CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
sistrip::SpyIdentifyRunsModule Class Reference
Inheritance diagram for sistrip::SpyIdentifyRunsModule:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SpyIdentifyRunsModule (const edm::ParameterSet &)
 
 ~SpyIdentifyRunsModule () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
void writeRunInFile (const unsigned int aRunNumber)
 

Private Attributes

std::string fileName_
 
std::ofstream outFile_
 
uint32_t prevRun_
 
edm::InputTag srcTag_
 
edm::EDGetTokenT< FEDRawDataCollectionsrcToken_
 

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 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 37 of file SiStripSpyIdentifyRuns.cc.

Constructor & Destructor Documentation

◆ SpyIdentifyRunsModule()

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

Definition at line 69 of file SiStripSpyIdentifyRuns.cc.

References srcTag_, and srcToken_.

70  : fileName_(iConfig.getParameter<std::string>("OutputTextFile")),
71  srcTag_(iConfig.getParameter<edm::InputTag>("InputProductLabel")),
72  prevRun_(0) {
73  srcToken_ = consumes<FEDRawDataCollection>(srcTag_);
74  }
edm::EDGetTokenT< FEDRawDataCollection > srcToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

◆ ~SpyIdentifyRunsModule()

sistrip::SpyIdentifyRunsModule::~SpyIdentifyRunsModule ( )
override

Definition at line 76 of file SiStripSpyIdentifyRuns.cc.

76 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 90 of file SiStripSpyIdentifyRuns.cc.

References edmScanValgrind::buffer, sistrip::EXPECT_SPY, FEDRawDataCollection::FEDData(), edm::Event::getByToken(), edm::EventBase::id(), input, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, sistrip::preconstructCheckFEDSpyBuffer(), prevRun_, edm::EventID::run(), srcToken_, sistrip::SUCCESS, and writeRunInFile().

90  {
91  //static bool lFirstEvent = true;
92  //if (!lFirstEvent) return;
93  uint32_t lRunNum = aEvt.id().run();
94  if (lRunNum == prevRun_)
95  return;
96 
98  aEvt.getByToken(srcToken_, lHandle);
99  const FEDRawDataCollection& buffers = *lHandle;
100 
101  for (unsigned int iFed(FEDNumbering::MINSiStripFEDID); iFed <= FEDNumbering::MAXSiStripFEDID; iFed++) {
102  //retrieve FED raw data for given FED
103  const FEDRawData& input = buffers.FEDData(static_cast<int>(iFed));
104  //check on FEDRawData pointer and size
105  if (!input.data() || !input.size())
106  continue;
107  //construct FEDBuffer
108  const auto st_buffer = preconstructCheckFEDSpyBuffer(input);
109  if (sistrip::FEDBufferStatusCode::SUCCESS != st_buffer) {
110  edm::LogWarning("SiStripSpyIdentifyRuns")
111  << "Exception caught when creating FEDSpyBuffer object for FED " << iFed << ": "
112  << "An exception of category 'FEDBuffer' occurred.\n"
113  << st_buffer;
115  break;
116  }
118  edm::LogWarning("SiStripSpyIdentifyRuns") << " -- this is a spy file, run " << lRunNum << std::endl;
119  writeRunInFile(lRunNum);
120  break;
121  }
122  //lFirstEvent = false;
123  prevRun_ = lRunNum;
124  }
edm::EDGetTokenT< FEDRawDataCollection > srcToken_
FEDBufferStatusCode preconstructCheckFEDSpyBuffer(const FEDRawData &fedBuffer)
void writeRunInFile(const unsigned int aRunNumber)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
static std::string const input
Definition: EdmProvDump.cc:50
edm::EventID id() const
Definition: EventBase.h:63
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
RunNumber_t run() const
Definition: EventID.h:38
Log< level::Warning, false > LogWarning

◆ beginJob()

void sistrip::SpyIdentifyRunsModule::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 78 of file SiStripSpyIdentifyRuns.cc.

References fileName_, MillePedeFileConverter_cfg::out, and outFile_.

78  {
79  outFile_.open(fileName_.c_str(), std::ios::out);
80  if (!outFile_.is_open()) {
81  edm::LogError("SiStripSpyIdentifyRuns")
82  << " -- Cannot open file : " << fileName_ << " for writting." << std::endl;
83  edm::LogInfo("SiStripSpyIdentifyRuns") << " *** SPY RUNS *** " << std::endl;
84 
85  } else {
86  outFile_ << " *** SPY RUNS *** " << std::endl;
87  }
88  }
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo

◆ endJob()

void sistrip::SpyIdentifyRunsModule::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 134 of file SiStripSpyIdentifyRuns.cc.

References outFile_.

134  {
135  //save global run number in text file in local directory
136  //output loginfo with number of errors
137  //or throw exception ?
138  if (outFile_.is_open())
139  outFile_.close();
140  }

◆ writeRunInFile()

void sistrip::SpyIdentifyRunsModule::writeRunInFile ( const unsigned int  aRunNumber)
private

Definition at line 126 of file SiStripSpyIdentifyRuns.cc.

References outFile_.

Referenced by analyze().

126  {
127  if (!outFile_.is_open()) {
128  edm::LogInfo("SiStripSpyIdentifyRuns") << aRunNumber << std::endl;
129  } else {
130  outFile_ << aRunNumber << std::endl;
131  }
132  }
Log< level::Info, false > LogInfo

Member Data Documentation

◆ fileName_

std::string sistrip::SpyIdentifyRunsModule::fileName_
private

Definition at line 51 of file SiStripSpyIdentifyRuns.cc.

Referenced by beginJob().

◆ outFile_

std::ofstream sistrip::SpyIdentifyRunsModule::outFile_
private

Definition at line 52 of file SiStripSpyIdentifyRuns.cc.

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

◆ prevRun_

uint32_t sistrip::SpyIdentifyRunsModule::prevRun_
private

Definition at line 57 of file SiStripSpyIdentifyRuns.cc.

Referenced by analyze().

◆ srcTag_

edm::InputTag sistrip::SpyIdentifyRunsModule::srcTag_
private

Definition at line 55 of file SiStripSpyIdentifyRuns.cc.

Referenced by SpyIdentifyRunsModule().

◆ srcToken_

edm::EDGetTokenT<FEDRawDataCollection> sistrip::SpyIdentifyRunsModule::srcToken_
private

Definition at line 56 of file SiStripSpyIdentifyRuns.cc.

Referenced by analyze(), and SpyIdentifyRunsModule().