CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripTrackerMapCreator.cc
Go to the documentation of this file.
8 
11 
14 
19 
20 #include <iostream>
21 
22 //
23 // -- Constructor
24 //
25 /*
26 SiStripTrackerMapCreator::SiStripTrackerMapCreator() {
27  trackerMap_ = 0;
28  if(!edm::Service<TkDetMap>().isAvailable()){
29  edm::LogError("TkHistoMap") <<
30  "\n------------------------------------------"
31  "\nUnAvailable Service TkHistoMap: please insert in the configuration file an instance like"
32  "\n\tprocess.TkDetMap = cms.Service(\"TkDetMap\")"
33  "\n------------------------------------------";
34  }
35  tkDetMap_=edm::Service<TkDetMap>().operator->();
36 }
37 */
38 SiStripTrackerMapCreator::SiStripTrackerMapCreator(const edm::EventSetup& eSetup): meanToMaxFactor_(2.5),eSetup_(eSetup)
39  //, psumap_()
40 {
41  cached_detid=0;
42  cached_layer=0;
43  trackerMap_ = 0;
46  // psumap_.BuildMap("CalibTracker/SiStripDCS/data/StripPSUDetIDMap_FromJan132010.dat",false);
47  if(!edm::Service<TkDetMap>().isAvailable()){
48  edm::LogError("TkHistoMap") <<
49  "\n------------------------------------------"
50  "\nUnAvailable Service TkHistoMap: please insert in the configuration file an instance like"
51  "\n\tprocess.TkDetMap = cms.Service(\"TkDetMap\")"
52  "\n------------------------------------------";
53  }
55 }
56 //
57 // -- Destructor
58 //
60  if (trackerMap_) delete trackerMap_;
61 }
62 //
63 // -- Create Geometric and Fed Tracker Map
64 //
66  DQMStore* dqm_store, std::string& map_type,
67  const edm::EventSetup& eSetup) {
68 
69  const SiStripFedCabling* fedcabling = detcabling_->fedCabling();
70 
71  if(!fedcabling) return;
72 
74  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
75  const TrackerTopology* const tTopo = tTopoHandle.product();
76 
77  if (trackerMap_) delete trackerMap_;
78  trackerMap_ = new TrackerMap(tkmapPset, fedcabling,tTopo);
79  std::string tmap_title = " Tracker Map from " + map_type;
80  trackerMap_->setTitle(tmap_title);
81 
82  nDet = 0;
83  tkMapMax_ = 0.0;
84  tkMapMin_ = 0.0;
85  meanToMaxFactor_ = 2.5;
86  useSSQuality_ = false;
87  ssqLabel_ = "";
88  stripTopLevelDir_="SiStrip";
89 
90  if (map_type == "QTestAlarm") {
91  setTkMapFromAlarm(dqm_store, eSetup);
92  /*
93  trackerMap_->fillc_all_blank();
94  const std::vector<uint16_t>& feds = fedcabling->feds();
95  uint32_t detId_save = 0;
96  for(std::vector<unsigned short>::const_iterator ifed = feds.begin();
97  ifed < feds.end(); ifed++){
98  const std::vector<FedChannelConnection> fedChannels = fedcabling->connections( *ifed );
99  for(std::vector<FedChannelConnection>::const_iterator iconn = fedChannels.begin(); iconn < fedChannels.end(); iconn++){
100 
101  uint32_t detId = iconn->detId();
102  if (detId == 0 || detId == 0xFFFFFFFF) continue;
103  if (detId_save != detId) {
104  detId_save = detId;
105  paintTkMapFromAlarm(detId, dqm_store);
106  }
107  }
108  }
109  */
110  } else {
112  setTkMapFromHistogram(dqm_store, map_type, eSetup);
113  setTkMapRange(map_type);
114  }
116  delete trackerMap_;
117  trackerMap_ = 0;
118 }
119 //
120 // -- Create Tracker Map for Offline process
121 //
123  DQMStore* dqm_store, std::string& map_type,
124  const edm::EventSetup& eSetup) {
125 
126  // Determine the strip top level dirctory in the DQM file: it is the path where MechanicalView is minus one directory
127 
128  std::string mdir = "MechanicalView";
129  dqm_store->cd();
130  if (!SiStripUtility::goToDir(dqm_store, mdir)) {
131  edm::LogError("SiStripTopLevelDirNotFound") << "I cannot find the SiStrip top level directory in the DQM file";
132  }
133  else {
134  std::string mechanicalview_dir = dqm_store->pwd();
135  stripTopLevelDir_=mechanicalview_dir.substr(0,mechanicalview_dir.find_last_of("/"));
136  edm::LogInfo("SiStripTopLevelDirFound") << "SiStrip top level directory is " << stripTopLevelDir_;
137  }
138  dqm_store->cd();
139 
140  //
141  const SiStripFedCabling* fedcabling = detcabling_->fedCabling();
142 
143  if(!fedcabling) return;
144 
145  edm::ESHandle<TrackerTopology> tTopoHandle;
146  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
147  const TrackerTopology* const tTopo = tTopoHandle.product();
148 
149  if (trackerMap_) delete trackerMap_;
150  trackerMap_ = new TrackerMap(tkmapPset,fedcabling,tTopo);
151 
152  meanToMaxFactor_ = tkmapPset.getUntrackedParameter<double>("meanToMaxFact",2.5);
153  useSSQuality_ = tkmapPset.getUntrackedParameter<bool>("useSSQuality",false);
154  ssqLabel_ = tkmapPset.getUntrackedParameter<std::string>("ssqLabel","");
155  bool tkMapPSU = tkmapPset.getUntrackedParameter<bool>("psuMap",false);
156  bool tkMapFED = tkmapPset.getUntrackedParameter<bool>("fedMap",false);
157  std::string namesuffix = tkmapPset.getUntrackedParameter<std::string>("mapSuffix","");
158 
159  // std::string tmap_title = " Tracker Map from " + map_type;
160  unsigned int runNumber_ = tkmapPset.getUntrackedParameter<unsigned int>("RunNumber",1); //LG
161  std::stringstream ss; //LG
162  ss << runNumber_; //LG
163  sRunNumber = ss.str(); //LG
164  std::cout << sRunNumber << "\n\n\n\n\n\n";
165  std::string tmap_title; //LG
166  if (runNumber_>0) { tmap_title = " Run: " + sRunNumber + ", Tracker Map from " + map_type; } //LG
167  else { tmap_title = " Tracker Map from " + map_type; } //LG
168  trackerMap_->setTitle(tmap_title);
169 
170  if(tkmapPset.exists("TopModules"))
171  topModules=tkmapPset.getUntrackedParameter<bool>("TopModules");
172  else
173  topModules=false;
174 
175  if(tkmapPset.exists("numberTopModules"))
176  numTopModules=tkmapPset.getUntrackedParameter<uint32_t>("numberTopModules");
177  else
178  numTopModules = 20;
179 
180  if (tkmapPset.exists("topModLabel"))
181  topModLabel=tkmapPset.getUntrackedParameter<int32_t>("topModLabel");
182  else
183  topModLabel = " top Modules " + map_type;
184 
185  if (map_type == "QTestAlarm") {
186  setTkMapFromAlarm(dqm_store, eSetup);
187  }
188  else {
189  setTkMapFromHistogram(dqm_store, map_type, eSetup);
190  }
191  // if not overwitten by manual configuration min=0 and max= mean value * meanToMaxFactor_
193 
194  // check manual setting
195 
196  if(tkmapPset.exists("mapMax")) tkMapMax_ = tkmapPset.getUntrackedParameter<double>("mapMax");
197  if(tkmapPset.exists("mapMin")) tkMapMin_ = tkmapPset.getUntrackedParameter<double>("mapMin");
198 
199  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
200 
201  trackerMap_->save(true, tkMapMin_,tkMapMax_, map_type+namesuffix+".svg");
202  trackerMap_->save(true, tkMapMin_,tkMapMax_, map_type+namesuffix+".png",4500,2400);
203 
204  if(tkMapPSU) {
205 
206  edm::LogInfo("PSUMapToBeSaved") << "Ready to save PSU TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
207  // trackerMap_->save_as_psutrackermap(true, tkMapMin_,tkMapMax_, map_type+namesuffix+"_psu.svg");
208  trackerMap_->save_as_psutrackermap(true, tkMapMin_,tkMapMax_, map_type+namesuffix+"_psu.png");
209 
210  }
211 
212  if(tkMapFED) {
213 
214  edm::LogInfo("FEDMapToBeSaved") << "Ready to save FED TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
215  // trackerMap_->save_as_fedtrackermap(true, tkMapMin_,tkMapMax_, map_type+"_fed.svg");
216  trackerMap_->save_as_fedtrackermap(true, tkMapMin_,tkMapMax_, map_type+namesuffix+"_fed.png");
217 
218  }
219 
220  delete trackerMap_;
221  trackerMap_ = 0;
222 }
223 //
224 // -- Fill Tracker Map with QTest Alarms and SiStripQuality bad modules
226 
227  //Retrieve tracker topology from geometry
228  edm::ESHandle<TrackerTopology> tTopoHandle;
229  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
230  const TrackerTopology* const tTopo = tTopoHandle.product();
231 
232  nDet = 0;
233  tkMapMax_ = 0.0;
234  tkMapMin_ = 0.0;
235 
237 
239 
241 
242  std::map<unsigned int,std::string>* badmodmap = new std::map<unsigned int,std::string>;
243 
244  // used to avoid multiple checks on the same detid since the loop is done on the FED channels
245  uint32_t detId_save = 0;
246  // example of loop using SiStripDetCabling
247  for(std::map< uint32_t, std::vector<const FedChannelConnection *> >::const_iterator module = detcabling_->getDetCabling().begin();
248  module!=detcabling_->getDetCabling().end();++module) {
249  uint32_t detId = module->first;
250  if (detId == 0 || detId == 0xFFFFFFFF) continue;
251  if (detId_save != detId) {
252  detId_save = detId;
253  bool isBad = useSSQuality_ && ssq->IsModuleBad(detId);
254  paintTkMapFromAlarm(detId, tTopo, dqm_store,isBad,badmodmap);
255  }
256  else {
257  edm::LogWarning("TwiceTheSameDetId") << "The detid " << detId << " was found already in the loop on SiStripDetCabling";
258  }
259  }
260  //
261  printBadModuleList(badmodmap, eSetup);
262  delete badmodmap;
263 }
264 //
265 void SiStripTrackerMapCreator::printBadModuleList(std::map<unsigned int,std::string>* badmodmap, const edm::EventSetup& eSetup) {
266 
267  //Retrieve tracker topology from geometry
268  edm::ESHandle<TrackerTopology> tTopoHandle;
269  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
270  const TrackerTopology* const tTopo = tTopoHandle.product();
271 
272  bool tibDone=false,tidSide1Done=false,tidSide2Done=false,tobDone=false,tecSide1Done=false,tecSide2Done=false;
273  unsigned int tibFirst=369120277-1,
274  tidSide1First=402664197-1,tidSide2First=402672389-1,
275  tobFirst=436228134-1,
276  tecSide1First=470044965-1,tecSide2First=470307109-1;
277 
278  int ntib=0,ntids1=0,ntids2=0,ntob=0,ntecs1=0,ntecs2=0;
279 
280  for(std::map<unsigned int,std::string>::const_iterator badmod = badmodmap->begin(); badmod!= badmodmap->end(); ++badmod) {
281  SiStripDetId ssdetid(badmod->first);
282  if(ssdetid.subDetector()==SiStripDetId::TIB) ntib++;
283  if(ssdetid.subDetector()==SiStripDetId::TID) {
284 
285  if(tTopo->tidSide(ssdetid)==1) ntids1++;
286  if(tTopo->tidSide(ssdetid)==2) ntids2++;
287  }
288  if(ssdetid.subDetector()==SiStripDetId::TOB) ntob++;
289  if(ssdetid.subDetector()==SiStripDetId::TEC) {
290 
291  if(tTopo->tecSide(ssdetid)==1) ntecs1++;
292  if(tTopo->tecSide(ssdetid)==2) ntecs2++;
293  }
294  }
295 
296  // edm::LogVerbatim("BadModuleList") << "Number of bad modules in total:";
297  edm::LogVerbatim("BadModuleList") << "Run: " << sRunNumber << ", Number of bad modules in total:"; //LG
298  edm::LogVerbatim("BadModuleList") << "--------------------------------------------------------------";
299  edm::LogVerbatim("BadModuleList") << "TIB: " << ntib;
300  edm::LogVerbatim("BadModuleList") << "TID/MINUS: " << ntids1;
301  edm::LogVerbatim("BadModuleList") << "TID/PLUS: " << ntids2;
302  edm::LogVerbatim("BadModuleList") << "TOB: " << ntob;
303  edm::LogVerbatim("BadModuleList") << "TEC/MINUS: " << ntecs1;
304  edm::LogVerbatim("BadModuleList") << "TEC/PLUS: " << ntecs2;
305  edm::LogVerbatim("BadModuleList") << "-------------------------------";
306  edm::LogVerbatim("BadModuleList") ;
307  edm::LogVerbatim("BadModuleList") << "List of bad modules per partition:";
308  edm::LogVerbatim("BadModuleList") << "----------------------------------";
309 
310  for(std::map<unsigned int,std::string>::const_iterator badmod = badmodmap->begin(); badmod!= badmodmap->end(); ++badmod) {
311  if(!tibDone && badmod->first >= tibFirst) {
312  tibDone = true;
313  edm::LogVerbatim("BadModuleList") ;
314  edm::LogVerbatim("BadModuleList") << "SubDetector TIB";
315  edm::LogVerbatim("BadModuleList") ;
316  }
317  if(!tidSide1Done && badmod->first >= tidSide1First) {
318  tidSide1Done = true;
319  edm::LogVerbatim("BadModuleList") ;
320  edm::LogVerbatim("BadModuleList") << "SubDetector TID/MINUS";
321  edm::LogVerbatim("BadModuleList") ;
322  }
323  if(!tidSide2Done && badmod->first >= tidSide2First) {
324  tidSide2Done = true;
325  edm::LogVerbatim("BadModuleList") ;
326  edm::LogVerbatim("BadModuleList") << "SubDetector TID/PLUS";
327  edm::LogVerbatim("BadModuleList") ;
328  }
329  if(!tobDone && badmod->first >= tobFirst) {
330  tobDone = true;
331  edm::LogVerbatim("BadModuleList") ;
332  edm::LogVerbatim("BadModuleList") << "SubDetector TOB";
333  edm::LogVerbatim("BadModuleList") ;
334  }
335  if(!tecSide1Done && badmod->first >= tecSide1First) {
336  tecSide1Done = true;
337  edm::LogVerbatim("BadModuleList") ;
338  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/MINUS";
339  edm::LogVerbatim("BadModuleList") ;
340  }
341  if(!tecSide2Done && badmod->first >= tecSide2First) {
342  tecSide2Done = true;
343  edm::LogVerbatim("BadModuleList") ;
344  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/PLUS";
345  edm::LogVerbatim("BadModuleList") ;
346  }
347  edm::LogVerbatim("BadModuleList") << badmod->second;
348  }
349 }
350 
351 //
352 // -- Paint Tracker Map with QTest Alarms
353 //
355  DQMStore* dqm_store, bool isBad, std::map<unsigned int,std::string>* badmodmap) {
356  std::ostringstream comment;
357  uint16_t flag = 0;
358  flag = getDetectorFlagAndComment(dqm_store, det_id, tTopo, comment);
359 
360  int rval, gval, bval;
361  SiStripUtility::getDetectorStatusColor(flag, rval, gval, bval);
362  if(isBad) { rval=255; gval=255; bval = 0; comment << " PCLBadModule ";}
363  trackerMap_->setText(det_id, comment.str());
364  trackerMap_->fillc(det_id, rval, gval, bval);
365  if(badmodmap && (flag!=0 || isBad)) (*badmodmap)[det_id] = comment.str();
366 }
367 
368 //
369 // -- Paint Tracker Map from TkHistoMap Histograms
371  dqm_store->cd();
372 
373  std::string mdir = "MechanicalView";
374  if (!SiStripUtility::goToDir(dqm_store, mdir)) return;
375  std::string mechanicalview_dir = dqm_store->pwd();
376 
377  std::vector<std::string> subdet_folder;
378  subdet_folder.push_back("TIB");
379  subdet_folder.push_back("TOB");
380  subdet_folder.push_back("TEC/MINUS");
381  subdet_folder.push_back("TEC/PLUS");
382  subdet_folder.push_back("TID/MINUS");
383  subdet_folder.push_back("TID/PLUS");
384 
385  nDet = 0;
386  tkMapMax_ = 0.0;
387  tkMapMin_ = 0.0;
388  std::vector<std::pair<float,uint32_t> >* topNmodVec = new std::vector<std::pair<float,uint32_t> >;
389 
390  for (std::vector<std::string>::const_iterator it = subdet_folder.begin(); it != subdet_folder.end(); it++) {
391  std::string dname = mechanicalview_dir + "/" + (*it);
392  if (!dqm_store->dirExists(dname)) continue;
393  dqm_store->cd(dname);
394  std::vector<std::string> layerVec = dqm_store->getSubdirs();
395  for (std::vector<std::string>::const_iterator iLayer = layerVec.begin(); iLayer != layerVec.end(); iLayer++) {
396  if ((*iLayer).find("BadModuleList") !=std::string::npos) continue;
397  std::vector<MonitorElement*> meVec = dqm_store->getContents((*iLayer));
398  MonitorElement* tkhmap_me = 0;
400  for (std::vector<MonitorElement*>::const_iterator itkh = meVec.begin(); itkh != meVec.end(); itkh++) {
401  name = (*itkh)->getName();
402  if (name.find("TkHMap") == std::string::npos) continue;
403  if (htype == "QTestAlarm" ){
404  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
405  tkhmap_me = (*itkh);
406  break;
407  } else if (name.find(htype) != std::string::npos) {
408  tkhmap_me = (*itkh);
409  break;
410  }
411  }
412  if (tkhmap_me != 0) {
413  if (topModules){
414  paintTkMapFromHistogram(dqm_store,tkhmap_me, htype, topNmodVec);
415  }
416  else paintTkMapFromHistogram(dqm_store,tkhmap_me, htype, 0);
417  }
418  }
419  dqm_store->cd(mechanicalview_dir);
420  }
421  dqm_store->cd();
422  if (topModules) printTopModules(topNmodVec, eSetup);
423  delete topNmodVec;
424 }
425 
426 void SiStripTrackerMapCreator::printTopModules(std::vector<std::pair<float,uint32_t> >* topNmodVec, const edm::EventSetup& eSetup){
427 
429  //edm::ESHandle<TrackerTopology> tTopoHandle;
430  //eSetup.get<TrackerTopologyRecord>().get(tTopoHandle);
431  //const TrackerTopology* const tTopo = tTopoHandle.product();
432  edm::ESHandle<TrackerTopology> tTopoHandle;
433  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
434  const TrackerTopology* const tTopo = tTopoHandle.product();
435 
436  if (topNmodVec->empty()) return;
437 
438  std::sort(topNmodVec->rbegin(), topNmodVec->rend());
439  if (topNmodVec->size() > numTopModules) topNmodVec->resize(numTopModules);
440 
441  edm::LogVerbatim("TopModules") << topModLabel;
442  edm::LogVerbatim("TopModules") << "------------------------------------------------------";
443 
444  for (std::vector<std::pair<float, uint32_t> >::const_iterator itNmod = topNmodVec->begin(); itNmod != topNmodVec->end(); itNmod++){
445  std::pair<float, uint32_t> aPair=(*itNmod);
446  uint32_t det_id = aPair.second;
447  std::ostringstream comment;
449  SiStripDetId ssdetid(aPair.second);
450  if(ssdetid.subDetector()==SiStripDetId::TIB) subdetector = "TIB ";
451  if(ssdetid.subDetector()==SiStripDetId::TID){
452  if(tTopo->tidSide(ssdetid)==1) subdetector = "TID/MINUS ";
453  if(tTopo->tidSide(ssdetid)==2) subdetector = "TID/PLUS ";
454  }
455  if(ssdetid.subDetector()==SiStripDetId::TOB) subdetector = "TOB ";
456  if(ssdetid.subDetector()==SiStripDetId::TEC){
457  if(tTopo->tecSide(ssdetid)==1) subdetector = "TEC/MINUS ";
458  if(tTopo->tecSide(ssdetid)==2) subdetector = "TEC/PLUS ";
459  }
460  uint16_t flag = getDetectorFlagAndComment(0, det_id, tTopo, comment);
461  if (flag == 0) edm::LogVerbatim("TopModules") << subdetector << comment.str() << " value: "<< aPair.first;
462  }
463  edm::LogVerbatim("TopModules") << "------------------------------------------------------";
464 }
465 
466 
467 void SiStripTrackerMapCreator::paintTkMapFromHistogram(DQMStore* dqm_store, MonitorElement* me, std::string& htype, std::vector<std::pair<float, uint32_t> >* topNmodVec) {
468 
469  // edm::ESHandle<SiStripQuality> ssq;
470 
471  // if(useSSQuality_) { eSetup_.get<SiStripQualityRcd>().get(ssqLabel_,ssq); }
472 
473  std::string name = me->getName();
474  std::string lname = name.substr(name.find("TkHMap_")+7);
475  lname = lname.substr(lname.find("_T")+1);
476  std::vector<uint32_t> layer_detids;
477  tkDetMap_->getDetsForLayer(tkDetMap_->getLayerNum(lname), layer_detids);
478  for (std::vector<uint32_t>::const_iterator idet = layer_detids.begin(); idet != layer_detids.end(); idet++) {
479  uint32_t det_id= (*idet);
480  if (det_id <= 0) continue;
481  nDet++;
483  float fval = 0.0;
484  if ( (name.find("NumberOfOff") != std::string::npos) || //temporary fix
485  (name.find("NumberOfOnTrackCluster") != std::string::npos) ) {
487  TProfile2D* tp = me->getTProfile2D() ;
488  fval = tp->GetBinEntries(tp->GetBin(xyval.ix, xyval.iy)) * tp->GetBinContent(xyval.ix, xyval.iy);
489  }
490  } else fval = me->getBinContent(xyval.ix, xyval.iy);
491  if (htype == "QTestAlarm") {
492  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
493  /*
494  int rval, gval, bval;
495  std::ostringstream comment;
496  uint32_t flag = 0;
497  flag = getDetectorFlagAndComment(dqm_store, det_id, comment);
498  SiStripUtility::getDetectorStatusColor(flag, rval, gval, bval);
499  if(useSSQuality_ && ssq->IsModuleBad(det_id)) { rval=255; gval=255; bval = 0;}
500  trackerMap_->fillc(det_id, rval, gval, bval);
501  trackerMap_->setText(det_id, comment.str());
502  */
503  } else {
504  if (fval == 0.0) trackerMap_->fillc(det_id,255, 255, 255);
505  else {
506  trackerMap_->fill_current_val(det_id, fval);
507  if(topNmodVec){
508  auto detPair = std::make_pair(fval,det_id);
509  topNmodVec->push_back(detPair);
510  }
511  }
512  tkMapMax_ += fval;
513  }
514  }
515 }
516 //
517 // -- Get Tracker Map Fill Range
518 //
520  tkMapMin_ = 0.0;
521  if (tkMapMax_ == 0.0) {
522  if (map_type.find("FractionOfBadChannels") != std::string::npos) tkMapMax_ = 1.0;
523  else if (map_type.find("NumberOfCluster") != std::string::npos) tkMapMax_ = 0.01;
524  else if (map_type.find("NumberOfDigi") != std::string::npos) tkMapMax_ = 0.6;
525  else if (map_type.find("NumberOfOffTrackCluster") != std::string::npos) tkMapMax_ = 100.0;
526  else if (map_type.find("NumberOfOnTrackCluster") != std::string::npos) tkMapMax_ = 50.0;
527  else if (map_type.find("StoNCorrOnTrack") != std::string::npos) tkMapMax_ = 200.0;
528  } else {
529  tkMapMax_ = tkMapMax_/nDet*1.0;
531  }
533 }
535  tkMapMin_ = 0.0;
536  if (tkMapMax_ != 0.0) {
537  tkMapMax_ = tkMapMax_/(nDet*1.0);
539  }
540  // the following line seems to be useless and misleading: in the offline map creation the range is set with the save... methods
541  // trackerMap_->setRange(tkMapMin_, tkMapMax_);
542 }
543 //
544 // -- Get Flag and status Comment
545 //
547  const TrackerTopology* tTopo, std::ostringstream& comment) {
548  // comment << " DetId " << det_id << " : ";
549  comment << "Module " << det_id;
550  uint16_t flag = 0;
551 
552  // get FED channels corresponding to the det_id
553 
554  // if(detcabling_) {
555  comment << " FEDCHs ";
556  std::vector<const FedChannelConnection*> conns = detcabling_->getConnections(det_id);
557  for(unsigned int i=0; i< conns.size() ;++i) {
558  if(conns[i]) {
559  comment << std::setw(3) << conns[i]->fedId() << "/" << std::setw(2) << conns[i]->fedCh()<< " ";
560  }
561  else {
562  comment << " ";
563  }
564  }
565  if(conns.size()==0) { comment << " "; }
566  if(conns.size()==1) { comment << " "; }
567  if(conns.size()==2) { comment << " "; }
568  // }
569  if(!dqm_store) return flag;
570  // get PSU channel corresponding to the det_id
571  /*
572  comment << " PSU: ";
573  comment << psumap_.getPSUName(det_id);
574  */
575  //
576 
577  SiStripFolderOrganizer folder_organizer;
578  std::string subdet_folder, badmodule_folder;
579 
580  dqm_store->cd();
581 
582  folder_organizer.setSiStripFolderName(stripTopLevelDir_);
583  folder_organizer.getSubDetFolder(det_id, tTopo, subdet_folder);
584 
585  LogDebug("SearchBadModule") << det_id << " " << subdet_folder << " " << stripTopLevelDir_;
586 
587  if (dqm_store->dirExists(subdet_folder)){
588  badmodule_folder = subdet_folder + "/BadModuleList";
589  LogDebug("SearchBadModule") << subdet_folder << " exists: " << badmodule_folder;
590  } else {
591  // badmodule_folder = dqm_store->pwd() + "/BadModuleList";
592  edm::LogError("SubDetFolderNotFound") << subdet_folder << " does not exist for detid " << det_id;
593  return flag;
594  }
595  if (!dqm_store->dirExists(badmodule_folder)) {
596  LogDebug("BadModuleFolderNotFound") << badmodule_folder << " does not exist for detid " << det_id;
597  return flag;
598  }
599  std::ostringstream badmodule_path;
600  badmodule_path << badmodule_folder << "/" << det_id;
601  LogDebug("SearchBadModule") << badmodule_folder << " exists: " << badmodule_path;
602 
603  MonitorElement* bad_module_me = dqm_store->get(badmodule_path.str());
604  if (bad_module_me && bad_module_me->kind() == MonitorElement::DQM_KIND_INT) {
605  LogDebug("SearchBadModule") << "Monitor Element found";
606  flag = bad_module_me->getIntValue();
608  SiStripUtility::getBadModuleStatus(flag, message);
609  comment << message.c_str();
610  }
611  return flag;
612 }
#define LogDebug(id)
int getLayerNum(const std::string &in) const
Definition: TkDetMap.cc:777
static const char runNumber_[]
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
void fillc_all_blank()
Definition: TrackerMap.cc:2732
void setSiStripFolderName(std::string name)
void getSubDetFolder(const uint32_t &detid, const TrackerTopology *tTopo, std::string &folder_name)
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1722
TProfile2D * getTProfile2D(void) const
void save_as_psutrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="psu_svgmap.svg", int width=100+(360+100)*5+300, int height=50+(150+50)*6+300)
Definition: TrackerMap.cc:1844
TString subdetector
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:700
edm::ESHandle< SiStripDetCabling > detcabling_
bool exists(std::string const &parameterName) const
checks if a parameter exists
static void getDetectorStatusColor(int status, int &rval, int &gval, int &bval)
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, const TrackerTopology *tTopo, std::ostringstream &comment)
void printBadModuleList(std::map< unsigned int, std::string > *badmodmap, const edm::EventSetup &eSetup)
static void getBadModuleStatus(uint16_t flag, std::string &message)
void paintTkMapFromAlarm(uint32_t det_id, const TrackerTopology *tTopo, DQMStore *dqm_store, bool isBad=false, std::map< unsigned int, std::string > *badmodmap=0)
void setTitle(std::string s)
Definition: TrackerMap.h:127
void fill_all_blank()
Definition: TrackerMap.cc:2740
void setTkMapFromAlarm(DQMStore *dqm_store, const edm::EventSetup &eSetup)
unsigned int tidSide(const DetId &id) const
const edm::EventSetup & eSetup_
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:699
Kind kind(void) const
Get the type of the monitor element.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1771
void getDetsForLayer(int layer, std::vector< uint32_t > &output) const
Definition: TkDetMap.cc:695
void setTkMapFromHistogram(DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1800
void fillc(int idmod, int RGBcode)
Definition: TrackerMap.h:104
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:788
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
unsigned long long int rval
Definition: vlib.h:22
SubDetector subDetector() const
Definition: SiStripDetId.h:114
void save_as_fedtrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="fed_svgmap.svg", int width=100+(90+100)*31+300, int height=150+(2940+150)*1+300)
Definition: TrackerMap.cc:2126
void paintTkMapFromHistogram(DQMStore *dqm_store, MonitorElement *me, std::string &map_type, std::vector< std::pair< float, uint32_t > > *topNmodVec)
int64_t getIntValue(void) const
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void printTopModules(std::vector< std::pair< float, uint32_t > > *topNmodVec, const edm::EventSetup &eSetup)
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
void setRange(float min, float max)
Definition: TrackerMap.cc:671
double getBinContent(int binx) const
get content of bin (1-D)
void printonline()
Definition: TrackerMap.cc:2878
void createForOffline(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
SiStripTrackerMapCreator(const edm::EventSetup &eSetup)
void fill_current_val(int idmod, float current_val)
Definition: TrackerMap.cc:2750
tuple cout
Definition: gather_cfg.py:145
void setText(int idmod, std::string s)
Definition: TrackerMap.cc:2788
const TkLayerMap::XYbin & getXY(uint32_t &, uint32_t &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:652
static bool goToDir(DQMStore *dqm_store, std::string name)
Definition: vlib.h:208
void setTkMapRange(std::string &map_type)
void create(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
unsigned int tecSide(const DetId &id) const
const std::string & pwd(void) const
Definition: DQMStore.cc:695
#define comment(par)
Definition: vmac.h:161