CMS 3D CMS Logo

DTDCSByLumiSummary.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author C. Battilana - CIEMAT
5  * \author P. Bellan - INFN PD
6  * \author A. Branca = INFN PD
7  */
8 
11 
16 
18 
19 #include <string>
20 
21 using namespace std;
22 using namespace edm;
23 
25 
27 
29 
31  DQMStore::IGetter& igetter,
33  edm::EventSetup const& setup) {
34  if (!bookingdone) {
35  ibooker.setCurrentFolder("DT/EventInfo/DCSContents");
36 
37  globalHVSummary = ibooker.book2D("HVGlbSummary", "HV Status Summary", 1, 1, 13, 5, -2, 3);
38  globalHVSummary->setAxisTitle("Sectors", 1);
39  globalHVSummary->setAxisTitle("Wheel", 2);
40 
41  {
42  auto scope = DQMStore::IBooker::UseLumiScope(ibooker);
43  totalDCSFraction = ibooker.bookFloat("DTDCSSummary");
44  for (int wh = -2; wh <= 2; wh++) {
45  stringstream wheel_str;
46  wheel_str << wh;
47 
48  MonitorElement* FractionWh = ibooker.bookFloat("DT_Wheel" + wheel_str.str());
49 
50  totalDCSFractionWh.push_back(FractionWh);
51  }
52  }
53 
54  globalHVSummary->Reset();
55 
56  // CB LumiFlag marked products are reset on LS boundaries
57  totalDCSFraction->Reset();
58 
59  for (int wh = -2; wh <= 2; wh++) {
60  totalDCSFractionWh[wh + 2]->Reset();
61  }
62  }
63  bookingdone = true;
64 
65  // Get the by lumi product plot from the task
66  int lumiNumber = lumi.id().luminosityBlock();
67 
68  bool null_pointer_histo(false);
69 
70  std::vector<float> wh_activeFrac;
71 
72  for (int wh = -2; wh <= 2; wh++) {
73  stringstream wheel_str;
74  wheel_str << wh;
75 
76  string hActiveUnitsPath = "DT/EventInfo/DCSContents/hActiveUnits" + wheel_str.str();
77 
78  MonitorElement* hActiveUnits = igetter.get(hActiveUnitsPath);
79 
80  if (hActiveUnits) {
81  float activeFrac = static_cast<float>(hActiveUnits->getBinContent(2)) / // CB 2nd bin is # of active channels
82  hActiveUnits->getBinContent(1); // first bin is overall number of channels
83 
84  if (activeFrac < 0.)
85  activeFrac = -1;
86 
87  wh_activeFrac.push_back(activeFrac);
88 
89  // Fill by lumi Certification ME
90  totalDCSFraction->Fill(activeFrac);
91  totalDCSFractionWh[wh + 2]->Fill(activeFrac);
92 
93  } else {
94  LogTrace("DTDQM|DTMonitorClient|DTDCSByLumiSummary")
95  << "[DTDCSByLumiSummary]: got null pointer retrieving histo at :" << hActiveUnitsPath << " for lumi # "
96  << lumiNumber << "client operation not performed." << endl;
97 
98  null_pointer_histo = true;
99  }
100 
101  } // end loop on wheels
102 
103  if (!null_pointer_histo)
104  dcsFracPerLumi[lumiNumber] = wh_activeFrac; // Fill map to be used to compute trend plots
105 
106  // CB LumiFlag marked products are reset on LS boundaries
107  totalDCSFraction->Reset();
108 
109  for (int wh = -2; wh <= 2; wh++) {
110  totalDCSFractionWh[wh + 2]->Reset();
111  }
112 }
113 
115  // Book trend plots ME & loop on map to fill it with by lumi info
116  map<int, std::vector<float> >::const_iterator fracPerLumiIt = dcsFracPerLumi.begin();
117  map<int, std::vector<float> >::const_iterator fracPerLumiEnd = dcsFracPerLumi.end();
118 
119  if (fracPerLumiIt != fracPerLumiEnd) {
120  int fLumi = dcsFracPerLumi.begin()->first;
121  int lLumi = dcsFracPerLumi.rbegin()->first;
122 
123  ibooker.setCurrentFolder("DT/EventInfo/DCSContents");
124 
125  int nLumis = lLumi - fLumi + 1.;
126 
127  // trend plots
128  for (int wh = -2; wh <= 2; wh++) {
129  stringstream wheel_str;
130  wheel_str << wh;
131 
132  DTTimeEvolutionHisto* trend;
133 
134  trend = new DTTimeEvolutionHisto(ibooker,
135  "hDCSFracTrendWh" + wheel_str.str(),
136  "Fraction of DT-HV ON Wh" + wheel_str.str(),
137  nLumis,
138  fLumi,
139  1,
140  false,
141  2);
142 
143  hDCSFracTrend.push_back(trend);
144  }
145  }
146 
147  float goodLSperWh[5] = {0, 0, 0, 0, 0};
148  float badLSperWh[5] = {0, 0, 0, 0, 0};
149 
150  // fill trend plots and save infos for summaryPlot
151  for (; fracPerLumiIt != fracPerLumiEnd; ++fracPerLumiIt) {
152  for (int wh = -2; wh <= 2; wh++) {
153  std::vector<float> activeFracPerWh;
154  activeFracPerWh = fracPerLumiIt->second;
155 
156  hDCSFracTrend[wh + 2]->setTimeSlotValue(activeFracPerWh[wh + 2], fracPerLumiIt->first);
157 
158  if (activeFracPerWh[wh + 2] > 0) { // we do not count the lumi were the DTs are off (no real problem),
159  // even if this can happen in the middle of a run (real problem: to be fixed)
160  if (activeFracPerWh[wh + 2] > 0.9)
161  goodLSperWh[wh + 2]++;
162  else {
163  badLSperWh[wh + 2]++;
164  }
165  } else { // there is no HV value OR all channels OFF
166  if (activeFracPerWh[wh + 2] < 0)
167  badLSperWh[wh + 2] = -1; // if there were no HV values, activeFrac returning -1
168  }
169  }
170  }
171 
172  // fill summaryPlot
173  for (int wh = -2; wh <= 2; wh++) {
174  if (goodLSperWh[wh + 2] != 0 || badLSperWh[wh + 2] == -1) {
175  float r = badLSperWh[wh + 2] / fabs(goodLSperWh[wh + 2] + badLSperWh[wh + 2]);
176  if (r > 0.5)
177  globalHVSummary->Fill(1, wh, 0);
178  else
179  globalHVSummary->Fill(1, wh, 1);
180  if (r == -1)
181  globalHVSummary->Fill(1, wh, -1);
182 
183  } else {
184  globalHVSummary->Fill(1, wh, 0);
185  }
186  }
187 }
MessageLogger.h
dqm::implementation::IBooker::bookFloat
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
ESHandle.h
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
Service.h
dqm::impl::MonitorElement::Reset
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
Definition: MonitorElement.cc:354
DTTimeEvolutionHisto.h
edm::ParameterSet
Definition: ParameterSet.h:36
dqm::implementation::IBooker::UseScope
Definition: DQMStore.h:457
DTDCSByLumiSummary.h
DTDCSByLumiSummary::DTDCSByLumiSummary
DTDCSByLumiSummary(const edm::ParameterSet &pset)
Constructor.
Definition: DTDCSByLumiSummary.cc:24
DTDCSByLumiSummary::beginRun
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
Definition: DTDCSByLumiSummary.cc:28
DTDCSByLumiSummary::~DTDCSByLumiSummary
~DTDCSByLumiSummary() override
Destructor.
Definition: DTDCSByLumiSummary.cc:26
edm::EventSetup
Definition: EventSetup.h:57
alignCSCRings.r
r
Definition: alignCSCRings.py:93
std
Definition: JetResolutionObject.h:76
dqm::implementation::IGetter
Definition: DQMStore.h:484
DTTimeEvolutionHisto
Definition: DTTimeEvolutionHisto.h:15
dqm::implementation::IBooker::book2D
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:177
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
EventSetup.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
lumi
Definition: LumiSectionData.h:20
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:592
DTTimeEvolutionHisto::setTimeSlotValue
void setTimeSlotValue(float value, int timeSlot)
Definition: DTTimeEvolutionHisto.cc:87
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
DTDCSByLumiSummary::dqmEndJob
void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
Definition: DTDCSByLumiSummary.cc:114
DTDCSByLumiSummary::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
Definition: DTDCSByLumiSummary.cc:30