CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
SiStripDaqInfo Class Reference

#include <SiStripDaqInfo.h>

Inheritance diagram for SiStripDaqInfo:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  SubDetMEs
 

Public Member Functions

 SiStripDaqInfo (edm::ParameterSet const &ps)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup) override
 
void bookStatus (DQMStore &dqm_store)
 
void fillDummyStatus (DQMStore &dqm_store)
 
void findExcludedModule (DQMStore &dqm_store, unsigned short fed_id, TrackerTopology const *tTopo)
 
void readFedIds (edm::ESHandle< SiStripFedCabling > const &fedcabling, edm::EventSetup const &iSetup)
 
void readSubdetFedFractions (DQMStore &dqm_store, std::vector< int > const &fed_ids, edm::EventSetup const &iSetup)
 

Private Attributes

bool bookedStatus_ {false}
 
MonitorElementdaqFraction_ { 0 }
 
edm::ESHandle< SiStripFedCablingfedCabling_
 
unsigned long long m_cacheID_ {}
 
int nFedTotal_ {}
 
std::map< std::string, std::vector< unsigned short > > subDetFedMap_
 
std::map< std::string, SubDetMEssubDetMEsMap_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

DQM/SiStripMonitorCluster/interface/SiStripDaqInfo.h

Description: Checks the # of SiStrip FEDs from DAQ Usage: <usage>

Definition at line 42 of file SiStripDaqInfo.h.

Constructor & Destructor Documentation

SiStripDaqInfo::SiStripDaqInfo ( edm::ParameterSet const &  ps)

Definition at line 33 of file SiStripDaqInfo.cc.

34 {
35  edm::LogInfo( "SiStripDaqInfo") << "SiStripDaqInfo::Deleting SiStripDaqInfo ";
36 }

Member Function Documentation

void SiStripDaqInfo::analyze ( edm::Event const &  event,
edm::EventSetup const &  eSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 149 of file SiStripDaqInfo.cc.

149  {
150 }
void SiStripDaqInfo::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 100 of file SiStripDaqInfo.cc.

References bookedStatus_, bookStatus(), constexpr, daqFraction_, fedCabling_, MonitorElement::Fill(), fillDummyStatus(), edm::EventSetup::get(), edm::ESHandleBase::isValid(), m_cacheID_, RunInfo::m_fed_in, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, nFedTotal_, readFedIds(), readSubdetFedFractions(), MonitorElement::Reset(), and edm::EventSetup::tryToGet().

101 {
102  edm::LogInfo("SiStripDaqInfo") << "SiStripDaqInfo:: Begining of Run";
103 
104  // Check latest Fed cabling and create TrackerMapCreator
105  unsigned long long cacheID = eSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
106  if (m_cacheID_ != cacheID) {
107  m_cacheID_ = cacheID;
108 
109  eSetup.get<SiStripFedCablingRcd>().get(fedCabling_);
110 
111  readFedIds(fedCabling_, eSetup);
112  }
113  auto& dqm_store = *edm::Service<DQMStore>{};
114  if (!bookedStatus_) {
115  bookStatus(dqm_store);
116  }
117  if (nFedTotal_ == 0) {
118  fillDummyStatus(dqm_store);
119  edm::LogInfo ("SiStripDaqInfo") <<" SiStripDaqInfo::No FEDs Connected!!!";
120  return;
121  }
122 
123  float nFEDConnected = 0.0;
124  constexpr int siStripFedIdMin{FEDNumbering::MINSiStripFEDID};
125  constexpr int siStripFedIdMax{FEDNumbering::MAXSiStripFEDID};
126 
127  auto runInfoRec = eSetup.tryToGet<RunInfoRcd>();
128  if (!runInfoRec) return;
129 
130  edm::ESHandle<RunInfo> sumFED;
131  runInfoRec->get(sumFED);
132 
133  if (!sumFED.isValid()) return;
134 
135  auto const& fedsInIds = sumFED->m_fed_in;
136  for (auto const fedID : fedsInIds) {
137  if (fedID >= siStripFedIdMin && fedID <= siStripFedIdMax) ++nFEDConnected;
138  }
139  edm::LogInfo("SiStripDaqInfo")
140  << " SiStripDaqInfo::Total # of FEDs " << nFedTotal_ << " Connected FEDs "
141  << nFEDConnected;
142  if (nFEDConnected > 0) {
143  daqFraction_->Reset();
144  daqFraction_->Fill(nFEDConnected / nFedTotal_);
145  readSubdetFedFractions(dqm_store, fedsInIds, eSetup);
146  }
147 }
void readSubdetFedFractions(DQMStore &dqm_store, std::vector< int > const &fed_ids, edm::EventSetup const &iSetup)
void bookStatus(DQMStore &dqm_store)
void Fill(long long x)
std::vector< int > m_fed_in
Definition: RunInfo.h:26
void readFedIds(edm::ESHandle< SiStripFedCabling > const &fedcabling, edm::EventSetup const &iSetup)
void Reset()
reset ME (ie. contents, errors, etc)
MonitorElement * daqFraction_
void fillDummyStatus(DQMStore &dqm_store)
bool isValid() const
Definition: ESHandle.h:44
unsigned long long m_cacheID_
#define constexpr
edm::ESHandle< SiStripFedCabling > fedCabling_
void SiStripDaqInfo::bookStatus ( DQMStore dqm_store)
private

Definition at line 42 of file SiStripDaqInfo.cc.

References bookedStatus_, DQMStore::bookFloat(), DQMStore::cd(), daqFraction_, SiStripUtility::getTopFolderPath(), eostools::move(), DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and subDetMEsMap_.

Referenced by beginRun(), and fillDummyStatus().

43 {
44  edm::LogInfo("SiStripDcsInfo")
45  << " SiStripDaqInfo::bookStatus " << bookedStatus_;
46  if (bookedStatus_) return;
47 
48  dqm_store.cd();
49  std::string strip_dir = "";
50  SiStripUtility::getTopFolderPath(dqm_store, "SiStrip", strip_dir);
51  if (!strip_dir.empty())
52  dqm_store.setCurrentFolder(strip_dir + "/EventInfo");
53  else
54  dqm_store.setCurrentFolder("SiStrip/EventInfo");
55 
56  daqFraction_ = dqm_store.bookFloat("DAQSummary");
57 
58  dqm_store.cd();
59  if (!strip_dir.empty())
60  dqm_store.setCurrentFolder(strip_dir + "/EventInfo/DAQContents");
61  else
62  dqm_store.setCurrentFolder("SiStrip/EventInfo/DAQContents");
63 
64  std::vector<std::string> det_types;
65  det_types.push_back("TIB");
66  det_types.push_back("TOB");
67  det_types.push_back("TIDF");
68  det_types.push_back("TIDB");
69  det_types.push_back("TECF");
70  det_types.push_back("TECB");
71 
72  for (auto const& det : det_types) {
73  std::string const me_name{"SiStrip_" + det};
74  SubDetMEs local_mes{dqm_store.bookFloat(me_name), 0};
75  subDetMEsMap_.emplace(det, std::move(local_mes));
76  }
77  bookedStatus_ = true;
78  dqm_store.cd();
79 }
MonitorElement * bookFloat(char_string const &name)
Book float.
Definition: DQMStore.cc:1048
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:571
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:546
std::map< std::string, SubDetMEs > subDetMEsMap_
MonitorElement * daqFraction_
static void getTopFolderPath(DQMStore &dqm_store, std::string const &top_dir, std::string &path)
def move(src, dest)
Definition: eostools.py:511
void SiStripDaqInfo::fillDummyStatus ( DQMStore dqm_store)
private

Definition at line 84 of file SiStripDaqInfo.cc.

References bookedStatus_, bookStatus(), daqFraction_, MonitorElement::Fill(), MonitorElement::Reset(), and subDetMEsMap_.

Referenced by beginRun().

85 {
86  if (!bookedStatus_) {
87  bookStatus(dqm_store);
88  }
89  assert(bookedStatus_);
90 
91  for (auto& pr : subDetMEsMap_) {
92  pr.second.daqFractionME->Reset();
93  pr.second.daqFractionME->Fill(-1.0);
94  }
96  daqFraction_->Fill(-1.0);
97 }
void bookStatus(DQMStore &dqm_store)
void Fill(long long x)
void Reset()
reset ME (ie. contents, errors, etc)
std::map< std::string, SubDetMEs > subDetMEsMap_
MonitorElement * daqFraction_
void SiStripDaqInfo::findExcludedModule ( DQMStore dqm_store,
unsigned short  fed_id,
TrackerTopology const *  tTopo 
)
private

Definition at line 232 of file SiStripDaqInfo.cc.

References DQMStore::bookInt(), DQMStore::cd(), DEFINE_FWK_MODULE, DQMStore::dirExists(), fedCabling_, SiStripFedCabling::fedConnections(), MonitorElement::Fill(), RemoveAddSevLevel::flag, DQMStore::get(), MonitorElement::getIntValue(), SiStripFolderOrganizer::getSubDetFolder(), SiStripUtility::goToDir(), DQMStore::pwd(), MonitorElement::Reset(), SiStripUtility::setBadModuleFlag(), DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by readSubdetFedFractions().

235 {
236  dqm_store.cd();
237  std::string mdir = "MechanicalView";
238  if (!SiStripUtility::goToDir(dqm_store, mdir)) {
239  dqm_store.setCurrentFolder("SiStrip/" + mdir);
240  }
241  std::string mechanical_dir = dqm_store.pwd();
242  auto fedChannels = fedCabling_->fedConnections(fed_id);
243  int ichannel = 0;
244  std::string tag = "ExcludedFedChannel";
245  std::string bad_module_folder;
246  for (auto const& conn : fedChannels) {
247  if (!conn.isConnected()) continue;
248  uint32_t detId = conn.detId();
249  if (detId == 0 || detId == 0xFFFFFFFF) continue;
250 
251  ichannel++;
252  if (ichannel == 1) {
253  std::string subdet_folder ;
254  SiStripFolderOrganizer folder_organizer;
255  folder_organizer.getSubDetFolder(detId,tTopo,subdet_folder);
256  if (!dqm_store.dirExists(subdet_folder)) {
257  subdet_folder =
258  mechanical_dir +
259  subdet_folder.substr(subdet_folder.find(mdir) + mdir.size());
260  }
261  bad_module_folder = subdet_folder + "/" + "BadModuleList";
262  dqm_store.setCurrentFolder(bad_module_folder);
263  }
264  std::ostringstream detid_str;
265  detid_str << detId;
266  std::string full_path = bad_module_folder + "/" + detid_str.str();
267  MonitorElement* me = dqm_store.get(full_path);
268  uint16_t flag = 0;
269  if (me) {
270  flag = me->getIntValue();
271  me->Reset();
272  } else
273  me = dqm_store.bookInt(detid_str.str());
275  me->Fill(flag);
276  }
277  dqm_store.cd();
278 }
static void setBadModuleFlag(std::string &hname, uint16_t &flg)
int64_t getIntValue() const
void getSubDetFolder(const uint32_t &detid, const TrackerTopology *tTopo, std::string &folder_name)
MonitorElement * bookInt(char_string const &name)
Book int.
Definition: DQMStore.cc:1027
void Fill(long long x)
bool dirExists(std::string const &path) const
true if directory exists
Definition: DQMStore.cc:635
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1613
void Reset()
reset ME (ie. contents, errors, etc)
std::string const & pwd() const
Definition: DQMStore.cc:539
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:571
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:546
ConnsConstIterRange fedConnections(uint16_t fed_id) const
static bool goToDir(DQMStore &dqm_store, std::string const &name)
edm::ESHandle< SiStripFedCabling > fedCabling_
void SiStripDaqInfo::readFedIds ( edm::ESHandle< SiStripFedCabling > const &  fedcabling,
edm::EventSetup const &  iSetup 
)
private

Definition at line 156 of file SiStripDaqInfo.cc.

References fedCabling_, SiStripFedCabling::fedConnections(), SiStripFedCabling::fedIds(), edm::EventSetup::get(), SiStripUtility::getSubDetectorTag(), nFedTotal_, edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, xuti::subdet_tag(), and subDetFedMap_.

Referenced by beginRun().

158 {
159  //Retrieve tracker topology from geometry
160  edm::ESHandle<TrackerTopology> tTopoHandle;
161  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
162  const TrackerTopology* const tTopo = tTopoHandle.product();
163 
164  auto feds = fedCabling_->fedIds();
165 
166  nFedTotal_ = feds.size();
167  for (auto const fed : feds) {
168  auto fedChannels = fedCabling_->fedConnections(fed);
169  for (auto const& conn : fedChannels) {
170  if (!conn.isConnected()) continue;
171  uint32_t detId = conn.detId();
172  if (detId == 0 || detId == 0xFFFFFFFF) continue;
174  SiStripUtility::getSubDetectorTag(detId,subdet_tag,tTopo);
175  subDetFedMap_[subdet_tag].push_back(fed);
176  break;
177  }
178  }
179 }
std::map< std::string, std::vector< unsigned short > > subDetFedMap_
FedsConstIterRange fedIds() const
const std::string subdet_tag("SubDet")
ConnsConstIterRange fedConnections(uint16_t fed_id) const
static void getSubDetectorTag(uint32_t det_id, std::string &subdet_tag, const TrackerTopology *tTopo)
T const * product() const
Definition: ESHandle.h:86
edm::ESHandle< SiStripFedCabling > fedCabling_
void SiStripDaqInfo::readSubdetFedFractions ( DQMStore dqm_store,
std::vector< int > const &  fed_ids,
edm::EventSetup const &  iSetup 
)
private

Definition at line 184 of file SiStripDaqInfo.cc.

References constexpr, l1t::stage2::layer2::fedId, findExcludedModule(), edm::EventSetup::get(), FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, dataset::name, edm::ESHandle< T >::product(), subDetFedMap_, and subDetMEsMap_.

Referenced by beginRun().

187 {
188  //Retrieve tracker topology from geometry
189  edm::ESHandle<TrackerTopology> tTopoHandle;
190  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
191  const TrackerTopology* const tTopo = tTopoHandle.product();
192 
193  constexpr int siStripFedIdMin{FEDNumbering::MINSiStripFEDID};
194  constexpr int siStripFedIdMax{FEDNumbering::MAXSiStripFEDID};
195 
196  // initialiase
197  for (auto const& pr : subDetFedMap_) {
198  auto const& name = pr.first;
199  auto iPos = subDetMEsMap_.find(name);
200  if (iPos == subDetMEsMap_.end()) continue;
201  iPos->second.connectedFeds = 0;
202  }
203  // count sub detector feds
204 
205  for (auto const& [name, subdetIds] : subDetFedMap_) {
206  auto iPos = subDetMEsMap_.find(name);
207  if (iPos == subDetMEsMap_.end()) continue;
208  iPos->second.connectedFeds = 0;
209  for (auto const subdetId : subdetIds) {
210  bool fedid_found = false;
211  for (auto const fedId : fed_ids) {
212  if (fedId < siStripFedIdMin || fedId > siStripFedIdMax) continue;
213  if (subdetId == fedId) {
214  fedid_found = true;
215  iPos->second.connectedFeds++;
216  break;
217  }
218  }
219  if (!fedid_found) findExcludedModule(dqm_store, subdetId, tTopo);
220  }
221  if (auto nFedSubDet = subdetIds.size(); nFedSubDet > 0) {
222  iPos->second.daqFractionME->Reset();
223  int const nFedsConnected = iPos->second.connectedFeds;
224  iPos->second.daqFractionME->Fill(nFedsConnected * 1.0 / nFedSubDet);
225  }
226  }
227 }
void findExcludedModule(DQMStore &dqm_store, unsigned short fed_id, TrackerTopology const *tTopo)
std::map< std::string, std::vector< unsigned short > > subDetFedMap_
std::map< std::string, SubDetMEs > subDetMEsMap_
T const * product() const
Definition: ESHandle.h:86
#define constexpr

Member Data Documentation

bool SiStripDaqInfo::bookedStatus_ {false}
private

Definition at line 74 of file SiStripDaqInfo.h.

Referenced by beginRun(), bookStatus(), and fillDummyStatus().

MonitorElement* SiStripDaqInfo::daqFraction_ { 0 }
private

Definition at line 63 of file SiStripDaqInfo.h.

Referenced by beginRun(), bookStatus(), and fillDummyStatus().

edm::ESHandle<SiStripFedCabling> SiStripDaqInfo::fedCabling_
private

Definition at line 76 of file SiStripDaqInfo.h.

Referenced by beginRun(), findExcludedModule(), and readFedIds().

unsigned long long SiStripDaqInfo::m_cacheID_ {}
private

Definition at line 72 of file SiStripDaqInfo.h.

Referenced by beginRun().

int SiStripDaqInfo::nFedTotal_ {}
private

Definition at line 73 of file SiStripDaqInfo.h.

Referenced by beginRun(), and readFedIds().

std::map<std::string, std::vector<unsigned short> > SiStripDaqInfo::subDetFedMap_
private

Definition at line 61 of file SiStripDaqInfo.h.

Referenced by readFedIds(), and readSubdetFedFractions().

std::map<std::string, SubDetMEs> SiStripDaqInfo::subDetMEsMap_
private

Definition at line 70 of file SiStripDaqInfo.h.

Referenced by bookStatus(), fillDummyStatus(), and readSubdetFedFractions().