CMS 3D CMS Logo

CalibrationSummaryFactory.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <sstream>
7 
8 using namespace sistrip;
9 
10 // -----------------------------------------------------------------------------
11 //
13  CalibrationAnalysis* anal = dynamic_cast<CalibrationAnalysis*>(iter->second);
14  if (!anal) {
15  return;
16  }
17 
18  std::vector<float> temp(128, 1. * sistrip::invalid_);
19  std::vector<std::vector<float> > amplitude(2, temp);
20  std::vector<std::vector<float> > baseline(2, temp);
21  std::vector<std::vector<float> > riseTime(2, temp);
22  std::vector<std::vector<float> > turnOn(2, temp);
23  std::vector<std::vector<float> > peakTime(2, temp);
24  std::vector<std::vector<float> > undershoot(2, temp);
25  std::vector<std::vector<float> > tail(2, temp);
26  std::vector<std::vector<float> > decayTime(2, temp);
27  std::vector<std::vector<float> > smearing(2, temp);
28  std::vector<std::vector<float> > chi2(2, temp);
29 
30  std::vector<std::vector<float> > value(2, temp);
31 
32  amplitude[0] = anal->amplitude()[0];
33  amplitude[1] = anal->amplitude()[1];
34  baseline[0] = anal->baseline()[0];
35  baseline[1] = anal->baseline()[1];
36  tail[0] = anal->tail()[0];
37  tail[1] = anal->tail()[1];
38  riseTime[0] = anal->riseTime()[0];
39  riseTime[1] = anal->riseTime()[1];
40  decayTime[0] = anal->decayTime()[0];
41  decayTime[1] = anal->decayTime()[1];
42  peakTime[0] = anal->peakTime()[0];
43  peakTime[1] = anal->peakTime()[1];
44  turnOn[0] = anal->turnOn()[0];
45  turnOn[1] = anal->turnOn()[1];
46  undershoot[0] = anal->undershoot()[0];
47  undershoot[1] = anal->undershoot()[1];
48  smearing[0] = anal->smearing()[0];
49  smearing[1] = anal->smearing()[1];
50  chi2[0] = anal->chi2()[0];
51  chi2[1] = anal->chi2()[1];
52 
53  SiStripFecKey lldKey = SiStripFecKey(iter->first);
54 
55  uint32_t key1 = SiStripFecKey(lldKey.fecCrate(),
56  lldKey.fecSlot(),
57  lldKey.fecRing(),
58  lldKey.ccuAddr(),
59  lldKey.ccuChan(),
60  lldKey.lldChan(),
61  lldKey.i2cAddr(lldKey.lldChan(), true))
62  .key();
63 
64  uint32_t key2 = SiStripFecKey(lldKey.fecCrate(),
65  lldKey.fecSlot(),
66  lldKey.fecRing(),
67  lldKey.ccuAddr(),
68  lldKey.ccuChan(),
69  lldKey.lldChan(),
70  lldKey.i2cAddr(lldKey.lldChan(), false))
71  .key();
72 
73  bool all_strips = false;
75  all_strips = true;
76  uint16_t bins = amplitude[amplitude[0].size() < amplitude[1].size() ? 1 : 0].size();
77  for (uint16_t i = 0; i < bins; i++) {
78  value[0][i] = amplitude[0][i];
79  value[1][i] = amplitude[1][i];
80  }
81  } else if (mon_ == sistrip::CALIBRATION_BASELINE_ALL_STRIPS) {
82  all_strips = true;
83  uint16_t bins = baseline[baseline[0].size() < baseline[1].size() ? 1 : 0].size();
84  for (uint16_t i = 0; i < bins; i++) {
85  value[0][i] = baseline[0][i];
86  value[1][i] = baseline[1][i];
87  }
88  } else if (mon_ == sistrip::CALIBRATION_TURNON_ALL_STRIPS) {
89  all_strips = true;
90  uint16_t bins = turnOn[turnOn[0].size() < turnOn[1].size() ? 1 : 0].size();
91  for (uint16_t i = 0; i < bins; i++) {
92  value[0][i] = turnOn[0][i];
93  value[1][i] = turnOn[1][i];
94  }
95  } else if (mon_ == sistrip::CALIBRATION_RISETIME_ALL_STRIPS) {
96  all_strips = true;
97  uint16_t bins = riseTime[riseTime[0].size() < riseTime[1].size() ? 1 : 0].size();
98  for (uint16_t i = 0; i < bins; i++) {
99  value[0][i] = riseTime[0][i];
100  value[1][i] = riseTime[1][i];
101  }
102  } else if (mon_ == sistrip::CALIBRATION_DECAYTIME_ALL_STRIPS) {
103  all_strips = true;
104  uint16_t bins = decayTime[decayTime[0].size() < decayTime[1].size() ? 1 : 0].size();
105  for (uint16_t i = 0; i < bins; i++) {
106  value[0][i] = decayTime[0][i];
107  value[1][i] = decayTime[1][i];
108  }
109  } else if (mon_ == sistrip::CALIBRATION_PEAKTIME_ALL_STRIPS) {
110  all_strips = true;
111  uint16_t bins = peakTime[peakTime[0].size() < peakTime[1].size() ? 1 : 0].size();
112  for (uint16_t i = 0; i < bins; i++) {
113  value[0][i] = peakTime[0][i];
114  value[1][i] = peakTime[1][i];
115  }
116  } else if (mon_ == sistrip::CALIBRATION_UNDERSHOOT_ALL_STRIPS) {
117  all_strips = true;
118  uint16_t bins = undershoot[undershoot[0].size() < undershoot[1].size() ? 1 : 0].size();
119  for (uint16_t i = 0; i < bins; i++) {
120  value[0][i] = undershoot[0][i];
121  value[1][i] = undershoot[1][i];
122  }
123  } else if (mon_ == sistrip::CALIBRATION_TAIL_ALL_STRIPS) {
124  all_strips = true;
125  uint16_t bins = tail[tail[0].size() < tail[1].size() ? 1 : 0].size();
126  for (uint16_t i = 0; i < bins; i++) {
127  value[0][i] = tail[0][i];
128  value[1][i] = tail[1][i];
129  }
130  } else if (mon_ == sistrip::CALIBRATION_SMEARING_ALL_STRIPS) {
131  all_strips = true;
132  uint16_t bins = smearing[smearing[0].size() < smearing[1].size() ? 1 : 0].size();
133  for (uint16_t i = 0; i < bins; i++) {
134  value[0][i] = smearing[0][i];
135  value[1][i] = smearing[1][i];
136  }
137  } else if (mon_ == sistrip::CALIBRATION_CHI2_ALL_STRIPS) {
138  all_strips = true;
139  uint16_t bins = chi2[chi2[0].size() < chi2[1].size() ? 1 : 0].size();
140  for (uint16_t i = 0; i < bins; i++) {
141  value[0][i] = chi2[0][i];
142  value[1][i] = chi2[1][i];
143  }
144  }
146  else if (mon_ == sistrip::CALIBRATION_AMPLITUDE_MEAN) {
147  value[0][0] = anal->amplitudeMean()[0];
148  value[1][0] = anal->amplitudeMean()[1];
149  } else if (mon_ == sistrip::CALIBRATION_BASELINE_MEAN) {
150  value[0][0] = anal->baselineMean()[0];
151  value[1][0] = anal->baselineMean()[1];
152  } else if (mon_ == sistrip::CALIBRATION_TURNON_MEAN) {
153  value[0][0] = anal->turnOnMean()[0];
154  value[1][0] = anal->turnOnMean()[1];
155  } else if (mon_ == sistrip::CALIBRATION_RISETIME_MEAN) {
156  value[0][0] = anal->riseTimeMean()[0];
157  value[1][0] = anal->riseTimeMean()[1];
158  } else if (mon_ == sistrip::CALIBRATION_DECAYTIME_MEAN) {
159  value[0][0] = anal->decayTimeMean()[0];
160  value[1][0] = anal->decayTimeMean()[1];
161  } else if (mon_ == sistrip::CALIBRATION_PEAKTIME_MEAN) {
162  value[0][0] = anal->peakTimeMean()[0];
163  value[1][0] = anal->peakTimeMean()[1];
164  } else if (mon_ == sistrip::CALIBRATION_UNDERSHOOT_MEAN) {
165  value[0][0] = anal->undershootMean()[0];
166  value[1][0] = anal->undershootMean()[1];
167  } else if (mon_ == sistrip::CALIBRATION_TAIL_MEAN) {
168  value[0][0] = anal->tailMean()[0];
169  value[1][0] = anal->tailMean()[1];
170  } else if (mon_ == sistrip::CALIBRATION_SMEARING_MEAN) {
171  value[0][0] = anal->smearingMean()[0];
172  value[1][0] = anal->smearingMean()[1];
173  } else if (mon_ == sistrip::CALIBRATION_CHI2_MEAN) {
174  value[0][0] = anal->chi2Mean()[0];
175  value[1][0] = anal->chi2Mean()[1];
176  }
178  else if (mon_ == sistrip::CALIBRATION_AMPLITUDE_MIN) {
179  value[0][0] = anal->amplitudeMin()[0];
180  value[1][0] = anal->amplitudeMin()[1];
181  } else if (mon_ == sistrip::CALIBRATION_BASELINE_MIN) {
182  value[0][0] = anal->baselineMin()[0];
183  value[1][0] = anal->baselineMin()[1];
184  } else if (mon_ == sistrip::CALIBRATION_TURNON_MIN) {
185  value[0][0] = anal->turnOnMin()[0];
186  value[1][0] = anal->turnOnMin()[1];
187  } else if (mon_ == sistrip::CALIBRATION_RISETIME_MIN) {
188  value[0][0] = anal->riseTimeMin()[0];
189  value[1][0] = anal->riseTimeMin()[1];
190  } else if (mon_ == sistrip::CALIBRATION_DECAYTIME_MIN) {
191  value[0][0] = anal->decayTimeMin()[0];
192  value[1][0] = anal->decayTimeMin()[1];
193  } else if (mon_ == sistrip::CALIBRATION_PEAKTIME_MIN) {
194  value[0][0] = anal->peakTimeMin()[0];
195  value[1][0] = anal->peakTimeMin()[1];
196  } else if (mon_ == sistrip::CALIBRATION_UNDERSHOOT_MIN) {
197  value[0][0] = anal->undershootMin()[0];
198  value[1][0] = anal->undershootMin()[1];
199  } else if (mon_ == sistrip::CALIBRATION_TAIL_MIN) {
200  value[0][0] = anal->tailMin()[0];
201  value[1][0] = anal->tailMin()[1];
202  } else if (mon_ == sistrip::CALIBRATION_SMEARING_MIN) {
203  value[0][0] = anal->smearingMin()[0];
204  value[1][0] = anal->smearingMin()[1];
205  } else if (mon_ == sistrip::CALIBRATION_CHI2_MIN) {
206  value[0][0] = anal->chi2Min()[0];
207  value[1][0] = anal->chi2Min()[1];
208  }
210  else if (mon_ == sistrip::CALIBRATION_AMPLITUDE_MAX) {
211  value[0][0] = anal->amplitudeMax()[0];
212  value[1][0] = anal->amplitudeMax()[1];
213  } else if (mon_ == sistrip::CALIBRATION_BASELINE_MAX) {
214  value[0][0] = anal->baselineMax()[0];
215  value[1][0] = anal->baselineMax()[1];
216  } else if (mon_ == sistrip::CALIBRATION_TURNON_MAX) {
217  value[0][0] = anal->turnOnMax()[0];
218  value[1][0] = anal->turnOnMax()[1];
219  } else if (mon_ == sistrip::CALIBRATION_RISETIME_MAX) {
220  value[0][0] = anal->riseTimeMax()[0];
221  value[1][0] = anal->riseTimeMax()[1];
222  } else if (mon_ == sistrip::CALIBRATION_DECAYTIME_MAX) {
223  value[0][0] = anal->decayTimeMax()[0];
224  value[1][0] = anal->decayTimeMax()[1];
225  } else if (mon_ == sistrip::CALIBRATION_PEAKTIME_MAX) {
226  value[0][0] = anal->peakTimeMax()[0];
227  value[1][0] = anal->peakTimeMax()[1];
228  } else if (mon_ == sistrip::CALIBRATION_UNDERSHOOT_MAX) {
229  value[0][0] = anal->undershootMax()[0];
230  value[1][0] = anal->undershootMax()[1];
231  } else if (mon_ == sistrip::CALIBRATION_TAIL_MAX) {
232  value[0][0] = anal->tailMax()[0];
233  value[1][0] = anal->tailMax()[1];
234  } else if (mon_ == sistrip::CALIBRATION_SMEARING_MAX) {
235  value[0][0] = anal->smearingMax()[0];
236  value[1][0] = anal->smearingMax()[1];
237  } else if (mon_ == sistrip::CALIBRATION_CHI2_MAX) {
238  value[0][0] = anal->chi2Max()[0];
239  value[1][0] = anal->chi2Max()[1];
240  }
242  else if (mon_ == sistrip::CALIBRATION_AMPLITUDE_SPREAD) {
243  value[0][0] = anal->amplitudeSpread()[0];
244  value[1][0] = anal->amplitudeSpread()[1];
245  } else if (mon_ == sistrip::CALIBRATION_BASELINE_SPREAD) {
246  value[0][0] = anal->baselineSpread()[0];
247  value[1][0] = anal->baselineSpread()[1];
248  } else if (mon_ == sistrip::CALIBRATION_TURNON_SPREAD) {
249  value[0][0] = anal->turnOnSpread()[0];
250  value[1][0] = anal->turnOnSpread()[1];
251  } else if (mon_ == sistrip::CALIBRATION_RISETIME_SPREAD) {
252  value[0][0] = anal->riseTimeSpread()[0];
253  value[1][0] = anal->riseTimeSpread()[1];
254  } else if (mon_ == sistrip::CALIBRATION_DECAYTIME_SPREAD) {
255  value[0][0] = anal->decayTimeSpread()[0];
256  value[1][0] = anal->decayTimeSpread()[1];
257  } else if (mon_ == sistrip::CALIBRATION_PEAKTIME_SPREAD) {
258  value[0][0] = anal->peakTimeSpread()[0];
259  value[1][0] = anal->peakTimeSpread()[1];
260  } else if (mon_ == sistrip::CALIBRATION_UNDERSHOOT_SPREAD) {
261  value[0][0] = anal->undershootSpread()[0];
262  value[1][0] = anal->undershootSpread()[1];
263  } else if (mon_ == sistrip::CALIBRATION_TAIL_SPREAD) {
264  value[0][0] = anal->tailSpread()[0];
265  value[1][0] = anal->tailSpread()[1];
266  } else if (mon_ == sistrip::CALIBRATION_SMEARING_SPREAD) {
267  value[0][0] = anal->smearingSpread()[0];
268  value[1][0] = anal->smearingSpread()[1];
269  } else if (mon_ == sistrip::CALIBRATION_CHI2_SPREAD) {
270  value[0][0] = anal->chi2Spread()[0];
271  value[1][0] = anal->chi2Spread()[1];
272  } else {
273  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
274  << " Unexpected monitorable: "
276  return;
277  }
278 
279  if (!all_strips) {
282 
285  } else {
286  for (uint16_t istr = 0; istr < value[0].size(); istr++)
289 
290  for (uint16_t istr = 0; istr < value[1].size(); istr++)
293  }
294 
295  format();
296 }
297 
298 //------------------------------------------------------------------------------
299 //
301  // Histogram formatting
305  generator_->axisLabel("Amplitude (ADC)");
306 
310  generator_->axisLabel("Baseline (ADC)");
311 
315  generator_->axisLabel("Turn-On (ns)");
316 
320  generator_->axisLabel("Tail (%)");
321 
325  generator_->axisLabel("Rise Time (ns)");
326 
330  generator_->axisLabel("Peak Time (ns)");
331 
335  generator_->axisLabel("Decay Time (ns)");
336 
340  generator_->axisLabel("Smearing (ns)");
341 
345  generator_->axisLabel("Chi2/ndf");
346 
350  generator_->axisLabel("Undershoot (%)");
351 
352  else {
353  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
354  << " Unexpected SummaryHisto value:"
356  }
357 }
static std::string monitorable(const sistrip::Monitorable &)
sistrip::Monitorable mon_
const uint16_t & ccuAddr() const
const uint16_t & ccuChan() const
const uint16_t & lldChan() const
sistrip classes
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
void fillMap(const std::string &top_level_dir, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error=0.)
Analysis for calibration runs.
const uint16_t & i2cAddr() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
const uint32_t & key() const
Definition: SiStripKey.h:120
Definition: value.py:1
sistrip::Granularity gran_
static const char mlSummaryPlots_[]
SummaryGenerator * generator_
static const uint16_t invalid_
Definition: Constants.h:16
const uint16_t & fecSlot() const
Log< level::Warning, false > LogWarning
const uint16_t & fecRing() const
const uint16_t & fecCrate() const