CMS 3D CMS Logo

DaqScopeModeAnalysis.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <iomanip>
7 #include <cmath>
8 
9 using namespace sistrip;
10 
11 const float DaqScopeModeAnalysis::tickMarkHeightThreshold_ = 50.; // [ADC]
12 const float DaqScopeModeAnalysis::frameFindingThreshold_ = (2./3.); // fraction of tick mark height
13 
14 // ----------------------------------------------------------------------------
15 //
17  : CommissioningAnalysis(key,"DaqScopeModeAnalysis"),
18  height_(1.*sistrip::invalid_),
19  base_(1.*sistrip::invalid_),
20  peak_(1.*sistrip::invalid_),
21  peds_(2,VFloat(128,sistrip::invalid_)),
22  noise_(2,VFloat(128,sistrip::invalid_)),
23  raw_(2,VFloat(128,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_),
30  rawMean_(2,sistrip::invalid_),
31  rawSpread_(2,sistrip::invalid_),
32  pedsMax_(2,sistrip::invalid_),
33  pedsMin_(2,sistrip::invalid_),
36  rawMax_(2,sistrip::invalid_),
37  rawMin_(2,sistrip::invalid_)
38 {
39  dead_[0].reserve(256); dead_[1].reserve(256);
40  noisy_[0].reserve(256); noisy_[1].reserve(256);
41 }
42 
43 // ----------------------------------------------------------------------------
44 //
46  : CommissioningAnalysis("DaqScopeModeAnalysis"),
48  base_(1.*sistrip::invalid_),
49  peak_(1.*sistrip::invalid_),
50  peds_(2,VFloat(128,sistrip::invalid_)),
51  noise_(2,VFloat(128,sistrip::invalid_)),
52  raw_(2,VFloat(128,sistrip::invalid_)),
53  dead_(2,VInt(0,sistrip::invalid_)),
54  noisy_(2,VInt(0,sistrip::invalid_)),
67 {
68  dead_[0].reserve(256); dead_[1].reserve(256);
69  noisy_[0].reserve(256); noisy_[1].reserve(256);
70 }
71 
72 // ----------------------------------------------------------------------------
73 //
78 
96  dead_[0].reserve(256);
97  dead_[1].reserve(256);
98  noisy_[0].reserve(256);
99  noisy_[1].reserve(256);
100 }
101 
102 
103 // ----------------------------------------------------------------------------
104 //
106  if ( ( getErrorCodes().empty() || getErrorCodes()[0] == "TickMarkRecovered" ) &&
107  base_ < sistrip::valid_ &&
108  peak_ < sistrip::valid_ &&
111  return ( ( static_cast<uint16_t>( base_ +
112  height_ *
114  } else { return sistrip::invalid_; }
115 }
116 
117 // ----------------------------------------------------------------------------
118 //
120  return ( ( getErrorCodes().empty() || getErrorCodes()[0] == "TickMarkRecovered") &&
125 }
126 
127 // ----------------------------------------------------------------------------
128 //
130 
131  return ( getErrorCodes().empty() &&
156  rawMax_[0] < sistrip::maximum_ &&
157  rawMax_[1] < sistrip::maximum_ &&
158  rawMin_[0] < sistrip::maximum_ &&
159  rawMin_[1] < sistrip::maximum_ );
160 }
161 
162 // ----------------------------------------------------------------------------
163 //
164 void DaqScopeModeAnalysis::print( std::stringstream& ss, uint32_t iapv ) {
165 
166 
167  if ( iapv == 1 || iapv == 2 ) { iapv--; }
168  else { iapv = 0; }
169 
170  header( ss );
171  ss << std::fixed << std::setprecision(2)
172  << " Tick mark bottom (baseline) [ADC] : " << base_ << std::endl
173  << " Tick mark top [ADC] : " << peak_ << std::endl
174  << " Tick mark height [ADC] : " << height_ << std::endl
175  << " Frame finding threshold [ADC] : " << frameFindingThreshold() << std::endl
176  << std::boolalpha
177  << " Tick mark found : " << foundTickMark() << std::endl
178  << " isValid : " << isValid() << std::endl;
179 
180  if ( peds_[iapv].size() < 128 ||
181  noise_[iapv].size() < 128 ||
182  raw_[iapv].size() < 128 ) {
183 
185  << "[" << myName() << "::" << __func__ << "]"
186  << " Unexpected number of pedestal/noise values: "
187  << peds_[iapv].size() << ", "
188  << noise_[iapv].size() << ", "
189  << raw_[iapv].size();
190  return;
191  }
192 
193  ss << " Monitorables for APV number : " << iapv;
194  if ( iapv == 0 ) { ss << " (first of pair)"; }
195  else if ( iapv == 1 ) { ss << " (second of pair)"; }
196  ss << std::endl;
197  ss << std::fixed << std::setprecision(2);
198  ss << " Example peds/noise for strips : "
199  << " 0, 31, 63, 127" << std::endl
200  << " Peds [ADC] : "
201  << std::setw(6) << peds_[iapv][0] << ", "
202  << std::setw(6) << peds_[iapv][31] << ", "
203  << std::setw(6) << peds_[iapv][63] << ", "
204  << std::setw(6) << peds_[iapv][127] << std::endl
205  << " Noise [ADC] : "
206  << std::setw(6) << noise_[iapv][0] << ", "
207  << std::setw(6) << noise_[iapv][31] << ", "
208  << std::setw(6) << noise_[iapv][63] << ", "
209  << std::setw(6) << noise_[iapv][127] << std::endl
210  << " Raw noise [ADC] : "
211  << std::setw(6) << raw_[iapv][0] << ", "
212  << std::setw(6) << raw_[iapv][31] << ", "
213  << std::setw(6) << raw_[iapv][63] << ", "
214  << std::setw(6) << raw_[iapv][127] << std::endl
215  << " Dead strips (<5s) [strip] : (" << dead_[iapv].size() << " in total) ";
216  for ( uint16_t ii = 0; ii < dead_[iapv].size(); ii++ ) {
217  ss << dead_[iapv][ii] << " "; }
218 
219  ss << std::endl;
220  ss << " Noisy strips (>5s) [strip] : (" << noisy_[iapv].size() << " in total) ";
221  for ( uint16_t ii = 0; ii < noisy_[iapv].size(); ii++ ) {
222  ss << noisy_[iapv][ii] << " ";
223  }
224  ss << std::endl;
225  ss << " Mean peds +/- spread [ADC] : " << pedsMean_[iapv] << " +/- " << pedsSpread_[iapv] << std::endl
226  << " Min/Max pedestal [ADC] : " << pedsMin_[iapv] << " <-> " << pedsMax_[iapv] << std::endl
227  << " Mean noise +/- spread [ADC] : " << noiseMean_[iapv] << " +/- " << noiseSpread_[iapv] << std::endl
228  << " Min/Max noise [ADC] : " << noiseMin_[iapv] << " <-> " << noiseMax_[iapv] << std::endl
229  << " Mean raw noise +/- spread [ADC] : " << rawMean_[iapv] << " +/- " << rawSpread_[iapv] << std::endl
230  << " Min/Max raw noise [ADC] : " << rawMin_[iapv] << " <-> " << rawMax_[iapv] << std::endl
231  << " Normalised noise : " << "(yet to be implemented...)" << std::endl
232  << std::boolalpha
233  << " isValid : " << isValid() << std::endl
234  << std::noboolalpha
235  << " Error codes (found "
236  << std::setw(2) << std::setfill(' ') << getErrorCodes().size()
237  << ") : ";
238  if ( getErrorCodes().empty() ) { ss << "(none)"; }
239  else {
240  VString::const_iterator istr = getErrorCodes().begin();
241  VString::const_iterator jstr = getErrorCodes().end();
242  for ( ; istr != jstr; ++istr ) { ss << *istr << " "; }
243  }
244  ss << std::endl;
245 }
246 
247 
248 
249 // ----------------------------------------------------------------------------
250 //
251 void DaqScopeModeAnalysis::summary( std::stringstream& ss ) const {
252 
253  SiStripFecKey fec_key( fecKey() );
254  SiStripFedKey fed_key( fedKey() );
255 
257 
258  std::stringstream extra1,extra2,extra3,extra4,extra5,extra6;
265 
267  type,
269  fed_key.key(),
271  fec_key.lldChan(),
272  extra1.str() ).title();
274  type,
276  fed_key.key(),
278  fec_key.lldChan(),
279  extra2.str() ).title();
281  type,
283  fed_key.key(),
284  sistrip::APV,
285  SiStripFecKey::i2cAddr( fec_key.lldChan(), true ),
286  extra3.str() ).title();
288  type,
290  fed_key.key(),
291  sistrip::APV,
292  SiStripFecKey::i2cAddr( fec_key.lldChan(), false ),
293  extra3.str() ).title();
294 
296  type,
298  fed_key.key(),
300  SiStripFecKey::i2cAddr( fec_key.lldChan()),
301  extra4.str() ).title();
302 
304  type,
306  fed_key.key(),
308  SiStripFecKey::i2cAddr( fec_key.lldChan()),
309  extra5.str() ).title();
310 
312  type,
314  fed_key.key(),
316  SiStripFecKey::i2cAddr( fec_key.lldChan()),
317  extra6.str() ).title();
318 
319  ss << " Summary"
320  << ":"
321  << ( isValid() ? "Valid" : "Invalid" )
322  << ":"
323  << sistrip::controlView_ << ":"
324  << fec_key.fecCrate() << "/"
325  << fec_key.fecSlot() << "/"
326  << fec_key.fecRing() << "/"
327  << fec_key.ccuAddr() << "/"
328  << fec_key.ccuChan()
329  << ":"
331  << "Collate" << sistrip::dir_
332  << SiStripFecKey( fec_key.fecCrate(),
333  fec_key.fecSlot(),
334  fec_key.fecRing(),
335  fec_key.ccuAddr(),
336  fec_key.ccuChan() ).path()
337  << ":"
338  << title1 << ";" << title2 << ";" << title3 << ";" << title4 << ";" << title5 << ";" << title6 << ";" << title7
339  << std::endl;
340 
341 }
size
Write out results.
static const char noise_[]
type
Definition: HCALResponse.h:21
static const char rawNoise_[]
const uint32_t & fedKey() const
const uint16_t & fecRing() const
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:56
static const char noiseMean_[]
bool isValid() const override
uint16_t frameFindingThreshold() const
static const char noiseMax_[]
const uint16_t & lldChan() const
static const char noiseMin_[]
const uint16_t & fecSlot() const
static const uint16_t valid_
Definition: Constants.h:17
const uint16_t & i2cAddr() const
sistrip classes
const uint32_t & key() const
Definition: SiStripKey.h:125
static const float tickMarkHeightThreshold_
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
static std::string runType(const sistrip::RunType &)
std::vector< float > VFloat
static const char mlCommissioning_[]
static const char scopeModeHeaderLow_[]
static const float frameFindingThreshold_
static const char controlView_[]
static const uint16_t maximum_
Definition: Constants.h:20
static const char dqmRoot_[]
const uint32_t & fecKey() const
static const char noiseSpread_[]
static const char commonMode_[]
void print(std::stringstream &, uint32_t apv_number=0) override
std::vector< uint16_t > VInt
ii
Definition: cuy.py:590
const uint16_t & fecCrate() const
static const char pedestals_[]
static const char scopeModeHeaderHigh_[]
std::vector< VInt > VVInt
virtual void header(std::stringstream &) const
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:16
static const char scopeModeFrame_[]
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
void summary(std::stringstream &) const override