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 ()
 
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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 &)
 
- 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 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

Definition at line 35 of file SiStripSpyExtractRunModule.cc.

Constructor & Destructor Documentation

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

Definition at line 77 of file SiStripSpyExtractRunModule.cc.

References runTag_, and runToken_.

sistrip::SpyExtractRunModule::~SpyExtractRunModule ( )
override

Definition at line 88 of file SiStripSpyExtractRunModule.cc.

88  {
89 
90  }

Member Function Documentation

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

Definition at line 100 of file SiStripSpyExtractRunModule.cc.

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

101  {
102 
103  static bool lFirstEvent = true;
105  aEvt.getByToken( runToken_, lRun );
106 
107  const bool isUpdated = updateRun(*lRun);
108 
109  if (isUpdated && !lFirstEvent){
110  edm::LogError("SpyExtractRunModule") << " -- Run number changed for event : " << aEvt.id().event()
111  << " (id().run() = " << aEvt.id().run()
112  << ") from " << previousRun_ << " to " << currentRun_
113  << std::endl;
114  }
115 
116 
117  lFirstEvent = false;
118 
119  }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::EDGetTokenT< uint32_t > runToken_
const bool updateRun(const uint32_t aRun)
edm::EventID id() const
Definition: EventBase.h:60
void sistrip::SpyExtractRunModule::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 92 of file SiStripSpyExtractRunModule.cc.

References currentRun_, errCounter_, and previousRun_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file SiStripSpyExtractRunModule.cc.

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

122  {
123 
124  //save global run number in text file in local directory
125  //output loginfo with number of errors
126  //or throw exception ?
127 
128 
129  if (errCounter_ == 1){
130  edm::LogInfo("SiStripSpyExtractRun") << " -- Writting run number " << currentRun_
131  << " into file " << fileName_
132  << std::endl;
133  std::ofstream lOutFile;
134  lOutFile.open(fileName_.c_str(),std::ios::out);
135  if (!lOutFile.is_open()) {
136  edm::LogError("SiStripSpyExtractRun") << " -- Cannot open file : " << fileName_ << " for writting run number "
137  << currentRun_
138  << std::endl;
139  }
140  else {
141  lOutFile << currentRun_ << std::endl;
142  lOutFile.close();
143  }
144 
145  }
146  else {
147  edm::LogError("SiStripSpyExtractRun") << " -- Number of times the run number changed in this job = " << errCounter_
148  << ", currentRun = " << currentRun_
149  << ", previousRun = " << previousRun_
150  << std::endl;
151  }
152 
153 
154  }
const bool sistrip::SpyExtractRunModule::updateRun ( const uint32_t  aRun)
private

Definition at line 156 of file SiStripSpyExtractRunModule.cc.

References currentRun_, errCounter_, and previousRun_.

Referenced by analyze().

156  {
157  if (aRun != currentRun_){
159  currentRun_ = aRun;
160  errCounter_++;
161  return true;
162  }
163  return false;
164 
165  }

Member Data Documentation

uint32_t sistrip::SpyExtractRunModule::currentRun_
private

Definition at line 60 of file SiStripSpyExtractRunModule.cc.

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

uint32_t sistrip::SpyExtractRunModule::errCounter_
private

Definition at line 64 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 61 of file SiStripSpyExtractRunModule.cc.

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

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

Definition at line 56 of file SiStripSpyExtractRunModule.cc.

Referenced by SpyExtractRunModule().

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

Definition at line 57 of file SiStripSpyExtractRunModule.cc.

Referenced by analyze(), and SpyExtractRunModule().