CMS 3D CMS Logo

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