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
 
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)
 
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 ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, 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 38 of file SiStripSpyIdentifyRuns.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file SiStripSpyIdentifyRuns.cc.

References srcTag_, and srcToken_.

75  : fileName_(iConfig.getParameter<std::string>("OutputTextFile")),
76  srcTag_(iConfig.getParameter<edm::InputTag>("InputProductLabel")),
77  prevRun_(0)
78  {
79  srcToken_ = consumes<FEDRawDataCollection>(srcTag_);
80  }
edm::EDGetTokenT< FEDRawDataCollection > srcToken_
T getParameter(std::string const &) const
sistrip::SpyIdentifyRunsModule::~SpyIdentifyRunsModule ( )
override

Definition at line 83 of file SiStripSpyIdentifyRuns.cc.

83  {
84 
85  }

Member Function Documentation

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

Definition at line 101 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().

102  {
103 
104  //static bool lFirstEvent = true;
105  //if (!lFirstEvent) return;
106  uint32_t lRunNum = aEvt.id().run();
107  if (lRunNum == prevRun_) return;
108 
110  aEvt.getByToken( srcToken_, lHandle );
111  const FEDRawDataCollection& buffers = *lHandle;
112 
113  for (unsigned int iFed(FEDNumbering::MINSiStripFEDID);
115  iFed++)
116  {
117 
118  //retrieve FED raw data for given FED
119  const FEDRawData& input = buffers.FEDData( static_cast<int>(iFed) );
120  //check on FEDRawData pointer and size
121  if ( !input.data() ||!input.size() ) continue;
122 
123  //construct FEDBuffer
124  std::unique_ptr<sistrip::FEDSpyBuffer> buffer;
125  try {
126  buffer.reset(new sistrip::FEDSpyBuffer(input.data(),input.size()));
127  } catch (const cms::Exception& e) {
128  edm::LogWarning("SiStripSpyIdentifyRuns")
129  << "Exception caught when creating FEDSpyBuffer object for FED " << iFed << ": " << e.what();
130  //if (!(buffer->readoutMode() == READOUT_MODE_SPY)) break;
131  std::string lErrStr = e.what();
132  if (lErrStr.find("Buffer is not from spy channel")!=lErrStr.npos) break;
133  else {
134  writeRunInFile(lRunNum);
135  break;
136  }
137  } // end of buffer reset try.
138  edm::LogWarning("SiStripSpyIdentifyRuns")
139  << " -- this is a spy file, run " << lRunNum << std::endl;
140  writeRunInFile(lRunNum);
141  break;
142  }
143  //lFirstEvent = false;
144  prevRun_ = lRunNum;
145 
146  }
RunNumber_t run() const
Definition: EventID.h:39
edm::EDGetTokenT< FEDRawDataCollection > srcToken_
void writeRunInFile(const unsigned int aRunNumber)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
char const * what() const override
Definition: Exception.cc:141
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
static std::string const input
Definition: EdmProvDump.cc:45
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::EventID id() const
Definition: EventBase.h:60
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void sistrip::SpyIdentifyRunsModule::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file SiStripSpyIdentifyRuns.cc.

References fileName_, MillePedeFileConverter_cfg::out, and outFile_.

88  {
89  outFile_.open(fileName_.c_str(),std::ios::out);
90  if (!outFile_.is_open()) {
91  edm::LogError("SiStripSpyIdentifyRuns") << " -- Cannot open file : " << fileName_ << " for writting."
92  << std::endl;
93  edm::LogInfo("SiStripSpyIdentifyRuns") << " *** SPY RUNS *** "<< std::endl;
94 
95  }
96  else {
97  outFile_ << " *** SPY RUNS *** " << std::endl;
98  }
99  }
void sistrip::SpyIdentifyRunsModule::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 158 of file SiStripSpyIdentifyRuns.cc.

References outFile_.

158  {
159 
160  //save global run number in text file in local directory
161  //output loginfo with number of errors
162  //or throw exception ?
163  if (outFile_.is_open()) outFile_.close();
164 
165  }
void sistrip::SpyIdentifyRunsModule::writeRunInFile ( const unsigned int  aRunNumber)
private

Definition at line 148 of file SiStripSpyIdentifyRuns.cc.

References outFile_.

Referenced by analyze().

148  {
149  if (!outFile_.is_open()) {
150  edm::LogInfo("SiStripSpyIdentifyRuns") << aRunNumber
151  << std::endl;
152  }
153  else {
154  outFile_ << aRunNumber << std::endl;
155  }
156  }

Member Data Documentation

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

Definition at line 55 of file SiStripSpyIdentifyRuns.cc.

Referenced by beginJob().

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

Definition at line 56 of file SiStripSpyIdentifyRuns.cc.

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

uint32_t sistrip::SpyIdentifyRunsModule::prevRun_
private

Definition at line 61 of file SiStripSpyIdentifyRuns.cc.

Referenced by analyze().

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

Definition at line 59 of file SiStripSpyIdentifyRuns.cc.

Referenced by SpyIdentifyRunsModule().

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

Definition at line 60 of file SiStripSpyIdentifyRuns.cc.

Referenced by analyze(), and SpyIdentifyRunsModule().