CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MedianCommonModeCalculator.cc
Go to the documentation of this file.
2 #include <cmath>
3 
4 using namespace std;
6  // theNoiseCalculator(noise_calc),
7  // theApvMask(mask_calc),
8  alreadyUsedEvent(false)
9 {
10  if (0) cout << "Constructing MedianCommonMode Calculator ..." << endl;
11  // cutToAvoidSignal = sig_cut;
12 }
13 //
14 // Destructor
15 //
17  if (0) cout << "Destructing TT6CommonModeCalculator " << endl;
18 }
19 //
20 // Action :
21 //
24 {
26  calculateCommonMode(indat);
27  int setNumber;
28  if(theCommonModeValues.size() >0) {
29  for (unsigned int i=0; i<indat.size(); i++){
30  setNumber = theTkCommonMode->topology().setOfStrip(i);
31  out.push_back(indat[i] - theCommonModeValues[setNumber]);
32  }
33  }else{
34  out = indat;
35  }
36  return out;
37 }
38 //
39 // Calculation of Common Mode Values :
40 //
42 {
43  if (alreadyUsedEvent == false) {
44  alreadyUsedEvent = true;
45 
46  theCommonModeValues.clear();
47 
48 
49  double avVal = 0.0;
50 
51  sort(indat.begin(),indat.end());
52 
53  uint16_t index = indat.size()%2 ? indat.size()/2 : indat.size()/2-1;
54  if ( !indat.empty() ) { avVal = indat[index]; }
55 
56  theCommonModeValues.push_back(static_cast<float>(avVal));
57 
59 
60  }
61 
62 }
63 
64 //
65 // Define New Event
66 //
68  alreadyUsedEvent = false;
69 }
int i
Definition: DBlmapReader.cc:9
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
void calculateCommonMode(ApvAnalysis::PedestalType &)
std::vector< float > theCommonModeValues
tuple out
Definition: dbtoconf.py:99
tuple cout
Definition: gather_cfg.py:121
ApvAnalysis::PedestalType doIt(ApvAnalysis::PedestalType)