CMS 3D CMS Logo

SiStripPopConBadComponentsDQM.cc
Go to the documentation of this file.
3 
11 public:
14 
17  // interface methods: implemented in template
18  void initES(const edm::EventSetup&) override;
19  void dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGetter& getter) override;
20  SiStripBadStrip* getObj() const override;
21 
22 protected:
23  std::string getMetaDataString() const override;
24 
25 private:
29 };
30 
34 
37 
41  "file", edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))} {
42  edm::LogInfo("SiStripBadComponentsDQMService") << "[SiStripBadComponentsDQMService::SiStripBadComponentsDQMService]";
43 }
44 
46  edm::LogInfo("SiStripBadComponentsDQMService") << "[SiStripBadComponentsDQMService::~SiStripBadComponentsDQMService]";
47 }
48 
51  setup.get<TrackerTopologyRcd>().get(tTopo);
52  trackerTopo_ = tTopo.product();
53 }
54 
56  std::stringstream ss;
57  ss << SiStripDQMPopConSourceHandler<SiStripBadStrip>::getMetaDataString();
59  return ss.str();
60 }
61 
62 namespace {
63  void getModuleFolderList(SiStripPopConBadComponentsHandlerFromDQM::DQMStore::IGetter& getter,
64  const std::string& pwd,
65  std::vector<std::string>& mfolders) {
66  if (std::string::npos != pwd.find("module_")) {
67  // std::string mId = pwd.substr(pwd.find("module_")+7, 9);
68  mfolders.push_back(pwd);
69  } else {
70  for (const auto& subdir : getter.getSubdirs()) {
71  getter.cd(subdir);
72  getModuleFolderList(getter, subdir, mfolders);
73  getter.cd();
74  getter.cd(pwd);
75  }
76  }
77  }
78 } // namespace
79 
81  //*LOOP OVER THE LIST OF SUMMARY OBJECTS TO INSERT IN DB*//
82 
84 
86 
87  getter.cd();
88 
89  const std::string mechanicalview_dir = "MechanicalView";
90  if (!getter.dirExists(mechanicalview_dir))
91  return;
92 
93  const std::vector<std::string> subdet_folder = {"TIB", "TOB", "TEC/side_1", "TEC/side_2", "TID/side_1", "TID/side_2"};
94 
95  int nDetsTotal = 0;
96  int nDetsWithErrorTotal = 0;
97  for (const auto& im : subdet_folder) {
98  const std::string dname = mechanicalview_dir + "/" + im;
99  getter.cd();
100  if (!getter.dirExists(dname))
101  continue;
102  getter.cd(dname);
103 
104  std::vector<std::string> module_folders;
105  getModuleFolderList(getter, dname, module_folders);
106  int nDets = module_folders.size();
107 
108  int nDetsWithError = 0;
109  const std::string bad_module_folder = dname + "/" + "BadModuleList";
110  getter.cd();
111  if (getter.dirExists(bad_module_folder)) {
112  for (const MonitorElement* me : getter.getContents(bad_module_folder)) {
113  nDetsWithError++;
114  std::cout << me->getName() << " " << me->getIntValue() << std::endl;
115  uint32_t detId = std::stoul(me->getName());
116  short flag = me->getIntValue();
117 
118  std::vector<unsigned int> theSiStripVector;
119 
120  unsigned short firstBadStrip = 0, NconsecutiveBadStrips = 0;
121  unsigned int theBadStripRange;
122 
123  // for(std::vector<uint32_t>::const_iterator is=BadApvList_.begin(); is!=BadApvList_.end(); ++is){
124 
125  // firstBadStrip=(*is)*128;
126  NconsecutiveBadStrips = reader.getNumberOfApvsAndStripLength(detId).first * 128;
127 
128  theBadStripRange = m_obj.encode(firstBadStrip, NconsecutiveBadStrips, flag);
129 
130  LogDebug("SiStripBadComponentsDQMService") << "detid " << detId << " \t"
131  << ", flag " << flag << std::endl;
132 
133  theSiStripVector.push_back(theBadStripRange);
134  // }
135 
136  SiStripBadStrip::Range range(theSiStripVector.begin(), theSiStripVector.end());
137  if (!m_obj.put(detId, range)) {
138  edm::LogError("SiStripBadFiberBuilder")
139  << "[SiStripBadFiberBuilder::analyze] detid already exists" << std::endl;
140  }
141  }
142  }
143  nDetsTotal += nDets;
144  nDetsWithErrorTotal += nDetsWithError;
145  }
146  getter.cd();
147 }
148 
150 
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
dqm::implementation::IGetter::getContents
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:593
alignCSCRings.pwd
pwd
Definition: alignCSCRings.py:57
ESHandle.h
SiStripDQMPopConSourceHandler
Definition: SiStripDQMPopConSourceHandler.h:18
SiStripPopConDQMEDHarvester.h
TrackerTopology
Definition: TrackerTopology.h:16
SiStripPopConBadComponentsHandlerFromDQM::trackerTopo_
const TrackerTopology * trackerTopo_
Definition: SiStripPopConBadComponentsDQM.cc:28
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiStripPopConBadComponentsHandlerFromDQM::SiStripPopConBadComponentsHandlerFromDQM
SiStripPopConBadComponentsHandlerFromDQM(const edm::ParameterSet &iConfig)
Definition: SiStripPopConBadComponentsDQM.cc:38
DQMStore.h
dqm::implementation::IGetter::getSubdirs
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:678
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiStripBadStrip::put
bool put(const uint32_t &detID, const InputVector &vect)
Definition: SiStripBadStrip.h:65
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripBadStrip.h
SiStripDetInfoFileReader
Definition: SiStripDetInfoFileReader.h:30
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
SiStripBadStrip
Definition: SiStripBadStrip.h:30
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::FileInPath
Definition: FileInPath.h:64
MakerMacros.h
TrackerTopology.h
SiStripBadStrip::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripBadStrip.h:53
TrackerTopologyRcd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:727
SiStripPopConBadComponentsHandlerFromDQM::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: SiStripPopConBadComponentsDQM.cc:13
DQM.reader
reader
Definition: DQM.py:105
SiStripPopConBadComponentsHandlerFromDQM::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiStripPopConBadComponentsDQM.cc:12
SiStripPopConBadComponentsHandlerFromDQM::getMetaDataString
std::string getMetaDataString() const override
Definition: SiStripPopConBadComponentsDQM.cc:55
edm::ESHandle< TrackerTopology >
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
SiStripPopConBadComponentsHandlerFromDQM::getObj
SiStripBadStrip * getObj() const override
Definition: SiStripPopConBadComponentsDQM.cc:149
SiStripDetInfoFileReader.h
SiStripPopConBadComponentsHandlerFromDQM
Definition: SiStripPopConBadComponentsDQM.cc:10
SiStripPopConBadComponentsHandlerFromDQM::initES
void initES(const edm::EventSetup &) override
Definition: SiStripPopConBadComponentsDQM.cc:49
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
edm::EventSetup
Definition: EventSetup.h:57
SiStripBadStrip::printSummary
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Definition: SiStripBadStrip.cc:60
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
SiStripPopConBadComponentsHandlerFromDQM::~SiStripPopConBadComponentsHandlerFromDQM
~SiStripPopConBadComponentsHandlerFromDQM() override
Definition: SiStripPopConBadComponentsDQM.cc:45
SiStripPopConBadComponentsHandlerFromDQM::fp_
edm::FileInPath fp_
Definition: SiStripPopConBadComponentsDQM.cc:26
dqm::implementation::IGetter
Definition: DQMStore.h:484
SiStripPopConDQMEDHarvester
Definition: SiStripPopConDQMEDHarvester.h:15
RefreshWebPage.dname
dname
Definition: RefreshWebPage.py:56
dqm::implementation::IBooker
Definition: DQMStore.h:43
SiStripPopConBadComponentsHandlerFromDQM::m_obj
SiStripBadStrip m_obj
Definition: SiStripPopConBadComponentsDQM.cc:27
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
SiStripBadStrip::encode
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
Definition: SiStripBadStrip.h:86
SiStripDQMPopConSourceHandler.h
dqm::implementation::IGetter::dirExists
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:708
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
SiStripPopConBadComponentsHandlerFromDQM::dqmEndJob
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
Definition: SiStripPopConBadComponentsDQM.cc:80