CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
21 
23 
25 
26 using namespace std;
27 using namespace edm;
28 
30  : mappingToken_(esConsumes<edm::Transition::EndLuminosityBlock>()),
31  runInfoToken_(esConsumes<edm::Transition::EndLuminosityBlock>()) {
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  mapping = &setup.getData(mappingToken_);
45 
46  // book the ME
47  // global fraction
48 
49  ibooker.setCurrentFolder("DT/EventInfo");
50 
51  totalDAQFraction = ibooker.bookFloat("DAQSummary");
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
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  auto sumFED = runInfoRec->get(runInfoToken_);
84  const vector<int> fedInIDs = sumFED.m_fed_in;
85 
86  // the range of DT feds
87  static const int FEDIDmin = FEDNumbering::MINDTFEDID;
88  static const int FEDIDMax = FEDNumbering::MAXDTFEDID;
89 
90  //FIXME for uROS FEDIDs once mapping has been defined
91  if (checkUros) {
92  LogTrace("DQM|DTMonitorClient|DTDAQInfo") << "Checking uROS FEDs as Legacy FEDs" << endl;
93  }
94 
95  // loop on all active feds
96  for (vector<int>::const_iterator fed = fedInIDs.begin(); fed != fedInIDs.end(); ++fed) {
97  // check if the fed is in the DT range
98  if (!(*fed >= FEDIDmin && *fed <= FEDIDMax))
99  continue;
100 
101  // check if the 12 channels are connected to any sector and fill the wheel percentage accordignly
102  int wheel = -99;
103  int sector = -99;
104  int dummy = -99;
105  for (int ros = 1; ros != 13; ++ros) {
106  if (!mapping->readOutToGeometry(*fed, ros, 2, 2, 2, wheel, dummy, sector, dummy, dummy, dummy)) {
107  LogTrace("DQM|DTMonitorClient|DTDAQInfo")
108  << "FED: " << *fed << " Ch: " << ros << " wheel: " << wheel << " Sect: " << sector << endl;
109  daqFractions[wheel]->Fill(daqFractions[wheel]->getFloatValue() + 1. / 12.);
111  daqMap->Fill(sector, wheel);
112  }
113  }
114  }
115  } else {
116  LogWarning("DQM|DTMonitorClient|DTDAQInfo") << "*** Warning: record key not found for RunInfoRcd" << endl;
117  totalDAQFraction->Fill(-1);
118  for (int wheel = -2; wheel != 3; ++wheel) {
119  daqFractions[wheel]->Fill(-1);
120  }
121  return;
122  }
123 }
124 
T getUntrackedParameter(std::string const &, T const &) const
std::optional< T > tryToGet() const
Definition: EventSetup.h:103
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: DTDAQInfo.cc:38
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
int readOutToGeometry(int dduId, int rosId, int robId, int tdcId, int channelId, DTWireId &wireId) const
transform identifiers
bool checkUros
Definition: DTDAQInfo.h:48
edm::ESGetToken< DTReadOutMapping, DTReadOutMappingRcd > mappingToken_
Definition: DTDAQInfo.h:53
#define LogTrace(id)
const RunInfo * sumFED
Definition: DTDAQInfo.h:57
void Fill(long long x)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
Definition: DTDAQInfo.h:56
std::vector< int > m_fed_in
Definition: RunInfo.h:25
MonitorElement * daqMap
Definition: DTDAQInfo.h:51
Transition
Definition: Transition.h:12
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: DTDAQInfo.cc:125
~DTDAQInfo() override
Destructor.
Definition: DTDAQInfo.cc:36
MonitorElement * totalDAQFraction
Definition: DTDAQInfo.h:50
bool bookingdone
Definition: DTDAQInfo.h:45
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
std::map< int, MonitorElement * > daqFractions
Definition: DTDAQInfo.h:52
virtual double getFloatValue() const
DTDAQInfo(const edm::ParameterSet &pset)
Constructor.
Definition: DTDAQInfo.cc:29
const DTReadOutMapping * mapping
Definition: DTDAQInfo.h:54
Log< level::Warning, false > LogWarning
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)