CMS 3D CMS Logo

ESDaqInfoTask.cc
Go to the documentation of this file.
1 #include <iostream>
2 
7 
10 
12 
16 
18 
20 
22 
24 
25 using namespace cms;
26 using namespace edm;
27 using namespace std;
28 
30  dqmStore_ = Service<DQMStore>().operator->();
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 }
55 
56 ESDaqInfoTask::~ESDaqInfoTask() { delete es_mapping_; }
57 
59  char histo[200];
60 
61  if (dqmStore_) {
62  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
63 
64  sprintf(histo, "DAQSummary");
65  meESDaqFraction_ = dqmStore_->bookFloat(histo);
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);
77  meESDaqActive_[i] = dqmStore_->bookFloat(histo);
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 }
99 
101 
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_)
116  meESDaqError_->setBinContent(i, 0.0);
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 }
164 
166  if (meESDaqFraction_)
167  meESDaqFraction_->Reset();
168 
169  for (int i = 0; i < 56; i++) {
170  if (meESDaqActive_[i])
171  meESDaqActive_[i]->Reset();
172  }
173 
174  if (meESDaqActiveMap_)
175  meESDaqActiveMap_->Reset();
176 
177  if (meESDaqError_)
178  meESDaqError_->Reset();
179 }
180 
181 void ESDaqInfoTask::analyze(const Event& e, const EventSetup& c) {}
182 
ESElectronicsMapper.h
FEDNumbering.h
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
RunSummaryRcd.h
ESHandle.h
ESDaqInfoTask::~ESDaqInfoTask
~ESDaqInfoTask() override
Destructor.
Definition: ESDaqInfoTask.cc:56
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm
HLT enums.
Definition: AlignableModifier.h:19
ESDaqInfoTask::beginJob
void beginJob(void) override
BeginJob.
Definition: ESDaqInfoTask.cc:58
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
DQMStore.h
RunInfo::m_fed_in
std::vector< int > m_fed_in
Definition: RunInfo.h:25
ESDaqInfoTask::beginLuminosityBlock
void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
BeginLuminosityBlock.
Definition: ESDaqInfoTask.cc:102
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ESDetId.h
ESDaqInfoTask.h
MakerMacros.h
edm::EventSetup::tryToGet
std::optional< T > tryToGet() const
Definition: EventSetup.h:94
ESElectronicsMapper
Definition: ESElectronicsMapper.h:14
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
edm::ESHandle
Definition: DTSurvey.h:22
ESDaqInfoTask::ESDaqInfoTask
ESDaqInfoTask(const edm::ParameterSet &ps)
Constructor.
Definition: ESDaqInfoTask.cc:29
ESDaqInfoTask::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
Definition: ESDaqInfoTask.cc:181
RunInfoRcd
Definition: RunSummaryRcd.h:26
edm::LogWarning
Definition: MessageLogger.h:141
ESDaqInfoTask::endJob
void endJob(void) override
EndJob.
Definition: ESDaqInfoTask.cc:100
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
edm::Service
Definition: Service.h:30
ESDaqInfoTask::reset
void reset(void)
Reset.
Definition: ESDaqInfoTask.cc:165
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
RunSummary.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
RunInfo.h
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
ESDaqInfoTask
Definition: ESDaqInfoTask.h:11
EventSetup.h
reset
void reset(double vett[256])
Definition: TPedValues.cc:11
edm::Event
Definition: Event.h:73
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37