49 "\n------------------------------------------"
50 "\nUnAvailable Service TkHistoMap: please insert in the configuration file an instance like"
51 "\n\tprocess.TkDetMap = cms.Service(\"TkDetMap\")"
52 "\n------------------------------------------";
71 if(!fedcabling)
return;
79 std::string tmap_title =
" Tracker Map from " + map_type;
90 if (map_type ==
"QTestAlarm") {
131 edm::LogError(
"SiStripTopLevelDirNotFound") <<
"I cannot find the SiStrip top level directory in the DQM file";
135 stripTopLevelDir_=mechanicalview_dir.substr(0,mechanicalview_dir.find_last_of(
"/"));
143 if(!fedcabling)
return;
161 std::stringstream
ss;
166 if (runNumber_>0) { tmap_title =
" Run: " + sRunNumber +
", Tracker Map from " + map_type; }
167 else { tmap_title =
" Tracker Map from " + map_type; }
170 if(tkmapPset.
exists(
"TopModules"))
175 if(tkmapPset.
exists(
"numberTopModules"))
180 if (tkmapPset.
exists(
"topModLabel"))
185 if (map_type ==
"QTestAlarm") {
206 edm::LogInfo(
"PSUMapToBeSaved") <<
"Ready to save PSU TkMap " << map_type << namesuffix <<
" with range set to " <<
tkMapMin_ <<
" - " <<
tkMapMax_;
214 edm::LogInfo(
"FEDMapToBeSaved") <<
"Ready to save FED TkMap " << map_type << namesuffix <<
" with range set to " <<
tkMapMin_ <<
" - " <<
tkMapMax_;
242 std::map<unsigned int,std::string>* badmodmap =
new std::map<unsigned int,std::string>;
245 uint32_t detId_save = 0;
247 for(std::map< uint32_t, std::vector<const FedChannelConnection *> >::const_iterator
module =
detcabling_->getDetCabling().begin();
249 uint32_t detId =
module->first;
250 if (detId == 0 || detId == 0xFFFFFFFF)
continue;
251 if (detId_save != detId) {
257 edm::LogWarning(
"TwiceTheSameDetId") <<
"The detid " << detId <<
" was found already in the loop on SiStripDetCabling";
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;
278 int ntib=0,ntids1=0,ntids2=0,ntob=0,ntecs1=0,ntecs2=0;
280 for(std::map<unsigned int,std::string>::const_iterator badmod = badmodmap->begin(); badmod!= badmodmap->end(); ++badmod) {
285 if(tTopo->
tidSide(ssdetid)==1) ntids1++;
286 if(tTopo->
tidSide(ssdetid)==2) ntids2++;
291 if(tTopo->
tecSide(ssdetid)==1) ntecs1++;
292 if(tTopo->
tecSide(ssdetid)==2) ntecs2++;
298 edm::LogVerbatim(
"BadModuleList") <<
"--------------------------------------------------------------";
310 for(std::map<unsigned int,std::string>::const_iterator badmod = badmodmap->begin(); badmod!= badmodmap->end(); ++badmod) {
311 if(!tibDone && badmod->first >= tibFirst) {
317 if(!tidSide1Done && badmod->first >= tidSide1First) {
323 if(!tidSide2Done && badmod->first >= tidSide2First) {
329 if(!tobDone && badmod->first >= tobFirst) {
335 if(!tecSide1Done && badmod->first >= tecSide1First) {
341 if(!tecSide2Done && badmod->first >= tecSide2First) {
355 DQMStore* dqm_store,
bool isBad, std::map<unsigned int,std::string>* badmodmap) {
360 int rval, gval, bval;
362 if(isBad) { rval=255; gval=255; bval = 0; comment <<
" PCLBadModule ";}
365 if(badmodmap && (flag!=0 || isBad)) (*badmodmap)[det_id] = comment.str();
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");
388 std::vector<std::pair<float,uint32_t> >* topNmodVec =
new std::vector<std::pair<float,uint32_t> >;
390 for (std::vector<std::string>::const_iterator it = subdet_folder.begin(); it != subdet_folder.end(); 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));
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!";
407 }
else if (name.find(htype) != std::string::npos) {
412 if (tkhmap_me != 0) {
419 dqm_store->
cd(mechanicalview_dir);
436 if (topNmodVec->empty())
return;
438 std::sort(topNmodVec->rbegin(), topNmodVec->rend());
442 edm::LogVerbatim(
"TopModules") <<
"------------------------------------------------------";
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;
452 if(tTopo->
tidSide(ssdetid)==1) subdetector =
"TID/MINUS ";
453 if(tTopo->
tidSide(ssdetid)==2) subdetector =
"TID/PLUS ";
457 if(tTopo->
tecSide(ssdetid)==1) subdetector =
"TEC/MINUS ";
458 if(tTopo->
tecSide(ssdetid)==2) subdetector =
"TEC/PLUS ";
461 if (flag == 0)
edm::LogVerbatim(
"TopModules") << subdetector << comment.str() <<
" value: "<< aPair.first;
463 edm::LogVerbatim(
"TopModules") <<
"------------------------------------------------------";
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;
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;
484 if ( (name.find(
"NumberOfOff") != std::string::npos) ||
485 (name.find(
"NumberOfOnTrackCluster") != std::string::npos) ) {
488 fval = tp->GetBinEntries(tp->GetBin(xyval.
ix, xyval.
iy)) * tp->GetBinContent(xyval.
ix, xyval.
iy);
491 if (htype ==
"QTestAlarm") {
492 edm::LogError(
"ItShouldNotBeHere") <<
"QTestAlarm map: you should not be here!";
508 auto detPair = std::make_pair(fval,det_id);
509 topNmodVec->push_back(detPair);
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;
549 comment <<
"Module " << det_id;
555 comment <<
" FEDCHs ";
556 std::vector<const FedChannelConnection*> conns =
detcabling_->getConnections(det_id);
557 for(
unsigned int i=0;
i< conns.size() ;++
i) {
559 comment << std::setw(3) << conns[
i]->fedId() <<
"/" << std::setw(2) << conns[
i]->fedCh()<<
" ";
565 if(conns.size()==0) { comment <<
" "; }
566 if(conns.size()==1) { comment <<
" "; }
567 if(conns.size()==2) { comment <<
" "; }
569 if(!dqm_store)
return flag;
587 if (dqm_store->
dirExists(subdet_folder)){
588 badmodule_folder = subdet_folder +
"/BadModuleList";
589 LogDebug(
"SearchBadModule") << subdet_folder <<
" exists: " << badmodule_folder;
592 edm::LogError(
"SubDetFolderNotFound") << subdet_folder <<
" does not exist for detid " << det_id;
595 if (!dqm_store->
dirExists(badmodule_folder)) {
596 LogDebug(
"BadModuleFolderNotFound") << badmodule_folder <<
" does not exist for detid " << det_id;
599 std::ostringstream badmodule_path;
600 badmodule_path << badmodule_folder <<
"/" << det_id;
601 LogDebug(
"SearchBadModule") << badmodule_folder <<
" exists: " << badmodule_path;
605 LogDebug(
"SearchBadModule") <<
"Monitor Element found";
609 comment << message.c_str();
int getLayerNum(const std::string &in) const
static const char runNumber_[]
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
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
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)
void cd(void)
go to top directory (ie. root)
edm::ESHandle< SiStripDetCabling > detcabling_
bool exists(std::string const ¶meterName) 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)
~SiStripTrackerMapCreator()
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)
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)
void setTkMapRangeOffline()
std::string stripTopLevelDir_
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. "my/long/dir/my_histo")
void getDetsForLayer(int layer, std::vector< uint32_t > &output) const
void setTkMapFromHistogram(DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
std::vector< MonitorElement * > getContents(const std::string &path) const
void fillc(int idmod, int RGBcode)
bool dirExists(const std::string &path) const
true if directory exists
Detector identifier class for the strip tracker.
unsigned long long int rval
SubDetector subDetector() const
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)
void paintTkMapFromHistogram(DQMStore *dqm_store, MonitorElement *me, std::string &map_type, std::vector< std::pair< float, uint32_t > > *topNmodVec)
int64_t getIntValue(void) const
T const * product() const
TkLayerMap::XYbin cached_XYbin
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)
double getBinContent(int binx) const
get content of bin (1-D)
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)
void setText(int idmod, std::string s)
const TkLayerMap::XYbin & getXY(uint32_t &, uint32_t &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
static bool goToDir(DQMStore *dqm_store, std::string name)
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