CMS 3D CMS Logo

ApvAnalysis.cc
Go to the documentation of this file.
6 #include <algorithm>
7 
8 using namespace std;
9 ApvAnalysis::ApvAnalysis(int nEvForUpdate) {
10  theTkCommonModeCalculator = nullptr;
11  theTkPedestalCalculator = nullptr;
12  theTkNoiseCalculator = nullptr;
13  theTkApvMask = nullptr;
14  nEventsForNoiseCalibration_ = 0;
15  eventsRequiredToUpdate_ = nEvForUpdate;
16 }
17 void ApvAnalysis::newEvent() const {
18  theTkPedestalCalculator->newEvent();
19  theTkNoiseCalculator->newEvent();
20  theTkCommonModeCalculator->newEvent();
21 }
22 
24  theTkPedestalCalculator->updatePedestal(in);
25 
27  if (theTkPedestalCalculator->status()->isUpdating()) {
28  nEventsForNoiseCalibration_++;
29 
30  if (theTkNoiseCalculator->noise().empty()) {
31  noise = theTkPedestalCalculator->rawNoise();
32  theTkNoiseCalculator->setStripNoise(noise);
33  theTkApvMask->calculateMask(noise);
34  }
35 
36  PedestalType pedestal = theTkPedestalCalculator->pedestal();
38  tmp.clear();
40  int i = 0;
41  for (; it != in.data.end(); it++) {
42  tmp.push_back((*it).adc() - pedestal[i]);
43  i++;
44  }
45  PedestalType tmp2 = theTkCommonModeCalculator->doIt(tmp);
46  if (!tmp2.empty()) {
47  theTkNoiseCalculator->updateNoise(tmp2);
48  }
49  if (nEventsForNoiseCalibration_ % eventsRequiredToUpdate_ == 1 && nEventsForNoiseCalibration_ > 1) {
50  noise = theTkNoiseCalculator->noise();
51  theTkApvMask->calculateMask(noise);
52  }
53  }
54 }
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44
void updateCalibration(edm::DetSet< SiStripRawDigi > &in)
Definition: ApvAnalysis.cc:23
void newEvent() const
Definition: ApvAnalysis.cc:17
collection_type data
Definition: DetSet.h:81
ApvAnalysis(int nev)
Definition: ApvAnalysis.cc:9
collection_type::const_iterator const_iterator
Definition: DetSet.h:32
tmp
align.sh
Definition: createJobs.py:716