CMS 3D CMS Logo

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