CMS 3D CMS Logo

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

#include <ESDaqInfoTask.h>

Inheritance diagram for ESDaqInfoTask:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 ESDaqInfoTask (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~ESDaqInfoTask () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 beginJob (void) override
 BeginJob. More...
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
 BeginLuminosityBlock. More...
 
void endJob (void) override
 EndJob. More...
 
void reset (void)
 Reset. 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 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 Member Functions

int getFEDNumber (const int x, const int y)
 

Private Attributes

DQMStoredqmStore_
 
ESElectronicsMapperes_mapping_
 
int ESFedRangeMax_
 
int ESFedRangeMin_
 
bool ESOnFed_ [56]
 
MonitorElementmeESDaqActive_ [56]
 
MonitorElementmeESDaqActiveMap_
 
MonitorElementmeESDaqError_
 
MonitorElementmeESDaqFraction_
 
bool mergeRuns_
 
std::string prefixME_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 11 of file ESDaqInfoTask.h.

Member Typedef Documentation

Definition at line 14 of file ESDaqInfoTask.h.

Definition at line 13 of file ESDaqInfoTask.h.

Constructor & Destructor Documentation

ESDaqInfoTask::ESDaqInfoTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 29 of file ESDaqInfoTask.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, and Utilities::operator.

29  {
31 
32  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
33 
34  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
35 
36  ESFedRangeMin_ = ps.getUntrackedParameter<int>("ESFedRangeMin", 520);
37  ESFedRangeMax_ = ps.getUntrackedParameter<int>("ESFedRangeMax", 575);
38 
39  meESDaqFraction_ = nullptr;
40  meESDaqActiveMap_ = nullptr;
41  meESDaqError_ = nullptr;
42 
43  for (int i = 0; i < 56; i++) {
44  meESDaqActive_[i] = nullptr;
45  }
46 
47  if (ps.exists("esMapping")) {
48  edm::ParameterSet esMap = ps.getParameter<edm::ParameterSet>("esMapping");
49  es_mapping_ = new ESElectronicsMapper(esMap);
50  } else {
51  edm::LogError("ESDaqInfoTask") << "preshower mapping pointer not initialized. Temporary.";
52  es_mapping_ = nullptr;
53  }
54 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string prefixME_
Definition: ESDaqInfoTask.h:41
bool exists(std::string const &parameterName) const
checks if a parameter exists
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:47
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:49
DQMStore * dqmStore_
Definition: ESDaqInfoTask.h:39
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:46
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:45
ESElectronicsMapper * es_mapping_
Definition: ESDaqInfoTask.h:54
ESDaqInfoTask::~ESDaqInfoTask ( )
override

Destructor.

Definition at line 56 of file ESDaqInfoTask.cc.

56 { delete es_mapping_; }
ESElectronicsMapper * es_mapping_
Definition: ESDaqInfoTask.h:54

Member Function Documentation

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

Analyze.

Definition at line 181 of file ESDaqInfoTask.cc.

References DEFINE_FWK_MODULE.

181 {}
void ESDaqInfoTask::beginJob ( void  )
overrideprotectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file ESDaqInfoTask.cc.

References timingPdfMaker::histo, and mps_fire::i.

58  {
59  char histo[200];
60 
61  if (dqmStore_) {
62  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
63 
64  sprintf(histo, "DAQSummary");
66  meESDaqFraction_->Fill(0.0);
67 
68  sprintf(histo, "DAQSummaryMap");
69  meESDaqActiveMap_ = dqmStore_->book2D(histo, histo, 80, 0.5, 80.5, 80, 0.5, 80.5);
70  meESDaqActiveMap_->setAxisTitle("Si X", 1);
71  meESDaqActiveMap_->setAxisTitle("Si Y", 2);
72 
73  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/DAQContents");
74 
75  for (int i = 0; i < 56; i++) {
76  sprintf(histo, "EcalPreshower_%d", ESFedRangeMin_ + i);
78  meESDaqActive_[i]->Fill(0.0);
79 
80  ESOnFed_[i] = false;
81  for (int x = 0; x < 80; x++) {
82  for (int y = 0; y < 80; y++) {
83  if (getFEDNumber(x, y) == ESFedRangeMin_ + i) {
84  ESOnFed_[i] = true;
85  break;
86  }
87  }
88  if (ESOnFed_[i] == true)
89  break;
90  }
91  }
92 
93  dqmStore_->setCurrentFolder(prefixME_ + "/ESIntegrityTask");
94  sprintf(histo, "DAQError");
95  meESDaqError_ = dqmStore_->book1D(histo, histo, 56, ESFedRangeMin_ - 0.5, ESFedRangeMax_ + 0.5);
96  meESDaqError_->setAxisTitle("FedID", 1);
97  }
98 }
bool ESOnFed_[56]
Definition: ESDaqInfoTask.h:56
MonitorElement * book2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1178
int getFEDNumber(const int x, const int y)
Definition: ESDaqInfoTask.h:58
std::string prefixME_
Definition: ESDaqInfoTask.h:41
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:47
void Fill(long long x)
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:49
DQMStore * dqmStore_
Definition: ESDaqInfoTask.h:39
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:46
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:639
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:45
MonitorElement * bookFloat(char_string const &name)
Book float.
Definition: DQMStore.cc:1087
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
Definition: DQMStore.cc:1121
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void ESDaqInfoTask::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
overrideprotected

BeginLuminosityBlock.

Definition at line 102 of file ESDaqInfoTask.cc.

References mps_fire::i, RunInfo::m_fed_in, reset(), and edm::EventSetup::tryToGet().

102  {
103  this->reset();
104 
105  for (int x = 0; x < 80; ++x) {
106  for (int y = 0; y < 80; ++y) {
107  if (getFEDNumber(x, y) > 0)
108  meESDaqActiveMap_->setBinContent(x + 1, y + 1, 0.0);
109  else
110  meESDaqActiveMap_->setBinContent(x + 1, y + 1, -1.0);
111  }
112  }
113 
114  for (int i = 0; i < 56; i++) {
115  if (meESDaqError_)
117  }
118 
119  if (auto runInfoRec = iSetup.tryToGet<RunInfoRcd>()) {
120  edm::ESHandle<RunInfo> sumFED;
121  runInfoRec->get(sumFED);
122 
123  std::vector<int> FedsInIds = sumFED->m_fed_in;
124 
125  float ESFedCount = 0.;
126 
127  for (unsigned int fedItr = 0; fedItr < FedsInIds.size(); ++fedItr) {
128  int fedID = FedsInIds[fedItr];
129 
130  if (fedID >= ESFedRangeMin_ && fedID <= ESFedRangeMax_) {
131  if (ESOnFed_[fedID - ESFedRangeMin_])
132  ESFedCount++;
133 
134  if (meESDaqActive_[fedID - ESFedRangeMin_])
135  meESDaqActive_[fedID - ESFedRangeMin_]->Fill(1.0);
136 
137  if (meESDaqActiveMap_) {
138  for (int x = 0; x < 80; x++) {
139  for (int y = 0; y < 80; y++) {
140  if (fedID == getFEDNumber(x, y))
141  meESDaqActiveMap_->setBinContent(x + 1, y + 1, 1.0);
142  }
143  }
144  }
145 
146  if (meESDaqFraction_)
147  meESDaqFraction_->Fill(ESFedCount / 40.);
148 
149  if (meESDaqError_) {
150  for (int i = 0; i < 56; i++) {
151  if (ESOnFed_[fedID - ESFedRangeMin_])
152  meESDaqError_->setBinContent(i + 1, 1.0);
153  else
154  meESDaqError_->setBinContent(i + 1, 2.0);
155  }
156  }
157  }
158  }
159 
160  } else {
161  LogWarning("ESDaqInfoTask") << "Cannot find any RunInfoRcd" << endl;
162  }
163 }
bool ESOnFed_[56]
Definition: ESDaqInfoTask.h:56
std::optional< T > tryToGet() const
Definition: EventSetup.h:94
int getFEDNumber(const int x, const int y)
Definition: ESDaqInfoTask.h:58
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:47
void Fill(long long x)
std::vector< int > m_fed_in
Definition: RunInfo.h:25
void reset(void)
Reset.
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:49
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:46
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:45
void ESDaqInfoTask::endJob ( void  )
overrideprotectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 100 of file ESDaqInfoTask.cc.

100 {}
int ESDaqInfoTask::getFEDNumber ( const int  x,
const int  y 
)
inlineprivate

Definition at line 58 of file ESDaqInfoTask.h.

58  {
59  int iz = (x < 40) ? 1 : 2;
60  int ip = (y >= 40) ? 1 : 2;
61  int ix = (x < 40) ? x : x - 40;
62  int iy = (y < 40) ? y : y - 40;
63  return (*es_mapping_).getFED(iz, ip, ix + 1, iy + 1);
64  }
void ESDaqInfoTask::reset ( void  )
protected

Reset.

Definition at line 165 of file ESDaqInfoTask.cc.

References mps_fire::i.

165  {
166  if (meESDaqFraction_)
168 
169  for (int i = 0; i < 56; i++) {
170  if (meESDaqActive_[i])
171  meESDaqActive_[i]->Reset();
172  }
173 
174  if (meESDaqActiveMap_)
176 
177  if (meESDaqError_)
178  meESDaqError_->Reset();
179 }
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:47
virtual void Reset()
reset ME (ie. contents, errors, etc)
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:49
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:46
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:45

Member Data Documentation

DQMStore* ESDaqInfoTask::dqmStore_
private

Definition at line 39 of file ESDaqInfoTask.h.

ESElectronicsMapper* ESDaqInfoTask::es_mapping_
private

Definition at line 54 of file ESDaqInfoTask.h.

int ESDaqInfoTask::ESFedRangeMax_
private

Definition at line 52 of file ESDaqInfoTask.h.

int ESDaqInfoTask::ESFedRangeMin_
private

Definition at line 51 of file ESDaqInfoTask.h.

bool ESDaqInfoTask::ESOnFed_[56]
private

Definition at line 56 of file ESDaqInfoTask.h.

MonitorElement* ESDaqInfoTask::meESDaqActive_[56]
private

Definition at line 46 of file ESDaqInfoTask.h.

MonitorElement* ESDaqInfoTask::meESDaqActiveMap_
private

Definition at line 47 of file ESDaqInfoTask.h.

MonitorElement* ESDaqInfoTask::meESDaqError_
private

Definition at line 49 of file ESDaqInfoTask.h.

MonitorElement* ESDaqInfoTask::meESDaqFraction_
private

Definition at line 45 of file ESDaqInfoTask.h.

bool ESDaqInfoTask::mergeRuns_
private

Definition at line 43 of file ESDaqInfoTask.h.

std::string ESDaqInfoTask::prefixME_
private

Definition at line 41 of file ESDaqInfoTask.h.