CMS 3D CMS Logo

DQMDaqInfo.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DQMDaqInfo
4 // Class: DQMDaqInfo
5 //
13 //
14 // Original Author: Ilaria SEGONI
15 // Created: Thu Sep 25 11:17:43 CEST 2008
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 #include <iostream>
22 #include <fstream>
23 
24 // user include files
33 
34 //Run Info
38 
39 //DQM
42 
43 //DataFormats
45 
46 class DQMDaqInfo : public edm::one::EDAnalyzer<> {
47 public:
50  explicit DQMDaqInfo(const edm::ParameterSet&);
51  ~DQMDaqInfo() override = default;
52 
53 private:
54  void beginJob() override;
56  void analyze(const edm::Event&, const edm::EventSetup&) override;
57 
60 
62 
64 
65  std::pair<int, int> PixelRange;
66  std::pair<int, int> TrackerRange;
67  std::pair<int, int> CSCRange;
68  std::pair<int, int> RPCRange;
69  std::pair<int, int> DTRange;
70  std::pair<int, int> HcalRange;
71  std::pair<int, int> ECALBarrRange;
72  std::pair<int, int> ECALEndcapRangeLow;
73  std::pair<int, int> ECALEndcapRangeHigh;
74  std::pair<int, int> L1TRange;
75 
76  float NumberOfFeds[9];
77 };
78 
80  : runInfoToken_{esConsumes<edm::Transition::BeginLuminosityBlock>()} {}
81 
84 
85  if (iSetup.tryToGet<RunInfoRcd>()) {
86  if (auto sumFED = iSetup.getHandle(runInfoToken_)) {
87  //const RunInfo* summaryFED=sumFED.product();
88 
89  std::vector<int> FedsInIds = sumFED->m_fed_in;
90 
91  float FedCount[9] = {0., 0., 0., 0., 0., 0., 0., 0., 0.};
92 
93  for (int fedID : FedsInIds) {
94  if (fedID >= PixelRange.first && fedID <= PixelRange.second)
95  ++FedCount[Pixel];
96  if (fedID >= TrackerRange.first && fedID <= TrackerRange.second)
97  ++FedCount[SiStrip];
98  if (fedID >= CSCRange.first && fedID <= CSCRange.second)
99  ++FedCount[CSC];
100  if (fedID >= RPCRange.first && fedID <= RPCRange.second)
101  ++FedCount[RPC];
102  if (fedID >= DTRange.first && fedID <= DTRange.second)
103  ++FedCount[DT];
104  if (fedID >= HcalRange.first && fedID <= HcalRange.second)
105  ++FedCount[Hcal];
106  if (fedID >= ECALBarrRange.first && fedID <= ECALBarrRange.second)
107  ++FedCount[EcalBarrel];
108  if ((fedID >= ECALEndcapRangeLow.first && fedID <= ECALEndcapRangeLow.second) ||
109  (fedID >= ECALEndcapRangeHigh.first && fedID <= ECALEndcapRangeHigh.second))
110  ++FedCount[EcalEndcap];
111  if (fedID >= L1TRange.first && fedID <= L1TRange.second)
112  ++FedCount[L1T];
113  }
114 
115  for (int detIndex = 0; detIndex < 9; ++detIndex) {
116  DaqFraction[detIndex]->Fill(FedCount[detIndex] / NumberOfFeds[detIndex]);
117  }
118  }
119  } else {
120  for (auto& detIndex : DaqFraction)
121  detIndex->Fill(-1);
122  return;
123  }
124 }
125 
127  dbe_ = nullptr;
129 
130  std::string commonFolder = "/EventInfo/DAQContents";
131  std::string subsystFolder;
132  std::string curentFolder;
133 
134  subsystFolder = "Pixel";
135  curentFolder = subsystFolder + commonFolder;
136  dbe_->setCurrentFolder(curentFolder);
137  DaqFraction[Pixel] = dbe_->bookFloat("PixelDaqFraction");
138 
139  subsystFolder = "SiStrip";
140  curentFolder = subsystFolder + commonFolder;
141  dbe_->setCurrentFolder(curentFolder);
142  DaqFraction[SiStrip] = dbe_->bookFloat("SiStripDaqFraction");
143 
144  subsystFolder = "RPC";
145  curentFolder = subsystFolder + commonFolder;
146  dbe_->setCurrentFolder(curentFolder);
147  DaqFraction[RPC] = dbe_->bookFloat("RPCDaqFraction");
148 
149  subsystFolder = "CSC";
150  curentFolder = subsystFolder + commonFolder;
151  dbe_->setCurrentFolder(curentFolder);
152  DaqFraction[CSC] = dbe_->bookFloat("CSCDaqFraction");
153 
154  subsystFolder = "DT";
155  curentFolder = subsystFolder + commonFolder;
156  dbe_->setCurrentFolder(curentFolder);
157  DaqFraction[DT] = dbe_->bookFloat("DTDaqFraction");
158 
159  subsystFolder = "Hcal";
160  curentFolder = subsystFolder + commonFolder;
161  dbe_->setCurrentFolder(curentFolder);
162  DaqFraction[Hcal] = dbe_->bookFloat("HcalDaqFraction");
163 
164  subsystFolder = "EcalBarrel";
165  curentFolder = subsystFolder + commonFolder;
166  dbe_->setCurrentFolder(curentFolder);
167  DaqFraction[EcalBarrel] = dbe_->bookFloat("EcalBarrDaqFraction");
168 
169  subsystFolder = "EcalEndcap";
170  curentFolder = subsystFolder + commonFolder;
171  dbe_->setCurrentFolder(curentFolder);
172  DaqFraction[EcalEndcap] = dbe_->bookFloat("EcalEndDaqFraction");
173 
174  subsystFolder = "L1T";
175  curentFolder = subsystFolder + commonFolder;
176  dbe_->setCurrentFolder(curentFolder);
177  DaqFraction[L1T] = dbe_->bookFloat("L1TDaqFraction");
178 
185  RPCRange.first = 790;
186  RPCRange.second = 792;
187  DTRange.first = 770;
188  DTRange.second = 774;
193  ECALBarrRange.first = 610;
194  ECALBarrRange.second = 645;
195  ECALEndcapRangeLow.first = 601;
196  ECALEndcapRangeLow.second = 609;
197  ECALEndcapRangeHigh.first = 646;
198  ECALEndcapRangeHigh.second = 654;
199 
200  NumberOfFeds[Pixel] = PixelRange.second - PixelRange.first + 1;
201  NumberOfFeds[SiStrip] = TrackerRange.second - TrackerRange.first + 1;
202  NumberOfFeds[CSC] = CSCRange.second - CSCRange.first + 1;
203  NumberOfFeds[RPC] = RPCRange.second - RPCRange.first + 1;
204  NumberOfFeds[DT] = DTRange.second - DTRange.first + 1;
205  NumberOfFeds[Hcal] = HcalRange.second - HcalRange.first + 1;
206  NumberOfFeds[EcalBarrel] = ECALBarrRange.second - ECALBarrRange.first + 1;
208  (ECALEndcapRangeHigh.second - ECALEndcapRangeHigh.first + 1);
209  NumberOfFeds[L1T] = L1TRange.second - L1TRange.first + 1;
210 }
211 
212 void DQMDaqInfo::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {}
213 
std::pair< int, int > DTRange
Definition: DQMDaqInfo.cc:69
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
dqm::legacy::DQMStore DQMStore
Definition: DQMDaqInfo.cc:48
void beginJob() override
Definition: DQMDaqInfo.cc:126
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:646
std::optional< T > tryToGet() const
Definition: EventSetup.h:103
float NumberOfFeds[9]
Definition: DQMDaqInfo.cc:76
MonitorElement * DaqFraction[9]
Definition: DQMDaqInfo.cc:63
std::pair< int, int > RPCRange
Definition: DQMDaqInfo.cc:68
void Fill(long long x)
DQMDaqInfo(const edm::ParameterSet &)
Definition: DQMDaqInfo.cc:79
DQMStore * dbe_
Definition: DQMDaqInfo.cc:59
int iEvent
Definition: GenABIO.cc:224
std::pair< int, int > TrackerRange
Definition: DQMDaqInfo.cc:66
std::pair< int, int > CSCRange
Definition: DQMDaqInfo.cc:67
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::pair< int, int > ECALEndcapRangeHigh
Definition: DQMDaqInfo.cc:73
std::pair< int, int > PixelRange
Definition: DQMDaqInfo.cc:65
std::pair< int, int > ECALBarrRange
Definition: DQMDaqInfo.cc:71
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
std::pair< int, int > L1TRange
Definition: DQMDaqInfo.cc:74
std::pair< int, int > ECALEndcapRangeLow
Definition: DQMDaqInfo.cc:72
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DQMDaqInfo.cc:212
~DQMDaqInfo() override=default
std::pair< int, int > HcalRange
Definition: DQMDaqInfo.cc:70
dqm::legacy::MonitorElement MonitorElement
Definition: DQMDaqInfo.cc:49
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
Definition: DQMDaqInfo.cc:82
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
Definition: DQMDaqInfo.cc:58
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:121