44 "\n------------------------------------------"
45 "\nUnAvailable Service TkHistoMap: please insert in the configuration file an instance like"
46 "\n\tprocess.TkDetMap = cms.Service(\"TkDetMap\")"
47 "\n------------------------------------------";
61 DQMStore* dqm_store, std::string& map_type) {
65 if(!fedcabling)
return;
69 std::string tmap_title =
" Tracker Map from " + map_type;
80 if (map_type ==
"QTestAlarm") {
113 DQMStore* dqm_store, std::string& map_type){
117 std::string mdir =
"MechanicalView";
120 edm::LogError(
"SiStripTopLevelDirNotFound") <<
"I cannot find the SiStrip top level directory in the DQM file";
123 std::string mechanicalview_dir = dqm_store->
pwd();
124 stripTopLevelDir_=mechanicalview_dir.substr(0,mechanicalview_dir.find_last_of(
"/"));
132 if(!fedcabling)
return;
144 std::string tmap_title =
" Tracker Map from " + map_type;
147 if (map_type ==
"QTestAlarm") {
168 edm::LogInfo(
"PSUMapToBeSaved") <<
"Ready to save PSU TkMap " << map_type << namesuffix <<
" with range set to " <<
tkMapMin_ <<
" - " <<
tkMapMax_;
176 edm::LogInfo(
"FEDMapToBeSaved") <<
"Ready to save FED TkMap " << map_type << namesuffix <<
" with range set to " <<
tkMapMin_ <<
" - " <<
tkMapMax_;
199 std::map<unsigned int,std::string>* badmodmap =
new std::map<unsigned int,std::string>;
202 uint32_t detId_save = 0;
204 for(
std::map< uint32_t, std::vector<const FedChannelConnection *> >::const_iterator
module =
detcabling_->getDetCabling().begin();
206 uint32_t detId =
module->first;
207 if (detId == 0 || detId == 0xFFFFFFFF)
continue;
208 if (detId_save != detId) {
214 edm::LogWarning(
"TwiceTheSameDetId") <<
"The detid " << detId <<
" was found already in the loop on SiStripDetCabling";
224 bool tibDone=
false,tidSide1Done=
false,tidSide2Done=
false,tobDone=
false,tecSide1Done=
false,tecSide2Done=
false;
225 unsigned int tibFirst=369120277-1,
226 tidSide1First=402664197-1,tidSide2First=402672389-1,
227 tobFirst=436228134-1,
228 tecSide1First=470044965-1,tecSide2First=470307109-1;
230 int ntib=0,ntids1=0,ntids2=0,ntob=0,ntecs1=0,ntecs2=0;
232 for(std::map<unsigned int,std::string>::const_iterator badmod = badmodmap->begin(); badmod!= badmodmap->end(); ++badmod) {
237 if(tiddetid.
side()==1) ntids1++;
238 if(tiddetid.
side()==2) ntids2++;
243 if(tecdetid.
side()==1) ntecs1++;
244 if(tecdetid.
side()==2) ntecs2++;
249 edm::LogVerbatim(
"BadModuleList") <<
"--------------------------------------------------------------";
261 for(std::map<unsigned int,std::string>::const_iterator badmod = badmodmap->begin(); badmod!= badmodmap->end(); ++badmod) {
262 if(!tibDone && badmod->first >= tibFirst) {
268 if(!tidSide1Done && badmod->first >= tidSide1First) {
274 if(!tidSide2Done && badmod->first >= tidSide2First) {
280 if(!tobDone && badmod->first >= tobFirst) {
286 if(!tecSide1Done && badmod->first >= tecSide1First) {
292 if(!tecSide2Done && badmod->first >= tecSide2First) {
311 int rval, gval, bval;
313 if(isBad) { rval=255; gval=255; bval = 0; comment <<
" PCLBadModule ";}
316 if(badmodmap && (flag!=0 || isBad)) (*badmodmap)[det_id] = comment.str();
324 std::string mdir =
"MechanicalView";
326 std::string mechanicalview_dir = dqm_store->
pwd();
328 std::vector<std::string> subdet_folder;
329 subdet_folder.push_back(
"TIB");
330 subdet_folder.push_back(
"TOB");
331 subdet_folder.push_back(
"TEC/side_1");
332 subdet_folder.push_back(
"TEC/side_2");
333 subdet_folder.push_back(
"TID/side_1");
334 subdet_folder.push_back(
"TID/side_2");
340 for (std::vector<std::string>::const_iterator it = subdet_folder.begin(); it != subdet_folder.end(); it++) {
341 std::string
dname = mechanicalview_dir +
"/" + (*it);
342 if (!dqm_store->
dirExists(dname))
continue;
343 dqm_store->
cd(dname);
344 std::vector<std::string> layerVec = dqm_store->
getSubdirs();
345 for (std::vector<std::string>::const_iterator iLayer = layerVec.begin(); iLayer != layerVec.end(); iLayer++) {
346 if ((*iLayer).find(
"BadModuleList") !=std::string::npos)
continue;
347 std::vector<MonitorElement*> meVec = dqm_store->
getContents((*iLayer));
350 for (std::vector<MonitorElement*>::const_iterator itkh = meVec.begin(); itkh != meVec.end(); itkh++) {
351 name = (*itkh)->getName();
352 if (name.find(
"TkHMap") == std::string::npos)
continue;
353 if (htype ==
"QTestAlarm" ){
354 edm::LogError(
"ItShouldNotBeHere") <<
"QTestAlarm map: you should not be here!";
357 }
else if (name.find(htype) != std::string::npos) {
362 if (tkhmap_me != 0) {
366 dqm_store->
cd(mechanicalview_dir);
377 std::string lname = name.substr(name.find(
"TkHMap_")+7);
378 lname = lname.substr(lname.find(
"_T")+1);
379 std::vector<uint32_t> layer_detids;
381 for (std::vector<uint32_t>::const_iterator idet = layer_detids.begin(); idet != layer_detids.end(); idet++) {
382 uint32_t det_id= (*idet);
383 if (det_id <= 0)
continue;
387 if ( (name.find(
"NumberOfOfffTrackCluster") != std::string::npos) ||
388 (name.find(
"NumberOfOnTrackCluster") != std::string::npos) ) {
391 fval = tp->GetBinEntries(tp->GetBin(xyval.
ix, xyval.
iy)) * tp->GetBinContent(xyval.
ix, xyval.
iy);
394 if (htype ==
"QTestAlarm") {
395 edm::LogError(
"ItShouldNotBeHere") <<
"QTestAlarm map: you should not be here!";
421 if (map_type.find(
"FractionOfBadChannels") != std::string::npos)
tkMapMax_ = 1.0;
422 else if (map_type.find(
"NumberOfCluster") != std::string::npos)
tkMapMax_ = 0.01;
423 else if (map_type.find(
"NumberOfDigi") != std::string::npos)
tkMapMax_ = 0.6;
424 else if (map_type.find(
"NumberOfOffTrackCluster") != std::string::npos)
tkMapMax_ = 100.0;
425 else if (map_type.find(
"NumberOfOnTrackCluster") != std::string::npos)
tkMapMax_ = 50.0;
426 else if (map_type.find(
"StoNCorrOnTrack") != std::string::npos)
tkMapMax_ = 200.0;
447 comment <<
"Module " << det_id;
453 comment <<
" FEDCHs ";
454 std::vector<const FedChannelConnection*> conns =
detcabling_->getConnections(det_id);
455 for(
unsigned int i=0;
i< conns.size() ;++
i) {
457 comment << std::setw(3) << conns[
i]->fedId() <<
"/" << std::setw(2) << conns[
i]->fedCh()<<
" ";
463 if(conns.size()==0) { comment <<
" "; }
464 if(conns.size()==1) { comment <<
" "; }
465 if(conns.size()==2) { comment <<
" "; }
469 std::string subdet_folder, badmodule_folder;
478 if (dqm_store->
dirExists(subdet_folder)){
479 badmodule_folder = subdet_folder +
"/BadModuleList";
480 LogDebug(
"SearchBadModule") << subdet_folder <<
" exists: " << badmodule_folder;
483 edm::LogError(
"SubDetFolderNotFound") << subdet_folder <<
" does not exist for detid " << det_id;
486 if (!dqm_store->
dirExists(badmodule_folder)) {
487 LogDebug(
"BadModuleFolderNotFound") << badmodule_folder <<
" does not exist for detid " << det_id;
490 std::ostringstream badmodule_path;
491 badmodule_path << badmodule_folder <<
"/" << det_id;
492 LogDebug(
"SearchBadModule") << badmodule_folder <<
" exists: " << badmodule_path;
496 LogDebug(
"SearchBadModule") <<
"Monitor Element found";
500 comment << message.c_str();
void create(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &htype)
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
void setSiStripFolderName(std::string name)
void save_as_psutrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="psu_svgmap.svg", int width=1500, int height=800)
void getSubDetFolder(const uint32_t &detid, std::string &folder_name)
std::vector< std::string > getSubdirs(void) const
void setTkMapFromHistogram(DQMStore *dqm_store, std::string &htype)
TProfile2D * getTProfile2D(void) const
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)
void paintTkMapFromHistogram(DQMStore *dqm_store, MonitorElement *me, std::string &map_type)
~SiStripTrackerMapCreator()
static void getBadModuleStatus(uint16_t flag, std::string &message)
void setTkMapFromAlarm(DQMStore *dqm_store)
void setTitle(std::string s)
unsigned int side() const
positive or negative id
int getLayerNum(std::string &in)
void getDetsForLayer(int layer, std::vector< uint32_t > &output)
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")
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
int64_t getIntValue(void) const
unsigned int side() const
positive or negative id
void printBadModuleList(std::map< unsigned int, std::string > *badmodmap)
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
void setRange(float min, float max)
void paintTkMapFromAlarm(uint32_t det_id, DQMStore *dqm_store, bool isBad=false, std::map< unsigned int, std::string > *badmodmap=0)
void createForOffline(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &htype)
double getBinContent(int binx) const
get content of bin (1-D)
SiStripTrackerMapCreator(const edm::EventSetup &eSetup)
const TkLayerMap::XYbin & getXY(uint32_t &)
void save_as_fedtrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="fed_svgmap.svg", int width=1500, int height=800)
void fill_current_val(int idmod, float current_val)
void setText(int idmod, std::string s)
static bool goToDir(DQMStore *dqm_store, std::string name)
void setTkMapRange(std::string &map_type)
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, std::ostringstream &comment)
const std::string & pwd(void) const