CMS 3D CMS Logo

DTDAQInfo.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author G. Cerminara - INFN Torino
5  *
6  * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah ncpp-um-my
7  *
8  */
9 
12 
16 
18 
22 
25 
27 
28 using namespace std;
29 using namespace edm;
30 
32  bookingdone = false;
33  checkUros = pset.getUntrackedParameter<bool>("checkUros", true);
34 }
35 
37 
39  DQMStore::IGetter& igetter,
40  edm::LuminosityBlock const& lumiSeg,
41  edm::EventSetup const& setup) {
42  if (!bookingdone) {
43  // retrieve the mapping
44  setup.get<DTReadOutMappingRcd>().get(mapping);
45 
46  // book the ME
47  // global fraction
48 
49  ibooker.setCurrentFolder("DT/EventInfo");
50 
51  totalDAQFraction = ibooker.bookFloat("DAQSummary");
52  totalDAQFraction->Fill(-1);
53 
54  // map
55  daqMap = ibooker.book2D("DAQSummaryMap", "DT Certification Summary Map", 12, 1, 13, 5, -2, 3);
56  daqMap->setAxisTitle("sector", 1);
57  daqMap->setAxisTitle("wheel", 2);
58 
59  // Wheel "fractions" -> will be 0 or 1
60 
61  ibooker.setCurrentFolder("DT/EventInfo/DAQContents");
62  for (int wheel = -2; wheel != 3; ++wheel) {
63  stringstream streams;
64  streams << "DT_Wheel" << wheel;
65 
66  daqFractions[wheel] = ibooker.bookFloat(streams.str());
67  daqFractions[wheel]->Fill(-1);
68  }
69  bookingdone = true;
70  } //booking done
71 
72  if (auto runInfoRec = setup.tryToGet<RunInfoRcd>()) {
73  // reset to 0
74  totalDAQFraction->Fill(0.);
75  daqFractions[-2]->Fill(0.);
76  daqFractions[-1]->Fill(0.);
77  daqFractions[-0]->Fill(0.);
78  daqFractions[1]->Fill(0.);
79  daqFractions[2]->Fill(0.);
80 
81  daqMap->Reset();
82  //get fed summary information
83  ESHandle<RunInfo> sumFED;
84  runInfoRec->get(sumFED);
85  vector<int> fedInIDs = sumFED->m_fed_in;
86 
87  // the range of DT feds
88  static const int FEDIDmin = FEDNumbering::MINDTFEDID;
89  static const int FEDIDMax = FEDNumbering::MAXDTFEDID;
90 
91  //FIXME for uROS FEDIDs once mapping has been defined
92  if (checkUros) {
93  LogTrace("DQM|DTMonitorClient|DTDAQInfo") << "Checking uROS FEDs as Legacy FEDs" << endl;
94  }
95 
96  // loop on all active feds
97  for (vector<int>::const_iterator fed = fedInIDs.begin(); fed != fedInIDs.end(); ++fed) {
98  // check if the fed is in the DT range
99  if (!(*fed >= FEDIDmin && *fed <= FEDIDMax))
100  continue;
101 
102  // check if the 12 channels are connected to any sector and fill the wheel percentage accordignly
103  int wheel = -99;
104  int sector = -99;
105  int dummy = -99;
106  for (int ros = 1; ros != 13; ++ros) {
107  if (!mapping->readOutToGeometry(*fed, ros, 2, 2, 2, wheel, dummy, sector, dummy, dummy, dummy)) {
108  LogTrace("DQM|DTMonitorClient|DTDAQInfo")
109  << "FED: " << *fed << " Ch: " << ros << " wheel: " << wheel << " Sect: " << sector << endl;
110  daqFractions[wheel]->Fill(daqFractions[wheel]->getFloatValue() + 1. / 12.);
111  totalDAQFraction->Fill(totalDAQFraction->getFloatValue() + 1. / 60.);
112  daqMap->Fill(sector, wheel);
113  }
114  }
115  }
116  } else {
117  LogWarning("DQM|DTMonitorClient|DTDAQInfo") << "*** Warning: record key not found for RunInfoRcd" << endl;
118  totalDAQFraction->Fill(-1);
119  for (int wheel = -2; wheel != 3; ++wheel) {
120  daqFractions[wheel]->Fill(-1);
121  }
122  return;
123  }
124 }
125 
T getUntrackedParameter(std::string const &, T const &) const
std::optional< T > tryToGet() const
Definition: EventSetup.h:94
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: DTDAQInfo.cc:38
MonitorElement * bookFloat(TString const &name)
Definition: DQMStore.cc:233
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
void Fill(long long x)
std::vector< int > m_fed_in
Definition: RunInfo.h:25
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: DTDAQInfo.cc:126
~DTDAQInfo() override
Destructor.
Definition: DTDAQInfo.cc:36
#define LogTrace(id)
HLT enums.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
T get() const
Definition: EventSetup.h:73
DTDAQInfo(const edm::ParameterSet &pset)
Constructor.
Definition: DTDAQInfo.cc:31
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)