CMS 3D CMS Logo

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  if (false)
10  cout << "Constructing MedianCommonMode Calculator ..." << endl;
11  // cutToAvoidSignal = sig_cut;
12 }
13 //
14 // Destructor
15 //
17  if (false)
18  cout << "Destructing TT6CommonModeCalculator " << endl;
19 }
20 //
21 // Action :
22 //
24  ApvAnalysis::PedestalType indat = _indat;
26  calculateCommonMode(indat);
27  int setNumber;
28  if (!theCommonModeValues.empty()) {
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  if (alreadyUsedEvent == false) {
43  alreadyUsedEvent = true;
44 
45  theCommonModeValues.clear();
46 
47  double avVal = 0.0;
48 
49  sort(indat.begin(), indat.end());
50 
51  uint16_t index = indat.size() % 2 ? indat.size() / 2 : indat.size() / 2 - 1;
52  if (!indat.empty()) {
53  avVal = indat[index];
54  }
55 
56  theCommonModeValues.push_back(static_cast<float>(avVal));
57 
59  }
60 }
61 
62 //
63 // Define New Event
64 //
MedianCommonModeCalculator::~MedianCommonModeCalculator
~MedianCommonModeCalculator() override
Definition: MedianCommonModeCalculator.cc:16
mps_fire.i
i
Definition: mps_fire.py:355
funct::false
false
Definition: Factorize.h:34
TkCommonModeTopology::setOfStrip
int setOfStrip(int)
Definition: TkCommonModeTopology.cc:3
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MedianCommonModeCalculator::alreadyUsedEvent
bool alreadyUsedEvent
Definition: MedianCommonModeCalculator.h:31
MedianCommonModeCalculator.h
MedianCommonModeCalculator::doIt
ApvAnalysis::PedestalType doIt(const ApvAnalysis::PedestalType &) override
Definition: MedianCommonModeCalculator.cc:23
MedianCommonModeCalculator::MedianCommonModeCalculator
MedianCommonModeCalculator()
Definition: MedianCommonModeCalculator.cc:5
MedianCommonModeCalculator::setCM
void setCM(TkCommonMode *in) override
Definition: MedianCommonModeCalculator.h:19
MedianCommonModeCalculator::theTkCommonMode
TkCommonMode * theTkCommonMode
Definition: MedianCommonModeCalculator.h:29
MedianCommonModeCalculator::newEvent
void newEvent() override
Definition: MedianCommonModeCalculator.cc:65
std
Definition: JetResolutionObject.h:76
MedianCommonModeCalculator::theCommonModeValues
std::vector< float > theCommonModeValues
Definition: MedianCommonModeCalculator.h:30
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ApvAnalysis::PedestalType
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44
TkCommonMode::topology
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17
MedianCommonModeCalculator::calculateCommonMode
void calculateCommonMode(ApvAnalysis::PedestalType &)
Definition: MedianCommonModeCalculator.cc:41