CMS 3D CMS Logo

SiPixelPerformanceSummary.cc
Go to the documentation of this file.
2 
4 
5 #include <algorithm>
6 
7 using namespace edm;
8 using namespace std;
9 
11  : timeStamp_(0), runNumber_(0), luminosityBlock_(0), numberOfEvents_(0) {}
12 
14  timeStamp_ = performanceSummary.getTimeStamp();
15  runNumber_ = performanceSummary.getRunNumber();
16  luminosityBlock_ = performanceSummary.getLuminosityBlock();
17  numberOfEvents_ = performanceSummary.getNumberOfEvents();
18  allDetSummaries_ = performanceSummary.getAllDetSummaries();
19 }
20 
22 
24  timeStamp_ = 0;
25  runNumber_ = 0;
26  luminosityBlock_ = 0;
27  numberOfEvents_ = 0;
28  allDetSummaries_.clear();
29 }
30 
31 pair<bool, vector<SiPixelPerformanceSummary::DetSummary>::iterator> SiPixelPerformanceSummary::initDet(
32  const uint32_t detId) {
33  vector<float> performanceValues;
34  performanceValues.reserve(kDetSummarySize);
35  for (int i = 0; i < kDetSummarySize; ++i)
36  performanceValues.push_back(kDefaultValue);
37  return setDet(detId, performanceValues);
38 }
39 
40 pair<bool, vector<SiPixelPerformanceSummary::DetSummary>::iterator> SiPixelPerformanceSummary::setDet(
41  const uint32_t detId, const vector<float>& performanceValues) {
42  vector<DetSummary>::iterator iDetSumm = allDetSummaries_.end();
43 
44  if (performanceValues.size() != kDetSummarySize) { // for inappropriate input
45  cout << "not adding these " << performanceValues.size() << " values; "
46  << "SiPixelPerformanceSummary can only add " << kDetSummarySize << " values per DetSummary";
47  return make_pair(false, iDetSumm);
48  }
49  iDetSumm = lower_bound(
51 
52  if (iDetSumm != allDetSummaries_.end() && // for an existong entry
53  iDetSumm->detId_ == detId)
54  return make_pair(false, iDetSumm);
55 
56  DetSummary newDetSumm; // for a new entry, put at (position-1) returned by StrictWeakOrdering
57  newDetSumm.detId_ = detId;
58  newDetSumm.performanceValues_ = performanceValues;
59  return make_pair(true, allDetSummaries_.insert(iDetSumm, newDetSumm));
60 }
61 
62 bool SiPixelPerformanceSummary::setValue(uint32_t detId, int index, float performanceValue) {
63  if (index > kDetSummarySize) {
64  cout << "cannot set the performance value for index = " << index << " > " << kDetSummarySize;
65  return false;
66  }
67  pair<bool, vector<DetSummary>::iterator> initResult = initDet(detId);
68  if (initResult.first || initResult.second != allDetSummaries_.end()) {
69  initResult.second->performanceValues_[index] = performanceValue;
70  return true;
71  } else {
72  cout << "cannot set the performance value; cannot create new entry for detId = " << detId;
73  return false;
74  }
75  return true;
76 }
77 
78 float SiPixelPerformanceSummary::getValue(uint32_t detId, int index) {
79  if (index > kDetSummarySize) {
80  cout << "cannot get value for detId = " << detId << " index = " << index << " > " << kDetSummarySize;
81  return kDefaultValue;
82  }
83  vector<float> performanceValues = getDetSummary(detId);
84  if (performanceValues.size() == kDetSummarySize)
85  return performanceValues[index];
86  else
87  return kDefaultValue;
88 }
89 
90 bool SiPixelPerformanceSummary::setRawDataErrorType(uint32_t detId, int bin, float nErrors) {
91  return setValue(detId, bin, nErrors);
92 }
93 
94 bool SiPixelPerformanceSummary::setNumberOfDigis(uint32_t detId, float mean, float rms, float emPtn) {
95  return (setValue(detId, 15, mean) && setValue(detId, 16, rms) && setValue(detId, 17, emPtn));
96 }
97 
98 bool SiPixelPerformanceSummary::setADC(uint32_t detId, float mean, float rms, float emPtn) {
99  return (setValue(detId, 18, mean) && setValue(detId, 19, rms) && setValue(detId, 20, emPtn));
100 }
101 
102 bool SiPixelPerformanceSummary::setNumberOfClusters(uint32_t detId, float mean, float rms, float emPtn) {
103  return (setValue(detId, 21, mean) && setValue(detId, 22, rms) && setValue(detId, 23, emPtn));
104 }
105 
106 bool SiPixelPerformanceSummary::setClusterCharge(uint32_t detId, float mean, float rms, float emPtn) {
107  return (setValue(detId, 24, mean) && setValue(detId, 25, rms) && setValue(detId, 26, emPtn));
108 }
109 
110 bool SiPixelPerformanceSummary::setClusterSize(uint32_t detId, float mean, float rms, float emPtn) {
111  return (setValue(detId, 27, mean) && setValue(detId, 28, rms) && setValue(detId, 29, emPtn));
112 }
113 
114 bool SiPixelPerformanceSummary::setClusterSizeX(uint32_t detId, float mean, float rms, float emPtn) {
115  return (setValue(detId, 30, mean) && setValue(detId, 31, rms) && setValue(detId, 32, emPtn));
116 }
117 
118 bool SiPixelPerformanceSummary::setClusterSizeY(uint32_t detId, float mean, float rms, float emPtn) {
119  return (setValue(detId, 33, mean) && setValue(detId, 34, rms) && setValue(detId, 35, emPtn));
120 }
121 
122 bool SiPixelPerformanceSummary::setNumberOfRecHits(uint32_t detId, float mean, float rms, float emPtn) {
123  return (setValue(detId, 36, mean) && setValue(detId, 37, rms) && setValue(detId, 38, emPtn));
124 }
125 
126 bool SiPixelPerformanceSummary::setResidualX(uint32_t detId, float mean, float rms, float emPtn) {
127  return (setValue(detId, 39, mean) && setValue(detId, 40, rms) && setValue(detId, 41, emPtn));
128 }
129 
130 bool SiPixelPerformanceSummary::setResidualY(uint32_t detId, float mean, float rms, float emPtn) {
131  return (setValue(detId, 42, mean) && setValue(detId, 43, rms) && setValue(detId, 44, emPtn));
132 }
133 
134 bool SiPixelPerformanceSummary::setNumberOfNoisCells(uint32_t detId, float nNpixCells) {
135  return setValue(detId, 45, nNpixCells);
136 }
137 
138 bool SiPixelPerformanceSummary::setNumberOfDeadCells(uint32_t detId, float nNpixCells) {
139  return setValue(detId, 46, nNpixCells);
140 }
141 
142 bool SiPixelPerformanceSummary::setNumberOfPixelHitsInTrackFit(uint32_t detId, float nPixelHits) {
143  return setValue(detId, 47, nPixelHits);
144 }
145 
146 bool SiPixelPerformanceSummary::setFractionOfTracks(uint32_t detId, float mean, float rms) {
147  return (setValue(detId, 48, mean) && setValue(detId, 49, rms));
148 }
149 
151  return setValue(detId, 50, nClusters);
152 }
153 
155  return setValue(detId, 51, nClusters);
156 }
157 
158 bool SiPixelPerformanceSummary::setClusterChargeOnTrack(uint32_t detId, float mean, float rms) {
159  return (setValue(detId, 52, mean) && setValue(detId, 53, rms));
160 }
161 
163  return (setValue(detId, 54, mean) && setValue(detId, 55, rms));
164 }
165 
166 bool SiPixelPerformanceSummary::setClusterSizeOnTrack(uint32_t detId, float mean, float rms) {
167  return (setValue(detId, 56, mean) && setValue(detId, 57, rms));
168 }
169 
170 bool SiPixelPerformanceSummary::setClusterSizeOffTrack(uint32_t detId, float mean, float rms) {
171  return (setValue(detId, 58, mean) && setValue(detId, 59, rms));
172 }
173 
174 vector<uint32_t> SiPixelPerformanceSummary::getAllDetIds() const {
175  vector<uint32_t> allDetIds;
176  for (vector<DetSummary>::const_iterator iDetSumm = allDetSummaries_.begin(); iDetSumm != allDetSummaries_.end();
177  ++iDetSumm)
178  allDetIds.push_back(iDetSumm->detId_);
179  return allDetIds;
180 }
181 
182 vector<float> SiPixelPerformanceSummary::getDetSummary(const uint32_t detId) const {
183  vector<DetSummary>::const_iterator iDetSumm =
184  find_if(allDetSummaries_.begin(), allDetSummaries_.end(), [&detId](const DetSummary& detSumm) -> bool {
185  return detSumm.detId_ == detId;
186  });
187  if (iDetSumm == allDetSummaries_.end()) {
188  vector<float> performanceValues;
189  cout << "cannot get DetSummary for detId = " << detId;
190  return performanceValues;
191  } else
192  return iDetSumm->performanceValues_;
193 }
194 
195 void SiPixelPerformanceSummary::print(const uint32_t detId) const {
196  vector<float> performanceValues = getDetSummary(detId);
197  cout << "DetSummary for detId " << detId << " : ";
198  for (vector<float>::const_iterator v = performanceValues.begin(); v != performanceValues.end(); ++v)
199  cout << " " << *v;
200  cout << endl;
201 }
202 
204  cout << "SiPixelPerformanceSummary size (allDets) = " << allDetSummaries_.size() << ", "
205  << "time stamp = " << timeStamp_ << ", "
206  << "run number = " << runNumber_ << ", "
207  << "luminosity section = " << luminosityBlock_ << ", "
208  << "number of events = " << numberOfEvents_ << endl;
209 }
210 
212  print();
213  for (vector<DetSummary>::const_iterator iDetSumm = allDetSummaries_.begin(); iDetSumm != allDetSummaries_.end();
214  ++iDetSumm)
215  print(iDetSumm->detId_);
216 }
heavyionUCCDQM_cfi.nClusters
nClusters
Definition: heavyionUCCDQM_cfi.py:9
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
SiPixelPerformanceSummary::DetSummary::detId_
uint32_t detId_
Definition: SiPixelPerformanceSummary.h:17
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
SiPixelPerformanceSummary::setClusterSizeY
bool setClusterSizeY(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:118
edm
HLT enums.
Definition: AlignableModifier.h:19
SiPixelPerformanceSummary::setNumberOfDigis
bool setNumberOfDigis(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:94
SiPixelPerformanceSummary::StrictWeakOrdering
Definition: SiPixelPerformanceSummary.h:23
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiPixelPerformanceSummary::setNumberOfDeadCells
bool setNumberOfDeadCells(uint32_t detId, float nNpixCells)
Definition: SiPixelPerformanceSummary.cc:138
SiPixelPerformanceSummary::setNumberOfPixelHitsInTrackFit
bool setNumberOfPixelHitsInTrackFit(uint32_t detId, float nPixelHits)
Definition: SiPixelPerformanceSummary.cc:142
SiPixelPerformanceSummary::setClusterChargeOnTrack
bool setClusterChargeOnTrack(uint32_t detId, float mean, float rms)
Definition: SiPixelPerformanceSummary.cc:158
SiPixelPerformanceSummary::initDet
std::pair< bool, std::vector< DetSummary >::iterator > initDet(const uint32_t detId)
Definition: SiPixelPerformanceSummary.cc:31
SiPixelPerformanceSummary::getDetSummary
std::vector< float > getDetSummary(uint32_t detId) const
Definition: SiPixelPerformanceSummary.cc:182
findQualityFiles.v
v
Definition: findQualityFiles.py:179
SiPixelPerformanceSummary::getLuminosityBlock
unsigned int getLuminosityBlock() const
Definition: SiPixelPerformanceSummary.h:49
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
SiPixelPerformanceSummary::setClusterSizeX
bool setClusterSizeX(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:114
SiPixelPerformanceSummary::getTimeStamp
unsigned long long getTimeStamp() const
Definition: SiPixelPerformanceSummary.h:40
SiPixelPerformanceSummary::setDet
std::pair< bool, std::vector< DetSummary >::iterator > setDet(const uint32_t detId, const std::vector< float > &performanceValues)
Definition: SiPixelPerformanceSummary.cc:40
SiPixelPerformanceSummary::numberOfEvents_
unsigned int numberOfEvents_
Definition: SiPixelPerformanceSummary.h:99
SiPixelPerformanceSummary::setNumberOfOnTrackClusters
bool setNumberOfOnTrackClusters(uint32_t detId, float nClusters)
Definition: SiPixelPerformanceSummary.cc:150
SiPixelPerformanceSummary::setFractionOfTracks
bool setFractionOfTracks(uint32_t detId, float mean, float rms)
Definition: SiPixelPerformanceSummary.cc:146
SiPixelPerformanceSummary::setNumberOfRecHits
bool setNumberOfRecHits(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:122
SiPixelPerformanceSummary::DetSummary
Definition: SiPixelPerformanceSummary.h:16
SiPixelPerformanceSummary::setClusterSizeOffTrack
bool setClusterSizeOffTrack(uint32_t detId, float mean, float rms)
Definition: SiPixelPerformanceSummary.cc:170
SiPixelPerformanceSummary::setClusterChargeOffTrack
bool setClusterChargeOffTrack(uint32_t detId, float mean, float rms)
Definition: SiPixelPerformanceSummary.cc:162
SiPixelPerformanceSummary.h
SiPixelPerformanceSummary::setNumberOfClusters
bool setNumberOfClusters(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:102
SiPixelPerformanceSummary::setADC
bool setADC(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:98
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
kDetSummarySize
#define kDetSummarySize
Definition: SiPixelPerformanceSummary.h:11
SiPixelPerformanceSummary::allDetSummaries_
std::vector< DetSummary > allDetSummaries_
Definition: SiPixelPerformanceSummary.h:101
SiPixelPerformanceSummary::getAllDetIds
std::vector< uint32_t > getAllDetIds() const
Definition: SiPixelPerformanceSummary.cc:174
SiPixelPerformanceSummary::getRunNumber
unsigned int getRunNumber() const
Definition: SiPixelPerformanceSummary.h:43
kDefaultValue
#define kDefaultValue
Definition: SiPixelPerformanceSummary.h:12
SiPixelPerformanceSummary::print
void print() const
Definition: SiPixelPerformanceSummary.cc:203
SiPixelPerformanceSummary::getNumberOfEvents
unsigned int getNumberOfEvents() const
Definition: SiPixelPerformanceSummary.h:46
SiPixelPerformanceSummary::SiPixelPerformanceSummary
SiPixelPerformanceSummary()
Definition: SiPixelPerformanceSummary.cc:10
SiPixelPerformanceSummary::luminosityBlock_
unsigned int luminosityBlock_
Definition: SiPixelPerformanceSummary.h:98
SiPixelPerformanceSummary::timeStamp_
unsigned long long timeStamp_
Definition: SiPixelPerformanceSummary.h:96
SiPixelPerformanceSummary::setRawDataErrorType
bool setRawDataErrorType(uint32_t detId, int bin, float nErrors)
Definition: SiPixelPerformanceSummary.cc:90
SiPixelPerformanceSummary::setResidualY
bool setResidualY(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:130
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
SiPixelPerformanceSummary::setNumberOfOffTrackClusters
bool setNumberOfOffTrackClusters(uint32_t detId, float nClusters)
Definition: SiPixelPerformanceSummary.cc:154
SiPixelPerformanceSummary
Definition: SiPixelPerformanceSummary.h:14
SiPixelPerformanceSummary::runNumber_
unsigned int runNumber_
Definition: SiPixelPerformanceSummary.h:97
SiPixelPerformanceSummary::setResidualX
bool setResidualX(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:126
std
Definition: JetResolutionObject.h:76
SiPixelPerformanceSummary::getAllDetSummaries
std::vector< DetSummary > getAllDetSummaries() const
Definition: SiPixelPerformanceSummary.h:56
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SiPixelPerformanceSummary::setClusterSizeOnTrack
bool setClusterSizeOnTrack(uint32_t detId, float mean, float rms)
Definition: SiPixelPerformanceSummary.cc:166
SiPixelPerformanceSummary::setNumberOfNoisCells
bool setNumberOfNoisCells(uint32_t detId, float nNpixCells)
Definition: SiPixelPerformanceSummary.cc:134
SiPixelPerformanceSummary::~SiPixelPerformanceSummary
~SiPixelPerformanceSummary()
Definition: SiPixelPerformanceSummary.cc:21
SiPixelPerformanceSummary::DetSummary::performanceValues_
std::vector< float > performanceValues_
Definition: SiPixelPerformanceSummary.h:18
SiPixelPerformanceSummary::setClusterSize
bool setClusterSize(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:110
SiPixelPerformanceSummary::setValue
bool setValue(uint32_t detId, int index, float performanceValue)
Definition: SiPixelPerformanceSummary.cc:62
sistrip::runNumber_
static const char runNumber_[]
Definition: ConstantsForDqm.h:33
SiPixelPerformanceSummary::printAll
void printAll() const
Definition: SiPixelPerformanceSummary.cc:211
SiPixelPerformanceSummary::setClusterCharge
bool setClusterCharge(uint32_t detId, float mean, float rms, float emPtn)
Definition: SiPixelPerformanceSummary.cc:106
SiPixelPerformanceSummary::clear
void clear()
Definition: SiPixelPerformanceSummary.cc:23
SiPixelPerformanceSummary::getValue
float getValue(uint32_t detId, int index)
Definition: SiPixelPerformanceSummary.cc:78