CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1TdeCSCTPGClient.cc
Go to the documentation of this file.
2 
9 #include "TRandom.h"
10 using namespace edm;
11 using namespace std;
12 
14  : monitorDir_(ps.getParameter<string>("monitorDir")),
15  chambers_(ps.getParameter<std::vector<std::string>>("chambers")),
16  // variables
17  alctVars_(ps.getParameter<std::vector<std::string>>("alctVars")),
18  clctVars_(ps.getParameter<std::vector<std::string>>("clctVars")),
19  lctVars_(ps.getParameter<std::vector<std::string>>("lctVars")),
20  // binning
21  alctNBin_(ps.getParameter<std::vector<unsigned>>("alctNBin")),
22  clctNBin_(ps.getParameter<std::vector<unsigned>>("clctNBin")),
23  lctNBin_(ps.getParameter<std::vector<unsigned>>("lctNBin")),
24  alctMinBin_(ps.getParameter<std::vector<double>>("alctMinBin")),
25  clctMinBin_(ps.getParameter<std::vector<double>>("clctMinBin")),
26  lctMinBin_(ps.getParameter<std::vector<double>>("lctMinBin")),
27  alctMaxBin_(ps.getParameter<std::vector<double>>("alctMaxBin")),
28  clctMaxBin_(ps.getParameter<std::vector<double>>("clctMaxBin")),
29  lctMaxBin_(ps.getParameter<std::vector<double>>("lctMaxBin")),
30  useB904ME11_(ps.getParameter<bool>("useB904ME11")),
31  useB904ME21_(ps.getParameter<bool>("useB904ME21")),
32  useB904ME234s2_(ps.getParameter<bool>("useB904ME234s2")),
33  isRun3_(ps.getParameter<bool>("isRun3")),
34  // by default the DQM will make 2D summary plots. Do you also want
35  // the very large number of 1D plots? Typically only for testing at B904 or
36  // on select P5 data
37  make1DPlots_(ps.getParameter<bool>("make1DPlots")) {
39 }
40 
42 
44  DQMStore::IGetter &igetter,
45  const edm::LuminosityBlock &lumiSeg,
46  const edm::EventSetup &c) {
47  book(ibooker);
48  processHistograms(igetter);
49 }
50 
51 //--------------------------------------------------------
53  book(ibooker);
54  processHistograms(igetter);
55 }
56 
59 
60  // remove the non-ME1/1 chambers from the list when useB904ME11 is set to true
61  if (useB904ME11_) {
62  chambers_.resize(1);
63  }
64  // similar for ME2/1
65  else if (useB904ME21_) {
66  auto temp = chambers_[3];
67  chambers_.resize(1);
68  chambers_[0] = temp;
69  }
70  // similar for ME4/2
71  else if (useB904ME234s2_) {
72  auto temp = chambers_.back();
73  chambers_.resize(1);
74  chambers_[0] = temp;
75  }
76  // collision data in Run-3
77  else if (isRun3_) {
78  clctVars_.resize(9);
79  lctVars_.resize(9);
80  }
81  // do not analyze Run-3 properties in Run-1 and Run-2 eras
82  else {
83  clctVars_.resize(4);
84  lctVars_.resize(5);
85  }
86 
87  // 1D plots for experts
89  // chamber type
90  for (unsigned iType = 0; iType < chambers_.size(); iType++) {
91  // alct variable
92  for (unsigned iVar = 0; iVar < alctVars_.size(); iVar++) {
93  const std::string key("alct_" + alctVars_[iVar] + "_diff");
94  const std::string histName(key + "_" + chambers_[iType]);
95  const std::string histTitle(chambers_[iType] + " ALCT " + alctVars_[iVar] + " (Emul - Data)");
96  if (chamberHistos_[iType][key] == nullptr)
97  chamberHistos_[iType][key] =
98  iBooker.book1D(histName, histTitle, alctNBin_[iVar], alctMinBin_[iVar], alctMaxBin_[iVar]);
99  else
100  chamberHistos_[iType][key]->Reset();
101  }
102 
103  // clct variable
104  for (unsigned iVar = 0; iVar < clctVars_.size(); iVar++) {
105  const std::string key("clct_" + clctVars_[iVar] + "_diff");
106  const std::string histName(key + "_" + chambers_[iType]);
107  const std::string histTitle(chambers_[iType] + " CLCT " + clctVars_[iVar] + " (Emul - Data)");
108  if (chamberHistos_[iType][key] == nullptr)
109  chamberHistos_[iType][key] =
110  iBooker.book1D(histName, histTitle, clctNBin_[iVar], clctMinBin_[iVar], clctMaxBin_[iVar]);
111  else
112  chamberHistos_[iType][key]->Reset();
113  }
114 
115  // lct variable
116  for (unsigned iVar = 0; iVar < lctVars_.size(); iVar++) {
117  const std::string key("lct_" + lctVars_[iVar] + "_diff");
118  const std::string histName(key + "_" + chambers_[iType]);
119  const std::string histTitle(chambers_[iType] + " LCT " + lctVars_[iVar] + " (Emul - Data)");
120  if (chamberHistos_[iType][key] == nullptr)
121  chamberHistos_[iType][key] =
122  iBooker.book1D(histName, histTitle, lctNBin_[iVar], lctMinBin_[iVar], lctMaxBin_[iVar]);
123  else
124  chamberHistos_[iType][key]->Reset();
125  }
126  }
127  }
128 
129  // 2D summary plots
130  lctDataSummary_eff_ = iBooker.book2D(
131  "lct_csctp_data_summary_eff", "Efficiency of data LCT being correctly emulated", 36, 1, 37, 18, 0, 18);
132  alctDataSummary_eff_ = iBooker.book2D(
133  "alct_csctp_data_summary_eff", "Efficiency of data ALCT being correctly emulated", 36, 1, 37, 18, 0, 18);
134  clctDataSummary_eff_ = iBooker.book2D(
135  "clct_csctp_data_summary_eff", "Efficiency of data CLCT being correctly emulated", 36, 1, 37, 18, 0, 18);
136 
137  lctEmulSummary_eff_ = iBooker.book2D(
138  "lct_csctp_emul_summary_eff", "Fraction of emulated LCT without matching data LCT", 36, 1, 37, 18, 0, 18);
139  alctEmulSummary_eff_ = iBooker.book2D(
140  "alct_csctp_emul_summary_eff", "Fraction of emulated ALCT without matching data ALCT", 36, 1, 37, 18, 0, 18);
141  clctEmulSummary_eff_ = iBooker.book2D(
142  "clct_csctp_emul_summary_eff", "Fraction of emulated CLCT without matching data CLCT", 36, 1, 37, 18, 0, 18);
143 
144  // x labels
145  lctDataSummary_eff_->setAxisTitle("Chamber", 1);
146  alctDataSummary_eff_->setAxisTitle("Chamber", 1);
147  clctDataSummary_eff_->setAxisTitle("Chamber", 1);
148 
149  lctEmulSummary_eff_->setAxisTitle("Chamber", 1);
150  alctEmulSummary_eff_->setAxisTitle("Chamber", 1);
151  clctEmulSummary_eff_->setAxisTitle("Chamber", 1);
152 
153  // plotting option
157 
161 
162  // summary plots
163  const std::array<std::string, 9> suffix_label{{"4/2", "4/1", "3/2", "3/1", " 2/2", "2/1", "1/3", "1/2", "1/1"}};
164 
165  // y labels
166  for (int ybin = 1; ybin <= 9; ++ybin) {
167  lctDataSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
168  alctDataSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
169  clctDataSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
170 
171  lctEmulSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
172  alctEmulSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
173  clctEmulSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
174 
175  lctDataSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
176  alctDataSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
177  clctDataSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
178 
179  lctEmulSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
180  alctEmulSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
181  clctEmulSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
182  }
183 }
184 
186  MonitorElement *dataMon;
187  MonitorElement *emulMon;
188 
189  // 1D plots for experts
191  // chamber type
192  for (unsigned iType = 0; iType < chambers_.size(); iType++) {
193  // alct variable
194  for (unsigned iVar = 0; iVar < alctVars_.size(); iVar++) {
195  const std::string key("alct_" + alctVars_[iVar]);
196  const std::string histData(key + "_data_" + chambers_[iType]);
197  const std::string histEmul(key + "_emul_" + chambers_[iType]);
198 
199  dataMon = igetter.get(monitorDir_ + "/" + histData);
200  emulMon = igetter.get(monitorDir_ + "/" + histEmul);
201 
202  TH1F *hDiff = chamberHistos_[iType][key + "_diff"]->getTH1F();
203 
204  if (dataMon && emulMon) {
205  TH1F *hData = dataMon->getTH1F();
206  TH1F *hEmul = emulMon->getTH1F();
207  hDiff->Add(hEmul, hData, 1, -1);
208  }
209  }
210 
211  // clct variable
212  for (unsigned iVar = 0; iVar < clctVars_.size(); iVar++) {
213  const std::string key("clct_" + clctVars_[iVar]);
214  const std::string histData(key + "_data_" + chambers_[iType]);
215  const std::string histEmul(key + "_emul_" + chambers_[iType]);
216 
217  dataMon = igetter.get(monitorDir_ + "/" + histData);
218  emulMon = igetter.get(monitorDir_ + "/" + histEmul);
219 
220  TH1F *hDiff = chamberHistos_[iType][key + "_diff"]->getTH1F();
221 
222  if (dataMon && emulMon) {
223  TH1F *hData = dataMon->getTH1F();
224  TH1F *hEmul = emulMon->getTH1F();
225  hDiff->Add(hEmul, hData, 1, -1);
226  }
227  }
228 
229  // lct variable
230  for (unsigned iVar = 0; iVar < lctVars_.size(); iVar++) {
231  const std::string key("lct_" + lctVars_[iVar]);
232  const std::string histData(key + "_data_" + chambers_[iType]);
233  const std::string histEmul(key + "_emul_" + chambers_[iType]);
234 
235  dataMon = igetter.get(monitorDir_ + "/" + histData);
236  emulMon = igetter.get(monitorDir_ + "/" + histEmul);
237 
238  TH1F *hDiff = chamberHistos_[iType][key + "_diff"]->getTH1F();
239 
240  if (dataMon && emulMon) {
241  TH1F *hData = dataMon->getTH1F();
242  TH1F *hEmul = emulMon->getTH1F();
243  hDiff->Add(hEmul, hData, 1, -1);
244  }
245  }
246  }
247  }
248 
249  // 2D summary plot
250  MonitorElement *lctDataSummary_denom_ = igetter.get(monitorDir_ + "/lct_csctp_data_summary_denom");
251  MonitorElement *lctDataSummary_num_ = igetter.get(monitorDir_ + "/lct_csctp_data_summary_num");
252  MonitorElement *alctDataSummary_denom_ = igetter.get(monitorDir_ + "/alct_csctp_data_summary_denom");
253  MonitorElement *alctDataSummary_num_ = igetter.get(monitorDir_ + "/alct_csctp_data_summary_num");
254  MonitorElement *clctDataSummary_denom_ = igetter.get(monitorDir_ + "/clct_csctp_data_summary_denom");
255  MonitorElement *clctDataSummary_num_ = igetter.get(monitorDir_ + "/clct_csctp_data_summary_num");
256 
257  MonitorElement *lctEmulSummary_denom_ = igetter.get(monitorDir_ + "/lct_csctp_emul_summary_denom");
258  MonitorElement *lctEmulSummary_num_ = igetter.get(monitorDir_ + "/lct_csctp_emul_summary_num");
259  MonitorElement *alctEmulSummary_denom_ = igetter.get(monitorDir_ + "/alct_csctp_emul_summary_denom");
260  MonitorElement *alctEmulSummary_num_ = igetter.get(monitorDir_ + "/alct_csctp_emul_summary_num");
261  MonitorElement *clctEmulSummary_denom_ = igetter.get(monitorDir_ + "/clct_csctp_emul_summary_denom");
262  MonitorElement *clctEmulSummary_num_ = igetter.get(monitorDir_ + "/clct_csctp_emul_summary_num");
263 
264  lctDataSummary_eff_->getTH2F()->Divide(lctDataSummary_num_->getTH2F(), lctDataSummary_denom_->getTH2F(), 1, 1, "");
265  alctDataSummary_eff_->getTH2F()->Divide(alctDataSummary_num_->getTH2F(), alctDataSummary_denom_->getTH2F(), 1, 1, "");
266  clctDataSummary_eff_->getTH2F()->Divide(clctDataSummary_num_->getTH2F(), clctDataSummary_denom_->getTH2F(), 1, 1, "");
267 
268  lctEmulSummary_eff_->getTH2F()->Divide(lctEmulSummary_num_->getTH2F(), lctEmulSummary_denom_->getTH2F(), 1, 1, "");
269  alctEmulSummary_eff_->getTH2F()->Divide(alctEmulSummary_num_->getTH2F(), alctEmulSummary_denom_->getTH2F(), 1, 1, "");
270  clctEmulSummary_eff_->getTH2F()->Divide(clctEmulSummary_num_->getTH2F(), clctEmulSummary_denom_->getTH2F(), 1, 1, "");
271 
272  // set minima to 0.95 so the contrast comes out better!
273  lctDataSummary_eff_->getTH2F()->GetZaxis()->SetRangeUser(0.95, 1);
274  alctDataSummary_eff_->getTH2F()->GetZaxis()->SetRangeUser(0.95, 1);
275  clctDataSummary_eff_->getTH2F()->GetZaxis()->SetRangeUser(0.95, 1);
276 }
std::vector< double > alctMaxBin_
MonitorElement * clctDataSummary_eff_
virtual TH2F * getTH2F() const
const edm::EventSetup & c
std::vector< double > clctMaxBin_
L1TdeCSCTPGClient(const edm::ParameterSet &ps)
Constructor.
~L1TdeCSCTPGClient() override
Destructor.
MonitorElement * lctDataSummary_eff_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::vector< std::string > lctVars_
std::vector< double > lctMinBin_
std::vector< std::string > alctVars_
virtual void setOption(const char *option)
virtual TH1F * getTH1F() const
std::string monitorDir_
MonitorElement * alctEmulSummary_eff_
std::vector< unsigned > alctNBin_
void book(DQMStore::IBooker &ibooker)
void processHistograms(DQMStore::IGetter &)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
tuple key
prepare the HTCondor submission files and eventually submit them
std::vector< double > alctMinBin_
MonitorElement * clctEmulSummary_eff_
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::vector< unsigned > lctNBin_
std::vector< double > clctMinBin_
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
MonitorElement * lctEmulSummary_eff_
std::vector< double > lctMaxBin_
std::vector< std::string > chambers_
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * alctDataSummary_eff_
std::vector< std::string > clctVars_
std::vector< unsigned > clctNBin_
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos_