CMS 3D CMS Logo

PedestalsAnalysis.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, "PedestalsAnalysis"),
15  peds_(2, VFloat(128, sistrip::invalid_)),
16  noise_(2, VFloat(128, sistrip::invalid_)),
17  raw_(2, VFloat(128, sistrip::invalid_)),
18  dead_(2, VInt(0, sistrip::invalid_)),
19  noisy_(2, VInt(0, sistrip::invalid_)),
20  pedsMean_(2, sistrip::invalid_),
21  pedsSpread_(2, sistrip::invalid_),
24  rawMean_(2, sistrip::invalid_),
25  rawSpread_(2, sistrip::invalid_),
26  pedsMax_(2, sistrip::invalid_),
27  pedsMin_(2, sistrip::invalid_),
30  rawMax_(2, sistrip::invalid_),
31  rawMin_(2, sistrip::invalid_),
32  legacy_(false) {
33  dead_[0].reserve(256);
34  dead_[1].reserve(256);
35  noisy_[0].reserve(256);
36  noisy_[1].reserve(256);
37 }
38 
39 // ----------------------------------------------------------------------------
40 //
42  : CommissioningAnalysis("PedestalsAnalysis"),
43  peds_(2, VFloat(128, sistrip::invalid_)),
44  noise_(2, VFloat(128, sistrip::invalid_)),
45  raw_(2, VFloat(128, sistrip::invalid_)),
46  dead_(2, VInt(0, sistrip::invalid_)),
47  noisy_(2, VInt(0, sistrip::invalid_)),
48  pedsMean_(2, sistrip::invalid_),
49  pedsSpread_(2, sistrip::invalid_),
52  rawMean_(2, sistrip::invalid_),
53  rawSpread_(2, sistrip::invalid_),
54  pedsMax_(2, sistrip::invalid_),
55  pedsMin_(2, sistrip::invalid_),
58  rawMax_(2, sistrip::invalid_),
59  rawMin_(2, sistrip::invalid_),
60  legacy_(false) {
61  dead_[0].reserve(256);
62  dead_[1].reserve(256);
63  noisy_[0].reserve(256);
64  noisy_[1].reserve(256);
65 }
66 
67 // ----------------------------------------------------------------------------
68 //
87  dead_[0].reserve(256);
88  dead_[1].reserve(256);
89  noisy_[0].reserve(256);
90  noisy_[1].reserve(256);
91  legacy_ = false;
92 }
93 
94 // ----------------------------------------------------------------------------
95 //
106  //noiseMean_[0] <= rawMean_[0] && //@@ temp
107  //noiseMean_[1] <= rawMean_[1] ); //@@ temp
108 }
109 
110 // ----------------------------------------------------------------------------
111 //
112 void PedestalsAnalysis::summary(std::stringstream& ss) const {
113  SiStripFecKey fec_key(fecKey());
114  SiStripFedKey fed_key(fedKey());
115 
117 
118  std::stringstream extra1, extra2, extra3;
119  if (legacy_) {
123  } else {
127  }
128 
130  type,
132  fed_key.key(),
134  fec_key.lldChan(),
135  extra1.str())
136  .title();
138  type,
140  fed_key.key(),
142  fec_key.lldChan(),
143  extra2.str())
144  .title();
146  type,
148  fed_key.key(),
149  sistrip::APV,
150  SiStripFecKey::i2cAddr(fec_key.lldChan(), true),
151  extra3.str())
152  .title();
154  type,
156  fed_key.key(),
157  sistrip::APV,
158  SiStripFecKey::i2cAddr(fec_key.lldChan(), false),
159  extra3.str())
160  .title();
161 
162  ss << " Summary"
163  << ":" << (isValid() ? "Valid" : "Invalid") << ":" << sistrip::controlView_ << ":" << fec_key.fecCrate() << "/"
164  << fec_key.fecSlot() << "/" << fec_key.fecRing() << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan() << ":"
165  << sistrip::dqmRoot_ << sistrip::dir_ << "Collate" << sistrip::dir_
166  << SiStripFecKey(fec_key.fecCrate(), fec_key.fecSlot(), fec_key.fecRing(), fec_key.ccuAddr(), fec_key.ccuChan())
167  .path()
168  << ":" << title1 << ";" << title2 << ";" << title3 << ";" << title4 << std::endl;
169 }
170 
171 // ----------------------------------------------------------------------------
172 //
173 void PedestalsAnalysis::print(std::stringstream& ss, uint32_t iapv) {
174  if (iapv == 1 || iapv == 2) {
175  iapv--;
176  } else {
177  iapv = 0;
178  }
179 
180  if (peds_[iapv].size() < 128 || noise_[iapv].size() < 128 || raw_[iapv].size() < 128) {
181  edm::LogWarning(mlCommissioning_) << "[" << myName() << "::" << __func__ << "]"
182  << " Unexpected number of pedestal/noise values: " << peds_[iapv].size() << ", "
183  << noise_[iapv].size() << ", " << raw_[iapv].size();
184  return;
185  }
186 
187  header(ss);
188  ss << " Monitorables for APV number : " << iapv;
189  if (iapv == 0) {
190  ss << " (first of pair)";
191  } else if (iapv == 1) {
192  ss << " (second of pair)";
193  }
194  ss << std::endl;
195  ss << std::fixed << std::setprecision(2);
196  ss << " Example peds/noise for strips : "
197  << " 0, 31, 63, 127" << std::endl
198  << " Peds [ADC] : " << std::setw(6) << peds_[iapv][0] << ", " << std::setw(6)
199  << peds_[iapv][31] << ", " << std::setw(6) << peds_[iapv][63] << ", " << std::setw(6) << peds_[iapv][127]
200  << std::endl
201  << " Noise [ADC] : " << std::setw(6) << noise_[iapv][0] << ", " << std::setw(6)
202  << noise_[iapv][31] << ", " << std::setw(6) << noise_[iapv][63] << ", " << std::setw(6) << noise_[iapv][127]
203  << std::endl
204  << " Raw noise [ADC] : " << std::setw(6) << raw_[iapv][0] << ", " << std::setw(6) << raw_[iapv][31]
205  << ", " << std::setw(6) << raw_[iapv][63] << ", " << std::setw(6) << raw_[iapv][127] << std::endl
206  << " Dead strips (<5s) [strip] : (" << dead_[iapv].size() << " in total) ";
207  for (uint16_t ii = 0; ii < dead_[iapv].size(); ii++) {
208  ss << dead_[iapv][ii] << " ";
209  }
210 
211  ss << std::endl;
212  ss << " Noisy strips (>5s) [strip] : (" << noisy_[iapv].size() << " in total) ";
213  for (uint16_t ii = 0; ii < noisy_[iapv].size(); ii++) {
214  ss << noisy_[iapv][ii] << " ";
215  }
216  ss << std::endl;
217  ss << " Mean peds +/- spread [ADC] : " << pedsMean_[iapv] << " +/- " << pedsSpread_[iapv] << std::endl
218  << " Min/Max pedestal [ADC] : " << pedsMin_[iapv] << " <-> " << pedsMax_[iapv] << std::endl
219  << " Mean noise +/- spread [ADC] : " << noiseMean_[iapv] << " +/- " << noiseSpread_[iapv] << std::endl
220  << " Min/Max noise [ADC] : " << noiseMin_[iapv] << " <-> " << noiseMax_[iapv] << std::endl
221  << " Mean raw noise +/- spread [ADC] : " << rawMean_[iapv] << " +/- " << rawSpread_[iapv] << std::endl
222  << " Min/Max raw noise [ADC] : " << rawMin_[iapv] << " <-> " << rawMax_[iapv] << std::endl
223  << " Normalised noise : "
224  << "(yet to be implemented...)" << std::endl
225  << std::boolalpha << " isValid : " << isValid() << std::endl
226  << std::noboolalpha << " Error codes (found " << std::setw(2) << std::setfill(' ') << getErrorCodes().size()
227  << ") : ";
228  if (getErrorCodes().empty()) {
229  ss << "(none)";
230  } else {
231  VString::const_iterator istr = getErrorCodes().begin();
232  VString::const_iterator jstr = getErrorCodes().end();
233  for (; istr != jstr; ++istr) {
234  ss << *istr << " ";
235  }
236  }
237  ss << std::endl;
238 }
size
Write out results.
static const char noise_[]
const VString & getErrorCodes() const
static const char rawNoise_[]
const uint16_t & ccuAddr() 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:56
static const char noiseMean_[]
void summary(std::stringstream &) const override
const uint16_t & ccuChan() const
static const char noiseMax_[]
static const char noiseMin_[]
const uint16_t & lldChan() const
void print(std::stringstream &, uint32_t apv_number=0) override
sistrip classes
void reset() override
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 &)
const std::string & myName() const
std::vector< float > VFloat
static const char mlCommissioning_[]
const uint16_t & i2cAddr() const
static const char controlView_[]
const uint32_t & key() const
Definition: SiStripKey.h:120
static const uint16_t maximum_
Definition: Constants.h:20
static const char dqmRoot_[]
static const char noiseSpread_[]
const uint32_t & fecKey() const
static const char commonMode_[]
const uint32_t & fedKey() const
std::vector< uint16_t > VInt
bool isValid() const override
ii
Definition: cuy.py:589
static const char pedestals_[]
static const char pedsAndCmSubNoise_[]
std::vector< VInt > VVInt
static const uint16_t invalid_
Definition: Constants.h:16
const uint16_t & fecSlot() const
virtual void header(std::stringstream &) const
std::vector< VFloat > VVFloat
Abstract base for derived classes that provide analysis of commissioning histograms.
Log< level::Warning, false > LogWarning
const uint16_t & fecRing() const
const uint16_t & fecCrate() const