CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
sistrip::SpyExtractRunModule Class Reference
Inheritance diagram for sistrip::SpyExtractRunModule:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 SpyExtractRunModule (const edm::ParameterSet &)
 
 ~SpyExtractRunModule () override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
const bool updateRun (const uint32_t aRun)
 

Private Attributes

uint32_t currentRun_
 
uint32_t errCounter_
 
std::string fileName_
 
uint32_t previousRun_
 
edm::InputTag runTag_
 
edm::EDGetTokenT< uint32_t > runToken_
 

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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 35 of file SiStripSpyExtractRunModule.cc.

Constructor & Destructor Documentation

◆ SpyExtractRunModule()

sistrip::SpyExtractRunModule::SpyExtractRunModule ( const edm::ParameterSet iConfig)
explicit

Definition at line 73 of file SiStripSpyExtractRunModule.cc.

74  : fileName_(iConfig.getParameter<std::string>("OutputTextFile")),
75  runTag_(iConfig.getParameter<edm::InputTag>("RunNumberTag")),
76  currentRun_(0),
77  previousRun_(0),
78  errCounter_(0) {
79  runToken_ = consumes<uint32_t>(runTag_);
80  }

References runTag_, and runToken_.

◆ ~SpyExtractRunModule()

sistrip::SpyExtractRunModule::~SpyExtractRunModule ( )
override

Definition at line 82 of file SiStripSpyExtractRunModule.cc.

82 {}

Member Function Documentation

◆ analyze()

void sistrip::SpyExtractRunModule::analyze ( const edm::Event aEvt,
const edm::EventSetup aSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 90 of file SiStripSpyExtractRunModule.cc.

90  {
91  static bool lFirstEvent = true;
93  aEvt.getByToken(runToken_, lRun);
94 
95  const bool isUpdated = updateRun(*lRun);
96 
97  if (isUpdated && !lFirstEvent) {
98  edm::LogError("SpyExtractRunModule")
99  << " -- Run number changed for event : " << aEvt.id().event() << " (id().run() = " << aEvt.id().run()
100  << ") from " << previousRun_ << " to " << currentRun_ << std::endl;
101  }
102 
103  lFirstEvent = false;
104  }

References currentRun_, edm::EventID::event(), edm::Event::getByToken(), edm::EventBase::id(), previousRun_, edm::EventID::run(), runToken_, and updateRun().

◆ beginJob()

void sistrip::SpyExtractRunModule::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file SiStripSpyExtractRunModule.cc.

84  {
85  currentRun_ = 0;
86  previousRun_ = 0;
87  errCounter_ = 0;
88  }

References currentRun_, errCounter_, and previousRun_.

◆ endJob()

void sistrip::SpyExtractRunModule::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 106 of file SiStripSpyExtractRunModule.cc.

106  {
107  //save global run number in text file in local directory
108  //output loginfo with number of errors
109  //or throw exception ?
110 
111  if (errCounter_ == 1) {
112  edm::LogInfo("SiStripSpyExtractRun")
113  << " -- Writting run number " << currentRun_ << " into file " << fileName_ << std::endl;
114  std::ofstream lOutFile;
115  lOutFile.open(fileName_.c_str(), std::ios::out);
116  if (!lOutFile.is_open()) {
117  edm::LogError("SiStripSpyExtractRun")
118  << " -- Cannot open file : " << fileName_ << " for writting run number " << currentRun_ << std::endl;
119  } else {
120  lOutFile << currentRun_ << std::endl;
121  lOutFile.close();
122  }
123 
124  } else {
125  edm::LogError("SiStripSpyExtractRun")
126  << " -- Number of times the run number changed in this job = " << errCounter_
127  << ", currentRun = " << currentRun_ << ", previousRun = " << previousRun_ << std::endl;
128  }
129  }

References currentRun_, errCounter_, fileName_, MillePedeFileConverter_cfg::out, and previousRun_.

◆ updateRun()

const bool sistrip::SpyExtractRunModule::updateRun ( const uint32_t  aRun)
private

Definition at line 131 of file SiStripSpyExtractRunModule.cc.

131  {
132  if (aRun != currentRun_) {
134  currentRun_ = aRun;
135  errCounter_++;
136  return true;
137  }
138  return false;
139  }

References currentRun_, errCounter_, and previousRun_.

Referenced by analyze().

Member Data Documentation

◆ currentRun_

uint32_t sistrip::SpyExtractRunModule::currentRun_
private

Definition at line 57 of file SiStripSpyExtractRunModule.cc.

Referenced by analyze(), beginJob(), endJob(), and updateRun().

◆ errCounter_

uint32_t sistrip::SpyExtractRunModule::errCounter_
private

Definition at line 61 of file SiStripSpyExtractRunModule.cc.

Referenced by beginJob(), endJob(), and updateRun().

◆ fileName_

std::string sistrip::SpyExtractRunModule::fileName_
private

Definition at line 50 of file SiStripSpyExtractRunModule.cc.

Referenced by endJob().

◆ previousRun_

uint32_t sistrip::SpyExtractRunModule::previousRun_
private

Definition at line 58 of file SiStripSpyExtractRunModule.cc.

Referenced by analyze(), beginJob(), endJob(), and updateRun().

◆ runTag_

edm::InputTag sistrip::SpyExtractRunModule::runTag_
private

Definition at line 53 of file SiStripSpyExtractRunModule.cc.

Referenced by SpyExtractRunModule().

◆ runToken_

edm::EDGetTokenT<uint32_t> sistrip::SpyExtractRunModule::runToken_
private

Definition at line 54 of file SiStripSpyExtractRunModule.cc.

Referenced by analyze(), and SpyExtractRunModule().

sistrip::SpyExtractRunModule::previousRun_
uint32_t previousRun_
Definition: SiStripSpyExtractRunModule.cc:58
sistrip::SpyExtractRunModule::runTag_
edm::InputTag runTag_
Definition: SiStripSpyExtractRunModule.cc:53
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
sistrip::SpyExtractRunModule::runToken_
edm::EDGetTokenT< uint32_t > runToken_
Definition: SiStripSpyExtractRunModule.cc:54
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
sistrip::SpyExtractRunModule::currentRun_
uint32_t currentRun_
Definition: SiStripSpyExtractRunModule.cc:57
edm::EventID::event
EventNumber_t event() const
Definition: EventID.h:40
sistrip::SpyExtractRunModule::errCounter_
uint32_t errCounter_
Definition: SiStripSpyExtractRunModule.cc:61
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
sistrip::SpyExtractRunModule::fileName_
std::string fileName_
Definition: SiStripSpyExtractRunModule.cc:50
edm::EventBase::id
edm::EventID id() const
Definition: EventBase.h:59
sistrip::SpyExtractRunModule::updateRun
const bool updateRun(const uint32_t aRun)
Definition: SiStripSpyExtractRunModule.cc:131
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::InputTag
Definition: InputTag.h:15