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 
14  CalibrationAnalysis* anal = dynamic_cast<CalibrationAnalysis*>( iter->second );
15  if ( !anal ) { return; }
16 
17  std::vector<float> temp(128, 1. * sistrip::invalid_ );
18  std::vector< std::vector<float> > amplitude( 2, temp );
19  std::vector< std::vector<float> > baseline( 2, temp );
20  std::vector< std::vector<float> > riseTime( 2, temp );
21  std::vector< std::vector<float> > turnOn( 2, temp );
22  std::vector< std::vector<float> > peakTime( 2, temp );
23  std::vector< std::vector<float> > undershoot( 2, temp );
24  std::vector< std::vector<float> > tail( 2, temp );
25  std::vector< std::vector<float> > decayTime( 2, temp );
26  std::vector< std::vector<float> > smearing( 2, temp );
27  std::vector< std::vector<float> > chi2( 2, temp );
28 
29  std::vector< std::vector<float> > value (2, temp);
30 
31  amplitude[0] = anal->amplitude()[0];
32  amplitude[1] = anal->amplitude()[1];
33  baseline[0] = anal->baseline()[0];
34  baseline[1] = anal->baseline()[1];
35  tail[0] = anal->tail()[0];
36  tail[1] = anal->tail()[1];
37  riseTime[0] = anal->riseTime()[0];
38  riseTime[1] = anal->riseTime()[1];
39  decayTime[0] = anal->decayTime()[0];
40  decayTime[1] = anal->decayTime()[1];
41  peakTime[0] = anal->peakTime()[0];
42  peakTime[1] = anal->peakTime()[1];
43  turnOn[0] = anal->turnOn()[0];
44  turnOn[1] = anal->turnOn()[1];
45  undershoot[0] = anal->undershoot()[0];
46  undershoot[1] = anal->undershoot()[1];
47  smearing[0] = anal->smearing()[0];
48  smearing[1] = anal->smearing()[1];
49  chi2[0] = anal->chi2()[0];
50  chi2[1] = anal->chi2()[1];
51 
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)).key();
62 
63  uint32_t key2 = SiStripFecKey(lldKey.fecCrate(),
64  lldKey.fecSlot(),
65  lldKey.fecRing(),
66  lldKey.ccuAddr(),
67  lldKey.ccuChan(),
68  lldKey.lldChan(),
69  lldKey.i2cAddr(lldKey.lldChan(),false)).key();
70 
71  bool all_strips = false;
73  all_strips = true;
74  uint16_t bins = amplitude[amplitude[0].size() < amplitude[1].size() ? 1 : 0].size();
75  for ( uint16_t i = 0; i < bins; i++ ) {
76  value[0][i] = amplitude[0][i];
77  value[1][i] = amplitude[1][i];
78  }
79  }
80  else if ( mon_ == sistrip::CALIBRATION_BASELINE_ALL_STRIPS) {
81  all_strips = true;
82  uint16_t bins = baseline[baseline[0].size() < baseline[1].size() ? 1 : 0].size();
83  for ( uint16_t i = 0; i < bins; i++ ) {
84  value[0][i] = baseline[0][i];
85  value[1][i] = baseline[1][i];
86  }
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  }
96  else if ( mon_ == sistrip::CALIBRATION_RISETIME_ALL_STRIPS) {
97  all_strips = true;
98  uint16_t bins = riseTime[riseTime[0].size() < riseTime[1].size() ? 1 : 0].size();
99  for ( uint16_t i = 0; i < bins; i++ ) {
100  value[0][i] = riseTime[0][i];
101  value[1][i] = riseTime[1][i];
102  }
103  }
104  else if ( mon_ == sistrip::CALIBRATION_DECAYTIME_ALL_STRIPS) {
105  all_strips = true;
106  uint16_t bins = decayTime[decayTime[0].size() < decayTime[1].size() ? 1 : 0].size();
107  for ( uint16_t i = 0; i < bins; i++ ) {
108  value[0][i] = decayTime[0][i];
109  value[1][i] = decayTime[1][i];
110  }
111  }
112  else if ( mon_ == sistrip::CALIBRATION_PEAKTIME_ALL_STRIPS) {
113  all_strips = true;
114  uint16_t bins = peakTime[peakTime[0].size() < peakTime[1].size() ? 1 : 0].size();
115  for ( uint16_t i = 0; i < bins; i++ ) {
116  value[0][i] = peakTime[0][i];
117  value[1][i] = peakTime[1][i];
118  }
119  }
120  else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_ALL_STRIPS) {
121  all_strips = true;
122  uint16_t bins = undershoot[undershoot[0].size() < undershoot[1].size() ? 1 : 0].size();
123  for ( uint16_t i = 0; i < bins; i++ ) {
124  value[0][i] = undershoot[0][i];
125  value[1][i] = undershoot[1][i];
126  }
127  }
128  else if ( mon_ == sistrip::CALIBRATION_TAIL_ALL_STRIPS) {
129  all_strips = true;
130  uint16_t bins = tail[tail[0].size() < tail[1].size() ? 1 : 0].size();
131  for ( uint16_t i = 0; i < bins; i++ ) {
132  value[0][i] = tail[0][i];
133  value[1][i] = tail[1][i];
134  }
135  }
136  else if ( mon_ == sistrip::CALIBRATION_SMEARING_ALL_STRIPS) {
137  all_strips = true;
138  uint16_t bins = smearing[smearing[0].size() < smearing[1].size() ? 1 : 0].size();
139  for ( uint16_t i = 0; i < bins; i++ ) {
140  value[0][i] = smearing[0][i];
141  value[1][i] = smearing[1][i];
142  }
143  }
144  else if ( mon_ == sistrip::CALIBRATION_CHI2_ALL_STRIPS) {
145  all_strips = true;
146  uint16_t bins = chi2[chi2[0].size() < chi2[1].size() ? 1 : 0].size();
147  for ( uint16_t i = 0; i < bins; i++ ) {
148  value[0][i] = chi2[0][i];
149  value[1][i] = chi2[1][i];
150  }
151  }
153  else if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_MEAN) {
154  value[0][0] = anal->amplitudeMean()[0];
155  value[1][0] = anal->amplitudeMean()[1];
156  }
157  else if ( mon_ == sistrip::CALIBRATION_BASELINE_MEAN) {
158  value[0][0] = anal->baselineMean()[0];
159  value[1][0] = anal->baselineMean()[1];
160  }
161  else if ( mon_ == sistrip::CALIBRATION_TURNON_MEAN) {
162  value[0][0] = anal->turnOnMean()[0];
163  value[1][0] = anal->turnOnMean()[1];
164  }
165  else if ( mon_ == sistrip::CALIBRATION_RISETIME_MEAN) {
166  value[0][0] = anal->riseTimeMean()[0];
167  value[1][0] = anal->riseTimeMean()[1];
168  }
169  else if ( mon_ == sistrip::CALIBRATION_DECAYTIME_MEAN) {
170  value[0][0] = anal->decayTimeMean()[0];
171  value[1][0] = anal->decayTimeMean()[1];
172  }
173  else if ( mon_ == sistrip::CALIBRATION_PEAKTIME_MEAN) {
174  value[0][0] = anal->peakTimeMean()[0];
175  value[1][0] = anal->peakTimeMean()[1];
176  }
177  else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_MEAN) {
178  value[0][0] = anal->undershootMean()[0];
179  value[1][0] = anal->undershootMean()[1];
180  }
181  else if ( mon_ == sistrip::CALIBRATION_TAIL_MEAN) {
182  value[0][0] = anal->tailMean()[0];
183  value[1][0] = anal->tailMean()[1];
184  }
185  else if ( mon_ == sistrip::CALIBRATION_SMEARING_MEAN) {
186  value[0][0] = anal->smearingMean()[0];
187  value[1][0] = anal->smearingMean()[1];
188  }
189  else if ( mon_ == sistrip::CALIBRATION_CHI2_MEAN) {
190  value[0][0] = anal->chi2Mean()[0];
191  value[1][0] = anal->chi2Mean()[1];
192  }
194  else if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_MIN) {
195  value[0][0] = anal->amplitudeMin()[0];
196  value[1][0] = anal->amplitudeMin()[1];
197  }
198  else if ( mon_ == sistrip::CALIBRATION_BASELINE_MIN) {
199  value[0][0] = anal->baselineMin()[0];
200  value[1][0] = anal->baselineMin()[1];
201  }
202  else if ( mon_ == sistrip::CALIBRATION_TURNON_MIN) {
203  value[0][0] = anal->turnOnMin()[0];
204  value[1][0] = anal->turnOnMin()[1];
205  }
206  else if ( mon_ == sistrip::CALIBRATION_RISETIME_MIN) {
207  value[0][0] = anal->riseTimeMin()[0];
208  value[1][0] = anal->riseTimeMin()[1];
209  }
210  else if ( mon_ == sistrip::CALIBRATION_DECAYTIME_MIN) {
211  value[0][0] = anal->decayTimeMin()[0];
212  value[1][0] = anal->decayTimeMin()[1];
213  }
214  else if ( mon_ == sistrip::CALIBRATION_PEAKTIME_MIN) {
215  value[0][0] = anal->peakTimeMin()[0];
216  value[1][0] = anal->peakTimeMin()[1];
217  }
218  else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_MIN) {
219  value[0][0] = anal->undershootMin()[0];
220  value[1][0] = anal->undershootMin()[1];
221  }
222  else if ( mon_ == sistrip::CALIBRATION_TAIL_MIN) {
223  value[0][0] = anal->tailMin()[0];
224  value[1][0] = anal->tailMin()[1];
225  }
226  else if ( mon_ == sistrip::CALIBRATION_SMEARING_MIN) {
227  value[0][0] = anal->smearingMin()[0];
228  value[1][0] = anal->smearingMin()[1];
229  }
230  else if ( mon_ == sistrip::CALIBRATION_CHI2_MIN) {
231  value[0][0] = anal->chi2Min()[0];
232  value[1][0] = anal->chi2Min()[1];
233  }
235  else if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_MAX) {
236  value[0][0] = anal->amplitudeMax()[0];
237  value[1][0] = anal->amplitudeMax()[1];
238  }
239  else if ( mon_ == sistrip::CALIBRATION_BASELINE_MAX) {
240  value[0][0] = anal->baselineMax()[0];
241  value[1][0] = anal->baselineMax()[1];
242  }
243  else if ( mon_ == sistrip::CALIBRATION_TURNON_MAX) {
244  value[0][0] = anal->turnOnMax()[0];
245  value[1][0] = anal->turnOnMax()[1];
246  }
247  else if ( mon_ == sistrip::CALIBRATION_RISETIME_MAX) {
248  value[0][0] = anal->riseTimeMax()[0];
249  value[1][0] = anal->riseTimeMax()[1];
250  }
251  else if ( mon_ == sistrip::CALIBRATION_DECAYTIME_MAX) {
252  value[0][0] = anal->decayTimeMax()[0];
253  value[1][0] = anal->decayTimeMax()[1];
254  }
255  else if ( mon_ == sistrip::CALIBRATION_PEAKTIME_MAX) {
256  value[0][0] = anal->peakTimeMax()[0];
257  value[1][0] = anal->peakTimeMax()[1];
258  }
259  else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_MAX) {
260  value[0][0] = anal->undershootMax()[0];
261  value[1][0] = anal->undershootMax()[1];
262  }
263  else if ( mon_ == sistrip::CALIBRATION_TAIL_MAX) {
264  value[0][0] = anal->tailMax()[0];
265  value[1][0] = anal->tailMax()[1];
266  }
267  else if ( mon_ == sistrip::CALIBRATION_SMEARING_MAX) {
268  value[0][0] = anal->smearingMax()[0];
269  value[1][0] = anal->smearingMax()[1];
270  }
271  else if ( mon_ == sistrip::CALIBRATION_CHI2_MAX) {
272  value[0][0] = anal->chi2Max()[0];
273  value[1][0] = anal->chi2Max()[1];
274  }
276  else if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_SPREAD) {
277  value[0][0] = anal->amplitudeSpread()[0];
278  value[1][0] = anal->amplitudeSpread()[1];
279  }
280  else if ( mon_ == sistrip::CALIBRATION_BASELINE_SPREAD) {
281  value[0][0] = anal->baselineSpread()[0];
282  value[1][0] = anal->baselineSpread()[1];
283  }
284  else if ( mon_ == sistrip::CALIBRATION_TURNON_SPREAD) {
285  value[0][0] = anal->turnOnSpread()[0];
286  value[1][0] = anal->turnOnSpread()[1];
287  }
288  else if ( mon_ == sistrip::CALIBRATION_RISETIME_SPREAD) {
289  value[0][0] = anal->riseTimeSpread()[0];
290  value[1][0] = anal->riseTimeSpread()[1];
291  }
292  else if ( mon_ == sistrip::CALIBRATION_DECAYTIME_SPREAD) {
293  value[0][0] = anal->decayTimeSpread()[0];
294  value[1][0] = anal->decayTimeSpread()[1];
295  }
296  else if ( mon_ == sistrip::CALIBRATION_PEAKTIME_SPREAD) {
297  value[0][0] = anal->peakTimeSpread()[0];
298  value[1][0] = anal->peakTimeSpread()[1];
299  }
300  else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_SPREAD) {
301  value[0][0] = anal->undershootSpread()[0];
302  value[1][0] = anal->undershootSpread()[1];
303  }
304  else if ( mon_ == sistrip::CALIBRATION_TAIL_SPREAD) {
305  value[0][0] = anal->tailSpread()[0];
306  value[1][0] = anal->tailSpread()[1];
307  }
308  else if ( mon_ == sistrip::CALIBRATION_SMEARING_SPREAD) {
309  value[0][0] = anal->smearingSpread()[0];
310  value[1][0] = anal->smearingSpread()[1];
311  }
312  else if ( mon_ == sistrip::CALIBRATION_CHI2_SPREAD) {
313  value[0][0] = anal->chi2Spread()[0];
314  value[1][0] = anal->chi2Spread()[1];
315  }
316  else {
318  << "[SummaryPlotFactory::" << __func__ << "]"
319  << " Unexpected monitorable: "
321  return;
322  }
323 
324  if ( !all_strips ) {
327  key1,
328  value[0][0] );
329 
332  key2,
333  value[1][0] );
334  }
335  else {
336 
337  for ( uint16_t istr = 0; istr < value[0].size(); istr++ )
340  key1,
341  value[0][istr] );
342 
343  for ( uint16_t istr = 0; istr < value[1].size(); istr++ )
346  key2,
347  value[1][istr] );
348  }
349 
350  format();
351 }
352 
353 //------------------------------------------------------------------------------
354 //
356 
357  // Histogram formatting
363  generator_->axisLabel( "Amplitude (ADC)" );
364 
365  else if ( mon_ == sistrip::CALIBRATION_BASELINE_MEAN or
370  generator_->axisLabel( "Baseline (ADC)" );
371 
372  else if ( mon_ == sistrip::CALIBRATION_TURNON_MEAN or
377  generator_->axisLabel( "Turn-On (ns)" );
378 
379  else if ( mon_ == sistrip::CALIBRATION_TAIL_MEAN or
384  generator_->axisLabel( "Tail (%)" );
385 
386  else if ( mon_ == sistrip::CALIBRATION_RISETIME_MEAN or
391  generator_->axisLabel( "Rise Time (ns)" );
392 
393  else if ( mon_ == sistrip::CALIBRATION_PEAKTIME_MEAN or
398  generator_->axisLabel( "Peak Time (ns)" );
399 
400  else if ( mon_ == sistrip::CALIBRATION_DECAYTIME_MEAN or
405  generator_->axisLabel( "Decay Time (ns)" );
406 
407  else if ( mon_ == sistrip::CALIBRATION_SMEARING_MEAN or
412  generator_->axisLabel( "Smearing (ns)" );
413 
414  else if ( mon_ == sistrip::CALIBRATION_CHI2_MEAN or
419  generator_->axisLabel( "Chi2/ndf" );
420 
421  else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_MEAN or
426  generator_->axisLabel( "Undershoot (%)" );
427 
428  else {
430  << "[SummaryPlotFactory::" << __func__ << "]"
431  << " Unexpected SummaryHisto value:"
433  }
434 }
435 
static std::string monitorable(const sistrip::Monitorable &)
const VFloat & riseTimeSpread()
const VFloat & tailMin()
const VFloat & amplitudeMax()
const VFloat & turnOnMean()
const VFloat & smearingMean()
sistrip::Monitorable mon_
const uint16_t & fecRing() const
const VFloat & amplitudeMin()
const VFloat & amplitudeSpread()
const VFloat & riseTimeMax()
const VFloat & turnOnMax()
const VFloat & peakTimeMax()
const VFloat & undershootMean()
const uint16_t & lldChan() const
const VFloat & riseTimeMin()
const uint16_t & fecSlot() const
const VFloat & undershootMax()
const VFloat & tailMax()
const uint16_t & i2cAddr() const
const VFloat & baselineMax()
const VFloat & turnOnSpread()
sistrip classes
const VFloat & peakTimeMean()
const VFloat & chi2Mean()
const uint32_t & key() const
Definition: SiStripKey.h:125
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
const VFloat & decayTimeMin()
void fillMap(const std::string &top_level_dir, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error=0.)
const VFloat & tailMean()
Analysis for calibration runs.
const VFloat & chi2Spread()
const VFloat & decayTimeSpread()
const VFloat & baselineSpread()
const VVFloat & peakTime()
const VFloat & smearingMin()
const VFloat & turnOnMin()
const VFloat & amplitudeMean()
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 VVFloat & decayTime()
const VFloat & undershootSpread()
const VFloat & riseTimeMean()
format
Some error handling for the usage.
sistrip::Granularity gran_
const VFloat & smearingSpread()
const VFloat & baselineMean()
const VVFloat & chi2()
const uint16_t & fecCrate() const
static const char mlSummaryPlots_[]
const VVFloat & smearing()
const VFloat & peakTimeMin()
const VFloat & decayTimeMean()
const VFloat & tailSpread()
const VVFloat & riseTime()
const VVFloat & baseline()
SummaryGenerator * generator_
const VFloat & smearingMax()
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:16
const VFloat & chi2Max()
const VFloat & chi2Min()
const VFloat & baselineMin()
const uint16_t & ccuChan() const
const VVFloat & turnOn()
const VVFloat & tail()
const VFloat & decayTimeMax()
const VFloat & undershootMin()
const VFloat & peakTimeSpread()
const VVFloat & undershoot()
const VVFloat & amplitude()