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  return ( ( getErrorCodes().empty() || getErrorCodes()[0] == "TickMarkRecovered" ) &&
155  rawMax_[0] < sistrip::maximum_ &&
156  rawMax_[1] < sistrip::maximum_ &&
157  rawMin_[0] < sistrip::maximum_ &&
158  rawMin_[1] < sistrip::maximum_ );
159 }
160 
161 // ----------------------------------------------------------------------------
162 //
163 void DaqScopeModeAnalysis::print( std::stringstream& ss, uint32_t iapv ) {
164 
165 
166  if ( iapv == 1 || iapv == 2 ) { iapv--; }
167  else { iapv = 0; }
168 
169  header( ss );
170  ss << std::fixed << std::setprecision(2)
171  << " Tick mark bottom (baseline) [ADC] : " << base_ << std::endl
172  << " Tick mark top [ADC] : " << peak_ << std::endl
173  << " Tick mark height [ADC] : " << height_ << std::endl
174  << " Frame finding threshold [ADC] : " << frameFindingThreshold() << std::endl
175  << std::boolalpha
176  << " Tick mark found : " << foundTickMark() << std::endl
177  << " isValid : " << isValid() << std::endl;
178 
179  if ( peds_[iapv].size() < 128 ||
180  noise_[iapv].size() < 128 ||
181  raw_[iapv].size() < 128 ) {
182 
184  << "[" << myName() << "::" << __func__ << "]"
185  << " Unexpected number of pedestal/noise values: "
186  << peds_[iapv].size() << ", "
187  << noise_[iapv].size() << ", "
188  << raw_[iapv].size();
189  return;
190  }
191 
192  ss << " Monitorables for APV number : " << iapv;
193  if ( iapv == 0 ) { ss << " (first of pair)"; }
194  else if ( iapv == 1 ) { ss << " (second of pair)"; }
195  ss << std::endl;
196  ss << std::fixed << std::setprecision(2);
197  ss << " Example peds/noise for strips : "
198  << " 0, 31, 63, 127" << std::endl
199  << " Peds [ADC] : "
200  << std::setw(6) << peds_[iapv][0] << ", "
201  << std::setw(6) << peds_[iapv][31] << ", "
202  << std::setw(6) << peds_[iapv][63] << ", "
203  << std::setw(6) << peds_[iapv][127] << std::endl
204  << " Noise [ADC] : "
205  << std::setw(6) << noise_[iapv][0] << ", "
206  << std::setw(6) << noise_[iapv][31] << ", "
207  << std::setw(6) << noise_[iapv][63] << ", "
208  << std::setw(6) << noise_[iapv][127] << std::endl
209  << " Raw noise [ADC] : "
210  << std::setw(6) << raw_[iapv][0] << ", "
211  << std::setw(6) << raw_[iapv][31] << ", "
212  << std::setw(6) << raw_[iapv][63] << ", "
213  << std::setw(6) << raw_[iapv][127] << std::endl
214  << " Dead strips (<5s) [strip] : (" << dead_[iapv].size() << " in total) ";
215  for ( uint16_t ii = 0; ii < dead_[iapv].size(); ii++ ) {
216  ss << dead_[iapv][ii] << " "; }
217 
218  ss << std::endl;
219  ss << " Noisy strips (>5s) [strip] : (" << noisy_[iapv].size() << " in total) ";
220  for ( uint16_t ii = 0; ii < noisy_[iapv].size(); ii++ ) {
221  ss << noisy_[iapv][ii] << " ";
222  }
223  ss << std::endl;
224  ss << " Mean peds +/- spread [ADC] : " << pedsMean_[iapv] << " +/- " << pedsSpread_[iapv] << std::endl
225  << " Min/Max pedestal [ADC] : " << pedsMin_[iapv] << " <-> " << pedsMax_[iapv] << std::endl
226  << " Mean noise +/- spread [ADC] : " << noiseMean_[iapv] << " +/- " << noiseSpread_[iapv] << std::endl
227  << " Min/Max noise [ADC] : " << noiseMin_[iapv] << " <-> " << noiseMax_[iapv] << std::endl
228  << " Mean raw noise +/- spread [ADC] : " << rawMean_[iapv] << " +/- " << rawSpread_[iapv] << std::endl
229  << " Min/Max raw noise [ADC] : " << rawMin_[iapv] << " <-> " << rawMax_[iapv] << std::endl
230  << " Normalised noise : " << "(yet to be implemented...)" << std::endl
231  << std::boolalpha
232  << " isValid : " << isValid() << std::endl
233  << std::noboolalpha
234  << " Error codes (found "
235  << std::setw(2) << std::setfill(' ') << getErrorCodes().size()
236  << ") : ";
237  if ( getErrorCodes().empty() ) { ss << "(none)"; }
238  else {
239  VString::const_iterator istr = getErrorCodes().begin();
240  VString::const_iterator jstr = getErrorCodes().end();
241  for ( ; istr != jstr; ++istr ) { ss << *istr << " "; }
242  }
243  ss << std::endl;
244 }
245 
246 
247 
248 // ----------------------------------------------------------------------------
249 //
250 void DaqScopeModeAnalysis::summary( std::stringstream& ss ) const {
251 
252  SiStripFecKey fec_key( fecKey() );
253  SiStripFedKey fed_key( fedKey() );
254 
256 
257  std::stringstream extra1,extra2,extra3,extra4;
262 
264  type,
266  fed_key.key(),
268  fec_key.lldChan(),
269  extra1.str() ).title();
271  type,
273  fed_key.key(),
275  fec_key.lldChan(),
276  extra2.str() ).title();
278  type,
280  fed_key.key(),
281  sistrip::APV,
282  SiStripFecKey::i2cAddr( fec_key.lldChan(), true ),
283  extra3.str() ).title();
285  type,
287  fed_key.key(),
288  sistrip::APV,
289  SiStripFecKey::i2cAddr( fec_key.lldChan(), false ),
290  extra3.str() ).title();
291 
293  type,
295  fed_key.key(),
297  SiStripFecKey::i2cAddr( fec_key.lldChan()),
298  extra4.str() ).title();
299 
300  ss << " Summary"
301  << ":"
302  << ( isValid() ? "Valid" : "Invalid" )
303  << ":"
304  << sistrip::controlView_ << ":"
305  << fec_key.fecCrate() << "/"
306  << fec_key.fecSlot() << "/"
307  << fec_key.fecRing() << "/"
308  << fec_key.ccuAddr() << "/"
309  << fec_key.ccuChan()
310  << ":"
312  << "Collate" << sistrip::dir_
313  << SiStripFecKey( fec_key.fecCrate(),
314  fec_key.fecSlot(),
315  fec_key.fecRing(),
316  fec_key.ccuAddr(),
317  fec_key.ccuChan() ).path()
318  << ":"
319  << title1 << ";" << title2 << ";" << title3 << ";" << title4 << ";" << title5
320  << std::endl;
321 
322 }
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 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:589
const uint16_t & fecCrate() const
static const char pedestals_[]
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