CMS 3D CMS Logo

PedsOnlyAnalysis.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, "PedsOnlyAnalysis"),
15  peds_(2, VFloat(128, sistrip::invalid_)),
16  raw_(2, VFloat(128, sistrip::invalid_)),
17  pedsMean_(2, sistrip::invalid_),
18  pedsSpread_(2, sistrip::invalid_),
19  rawMean_(2, sistrip::invalid_),
20  rawSpread_(2, sistrip::invalid_),
21  pedsMax_(2, sistrip::invalid_),
22  pedsMin_(2, sistrip::invalid_),
23  rawMax_(2, sistrip::invalid_),
24  rawMin_(2, sistrip::invalid_),
25  legacy_(false) {}
26 
27 // ----------------------------------------------------------------------------
28 //
30  : CommissioningAnalysis("PedsOnlyAnalysis"),
31  peds_(2, VFloat(128, sistrip::invalid_)),
32  raw_(2, VFloat(128, sistrip::invalid_)),
41  legacy_(false) {}
42 
43 // ----------------------------------------------------------------------------
44 //
56  legacy_ = false;
57 }
58 
59 // ----------------------------------------------------------------------------
60 //
68 }
69 
70 // ----------------------------------------------------------------------------
71 //
72 void PedsOnlyAnalysis::summary(std::stringstream& ss) const {
73  SiStripFecKey fec_key(fecKey());
74  SiStripFedKey fed_key(fedKey());
75 
77 
78  std::stringstream extra1, extra2, extra3;
79  if (legacy_) {
83  } else {
87  }
88 
90  type,
92  fed_key.key(),
94  fec_key.lldChan(),
95  extra1.str())
96  .title();
98  type,
100  fed_key.key(),
102  fec_key.lldChan(),
103  extra2.str())
104  .title();
106  type,
108  fed_key.key(),
109  sistrip::APV,
110  SiStripFecKey::i2cAddr(fec_key.lldChan(), true),
111  extra3.str())
112  .title();
114  type,
116  fed_key.key(),
117  sistrip::APV,
118  SiStripFecKey::i2cAddr(fec_key.lldChan(), false),
119  extra3.str())
120  .title();
121 
122  ss << " Summary"
123  << ":" << (isValid() ? "Valid" : "Invalid") << ":" << sistrip::controlView_ << ":" << fec_key.fecCrate() << "/"
124  << fec_key.fecSlot() << "/" << fec_key.fecRing() << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan() << ":"
125  << sistrip::dqmRoot_ << sistrip::dir_ << "Collate" << sistrip::dir_
126  << SiStripFecKey(fec_key.fecCrate(), fec_key.fecSlot(), fec_key.fecRing(), fec_key.ccuAddr(), fec_key.ccuChan())
127  .path()
128  << ":" << title1 << ";" << title2 << ";" << title3 << ";" << title4 << std::endl;
129 }
130 
131 // ----------------------------------------------------------------------------
132 //
133 void PedsOnlyAnalysis::print(std::stringstream& ss, uint32_t iapv) {
134  if (iapv == 1 || iapv == 2) {
135  iapv--;
136  } else {
137  iapv = 0;
138  }
139 
140  if (peds_[iapv].size() < 128 || raw_[iapv].size() < 128) {
141  edm::LogWarning(mlCommissioning_) << "[" << myName() << "::" << __func__ << "]"
142  << " Unexpected number of pedestal/noise values: " << peds_[iapv].size() << ", "
143  << raw_[iapv].size();
144  return;
145  }
146 
147  header(ss);
148  ss << " Monitorables for APV number : " << iapv;
149  if (iapv == 0) {
150  ss << " (first of pair)";
151  } else if (iapv == 1) {
152  ss << " (second of pair)";
153  }
154  ss << std::endl;
155  ss << std::fixed << std::setprecision(2);
156  ss << " Example peds/noise for strips : "
157  << " 0, 31, 63, 127" << std::endl
158  << " Peds [ADC] : " << std::setw(6) << peds_[iapv][0] << ", " << std::setw(6)
159  << peds_[iapv][31] << ", " << std::setw(6) << peds_[iapv][63] << ", " << std::setw(6) << peds_[iapv][127]
160  << std::endl
161  << " Raw noise [ADC] : " << std::setw(6) << raw_[iapv][0] << ", " << std::setw(6) << raw_[iapv][31]
162  << ", " << std::setw(6) << raw_[iapv][63] << ", " << std::setw(6) << raw_[iapv][127] << std::endl;
163  ss << " Mean peds +/- spread [ADC] : " << pedsMean_[iapv] << " +/- " << pedsSpread_[iapv] << std::endl
164  << " Min/Max pedestal [ADC] : " << pedsMin_[iapv] << " <-> " << pedsMax_[iapv] << std::endl
165  << " Mean raw noise +/- spread [ADC] : " << rawMean_[iapv] << " +/- " << rawSpread_[iapv] << std::endl
166  << " Min/Max raw noise [ADC] : " << rawMin_[iapv] << " <-> " << rawMax_[iapv] << std::endl
167  << std::boolalpha << " isValid : " << isValid() << std::endl
168  << std::noboolalpha << " Error codes (found " << std::setw(2) << std::setfill(' ') << getErrorCodes().size()
169  << ") : ";
170  if (getErrorCodes().empty()) {
171  ss << "(none)";
172  } else {
173  VString::const_iterator istr = getErrorCodes().begin();
174  VString::const_iterator jstr = getErrorCodes().end();
175  for (; istr != jstr; ++istr) {
176  ss << *istr << " ";
177  }
178  }
179  ss << std::endl;
180 }
size
Write out results.
type
Definition: HCALResponse.h:21
static const char rawNoise_[]
const uint32_t & fedKey() const
const uint16_t & fecRing() const
void print(std::stringstream &, uint32_t apv_number=0) override
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
void summary(std::stringstream &) const override
bool isValid() const override
const uint16_t & lldChan() const
const uint16_t & fecSlot() const
const uint16_t & i2cAddr() const
sistrip classes
const uint32_t & key() const
Definition: SiStripKey.h:120
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 controlView_[]
static const uint16_t maximum_
Definition: Constants.h:20
static const char dqmRoot_[]
const uint32_t & fecKey() const
static const char commonMode_[]
const uint16_t & fecCrate() const
static const char pedestals_[]
static const char pedsAndCmSubNoise_[]
virtual void header(std::stringstream &) const
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:16
void reset() override
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