CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ApvAnalysis.cc
Go to the documentation of this file.
6 #include <algorithm>
7 
8 using namespace std;
9 ApvAnalysis::ApvAnalysis(int nEvForUpdate)
10 {
11 
12  theTkCommonModeCalculator =0;
13  theTkPedestalCalculator =0;
14  theTkNoiseCalculator =0;
15  theTkApvMask =0;
16  nEventsForNoiseCalibration_ =0;
17  eventsRequiredToUpdate_ = nEvForUpdate;
18 
19 
20 
21 }
22 void ApvAnalysis::newEvent() const{
23  theTkPedestalCalculator->newEvent();
24  theTkNoiseCalculator->newEvent();
25  theTkCommonModeCalculator->newEvent();
26 }
27 
29  theTkPedestalCalculator->updatePedestal(in);
30 
32  if(theTkPedestalCalculator->status()->isUpdating()){
33  nEventsForNoiseCalibration_++;
34 
35  if(theTkNoiseCalculator->noise().size() == 0) {
36  noise = theTkPedestalCalculator->rawNoise();
37  theTkNoiseCalculator->setStripNoise(noise);
38  theTkApvMask->calculateMask(noise);
39  }
40 
41  PedestalType pedestal= theTkPedestalCalculator->pedestal();
43  tmp.clear();
45  int i=0;
46  for(;it!= in.data.end();it++){
47  tmp.push_back((*it).adc() - pedestal[i]);
48  i++;
49  }
50  PedestalType tmp2 = theTkCommonModeCalculator->doIt(tmp);
51  if(tmp2.size() > 0) {
52  theTkNoiseCalculator->updateNoise(tmp2);
53  }
54  if(nEventsForNoiseCalibration_%eventsRequiredToUpdate_ == 1 && nEventsForNoiseCalibration_ >1)
55  {
56 
57  noise=theTkNoiseCalculator->noise();
58  theTkApvMask->calculateMask(noise);
59 
60  }
61  }
62 
63 
64 }
int i
Definition: DBlmapReader.cc:9
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
void updateCalibration(edm::DetSet< SiStripRawDigi > &in)
Definition: ApvAnalysis.cc:28
void newEvent() const
Definition: ApvAnalysis.cc:22
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
collection_type data
Definition: DetSet.h:78
ApvAnalysis(int nev)
Definition: ApvAnalysis.cc:9
collection_type::const_iterator const_iterator
Definition: DetSet.h:33