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::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SpyExtractRunModule (const edm::ParameterSet &)
 
 ~SpyExtractRunModule () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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.

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::one::EDAnalyzerBase.

Definition at line 90 of file SiStripSpyExtractRunModule.cc.

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

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  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< uint32_t > runToken_
Log< level::Error, false > LogError
edm::EventID id() const
Definition: EventBase.h:59
const bool updateRun(const uint32_t aRun)
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40

◆ beginJob()

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

◆ endJob()

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 106 of file SiStripSpyExtractRunModule.cc.

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

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  }
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo

◆ updateRun()

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

Definition at line 131 of file SiStripSpyExtractRunModule.cc.

References currentRun_, errCounter_, and previousRun_.

Referenced by analyze().

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

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().