Public Member Functions | |
SpyExtractRunModule (const edm::ParameterSet &) | |
~SpyExtractRunModule () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
virtual void | endJob () |
const bool | updateRun (const uint32_t aRun) |
Private Attributes | |
uint32_t | currentRun_ |
uint32_t | errCounter_ |
std::string | fileName_ |
uint32_t | previousRun_ |
edm::InputTag | runTag_ |
Definition at line 35 of file SiStripSpyExtractRunModule.cc.
sistrip::SpyExtractRunModule::SpyExtractRunModule | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 76 of file SiStripSpyExtractRunModule.cc.
: fileName_(iConfig.getParameter<std::string>("OutputTextFile")), runTag_(iConfig.getParameter<edm::InputTag>("RunNumberTag")), currentRun_(0), previousRun_(0), errCounter_(0) { }
sistrip::SpyExtractRunModule::~SpyExtractRunModule | ( | ) |
Definition at line 87 of file SiStripSpyExtractRunModule.cc.
{ }
void sistrip::SpyExtractRunModule::analyze | ( | const edm::Event & | aEvt, |
const edm::EventSetup & | aSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 99 of file SiStripSpyExtractRunModule.cc.
References currentRun_, edm::EventID::event(), edm::Event::getByLabel(), edm::EventBase::id(), previousRun_, edm::EventID::run(), runTag_, and updateRun().
{ static bool lFirstEvent = true; edm::Handle<uint32_t> lRun; aEvt.getByLabel( runTag_, lRun ); const bool isUpdated = updateRun(*lRun); if (isUpdated && !lFirstEvent){ edm::LogError("SpyExtractRunModule") << " -- Run number changed for event : " << aEvt.id().event() << " (id().run() = " << aEvt.id().run() << ") from " << previousRun_ << " to " << currentRun_ << std::endl; } lFirstEvent = false; }
void sistrip::SpyExtractRunModule::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 91 of file SiStripSpyExtractRunModule.cc.
References currentRun_, errCounter_, and previousRun_.
{ currentRun_ = 0; previousRun_ = 0; errCounter_ = 0; }
void sistrip::SpyExtractRunModule::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 121 of file SiStripSpyExtractRunModule.cc.
References currentRun_, errCounter_, fileName_, dbtoconf::out, and previousRun_.
{ //save global run number in text file in local directory //output loginfo with number of errors //or throw exception ? if (errCounter_ == 1){ edm::LogInfo("SiStripSpyExtractRun") << " -- Writting run number " << currentRun_ << " into file " << fileName_ << std::endl; std::ofstream lOutFile; lOutFile.open(fileName_.c_str(),std::ios::out); if (!lOutFile.is_open()) { edm::LogError("SiStripSpyExtractRun") << " -- Cannot open file : " << fileName_ << " for writting run number " << currentRun_ << std::endl; } else { lOutFile << currentRun_ << std::endl; lOutFile.close(); } } else { edm::LogError("SiStripSpyExtractRun") << " -- Number of times the run number changed in this job = " << errCounter_ << ", currentRun = " << currentRun_ << ", previousRun = " << previousRun_ << std::endl; } }
const bool sistrip::SpyExtractRunModule::updateRun | ( | const uint32_t | aRun | ) | [private] |
Definition at line 155 of file SiStripSpyExtractRunModule.cc.
References currentRun_, errCounter_, and previousRun_.
Referenced by analyze().
{ if (aRun != currentRun_){ previousRun_ = currentRun_; currentRun_ = aRun; errCounter_++; return true; } return false; }
uint32_t sistrip::SpyExtractRunModule::currentRun_ [private] |
Definition at line 59 of file SiStripSpyExtractRunModule.cc.
Referenced by analyze(), beginJob(), endJob(), and updateRun().
uint32_t sistrip::SpyExtractRunModule::errCounter_ [private] |
Definition at line 63 of file SiStripSpyExtractRunModule.cc.
Referenced by beginJob(), endJob(), and updateRun().
std::string sistrip::SpyExtractRunModule::fileName_ [private] |
Definition at line 53 of file SiStripSpyExtractRunModule.cc.
Referenced by endJob().
uint32_t sistrip::SpyExtractRunModule::previousRun_ [private] |
Definition at line 60 of file SiStripSpyExtractRunModule.cc.
Referenced by analyze(), beginJob(), endJob(), and updateRun().
Definition at line 56 of file SiStripSpyExtractRunModule.cc.
Referenced by analyze().