CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PedsFullNoiseAnalysis.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <iomanip>
7 #include <cmath>
8 
9 using namespace sistrip;
10 
11 // ----------------------------------------------------------------------------
12 //
14  : CommissioningAnalysis(key,"PedsFullNoiseAnalysis"),
15  peds_(2,VFloat(128,sistrip::invalid_)),
16  noise_(2,VFloat(128,sistrip::invalid_)),
17  raw_(2,VFloat(128,sistrip::invalid_)),
18  ksProb_(2,VFloat(0,sistrip::invalid_)),
19  chi2Prob_(2,VFloat(0,sistrip::invalid_)),
20  noiseGaus_(2,VFloat(0,sistrip::invalid_)),
21  noiseBin84_(2,VFloat(0,sistrip::invalid_)),
22  noiseRMS_(2,VFloat(0,sistrip::invalid_)),
23  noiseSignif_(2,VFloat(0,sistrip::invalid_)),
24  dead_(2,VInt(0,sistrip::invalid_)),
25  noisy_(2,VInt(0,sistrip::invalid_)),
26  pedsMean_(2,sistrip::invalid_),
27  pedsSpread_(2,sistrip::invalid_),
28  noiseMean_(2,sistrip::invalid_),
29  noiseSpread_(2,sistrip::invalid_),
30  rawMean_(2,sistrip::invalid_),
31  rawSpread_(2,sistrip::invalid_),
32  pedsMax_(2,sistrip::invalid_),
33  pedsMin_(2,sistrip::invalid_),
34  noiseMax_(2,sistrip::invalid_),
35  noiseMin_(2,sistrip::invalid_),
36  rawMax_(2,sistrip::invalid_),
37  rawMin_(2,sistrip::invalid_),
38  legacy_(false)
39 {
40  dead_[0].reserve(128); dead_[1].reserve(128);
41  noisy_[0].reserve(128); noisy_[1].reserve(128);
42  ksProb_[0].reserve(128); ksProb_[1].reserve(128);
43  chi2Prob_[0].reserve(128); chi2Prob_[1].reserve(128);
44  noiseGaus_[0].reserve(128); noiseGaus_[1].reserve(128);
45  noiseBin84_[0].reserve(128); noiseBin84_[1].reserve(128);
46  noiseRMS_[0].reserve(128); noiseRMS_[1].reserve(128);
47  noiseSignif_[0].reserve(128); noiseSignif_[1].reserve(128);
48 }
49 
50 // ----------------------------------------------------------------------------
51 //
53  : CommissioningAnalysis("PedsFullNoiseAnalysis"),
54  peds_(2,VFloat(128,sistrip::invalid_)),
55  noise_(2,VFloat(128,sistrip::invalid_)),
56  raw_(2,VFloat(128,sistrip::invalid_)),
57  ksProb_(2,VFloat(0,sistrip::invalid_)),
58  chi2Prob_(2,VFloat(0,sistrip::invalid_)),
59  noiseGaus_(2,VFloat(0,sistrip::invalid_)),
60  noiseBin84_(2,VFloat(0,sistrip::invalid_)),
61  noiseRMS_(2,VFloat(0,sistrip::invalid_)),
62  noiseSignif_(2,VFloat(0,sistrip::invalid_)),
63  dead_(2,VInt(0,sistrip::invalid_)),
64  noisy_(2,VInt(0,sistrip::invalid_)),
65  pedsMean_(2,sistrip::invalid_),
66  pedsSpread_(2,sistrip::invalid_),
67  noiseMean_(2,sistrip::invalid_),
68  noiseSpread_(2,sistrip::invalid_),
69  rawMean_(2,sistrip::invalid_),
70  rawSpread_(2,sistrip::invalid_),
71  pedsMax_(2,sistrip::invalid_),
72  pedsMin_(2,sistrip::invalid_),
73  noiseMax_(2,sistrip::invalid_),
74  noiseMin_(2,sistrip::invalid_),
75  rawMax_(2,sistrip::invalid_),
76  rawMin_(2,sistrip::invalid_),
77  legacy_(false)
78 {
79  dead_[0].reserve(128); dead_[1].reserve(128);
80  noisy_[0].reserve(128); noisy_[1].reserve(128);
81  ksProb_[0].reserve(128); ksProb_[1].reserve(128);
82  chi2Prob_[0].reserve(128); chi2Prob_[1].reserve(128);
83  noiseGaus_[0].reserve(128); noiseGaus_[1].reserve(128);
84  noiseBin84_[0].reserve(128); noiseBin84_[1].reserve(128);
85  noiseRMS_[0].reserve(128); noiseRMS_[1].reserve(128);
86  noiseSignif_[0].reserve(128); noiseSignif_[1].reserve(128);
87 }
88 
89 // ----------------------------------------------------------------------------
90 //
115  dead_[0].reserve(128); dead_[1].reserve(128);
116  noisy_[0].reserve(128); noisy_[1].reserve(128);
117  ksProb_[0].reserve(128); ksProb_[1].reserve(128);
118  chi2Prob_[0].reserve(128); chi2Prob_[1].reserve(128);
119  noiseGaus_[0].reserve(128); noiseGaus_[1].reserve(128);
120  noiseBin84_[0].reserve(128); noiseBin84_[1].reserve(128);
121  noiseRMS_[0].reserve(128); noiseRMS_[1].reserve(128);
122  noiseSignif_[0].reserve(128); noiseSignif_[1].reserve(128);
123  legacy_ = false;
124 }
125 
126 // ----------------------------------------------------------------------------
127 //
129  return ( pedsMean_[0] < sistrip::maximum_ &&
149  rawMax_[0] < sistrip::maximum_ &&
150  rawMax_[1] < sistrip::maximum_ &&
151  rawMin_[0] < sistrip::maximum_ &&
152  rawMin_[1] < sistrip::maximum_ &&
153  getErrorCodes().empty() );
154  //noiseMean_[0] <= rawMean_[0] && //@@ temp
155  //noiseMean_[1] <= rawMean_[1] ); //@@ temp
156 }
157 
158 // ----------------------------------------------------------------------------
159 //
160 void PedsFullNoiseAnalysis::summary( std::stringstream& ss ) const {
161 
162  SiStripFecKey fec_key( fecKey() );
163  SiStripFedKey fed_key( fedKey() );
164 
166 
167  std::stringstream extra1,extra2,extra3;
168  if ( legacy_ ) {
172  } else {
176  }
177 
178  std::string title1 = SiStripHistoTitle( sistrip::EXPERT_HISTO,
179  type,
181  fed_key.key(),
183  fec_key.lldChan(),
184  extra1.str() ).title();
185  std::string title2 = SiStripHistoTitle( sistrip::EXPERT_HISTO,
186  type,
188  fed_key.key(),
190  fec_key.lldChan(),
191  extra2.str() ).title();
192  std::string title3 = SiStripHistoTitle( sistrip::EXPERT_HISTO,
193  type,
195  fed_key.key(),
196  sistrip::APV,
197  SiStripFecKey::i2cAddr( fec_key.lldChan(), true ),
198  extra3.str() ).title();
199  std::string title4 = SiStripHistoTitle( sistrip::EXPERT_HISTO,
200  type,
202  fed_key.key(),
203  sistrip::APV,
204  SiStripFecKey::i2cAddr( fec_key.lldChan(), false ),
205  extra3.str() ).title();
206 
207 
208  ss << " Summary"
209  << ":"
210  << ( isValid() ? "Valid" : "Invalid" )
211  << ":"
212  << sistrip::controlView_ << ":"
213  << fec_key.fecCrate() << "/"
214  << fec_key.fecSlot() << "/"
215  << fec_key.fecRing() << "/"
216  << fec_key.ccuAddr() << "/"
217  << fec_key.ccuChan()
218  << ":"
220  << "Collate" << sistrip::dir_
221  << SiStripFecKey( fec_key.fecCrate(),
222  fec_key.fecSlot(),
223  fec_key.fecRing(),
224  fec_key.ccuAddr(),
225  fec_key.ccuChan() ).path()
226  << ":"
227  << title1 << ";" << title2 << ";" << title3 << ";" << title4
228  << std::endl;
229 
230 }
231 
232 // ----------------------------------------------------------------------------
233 //
234 void PedsFullNoiseAnalysis::print( std::stringstream& ss, uint32_t iapv ) {
235 
236  if ( iapv == 1 || iapv == 2 ) { iapv--; }
237  else { iapv = 0; }
238 
239  if ( peds_[iapv].size() < 128 ||
240  noise_[iapv].size() < 128 ||
241  raw_[iapv].size() < 128 ) {
243  << "[" << myName() << "::" << __func__ << "]"
244  << " Unexpected number of pedestal/noise values: "
245  << peds_[iapv].size() << ", "
246  << noise_[iapv].size() << ", "
247  << raw_[iapv].size();
248  return;
249  }
250 
251  header( ss );
252  ss << " Monitorables for APV number : " << iapv;
253  if ( iapv == 0 ) { ss << " (first of pair)"; }
254  else if ( iapv == 1 ) { ss << " (second of pair)"; }
255  ss << std::endl;
256  ss << std::fixed << std::setprecision(2);
257  ss << " Example peds/noise for strips : "
258  << " 0, 31, 63, 127" << std::endl
259  << " Peds [ADC] : "
260  << std::setw(6) << peds_[iapv][0] << ", "
261  << std::setw(6) << peds_[iapv][31] << ", "
262  << std::setw(6) << peds_[iapv][63] << ", "
263  << std::setw(6) << peds_[iapv][127] << std::endl
264  << " Noise [ADC] : "
265  << std::setw(6) << noise_[iapv][0] << ", "
266  << std::setw(6) << noise_[iapv][31] << ", "
267  << std::setw(6) << noise_[iapv][63] << ", "
268  << std::setw(6) << noise_[iapv][127] << std::endl
269  << " Raw noise [ADC] : "
270  << std::setw(6) << raw_[iapv][0] << ", "
271  << std::setw(6) << raw_[iapv][31] << ", "
272  << std::setw(6) << raw_[iapv][63] << ", "
273  << std::setw(6) << raw_[iapv][127] << std::endl
274  << " Dead strips (<5s) [strip] : (" << dead_[iapv].size() << " in total) ";
275  for ( uint16_t ii = 0; ii < dead_[iapv].size(); ii++ ) {
276  ss << dead_[iapv][ii] << " "; }
277 
278  ss << std::endl;
279  ss << " Noisy strips (>5s) [strip] : (" << noisy_[iapv].size() << " in total) ";
280  for ( uint16_t ii = 0; ii < noisy_[iapv].size(); ii++ ) {
281  ss << noisy_[iapv][ii] << " ";
282  }
283  ss << std::endl;
284  ss << " Mean peds +/- spread [ADC] : " << pedsMean_[iapv] << " +/- " << pedsSpread_[iapv] << std::endl
285  << " Min/Max pedestal [ADC] : " << pedsMin_[iapv] << " <-> " << pedsMax_[iapv] << std::endl
286  << " Mean noise +/- spread [ADC] : " << noiseMean_[iapv] << " +/- " << noiseSpread_[iapv] << std::endl
287  << " Min/Max noise [ADC] : " << noiseMin_[iapv] << " <-> " << noiseMax_[iapv] << std::endl
288  << " Mean raw noise +/- spread [ADC] : " << rawMean_[iapv] << " +/- " << rawSpread_[iapv] << std::endl
289  << " Min/Max raw noise [ADC] : " << rawMin_[iapv] << " <-> " << rawMax_[iapv] << std::endl
290  << " Normalised noise : " << "(yet to be implemented...)" << std::endl
291  << std::boolalpha
292  << " isValid : " << isValid() << std::endl
293  << std::noboolalpha
294  << " Error codes (found "
295  << std::setw(2) << std::setfill(' ') << getErrorCodes().size()
296  << ") : ";
297  if ( getErrorCodes().empty() ) { ss << "(none)"; }
298  else {
299  VString::const_iterator istr = getErrorCodes().begin();
300  VString::const_iterator jstr = getErrorCodes().end();
301  for ( ; istr != jstr; ++istr ) { ss << *istr << " "; }
302  }
303  ss << std::endl;
304 }
305 
static const char noise_[]
type
Definition: HCALResponse.h:22
static const char rawNoise_[]
const uint32_t & fedKey() const
const uint16_t & fecRing() const
static const char pedsAndRawNoise_[]
static const char dir_[]
Utility class that holds histogram title.
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:57
static const char noiseMean_[]
static const char noiseMax_[]
const uint16_t & lldChan() const
static const char noiseMin_[]
const uint16_t & fecSlot() const
const uint16_t & i2cAddr() const
const uint32_t & key() const
Definition: SiStripKey.h:126
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:46
static std::string runType(const sistrip::RunType &)
list path
Definition: scaleCards.py:51
std::vector< float > VFloat
static const char mlCommissioning_[]
static const char controlView_[]
static const uint16_t maximum_
Definition: Constants.h:21
static const char dqmRoot_[]
const uint32_t & fecKey() const
static const char noiseSpread_[]
static const char commonMode_[]
std::vector< uint16_t > VInt
const uint16_t & fecCrate() const
static const char pedestals_[]
void summary(std::stringstream &) const
static const char pedsAndCmSubNoise_[]
std::vector< VInt > VVInt
void print(std::stringstream &, uint32_t apv_number=0)
virtual void header(std::stringstream &) const
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:17
list key
Definition: combine.py:13
const uint16_t & ccuChan() const
std::vector< VFloat > VVFloat
Abstract base for derived classes that provide analysis of commissioning histograms.
const VString & getErrorCodes() const
const std::string & myName() const
tuple size
Write out results.
static const char noiseSignif_[]