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

Public Member Functions

 SpyIdentifyRunsModule (const edm::ParameterSet &)
 
 ~SpyIdentifyRunsModule () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
 
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::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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 37 of file SiStripSpyIdentifyRuns.cc.

Constructor & Destructor Documentation

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
sistrip::SpyIdentifyRunsModule::~SpyIdentifyRunsModule ( )
override

Definition at line 76 of file SiStripSpyIdentifyRuns.cc.

76 {}

Member Function Documentation

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

Definition at line 90 of file SiStripSpyIdentifyRuns.cc.

References edmScanValgrind::buffer, FEDRawData::data(), MillePedeFileConverter_cfg::e, FEDRawDataCollection::FEDData(), edm::Event::getByToken(), edm::EventBase::id(), input, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, prevRun_, edm::EventID::run(), FEDRawData::size(), srcToken_, AlCaHLTBitMon_QueryRunRegistry::string, cms::Exception::what(), 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 
108  //construct FEDBuffer
109  std::unique_ptr<sistrip::FEDSpyBuffer> buffer;
110  try {
111  buffer.reset(new sistrip::FEDSpyBuffer(input.data(), input.size()));
112  } catch (const cms::Exception& e) {
113  edm::LogWarning("SiStripSpyIdentifyRuns")
114  << "Exception caught when creating FEDSpyBuffer object for FED " << iFed << ": " << e.what();
115  //if (!(buffer->readoutMode() == READOUT_MODE_SPY)) break;
116  std::string lErrStr = e.what();
117  if (lErrStr.find("Buffer is not from spy channel") != lErrStr.npos)
118  break;
119  else {
120  writeRunInFile(lRunNum);
121  break;
122  }
123  } // end of buffer reset try.
124  edm::LogWarning("SiStripSpyIdentifyRuns") << " -- this is a spy file, run " << lRunNum << std::endl;
125  writeRunInFile(lRunNum);
126  break;
127  }
128  //lFirstEvent = false;
129  prevRun_ = lRunNum;
130  }
RunNumber_t run() const
Definition: EventID.h:38
edm::EDGetTokenT< FEDRawDataCollection > srcToken_
void writeRunInFile(const unsigned int aRunNumber)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
char const * what() const override
Definition: Exception.cc:103
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
static std::string const input
Definition: EdmProvDump.cc:48
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::EventID id() const
Definition: EventBase.h:59
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
void sistrip::SpyIdentifyRunsModule::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

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  }
void sistrip::SpyIdentifyRunsModule::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 140 of file SiStripSpyIdentifyRuns.cc.

References outFile_.

140  {
141  //save global run number in text file in local directory
142  //output loginfo with number of errors
143  //or throw exception ?
144  if (outFile_.is_open())
145  outFile_.close();
146  }
void sistrip::SpyIdentifyRunsModule::writeRunInFile ( const unsigned int  aRunNumber)
private

Definition at line 132 of file SiStripSpyIdentifyRuns.cc.

References outFile_.

Referenced by analyze().

132  {
133  if (!outFile_.is_open()) {
134  edm::LogInfo("SiStripSpyIdentifyRuns") << aRunNumber << std::endl;
135  } else {
136  outFile_ << aRunNumber << std::endl;
137  }
138  }

Member Data Documentation

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

Definition at line 51 of file SiStripSpyIdentifyRuns.cc.

Referenced by beginJob().

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

Definition at line 52 of file SiStripSpyIdentifyRuns.cc.

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

uint32_t sistrip::SpyIdentifyRunsModule::prevRun_
private

Definition at line 57 of file SiStripSpyIdentifyRuns.cc.

Referenced by analyze().

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

Definition at line 55 of file SiStripSpyIdentifyRuns.cc.

Referenced by SpyIdentifyRunsModule().

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

Definition at line 56 of file SiStripSpyIdentifyRuns.cc.

Referenced by analyze(), and SpyIdentifyRunsModule().