CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripTrackerMapCreator Class Reference

#include <SiStripTrackerMapCreator.h>

Public Member Functions

void create (const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
 
void createForOffline (const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
 
bool readConfiguration ()
 
 SiStripTrackerMapCreator (const edm::EventSetup &eSetup)
 
 ~SiStripTrackerMapCreator ()
 

Private Member Functions

uint16_t getDetectorFlagAndComment (DQMStore *dqm_store, uint32_t det_id, const TrackerTopology *tTopo, std::ostringstream &comment)
 
void paintTkMapFromAlarm (uint32_t det_id, const TrackerTopology *tTopo, DQMStore *dqm_store, bool isBad=false, std::map< unsigned int, std::string > *badmodmap=0)
 
void paintTkMapFromHistogram (DQMStore *dqm_store, MonitorElement *me, std::string &map_type, std::vector< std::pair< float, uint32_t > > *topNmodVec)
 
void printBadModuleList (std::map< unsigned int, std::string > *badmodmap, const edm::EventSetup &eSetup)
 
void printTopModules (std::vector< std::pair< float, uint32_t > > *topNmodVec, const edm::EventSetup &eSetup)
 
void setTkMapFromAlarm (DQMStore *dqm_store, const edm::EventSetup &eSetup)
 
void setTkMapFromHistogram (DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
 
void setTkMapRange (std::string &map_type)
 
void setTkMapRangeOffline ()
 

Private Attributes

uint32_t cached_detid
 
int16_t cached_layer
 
TkLayerMap::XYbin cached_XYbin
 
edm::ESHandle< SiStripDetCablingdetcabling_
 
const edm::EventSetupeSetup_
 
float meanToMaxFactor_
 
int nDet
 
int32_t numTopModules
 
std::string ssqLabel_
 
std::string stripTopLevelDir_
 
TkDetMaptkDetMap_
 
float tkMapMax_
 
float tkMapMin_
 
std::string tkMapName_
 
std::string topModLabel
 
bool topModules
 
TrackerMaptrackerMap_
 
bool useSSQuality_
 

Detailed Description

Definition at line 23 of file SiStripTrackerMapCreator.h.

Constructor & Destructor Documentation

SiStripTrackerMapCreator::SiStripTrackerMapCreator ( const edm::EventSetup eSetup)

Definition at line 38 of file SiStripTrackerMapCreator.cc.

References cached_detid, cached_layer, detcabling_, eSetup_, edm::EventSetup::get(), cppFunctionSkipper::operator, stripTopLevelDir_, tkDetMap_, and trackerMap_.

38  : 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 }
edm::ESHandle< SiStripDetCabling > detcabling_
const edm::EventSetup & eSetup_
const T & get() const
Definition: EventSetup.h:55
SiStripTrackerMapCreator::~SiStripTrackerMapCreator ( )

Definition at line 59 of file SiStripTrackerMapCreator.cc.

References trackerMap_.

59  {
60  if (trackerMap_) delete trackerMap_;
61 }

Member Function Documentation

void SiStripTrackerMapCreator::create ( const edm::ParameterSet tkmapPset,
DQMStore dqm_store,
std::string &  htype,
const edm::EventSetup eSetup 
)

Definition at line 65 of file SiStripTrackerMapCreator.cc.

References detcabling_, TrackerMap::fill_all_blank(), meanToMaxFactor_, nDet, TrackerMap::printonline(), TrackerMap::setTitle(), setTkMapFromAlarm(), setTkMapFromHistogram(), setTkMapRange(), ssqLabel_, AlCaHLTBitMon_QueryRunRegistry::string, stripTopLevelDir_, tkMapMax_, tkMapMin_, trackerMap_, and useSSQuality_.

Referenced by SiStripActionExecutor::createTkMap().

67  {
68 
69  const SiStripFedCabling* fedcabling = detcabling_->fedCabling();
70 
71  if(!fedcabling) return;
72 
73  if (trackerMap_) delete trackerMap_;
74  trackerMap_ = new TrackerMap(tkmapPset, fedcabling);
75  std::string tmap_title = " Tracker Map from " + map_type;
76  trackerMap_->setTitle(tmap_title);
77 
78  nDet = 0;
79  tkMapMax_ = 0.0;
80  tkMapMin_ = 0.0;
81  meanToMaxFactor_ = 2.5;
82  useSSQuality_ = false;
83  ssqLabel_ = "";
84  stripTopLevelDir_="SiStrip";
85 
86  if (map_type == "QTestAlarm") {
87  setTkMapFromAlarm(dqm_store, eSetup);
88  /*
89  trackerMap_->fillc_all_blank();
90  const std::vector<uint16_t>& feds = fedcabling->feds();
91  uint32_t detId_save = 0;
92  for(std::vector<unsigned short>::const_iterator ifed = feds.begin();
93  ifed < feds.end(); ifed++){
94  const std::vector<FedChannelConnection> fedChannels = fedcabling->connections( *ifed );
95  for(std::vector<FedChannelConnection>::const_iterator iconn = fedChannels.begin(); iconn < fedChannels.end(); iconn++){
96 
97  uint32_t detId = iconn->detId();
98  if (detId == 0 || detId == 0xFFFFFFFF) continue;
99  if (detId_save != detId) {
100  detId_save = detId;
101  paintTkMapFromAlarm(detId, dqm_store);
102  }
103  }
104  }
105  */
106  } else {
108  setTkMapFromHistogram(dqm_store, map_type, eSetup);
109  setTkMapRange(map_type);
110  }
112  delete trackerMap_;
113  trackerMap_ = 0;
114 }
edm::ESHandle< SiStripDetCabling > detcabling_
void setTitle(std::string s)
Definition: TrackerMap.h:126
void fill_all_blank()
Definition: TrackerMap.cc:2739
void setTkMapFromAlarm(DQMStore *dqm_store, const edm::EventSetup &eSetup)
void setTkMapFromHistogram(DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
void printonline()
Definition: TrackerMap.cc:2877
void setTkMapRange(std::string &map_type)
void SiStripTrackerMapCreator::createForOffline ( const edm::ParameterSet tkmapPset,
DQMStore dqm_store,
std::string &  htype,
const edm::EventSetup eSetup 
)

Definition at line 118 of file SiStripTrackerMapCreator.cc.

References DQMStore::cd(), detcabling_, edm::ParameterSet::exists(), edm::ParameterSet::getUntrackedParameter(), SiStripUtility::goToDir(), meanToMaxFactor_, numTopModules, DQMStore::pwd(), TrackerMap::save(), TrackerMap::save_as_fedtrackermap(), TrackerMap::save_as_psutrackermap(), TrackerMap::setTitle(), setTkMapFromAlarm(), setTkMapFromHistogram(), setTkMapRangeOffline(), ssqLabel_, AlCaHLTBitMon_QueryRunRegistry::string, stripTopLevelDir_, tkMapMax_, tkMapMin_, topModLabel, topModules, trackerMap_, and useSSQuality_.

Referenced by SiStripActionExecutor::createOfflineTkMap().

120  {
121 
122  // Determine the strip top level dirctory in the DQM file: it is the path where MechanicalView is minus one directory
123 
124  std::string mdir = "MechanicalView";
125  dqm_store->cd();
126  if (!SiStripUtility::goToDir(dqm_store, mdir)) {
127  edm::LogError("SiStripTopLevelDirNotFound") << "I cannot find the SiStrip top level directory in the DQM file";
128  }
129  else {
130  std::string mechanicalview_dir = dqm_store->pwd();
131  stripTopLevelDir_=mechanicalview_dir.substr(0,mechanicalview_dir.find_last_of("/"));
132  edm::LogInfo("SiStripTopLevelDirFound") << "SiStrip top level directory is " << stripTopLevelDir_;
133  }
134  dqm_store->cd();
135 
136  //
137  const SiStripFedCabling* fedcabling = detcabling_->fedCabling();
138 
139  if(!fedcabling) return;
140 
141  if (trackerMap_) delete trackerMap_;
142  trackerMap_ = new TrackerMap(tkmapPset,fedcabling);
143 
144  meanToMaxFactor_ = tkmapPset.getUntrackedParameter<double>("meanToMaxFact",2.5);
145  useSSQuality_ = tkmapPset.getUntrackedParameter<bool>("useSSQuality",false);
146  ssqLabel_ = tkmapPset.getUntrackedParameter<std::string>("ssqLabel","");
147  bool tkMapPSU = tkmapPset.getUntrackedParameter<bool>("psuMap",false);
148  bool tkMapFED = tkmapPset.getUntrackedParameter<bool>("fedMap",false);
149  std::string namesuffix = tkmapPset.getUntrackedParameter<std::string>("mapSuffix","");
150 
151  std::string tmap_title = " Tracker Map from " + map_type;
152  trackerMap_->setTitle(tmap_title);
153 
154  if(tkmapPset.exists("TopModules"))
155  topModules=tkmapPset.getUntrackedParameter<bool>("TopModules");
156  else
157  topModules=false;
158 
159  if(tkmapPset.exists("numberTopModules"))
160  numTopModules=tkmapPset.getUntrackedParameter<int32_t>("numberTopModules");
161  else
162  numTopModules = 20;
163 
164  if (tkmapPset.exists("topModLabel"))
165  topModLabel=tkmapPset.getUntrackedParameter<int32_t>("topModLabel");
166  else
167  topModLabel = " top Modules " + map_type;
168 
169  if (map_type == "QTestAlarm") {
170  setTkMapFromAlarm(dqm_store, eSetup);
171  }
172  else {
173  setTkMapFromHistogram(dqm_store, map_type, eSetup);
174  }
175  // if not overwitten by manual configuration min=0 and max= mean value * meanToMaxFactor_
177 
178  // check manual setting
179 
180  if(tkmapPset.exists("mapMax")) tkMapMax_ = tkmapPset.getUntrackedParameter<double>("mapMax");
181  if(tkmapPset.exists("mapMin")) tkMapMin_ = tkmapPset.getUntrackedParameter<double>("mapMin");
182 
183  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
184 
185  trackerMap_->save(true, tkMapMin_,tkMapMax_, map_type+namesuffix+".svg");
186  trackerMap_->save(true, tkMapMin_,tkMapMax_, map_type+namesuffix+".png",4500,2400);
187 
188  if(tkMapPSU) {
189 
190  edm::LogInfo("PSUMapToBeSaved") << "Ready to save PSU TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
191  // trackerMap_->save_as_psutrackermap(true, tkMapMin_,tkMapMax_, map_type+namesuffix+"_psu.svg");
192  trackerMap_->save_as_psutrackermap(true, tkMapMin_,tkMapMax_, map_type+namesuffix+"_psu.png");
193 
194  }
195 
196  if(tkMapFED) {
197 
198  edm::LogInfo("FEDMapToBeSaved") << "Ready to save FED TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
199  // trackerMap_->save_as_fedtrackermap(true, tkMapMin_,tkMapMax_, map_type+"_fed.svg");
200  trackerMap_->save_as_fedtrackermap(true, tkMapMin_,tkMapMax_, map_type+namesuffix+"_fed.png");
201 
202  }
203 
204  delete trackerMap_;
205  trackerMap_ = 0;
206 }
T getUntrackedParameter(std::string const &, T const &) 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:1843
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:696
edm::ESHandle< SiStripDetCabling > detcabling_
bool exists(std::string const &parameterName) const
checks if a parameter exists
void setTitle(std::string s)
Definition: TrackerMap.h:126
void setTkMapFromAlarm(DQMStore *dqm_store, 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:698
void setTkMapFromHistogram(DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
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:2125
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
static bool goToDir(DQMStore *dqm_store, std::string name)
const std::string & pwd(void) const
Definition: DQMStore.cc:691
uint16_t SiStripTrackerMapCreator::getDetectorFlagAndComment ( DQMStore dqm_store,
uint32_t  det_id,
const TrackerTopology tTopo,
std::ostringstream &  comment 
)
private

Definition at line 525 of file SiStripTrackerMapCreator.cc.

References DQMStore::cd(), detcabling_, DQMStore::dirExists(), MonitorElement::DQM_KIND_INT, archive::flag, DQMStore::get(), SiStripUtility::getBadModuleStatus(), MonitorElement::getIntValue(), SiStripFolderOrganizer::getSubDetFolder(), i, MonitorElement::kind(), LogDebug, python.rootplot.argparse::message, SiStripFolderOrganizer::setSiStripFolderName(), AlCaHLTBitMon_QueryRunRegistry::string, and stripTopLevelDir_.

Referenced by paintTkMapFromAlarm(), and printTopModules().

526  {
527  // comment << " DetId " << det_id << " : ";
528  comment << "Module " << det_id;
529  uint16_t flag = 0;
530 
531  // get FED channels corresponding to the det_id
532 
533  // if(detcabling_) {
534  comment << " FEDCHs ";
535  std::vector<const FedChannelConnection*> conns = detcabling_->getConnections(det_id);
536  for(unsigned int i=0; i< conns.size() ;++i) {
537  if(conns[i]) {
538  comment << std::setw(3) << conns[i]->fedId() << "/" << std::setw(2) << conns[i]->fedCh()<< " ";
539  }
540  else {
541  comment << " ";
542  }
543  }
544  if(conns.size()==0) { comment << " "; }
545  if(conns.size()==1) { comment << " "; }
546  if(conns.size()==2) { comment << " "; }
547  // }
548  if(!dqm_store) return flag;
549  // get PSU channel corresponding to the det_id
550  /*
551  comment << " PSU: ";
552  comment << psumap_.getPSUName(det_id);
553  */
554  //
555 
556  SiStripFolderOrganizer folder_organizer;
557  std::string subdet_folder, badmodule_folder;
558 
559  dqm_store->cd();
560 
561  folder_organizer.setSiStripFolderName(stripTopLevelDir_);
562  folder_organizer.getSubDetFolder(det_id, tTopo, subdet_folder);
563 
564  LogDebug("SearchBadModule") << det_id << " " << subdet_folder << " " << stripTopLevelDir_;
565 
566  if (dqm_store->dirExists(subdet_folder)){
567  badmodule_folder = subdet_folder + "/BadModuleList";
568  LogDebug("SearchBadModule") << subdet_folder << " exists: " << badmodule_folder;
569  } else {
570  // badmodule_folder = dqm_store->pwd() + "/BadModuleList";
571  edm::LogError("SubDetFolderNotFound") << subdet_folder << " does not exist for detid " << det_id;
572  return flag;
573  }
574  if (!dqm_store->dirExists(badmodule_folder)) {
575  LogDebug("BadModuleFolderNotFound") << badmodule_folder << " does not exist for detid " << det_id;
576  return flag;
577  }
578  std::ostringstream badmodule_path;
579  badmodule_path << badmodule_folder << "/" << det_id;
580  LogDebug("SearchBadModule") << badmodule_folder << " exists: " << badmodule_path;
581 
582  MonitorElement* bad_module_me = dqm_store->get(badmodule_path.str());
583  if (bad_module_me && bad_module_me->kind() == MonitorElement::DQM_KIND_INT) {
584  LogDebug("SearchBadModule") << "Monitor Element found";
585  flag = bad_module_me->getIntValue();
587  SiStripUtility::getBadModuleStatus(flag, message);
588  comment << message.c_str();
589  }
590  return flag;
591 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
void setSiStripFolderName(std::string name)
void getSubDetFolder(const uint32_t &detid, const TrackerTopology *tTopo, std::string &folder_name)
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:696
edm::ESHandle< SiStripDetCabling > detcabling_
static void getBadModuleStatus(uint16_t flag, std::string &message)
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:1760
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:784
int64_t getIntValue(void) const
#define comment(par)
Definition: vmac.h:161
void SiStripTrackerMapCreator::paintTkMapFromAlarm ( uint32_t  det_id,
const TrackerTopology tTopo,
DQMStore dqm_store,
bool  isBad = false,
std::map< unsigned int, std::string > *  badmodmap = 0 
)
private

Definition at line 337 of file SiStripTrackerMapCreator.cc.

References comment, TrackerMap::fillc(), archive::flag, getDetectorFlagAndComment(), SiStripUtility::getDetectorStatusColor(), TrackerMap::setText(), and trackerMap_.

Referenced by setTkMapFromAlarm().

338  {
339  std::ostringstream comment;
340  uint16_t flag = 0;
341  flag = getDetectorFlagAndComment(dqm_store, det_id, tTopo, comment);
342 
343  int rval, gval, bval;
344  SiStripUtility::getDetectorStatusColor(flag, rval, gval, bval);
345  if(isBad) { rval=255; gval=255; bval = 0; comment << " PCLBadModule ";}
346  trackerMap_->setText(det_id, comment.str());
347  trackerMap_->fillc(det_id, rval, gval, bval);
348  if(badmodmap && (flag!=0 || isBad)) (*badmodmap)[det_id] = comment.str();
349 }
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 fillc(int idmod, int RGBcode)
Definition: TrackerMap.h:103
unsigned long long int rval
Definition: vlib.h:22
void setText(int idmod, std::string s)
Definition: TrackerMap.cc:2787
#define comment(par)
Definition: vmac.h:161
void SiStripTrackerMapCreator::paintTkMapFromHistogram ( DQMStore dqm_store,
MonitorElement me,
std::string &  map_type,
std::vector< std::pair< float, uint32_t > > *  topNmodVec 
)
private

Definition at line 445 of file SiStripTrackerMapCreator.cc.

References cached_detid, cached_layer, cached_XYbin, MonitorElement::DQM_KIND_TPROFILE2D, TrackerMap::fill_current_val(), TrackerMap::fillc(), MonitorElement::getBinContent(), TkDetMap::getDetsForLayer(), TkDetMap::getLayerNum(), MonitorElement::getName(), MonitorElement::getTProfile2D(), TkDetMap::getXY(), TkLayerMap::XYbin::ix, TkLayerMap::XYbin::iy, MonitorElement::kind(), mergeVDriftHistosByStation::name, nDet, AlCaHLTBitMon_QueryRunRegistry::string, tkDetMap_, tkMapMax_, and trackerMap_.

Referenced by setTkMapFromHistogram().

445  {
446 
447  // edm::ESHandle<SiStripQuality> ssq;
448 
449  // if(useSSQuality_) { eSetup_.get<SiStripQualityRcd>().get(ssqLabel_,ssq); }
450 
451  std::string name = me->getName();
452  std::string lname = name.substr(name.find("TkHMap_")+7);
453  lname = lname.substr(lname.find("_T")+1);
454  std::vector<uint32_t> layer_detids;
455  tkDetMap_->getDetsForLayer(tkDetMap_->getLayerNum(lname), layer_detids);
456  for (std::vector<uint32_t>::const_iterator idet = layer_detids.begin(); idet != layer_detids.end(); idet++) {
457  uint32_t det_id= (*idet);
458  if (det_id <= 0) continue;
459  nDet++;
461  float fval = 0.0;
462  if ( (name.find("NumberOfOfffTrackCluster") != std::string::npos) ||
463  (name.find("NumberOfOnTrackCluster") != std::string::npos) ) {
465  TProfile2D* tp = me->getTProfile2D() ;
466  fval = tp->GetBinEntries(tp->GetBin(xyval.ix, xyval.iy)) * tp->GetBinContent(xyval.ix, xyval.iy);
467  }
468  } else fval = me->getBinContent(xyval.ix, xyval.iy);
469  if (htype == "QTestAlarm") {
470  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
471  /*
472  int rval, gval, bval;
473  std::ostringstream comment;
474  uint32_t flag = 0;
475  flag = getDetectorFlagAndComment(dqm_store, det_id, comment);
476  SiStripUtility::getDetectorStatusColor(flag, rval, gval, bval);
477  if(useSSQuality_ && ssq->IsModuleBad(det_id)) { rval=255; gval=255; bval = 0;}
478  trackerMap_->fillc(det_id, rval, gval, bval);
479  trackerMap_->setText(det_id, comment.str());
480  */
481  } else {
482  if (fval == 0.0) trackerMap_->fillc(det_id,255, 255, 255);
483  else {
484  trackerMap_->fill_current_val(det_id, fval);
485  }
486  tkMapMax_ += fval;
487  if(topNmodVec){
488  //std::ostringstream ss; ss << fval;
489  auto detPair = std::make_pair(fval,det_id);
490  topNmodVec->push_back(detPair);
491  }
492  }
493  }
494 }
int getLayerNum(const std::string &in) const
Definition: TkDetMap.cc:777
const std::string & getName(void) const
get name of ME
TProfile2D * getTProfile2D(void) const
Kind kind(void) const
Get the type of the monitor element.
void getDetsForLayer(int layer, std::vector< uint32_t > &output) const
Definition: TkDetMap.cc:695
void fillc(int idmod, int RGBcode)
Definition: TrackerMap.h:103
double getBinContent(int binx) const
get content of bin (1-D)
void fill_current_val(int idmod, float current_val)
Definition: TrackerMap.cc:2749
const TkLayerMap::XYbin & getXY(uint32_t &, uint32_t &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:652
void SiStripTrackerMapCreator::printBadModuleList ( std::map< unsigned int, std::string > *  badmodmap,
const edm::EventSetup eSetup 
)
private

Definition at line 249 of file SiStripTrackerMapCreator.cc.

References edm::EventSetup::get(), edm::ESHandle< class >::product(), SiStripDetId::subDetector(), SiStripDetId::TEC, TrackerTopology::tecSide(), SiStripDetId::TIB, SiStripDetId::TID, TrackerTopology::tidSide(), and SiStripDetId::TOB.

Referenced by setTkMapFromAlarm().

249  {
250 
251  //Retrieve tracker topology from geometry
252  edm::ESHandle<TrackerTopology> tTopoHandle;
253  eSetup.get<IdealGeometryRecord>().get(tTopoHandle);
254  const TrackerTopology* const tTopo = tTopoHandle.product();
255 
256  bool tibDone=false,tidSide1Done=false,tidSide2Done=false,tobDone=false,tecSide1Done=false,tecSide2Done=false;
257  unsigned int tibFirst=369120277-1,
258  tidSide1First=402664197-1,tidSide2First=402672389-1,
259  tobFirst=436228134-1,
260  tecSide1First=470044965-1,tecSide2First=470307109-1;
261 
262  int ntib=0,ntids1=0,ntids2=0,ntob=0,ntecs1=0,ntecs2=0;
263 
264  for(std::map<unsigned int,std::string>::const_iterator badmod = badmodmap->begin(); badmod!= badmodmap->end(); ++badmod) {
265  SiStripDetId ssdetid(badmod->first);
266  if(ssdetid.subDetector()==SiStripDetId::TIB) ntib++;
267  if(ssdetid.subDetector()==SiStripDetId::TID) {
268 
269  if(tTopo->tidSide(ssdetid)==1) ntids1++;
270  if(tTopo->tidSide(ssdetid)==2) ntids2++;
271  }
272  if(ssdetid.subDetector()==SiStripDetId::TOB) ntob++;
273  if(ssdetid.subDetector()==SiStripDetId::TEC) {
274 
275  if(tTopo->tecSide(ssdetid)==1) ntecs1++;
276  if(tTopo->tecSide(ssdetid)==2) ntecs2++;
277  }
278  }
279 
280  edm::LogVerbatim("BadModuleList") << "Number of bad modules in total:";
281  edm::LogVerbatim("BadModuleList") << "--------------------------------------------------------------";
282  edm::LogVerbatim("BadModuleList") << "TIB: " << ntib;
283  edm::LogVerbatim("BadModuleList") << "TID/MINUS: " << ntids1;
284  edm::LogVerbatim("BadModuleList") << "TID/PLUS: " << ntids2;
285  edm::LogVerbatim("BadModuleList") << "TOB: " << ntob;
286  edm::LogVerbatim("BadModuleList") << "TEC/MINUS: " << ntecs1;
287  edm::LogVerbatim("BadModuleList") << "TEC/PLUS: " << ntecs2;
288  edm::LogVerbatim("BadModuleList") << "-------------------------------";
289  edm::LogVerbatim("BadModuleList") ;
290  edm::LogVerbatim("BadModuleList") << "List of bad modules per partition:";
291  edm::LogVerbatim("BadModuleList") << "----------------------------------";
292 
293  for(std::map<unsigned int,std::string>::const_iterator badmod = badmodmap->begin(); badmod!= badmodmap->end(); ++badmod) {
294  if(!tibDone && badmod->first >= tibFirst) {
295  tibDone = true;
296  edm::LogVerbatim("BadModuleList") ;
297  edm::LogVerbatim("BadModuleList") << "SubDetector TIB";
298  edm::LogVerbatim("BadModuleList") ;
299  }
300  if(!tidSide1Done && badmod->first >= tidSide1First) {
301  tidSide1Done = true;
302  edm::LogVerbatim("BadModuleList") ;
303  edm::LogVerbatim("BadModuleList") << "SubDetector TID/MINUS";
304  edm::LogVerbatim("BadModuleList") ;
305  }
306  if(!tidSide2Done && badmod->first >= tidSide2First) {
307  tidSide2Done = true;
308  edm::LogVerbatim("BadModuleList") ;
309  edm::LogVerbatim("BadModuleList") << "SubDetector TID/PLUS";
310  edm::LogVerbatim("BadModuleList") ;
311  }
312  if(!tobDone && badmod->first >= tobFirst) {
313  tobDone = true;
314  edm::LogVerbatim("BadModuleList") ;
315  edm::LogVerbatim("BadModuleList") << "SubDetector TOB";
316  edm::LogVerbatim("BadModuleList") ;
317  }
318  if(!tecSide1Done && badmod->first >= tecSide1First) {
319  tecSide1Done = true;
320  edm::LogVerbatim("BadModuleList") ;
321  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/MINUS";
322  edm::LogVerbatim("BadModuleList") ;
323  }
324  if(!tecSide2Done && badmod->first >= tecSide2First) {
325  tecSide2Done = true;
326  edm::LogVerbatim("BadModuleList") ;
327  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/PLUS";
328  edm::LogVerbatim("BadModuleList") ;
329  }
330  edm::LogVerbatim("BadModuleList") << badmod->second;
331  }
332 }
unsigned int tidSide(const DetId &id) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
unsigned int tecSide(const DetId &id) const
void SiStripTrackerMapCreator::printTopModules ( std::vector< std::pair< float, uint32_t > > *  topNmodVec,
const edm::EventSetup eSetup 
)
private

Definition at line 409 of file SiStripTrackerMapCreator.cc.

References comment, archive::flag, edm::EventSetup::get(), getDetectorFlagAndComment(), numTopModules, edm::ESHandle< class >::product(), python.multivaluedict::sort(), AlCaHLTBitMon_QueryRunRegistry::string, SiStripDetId::subDetector(), SiStripDetId::TEC, TrackerTopology::tecSide(), SiStripDetId::TIB, SiStripDetId::TID, TrackerTopology::tidSide(), SiStripDetId::TOB, and topModLabel.

Referenced by setTkMapFromHistogram().

409  {
410  //, const edm::EventSetup& eSetup
411 
413  edm::ESHandle<TrackerTopology> tTopoHandle;
414  eSetup.get<IdealGeometryRecord>().get(tTopoHandle);
415  const TrackerTopology* const tTopo = tTopoHandle.product();
416 
417  std::sort(topNmodVec->rbegin(), topNmodVec->rend());
418  topNmodVec->resize(numTopModules);
419 
420  edm::LogVerbatim("TopModules") << topModLabel;
421  edm::LogVerbatim("TopModules") << "------------------------------------------------------";
422 
423  for (std::vector<std::pair<float, uint32_t> >::const_iterator itNmod = topNmodVec->begin(); itNmod != topNmodVec->end(); itNmod++){
424  std::pair<float, uint32_t> aPair=(*itNmod);
425  uint32_t det_id = aPair.second;
426  std::ostringstream comment;
427  std::string subdetector;
428  SiStripDetId ssdetid(aPair.second);
429  if(ssdetid.subDetector()==SiStripDetId::TIB) subdetector = "TIB ";
430  if(ssdetid.subDetector()==SiStripDetId::TID){
431  if(tTopo->tidSide(ssdetid)==1) subdetector = "TID/MINUS ";
432  if(tTopo->tidSide(ssdetid)==2) subdetector = "TID/PLUS ";
433  }
434  if(ssdetid.subDetector()==SiStripDetId::TOB) subdetector = "TOB ";
435  if(ssdetid.subDetector()==SiStripDetId::TEC){
436  if(tTopo->tecSide(ssdetid)==1) subdetector = "TEC/MINUS ";
437  if(tTopo->tecSide(ssdetid)==2) subdetector = "TEC/PLUS ";
438  }
439  uint16_t flag = getDetectorFlagAndComment(0, det_id, tTopo, comment);
440  if (flag == 0) edm::LogVerbatim("TopModules") << subdetector << comment.str() << " value: "<< aPair.first;
441  }
442  edm::LogVerbatim("TopModules") << "------------------------------------------------------";
443 }
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, const TrackerTopology *tTopo, std::ostringstream &comment)
unsigned int tidSide(const DetId &id) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
unsigned int tecSide(const DetId &id) const
#define comment(par)
Definition: vmac.h:161
bool SiStripTrackerMapCreator::readConfiguration ( )
void SiStripTrackerMapCreator::setTkMapFromAlarm ( DQMStore dqm_store,
const edm::EventSetup eSetup 
)
private

Definition at line 209 of file SiStripTrackerMapCreator.cc.

References detcabling_, eSetup_, TrackerMap::fillc_all_blank(), edm::EventSetup::get(), python.multivaluedict::map(), python.rootplot.argparse::module, nDet, paintTkMapFromAlarm(), printBadModuleList(), edm::ESHandle< class >::product(), ssqLabel_, tkMapMax_, tkMapMin_, trackerMap_, and useSSQuality_.

Referenced by create(), and createForOffline().

209  {
210 
211  //Retrieve tracker topology from geometry
212  edm::ESHandle<TrackerTopology> tTopoHandle;
213  eSetup.get<IdealGeometryRecord>().get(tTopoHandle);
214  const TrackerTopology* const tTopo = tTopoHandle.product();
215 
216  nDet = 0;
217  tkMapMax_ = 0.0;
218  tkMapMin_ = 0.0;
219 
221 
223 
225 
226  std::map<unsigned int,std::string>* badmodmap = new std::map<unsigned int,std::string>;
227 
228  // used to avoid multiple checks on the same detid since the loop is done on the FED channels
229  uint32_t detId_save = 0;
230  // example of loop using SiStripDetCabling
231  for(std::map< uint32_t, std::vector<const FedChannelConnection *> >::const_iterator module = detcabling_->getDetCabling().begin();
232  module!=detcabling_->getDetCabling().end();++module) {
233  uint32_t detId = module->first;
234  if (detId == 0 || detId == 0xFFFFFFFF) continue;
235  if (detId_save != detId) {
236  detId_save = detId;
237  bool isBad = useSSQuality_ && ssq->IsModuleBad(detId);
238  paintTkMapFromAlarm(detId, tTopo, dqm_store,isBad,badmodmap);
239  }
240  else {
241  edm::LogWarning("TwiceTheSameDetId") << "The detid " << detId << " was found already in the loop on SiStripDetCabling";
242  }
243  }
244  //
245  printBadModuleList(badmodmap, eSetup);
246  delete badmodmap;
247 }
void fillc_all_blank()
Definition: TrackerMap.cc:2731
edm::ESHandle< SiStripDetCabling > detcabling_
void printBadModuleList(std::map< unsigned int, std::string > *badmodmap, const edm::EventSetup &eSetup)
void paintTkMapFromAlarm(uint32_t det_id, const TrackerTopology *tTopo, DQMStore *dqm_store, bool isBad=false, std::map< unsigned int, std::string > *badmodmap=0)
const edm::EventSetup & eSetup_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
Definition: vlib.h:208
void SiStripTrackerMapCreator::setTkMapFromHistogram ( DQMStore dqm_store,
std::string &  htype,
const edm::EventSetup eSetup 
)
private

Definition at line 353 of file SiStripTrackerMapCreator.cc.

References DQMStore::cd(), DQMStore::dirExists(), RefreshWebPage::dname, DQMStore::getContents(), DQMStore::getSubdirs(), SiStripUtility::goToDir(), mergeVDriftHistosByStation::name, nDet, paintTkMapFromHistogram(), printTopModules(), DQMStore::pwd(), AlCaHLTBitMon_QueryRunRegistry::string, tkMapMax_, tkMapMin_, and topModules.

Referenced by create(), and createForOffline().

353  {
354  dqm_store->cd();
355 
356  std::string mdir = "MechanicalView";
357  if (!SiStripUtility::goToDir(dqm_store, mdir)) return;
358  std::string mechanicalview_dir = dqm_store->pwd();
359 
360  std::vector<std::string> subdet_folder;
361  subdet_folder.push_back("TIB");
362  subdet_folder.push_back("TOB");
363  subdet_folder.push_back("TEC/MINUS");
364  subdet_folder.push_back("TEC/PLUS");
365  subdet_folder.push_back("TID/MINUS");
366  subdet_folder.push_back("TID/PLUS");
367 
368  nDet = 0;
369  tkMapMax_ = 0.0;
370  tkMapMin_ = 0.0;
371  std::vector<std::pair<float,uint32_t> >* topNmodVec = new std::vector<std::pair<float,uint32_t> >;
372 
373  for (std::vector<std::string>::const_iterator it = subdet_folder.begin(); it != subdet_folder.end(); it++) {
374  std::string dname = mechanicalview_dir + "/" + (*it);
375  if (!dqm_store->dirExists(dname)) continue;
376  dqm_store->cd(dname);
377  std::vector<std::string> layerVec = dqm_store->getSubdirs();
378  for (std::vector<std::string>::const_iterator iLayer = layerVec.begin(); iLayer != layerVec.end(); iLayer++) {
379  if ((*iLayer).find("BadModuleList") !=std::string::npos) continue;
380  std::vector<MonitorElement*> meVec = dqm_store->getContents((*iLayer));
381  MonitorElement* tkhmap_me = 0;
383  for (std::vector<MonitorElement*>::const_iterator itkh = meVec.begin(); itkh != meVec.end(); itkh++) {
384  name = (*itkh)->getName();
385  if (name.find("TkHMap") == std::string::npos) continue;
386  if (htype == "QTestAlarm" ){
387  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
388  tkhmap_me = (*itkh);
389  break;
390  } else if (name.find(htype) != std::string::npos) {
391  tkhmap_me = (*itkh);
392  break;
393  }
394  }
395  if (tkhmap_me != 0) {
396  if (topModules){
397  paintTkMapFromHistogram(dqm_store,tkhmap_me, htype, topNmodVec);
398  }
399  else paintTkMapFromHistogram(dqm_store,tkhmap_me, htype, 0);
400  }
401  }
402  dqm_store->cd(mechanicalview_dir);
403  }
404  dqm_store->cd();
405  if (topModules) printTopModules(topNmodVec, eSetup);
406  delete topNmodVec;
407 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1711
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:696
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1789
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:784
void paintTkMapFromHistogram(DQMStore *dqm_store, MonitorElement *me, std::string &map_type, std::vector< std::pair< float, uint32_t > > *topNmodVec)
void printTopModules(std::vector< std::pair< float, uint32_t > > *topNmodVec, const edm::EventSetup &eSetup)
static bool goToDir(DQMStore *dqm_store, std::string name)
const std::string & pwd(void) const
Definition: DQMStore.cc:691
void SiStripTrackerMapCreator::setTkMapRange ( std::string &  map_type)
private

Definition at line 498 of file SiStripTrackerMapCreator.cc.

References meanToMaxFactor_, nDet, TrackerMap::setRange(), tkMapMax_, tkMapMin_, and trackerMap_.

Referenced by create().

498  {
499  tkMapMin_ = 0.0;
500  if (tkMapMax_ == 0.0) {
501  if (map_type.find("FractionOfBadChannels") != std::string::npos) tkMapMax_ = 1.0;
502  else if (map_type.find("NumberOfCluster") != std::string::npos) tkMapMax_ = 0.01;
503  else if (map_type.find("NumberOfDigi") != std::string::npos) tkMapMax_ = 0.6;
504  else if (map_type.find("NumberOfOffTrackCluster") != std::string::npos) tkMapMax_ = 100.0;
505  else if (map_type.find("NumberOfOnTrackCluster") != std::string::npos) tkMapMax_ = 50.0;
506  else if (map_type.find("StoNCorrOnTrack") != std::string::npos) tkMapMax_ = 200.0;
507  } else {
508  tkMapMax_ = tkMapMax_/nDet*1.0;
510  }
512 }
void setRange(float min, float max)
Definition: TrackerMap.cc:670
void SiStripTrackerMapCreator::setTkMapRangeOffline ( )
private

Definition at line 513 of file SiStripTrackerMapCreator.cc.

References meanToMaxFactor_, nDet, tkMapMax_, and tkMapMin_.

Referenced by createForOffline().

513  {
514  tkMapMin_ = 0.0;
515  if (tkMapMax_ != 0.0) {
516  tkMapMax_ = tkMapMax_/(nDet*1.0);
518  }
519  // the following line seems to be useless and misleading: in the offline map creation the range is set with the save... methods
520  // trackerMap_->setRange(tkMapMin_, tkMapMax_);
521 }

Member Data Documentation

uint32_t SiStripTrackerMapCreator::cached_detid
private

Definition at line 65 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram(), and SiStripTrackerMapCreator().

int16_t SiStripTrackerMapCreator::cached_layer
private

Definition at line 66 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram(), and SiStripTrackerMapCreator().

TkLayerMap::XYbin SiStripTrackerMapCreator::cached_XYbin
private

Definition at line 67 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram().

edm::ESHandle< SiStripDetCabling > SiStripTrackerMapCreator::detcabling_
private
const edm::EventSetup& SiStripTrackerMapCreator::eSetup_
private

Definition at line 62 of file SiStripTrackerMapCreator.h.

Referenced by setTkMapFromAlarm(), and SiStripTrackerMapCreator().

float SiStripTrackerMapCreator::meanToMaxFactor_
private
int SiStripTrackerMapCreator::nDet
private
int32_t SiStripTrackerMapCreator::numTopModules
private

Definition at line 69 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printTopModules().

std::string SiStripTrackerMapCreator::ssqLabel_
private

Definition at line 59 of file SiStripTrackerMapCreator.h.

Referenced by create(), createForOffline(), and setTkMapFromAlarm().

std::string SiStripTrackerMapCreator::stripTopLevelDir_
private
TkDetMap* SiStripTrackerMapCreator::tkDetMap_
private

Definition at line 61 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram(), and SiStripTrackerMapCreator().

float SiStripTrackerMapCreator::tkMapMax_
private
float SiStripTrackerMapCreator::tkMapMin_
private
std::string SiStripTrackerMapCreator::tkMapName_
private

Definition at line 52 of file SiStripTrackerMapCreator.h.

std::string SiStripTrackerMapCreator::topModLabel
private

Definition at line 70 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printTopModules().

bool SiStripTrackerMapCreator::topModules
private

Definition at line 68 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and setTkMapFromHistogram().

TrackerMap* SiStripTrackerMapCreator::trackerMap_
private
bool SiStripTrackerMapCreator::useSSQuality_
private

Definition at line 58 of file SiStripTrackerMapCreator.h.

Referenced by create(), createForOffline(), and setTkMapFromAlarm().