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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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.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::auto_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: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 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().