CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
ESFEDIntegrityTask Class Reference

#include <ESFEDIntegrityTask.h>

Inheritance diagram for ESFEDIntegrityTask:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 ESFEDIntegrityTask (const edm::ParameterSet &ps)
 
virtual ~ESFEDIntegrityTask ()
 
- 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 ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob (void)
 BeginJob. More...
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
void cleanup (void)
 Cleanup. More...
 
void endJob (void)
 EndJob. More...
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 EndRun. More...
 
void reset (void)
 Reset. More...
 
void setup (void)
 Setup. More...
 
- 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)
 

Private Attributes

edm::EDGetTokenT
< ESRawDataCollection
dccCollections_
 
bool debug_
 
DQMStoredqmStore_
 
bool enableCleanup_
 
std::string fedDirName_
 
edm::EDGetTokenT
< FEDRawDataCollection
FEDRawDataCollection_
 
int ievt_
 
bool init_
 
MonitorElementmeESFedsEntries_
 
MonitorElementmeESFedsFatal_
 
MonitorElementmeESFedsNonFatal_
 
bool mergeRuns_
 
std::string prefixME_
 

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

Detailed Description

Definition at line 15 of file ESFEDIntegrityTask.h.

Constructor & Destructor Documentation

ESFEDIntegrityTask::ESFEDIntegrityTask ( const edm::ParameterSet ps)

Definition at line 27 of file ESFEDIntegrityTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and cppFunctionSkipper::operator.

27  {
28 
29  init_ = false;
30 
32 
33  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
34  fedDirName_ = ps.getUntrackedParameter<string>("FEDDirName", "FEDIntegrity");
35  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
36  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
37  debug_ = ps.getUntrackedParameter<bool>("debug", false);
38 
39  dccCollections_ = consumes<ESRawDataCollection>(ps.getParameter<InputTag>("ESDCCCollections"));
40  FEDRawDataCollection_ = consumes<FEDRawDataCollection>(ps.getParameter<edm::InputTag>("FEDRawDataCollection"));
41 
42  meESFedsEntries_ = 0;
43  meESFedsFatal_ = 0;
45 
46 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meESFedsFatal_
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
MonitorElement * meESFedsEntries_
MonitorElement * meESFedsNonFatal_
ESFEDIntegrityTask::~ESFEDIntegrityTask ( )
virtual

Definition at line 48 of file ESFEDIntegrityTask.cc.

48  {
49 
50 }

Member Function Documentation

void ESFEDIntegrityTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 132 of file ESFEDIntegrityTask.cc.

References gather_cfg::cout, FEDRawData::data(), ESDCCHeaderBlock::fedId(), ESDCCHeaderBlock::getBX(), edm::Event::getByToken(), ESDCCHeaderBlock::getDCCErrors(), ESDCCHeaderBlock::getFEChannelStatus(), ESDCCHeaderBlock::getLV1(), ESDCCHeaderBlock::getOptoRX0(), ESDCCHeaderBlock::getOptoRX1(), ESDCCHeaderBlock::getOptoRX2(), ESDCCHeaderBlock::getOrbitNumber(), i, FEDHeader::lvl1ID(), HcalObjRepresent::setup(), and FEDRawData::size().

132  {
133 
134  if ( ! init_ ) this->setup();
135 
136  ievt_++;
137 
138  int gt_L1A = 0;
139  // int gt_OrbitNumber = 0, gt_BX = 0;
140  int esDCC_L1A_MostFreqCounts = 0;
141  int esDCC_BX_MostFreqCounts = 0;
142  int esDCC_OrbitNumber_MostFreqCounts = 0;
143  int gtFedDataSize = 0;
144 
146  Handle<FEDRawDataCollection> allFedRawData;
147 
148  if ( e.getByToken(FEDRawDataCollection_, allFedRawData) ) {
149 
150  // ES FEDs
151  for (int esFED=520; esFED<=575; ++esFED) {
152 
153  const FEDRawData& fedData = allFedRawData->FEDData(esFED);
154  int length = fedData.size()/sizeof(uint64_t);
155 
156  if ( length > 0 )
157  if ( meESFedsEntries_ ) meESFedsEntries_->Fill(esFED);
158  }
159 
160  // GT FED data
161  const FEDRawData& gtFedData = allFedRawData->FEDData(812);
162 
163  gtFedDataSize = gtFedData.size()/sizeof(uint64_t);
164 
165  if ( gtFedDataSize > 0 ) {
166 
167  FEDHeader header(gtFedData.data());
168 
169  gt_L1A = header.lvl1ID();
170  //gt_OrbitNumber = e.orbitNumber();
171  //gt_BX = e.bunchCrossing();
172  } else {
173 
174  map<int, int> esDCC_L1A_FreqMap;
175  map<int, int> esDCC_BX_FreqMap;
176  map<int, int> esDCC_OrbitNumber_FreqMap;
177 
178  if ( e.getByToken(dccCollections_, dccs) ) {
179 
180  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
181  ESDCCHeaderBlock esdcc = (*dccItr);
182 
183  esDCC_L1A_FreqMap[esdcc.getLV1()]++;
184  esDCC_BX_FreqMap[esdcc.getBX()]++;
185  esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()]++;
186 
187  if (esDCC_L1A_FreqMap[esdcc.getLV1()] > esDCC_L1A_MostFreqCounts) {
188  esDCC_L1A_MostFreqCounts = esDCC_L1A_FreqMap[esdcc.getLV1()];
189  gt_L1A = esdcc.getLV1();
190  }
191 
192  if (esDCC_BX_FreqMap[esdcc.getBX()] > esDCC_BX_MostFreqCounts) {
193  esDCC_BX_MostFreqCounts = esDCC_BX_FreqMap[esdcc.getBX()];
194  //gt_BX = esdcc.getBX();
195  }
196 
197  if (esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()] > esDCC_OrbitNumber_MostFreqCounts) {
198  esDCC_OrbitNumber_MostFreqCounts = esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()];
199  //gt_OrbitNumber = esdcc.getOrbitNumber();
200  }
201 
202  }
203  } else {
204  LogWarning("ESFEDIntegrityTask") << "dccCollections not available";
205  }
206 
207  }
208 
209  } else {
210  LogWarning("ESFEDIntegrityTask") << "FEDRawDataCollection not available";
211  }
212 
213  vector<int> fiberStatus;
214  if ( e.getByToken(dccCollections_, dccs) ) {
215  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
216  ESDCCHeaderBlock dcc = (*dccItr);
217 
218  if (dcc.getDCCErrors() > 0) {
219 
220  if ( meESFedsFatal_ ) meESFedsFatal_->Fill(dcc.fedId());
221 
222  } else {
223  if (debug_) cout<<dcc.fedId()<<" "<<dcc.getOptoRX0()<<" "<<dcc.getOptoRX1()<<" "<<dcc.getOptoRX2()<<endl;
224  fiberStatus = dcc.getFEChannelStatus();
225 
226  if (dcc.getOptoRX0() == 128) {
227  meESFedsNonFatal_->Fill(dcc.fedId(), 1./3.);
228  } else if (dcc.getOptoRX0() == 129) {
229  for (unsigned int i=0; i<12; ++i) {
230  if (fiberStatus[i]==8 || fiberStatus[i]==10 || fiberStatus[i]==11 || fiberStatus[i]==12)
231  if ( meESFedsNonFatal_ ) meESFedsNonFatal_->Fill(dcc.fedId(), 1./12.);
232  }
233  }
234  if (dcc.getOptoRX1() == 128) {
235  meESFedsNonFatal_->Fill(dcc.fedId(), 1./3.);
236  } else if (dcc.getOptoRX1() == 129) {
237  for (unsigned int i=12; i<24; ++i) {
238  if (fiberStatus[i]==8 || fiberStatus[i]==10 || fiberStatus[i]==11 || fiberStatus[i]==12)
239  if ( meESFedsNonFatal_ ) meESFedsNonFatal_->Fill(dcc.fedId(), 1./12.);
240  }
241  }
242  if (dcc.getOptoRX2() == 128) {
243  meESFedsNonFatal_->Fill(dcc.fedId(), 1./3.);
244  } else if (dcc.getOptoRX2() == 129){
245  for (unsigned int i=24; i<36; ++i) {
246  if (fiberStatus[i]==8 || fiberStatus[i]==10 || fiberStatus[i]==11 || fiberStatus[i]==12)
247  if ( meESFedsNonFatal_ ) meESFedsNonFatal_->Fill(dcc.fedId(), 1./12.);
248  }
249  }
250  }
251 
252  if (dcc.getLV1() != gt_L1A) meESFedsNonFatal_->Fill(dcc.fedId());
253  //if (dcc.getBX() != gt_BX) meESFedsNonFatal_->Fill(dcc.fedId());
254  //if (dcc.getOrbitNumber() != gt_OrbitNumber) meESFedsNonFatal_->Fill(dcc.fedId());
255  }
256  }
257 
258  //for (ESLocalRawDataCollection::const_iterator kItr = kchips->begin(); kItr != kchips->end(); ++kItr) {
259 
260  //ESKCHIPBlock kchip = (*kItr);
261 
262  //Int_t nErr = 0;
263  //if (kchip.getFlag1() > 0) nErr++;
264  //if (kchip.getFlag2() > 0) nErr++;
265  //if (kchip.getBC() != kchip.getOptoBC()) nErr++;
266  //if (kchip.getEC() != kchip.getOptoEC()) nErr++;
267  //if (nErr>0) meESFedsNonFatal_->Fill(dcc.fedId());
268  //}
269 
270 }
int i
Definition: DBlmapReader.cc:9
int getLV1() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< ESDCCHeaderBlock >::const_iterator const_iterator
int getOptoRX0() const
int getOptoRX1() const
MonitorElement * meESFedsFatal_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const std::vector< int > & getFEChannelStatus() const
void Fill(long long x)
void setup(void)
Setup.
int getBX() const
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
int getOrbitNumber() const
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
unsigned long long uint64_t
Definition: Time.h:15
int getDCCErrors() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
tuple cout
Definition: gather_cfg.py:121
const int fedId() const
int lvl1ID()
Level-1 event number generated by the TTC system.
Definition: FEDHeader.cc:20
int getOptoRX2() const
MonitorElement * meESFedsEntries_
MonitorElement * meESFedsNonFatal_
void ESFEDIntegrityTask::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file ESFEDIntegrityTask.cc.

52  {
53 
54  ievt_ = 0;
55 
56  if ( dqmStore_ ) {
59  }
60 
61 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2730
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void ESFEDIntegrityTask::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file ESFEDIntegrityTask.cc.

References reset().

63  {
64 
65  if ( ! mergeRuns_ ) this->reset();
66 
67 }
void reset(void)
Reset.
void ESFEDIntegrityTask::cleanup ( void  )
protected

Cleanup.

Definition at line 102 of file ESFEDIntegrityTask.cc.

102  {
103 
104  if ( ! init_ ) return;
105 
106  if ( dqmStore_ ) {
108 
110  meESFedsEntries_ = 0;
111 
113  meESFedsFatal_ = 0;
114 
116  meESFedsNonFatal_ = 0;
117 
118  }
119 
120  init_ = false;
121 
122 }
const std::string & getName(void) const
get name of ME
MonitorElement * meESFedsFatal_
void removeElement(const std::string &name)
Definition: DQMStore.cc:2772
MonitorElement * meESFedsEntries_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
MonitorElement * meESFedsNonFatal_
void ESFEDIntegrityTask::endJob ( void  )
protectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file ESFEDIntegrityTask.cc.

References edm::cleanup().

124  {
125 
126  LogInfo("ESFEDIntegrityTask") << "analyzed " << ievt_ << " events";
127 
128  if ( enableCleanup_ ) this->cleanup();
129 
130 }
void cleanup(void)
Cleanup.
void ESFEDIntegrityTask::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file ESFEDIntegrityTask.cc.

69  {
70 
71 }
void ESFEDIntegrityTask::reset ( void  )
protected

Reset.

Definition at line 73 of file ESFEDIntegrityTask.cc.

73  {
74 
78 
79 }
MonitorElement * meESFedsFatal_
MonitorElement * meESFedsEntries_
void Reset(void)
reset ME (ie. contents, errors, etc)
MonitorElement * meESFedsNonFatal_
void ESFEDIntegrityTask::setup ( void  )
protected

Setup.

Definition at line 81 of file ESFEDIntegrityTask.cc.

References timingPdfMaker::histo.

81  {
82 
83  init_ = true;
84 
85  char histo[200];
86 
87  if ( dqmStore_ ) {
89 
90  sprintf(histo, "FEDEntries");
91  meESFedsEntries_ = dqmStore_->book1D(histo, histo, 56, 520, 576);
92 
93  sprintf(histo, "FEDFatal");
94  meESFedsFatal_ = dqmStore_->book1D(histo, histo, 56, 520, 576);
95 
96  sprintf(histo, "FEDNonFatal");
97  meESFedsNonFatal_ = dqmStore_->book1D(histo, histo, 56, 520, 576);
98  }
99 
100 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
MonitorElement * meESFedsFatal_
MonitorElement * meESFedsEntries_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
MonitorElement * meESFedsNonFatal_

Member Data Documentation

edm::EDGetTokenT<ESRawDataCollection> ESFEDIntegrityTask::dccCollections_
private

Definition at line 60 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::debug_
private

Definition at line 58 of file ESFEDIntegrityTask.h.

DQMStore* ESFEDIntegrityTask::dqmStore_
private

Definition at line 52 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::enableCleanup_
private

Definition at line 56 of file ESFEDIntegrityTask.h.

std::string ESFEDIntegrityTask::fedDirName_
private

Definition at line 55 of file ESFEDIntegrityTask.h.

edm::EDGetTokenT<FEDRawDataCollection> ESFEDIntegrityTask::FEDRawDataCollection_
private

Definition at line 61 of file ESFEDIntegrityTask.h.

int ESFEDIntegrityTask::ievt_
private

Definition at line 50 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::init_
private

Definition at line 67 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsEntries_
private

Definition at line 63 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsFatal_
private

Definition at line 64 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsNonFatal_
private

Definition at line 65 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::mergeRuns_
private

Definition at line 57 of file ESFEDIntegrityTask.h.

std::string ESFEDIntegrityTask::prefixME_
private

Definition at line 54 of file ESFEDIntegrityTask.h.