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