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 }
CommissioningAnalysis::getErrorCodes
const VString & getErrorCodes() const
Definition: CommissioningAnalysis.h:131
SiStripEnumsAndStrings::runType
static std::string runType(const sistrip::RunType &)
Definition: SiStripEnumsAndStrings.cc:39
sistrip::extrainfo::commonMode_
static const char commonMode_[]
Definition: ConstantsForDqm.h:48
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
sistrip::extrainfo::noise_
static const char noise_[]
Definition: ConstantsForDqm.h:47
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
PedestalsAnalysis::PedestalsAnalysis
PedestalsAnalysis()
Definition: PedestalsAnalysis.cc:41
PedestalsAnalysis::summary
void summary(std::stringstream &) const override
Definition: PedestalsAnalysis.cc:112
PedestalsAnalysis::rawMin_
VFloat rawMin_
Definition: PedestalsAnalysis.h:126
SiStripKey::key
const uint32_t & key() const
Definition: SiStripKey.h:120
SiStripFecKey::lldChan
const uint16_t & lldChan() const
Definition: SiStripFecKey.h:203
CommissioningAnalysis::fedKey
const uint32_t & fedKey() const
Definition: CommissioningAnalysis.h:134
sistrip::dir_
static const char dir_[]
Definition: ConstantsForDqm.h:17
PedestalsAnalysis::noiseSpread_
VFloat noiseSpread_
Definition: PedestalsAnalysis.h:102
CommissioningAnalysis::VVInt
std::vector< VInt > VVInt
Definition: CommissioningAnalysis.h:36
PedestalsAnalysis::print
void print(std::stringstream &, uint32_t apv_number=0) override
Definition: PedestalsAnalysis.cc:173
SiStripFecKey::fecCrate
const uint16_t & fecCrate() const
Definition: SiStripFecKey.h:198
sistrip::RunType
RunType
Definition: ConstantsForRunType.h:70
SiStripFedKey
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
sistrip::extrainfo::pedsAndCmSubNoise_
static const char pedsAndCmSubNoise_[]
Definition: ConstantsForDqm.h:55
PedestalsAnalysis::noisy_
VVInt noisy_
Definition: PedestalsAnalysis.h:88
CommissioningAnalysis::VFloat
std::vector< float > VFloat
Definition: CommissioningAnalysis.h:30
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
PedestalsAnalysis::legacy_
bool legacy_
Definition: PedestalsAnalysis.h:129
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
sistrip::noiseMin_
static const char noiseMin_[]
Definition: ConstantsForMonitorable.h:86
sistrip::mlCommissioning_
static const char mlCommissioning_[]
Definition: ConstantsForLogger.h:15
sistrip::noiseMax_
static const char noiseMax_[]
Definition: ConstantsForMonitorable.h:85
PedestalsAnalysis::pedsMin_
VFloat pedsMin_
Definition: PedestalsAnalysis.h:114
CommissioningAnalysis::header
virtual void header(std::stringstream &) const
Definition: CommissioningAnalysis.cc:33
SiStripFecKey::fecRing
const uint16_t & fecRing() const
Definition: SiStripFecKey.h:200
PedestalsAnalysis::reset
void reset() override
Definition: PedestalsAnalysis.cc:69
PedestalsAnalysis::rawSpread_
VFloat rawSpread_
Definition: PedestalsAnalysis.h:108
PedestalsAnalysis::raw_
VVFloat raw_
Definition: PedestalsAnalysis.h:80
sistrip::EXPERT_HISTO
Definition: ConstantsForHistoType.h:29
PedestalsAnalysis::dead_
VVInt dead_
Definition: PedestalsAnalysis.h:85
sistrip::extrainfo::pedestals_
static const char pedestals_[]
Definition: ConstantsForDqm.h:45
PedestalsAnalysis::peds_
VVFloat peds_
Definition: PedestalsAnalysis.h:74
SiStripFecKey
Utility class that identifies a position within the strip tracker control structure,...
Definition: SiStripFecKey.h:45
PedestalsAnalysis::pedsSpread_
VFloat pedsSpread_
Definition: PedestalsAnalysis.h:96
sistrip::noiseSpread_
static const char noiseSpread_[]
Definition: ConstantsForMonitorable.h:84
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripFecKey::ccuChan
const uint16_t & ccuChan() const
Definition: SiStripFecKey.h:202
PedestalsAnalysis::isValid
bool isValid() const override
Definition: PedestalsAnalysis.cc:96
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
sistrip::maximum_
static const uint16_t maximum_
Definition: Constants.h:20
sistrip::controlView_
static const char controlView_[]
Definition: ConstantsForView.h:21
sistrip::APV
Definition: ConstantsForGranularity.h:79
PedestalsAnalysis::pedsMean_
VFloat pedsMean_
Definition: PedestalsAnalysis.h:93
PedestalsAnalysis::rawMax_
VFloat rawMax_
Definition: PedestalsAnalysis.h:123
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
sistrip::extrainfo::pedsAndRawNoise_
static const char pedsAndRawNoise_[]
Definition: ConstantsForDqm.h:53
sistrip::dqmRoot_
static const char dqmRoot_[]
Definition: ConstantsForDqm.h:28
CommissioningAnalysis::VInt
std::vector< uint16_t > VInt
Definition: CommissioningAnalysis.h:34
CommissioningAnalysis
Abstract base for derived classes that provide analysis of commissioning histograms.
Definition: CommissioningAnalysis.h:18
SiStripFecKey::i2cAddr
const uint16_t & i2cAddr() const
Definition: SiStripFecKey.h:204
CommissioningAnalysis::fecKey
const uint32_t & fecKey() const
Definition: CommissioningAnalysis.h:133
PedestalsAnalysis::noiseMax_
VFloat noiseMax_
Definition: PedestalsAnalysis.h:117
SiStripEnumsAndStrings.h
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
SiStripFecKey::ccuAddr
const uint16_t & ccuAddr() const
Definition: SiStripFecKey.h:201
SiStripHistoTitle.h
CommissioningAnalysis::myName
const std::string & myName() const
Definition: CommissioningAnalysis.h:139
PedestalsAnalysis::noiseMin_
VFloat noiseMin_
Definition: PedestalsAnalysis.h:120
SiStripHistoTitle
Utility class that holds histogram title.
Definition: SiStripHistoTitle.h:20
PedestalsAnalysis.h
sistrip::extrainfo::rawNoise_
static const char rawNoise_[]
Definition: ConstantsForDqm.h:46
CommissioningAnalysis::VVFloat
std::vector< VFloat > VVFloat
Definition: CommissioningAnalysis.h:32
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
sistrip::FED_KEY
Definition: ConstantsForKeyType.h:30
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
PedestalsAnalysis::pedsMax_
VFloat pedsMax_
Definition: PedestalsAnalysis.h:111
PedestalsAnalysis::noise_
VVFloat noise_
Definition: PedestalsAnalysis.h:77
SiStripFecKey::fecSlot
const uint16_t & fecSlot() const
Definition: SiStripFecKey.h:199
PedestalsAnalysis::noiseMean_
VFloat noiseMean_
Definition: PedestalsAnalysis.h:99
crabWrapper.key
key
Definition: crabWrapper.py:19
PedestalsAnalysis::rawMean_
VFloat rawMean_
Definition: PedestalsAnalysis.h:105
cuy.ii
ii
Definition: cuy.py:590
sistrip::LLD_CHAN
Definition: ConstantsForGranularity.h:78
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
sistrip::noiseMean_
static const char noiseMean_[]
Definition: ConstantsForMonitorable.h:83