CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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> > value( 2, temp );
19  std::vector< std::vector<float> > error( 2, temp );
20  std::vector< std::vector<float> > amplitude( 2, temp );
21  std::vector< std::vector<float> > tail( 2, temp );
22  std::vector< std::vector<float> > riseTime( 2, temp );
23  std::vector< std::vector<float> > timeConstant( 2, temp );
24  std::vector< std::vector<float> > smearing( 2, temp );
25  std::vector< std::vector<float> > chi2( 2, temp );
26  amplitude[0] = anal->amplitude()[0];
27  amplitude[1] = anal->amplitude()[1];
28  tail[0] = anal->tail()[0];
29  tail[1] = anal->tail()[1];
30  riseTime[0] = anal->riseTime()[0];
31  riseTime[1] = anal->riseTime()[1];
32  timeConstant[0] = anal->timeConstant()[0];
33  timeConstant[1] = anal->timeConstant()[1];
34  smearing[0] = anal->smearing()[0];
35  smearing[1] = anal->smearing()[1];
36  chi2[0] = anal->chi2()[0];
37  chi2[1] = anal->chi2()[1];
38 
39  SiStripFecKey lldKey = SiStripFecKey(iter->first);
40  uint32_t key1 = SiStripFecKey(lldKey.fecCrate(),
41  lldKey.fecSlot(),
42  lldKey.fecRing(),
43  lldKey.ccuAddr(),
44  lldKey.ccuChan(),
45  lldKey.lldChan(),
46  lldKey.i2cAddr(lldKey.lldChan(),true)).key();
47  uint32_t key2 = SiStripFecKey(lldKey.fecCrate(),
48  lldKey.fecSlot(),
49  lldKey.fecRing(),
50  lldKey.ccuAddr(),
51  lldKey.ccuChan(),
52  lldKey.lldChan(),
53  lldKey.i2cAddr(lldKey.lldChan(),false)).key();
54 
55  bool all_strips = false;
56  bool with_error = false;
58  all_strips = true;
59  uint16_t bins = amplitude[amplitude[0].size() < amplitude[1].size() ? 1 : 0].size();
60  for ( uint16_t i = 0; i < bins; i++ ) {
61  value[0][i] = amplitude[0][i]/10.;
62  value[1][i] = amplitude[1][i]/10.;
63  }
64  } else if ( mon_ == sistrip::CALIBRATION_AMPLITUDE) {
65  with_error = true;
66  value[0][0] = anal->amplitudeMean()[0]/10.;
67  value[1][0] = anal->amplitudeMean()[1]/10.;
68  error[0][0] = anal->amplitudeSpread()[0]/10.;
69  error[1][0] = anal->amplitudeSpread()[1]/10.;
70  } else if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_MIN) {
71  value[0][0] = anal->amplitudeMin()[0]/10.;
72  value[1][0] = anal->amplitudeMin()[1]/10.;
73  } else if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_MAX) {
74  value[0][0] = anal->amplitudeMax()[0]/10.;
75  value[1][0] = anal->amplitudeMax()[1]/10.;
76  } else if ( mon_ == sistrip::CALIBRATION_TAIL_ALLSTRIPS) {
77  all_strips = true;
78  uint16_t bins = tail[tail[0].size() < tail[1].size() ? 1 : 0].size();
79  for ( uint16_t i = 0; i < bins; i++ ) {
80  value[0][i] = tail[0][i];
81  value[1][i] = tail[1][i];
82  }
83  } else if ( mon_ == sistrip::CALIBRATION_TAIL) {
84  with_error = true;
85  value[0][0] = anal->tailMean()[0];
86  value[1][0] = anal->tailMean()[1];
87  error[0][0] = anal->tailSpread()[0];
88  error[1][0] = anal->tailSpread()[1];
89  } else if ( mon_ == sistrip::CALIBRATION_TAIL_MIN) {
90  value[0][0] = anal->tailMin()[0];
91  value[1][0] = anal->tailMin()[1];
92  } else if ( mon_ == sistrip::CALIBRATION_TAIL_MAX) {
93  value[0][0] = anal->tailMax()[0];
94  value[1][0] = anal->tailMax()[1];
95  } else if ( mon_ == sistrip::CALIBRATION_RISETIME_ALLSTRIPS) {
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_RISETIME) {
103  with_error = true;
104  value[0][0] = anal->riseTimeMean()[0];
105  value[1][0] = anal->riseTimeMean()[1];
106  error[0][0] = anal->riseTimeSpread()[0];
107  error[1][0] = anal->riseTimeSpread()[1];
108  } else if ( mon_ == sistrip::CALIBRATION_RISETIME_MIN) {
109  value[0][0] = anal->riseTimeMin()[0];
110  value[1][0] = anal->riseTimeMin()[1];
111  } else if ( mon_ == sistrip::CALIBRATION_RISETIME_MAX) {
112  value[0][0] = anal->riseTimeMax()[0];
113  value[1][0] = anal->riseTimeMax()[1];
114  } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT_ALLSTRIPS) {
115  all_strips = true;
116  uint16_t bins = timeConstant[timeConstant[0].size() < timeConstant[1].size() ? 1 : 0].size();
117  for ( uint16_t i = 0; i < bins; i++ ) {
118  value[0][i] = timeConstant[0][i];
119  value[1][i] = timeConstant[1][i];
120  }
121  } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT) {
122  with_error = true;
123  value[0][0] = anal->timeConstantMean()[0];
124  value[1][0] = anal->timeConstantMean()[1];
125  error[0][0] = anal->timeConstantSpread()[0];
126  error[1][0] = anal->timeConstantSpread()[1];
127  } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT_MIN) {
128  value[0][0] = anal->timeConstantMin()[0];
129  value[1][0] = anal->timeConstantMin()[1];
130  } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT_MAX) {
131  value[0][0] = anal->timeConstantMax()[0];
132  value[1][0] = anal->timeConstantMax()[1];
133  } else if ( mon_ == sistrip::CALIBRATION_SMEARING_ALLSTRIPS) {
134  all_strips = true;
135  uint16_t bins = smearing[smearing[0].size() < smearing[1].size() ? 1 : 0].size();
136  for ( uint16_t i = 0; i < bins; i++ ) {
137  value[0][i] = smearing[0][i];
138  value[1][i] = smearing[1][i];
139  }
140  } else if ( mon_ == sistrip::CALIBRATION_SMEARING) {
141  with_error = true;
142  value[0][0] = anal->smearingMean()[0];
143  value[1][0] = anal->smearingMean()[1];
144  error[0][0] = anal->smearingSpread()[0];
145  error[1][0] = anal->smearingSpread()[1];
146  } else if ( mon_ == sistrip::CALIBRATION_SMEARING_MIN) {
147  value[0][0] = anal->smearingMin()[0];
148  value[1][0] = anal->smearingMin()[1];
149  } else if ( mon_ == sistrip::CALIBRATION_SMEARING_MAX) {
150  value[0][0] = anal->smearingMax()[0];
151  value[1][0] = anal->smearingMax()[1];
152  } else if ( mon_ == sistrip::CALIBRATION_CHI2_ALLSTRIPS) {
153  all_strips = true;
154  uint16_t bins = chi2[chi2[0].size() < chi2[1].size() ? 1 : 0].size();
155  for ( uint16_t i = 0; i < bins; i++ ) {
156  value[0][i] = chi2[0][i];
157  value[1][i] = chi2[1][i];
158  }
159  } else if ( mon_ == sistrip::CALIBRATION_CHI2) {
160  with_error = true;
161  value[0][0] = anal->chi2Mean()[0]/100.;
162  value[1][0] = anal->chi2Mean()[1]/100.;
163  error[0][0] = anal->chi2Spread()[0]/100.;
164  error[1][0] = anal->chi2Spread()[1]/100.;
165  } else if ( mon_ == sistrip::CALIBRATION_CHI2_MIN) {
166  value[0][0] = anal->chi2Min()[0]/100.;
167  value[1][0] = anal->chi2Min()[1]/100.;
168  } else if ( mon_ == sistrip::CALIBRATION_CHI2_MAX) {
169  value[0][0] = anal->chi2Max()[0]/100.;
170  value[1][0] = anal->chi2Max()[1]/100.;
171  } else {
173  << "[SummaryPlotFactory::" << __func__ << "]"
174  << " Unexpected monitorable: "
176  return;
177  }
178 
179  if ( !all_strips ) {
180  if( !with_error) {
183  key1,
184  value[0][0] );
185 
188  key2,
189  value[1][0] );
190  } else {
193  key1,
194  value[0][0],
195  error[0][0]);
196 
199  key2,
200  value[1][0],
201  error[1][0]);
202  }
203  } else {
204 
205  for ( uint16_t istr = 0; istr < value[0].size(); istr++ ) {
208  key1,
209  value[0][istr] );
210  }
211 
212  for ( uint16_t istr = 0; istr < value[1].size(); istr++ ) {
215  key2,
216  value[1][istr] );
217  }
218  }
219 }
220 
221 //------------------------------------------------------------------------------
222 //
224 
225  // Histogram formatting
226  if ( mon_ == sistrip::CALIBRATION_AMPLITUDE ) {
227  generator_->axisLabel( "Amplitude (ADC*Nevt/10.)" );
228  } else if ( mon_ == sistrip::CALIBRATION_TAIL ) {
229  generator_->axisLabel( "Tail (%)" );
230  } else if ( mon_ == sistrip::CALIBRATION_RISETIME ) {
231  generator_->axisLabel( "Rise time (ns)" );
232  } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT ) {
233  generator_->axisLabel( "Time constant (ns)" );
234  } else if ( mon_ == sistrip::CALIBRATION_SMEARING ) {
235  generator_->axisLabel( "Smearing (ns)" );
236  } else if ( mon_ == sistrip::CALIBRATION_CHI2 ) {
237  generator_->axisLabel( "Chi2/100." );
238  } else {
240  << "[SummaryPlotFactory::" << __func__ << "]"
241  << " Unexpected SummaryHisto value:"
243  }
244 
245 }
246 
static std::string monitorable(const sistrip::Monitorable &)
int i
Definition: DBlmapReader.cc:9
const VFloat & smearingMean() const
const VFloat & riseTimeSpread() const
const VVFloat & riseTime() const
sistrip::Monitorable mon_
const uint16_t & fecRing() const
const VFloat & amplitudeMean() const
const VFloat & amplitudeMin() const
const VVFloat & amplitude() const
const VFloat & timeConstantMean() const
const VFloat & chi2Spread() const
const VFloat & smearingSpread() const
const VFloat & riseTimeMean() const
const VVFloat & smearing() const
const uint16_t & lldChan() const
const uint16_t & fecSlot() const
const VVFloat & timeConstant() const
const uint16_t & i2cAddr() const
const uint32_t & key() const
Definition: SiStripKey.h:126
const VFloat & chi2Min() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:46
const VFloat & chi2Max() const
void fillMap(const std::string &top_level_dir, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error=0.)
const VFloat & tailMax() const
const VFloat & riseTimeMin() const
Analysis for calibration runs.
const VVFloat & tail() const
const VFloat & amplitudeMax() const
const VFloat & timeConstantSpread() const
sistrip::Granularity gran_
const VFloat & chi2Mean() const
const uint16_t & fecCrate() const
static const char mlSummaryPlots_[]
const VFloat & riseTimeMax() const
SummaryGenerator * generator_
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:17
const VFloat & timeConstantMin() const
const VFloat & smearingMin() const
const VFloat & timeConstantMax() const
const VVFloat & chi2() const
const uint16_t & ccuChan() const
const VFloat & tailMean() const
const VFloat & smearingMax() const
const VFloat & tailSpread() const
const VFloat & amplitudeSpread() const
const VFloat & tailMin() const