00001 #include "TrimRangeTestResult.h"
00002 #include "DefaultVariable.h"
00003 #include "mVThresholdVariable.h"
00004
00005 #include "Sct/SctParameters.h"
00006 #include <CommonWithDsp/ABCD/ABCDscans.h>
00007 #include <boost/shared_ptr.hpp>
00008
00009 namespace SctData{
00010
00011 string TrimRangeTestResult::getClassName() const throw(){
00012 return string("SctData::TrimRangeTestResult");
00013 }
00014
00015 TrimRangeTestResult::TrimRangeTestResult() throw() : chipTrimData(nChipModule), chipTrim(nChipModule),
00016 charge(0), type(0), algorithm(0) {}
00017
00018 TrimRangeTestResult::TrimRangeTestResult(unsigned int runNumber, const string& moduleName) throw()
00019 : TestResult(runNumber, moduleName, mVThresholdVariable::instance(), *DefaultVariable::instance(ST_TRIM)),
00020 chipTrimData(nChipModule), chipTrim(nChipModule), charge(0), type(0), algorithm(0) {}
00021
00022 TrimRangeTestResult::~TrimRangeTestResult() throw() {}
00023
00024 string TrimRangeTestResult::Trim::getClassName() const throw(){
00025 return string("SctData::TrimRangeTestResult::Trim");
00026 }
00027
00028 string TrimRangeTestResult::TrimData::getClassName() const throw(){
00029 return string("SctData::TrimRangeTestResult::TrimData");
00030 }
00031
00032 string TrimRangeTestResult::ChipTrim::getClassName() const throw(){
00033 return string("SctData::TrimRangeTestResult::ChipTrim");
00034 }
00035
00036 string TrimRangeTestResult::ChipTrimData::getClassName() const throw(){
00037 return string("SctData::TrimRangeTestResult::ChipTrimData");
00038 }
00039
00040 const Stats<double> TrimRangeTestResult::ChipTrimData::getOffsets() const throw() {
00041 Stats<double> offset(nChannelChip);
00042 offset.resize(nChannelChip);
00043 for (unsigned i=0; i<nChannelChip; ++i){
00044 offset.modifyAt(i).valid = (channelData.getAt(i).valid && channelData.getAt(i).value.p1 != 0);
00045 if (offset.getAt(i).valid) {
00046 offset.modifyAt(i).value=channelData.getAt(i).value.p0;
00047 }
00048 }
00049 return offset;
00050 }
00051
00052 const Stats<double> TrimRangeTestResult::ChipTrimData::getSteps() const throw() {
00053 Stats<double> step;
00054 step.resize(nChannelChip);
00055 for (unsigned i=0; i<nChannelChip; ++i){
00056 step.modifyAt(i).valid = (channelData.getAt(i).valid && channelData.getAt(i).value.p1 != 0);
00057 if (step.getAt(i).valid){
00058 step.modifyAt(i).value = 1./channelData.getAt(i).value.p1;
00059 }
00060 }
00061 return step;
00062 }
00063
00064 }