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
ESRawDataTask Class Reference

#include <ESRawDataTask.h>

Inheritance diagram for ESRawDataTask:
edm::EDAnalyzer

Public Member Functions

 ESRawDataTask (const edm::ParameterSet &ps)
 
virtual ~ESRawDataTask ()
 
- 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_
 
DQMStoredqmStore_
 
bool enableCleanup_
 
edm::InputTag FEDRawDataCollection_
 
int ievt_
 
bool init_
 
MonitorElementmeBXDCCErrors_
 
MonitorElementmeBXDiff_
 
MonitorElementmeL1ADCCErrors_
 
MonitorElementmeL1ADiff_
 
MonitorElementmeOrbitNumberDCCErrors_
 
MonitorElementmeOrbitNumberDiff_
 
bool mergeRuns_
 
std::string prefixME_
 
int runNum_
 

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)
 

Detailed Description

Definition at line 11 of file ESRawDataTask.h.

Constructor & Destructor Documentation

ESRawDataTask::ESRawDataTask ( const edm::ParameterSet ps)

Definition at line 32 of file ESRawDataTask.cc.

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

32  {
33 
34  init_ = false;
35 
37 
38  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
39  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
40  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
41 
42  FEDRawDataCollection_ = ps.getParameter<InputTag>("FEDRawDataCollection");
43  dccCollections_ = ps.getParameter<InputTag>("ESDCCCollections");
44 
45 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag dccCollections_
Definition: ESRawDataTask.h:55
std::string prefixME_
Definition: ESRawDataTask.h:50
DQMStore * dqmStore_
Definition: ESRawDataTask.h:48
edm::InputTag FEDRawDataCollection_
Definition: ESRawDataTask.h:56
ESRawDataTask::~ESRawDataTask ( )
virtual

Definition at line 47 of file ESRawDataTask.cc.

47  {
48 }

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 161 of file ESRawDataTask.cc.

References edm::EventBase::bunchCrossing(), FEDRawData::data(), ESDCCHeaderBlock::fedId(), ESDCCHeaderBlock::getBX(), edm::Event::getByLabel(), ESDCCHeaderBlock::getLV1(), ESDCCHeaderBlock::getOrbitNumber(), edm::EventBase::id(), FEDHeader::lvl1ID(), edm::EventBase::orbitNumber(), edm::EventID::run(), HcalObjRepresent::setup(), and FEDRawData::size().

161  {
162 
163  if ( ! init_ ) this->setup();
164 
165  ievt_++;
166  runNum_ = e.id().run();
167 
168  int gt_L1A = 0, gt_OrbitNumber = 0, gt_BX = 0;
169  int esDCC_L1A_MostFreqCounts = 0;
170  int esDCC_BX_MostFreqCounts = 0;
171  int esDCC_OrbitNumber_MostFreqCounts = 0;
172 
174  Handle<FEDRawDataCollection> allFedRawData;
175 
176  int gtFedDataSize = 0;
177 
178  if ( e.getByLabel(FEDRawDataCollection_, allFedRawData) ) {
179 
180  // GT FED data
181  const FEDRawData& gtFedData = allFedRawData->FEDData(812);
182 
183  gtFedDataSize = gtFedData.size()/sizeof(uint64_t);
184 
185  if ( gtFedDataSize > 0 ) {
186 
187  FEDHeader header(gtFedData.data());
188 
189  gt_L1A = header.lvl1ID();
190  gt_OrbitNumber = e.orbitNumber();
191  gt_BX = e.bunchCrossing();
192  } else {
193 
194  map<int, int> esDCC_L1A_FreqMap;
195  map<int, int> esDCC_BX_FreqMap;
196  map<int, int> esDCC_OrbitNumber_FreqMap;
197 
198  if ( e.getByLabel(dccCollections_, dccs) ) {
199  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
200  ESDCCHeaderBlock esdcc = (*dccItr);
201 
202  esDCC_L1A_FreqMap[esdcc.getLV1()]++;
203  esDCC_BX_FreqMap[esdcc.getBX()]++;
204  esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()]++;
205 
206  if (esDCC_L1A_FreqMap[esdcc.getLV1()] > esDCC_L1A_MostFreqCounts) {
207  esDCC_L1A_MostFreqCounts = esDCC_L1A_FreqMap[esdcc.getLV1()];
208  gt_L1A = esdcc.getLV1();
209  }
210 
211  if (esDCC_BX_FreqMap[esdcc.getBX()] > esDCC_BX_MostFreqCounts) {
212  esDCC_BX_MostFreqCounts = esDCC_BX_FreqMap[esdcc.getBX()];
213  gt_BX = esdcc.getBX();
214  }
215 
216  if (esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()] > esDCC_OrbitNumber_MostFreqCounts) {
217  esDCC_OrbitNumber_MostFreqCounts = esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()];
218  gt_OrbitNumber = esdcc.getOrbitNumber();
219  }
220 
221  }
222  } else {
223  LogWarning("ESRawDataTask") << dccCollections_ << " not available";
224  }
225 
226  }
227  } else {
228  LogWarning("ESRawDataTask") << FEDRawDataCollection_ << " not available";
229  }
230 
231  // DCC
232  vector<int> fiberStatus;
233  if ( e.getByLabel(dccCollections_, dccs) ) {
234 
235  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
236  ESDCCHeaderBlock dcc = (*dccItr);
237 
238  //if (dcc.getRunNumber() != runNum_) {
239  //meRunNumberErrors_->Fill(dcc.fedId());
240  //cout<<"Run # err : "<<dcc.getRunNumber()<<" "<<runNum_<<endl;
241  //}
242 
243  if (dcc.getLV1() != gt_L1A) {
244  meL1ADCCErrors_->Fill(dcc.fedId());
245  //cout<<"L1A err : "<<dcc.getLV1()<<" "<<gt_L1A<<endl;
246  Float_t l1a_diff = dcc.getLV1() - gt_L1A;
247  if (l1a_diff > 100) l1a_diff = 100;
248  else if (l1a_diff < -100) l1a_diff = -100;
249  meL1ADiff_->Fill(l1a_diff);
250  }
251 
252  if (dcc.getBX() != gt_BX) {
253  meBXDCCErrors_->Fill(dcc.fedId());
254  //cout<<"BX err : "<<dcc.getBX()<<" "<<gt_BX<<endl;
255  Float_t bx_diff = dcc.getBX() - gt_BX;
256  if (bx_diff > 100) bx_diff = 100;
257  else if (bx_diff < -100) bx_diff = -100;
258  meBXDiff_->Fill(bx_diff);
259  }
260  if (dcc.getOrbitNumber() != gt_OrbitNumber) {
262  //cout<<"Orbit err : "<<dcc.getOrbitNumber()<<" "<<gt_OrbitNumber<<endl;
263  Float_t orbitnumber_diff = dcc.getOrbitNumber() - gt_OrbitNumber;
264  if (orbitnumber_diff > 100) orbitnumber_diff = 100;
265  else if (orbitnumber_diff < -100) orbitnumber_diff = -100;
266  meOrbitNumberDiff_->Fill(orbitnumber_diff);
267  }
268  }
269  }
270 
271 }
RunNumber_t run() const
Definition: EventID.h:42
MonitorElement * meOrbitNumberDiff_
Definition: ESRawDataTask.h:64
int getLV1() const
MonitorElement * meOrbitNumberDCCErrors_
Definition: ESRawDataTask.h:61
std::vector< T >::const_iterator const_iterator
int bunchCrossing() const
Definition: EventBase.h:62
edm::InputTag dccCollections_
Definition: ESRawDataTask.h:55
void setup(void)
Setup.
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
void Fill(long long x)
MonitorElement * meL1ADCCErrors_
Definition: ESRawDataTask.h:59
int getBX() const
MonitorElement * meBXDCCErrors_
Definition: ESRawDataTask.h:60
int getOrbitNumber() const
int orbitNumber() const
Definition: EventBase.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
unsigned long long uint64_t
Definition: Time.h:15
edm::EventID id() const
Definition: EventBase.h:56
MonitorElement * meL1ADiff_
Definition: ESRawDataTask.h:62
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
MonitorElement * meBXDiff_
Definition: ESRawDataTask.h:63
const int fedId() const
int lvl1ID()
Level-1 event number generated by the TTC system.
Definition: FEDHeader.cc:22
edm::InputTag FEDRawDataCollection_
Definition: ESRawDataTask.h:56
void ESRawDataTask::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 50 of file ESRawDataTask.cc.

50  {
51 
52  ievt_ = 0;
53 
54  if ( dqmStore_ ) {
55  dqmStore_->setCurrentFolder(prefixME_ + "/ESRawDataTask");
56  dqmStore_->rmdir(prefixME_ + "/ESRawDataTask");
57  }
58 
59 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2311
std::string prefixME_
Definition: ESRawDataTask.h:50
DQMStore * dqmStore_
Definition: ESRawDataTask.h:48
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
void ESRawDataTask::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 61 of file ESRawDataTask.cc.

References reset().

61  {
62 
63  if ( ! mergeRuns_ ) this->reset();
64 
65 }
void reset(void)
Reset.
void ESRawDataTask::cleanup ( void  )
protected

Cleanup.

Definition at line 122 of file ESRawDataTask.cc.

122  {
123 
124  if ( ! init_ ) return;
125 
126  if ( dqmStore_ ) {
127  //if ( meRunNumberErrors_ ) dqmStore_->removeElement( meRunNumberErrors_->getName() );
128  //meRunNumberErrors_ = 0;
129 
131  meL1ADCCErrors_ = 0;
132 
134  meBXDCCErrors_ = 0;
135 
138 
140  meL1ADiff_ = 0;
141 
143  meBXDiff_ = 0;
144 
146  meOrbitNumberDiff_ = 0;
147  }
148 
149  init_ = false;
150 
151 }
MonitorElement * meOrbitNumberDiff_
Definition: ESRawDataTask.h:64
const std::string & getName(void) const
get name of ME
MonitorElement * meOrbitNumberDCCErrors_
Definition: ESRawDataTask.h:61
MonitorElement * meL1ADCCErrors_
Definition: ESRawDataTask.h:59
MonitorElement * meBXDCCErrors_
Definition: ESRawDataTask.h:60
void removeElement(const std::string &name)
Definition: DQMStore.cc:2353
DQMStore * dqmStore_
Definition: ESRawDataTask.h:48
MonitorElement * meL1ADiff_
Definition: ESRawDataTask.h:62
MonitorElement * meBXDiff_
Definition: ESRawDataTask.h:63
void ESRawDataTask::endJob ( void  )
protectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 153 of file ESRawDataTask.cc.

References edm::cleanup().

153  {
154 
155  LogInfo("ESRawDataTask") << "analyzed " << ievt_ << " events";
156 
157  if ( enableCleanup_ ) this->cleanup();
158 
159 }
void cleanup(void)
Cleanup.
void ESRawDataTask::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file ESRawDataTask.cc.

67  {
68 
69 }
void ESRawDataTask::reset ( void  )
protected

Reset.

Definition at line 71 of file ESRawDataTask.cc.

71  {
72 
73 }
void ESRawDataTask::setup ( void  )
protected

Setup.

Definition at line 75 of file ESRawDataTask.cc.

References trackerHits::histo.

75  {
76 
77  init_ = true;
78 
79  char histo[200];
80 
81  if (dqmStore_) {
82  dqmStore_->setCurrentFolder(prefixME_ + "/ESRawDataTask");
83 
84  //sprintf(histo, "ES run number errors");
85  //meRunNumberErrors_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
86  //meRunNumberErrors_->setAxisTitle("ES FED", 1);
87  //meRunNumberErrors_->setAxisTitle("Num of Events", 2);
88 
89  sprintf(histo, "ES L1A DCC errors");
90  meL1ADCCErrors_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
91  meL1ADCCErrors_->setAxisTitle("ES FED", 1);
92  meL1ADCCErrors_->setAxisTitle("Num of Events", 2);
93 
94  sprintf(histo, "ES BX DCC errors");
95  meBXDCCErrors_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
96  meBXDCCErrors_->setAxisTitle("ES FED", 1);
97  meBXDCCErrors_->setAxisTitle("Num of Events", 2);
98 
99  sprintf(histo, "ES Orbit Number DCC errors");
100  meOrbitNumberDCCErrors_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
102  meOrbitNumberDCCErrors_->setAxisTitle("Num of Events", 2);
103 
104  sprintf(histo, "Difference between ES and GT L1A");
105  meL1ADiff_ = dqmStore_->book1D(histo, histo, 201, -100.5, 100.5);
106  meL1ADiff_->setAxisTitle("ES - GT L1A", 1);
107  meL1ADiff_->setAxisTitle("Num of Events", 2);
108 
109  sprintf(histo, "Difference between ES and GT BX");
110  meBXDiff_ = dqmStore_->book1D(histo, histo, 201, -100.5, 100.5);
111  meBXDiff_->setAxisTitle("ES - GT BX", 1);
112  meBXDiff_->setAxisTitle("Num of Events", 2);
113 
114  sprintf(histo, "Difference between ES and GT Orbit Number");
115  meOrbitNumberDiff_ = dqmStore_->book1D(histo, histo, 201, -100.5, 100.5);
116  meOrbitNumberDiff_->setAxisTitle("ES - GT orbit number", 1);
117  meOrbitNumberDiff_->setAxisTitle("Num of Events", 2);
118  }
119 
120 }
MonitorElement * meOrbitNumberDiff_
Definition: ESRawDataTask.h:64
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
MonitorElement * meOrbitNumberDCCErrors_
Definition: ESRawDataTask.h:61
std::string prefixME_
Definition: ESRawDataTask.h:50
tuple histo
Definition: trackerHits.py:12
MonitorElement * meL1ADCCErrors_
Definition: ESRawDataTask.h:59
MonitorElement * meBXDCCErrors_
Definition: ESRawDataTask.h:60
DQMStore * dqmStore_
Definition: ESRawDataTask.h:48
MonitorElement * meL1ADiff_
Definition: ESRawDataTask.h:62
MonitorElement * meBXDiff_
Definition: ESRawDataTask.h:63
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232

Member Data Documentation

edm::InputTag ESRawDataTask::dccCollections_
private

Definition at line 55 of file ESRawDataTask.h.

DQMStore* ESRawDataTask::dqmStore_
private

Definition at line 48 of file ESRawDataTask.h.

bool ESRawDataTask::enableCleanup_
private

Definition at line 52 of file ESRawDataTask.h.

edm::InputTag ESRawDataTask::FEDRawDataCollection_
private

Definition at line 56 of file ESRawDataTask.h.

int ESRawDataTask::ievt_
private

Definition at line 46 of file ESRawDataTask.h.

bool ESRawDataTask::init_
private

Definition at line 66 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meBXDCCErrors_
private

Definition at line 60 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meBXDiff_
private

Definition at line 63 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meL1ADCCErrors_
private

Definition at line 59 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meL1ADiff_
private

Definition at line 62 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meOrbitNumberDCCErrors_
private

Definition at line 61 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meOrbitNumberDiff_
private

Definition at line 64 of file ESRawDataTask.h.

bool ESRawDataTask::mergeRuns_
private

Definition at line 53 of file ESRawDataTask.h.

std::string ESRawDataTask::prefixME_
private

Definition at line 50 of file ESRawDataTask.h.

int ESRawDataTask::runNum_
private

Definition at line 67 of file ESRawDataTask.h.