Go to the documentation of this file.00001 #include "CalibTracker/SiStripAPVAnalysis/interface/ApvAnalysis.h"
00002 #include "CalibTracker/SiStripAPVAnalysis/interface/TkApvMask.h"
00003 #include "CalibTracker/SiStripAPVAnalysis/interface/TkNoiseCalculator.h"
00004 #include "CalibTracker/SiStripAPVAnalysis/interface/TkPedestalCalculator.h"
00005 #include "CalibTracker/SiStripAPVAnalysis/interface/TkCommonModeCalculator.h"
00006 #include <algorithm>
00007
00008 using namespace std;
00009 ApvAnalysis::ApvAnalysis(int nEvForUpdate)
00010 {
00011
00012 theTkCommonModeCalculator =0;
00013 theTkPedestalCalculator =0;
00014 theTkNoiseCalculator =0;
00015 theTkApvMask =0;
00016 nEventsForNoiseCalibration_ =0;
00017 eventsRequiredToUpdate_ = nEvForUpdate;
00018
00019
00020
00021 }
00022 void ApvAnalysis::newEvent() const{
00023 theTkPedestalCalculator->newEvent();
00024 theTkNoiseCalculator->newEvent();
00025 theTkCommonModeCalculator->newEvent();
00026 }
00027
00028 void ApvAnalysis::updateCalibration(edm::DetSet<SiStripRawDigi>& in) {
00029 theTkPedestalCalculator->updatePedestal(in);
00030
00031 PedestalType noise;
00032 if(theTkPedestalCalculator->status()->isUpdating()){
00033 nEventsForNoiseCalibration_++;
00034
00035 if(theTkNoiseCalculator->noise().size() == 0) {
00036 noise = theTkPedestalCalculator->rawNoise();
00037 theTkNoiseCalculator->setStripNoise(noise);
00038 theTkApvMask->calculateMask(noise);
00039 }
00040
00041 PedestalType pedestal= theTkPedestalCalculator->pedestal();
00042 PedestalType tmp;
00043 tmp.clear();
00044 edm::DetSet<SiStripRawDigi>::const_iterator it = in.data.begin();
00045 int i=0;
00046 for(;it!= in.data.end();it++){
00047 tmp.push_back((*it).adc() - pedestal[i]);
00048 i++;
00049 }
00050 PedestalType tmp2 = theTkCommonModeCalculator->doIt(tmp);
00051 if(tmp2.size() > 0) {
00052 theTkNoiseCalculator->updateNoise(tmp2);
00053 }
00054 if(nEventsForNoiseCalibration_%eventsRequiredToUpdate_ == 1 && nEventsForNoiseCalibration_ >1)
00055 {
00056
00057 noise=theTkNoiseCalculator->noise();
00058 theTkApvMask->calculateMask(noise);
00059
00060 }
00061 }
00062
00063
00064 }