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 edm::EDConsumerBase

Public Member Functions

 ESRawDataTask (const edm::ParameterSet &ps)
 
virtual ~ESRawDataTask ()
 
- 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_
 
DQMStoredqmStore_
 
bool enableCleanup_
 
edm::EDGetTokenT
< FEDRawDataCollection
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
 
- 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 14 of file ESRawDataTask.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file ESRawDataTask.cc.

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

30  {
31 
32  init_ = false;
33 
35 
36  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
37  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
38  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
39 
40  FEDRawDataCollection_ = consumes<FEDRawDataCollection>(ps.getParameter<InputTag>("FEDRawDataCollection"));
41  dccCollections_ = consumes<ESRawDataCollection>(ps.getParameter<InputTag>("ESDCCCollections"));
42 
43 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
Definition: ESRawDataTask.h:59
std::string prefixME_
Definition: ESRawDataTask.h:53
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
Definition: ESRawDataTask.h:58
DQMStore * dqmStore_
Definition: ESRawDataTask.h:51
ESRawDataTask::~ESRawDataTask ( )
virtual

Definition at line 45 of file ESRawDataTask.cc.

45  {
46 }

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 159 of file ESRawDataTask.cc.

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

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file ESRawDataTask.cc.

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file ESRawDataTask.cc.

References reset().

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

Cleanup.

Definition at line 120 of file ESRawDataTask.cc.

120  {
121 
122  if ( ! init_ ) return;
123 
124  if ( dqmStore_ ) {
125  //if ( meRunNumberErrors_ ) dqmStore_->removeElement( meRunNumberErrors_->getName() );
126  //meRunNumberErrors_ = 0;
127 
129  meL1ADCCErrors_ = 0;
130 
132  meBXDCCErrors_ = 0;
133 
136 
138  meL1ADiff_ = 0;
139 
141  meBXDiff_ = 0;
142 
144  meOrbitNumberDiff_ = 0;
145  }
146 
147  init_ = false;
148 
149 }
MonitorElement * meOrbitNumberDiff_
Definition: ESRawDataTask.h:67
const std::string & getName(void) const
get name of ME
MonitorElement * meOrbitNumberDCCErrors_
Definition: ESRawDataTask.h:64
MonitorElement * meL1ADCCErrors_
Definition: ESRawDataTask.h:62
MonitorElement * meBXDCCErrors_
Definition: ESRawDataTask.h:63
void removeElement(const std::string &name)
Definition: DQMStore.cc:2772
DQMStore * dqmStore_
Definition: ESRawDataTask.h:51
MonitorElement * meL1ADiff_
Definition: ESRawDataTask.h:65
MonitorElement * meBXDiff_
Definition: ESRawDataTask.h:66
void ESRawDataTask::endJob ( void  )
protectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 151 of file ESRawDataTask.cc.

References edm::cleanup().

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file ESRawDataTask.cc.

65  {
66 
67 }
void ESRawDataTask::reset ( void  )
protected

Reset.

Definition at line 69 of file ESRawDataTask.cc.

69  {
70 
71 }
void ESRawDataTask::setup ( void  )
protected

Setup.

Definition at line 73 of file ESRawDataTask.cc.

References timingPdfMaker::histo.

73  {
74 
75  init_ = true;
76 
77  char histo[200];
78 
79  if (dqmStore_) {
80  dqmStore_->setCurrentFolder(prefixME_ + "/ESRawDataTask");
81 
82  //sprintf(histo, "ES run number errors");
83  //meRunNumberErrors_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
84  //meRunNumberErrors_->setAxisTitle("ES FED", 1);
85  //meRunNumberErrors_->setAxisTitle("Num of Events", 2);
86 
87  sprintf(histo, "ES L1A DCC errors");
88  meL1ADCCErrors_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
89  meL1ADCCErrors_->setAxisTitle("ES FED", 1);
90  meL1ADCCErrors_->setAxisTitle("Num of Events", 2);
91 
92  sprintf(histo, "ES BX DCC errors");
93  meBXDCCErrors_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
94  meBXDCCErrors_->setAxisTitle("ES FED", 1);
95  meBXDCCErrors_->setAxisTitle("Num of Events", 2);
96 
97  sprintf(histo, "ES Orbit Number DCC errors");
98  meOrbitNumberDCCErrors_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
100  meOrbitNumberDCCErrors_->setAxisTitle("Num of Events", 2);
101 
102  sprintf(histo, "Difference between ES and GT L1A");
103  meL1ADiff_ = dqmStore_->book1D(histo, histo, 201, -100.5, 100.5);
104  meL1ADiff_->setAxisTitle("ES - GT L1A", 1);
105  meL1ADiff_->setAxisTitle("Num of Events", 2);
106 
107  sprintf(histo, "Difference between ES and GT BX");
108  meBXDiff_ = dqmStore_->book1D(histo, histo, 201, -100.5, 100.5);
109  meBXDiff_->setAxisTitle("ES - GT BX", 1);
110  meBXDiff_->setAxisTitle("Num of Events", 2);
111 
112  sprintf(histo, "Difference between ES and GT Orbit Number");
113  meOrbitNumberDiff_ = dqmStore_->book1D(histo, histo, 201, -100.5, 100.5);
114  meOrbitNumberDiff_->setAxisTitle("ES - GT orbit number", 1);
115  meOrbitNumberDiff_->setAxisTitle("Num of Events", 2);
116  }
117 
118 }
MonitorElement * meOrbitNumberDiff_
Definition: ESRawDataTask.h:67
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
MonitorElement * meOrbitNumberDCCErrors_
Definition: ESRawDataTask.h:64
std::string prefixME_
Definition: ESRawDataTask.h:53
MonitorElement * meL1ADCCErrors_
Definition: ESRawDataTask.h:62
MonitorElement * meBXDCCErrors_
Definition: ESRawDataTask.h:63
DQMStore * dqmStore_
Definition: ESRawDataTask.h:51
MonitorElement * meL1ADiff_
Definition: ESRawDataTask.h:65
MonitorElement * meBXDiff_
Definition: ESRawDataTask.h:66
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:584

Member Data Documentation

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

Definition at line 58 of file ESRawDataTask.h.

DQMStore* ESRawDataTask::dqmStore_
private

Definition at line 51 of file ESRawDataTask.h.

bool ESRawDataTask::enableCleanup_
private

Definition at line 55 of file ESRawDataTask.h.

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

Definition at line 59 of file ESRawDataTask.h.

int ESRawDataTask::ievt_
private

Definition at line 49 of file ESRawDataTask.h.

bool ESRawDataTask::init_
private

Definition at line 69 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meBXDCCErrors_
private

Definition at line 63 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meBXDiff_
private

Definition at line 66 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meL1ADCCErrors_
private

Definition at line 62 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meL1ADiff_
private

Definition at line 65 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meOrbitNumberDCCErrors_
private

Definition at line 64 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meOrbitNumberDiff_
private

Definition at line 67 of file ESRawDataTask.h.

bool ESRawDataTask::mergeRuns_
private

Definition at line 56 of file ESRawDataTask.h.

std::string ESRawDataTask::prefixME_
private

Definition at line 53 of file ESRawDataTask.h.

int ESRawDataTask::runNum_
private

Definition at line 70 of file ESRawDataTask.h.