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