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  dead_[0].reserve(256);
39  dead_[1].reserve(256);
40  noisy_[0].reserve(256);
41  noisy_[1].reserve(256);
42 }
43 
44 // ----------------------------------------------------------------------------
45 //
47  : CommissioningAnalysis("DaqScopeModeAnalysis"),
48  height_(1. * sistrip::invalid_),
49  base_(1. * sistrip::invalid_),
50  peak_(1. * sistrip::invalid_),
51  peds_(2, VFloat(128, sistrip::invalid_)),
52  noise_(2, VFloat(128, sistrip::invalid_)),
53  raw_(2, VFloat(128, sistrip::invalid_)),
54  dead_(2, VInt(0, sistrip::invalid_)),
55  noisy_(2, VInt(0, sistrip::invalid_)),
67  rawMin_(2, sistrip::invalid_) {
68  dead_[0].reserve(256);
69  dead_[1].reserve(256);
70  noisy_[0].reserve(256);
71  noisy_[1].reserve(256);
72 }
73 
74 // ----------------------------------------------------------------------------
75 //
78  base_ = 1. * sistrip::invalid_;
79  peak_ = 1. * sistrip::invalid_;
80 
98  dead_[0].reserve(256);
99  dead_[1].reserve(256);
100  noisy_[0].reserve(256);
101  noisy_[1].reserve(256);
102 }
103 
104 // ----------------------------------------------------------------------------
105 //
107  if ((getErrorCodes().empty() || getErrorCodes()[0] == "TickMarkRecovered") && base_ < sistrip::valid_ &&
108  peak_ < sistrip::valid_ && height_ < sistrip::valid_ && height_ > tickMarkHeightThreshold_) {
109  return ((static_cast<uint16_t>(base_ + height_ * DaqScopeModeAnalysis::frameFindingThreshold_) / 32) * 32);
110  } else {
111  return sistrip::invalid_;
112  }
113 }
114 
115 // ----------------------------------------------------------------------------
116 //
118  return ((getErrorCodes().empty() || getErrorCodes()[0] == "TickMarkRecovered") && base_ < sistrip::valid_ &&
120 }
121 
122 // ----------------------------------------------------------------------------
123 //
136 }
137 
138 // ----------------------------------------------------------------------------
139 //
140 void DaqScopeModeAnalysis::print(std::stringstream& ss, uint32_t iapv) {
141  if (iapv == 1 || iapv == 2) {
142  iapv--;
143  } else {
144  iapv = 0;
145  }
146 
147  header(ss);
148  ss << std::fixed << std::setprecision(2) << " Tick mark bottom (baseline) [ADC] : " << base_ << std::endl
149  << " Tick mark top [ADC] : " << peak_ << std::endl
150  << " Tick mark height [ADC] : " << height_ << std::endl
151  << " Frame finding threshold [ADC] : " << frameFindingThreshold() << std::endl
152  << std::boolalpha << " Tick mark found : " << foundTickMark() << std::endl
153  << " isValid : " << isValid() << std::endl;
154 
155  if (peds_[iapv].size() < 128 || noise_[iapv].size() < 128 || raw_[iapv].size() < 128) {
156  edm::LogWarning(mlCommissioning_) << "[" << myName() << "::" << __func__ << "]"
157  << " Unexpected number of pedestal/noise values: " << peds_[iapv].size() << ", "
158  << noise_[iapv].size() << ", " << raw_[iapv].size();
159  return;
160  }
161 
162  ss << " Monitorables for APV number : " << iapv;
163  if (iapv == 0) {
164  ss << " (first of pair)";
165  } else if (iapv == 1) {
166  ss << " (second of pair)";
167  }
168  ss << std::endl;
169  ss << std::fixed << std::setprecision(2);
170  ss << " Example peds/noise for strips : "
171  << " 0, 31, 63, 127" << std::endl
172  << " Peds [ADC] : " << std::setw(6) << peds_[iapv][0] << ", " << std::setw(6)
173  << peds_[iapv][31] << ", " << std::setw(6) << peds_[iapv][63] << ", " << std::setw(6) << peds_[iapv][127]
174  << std::endl
175  << " Noise [ADC] : " << std::setw(6) << noise_[iapv][0] << ", " << std::setw(6)
176  << noise_[iapv][31] << ", " << std::setw(6) << noise_[iapv][63] << ", " << std::setw(6) << noise_[iapv][127]
177  << std::endl
178  << " Raw noise [ADC] : " << std::setw(6) << raw_[iapv][0] << ", " << std::setw(6) << raw_[iapv][31]
179  << ", " << std::setw(6) << raw_[iapv][63] << ", " << std::setw(6) << raw_[iapv][127] << std::endl
180  << " Dead strips (<5s) [strip] : (" << dead_[iapv].size() << " in total) ";
181  for (uint16_t ii = 0; ii < dead_[iapv].size(); ii++) {
182  ss << dead_[iapv][ii] << " ";
183  }
184 
185  ss << std::endl;
186  ss << " Noisy strips (>5s) [strip] : (" << noisy_[iapv].size() << " in total) ";
187  for (uint16_t ii = 0; ii < noisy_[iapv].size(); ii++) {
188  ss << noisy_[iapv][ii] << " ";
189  }
190  ss << std::endl;
191  ss << " Mean peds +/- spread [ADC] : " << pedsMean_[iapv] << " +/- " << pedsSpread_[iapv] << std::endl
192  << " Min/Max pedestal [ADC] : " << pedsMin_[iapv] << " <-> " << pedsMax_[iapv] << std::endl
193  << " Mean noise +/- spread [ADC] : " << noiseMean_[iapv] << " +/- " << noiseSpread_[iapv] << std::endl
194  << " Min/Max noise [ADC] : " << noiseMin_[iapv] << " <-> " << noiseMax_[iapv] << std::endl
195  << " Mean raw noise +/- spread [ADC] : " << rawMean_[iapv] << " +/- " << rawSpread_[iapv] << std::endl
196  << " Min/Max raw noise [ADC] : " << rawMin_[iapv] << " <-> " << rawMax_[iapv] << std::endl
197  << " Normalised noise : "
198  << "(yet to be implemented...)" << std::endl
199  << std::boolalpha << " isValid : " << isValid() << std::endl
200  << std::noboolalpha << " Error codes (found " << std::setw(2) << std::setfill(' ') << getErrorCodes().size()
201  << ") : ";
202  if (getErrorCodes().empty()) {
203  ss << "(none)";
204  } else {
205  VString::const_iterator istr = getErrorCodes().begin();
206  VString::const_iterator jstr = getErrorCodes().end();
207  for (; istr != jstr; ++istr) {
208  ss << *istr << " ";
209  }
210  }
211  ss << std::endl;
212 }
213 
214 // ----------------------------------------------------------------------------
215 //
216 void DaqScopeModeAnalysis::summary(std::stringstream& ss) const {
217  SiStripFecKey fec_key(fecKey());
218  SiStripFedKey fed_key(fedKey());
219 
221 
222  std::stringstream extra1, extra2, extra3, extra4, extra5, extra6;
229 
231  type,
233  fed_key.key(),
235  fec_key.lldChan(),
236  extra1.str())
237  .title();
239  type,
241  fed_key.key(),
243  fec_key.lldChan(),
244  extra2.str())
245  .title();
247  type,
249  fed_key.key(),
250  sistrip::APV,
251  SiStripFecKey::i2cAddr(fec_key.lldChan(), true),
252  extra3.str())
253  .title();
255  type,
257  fed_key.key(),
258  sistrip::APV,
259  SiStripFecKey::i2cAddr(fec_key.lldChan(), false),
260  extra3.str())
261  .title();
262 
264  type,
266  fed_key.key(),
268  SiStripFecKey::i2cAddr(fec_key.lldChan()),
269  extra4.str())
270  .title();
271 
273  type,
275  fed_key.key(),
277  SiStripFecKey::i2cAddr(fec_key.lldChan()),
278  extra5.str())
279  .title();
280 
282  type,
284  fed_key.key(),
286  SiStripFecKey::i2cAddr(fec_key.lldChan()),
287  extra6.str())
288  .title();
289 
290  ss << " Summary"
291  << ":" << (isValid() ? "Valid" : "Invalid") << ":" << sistrip::controlView_ << ":" << fec_key.fecCrate() << "/"
292  << fec_key.fecSlot() << "/" << fec_key.fecRing() << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan() << ":"
293  << sistrip::dqmRoot_ << sistrip::dir_ << "Collate" << sistrip::dir_
294  << SiStripFecKey(fec_key.fecCrate(), fec_key.fecSlot(), fec_key.fecRing(), fec_key.ccuAddr(), fec_key.ccuChan())
295  .path()
296  << ":" << title1 << ";" << title2 << ";" << title3 << ";" << title4 << ";" << title5 << ";" << title6 << ";"
297  << title7 << std::endl;
298 }
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:120
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