CMS 3D CMS Logo

SiStripPopConBadComponentsDQM.cc
Go to the documentation of this file.
4 
12 public:
15 
18  // interface methods: implemented in template
19  void initES(const edm::EventSetup&) override;
20  void dqmEndJob(DQMStore::IBooker& booker, DQMStore::IGetter& getter) override;
21  SiStripBadStrip* getObj() const override;
22 
23 protected:
24  std::string getMetaDataString() const override;
25 
26 private:
31 };
32 
34 
37 
41  fp_{iConfig.getUntrackedParameter<edm::FileInPath>("file",
43  tTopoToken_(iC.esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()) {
44  edm::LogInfo("SiStripBadComponentsDQMService") << "[SiStripBadComponentsDQMService::SiStripBadComponentsDQMService]";
45 }
46 
48  edm::LogInfo("SiStripBadComponentsDQMService") << "[SiStripBadComponentsDQMService::~SiStripBadComponentsDQMService]";
49 }
50 
52  trackerTopo_ = &setup.getData(tTopoToken_);
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 
85  const auto detInfo = SiStripDetInfoFileReader::read(fp_.fullPath());
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 = detInfo.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 
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
SiStripDQMPopConSourceHandler
Definition: SiStripDQMPopConSourceHandler.h:19
SiStripPopConDQMEDHarvester.h
TrackerTopology
Definition: TrackerTopology.h:16
SiStripPopConBadComponentsHandlerFromDQM::trackerTopo_
const TrackerTopology * trackerTopo_
Definition: SiStripPopConBadComponentsDQM.cc:30
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiStripPopConBadComponentsHandlerFromDQM::SiStripPopConBadComponentsHandlerFromDQM
SiStripPopConBadComponentsHandlerFromDQM(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
Definition: SiStripPopConBadComponentsDQM.cc:38
DQMStore.h
dqm::implementation::IGetter::getSubdirs
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:700
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
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
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
SiStripDetInfoFileReader::read
SiStripDetInfo read(std::string filePath)
Definition: SiStripDetInfoFileReader.cc:11
SiStripBadStrip
Definition: SiStripBadStrip.h:30
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::FileInPath
Definition: FileInPath.h:61
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:728
SiStripPopConBadComponentsHandlerFromDQM::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: SiStripPopConBadComponentsDQM.cc:14
SiStripPopConBadComponentsHandlerFromDQM::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiStripPopConBadComponentsDQM.cc:13
SiStripPopConBadComponentsHandlerFromDQM::getMetaDataString
std::string getMetaDataString() const override
Definition: SiStripPopConBadComponentsDQM.cc:55
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:11
SiStripPopConBadComponentsHandlerFromDQM::initES
void initES(const edm::EventSetup &) override
Definition: SiStripPopConBadComponentsDQM.cc:51
SiStripPopConBadComponentsHandlerFromDQM::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripPopConBadComponentsDQM.cc:29
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
edm::EventSetup
Definition: EventSetup.h:58
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
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripPopConBadComponentsHandlerFromDQM::~SiStripPopConBadComponentsHandlerFromDQM
~SiStripPopConBadComponentsHandlerFromDQM() override
Definition: SiStripPopConBadComponentsDQM.cc:47
SiStripPopConBadComponentsHandlerFromDQM::fp_
edm::FileInPath fp_
Definition: SiStripPopConBadComponentsDQM.cc:27
dqm::implementation::IGetter
Definition: DQMStore.h:484
edm::Transition::BeginRun
SiStripDetInfoFileReader::kDefaultFile
constexpr static char const *const kDefaultFile
Definition: SiStripDetInfoFileReader.h:10
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:28
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
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
dqm::implementation::IGetter::dirExists
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:730
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117
SiStripPopConBadComponentsHandlerFromDQM::dqmEndJob
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
Definition: SiStripPopConBadComponentsDQM.cc:80