CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
ESRawDataTask Class Reference

#include <ESRawDataTask.h>

Inheritance diagram for ESRawDataTask:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ESRawDataTask (const edm::ParameterSet &ps)
 
 ~ESRawDataTask () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 Analyze. More...
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 Setup. More...
 
void endJob (void) override
 EndJob. More...
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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< ESRawDataCollectiondccCollections_
 
edm::EDGetTokenT< FEDRawDataCollectionFEDRawDataCollection_
 
int ievt_
 
MonitorElementmeBXDCCErrors_
 
MonitorElementmeBXDiff_
 
MonitorElementmeL1ADCCErrors_
 
MonitorElementmeL1ADiff_
 
MonitorElementmeOrbitNumberDCCErrors_
 
MonitorElementmeOrbitNumberDiff_
 
std::string prefixME_
 
int runNum_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 14 of file ESRawDataTask.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file ESRawDataTask.cc.

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

28  {
29  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
30 
31  FEDRawDataCollection_ = consumes<FEDRawDataCollection>(ps.getParameter<InputTag>("FEDRawDataCollection"));
32  dccCollections_ = consumes<ESRawDataCollection>(ps.getParameter<InputTag>("ESDCCCollections"));
33 
34  ievt_ = 0;
35 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
Definition: ESRawDataTask.h:35
std::string prefixME_
Definition: ESRawDataTask.h:32
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
Definition: ESRawDataTask.h:34
ESRawDataTask::~ESRawDataTask ( )
inlineoverride

Member Function Documentation

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

Analyze.

Definition at line 80 of file ESRawDataTask.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::EventBase::bunchCrossing(), FEDRawData::data(), DEFINE_FWK_MODULE, edm::SortedCollection< T, SORT >::end(), FEDRawDataCollection::FEDData(), ESDCCHeaderBlock::fedId(), ESDCCHeaderBlock::getBX(), edm::Event::getByToken(), ESDCCHeaderBlock::getLV1(), ESDCCHeaderBlock::getOrbitNumber(), RecoTauValidation_cfi::header, edm::EventBase::id(), edm::EventBase::orbitNumber(), edm::EventID::run(), and FEDRawData::size().

Referenced by ~ESRawDataTask().

80  {
81  ievt_++;
82  runNum_ = e.id().run();
83 
84  int gt_L1A = 0, gt_OrbitNumber = 0, gt_BX = 0;
85  int esDCC_L1A_MostFreqCounts = 0;
86  int esDCC_BX_MostFreqCounts = 0;
87  int esDCC_OrbitNumber_MostFreqCounts = 0;
88 
90  Handle<FEDRawDataCollection> allFedRawData;
91 
92  int gtFedDataSize = 0;
93 
94  if (e.getByToken(FEDRawDataCollection_, allFedRawData)) {
95  // GT FED data
96  const FEDRawData& gtFedData = allFedRawData->FEDData(812);
97 
98  gtFedDataSize = gtFedData.size() / sizeof(uint64_t);
99 
100  if (gtFedDataSize > 0) {
101  FEDHeader header(gtFedData.data());
102 
103  gt_L1A = header.lvl1ID();
104  gt_OrbitNumber = e.orbitNumber();
105  gt_BX = e.bunchCrossing();
106  } else {
107  map<int, int> esDCC_L1A_FreqMap;
108  map<int, int> esDCC_BX_FreqMap;
109  map<int, int> esDCC_OrbitNumber_FreqMap;
110 
111  if (e.getByToken(dccCollections_, dccs)) {
112  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
113  ESDCCHeaderBlock esdcc = (*dccItr);
114 
115  esDCC_L1A_FreqMap[esdcc.getLV1()]++;
116  esDCC_BX_FreqMap[esdcc.getBX()]++;
117  esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()]++;
118 
119  if (esDCC_L1A_FreqMap[esdcc.getLV1()] > esDCC_L1A_MostFreqCounts) {
120  esDCC_L1A_MostFreqCounts = esDCC_L1A_FreqMap[esdcc.getLV1()];
121  gt_L1A = esdcc.getLV1();
122  }
123 
124  if (esDCC_BX_FreqMap[esdcc.getBX()] > esDCC_BX_MostFreqCounts) {
125  esDCC_BX_MostFreqCounts = esDCC_BX_FreqMap[esdcc.getBX()];
126  gt_BX = esdcc.getBX();
127  }
128 
129  if (esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()] > esDCC_OrbitNumber_MostFreqCounts) {
130  esDCC_OrbitNumber_MostFreqCounts = esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()];
131  gt_OrbitNumber = esdcc.getOrbitNumber();
132  }
133  }
134  } else {
135  LogWarning("ESRawDataTask") << "dccCollections not available";
136  }
137  }
138  } else {
139  LogWarning("ESRawDataTask") << "FEDRawDataCollection not available";
140  }
141 
142  // DCC
143  vector<int> fiberStatus;
144  if (e.getByToken(dccCollections_, dccs)) {
145  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
146  ESDCCHeaderBlock dcc = (*dccItr);
147 
148  //if (dcc.getRunNumber() != runNum_) {
149  //meRunNumberErrors_->Fill(dcc.fedId());
150  //cout<<"Run # err : "<<dcc.getRunNumber()<<" "<<runNum_<<endl;
151  //}
152 
153  if (dcc.getLV1() != gt_L1A) {
154  meL1ADCCErrors_->Fill(dcc.fedId());
155  //cout<<"L1A err : "<<dcc.getLV1()<<" "<<gt_L1A<<endl;
156  Float_t l1a_diff = dcc.getLV1() - gt_L1A;
157  if (l1a_diff > 100)
158  l1a_diff = 100;
159  else if (l1a_diff < -100)
160  l1a_diff = -100;
161  meL1ADiff_->Fill(l1a_diff);
162  }
163 
164  if (dcc.getBX() != gt_BX) {
165  meBXDCCErrors_->Fill(dcc.fedId());
166  //cout<<"BX err : "<<dcc.getBX()<<" "<<gt_BX<<endl;
167  Float_t bx_diff = dcc.getBX() - gt_BX;
168  if (bx_diff > 100)
169  bx_diff = 100;
170  else if (bx_diff < -100)
171  bx_diff = -100;
172  meBXDiff_->Fill(bx_diff);
173  }
174  if (dcc.getOrbitNumber() != gt_OrbitNumber) {
176  //cout<<"Orbit err : "<<dcc.getOrbitNumber()<<" "<<gt_OrbitNumber<<endl;
177  Float_t orbitnumber_diff = dcc.getOrbitNumber() - gt_OrbitNumber;
178  if (orbitnumber_diff > 100)
179  orbitnumber_diff = 100;
180  else if (orbitnumber_diff < -100)
181  orbitnumber_diff = -100;
182  meOrbitNumberDiff_->Fill(orbitnumber_diff);
183  }
184  }
185  }
186 }
RunNumber_t run() const
Definition: EventID.h:38
MonitorElement * meOrbitNumberDiff_
Definition: ESRawDataTask.h:43
int getLV1() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
MonitorElement * meOrbitNumberDCCErrors_
Definition: ESRawDataTask.h:40
std::vector< T >::const_iterator const_iterator
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
Definition: ESRawDataTask.h:35
int bunchCrossing() const
Definition: EventBase.h:64
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
MonitorElement * meL1ADCCErrors_
Definition: ESRawDataTask.h:38
void Fill(long long x)
int getBX() const
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
MonitorElement * meBXDCCErrors_
Definition: ESRawDataTask.h:39
int getOrbitNumber() const
int orbitNumber() const
Definition: EventBase.h:65
const_iterator end() const
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
Definition: ESRawDataTask.h:34
unsigned long long uint64_t
Definition: Time.h:13
edm::EventID id() const
Definition: EventBase.h:59
MonitorElement * meL1ADiff_
Definition: ESRawDataTask.h:41
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
MonitorElement * meBXDiff_
Definition: ESRawDataTask.h:42
const int fedId() const
const_iterator begin() const
void ESRawDataTask::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Setup.

Implements DQMEDAnalyzer.

Definition at line 37 of file ESRawDataTask.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), timingPdfMaker::histo, dqm::impl::MonitorElement::setAxisTitle(), and dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder().

Referenced by ~ESRawDataTask().

37  {
38  char histo[200];
39 
40  iBooker.setCurrentFolder(prefixME_ + "/ESRawDataTask");
41 
42  //sprintf(histo, "ES run number errors");
43  //meRunNumberErrors_ = iBooker.book1D(histo, histo, 56, 519.5, 575.5);
44  //meRunNumberErrors_->setAxisTitle("ES FED", 1);
45  //meRunNumberErrors_->setAxisTitle("Num of Events", 2);
46 
47  sprintf(histo, "ES L1A DCC errors");
48  meL1ADCCErrors_ = iBooker.book1D(histo, histo, 56, 519.5, 575.5);
49  meL1ADCCErrors_->setAxisTitle("ES FED", 1);
50  meL1ADCCErrors_->setAxisTitle("Num of Events", 2);
51 
52  sprintf(histo, "ES BX DCC errors");
53  meBXDCCErrors_ = iBooker.book1D(histo, histo, 56, 519.5, 575.5);
54  meBXDCCErrors_->setAxisTitle("ES FED", 1);
55  meBXDCCErrors_->setAxisTitle("Num of Events", 2);
56 
57  sprintf(histo, "ES Orbit Number DCC errors");
58  meOrbitNumberDCCErrors_ = iBooker.book1D(histo, histo, 56, 519.5, 575.5);
60  meOrbitNumberDCCErrors_->setAxisTitle("Num of Events", 2);
61 
62  sprintf(histo, "Difference between ES and GT L1A");
63  meL1ADiff_ = iBooker.book1D(histo, histo, 201, -100.5, 100.5);
64  meL1ADiff_->setAxisTitle("ES - GT L1A", 1);
65  meL1ADiff_->setAxisTitle("Num of Events", 2);
66 
67  sprintf(histo, "Difference between ES and GT BX");
68  meBXDiff_ = iBooker.book1D(histo, histo, 201, -100.5, 100.5);
69  meBXDiff_->setAxisTitle("ES - GT BX", 1);
70  meBXDiff_->setAxisTitle("Num of Events", 2);
71 
72  sprintf(histo, "Difference between ES and GT Orbit Number");
73  meOrbitNumberDiff_ = iBooker.book1D(histo, histo, 201, -100.5, 100.5);
74  meOrbitNumberDiff_->setAxisTitle("ES - GT orbit number", 1);
75  meOrbitNumberDiff_->setAxisTitle("Num of Events", 2);
76 }
MonitorElement * meOrbitNumberDiff_
Definition: ESRawDataTask.h:43
MonitorElement * meOrbitNumberDCCErrors_
Definition: ESRawDataTask.h:40
std::string prefixME_
Definition: ESRawDataTask.h:32
MonitorElement * meL1ADCCErrors_
Definition: ESRawDataTask.h:38
MonitorElement * meBXDCCErrors_
Definition: ESRawDataTask.h:39
MonitorElement * meL1ADiff_
Definition: ESRawDataTask.h:41
MonitorElement * meBXDiff_
Definition: ESRawDataTask.h:42
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void ESRawDataTask::endJob ( void  )
overrideprotectedvirtual

EndJob.

Reimplemented from edm::one::EDProducerBase.

Definition at line 78 of file ESRawDataTask.cc.

Referenced by ~ESRawDataTask().

78 { LogInfo("ESRawDataTask") << "analyzed " << ievt_ << " events"; }

Member Data Documentation

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

Definition at line 34 of file ESRawDataTask.h.

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

Definition at line 35 of file ESRawDataTask.h.

int ESRawDataTask::ievt_
private

Definition at line 30 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meBXDCCErrors_
private

Definition at line 39 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meBXDiff_
private

Definition at line 42 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meL1ADCCErrors_
private

Definition at line 38 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meL1ADiff_
private

Definition at line 41 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meOrbitNumberDCCErrors_
private

Definition at line 40 of file ESRawDataTask.h.

MonitorElement* ESRawDataTask::meOrbitNumberDiff_
private

Definition at line 43 of file ESRawDataTask.h.

std::string ESRawDataTask::prefixME_
private

Definition at line 32 of file ESRawDataTask.h.

int ESRawDataTask::runNum_
private

Definition at line 45 of file ESRawDataTask.h.