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

Public Member Functions

 ESFEDIntegrityTask (const edm::ParameterSet &ps)
 
virtual ~ESFEDIntegrityTask ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

edm::InputTag dccCollections_
 
bool debug_
 
DQMStoredqmStore_
 
bool enableCleanup_
 
std::string fedDirName_
 
edm::InputTag FEDRawDataCollection_
 
int ievt_
 
bool init_
 
edm::InputTag kchipCollections_
 
MonitorElementmeESFedsEntries_
 
MonitorElementmeESFedsFatal_
 
MonitorElementmeESFedsNonFatal_
 
bool mergeRuns_
 
std::string prefixME_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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 12 of file ESFEDIntegrityTask.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file ESFEDIntegrityTask.cc.

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

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

Definition at line 51 of file ESFEDIntegrityTask.cc.

51  {
52 
53 }

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 135 of file ESFEDIntegrityTask.cc.

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

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file ESFEDIntegrityTask.cc.

55  {
56 
57  ievt_ = 0;
58 
59  if ( dqmStore_ ) {
62  }
63 
64 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void ESFEDIntegrityTask::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 66 of file ESFEDIntegrityTask.cc.

References reset().

66  {
67 
68  if ( ! mergeRuns_ ) this->reset();
69 
70 }
void reset(void)
Reset.
void ESFEDIntegrityTask::cleanup ( void  )
protected

Cleanup.

Definition at line 105 of file ESFEDIntegrityTask.cc.

105  {
106 
107  if ( ! init_ ) return;
108 
109  if ( dqmStore_ ) {
111 
113  meESFedsEntries_ = 0;
114 
116  meESFedsFatal_ = 0;
117 
119  meESFedsNonFatal_ = 0;
120 
121  }
122 
123  init_ = false;
124 
125 }
const std::string & getName(void) const
get name of ME
MonitorElement * meESFedsFatal_
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
MonitorElement * meESFedsEntries_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
MonitorElement * meESFedsNonFatal_
void ESFEDIntegrityTask::endJob ( void  )
protectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 127 of file ESFEDIntegrityTask.cc.

References edm::cleanup().

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file ESFEDIntegrityTask.cc.

72  {
73 
74 }
void ESFEDIntegrityTask::reset ( void  )
protected

Reset.

Definition at line 76 of file ESFEDIntegrityTask.cc.

76  {
77 
81 
82 }
MonitorElement * meESFedsFatal_
MonitorElement * meESFedsEntries_
void Reset(void)
reset ME (ie. contents, errors, etc)
MonitorElement * meESFedsNonFatal_
void ESFEDIntegrityTask::setup ( void  )
protected

Setup.

Definition at line 84 of file ESFEDIntegrityTask.cc.

References interpolateCardsSimple::histo.

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

Member Data Documentation

edm::InputTag ESFEDIntegrityTask::dccCollections_
private

Definition at line 57 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::debug_
private

Definition at line 55 of file ESFEDIntegrityTask.h.

DQMStore* ESFEDIntegrityTask::dqmStore_
private

Definition at line 49 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::enableCleanup_
private

Definition at line 53 of file ESFEDIntegrityTask.h.

std::string ESFEDIntegrityTask::fedDirName_
private

Definition at line 52 of file ESFEDIntegrityTask.h.

edm::InputTag ESFEDIntegrityTask::FEDRawDataCollection_
private

Definition at line 59 of file ESFEDIntegrityTask.h.

int ESFEDIntegrityTask::ievt_
private

Definition at line 47 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::init_
private

Definition at line 65 of file ESFEDIntegrityTask.h.

edm::InputTag ESFEDIntegrityTask::kchipCollections_
private

Definition at line 58 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsEntries_
private

Definition at line 61 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsFatal_
private

Definition at line 62 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsNonFatal_
private

Definition at line 63 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::mergeRuns_
private

Definition at line 54 of file ESFEDIntegrityTask.h.

std::string ESFEDIntegrityTask::prefixME_
private

Definition at line 51 of file ESFEDIntegrityTask.h.