CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- 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
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual 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
< FEDRawDataCollection
srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 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 ( )

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 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 101 of file SiStripSpyIdentifyRuns.cc.

References FEDRawData::data(), alignCSCRings::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.getByLabel( srcTag_, lHandle );
111  aEvt.getByToken( srcToken_, lHandle );
112  const FEDRawDataCollection& buffers = *lHandle;
113 
114  for (unsigned int iFed(FEDNumbering::MINSiStripFEDID);
116  iFed++)
117  {
118 
119  //retrieve FED raw data for given FED
120  const FEDRawData& input = buffers.FEDData( static_cast<int>(iFed) );
121  //check on FEDRawData pointer and size
122  if ( !input.data() ||!input.size() ) continue;
123 
124  //construct FEDBuffer
125  std::auto_ptr<sistrip::FEDSpyBuffer> buffer;
126  try {
127  buffer.reset(new sistrip::FEDSpyBuffer(input.data(),input.size()));
128  } catch (const cms::Exception& e) {
129  edm::LogWarning("SiStripSpyIdentifyRuns")
130  << "Exception caught when creating FEDSpyBuffer object for FED " << iFed << ": " << e.what();
131  //if (!(buffer->readoutMode() == READOUT_MODE_SPY)) break;
132  std::string lErrStr = e.what();
133  if (lErrStr.find("Buffer is not from spy channel")!=lErrStr.npos) break;
134  else {
135  writeRunInFile(lRunNum);
136  break;
137  }
138  } // end of buffer reset try.
139  edm::LogWarning("SiStripSpyIdentifyRuns")
140  << " -- this is a spy file, run " << lRunNum << std::endl;
141  writeRunInFile(lRunNum);
142  break;
143  }
144  //lFirstEvent = false;
145  prevRun_ = lRunNum;
146 
147  }
RunNumber_t run() const
Definition: EventID.h:42
virtual char const * what() const
Definition: Exception.cc:141
edm::EDGetTokenT< FEDRawDataCollection > srcToken_
void writeRunInFile(const unsigned int aRunNumber)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
static std::string const input
Definition: EdmProvDump.cc:44
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::EventID id() const
Definition: EventBase.h:56
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_, dbtoconf::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  }
tuple out
Definition: dbtoconf.py:99
void sistrip::SpyIdentifyRunsModule::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 159 of file SiStripSpyIdentifyRuns.cc.

References outFile_.

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

Definition at line 149 of file SiStripSpyIdentifyRuns.cc.

References outFile_.

Referenced by analyze().

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

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