#include <DQM/SiStripMonitorCluster/interface/SiStripDaqInfo.h>
Classes | |
struct | SubDetMEs |
Public Member Functions | |
SiStripDaqInfo (const edm::ParameterSet &ps) | |
Constructor. | |
virtual | ~SiStripDaqInfo () |
Destructor. | |
Private Member Functions | |
void | analyze (edm::Event const &, edm::EventSetup const &) |
Analyze. | |
void | beginJob () |
BeginJob. | |
void | beginRun (edm::Run const &run, edm::EventSetup const &eSetup) |
Begin Run. | |
void | bookStatus () |
void | endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &iSetup) |
End Of Luminosity. | |
void | endRun (edm::Run const &run, edm::EventSetup const &eSetup) |
EndRun. | |
void | fillDummyStatus () |
void | findExcludedModule (unsigned short fed_id) |
void | readFedIds (const edm::ESHandle< SiStripFedCabling > &fedcabling) |
void | readSubdetFedFractions (std::vector< int > &fed_ids) |
Private Attributes | |
bool | bookedStatus_ |
MonitorElement * | DaqFraction_ |
DQMStore * | dqmStore_ |
edm::ESHandle< SiStripFedCabling > | fedCabling_ |
unsigned long long | m_cacheID_ |
int | nFedTotal |
std::map< std::string, std::vector< unsigned short > > | subDetFedMap |
std::map< std::string, SubDetMEs > | SubDetMEsMap |
Description: Checks the # of SiStrip FEDs from DAQ Usage: <usage>
Definition at line 40 of file SiStripDaqInfo.h.
SiStripDaqInfo::SiStripDaqInfo | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 32 of file SiStripDaqInfo.cc.
References bookedStatus_, dqmStore_, nFedTotal, and cmsCodeRules::cppFunctionSkipper::operator.
{ // Create MessageSender edm::LogInfo( "SiStripDaqInfo") << "SiStripDaqInfo::Deleting SiStripDaqInfo "; // get back-end interface dqmStore_ = edm::Service<DQMStore>().operator->(); nFedTotal = 0; bookedStatus_ = false; }
SiStripDaqInfo::~SiStripDaqInfo | ( | ) | [virtual] |
Destructor.
Definition at line 41 of file SiStripDaqInfo.cc.
{ edm::LogInfo("SiStripDaqInfo") << "SiStripDaqInfo::Deleting SiStripDaqInfo "; }
void SiStripDaqInfo::analyze | ( | edm::Event const & | event, |
edm::EventSetup const & | eSetup | ||
) | [private, virtual] |
void SiStripDaqInfo::beginJob | ( | void | ) | [private, virtual] |
void SiStripDaqInfo::beginRun | ( | edm::Run const & | run, |
edm::EventSetup const & | eSetup | ||
) | [private, virtual] |
Begin Run.
Reimplemented from edm::EDAnalyzer.
Definition at line 109 of file SiStripDaqInfo.cc.
References bookedStatus_, bookStatus(), DaqFraction_, fedCabling_, MonitorElement::Fill(), fillDummyStatus(), edm::EventSetup::find(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), edm::ESHandleBase::isValid(), m_cacheID_, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, nFedTotal, readFedIds(), readSubdetFedFractions(), and MonitorElement::Reset().
{ edm::LogInfo ("SiStripDaqInfo") <<"SiStripDaqInfo:: Begining of Run"; // Check latest Fed cabling and create TrackerMapCreator unsigned long long cacheID = eSetup.get<SiStripFedCablingRcd>().cacheIdentifier(); if (m_cacheID_ != cacheID) { m_cacheID_ = cacheID; eSetup.get<SiStripFedCablingRcd>().get(fedCabling_); readFedIds(fedCabling_); } if (!bookedStatus_) bookStatus(); if (nFedTotal == 0) { fillDummyStatus(); edm::LogInfo ("SiStripDaqInfo") <<" SiStripDaqInfo::No FEDs Connected!!!"; return; } float nFEDConnected = 0.0; const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("RunInfoRcd")); if( eSetup.find( recordKey ) != 0) { edm::ESHandle<RunInfo> sumFED; eSetup.get<RunInfoRcd>().get(sumFED); if ( sumFED.isValid() ) { std::vector<int> FedsInIds= sumFED->m_fed_in; for(unsigned int it = 0; it < FedsInIds.size(); ++it) { int fedID = FedsInIds[it]; if(fedID>=siStripFedIdMin && fedID<=siStripFedIdMax) ++nFEDConnected; } edm::LogInfo ("SiStripDaqInfo") <<" SiStripDaqInfo::Total # of FEDs " << nFedTotal << " Connected FEDs " << nFEDConnected; if (nFEDConnected > 0) { DaqFraction_->Reset(); DaqFraction_->Fill(nFEDConnected/nFedTotal); readSubdetFedFractions(FedsInIds); } } } }
void SiStripDaqInfo::bookStatus | ( | ) | [private] |
Definition at line 54 of file SiStripDaqInfo.cc.
References bookedStatus_, DQMStore::bookFloat(), DQMStore::cd(), SiStripDaqInfo::SubDetMEs::ConnectedFeds, DaqFraction_, SiStripDaqInfo::SubDetMEs::DaqFractionME, dqmStore_, SiStripUtility::getTopFolderPath(), DQMStore::setCurrentFolder(), and SubDetMEsMap.
Referenced by beginRun(), and fillDummyStatus().
{ edm::LogInfo( "SiStripDcsInfo") << " SiStripDaqInfo::bookStatus " << bookedStatus_; if (!bookedStatus_) { dqmStore_->cd(); std::string strip_dir = ""; SiStripUtility::getTopFolderPath(dqmStore_, "SiStrip", strip_dir); if (strip_dir.size() > 0) dqmStore_->setCurrentFolder(strip_dir+"/EventInfo"); else dqmStore_->setCurrentFolder("SiStrip/EventInfo"); DaqFraction_= dqmStore_->bookFloat("DAQSummary"); dqmStore_->cd(); if (strip_dir.size() > 0) dqmStore_->setCurrentFolder(strip_dir+"/EventInfo/DAQContents"); else dqmStore_->setCurrentFolder("SiStrip/EventInfo/DAQContents"); std::vector<std::string> det_type; det_type.push_back("TIB"); det_type.push_back("TOB"); det_type.push_back("TIDF"); det_type.push_back("TIDB"); det_type.push_back("TECF"); det_type.push_back("TECB"); for ( std::vector<std::string>::iterator it = det_type.begin(); it != det_type.end(); it++) { std::string det = (*it); SubDetMEs local_mes; std::string me_name; me_name = "SiStrip_" + det; local_mes.DaqFractionME = dqmStore_->bookFloat(me_name); local_mes.ConnectedFeds = 0; SubDetMEsMap.insert(make_pair(det, local_mes)); } bookedStatus_ = true; dqmStore_->cd(); } }
void SiStripDaqInfo::endLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, |
edm::EventSetup const & | iSetup | ||
) | [private, virtual] |
End Of Luminosity.
Reimplemented from edm::EDAnalyzer.
Definition at line 164 of file SiStripDaqInfo.cc.
{ edm::LogInfo( "SiStripDaqInfo") << "SiStripDaqInfo::endLuminosityBlock"; }
void SiStripDaqInfo::endRun | ( | edm::Run const & | run, |
edm::EventSetup const & | eSetup | ||
) | [private, virtual] |
EndRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 170 of file SiStripDaqInfo.cc.
{ edm::LogInfo ("SiStripDaqInfo") <<"SiStripDaqInfo::EndRun"; }
void SiStripDaqInfo::fillDummyStatus | ( | ) | [private] |
Definition at line 95 of file SiStripDaqInfo.cc.
References bookedStatus_, bookStatus(), DaqFraction_, MonitorElement::Fill(), MonitorElement::Reset(), and SubDetMEsMap.
Referenced by beginRun().
{ if (!bookedStatus_) bookStatus(); if (bookedStatus_) { for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin(); it != SubDetMEsMap.end(); it++) { it->second.DaqFractionME->Reset(); it->second.DaqFractionME->Fill(-1.0); } DaqFraction_->Reset(); DaqFraction_->Fill(-1.0); } }
void SiStripDaqInfo::findExcludedModule | ( | unsigned short | fed_id | ) | [private] |
Definition at line 244 of file SiStripDaqInfo.cc.
References DQMStore::bookInt(), DQMStore::cd(), DQMStore::dirExists(), dqmStore_, fedCabling_, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getIntValue(), SiStripFolderOrganizer::getSubDetFolder(), SiStripUtility::goToDir(), DQMStore::pwd(), MonitorElement::Reset(), SiStripUtility::setBadModuleFlag(), DQMStore::setCurrentFolder(), and GlobalPosition_Frontier_DevDB_cff::tag.
Referenced by readSubdetFedFractions().
{ dqmStore_->cd(); std::string mdir = "MechanicalView"; if (!SiStripUtility::goToDir(dqmStore_, mdir)) { dqmStore_->setCurrentFolder("SiStrip/"+mdir); } std::string mechanical_dir = dqmStore_->pwd(); const std::vector<FedChannelConnection> fedChannels = fedCabling_->connections(fed_id); int ichannel = 0; std::string tag = "ExcludedFedChannel"; std::string bad_module_folder; for (std::vector<FedChannelConnection>::const_iterator iconn = fedChannels.begin(); iconn < fedChannels.end(); iconn++){ if (!iconn->isConnected()) continue; uint32_t detId = iconn->detId(); if (detId == 0 || detId == 0xFFFFFFFF) continue; ichannel++; if (ichannel == 1) { std::string subdet_folder ; SiStripFolderOrganizer folder_organizer; folder_organizer.getSubDetFolder(detId,subdet_folder); if (!dqmStore_->dirExists(subdet_folder)) { subdet_folder = mechanical_dir + subdet_folder.substr(subdet_folder.find(mdir)+mdir.size()); } bad_module_folder = subdet_folder + "/" + "BadModuleList"; dqmStore_->setCurrentFolder(bad_module_folder); } std::ostringstream detid_str; detid_str << detId; std::string full_path = bad_module_folder + "/" + detid_str.str(); MonitorElement* me = dqmStore_->get(full_path); uint16_t flag = 0; if (me) { flag = me->getIntValue(); me->Reset(); } else me = dqmStore_->bookInt(detid_str.str()); SiStripUtility::setBadModuleFlag(tag, flag); me->Fill(flag); } dqmStore_->cd(); }
void SiStripDaqInfo::readFedIds | ( | const edm::ESHandle< SiStripFedCabling > & | fedcabling | ) | [private] |
Definition at line 176 of file SiStripDaqInfo.cc.
References fedCabling_, SiStripUtility::getSubDetectorTag(), nFedTotal, xuti::subdet_tag(), and subDetFedMap.
Referenced by beginRun().
{ const std::vector<uint16_t>& feds = fedCabling_->feds(); nFedTotal = feds.size(); for(std::vector<unsigned short>::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++){ const std::vector<FedChannelConnection> fedChannels = fedCabling_->connections( *ifed ); for (std::vector<FedChannelConnection>::const_iterator iconn = fedChannels.begin(); iconn < fedChannels.end(); iconn++){ if (!iconn->isConnected()) continue; uint32_t detId = iconn->detId(); if (detId == 0 || detId == 0xFFFFFFFF) continue; std::string subdet_tag; SiStripUtility::getSubDetectorTag(detId,subdet_tag); subDetFedMap[subdet_tag].push_back(*ifed); break; } } }
void SiStripDaqInfo::readSubdetFedFractions | ( | std::vector< int > & | fed_ids | ) | [private] |
Definition at line 196 of file SiStripDaqInfo.cc.
References findExcludedModule(), Association::map, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, mergeVDriftHistosByStation::name, subDetFedMap, and SubDetMEsMap.
Referenced by beginRun().
{ const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; // initialiase for (std::map<std::string, std::vector<unsigned short> >::const_iterator it = subDetFedMap.begin(); it != subDetFedMap.end(); it++) { std::string name = it->first; std::map<std::string, SubDetMEs>::iterator iPos = SubDetMEsMap.find(name); if (iPos == SubDetMEsMap.end()) continue; iPos->second.ConnectedFeds = 0; } // count sub detector feds for (std::map<std::string, std::vector<unsigned short> >::const_iterator it = subDetFedMap.begin(); it != subDetFedMap.end(); it++) { std::string name = it->first; std::vector<unsigned short> subdetIds = it->second; std::map<std::string, SubDetMEs>::iterator iPos = SubDetMEsMap.find(name); if (iPos == SubDetMEsMap.end()) continue; iPos->second.ConnectedFeds = 0; for (std::vector<unsigned short>::iterator iv = subdetIds.begin(); iv != subdetIds.end(); iv++) { bool fedid_found = false; for(unsigned int it = 0; it < fed_ids.size(); ++it) { unsigned short fedID = fed_ids[it]; if(fedID < siStripFedIdMin || fedID > siStripFedIdMax) continue; if ((*iv) == fedID) { fedid_found = true; iPos->second.ConnectedFeds++; break; } } if (!fedid_found) findExcludedModule((*iv)); } int nFedsConnected = iPos->second.ConnectedFeds; int nFedSubDet = subdetIds.size(); if (nFedSubDet > 0) { iPos->second.DaqFractionME->Reset(); iPos->second.DaqFractionME->Fill(nFedsConnected*1.0/nFedSubDet); } } }
bool SiStripDaqInfo::bookedStatus_ [private] |
Definition at line 89 of file SiStripDaqInfo.h.
Referenced by beginRun(), bookStatus(), fillDummyStatus(), and SiStripDaqInfo().
MonitorElement* SiStripDaqInfo::DaqFraction_ [private] |
Definition at line 78 of file SiStripDaqInfo.h.
Referenced by beginRun(), bookStatus(), and fillDummyStatus().
DQMStore* SiStripDaqInfo::dqmStore_ [private] |
Definition at line 77 of file SiStripDaqInfo.h.
Referenced by bookStatus(), findExcludedModule(), and SiStripDaqInfo().
edm::ESHandle< SiStripFedCabling > SiStripDaqInfo::fedCabling_ [private] |
Definition at line 91 of file SiStripDaqInfo.h.
Referenced by beginRun(), findExcludedModule(), and readFedIds().
unsigned long long SiStripDaqInfo::m_cacheID_ [private] |
Definition at line 87 of file SiStripDaqInfo.h.
Referenced by beginRun().
int SiStripDaqInfo::nFedTotal [private] |
Definition at line 88 of file SiStripDaqInfo.h.
Referenced by beginRun(), readFedIds(), and SiStripDaqInfo().
std::map<std::string,std::vector<unsigned short> > SiStripDaqInfo::subDetFedMap [private] |
Definition at line 75 of file SiStripDaqInfo.h.
Referenced by readFedIds(), and readSubdetFedFractions().
std::map<std::string, SubDetMEs> SiStripDaqInfo::SubDetMEsMap [private] |
Definition at line 85 of file SiStripDaqInfo.h.
Referenced by bookStatus(), fillDummyStatus(), and readSubdetFedFractions().