CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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_
 
edm::ESGetToken< RunInfo,
RunInfoRcd
runInfoToken_
 

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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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  runInfoToken_ = esConsumes<edm::Transition::BeginLuminosityBlock>();
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 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
Log< level::Error, false > LogError
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
Definition: ESDaqInfoTask.h:40
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:49
DQMStore * dqmStore_
Definition: ESDaqInfoTask.h:39
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:46
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 
)
overrideprotectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 180 of file ESDaqInfoTask.cc.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file ESDaqInfoTask.cc.

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

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 * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
int getFEDNumber(const int x, const int y)
Definition: ESDaqInfoTask.h:58
std::string prefixME_
Definition: ESDaqInfoTask.h:41
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:646
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
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:45
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
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 
)
overrideprotectedvirtual

BeginLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 102 of file ESDaqInfoTask.cc.

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

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  const auto& sumFED = runInfoRec->getHandle(runInfoToken_);
121 
122  std::vector<int> FedsInIds = sumFED->m_fed_in;
123 
124  float ESFedCount = 0.;
125 
126  for (unsigned int fedItr = 0; fedItr < FedsInIds.size(); ++fedItr) {
127  int fedID = FedsInIds[fedItr];
128 
129  if (fedID >= ESFedRangeMin_ && fedID <= ESFedRangeMax_) {
130  if (ESOnFed_[fedID - ESFedRangeMin_])
131  ESFedCount++;
132 
133  if (meESDaqActive_[fedID - ESFedRangeMin_])
134  meESDaqActive_[fedID - ESFedRangeMin_]->Fill(1.0);
135 
136  if (meESDaqActiveMap_) {
137  for (int x = 0; x < 80; x++) {
138  for (int y = 0; y < 80; y++) {
139  if (fedID == getFEDNumber(x, y))
140  meESDaqActiveMap_->setBinContent(x + 1, y + 1, 1.0);
141  }
142  }
143  }
144 
145  if (meESDaqFraction_)
146  meESDaqFraction_->Fill(ESFedCount / 40.);
147 
148  if (meESDaqError_) {
149  for (int i = 0; i < 56; i++) {
150  if (ESOnFed_[fedID - ESFedRangeMin_])
151  meESDaqError_->setBinContent(i + 1, 1.0);
152  else
153  meESDaqError_->setBinContent(i + 1, 2.0);
154  }
155  }
156  }
157  }
158 
159  } else {
160  LogWarning("ESDaqInfoTask") << "Cannot find any RunInfoRcd" << endl;
161  }
162 }
bool ESOnFed_[56]
Definition: ESDaqInfoTask.h:56
std::optional< T > tryToGet() const
Definition: EventSetup.h:103
int getFEDNumber(const int x, const int y)
Definition: ESDaqInfoTask.h:58
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:47
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
Definition: ESDaqInfoTask.h:40
void Fill(long long x)
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
Log< level::Warning, false > LogWarning
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 164 of file ESDaqInfoTask.cc.

References mps_fire::i.

164  {
165  if (meESDaqFraction_)
167 
168  for (int i = 0; i < 56; i++) {
169  if (meESDaqActive_[i])
170  meESDaqActive_[i]->Reset();
171  }
172 
173  if (meESDaqActiveMap_)
175 
176  if (meESDaqError_)
177  meESDaqError_->Reset();
178 }
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:47
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
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.

edm::ESGetToken<RunInfo, RunInfoRcd> ESDaqInfoTask::runInfoToken_
private

Definition at line 40 of file ESDaqInfoTask.h.