CMS 3D CMS Logo

SiStripBaseCondObjDQM.cc
Go to the documentation of this file.
5 
6 #include "TCanvas.h"
7 
9  edm::ParameterSet const &hPSet,
10  edm::ParameterSet const &fPSet,
11  const TrackerTopology *tTopo)
12  : hPSet_(hPSet), fPSet_(fPSet), tTopo_(tTopo), dqmStore_(edm::Service<DQMStore>().operator->()), runNumber_(iRun) {
14  edm::FileInPath(std::string("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")).fullPath());
15 
16  Mod_On_ = fPSet_.getParameter<bool>("Mod_On");
17  HistoMaps_On_ = fPSet_.getParameter<bool>("HistoMaps_On");
18  SummaryOnLayerLevel_On_ = fPSet_.getParameter<bool>("SummaryOnLayerLevel_On");
19  SummaryOnStringLevel_On_ = fPSet_.getParameter<bool>("SummaryOnStringLevel_On");
20 
21  GrandSummary_On_ = fPSet_.getParameter<bool>("GrandSummary_On");
22 
23  CondObj_fillId_ = hPSet_.getParameter<std::string>("CondObj_fillId");
24  CondObj_name_ = hPSet_.getParameter<std::string>("CondObj_name");
25 
26  // Warning message from wrong input:
28  edm::LogWarning("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::SiStripBaseCondObjDQMs] PLEASE CHECK : "
29  "String and layer level options can not be activated together"
30  << std::endl;
31  }
32 
33  // The OR of the two conditions allow to switch on this feature for all the
34  // components (if the FillConditions_PSet has the TkMap_On =true) or for
35  // single MEs (if the PSet for a ME has the TkMap_On =true)
36  if (fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On"))
38 
39  minValue = hPSet_.getParameter<double>("minValue");
40  maxValue = hPSet_.getParameter<double>("maxValue");
41 }
42 
44  if (checkChanged(eSetup_)) {
45  getConditionObject(eSetup_);
46 
47  // The OR of the two conditions allows to switch on this feature for all the
48  // components (if the FillConditions_PSet has the ActiveDetIds_On =true) or
49  // for single MEs (if the PSet for a ME has the ActiveDetIds_On =true)
50  if (fPSet_.getParameter<bool>("ActiveDetIds_On") || hPSet_.getParameter<bool>("ActiveDetIds_On"))
51  getActiveDetIds(eSetup_);
52  else
54 
56 
57  if (Mod_On_) {
59  }
62  }
63 
64  if (fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")) {
66  if (!filename.empty()) {
67  constexpr unsigned int kSLen = 128;
68  char sRun[kSLen];
69  snprintf(sRun, kSLen, "_Run_%d", runNumber_);
70  filename.insert(filename.find('.'), sRun);
71 
73  }
74  }
75  }
76 }
77 
79  std::string requestedSubDetector,
80  uint32_t requestedSide,
81  uint32_t requestedLayer) {
82  getConditionObject(eSetup_);
83  getActiveDetIds(eSetup_);
84 
85  std::vector<uint32_t> requestedDetIds_;
86  requestedDetIds_.clear();
87 
88  if (requestedSubDetector == "TIB") {
89  SiStripSubStructure::getTIBDetectors(activeDetIds, requestedDetIds_, tTopo_, requestedLayer, 0, 0, 0);
90  } else if (requestedSubDetector == "TID") {
91  SiStripSubStructure::getTIDDetectors(activeDetIds, requestedDetIds_, tTopo_, requestedSide, requestedLayer, 0, 0);
92  } else if (requestedSubDetector == "TOB") {
93  SiStripSubStructure::getTOBDetectors(activeDetIds, requestedDetIds_, tTopo_, requestedLayer, 0, 0);
94  } else if (requestedSubDetector == "TEC") {
96  activeDetIds, requestedDetIds_, tTopo_, requestedSide, requestedLayer, 0, 0, 0, 0);
97  }
98 
99  analysisOnDemand(eSetup_, requestedDetIds_);
100 }
101 
102 void SiStripBaseCondObjDQM::analysisOnDemand(const edm::EventSetup &eSetup_, uint32_t detIdOnDemand) {
103  if (checkChanged(eSetup_)) {
104  getConditionObject(eSetup_);
105 
106  std::vector<uint32_t> vdetIdsOnDemand_;
107  vdetIdsOnDemand_.push_back(detIdOnDemand); // fillModMEs needs a vector
108 
109  fillModMEs(vdetIdsOnDemand_);
110  }
111 }
112 
114  const std::vector<uint32_t> &detIdsOnDemand) {
115  if (checkChanged(eSetup_)) {
116  getConditionObject(eSetup_);
117  fillSummaryMEs(detIdsOnDemand);
118  }
119 }
120 
121 //#FIXME : very long method. please factorize it
122 void SiStripBaseCondObjDQM::selectModules(std::vector<uint32_t> &detIds_) {
123  edm::LogInfo("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::selectModules] input detIds_: " << detIds_.size()
124  << std::endl;
125 
126  if (fPSet_.getParameter<bool>("restrictModules")) {
127  std::vector<DetIdSelector> included_subdetsels;
128  std::vector<std::string> included_subdets =
129  fPSet_.getParameter<std::vector<std::string>>("ModulesToBeIncluded_DetIdSelector");
130  for (std::vector<std::string>::const_iterator wsdps = included_subdets.begin(); wsdps != included_subdets.end();
131  ++wsdps) {
132  included_subdetsels.push_back(DetIdSelector(*wsdps));
133  }
134 
135  std::vector<uint32_t> modulesToBeIncluded;
136  for (const auto detid : detIds_) {
137  for (const auto &detidsel : included_subdetsels) {
138  if (detidsel.isSelected(detid)) {
139  modulesToBeIncluded.push_back(detid);
140  break;
141  // std::cout << "detId: " << *detid << " is selected" <<
142  // std::endl;
143  }
144  }
145  }
146 
147  // -----
148  // *** exclude modules ***
149  std::vector<DetIdSelector> excluded_subdetsels;
150  std::vector<std::string> excluded_subdets =
151  fPSet_.getParameter<std::vector<std::string>>("ModulesToBeExcluded_DetIdSelector");
152  excluded_subdetsels.reserve(excluded_subdets.size());
153  for (const auto &wsdps : excluded_subdets) {
154  excluded_subdetsels.push_back(DetIdSelector(wsdps));
155  }
156 
157  std::vector<uint32_t> modulesToBeExcluded;
158  for (const auto detid : detIds_) {
159  for (const auto &detidsel : excluded_subdetsels) {
160  if (detidsel.isSelected(detid)) {
161  modulesToBeExcluded.push_back(detid);
162  break;
163  }
164  }
165  }
166 
167  ModulesToBeExcluded_ = fPSet_.getParameter<std::vector<unsigned int>>("ModulesToBeExcluded");
168  ModulesToBeIncluded_ = fPSet_.getParameter<std::vector<unsigned int>>("ModulesToBeIncluded");
169  SubDetectorsToBeExcluded_ = fPSet_.getParameter<std::vector<std::string>>("SubDetectorsToBeExcluded");
170 
171  // vectors to be sorted otherwise the intersection is non computed properly
172 
175 
176  if (modulesToBeExcluded.empty() && modulesToBeIncluded.empty() && ModulesToBeExcluded_.empty() &&
177  ModulesToBeIncluded_.empty())
178  edm::LogWarning("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::selectModules] PLEASE CHECK : no modules "
179  "to be exclude/included in your cfg"
180  << std::endl;
181 
182  modulesToBeIncluded.insert(modulesToBeIncluded.end(), ModulesToBeIncluded_.begin(), ModulesToBeIncluded_.end());
183  edm::LogInfo("SiStripBaseCondObjDQM")
184  << "[SiStripBaseCondObjDQM::selectModules] modulesToBeIncluded: " << modulesToBeIncluded.size() << std::endl;
185  modulesToBeExcluded.insert(modulesToBeExcluded.end(), ModulesToBeExcluded_.begin(), ModulesToBeExcluded_.end());
186  edm::LogInfo("SiStripBaseCondObjDQM")
187  << "[SiStripBaseCondObjDQM::selectModules] modulesToBeExcluded: " << modulesToBeExcluded.size() << std::endl;
188 
189  // apply modules selection
190  if (!modulesToBeIncluded.empty()) {
191  std::vector<uint32_t> tmp;
192  // The intersection of two sets is formed only by the elements that are
193  // present in both sets
194  set_intersection(detIds_.begin(),
195  detIds_.end(),
196  modulesToBeIncluded.begin(),
197  modulesToBeIncluded.end(),
198  inserter(tmp, tmp.begin()));
199  swap(detIds_, tmp);
200  }
201 
202  std::sort(detIds_.begin(), detIds_.end());
203  if (!modulesToBeExcluded.empty()) {
204  for (const auto mod : modulesToBeExcluded) {
205  auto detid = std::lower_bound(detIds_.begin(), detIds_.end(), mod);
206  if (detid != detIds_.end())
207  detIds_.erase(detid);
208  detid--;
209  }
210  }
211 
212  // -----
213  // *** restrict to a particular subdetector ***
214 
215  if (*(SubDetectorsToBeExcluded_.begin()) != "none") {
216  std::vector<uint32_t> tmp;
217 
218  for (const auto &mod : SubDetectorsToBeExcluded_) {
219  tmp.clear();
220 
221  if (mod == "TIB") {
222  SiStripSubStructure::getTIBDetectors(detIds_, tmp, tTopo_, 0, 0, 0, 0);
223  } else if (mod == "TOB") {
224  SiStripSubStructure::getTOBDetectors(detIds_, tmp, tTopo_, 0, 0, 0);
225  } else if (mod == "TID") {
226  SiStripSubStructure::getTIDDetectors(detIds_, tmp, tTopo_, 0, 0, 0, 0);
227  } else if (mod == "TEC") {
228  SiStripSubStructure::getTECDetectors(detIds_, tmp, tTopo_, 0, 0, 0, 0, 0, 0);
229  } else {
230  edm::LogWarning("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::selectModules] PLEASE CHECK : no "
231  "correct (name) subdetector to be excluded in your cfg"
232  << std::endl;
233  }
234 
235  const auto iterBegin_ = std::lower_bound(detIds_.begin(), detIds_.end(), *min_element(tmp.begin(), tmp.end()));
236 
237  const auto iterEnd_ = std::lower_bound(detIds_.begin(), detIds_.end(), *max_element(tmp.begin(), tmp.end()));
238 
239  for (auto detIter_ = iterEnd_; detIter_ != iterBegin_ - 1; detIter_--) {
240  detIds_.erase(detIter_);
241  }
242 
243  } // loop SubDetectorsToBeExcluded_
244  }
245  }
246  edm::LogInfo("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::selectModules] output detIds_: " << detIds_.size()
247  << std::endl;
248 
249  // -----
250  // *** fill only one Module per layer ***
251 
252  if (fPSet_.getParameter<std::string>("ModulesToBeFilled") == "onlyOneModulePerLayer") {
253  std::vector<uint32_t> tmp;
254  std::vector<uint32_t> layerDetIds;
255 
256  for (unsigned int i = 1; i < 5; i++) {
257  tmp.clear();
258  SiStripSubStructure::getTIBDetectors(detIds_, tmp, tTopo_, i, 0, 0, 0);
259  if (!tmp.empty()) {
260  layerDetIds.push_back(*(tmp.begin()));
261  }
262  }
263  for (unsigned int i = 1; i < 7; i++) {
264  tmp.clear();
266  if (!tmp.empty()) {
267  layerDetIds.push_back(*(tmp.begin()));
268  }
269  }
270  for (unsigned int i = 1; i < 4; i++) {
271  tmp.clear();
272  SiStripSubStructure::getTIDDetectors(detIds_, tmp, tTopo_, 1, i, 0, 0);
273  if (!tmp.empty()) {
274  layerDetIds.push_back(*(tmp.begin()));
275  }
276  SiStripSubStructure::getTIDDetectors(detIds_, tmp, tTopo_, 2, i, 0, 0);
277  if (!tmp.empty()) {
278  layerDetIds.push_back(*(tmp.begin()));
279  }
280  }
281  for (unsigned int i = 1; i < 10; i++) {
282  tmp.clear();
283  SiStripSubStructure::getTECDetectors(detIds_, tmp, tTopo_, 1, i, 0, 0, 0, 0);
284  if (!tmp.empty()) {
285  layerDetIds.push_back(*(tmp.begin()));
286  }
287  SiStripSubStructure::getTECDetectors(detIds_, tmp, tTopo_, 2, i, 0, 0, 0, 0);
288  if (!tmp.empty()) {
289  layerDetIds.push_back(*(tmp.begin()));
290  }
291  }
292 
293  detIds_.clear();
294  detIds_ = layerDetIds;
295  }
296  // -----
297 
298 } // selectModules
299 
300 void SiStripBaseCondObjDQM::getModMEs(ModMEs &CondObj_ME, const uint32_t &detId_) {
301  const auto ModMEsMap_iter = ModMEsMap_.find(detId_);
302 
303  if (ModMEsMap_iter != ModMEsMap_.end()) {
304  CondObj_ME = ModMEsMap_iter->second;
305 
306  if ((CondObj_fillId_ == "ProfileAndCumul" || CondObj_fillId_ == "onlyProfile") && CondObj_ME.ProfileDistr) {
307  CondObj_ME.ProfileDistr->Reset();
308  }
309 
310  if ((CondObj_fillId_ == "ProfileAndCumul" || CondObj_fillId_ == "onlyCumul") && CondObj_ME.CumulDistr) {
311  CondObj_ME.CumulDistr->Reset();
312  } else {
313  edm::LogWarning("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::getModMEs] PLEASE CHECK : CondObj_fillId "
314  "option mispelled";
315  }
316  return;
317  }
318 
319  // --> profile defined for all CondData
320  if ((CondObj_fillId_ == "ProfileAndCumul" || CondObj_fillId_ == "onlyProfile")) {
321  bookProfileMEs(CondObj_ME, detId_);
322  }
323 
324  // --> cumul currently only defined for noise and apvgain
325  if ((CondObj_fillId_ == "ProfileAndCumul" || CondObj_fillId_ == "onlyCumul") &&
326  (CondObj_name_ == "noise" || CondObj_name_ == "apvgain"))
327  bookCumulMEs(CondObj_ME, detId_);
328 
329  ModMEsMap_.insert(std::make_pair(detId_, CondObj_ME));
330 }
331 
332 //%FIXME: very long method, factorize
333 void SiStripBaseCondObjDQM::getSummaryMEs(ModMEs &CondObj_ME, const uint32_t &detId_) {
334  std::map<uint32_t, ModMEs>::const_iterator SummaryMEsMap_iter;
335 
336  if (CondObj_name_ == "lorentzangle" && SummaryOnStringLevel_On_) {
337  SummaryMEsMap_iter = SummaryMEsMap_.find(getStringNameAndId(detId_).second);
338  } else if (CondObj_name_ == "bpcorrection" && SummaryOnStringLevel_On_) {
339  SummaryMEsMap_iter = SummaryMEsMap_.find(getStringNameAndId(detId_).second);
340  } else {
341  SummaryMEsMap_iter = SummaryMEsMap_.find(getLayerNameAndId(detId_).second);
342  }
343 
344  if (SummaryMEsMap_iter != SummaryMEsMap_.end()) {
345  return;
346  }
347 
348  // FIXME t's not good that the base class has to know about which derived
349  // class shoudl exist.
350  // please modify this part. implement virtual functions, esplicited in the
351  // derived classes
352  // --> currently only profile summary defined for all condition objects except
353  // quality
354  if ((CondObj_fillId_ == "ProfileAndCumul" || CondObj_fillId_ == "onlyProfile") &&
355  (CondObj_name_ == "pedestal" || CondObj_name_ == "noise" || CondObj_name_ == "lowthreshold" ||
356  CondObj_name_ == "highthreshold" || CondObj_name_ == "apvgain" || CondObj_name_ == "bpcorrection" ||
357  CondObj_name_ == "lorentzangle")) {
358  if (hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel"))
359  if (!CondObj_ME.SummaryOfProfileDistr) {
360  bookSummaryProfileMEs(CondObj_ME, detId_);
361  }
362  }
363 
364  // --> currently only genuine cumul LA
365  if ((CondObj_fillId_ == "ProfileAndCumul" || CondObj_fillId_ == "onlyCumul") &&
366  (CondObj_name_ == "lorentzangle" || CondObj_name_ == "bpcorrection" || CondObj_name_ == "noise")) {
367  if (hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel"))
368  if (!CondObj_ME.SummaryOfCumulDistr) {
369  bookSummaryCumulMEs(CondObj_ME, detId_);
370  }
371  }
372 
373  // --> currently only summary as a function of detId for noise, pedestal and
374  // apvgain
375  if (CondObj_name_ == "noise" || CondObj_name_ == "lowthreshold" || CondObj_name_ == "highthreshold" ||
376  CondObj_name_ == "apvgain" || CondObj_name_ == "pedestal" || CondObj_name_ == "quality") {
377  if (hPSet_.getParameter<bool>("FillSummaryAtLayerLevel"))
378  if (!CondObj_ME.SummaryDistr) {
379  bookSummaryMEs(CondObj_ME, detId_);
380  }
381  }
382 
383  if (CondObj_name_ == "lorentzangle" && SummaryOnStringLevel_On_) {
384  // FIXME getStringNameandId takes time. not need to call it every timne. put
385  // the call at the beginning of the method and caache the string
386  SummaryMEsMap_.insert(std::make_pair(getStringNameAndId(detId_).second, CondObj_ME));
387  } else if (CondObj_name_ == "bpcorrection" && SummaryOnStringLevel_On_) {
388  // FIXME getStringNameandId takes time. not need to call it every timne. put
389  // the call at the beginning of the method and caache the string
390  SummaryMEsMap_.insert(std::make_pair(getStringNameAndId(detId_).second, CondObj_ME));
391  } else {
392  SummaryMEsMap_.insert(std::make_pair(getLayerNameAndId(detId_).second, CondObj_ME));
393  }
394 }
395 // ----
396 
397 //====================================================
398 // -----
399 void SiStripBaseCondObjDQM::bookProfileMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_) {
400  int hProfile_NchX = 0;
401  double hProfile_LowX = 0;
402  double hProfile_HighX = 0;
403 
404  std::string hProfile_description;
405  hProfile_description = hPSet_.getParameter<std::string>("Profile_description");
406 
407  std::string hProfile_xTitle, hProfile_yTitle;
408  hProfile_xTitle = hPSet_.getParameter<std::string>("Profile_xTitle");
409  hProfile_yTitle = hPSet_.getParameter<std::string>("Profile_yTitle");
410 
411  if (CondObj_name_ != "apvgain") {
412  int nStrip = reader->getNumberOfApvsAndStripLength(detId_).first * 128;
413 
414  hProfile_NchX = nStrip;
415  hProfile_LowX = 0.5;
416  hProfile_HighX = nStrip + 0.5;
417  } else {
418  int nApv = reader->getNumberOfApvsAndStripLength(detId_).first;
419 
420  hProfile_NchX = nApv;
421  hProfile_LowX = 0.5;
422  hProfile_HighX = nApv + 0.5;
423  }
424 
426 
427  std::string hProfile_Name;
428  hProfile_Name = hidmanager.createHistoId(hProfile_description, "det", detId_);
429 
430  std::string hProfile;
431  hProfile = hProfile_Name;
432 
433  CondObj_ME.ProfileDistr = dqmStore_->book1D(hProfile_Name, hProfile, hProfile_NchX, hProfile_LowX, hProfile_HighX);
434  CondObj_ME.ProfileDistr->setAxisTitle(hProfile_xTitle, 1);
435  CondObj_ME.ProfileDistr->setAxisTitle(hProfile_yTitle, 2);
436 }
437 // -----
438 
439 //=============================================
440 // -----
441 void SiStripBaseCondObjDQM::bookCumulMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_) {
442  int hCumul_NchX = 0;
443  double hCumul_LowX = 0;
444  double hCumul_HighX = 0;
445 
446  std::string hCumul_description;
447  hCumul_description = hPSet_.getParameter<std::string>("Cumul_description");
448 
449  std::string hCumul_xTitle, hCumul_yTitle;
450  hCumul_xTitle = hPSet_.getParameter<std::string>("Cumul_xTitle");
451  hCumul_yTitle = hPSet_.getParameter<std::string>("Cumul_yTitle");
452 
453  hCumul_NchX = hPSet_.getParameter<int>("Cumul_NchX");
454  hCumul_LowX = hPSet_.getParameter<double>("Cumul_LowX");
455  hCumul_HighX = hPSet_.getParameter<double>("Cumul_HighX");
456 
458 
459  std::string hCumul_name;
460  hCumul_name = hidmanager.createHistoId(hCumul_description, "det", detId_);
461  ;
462 
463  std::string hCumul_title;
464  hCumul_title = hCumul_name;
465 
466  CondObj_ME.CumulDistr = dqmStore_->book1D(hCumul_name, hCumul_title, hCumul_NchX, hCumul_LowX, hCumul_HighX);
467  CondObj_ME.CumulDistr->setAxisTitle(hCumul_xTitle, 1);
468  CondObj_ME.CumulDistr->setAxisTitle(hCumul_yTitle, 2);
469 }
470 // ----
471 
472 //===========================================
473 // -----
474 //#FIXME: same comments: factorize, and remove any reference to derived classes
476  std::vector<uint32_t> sameLayerDetIds_;
477 
478  int hSummaryOfProfile_NchX = 0;
479  double hSummaryOfProfile_LowX = 0;
480  double hSummaryOfProfile_HighX = 0;
481 
482  std::string hSummaryOfProfile_description;
483  hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
484 
485  std::string hSummaryOfProfile_xTitle, hSummaryOfProfile_yTitle;
486  hSummaryOfProfile_xTitle = hPSet_.getParameter<std::string>("SummaryOfProfile_xTitle");
487  hSummaryOfProfile_yTitle = hPSet_.getParameter<std::string>("SummaryOfProfile_yTitle");
488 
489  int hSummaryOfProfile_NchY;
490  double hSummaryOfProfile_LowY, hSummaryOfProfile_HighY;
491  hSummaryOfProfile_NchY = hPSet_.getParameter<int>("SummaryOfProfile_NchY");
492  hSummaryOfProfile_LowY = hPSet_.getParameter<double>("SummaryOfProfile_LowY");
493  hSummaryOfProfile_HighY = hPSet_.getParameter<double>("SummaryOfProfile_HighY");
494 
495  int nStrip, nApv, layerId_;
496 
497  if (CondObj_name_ == "lorentzangle" && SummaryOnStringLevel_On_) {
498  layerId_ = getStringNameAndId(detId_).second;
499  } else if (CondObj_name_ == "bpcorrection" && SummaryOnStringLevel_On_) {
500  layerId_ = getStringNameAndId(detId_).second;
501  } else {
502  layerId_ = getLayerNameAndId(detId_).second;
503  }
504 
505  if (CondObj_name_ == "pedestal" || CondObj_name_ == "noise" || CondObj_name_ == "lowthreshold" ||
506  CondObj_name_ == "highthreshold") { // plot in strip number
507 
508  if ((layerId_ > 610 && layerId_ < 620) || // TID & TEC have 768 strips at maximum
509  (layerId_ > 620 && layerId_ < 630) || (layerId_ > 410 && layerId_ < 414) ||
510  (layerId_ > 420 && layerId_ < 424)) {
511  nStrip = 768;
512  } else {
513  nStrip = reader->getNumberOfApvsAndStripLength(detId_).first * 128;
514  }
515 
516  hSummaryOfProfile_NchX = nStrip;
517  hSummaryOfProfile_LowX = 0.5;
518  hSummaryOfProfile_HighX = nStrip + 0.5;
519 
520  } else if (((CondObj_name_ == "lorentzangle" || CondObj_name_ == "bpcorrection") && SummaryOnLayerLevel_On_) ||
521  CondObj_name_ == "quality") { // plot in detId-number
522 
523  // -----
524  // get detIds belonging to same layer to fill X-axis with detId-number
525 
526  sameLayerDetIds_.clear();
527 
528  switch (DetId(detId_).subdetId()) {
531  activeDetIds, sameLayerDetIds_, tTopo_, tTopo_->tibLayer(detId_), 0, 0, tTopo_->tibString(detId_));
532  break;
534  SiStripSubStructure::getTIDDetectors(activeDetIds, sameLayerDetIds_, tTopo_, 0, 0, 0, 0);
535  break;
537  SiStripSubStructure::getTOBDetectors(activeDetIds, sameLayerDetIds_, tTopo_, tTopo_->tobLayer(detId_), 0, 0);
538  break;
540  SiStripSubStructure::getTECDetectors(activeDetIds, sameLayerDetIds_, tTopo_, 0, 0, 0, 0, 0, 0);
541  break;
542  }
543 
544  hSummaryOfProfile_NchX = sameLayerDetIds_.size();
545  hSummaryOfProfile_LowX = 0.5;
546  hSummaryOfProfile_HighX = sameLayerDetIds_.size() + 0.5;
547 
548  } else if ((CondObj_name_ == "lorentzangle" || CondObj_name_ == "bpcorrection") &&
549  SummaryOnStringLevel_On_) { // plot in detId-number
550 
551  // -----
552  // get detIds belonging to same string to fill X-axis with detId-number
553 
554  sameLayerDetIds_.clear();
555 
556  switch (DetId(detId_).subdetId()) {
558  if (tTopo_->tibIsInternalString(detId_)) {
560  activeDetIds, sameLayerDetIds_, tTopo_, tTopo_->tibLayer(detId_), 0, 1, tTopo_->tibString(detId_));
561  } else if (tTopo_->tibIsExternalString(detId_)) {
563  activeDetIds, sameLayerDetIds_, tTopo_, tTopo_->tibLayer(detId_), 0, 2, tTopo_->tibString(detId_));
564  }
565  break;
567  SiStripSubStructure::getTIDDetectors(activeDetIds, sameLayerDetIds_, tTopo_, 0, 0, 0, 0);
568  break;
571  activeDetIds, sameLayerDetIds_, tTopo_, tTopo_->tobLayer(detId_), 0, tTopo_->tobRod(detId_));
572  break;
574  SiStripSubStructure::getTECDetectors(activeDetIds, sameLayerDetIds_, tTopo_, 0, 0, 0, 0, 0, 0);
575  break;
576  }
577 
578  hSummaryOfProfile_NchX = sameLayerDetIds_.size();
579  hSummaryOfProfile_LowX = 0.5;
580  hSummaryOfProfile_HighX = sameLayerDetIds_.size() + 0.5;
581 
582  } else if (CondObj_name_ == "apvgain") {
583  if ((layerId_ > 610 && layerId_ < 620) || // TID & TEC have 6 apvs at maximum
584  (layerId_ > 620 && layerId_ < 630) || (layerId_ > 410 && layerId_ < 414) ||
585  (layerId_ > 420 && layerId_ < 424)) {
586  nApv = 6;
587  } else {
588  nApv = reader->getNumberOfApvsAndStripLength(detId_).first;
589  }
590 
591  hSummaryOfProfile_NchX = nApv;
592  hSummaryOfProfile_LowX = 0.5;
593  hSummaryOfProfile_HighX = nApv + 0.5;
594 
595  } else {
596  edm::LogWarning("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::bookSummaryProfileMEs] PLEASE CHECK : "
597  "x-axis label in your cfg"
598  << std::endl;
599  }
600 
601  uint32_t layer_ = 0;
602 
604 
606 
607  std::string hSummaryOfProfile_name;
608 
609  // ---
610  int subdetectorId_ = ((detId_ >> 25) & 0x7);
611 
612  if (subdetectorId_ < 3 || subdetectorId_ > 6) {
613  edm::LogError("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::bookSummaryProfileMEs] WRONG INPUT : no "
614  "such subdetector type : "
615  << subdetectorId_ << " no folder set!" << std::endl;
616  return;
617  }
618  // ---
619 
620  if ((CondObj_name_ == "lorentzangle" || CondObj_name_ == "bpcorrection") && SummaryOnStringLevel_On_) {
621  hSummaryOfProfile_name =
622  hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getStringNameAndId(detId_).first, "");
623  } else {
624  hSummaryOfProfile_name =
625  hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getLayerNameAndId(detId_).first, "");
626  }
627 
628  std::string hSummaryOfProfile_title;
629  hSummaryOfProfile_title = hSummaryOfProfile_name;
630 
631  CondObj_ME.SummaryOfProfileDistr = dqmStore_->bookProfile(hSummaryOfProfile_name,
632  hSummaryOfProfile_title,
633  hSummaryOfProfile_NchX,
634  hSummaryOfProfile_LowX,
635  hSummaryOfProfile_HighX,
636  hSummaryOfProfile_NchY,
637  0.,
638  0.);
639  // hSummaryOfProfile_LowY,
640  // hSummaryOfProfile_HighY);
641  CondObj_ME.SummaryOfProfileDistr->setAxisTitle(hSummaryOfProfile_xTitle, 1);
642  CondObj_ME.SummaryOfProfileDistr->setAxisTitle(hSummaryOfProfile_yTitle, 2);
643  CondObj_ME.SummaryOfProfileDistr->setAxisRange(hSummaryOfProfile_LowY, hSummaryOfProfile_HighY, 2);
644 
645  // -----
646  // in order to get the right detId-number labelled in right bin of x-axis
647 
648  if (CondObj_name_ == "quality") {
649  unsigned int iBin = 0;
650 
651  for (unsigned int i = 0; i < sameLayerDetIds_.size(); i++) {
652  iBin++;
653  char sameLayerDetIds_Name[1024];
654  sprintf(sameLayerDetIds_Name, "%u", sameLayerDetIds_[i]);
655  CondObj_ME.SummaryOfProfileDistr->setBinLabel(iBin, sameLayerDetIds_Name);
656  }
657  }
658  if (CondObj_name_ == "lorentzangle" || CondObj_name_ == "bpcorrection") {
659  // Put the detIds for the -z side as following the geometrical order:
660  reverse(sameLayerDetIds_.begin(), sameLayerDetIds_.begin() + sameLayerDetIds_.size() / 2);
661 
662  unsigned int iBin = 0;
663  for (unsigned int i = 0; i < sameLayerDetIds_.size(); i++) {
664  iBin++;
666  // remove the label for detIds:
667  CondObj_ME.SummaryOfProfileDistr->setBinLabel(iBin, "");
668  }
669 
671  // Label with module position instead of detIds:
672  char sameLayerDetIds_Name[1024];
673  if (subdetectorId_ == 3) { // re-abelling for TIB
674  if (tTopo_->tibIsZPlusSide(sameLayerDetIds_[i])) {
675  sprintf(sameLayerDetIds_Name, "%i", tTopo_->tibModule(sameLayerDetIds_[i]));
676  } else if (tTopo_->tibIsZMinusSide(sameLayerDetIds_[i])) {
677  sprintf(sameLayerDetIds_Name, "%i", -tTopo_->tibModule(sameLayerDetIds_[i]));
678  }
679  CondObj_ME.SummaryOfProfileDistr->setBinLabel(iBin, sameLayerDetIds_Name);
680  } else if (subdetectorId_ == 5) { // re-abelling for TOB
681  if (tTopo_->tobIsZPlusSide(sameLayerDetIds_[i])) {
682  sprintf(sameLayerDetIds_Name, "%i", tTopo_->tobModule(sameLayerDetIds_[i]));
683  } else if (tTopo_->tobIsZMinusSide(sameLayerDetIds_[i])) {
684  sprintf(sameLayerDetIds_Name, "%i", -tTopo_->tobModule(sameLayerDetIds_[i]));
685  }
686  CondObj_ME.SummaryOfProfileDistr->setBinLabel(iBin, sameLayerDetIds_Name);
687  }
688  }
689  }
690 
691  // -----
692 
693  } // if "lorentzangle"
694 }
695 
697  int hSummaryOfCumul_NchX = 0;
698  double hSummaryOfCumul_LowX = 0;
699  double hSummaryOfCumul_HighX = 0;
700 
701  std::string hSummaryOfCumul_description;
702  hSummaryOfCumul_description = hPSet_.getParameter<std::string>("SummaryOfCumul_description");
703 
704  std::string hSummaryOfCumul_xTitle, hSummaryOfCumul_yTitle;
705  hSummaryOfCumul_xTitle = hPSet_.getParameter<std::string>("SummaryOfCumul_xTitle");
706  hSummaryOfCumul_yTitle = hPSet_.getParameter<std::string>("SummaryOfCumul_yTitle");
707 
708  hSummaryOfCumul_NchX = hPSet_.getParameter<int>("SummaryOfCumul_NchX");
709  hSummaryOfCumul_LowX = hPSet_.getParameter<double>("SummaryOfCumul_LowX");
710  hSummaryOfCumul_HighX = hPSet_.getParameter<double>("SummaryOfCumul_HighX");
711 
712  uint32_t layer_ = 0;
713 
715 
717 
718  std::string hSummaryOfCumul_name;
719 
720  // ---
721  int subdetectorId_ = ((detId_ >> 25) & 0x7);
722 
723  if (subdetectorId_ < 3 || subdetectorId_ > 6) {
724  edm::LogError("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::bookSummaryCumulMEs] WRONG INPUT : no such "
725  "subdetector type : "
726  << subdetectorId_ << " no folder set!" << std::endl;
727  return;
728  }
729  // ---
730 
731  // LA and BP Histos are plotted for each string:
732  if ((CondObj_name_ == "lorentzangle" || CondObj_name_ == "bpcorrection") && SummaryOnStringLevel_On_) {
733  hSummaryOfCumul_name =
734  hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getStringNameAndId(detId_).first, "");
735  } else {
736  hSummaryOfCumul_name =
737  hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getLayerNameAndId(detId_).first, "");
738  }
739 
740  std::string hSummaryOfCumul_title;
741  hSummaryOfCumul_title = hSummaryOfCumul_name;
742 
743  CondObj_ME.SummaryOfCumulDistr = dqmStore_->book1D(
744  hSummaryOfCumul_name, hSummaryOfCumul_title, hSummaryOfCumul_NchX, hSummaryOfCumul_LowX, hSummaryOfCumul_HighX);
745 
746  CondObj_ME.SummaryOfCumulDistr->setAxisTitle(hSummaryOfCumul_xTitle, 1);
747  CondObj_ME.SummaryOfCumulDistr->setAxisTitle(hSummaryOfCumul_yTitle, 2);
748 }
749 
750 // FIXME same as before: factorize
751 void SiStripBaseCondObjDQM::bookSummaryMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_) {
752  std::vector<uint32_t> sameLayerDetIds_;
753 
754  int hSummary_NchX = 0;
755  double hSummary_LowX = 0;
756  double hSummary_HighX = 0;
757 
758  std::string hSummary_description;
759  hSummary_description = hPSet_.getParameter<std::string>("Summary_description");
760 
761  std::string hSummary_xTitle, hSummary_yTitle;
762  hSummary_xTitle = hPSet_.getParameter<std::string>("Summary_xTitle");
763  hSummary_yTitle = hPSet_.getParameter<std::string>("Summary_yTitle");
764 
765  int hSummary_NchY;
766  double hSummary_LowY, hSummary_HighY;
767  hSummary_NchY = hPSet_.getParameter<int>("Summary_NchY");
768  hSummary_LowY = hPSet_.getParameter<double>("Summary_LowY");
769  hSummary_HighY = hPSet_.getParameter<double>("Summary_HighY");
770 
771  // -----
772  // get detIds belonging to same layer to fill X-axis with detId-number
773 
774  sameLayerDetIds_.clear();
775 
776  sameLayerDetIds_ = GetSameLayerDetId(activeDetIds, detId_);
777 
778  hSummary_NchX = sameLayerDetIds_.size();
779  hSummary_LowX = 0.5;
780  hSummary_HighX = sameLayerDetIds_.size() + 0.5;
781 
782  uint32_t layer_ = 0;
783 
785 
787 
788  std::string hSummary_name;
789 
790  // ---
791  int subdetectorId_ = ((detId_ >> 25) & 0x7);
792 
793  if (subdetectorId_ < 3 || subdetectorId_ > 6) {
794  edm::LogError("SiStripBaseCondObjDQM") << "[SiStripBaseCondObjDQM::bookSummaryMEs] WRONG INPUT : no such "
795  "subdetector type : "
796  << subdetectorId_ << " no folder set!" << std::endl;
797  return;
798  }
799  // ---
800 
801  hSummary_name = hidmanager.createHistoLayer(hSummary_description, "layer", getLayerNameAndId(detId_).first, "");
802 
803  std::string hSummary_title;
804  hSummary_title = hSummary_name;
805 
806  CondObj_ME.SummaryDistr = dqmStore_->bookProfile(
807  hSummary_name, hSummary_title, hSummary_NchX, hSummary_LowX, hSummary_HighX, hSummary_NchY, 0., 0.);
808  // hSummary_LowY,
809  // hSummary_HighY);
810  CondObj_ME.SummaryDistr->setAxisTitle(hSummary_xTitle, 1);
811  CondObj_ME.SummaryDistr->setAxisTitle(hSummary_yTitle, 2);
812  CondObj_ME.SummaryDistr->setAxisRange(hSummary_LowY, hSummary_HighY, 2);
813 
814  // -----
815  // in order to get the right detId-number labelled in right bin of x-axis
816  unsigned int iBin = 0;
817 
818  for (unsigned int i = 0; i < sameLayerDetIds_.size(); i++) {
819  iBin++;
820  char sameLayerDetIds_Name[1024];
821  sprintf(sameLayerDetIds_Name, "%u", sameLayerDetIds_[i]);
822  if (iBin % 100 == 0)
823  CondObj_ME.SummaryDistr->setBinLabel(iBin, sameLayerDetIds_Name);
824  }
825 }
826 
827 std::pair<std::string, uint32_t> SiStripBaseCondObjDQM::getLayerNameAndId(const uint32_t &detId_) {
828  int subdetectorId_ = ((detId_ >> 25) & 0x7);
829  int layerId_ = 0;
830 
831  std::stringstream layerName;
832 
833  if (subdetectorId_ == 3) { // TIB
834 
835  for (unsigned int i = 1; i < 5; i++) {
836  if (tTopo_->tibLayer(detId_) == i) {
837  layerName << "TIB__layer__" << i;
838  layerId_ = 300 + i;
839  }
840  }
841 
842  }
843 
844  else if (subdetectorId_ == 4) { // TIDD
845 
846  if (tTopo_->tidSide(detId_) == 1) { // TIDD side 1
847 
848  for (unsigned int i = 1; i < 4; i++) {
849  if (tTopo_->tidWheel(detId_) == i) {
850  layerName << "TID__side__1__wheel__" << i;
851  layerId_ = 410 + i;
852  }
853  }
854 
855  }
856 
857  else if (tTopo_->tidSide(detId_) == 2) { // TIDD side 2
858 
859  for (unsigned int i = 1; i < 4; i++) {
860  if (tTopo_->tidWheel(detId_) == i) {
861  layerName << "TID__side__2__wheel__" << i;
862  layerId_ = 420 + i;
863  }
864  }
865  }
866 
867  }
868 
869  else if (subdetectorId_ == 5) { // TOB
870 
871  for (unsigned int i = 1; i < 7; i++) {
872  if (tTopo_->tobLayer(detId_) == i) {
873  layerName << "TOB__layer__" << i;
874  layerId_ = 500 + i;
875  }
876  }
877 
878  }
879 
880  else if (subdetectorId_ == 6) { // TEC
881 
882  if (tTopo_->tecSide(detId_) == 1) { // TEC side 1
883 
884  for (unsigned int i = 1; i < 10; i++) {
885  if (tTopo_->tecWheel(detId_) == i) {
886  layerName << "TEC__side__1__wheel__" << i;
887  layerId_ = 610 + i;
888  }
889  }
890 
891  }
892 
893  else if (tTopo_->tecSide(detId_) == 2) { // TEC side 2
894 
895  for (unsigned int i = 1; i < 10; i++) {
896  if (tTopo_->tecWheel(detId_) == i) {
897  layerName << "TEC__side__2__wheel__" << i;
898  layerId_ = 620 + i;
899  }
900  }
901  }
902  }
903 
904  return std::make_pair(layerName.str(), layerId_);
905 }
906 
907 std::pair<std::string, uint32_t> SiStripBaseCondObjDQM::getStringNameAndId(const uint32_t &detId_) {
908  int subdetectorId_ = ((detId_ >> 25) & 0x7);
909  int layerStringId_ = 0;
910 
911  std::stringstream layerStringName;
912 
913  if (subdetectorId_ == 3) { // TIB
914  if (tTopo_->tibLayer(detId_) == 1 && tTopo_->tibIsInternalString(detId_)) { // 1st layer int
915  for (unsigned int i = 1; i < 27; i++) {
916  if (tTopo_->tibString(detId_) == i) {
917  layerStringName << "TIB_L1_Int_Str_" << i;
918  layerStringId_ = 30110 + i;
919  }
920  }
921  } else if (tTopo_->tibLayer(detId_) == 1 && tTopo_->tibIsExternalString(detId_)) { // 1st layer ext
922  for (unsigned int i = 1; i < 31; i++) {
923  if (tTopo_->tibString(detId_) == i) {
924  layerStringName << "TIB_L1_Ext_Str_" << i;
925  layerStringId_ = 301200 + i;
926  }
927  }
928  } else if (tTopo_->tibLayer(detId_) == 2 && tTopo_->tibIsInternalString(detId_)) { // 2nd layer int
929  for (unsigned int i = 1; i < 35; i++) {
930  if (tTopo_->tibString(detId_) == i) {
931  layerStringName << "TIB_L2_Int_Str_" << i;
932  layerStringId_ = 302100 + i;
933  }
934  }
935  } else if (tTopo_->tibLayer(detId_) == 2 && tTopo_->tibIsExternalString(detId_)) { // 2nd layer ext
936  for (unsigned int i = 1; i < 39; i++) {
937  if (tTopo_->tibString(detId_) == i) {
938  layerStringName << "TIB_L2_Ext_Str_" << i;
939  layerStringId_ = 302200 + i;
940  }
941  }
942  } else if (tTopo_->tibLayer(detId_) == 3 && tTopo_->tibIsInternalString(detId_)) { // 3rd layer int
943  for (unsigned int i = 1; i < 45; i++) {
944  if (tTopo_->tibString(detId_) == i) {
945  layerStringName << "TIB_L3_Int_Str_" << i;
946  layerStringId_ = 303100 + i;
947  }
948  }
949  } else if (tTopo_->tibLayer(detId_) == 3 && tTopo_->tibIsExternalString(detId_)) { // 3rd layer ext
950  for (unsigned int i = 1; i < 47; i++) {
951  if (tTopo_->tibString(detId_) == i) {
952  layerStringName << "TIB_L3_Ext_Str_" << i;
953  layerStringId_ = 303200 + i;
954  }
955  }
956  } else if (tTopo_->tibLayer(detId_) == 4 && tTopo_->tibIsInternalString(detId_)) { // 4th layer int
957  for (unsigned int i = 1; i < 53; i++) {
958  if (tTopo_->tibString(detId_) == i) {
959  layerStringName << "TIB_L4_Int_Str_" << i;
960  layerStringId_ = 304100 + i;
961  }
962  }
963  } else if (tTopo_->tibLayer(detId_) == 4 && tTopo_->tibIsExternalString(detId_)) { // 4th layer ext
964  for (unsigned int i = 1; i < 57; i++) {
965  if (tTopo_->tibString(detId_) == i) {
966  layerStringName << "TIB_L4_Ext_Str_" << i;
967  layerStringId_ = 304200 + i;
968  }
969  }
970  }
971  } // TIB
972 
973  else if (subdetectorId_ == 5) { // TOB
974  if (tTopo_->tobLayer(detId_) == 1) { // 1st layer
975  for (unsigned int i = 1; i < 43; i++) {
976  if (tTopo_->tobRod(detId_) == i) {
977  layerStringName << "TOB_L1_Rod_" << i;
978  layerStringId_ = 50100 + i;
979  }
980  }
981  } else if (tTopo_->tobLayer(detId_) == 2) { // 2nd layer
982  for (unsigned int i = 1; i < 49; i++) {
983  if (tTopo_->tobRod(detId_) == i) {
984  layerStringName << "TOB_L2_Rod_" << i;
985  layerStringId_ = 50200 + i;
986  }
987  }
988  } else if (tTopo_->tobLayer(detId_) == 3) { // 3rd layer
989  for (unsigned int i = 1; i < 55; i++) {
990  if (tTopo_->tobRod(detId_) == i) {
991  layerStringName << "TOB_L3_Rod_" << i;
992  layerStringId_ = 50300 + i;
993  }
994  }
995  } else if (tTopo_->tobLayer(detId_) == 4) { // 4th layer
996  for (unsigned int i = 1; i < 61; i++) {
997  if (tTopo_->tobRod(detId_) == i) {
998  layerStringName << "TOB_L4_Rod_" << i;
999  layerStringId_ = 50400 + i;
1000  }
1001  }
1002  } else if (tTopo_->tobLayer(detId_) == 5) { // 5th layer
1003  for (unsigned int i = 1; i < 67; i++) {
1004  if (tTopo_->tobRod(detId_) == i) {
1005  layerStringName << "TOB_L5_Rod_" << i;
1006  layerStringId_ = 50500 + i;
1007  }
1008  }
1009  } else if (tTopo_->tobLayer(detId_) == 6) { // 6st layer
1010  for (unsigned int i = 1; i < 75; i++) {
1011  if (tTopo_->tobRod(detId_) == i) {
1012  layerStringName << "TOB_L6_Rod_" << i;
1013  layerStringId_ = 50600 + i;
1014  }
1015  }
1016  }
1017  } // TOB
1018 
1019  return std::make_pair(layerStringName.str(), layerStringId_);
1020 }
1021 
1022 std::vector<uint32_t> SiStripBaseCondObjDQM::GetSameLayerDetId(const std::vector<uint32_t> &activeDetIds,
1023  uint32_t selDetId) {
1024  std::vector<uint32_t> sameLayerDetIds;
1025  sameLayerDetIds.clear();
1026 
1027  switch (DetId(selDetId).subdetId()) {
1028  case StripSubdetector::TIB:
1029  SiStripSubStructure::getTIBDetectors(activeDetIds, sameLayerDetIds, tTopo_, tTopo_->tibLayer(selDetId), 0, 0, 0);
1030  break;
1031  case StripSubdetector::TID:
1033  activeDetIds, sameLayerDetIds, tTopo_, tTopo_->tidSide(selDetId), tTopo_->tidWheel(selDetId), 0, 0);
1034  break;
1035  case StripSubdetector::TOB:
1036  SiStripSubStructure::getTOBDetectors(activeDetIds, sameLayerDetIds, tTopo_, tTopo_->tobLayer(selDetId), 0, 0);
1037  break;
1038  case StripSubdetector::TEC:
1040  activeDetIds, sameLayerDetIds, tTopo_, tTopo_->tecSide(selDetId), tTopo_->tecWheel(selDetId), 0, 0, 0, 0);
1041  break;
1042  }
1043 
1044  return sameLayerDetIds;
1045 }
1046 
1047 void SiStripBaseCondObjDQM::bookTkMap(const std::string &TkMapname) { tkMap = new TrackerMap(TkMapname); }
1048 
1049 void SiStripBaseCondObjDQM::fillTkMap(const uint32_t &detid, const float &value) { tkMap->fill(detid, value); }
1050 
1051 void SiStripBaseCondObjDQM::saveTkMap(const std::string &TkMapname, double minValue, double maxValue) {
1052  if (!tkMapScaler.empty()) {
1053  // check that saturation is below x% below minValue and above minValue, and
1054  // in case re-arrange.
1055  float th = hPSet_.getParameter<double>("saturatedFraction");
1056 
1057  size_t imin = 0, imax = 0;
1058  float entries = 0;
1059  for (size_t i = 0; i < tkMapScaler.size(); ++i)
1060  entries += tkMapScaler[i];
1061 
1062  float min = 0;
1063  for (size_t i = 0; (i < tkMapScaler.size()) && (min < th); ++i) {
1064  min += tkMapScaler[i] / entries;
1065  imin = i;
1066  }
1067 
1068  float max = 0;
1069  // for(size_t i=tkMapScaler.size()-1;(i>=0) && (max<th);--i){ // Wrong
1070  // Since i is unsigned, i >= 0 is always true,
1071  // and the loop termination condition is never reached.
1072  // We offset the loop index by one to fix this.
1073  for (size_t j = tkMapScaler.size(); (j > 0) && (max < th); --j) {
1074  size_t i = j - 1;
1075  max += tkMapScaler[i] / entries;
1076  imax = i;
1077  }
1078 
1079  // reset maxValue;
1080  if (maxValue < imax) {
1081  edm::LogInfo("SiStripBaseCondObjDQM") << "Resetting TkMap maxValue from " << maxValue << " to " << imax;
1082  maxValue = imax;
1083  }
1084  // reset minValue;
1085  if (minValue > imin) {
1086  edm::LogInfo("SiStripBaseCondObjDQM") << "Resetting TkMap minValue from " << minValue << " to " << imin;
1087  minValue = imin;
1088  }
1089  }
1090 
1091  tkMap->save(false, minValue, maxValue, TkMapname, 4500, 2400);
1092  tkMap->setPalette(1);
1093  tkMap->showPalette(true);
1094 }
1095 
1097  edm::LogInfo("SiStripBaseCondObjDQM") << "SiStripBaseCondObjDQM::end" << std::endl;
1098 }
1099 
1100 void SiStripBaseCondObjDQM::fillModMEs(const std::vector<uint32_t> &selectedDetIds) {
1101  ModMEs CondObj_ME;
1102  for (const auto det : selectedDetIds) {
1103  fillMEsForDet(CondObj_ME, det);
1104  }
1105 }
1106 
1107 //==========================
1108 void SiStripBaseCondObjDQM::fillSummaryMEs(const std::vector<uint32_t> &selectedDetIds) {
1109  for (const auto det : selectedDetIds) {
1110  fillMEsForLayer(/*SummaryMEsMap_,*/ det);
1111  }
1112 
1113  for (const auto &itm : SummaryMEsMap_) {
1114  ModMEs selME;
1115  selME = itm.second;
1116 
1117  if (hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel") &&
1118  fPSet_.getParameter<bool>("OutputSummaryProfileAtLayerLevelAsImage")) {
1119  if (CondObj_fillId_ == "onlyProfile" || CondObj_fillId_ == "ProfileAndCumul") {
1120  TCanvas c1("c1");
1121  selME.SummaryOfProfileDistr->getTProfile()->Draw();
1122  std::string name(selME.SummaryOfProfileDistr->getTProfile()->GetTitle());
1123  name += ".png";
1124  c1.Print(name.c_str());
1125  }
1126  }
1127  if (hPSet_.getParameter<bool>("FillSummaryAtLayerLevel") &&
1128  fPSet_.getParameter<bool>("OutputSummaryAtLayerLevelAsImage")) {
1129  TCanvas c1("c1");
1130  selME.SummaryDistr->getTH1()->Draw();
1132  name += ".png";
1133  c1.Print(name.c_str());
1134  }
1135  if (hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel") &&
1136  fPSet_.getParameter<bool>("OutputCumulativeSummaryAtLayerLevelAsImage")) {
1137  if (CondObj_fillId_ == "onlyCumul" || CondObj_fillId_ == "ProfileAndCumul") {
1138  TCanvas c1("c1");
1139  selME.SummaryOfCumulDistr->getTH1()->Draw();
1141  name += ".png";
1142  c1.Print(name.c_str());
1143  }
1144  }
1145  }
1146 }
SiStripBaseCondObjDQM::bookSummaryCumulMEs
void bookSummaryCumulMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:696
SiStripHistoId::createHistoLayer
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
Definition: SiStripHistoId.cc:51
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
SiStripBaseCondObjDQM::hidmanager
SiStripHistoId hidmanager
Definition: SiStripBaseCondObjDQM.h:141
SiStripBaseCondObjDQM::folder_organizer
SiStripFolderOrganizer folder_organizer
Definition: SiStripBaseCondObjDQM.h:142
SiStripBaseCondObjDQM::saveTkMap
void saveTkMap(const std::string &TkMapname, double minValue, double maxValue)
Definition: SiStripBaseCondObjDQM.cc:1051
mps_fire.i
i
Definition: mps_fire.py:428
SiStripBaseCondObjDQM::getActiveDetIds
virtual void getActiveDetIds(const edm::EventSetup &eSetup)=0
TrackerTopology::tibIsInternalString
bool tibIsInternalString(const DetId &id) const
Definition: TrackerTopology.h:429
TrackerTopology::tibIsExternalString
bool tibIsExternalString(const DetId &id) const
Definition: TrackerTopology.h:431
SiStripBaseCondObjDQM::fillMEsForLayer
virtual void fillMEsForLayer(uint32_t selDetId_)=0
SiStripBaseCondObjDQM::ModMEs::CumulDistr
MonitorElement * CumulDistr
Definition: SiStripBaseCondObjDQM.h:74
SiStripBaseCondObjDQM::ModMEs::ProfileDistr
MonitorElement * ProfileDistr
Definition: SiStripBaseCondObjDQM.h:73
SiStripSubStructure::getTIDDetectors
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, const TrackerTopology *trackerTopology, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0)
SiStripBaseCondObjDQM::ModMEsMap_
std::map< uint32_t, ModMEs > ModMEsMap_
Definition: SiStripBaseCondObjDQM.h:112
SiStripSubStructure::getTIBDetectors
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0)
TrackerMap::setPalette
void setPalette(int numpalette)
Definition: TrackerMap.h:155
SiStripBaseCondObjDQM::analysisOnDemand
void analysisOnDemand(const edm::EventSetup &eSetup_, uint32_t detIdOnDemand)
Definition: SiStripBaseCondObjDQM.cc:102
min
T min(T a, T b)
Definition: MathUtil.h:58
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
edm::swap
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
SiStripBaseCondObjDQM::activeDetIds
std::vector< uint32_t > activeDetIds
Definition: SiStripBaseCondObjDQM.h:114
SiStripBaseCondObjDQM::getConditionObject
virtual void getConditionObject(const edm::EventSetup &eSetup_)=0
SiStripBaseCondObjDQM::ModulesToBeIncluded_
std::vector< uint32_t > ModulesToBeIncluded_
Definition: SiStripBaseCondObjDQM.h:136
SiStripBaseCondObjDQM::bookProfileMEs
void bookProfileMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:399
SiStripBaseCondObjDQM::analysis
void analysis(const edm::EventSetup &eSetup_)
Definition: SiStripBaseCondObjDQM.cc:43
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
OnDemandMonitoring_cfi.minValue
minValue
Definition: OnDemandMonitoring_cfi.py:74
TrackerMap::fill
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:3288
SiStripBaseCondObjDQM::ModMEs::SummaryOfProfileDistr
MonitorElement * SummaryOfProfileDistr
Definition: SiStripBaseCondObjDQM.h:75
SiStripBaseCondObjDQM::selectModules
void selectModules(std::vector< uint32_t > &detIds_)
Definition: SiStripBaseCondObjDQM.cc:122
SiStripBaseCondObjDQM::HistoMaps_On_
bool HistoMaps_On_
Definition: SiStripBaseCondObjDQM.h:100
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripBaseCondObjDQM::tkMapScaler
std::vector< int > tkMapScaler
Definition: SiStripBaseCondObjDQM.h:105
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
SiStripDetInfoFileReader
Definition: SiStripDetInfoFileReader.h:30
SiStripBaseCondObjDQM::SummaryOnLayerLevel_On_
bool SummaryOnLayerLevel_On_
Definition: SiStripBaseCondObjDQM.h:101
SiStripBaseCondObjDQM::tkMap
TrackerMap * tkMap
Definition: SiStripBaseCondObjDQM.h:120
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SiStripBaseCondObjDQM::SummaryMEsMap_
std::map< uint32_t, ModMEs > SummaryMEsMap_
Definition: SiStripBaseCondObjDQM.h:113
SiStripBaseCondObjDQM::ModulesToBeExcluded_
std::vector< uint32_t > ModulesToBeExcluded_
Definition: SiStripBaseCondObjDQM.h:135
SiStripBaseCondObjDQM::bookTkMap
void bookTkMap(const std::string &TkMapname)
Definition: SiStripBaseCondObjDQM.cc:1047
TrackerTopology::tobRod
unsigned int tobRod(const DetId &id) const
Definition: TrackerTopology.h:195
groupFilesInBlocks.reverse
reverse
Definition: groupFilesInBlocks.py:131
Utilities.operator
operator
Definition: Utilities.py:24
TrackerTopology::tidWheel
unsigned int tidWheel(const DetId &id) const
Definition: TrackerTopology.h:201
SiStripBaseCondObjDQM::reader
SiStripDetInfoFileReader * reader
Definition: SiStripBaseCondObjDQM.h:94
SiStripBaseCondObjDQM::fillMEsForDet
virtual void fillMEsForDet(const ModMEs &selModME_, uint32_t selDetId_)=0
SiStripFolderOrganizer::GetSubDetAndLayer
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=false)
Definition: SiStripFolderOrganizer.cc:106
SiStripBaseCondObjDQM::ModMEs::SummaryDistr
MonitorElement * SummaryDistr
Definition: SiStripBaseCondObjDQM.h:77
SiStripBaseCondObjDQM.h
SiStripBaseCondObjDQM::fillTkMap
void fillTkMap(const uint32_t &detid, const float &value)
Definition: SiStripBaseCondObjDQM.cc:1049
DetId
Definition: DetId.h:17
edm::FileInPath
Definition: FileInPath.h:64
TrackerTopology.h
SiStripBaseCondObjDQM::GrandSummary_On_
bool GrandSummary_On_
Definition: SiStripBaseCondObjDQM.h:103
SiStripBaseCondObjDQM::getStringNameAndId
std::pair< std::string, uint32_t > getStringNameAndId(const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:907
dqm::legacy::DQMStore
Definition: DQMStore.h:727
SiStripBaseCondObjDQM::Mod_On_
bool Mod_On_
Definition: SiStripBaseCondObjDQM.h:99
SiStripBaseCondObjDQM::getLayerNameAndId
std::pair< std::string, uint32_t > getLayerNameAndId(const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:827
SiStripBaseCondObjDQM::SiStripBaseCondObjDQM
SiStripBaseCondObjDQM(edm::RunNumber_t iRun, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet, const TrackerTopology *tTopo)
Definition: SiStripBaseCondObjDQM.cc:8
dqm::impl::MonitorElement::Reset
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
Definition: MonitorElement.cc:354
SiStripBaseCondObjDQM::getModMEs
void getModMEs(ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:300
dqm::implementation::IBooker::bookProfile
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
SiStripSubStructure::getTECDetectors
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, const TrackerTopology *trackerTopology, uint32_t side=0, uint32_t wheel=0, uint32_t petal_bkw_frw=0, uint32_t petal=0, uint32_t ring=0, uint32_t ster=0)
Service
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
TrackerTopology::tobIsZPlusSide
bool tobIsZPlusSide(const DetId &id) const
Definition: TrackerTopology.h:252
dqm::legacy::MonitorElement::getTProfile
virtual TProfile * getTProfile() const
Definition: MonitorElement.h:507
TrackerMap
Definition: TrackerMap.h:76
SiStripBaseCondObjDQM::fillSummaryMEs
virtual void fillSummaryMEs(const std::vector< uint32_t > &selectedDetIds)
Definition: SiStripBaseCondObjDQM.cc:1108
dqm::legacy::MonitorElement::getTH1
virtual TH1 * getTH1() const
Definition: MonitorElement.h:475
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
dqm::impl::MonitorElement::setAxisRange
virtual void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:794
SiStripBaseCondObjDQM::fillModMEs
virtual void fillModMEs(const std::vector< uint32_t > &selectedDetIds)
Definition: SiStripBaseCondObjDQM.cc:1100
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
TrackerTopology::tibString
unsigned int tibString(const DetId &id) const
Definition: TrackerTopology.h:419
SiStripBaseCondObjDQM::CondObj_fillId_
std::string CondObj_fillId_
Definition: SiStripBaseCondObjDQM.h:109
edm::ParameterSet
Definition: ParameterSet.h:47
TrackerTopology::tobIsZMinusSide
bool tobIsZMinusSide(const DetId &id) const
Definition: TrackerTopology.h:253
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
TrackerTopology::tibModule
unsigned int tibModule(const DetId &id) const
Definition: TrackerTopology.h:172
TrackerTopology::tidSide
unsigned int tidSide(const DetId &id) const
Definition: TrackerTopology.h:190
seedmultiplicitymonitor_newtracking_cfi.maxValue
maxValue
Definition: seedmultiplicitymonitor_newtracking_cfi.py:8
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
value
Definition: value.py:1
dqm::impl::MonitorElement::setBinLabel
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:771
SiStripBaseCondObjDQM::bookCumulMEs
void bookCumulMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:441
edm::EventSetup
Definition: EventSetup.h:58
dqm::impl::MonitorElement::getTitle
virtual std::string getTitle() const
get MonitorElement title
Definition: MonitorElement.cc:683
TrackerMap::showPalette
void showPalette(bool printflag1)
Definition: TrackerMap.h:157
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiStripBaseCondObjDQM::bookSummaryMEs
void bookSummaryMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:751
SiStripHistoId::createHistoId
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
Definition: SiStripHistoId.cc:26
SiStripDetInfoFileReader::getAllDetIds
const std::vector< uint32_t > & getAllDetIds() const
Definition: SiStripDetInfoFileReader.h:52
SiStripBaseCondObjDQM::checkChanged
virtual bool checkChanged(const edm::EventSetup &eSetup)=0
SiStripBaseCondObjDQM::GetSameLayerDetId
std::vector< uint32_t > GetSameLayerDetId(const std::vector< uint32_t > &activeDetIds, uint32_t selDetId)
Definition: SiStripBaseCondObjDQM.cc:1022
SiStripBaseCondObjDQM::maxValue
double maxValue
Definition: SiStripBaseCondObjDQM.h:104
SiStripFolderOrganizer::setDetectorFolder
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
Definition: SiStripFolderOrganizer.cc:202
SiStripBaseCondObjDQM::end
virtual void end()
Definition: SiStripBaseCondObjDQM.cc:1096
SiStripBaseCondObjDQM::ModMEs
Definition: SiStripBaseCondObjDQM.h:64
TrackerMap::save
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:810
TrackerTopology::tobLayer
unsigned int tobLayer(const DetId &id) const
Definition: TrackerTopology.h:147
SiStripDetInfoFileReader::getNumberOfApvsAndStripLength
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
Definition: SiStripDetInfoFileReader.cc:101
SiStripSubStructure::getTOBDetectors
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0)
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
TrackerTopology::tobModule
unsigned int tobModule(const DetId &id) const
Definition: TrackerTopology.h:166
SiStripBaseCondObjDQM::tTopo_
const TrackerTopology * tTopo_
Definition: SiStripBaseCondObjDQM.h:122
SiStripBaseCondObjDQM::getSummaryMEs
void getSummaryMEs(ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:333
SiStripBaseCondObjDQM::CondObj_name_
std::string CondObj_name_
Definition: SiStripBaseCondObjDQM.h:110
SiStripFolderOrganizer::setLayerFolder
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=false)
Definition: SiStripFolderOrganizer.cc:304
SiStripBaseCondObjDQM::SummaryOnStringLevel_On_
bool SummaryOnStringLevel_On_
Definition: SiStripBaseCondObjDQM.h:102
SiStripBaseCondObjDQM::ModMEs::SummaryOfCumulDistr
MonitorElement * SummaryOfCumulDistr
Definition: SiStripBaseCondObjDQM.h:76
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
SiStripBaseCondObjDQM::fPSet_
edm::ParameterSet fPSet_
Definition: SiStripBaseCondObjDQM.h:97
TrackerTopology::tibIsZPlusSide
bool tibIsZPlusSide(const DetId &id) const
Definition: TrackerTopology.h:255
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripBaseCondObjDQM::hPSet_
edm::ParameterSet hPSet_
Definition: SiStripBaseCondObjDQM.h:96
SiStripBaseCondObjDQM::SubDetectorsToBeExcluded_
std::vector< std::string > SubDetectorsToBeExcluded_
Definition: SiStripBaseCondObjDQM.h:137
SiStripBaseCondObjDQM::minValue
double minValue
Definition: SiStripBaseCondObjDQM.h:104
SiStripBaseCondObjDQM::runNumber_
edm::RunNumber_t runNumber_
Definition: SiStripBaseCondObjDQM.h:144
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
sistrip::layer_
static const char layer_[]
Definition: ConstantsForGranularity.h:30
SiStripBaseCondObjDQM::bookSummaryProfileMEs
void bookSummaryProfileMEs(SiStripBaseCondObjDQM::ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:475
phase1PixelTopology::layerName
constexpr char const * layerName[numberOfLayers]
Definition: phase1PixelTopology.h:37
SiStripBaseCondObjDQM::dqmStore_
DQMStore * dqmStore_
Definition: SiStripBaseCondObjDQM.h:143
TrackerTopology::tibIsZMinusSide
bool tibIsZMinusSide(const DetId &id) const
Definition: TrackerTopology.h:256
TrackerTopology::tecWheel
unsigned int tecWheel(const DetId &id) const
Definition: TrackerTopology.h:198
edm::Log
Definition: MessageLogger.h:70
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
StripSubdetector.h
SiStripSubStructure.h
sistrip::runNumber_
static const char runNumber_[]
Definition: ConstantsForDqm.h:33
DetIdSelector
Definition: DetIdSelector.h:12
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
TrackerTopology::tibLayer
unsigned int tibLayer(const DetId &id) const
Definition: TrackerTopology.h:150
TrackerTopology::tecSide
unsigned int tecSide(const DetId &id) const
Definition: TrackerTopology.h:184