test
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 //
23  (const ApvAnalysis::PedestalType& _indat)
24 {
25  ApvAnalysis::PedestalType indat = _indat;
27  calculateCommonMode(indat);
28  int setNumber;
29  if(theCommonModeValues.size() >0) {
30  for (unsigned int i=0; i<indat.size(); i++){
31  setNumber = theTkCommonMode->topology().setOfStrip(i);
32  out.push_back(indat[i] - theCommonModeValues[setNumber]);
33  }
34  }else{
35  out = indat;
36  }
37  return out;
38 }
39 //
40 // Calculation of Common Mode Values :
41 //
43 {
44  if (alreadyUsedEvent == false) {
45  alreadyUsedEvent = true;
46 
47  theCommonModeValues.clear();
48 
49 
50  double avVal = 0.0;
51 
52  sort(indat.begin(),indat.end());
53 
54  uint16_t index = indat.size()%2 ? indat.size()/2 : indat.size()/2-1;
55  if ( !indat.empty() ) { avVal = indat[index]; }
56 
57  theCommonModeValues.push_back(static_cast<float>(avVal));
58 
60 
61  }
62 
63 }
64 
65 //
66 // Define New Event
67 //
69  alreadyUsedEvent = false;
70 }
int i
Definition: DBlmapReader.cc:9
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
void calculateCommonMode(ApvAnalysis::PedestalType &)
ApvAnalysis::PedestalType doIt(const ApvAnalysis::PedestalType &)
std::vector< float > theCommonModeValues
tuple out
Definition: dbtoconf.py:99
tuple cout
Definition: gather_cfg.py:121
volatile std::atomic< bool > shutdown_flag false