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_)),
56  pedsMean_(2, sistrip::invalid_),
57  pedsSpread_(2, sistrip::invalid_),
60  rawMean_(2, sistrip::invalid_),
61  rawSpread_(2, sistrip::invalid_),
62  pedsMax_(2, sistrip::invalid_),
63  pedsMin_(2, sistrip::invalid_),
66  rawMax_(2, 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 }
CommissioningAnalysis::getErrorCodes
const VString & getErrorCodes() const
Definition: CommissioningAnalysis.h:131
SiStripEnumsAndStrings::runType
static std::string runType(const sistrip::RunType &)
Definition: SiStripEnumsAndStrings.cc:39
DaqScopeModeAnalysis::noiseMin_
VFloat noiseMin_
Definition: DaqScopeModeAnalysis.h:124
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
DaqScopeModeAnalysis::raw_
VVFloat raw_
Definition: DaqScopeModeAnalysis.h:96
sistrip::extrainfo::noise_
static const char noise_[]
Definition: ConstantsForDqm.h:47
MessageLogger.h
sistrip::extrainfo::scopeModeHeaderHigh_
static const char scopeModeHeaderHigh_[]
Definition: ConstantsForDqm.h:65
DaqScopeModeAnalysis::noise_
VVFloat noise_
Definition: DaqScopeModeAnalysis.h:94
DaqScopeModeAnalysis::isValid
bool isValid() const override
Definition: DaqScopeModeAnalysis.cc:124
SiStripKey::key
const uint32_t & key() const
Definition: SiStripKey.h:120
DaqScopeModeAnalysis::reset
void reset() override
Definition: DaqScopeModeAnalysis.cc:76
SiStripFecKey::lldChan
const uint16_t & lldChan() const
Definition: SiStripFecKey.h:203
CommissioningAnalysis::fedKey
const uint32_t & fedKey() const
Definition: CommissioningAnalysis.h:134
DaqScopeModeAnalysis::summary
void summary(std::stringstream &) const override
Definition: DaqScopeModeAnalysis.cc:216
sistrip::dir_
static const char dir_[]
Definition: ConstantsForDqm.h:17
DaqScopeModeAnalysis::noisy_
VVInt noisy_
Definition: DaqScopeModeAnalysis.h:101
DaqScopeModeAnalysis::rawSpread_
VFloat rawSpread_
Definition: DaqScopeModeAnalysis.h:114
CommissioningAnalysis::VVInt
std::vector< VInt > VVInt
Definition: CommissioningAnalysis.h:36
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
CommissioningAnalysis::VFloat
std::vector< float > VFloat
Definition: CommissioningAnalysis.h:30
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
DaqScopeModeAnalysis::pedsSpread_
VFloat pedsSpread_
Definition: DaqScopeModeAnalysis.h:106
sistrip::valid_
static const uint16_t valid_
Definition: Constants.h:17
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
sistrip::noiseMin_
static const char noiseMin_[]
Definition: ConstantsForMonitorable.h:86
DaqScopeModeAnalysis::pedsMean_
VFloat pedsMean_
Definition: DaqScopeModeAnalysis.h:104
sistrip::mlCommissioning_
static const char mlCommissioning_[]
Definition: ConstantsForLogger.h:15
sistrip::noiseMax_
static const char noiseMax_[]
Definition: ConstantsForMonitorable.h:85
CommissioningAnalysis::header
virtual void header(std::stringstream &) const
Definition: CommissioningAnalysis.cc:33
SiStripFecKey::fecRing
const uint16_t & fecRing() const
Definition: SiStripFecKey.h:200
DaqScopeModeAnalysis::noiseMean_
VFloat noiseMean_
Definition: DaqScopeModeAnalysis.h:108
sistrip::EXPERT_HISTO
Definition: ConstantsForHistoType.h:29
DaqScopeModeAnalysis::base_
float base_
Definition: DaqScopeModeAnalysis.h:87
sistrip::extrainfo::pedestals_
static const char pedestals_[]
Definition: ConstantsForDqm.h:45
DaqScopeModeAnalysis::rawMin_
VFloat rawMin_
Definition: DaqScopeModeAnalysis.h:128
SiStripFecKey
Utility class that identifies a position within the strip tracker control structure,...
Definition: SiStripFecKey.h:45
sistrip::noiseSpread_
static const char noiseSpread_[]
Definition: ConstantsForMonitorable.h:84
SiStripFecKey::ccuChan
const uint16_t & ccuChan() const
Definition: SiStripFecKey.h:202
DaqScopeModeAnalysis::pedsMin_
VFloat pedsMin_
Definition: DaqScopeModeAnalysis.h:119
sistrip::extrainfo::scopeModeFrame_
static const char scopeModeFrame_[]
Definition: ConstantsForDqm.h:63
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
sistrip::maximum_
static const uint16_t maximum_
Definition: Constants.h:20
sistrip::controlView_
static const char controlView_[]
Definition: ConstantsForView.h:21
DaqScopeModeAnalysis::noiseSpread_
VFloat noiseSpread_
Definition: DaqScopeModeAnalysis.h:110
sistrip::APV
Definition: ConstantsForGranularity.h:79
DaqScopeModeAnalysis::rawMax_
VFloat rawMax_
Definition: DaqScopeModeAnalysis.h:126
DaqScopeModeAnalysis::noiseMax_
VFloat noiseMax_
Definition: DaqScopeModeAnalysis.h:122
DaqScopeModeAnalysis::peds_
VVFloat peds_
Definition: DaqScopeModeAnalysis.h:92
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
DaqScopeModeAnalysis::tickMarkHeightThreshold_
static const float tickMarkHeightThreshold_
Definition: DaqScopeModeAnalysis.h:78
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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
DaqScopeModeAnalysis::dead_
VVInt dead_
Definition: DaqScopeModeAnalysis.h:99
SiStripFecKey::i2cAddr
const uint16_t & i2cAddr() const
Definition: SiStripFecKey.h:204
CommissioningAnalysis::fecKey
const uint32_t & fecKey() const
Definition: CommissioningAnalysis.h:133
DaqScopeModeAnalysis::DaqScopeModeAnalysis
DaqScopeModeAnalysis()
Definition: DaqScopeModeAnalysis.cc:46
SiStripEnumsAndStrings.h
DaqScopeModeAnalysis::rawMean_
VFloat rawMean_
Definition: DaqScopeModeAnalysis.h:112
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
DaqScopeModeAnalysis::foundTickMark
bool foundTickMark() const
Definition: DaqScopeModeAnalysis.cc:117
SiStripHistoTitle
Utility class that holds histogram title.
Definition: SiStripHistoTitle.h:20
DaqScopeModeAnalysis::frameFindingThreshold
uint16_t frameFindingThreshold() const
Definition: DaqScopeModeAnalysis.cc:106
DaqScopeModeAnalysis.h
DaqScopeModeAnalysis::print
void print(std::stringstream &, uint32_t apv_number=0) override
Definition: DaqScopeModeAnalysis.cc:140
sistrip::extrainfo::rawNoise_
static const char rawNoise_[]
Definition: ConstantsForDqm.h:46
sistrip::extrainfo::scopeModeHeaderLow_
static const char scopeModeHeaderLow_[]
Definition: ConstantsForDqm.h:64
CommissioningAnalysis::VVFloat
std::vector< VFloat > VVFloat
Definition: CommissioningAnalysis.h:32
DaqScopeModeAnalysis::height_
float height_
Definition: DaqScopeModeAnalysis.h:85
DaqScopeModeAnalysis::frameFindingThreshold_
static const float frameFindingThreshold_
Definition: DaqScopeModeAnalysis.h:81
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: EnsembleCalibrationLA.cc:10
SiStripFecKey::fecSlot
const uint16_t & fecSlot() const
Definition: SiStripFecKey.h:199
DaqScopeModeAnalysis::pedsMax_
VFloat pedsMax_
Definition: DaqScopeModeAnalysis.h:117
crabWrapper.key
key
Definition: crabWrapper.py:19
cuy.ii
ii
Definition: cuy.py:589
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
DaqScopeModeAnalysis::peak_
float peak_
Definition: DaqScopeModeAnalysis.h:89