CMS 3D CMS Logo

BPHMonitor.cc
Go to the documentation of this file.
2 
4 
6 
7 // -----------------------------
8 // constructors and destructor
9 // -----------------------------
10 
12  : folderName_(iConfig.getParameter<std::string>("FolderName")),
13  muoInputTag_(iConfig.getParameter<edm::InputTag>("muons")),
14  bsInputTag_(iConfig.getParameter<edm::InputTag>("beamSpot")),
15  trInputTag_(iConfig.getParameter<edm::InputTag>("tracks")),
16  phInputTag_(iConfig.getParameter<edm::InputTag>("photons")),
17  vtxInputTag_(iConfig.getParameter<edm::InputTag>("offlinePVs")),
18  muoToken_(mayConsume<reco::MuonCollection>(muoInputTag_)),
19  bsToken_(mayConsume<reco::BeamSpot>(bsInputTag_)),
20  trToken_(mayConsume<reco::TrackCollection>(trInputTag_)),
21  phToken_(mayConsume<reco::PhotonCollection>(phInputTag_)),
22  vtxToken_(mayConsume<reco::VertexCollection>(vtxInputTag_)),
23  phi_binning_(getHistoPSet(
24  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("phiPSet"))),
25  pt_binning_(
26  getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("ptPSet"))),
27  dMu_pt_binning_(getHistoPSet(
28  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("dMu_ptPSet"))),
29  eta_binning_(getHistoPSet(
30  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("etaPSet"))),
31  d0_binning_(
32  getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("d0PSet"))),
33  z0_binning_(
34  getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("z0PSet"))),
35  dR_binning_(
36  getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("dRPSet"))),
37  mass_binning_(getHistoPSet(
38  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("massPSet"))),
39  Bmass_binning_(getHistoPSet(
40  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("BmassPSet"))),
41  dca_binning_(getHistoPSet(
42  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("dcaPSet"))),
43  ds_binning_(
44  getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("dsPSet"))),
45  cos_binning_(getHistoPSet(
46  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("cosPSet"))),
47  prob_binning_(getHistoPSet(
48  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("probPSet"))),
49  num_genTriggerEventFlag_(new GenericTriggerEventFlag(
50  iConfig.getParameter<edm::ParameterSet>("numGenericTriggerEventPSet"), consumesCollector(), *this)),
51  den_genTriggerEventFlag_(new GenericTriggerEventFlag(
52  iConfig.getParameter<edm::ParameterSet>("denGenericTriggerEventPSet"), consumesCollector(), *this)),
53  hltPrescale_(new HLTPrescaleProvider(iConfig, consumesCollector(), *this)),
54  muoSelection_(iConfig.getParameter<std::string>("muoSelection")),
55  muoSelection_ref(iConfig.getParameter<std::string>("muoSelection_ref")),
56  muoSelection_tag(iConfig.getParameter<std::string>("muoSelection_tag")),
57  muoSelection_probe(iConfig.getParameter<std::string>("muoSelection_probe")),
58  nmuons_(iConfig.getParameter<int>("nmuons")),
59  tnp_(iConfig.getParameter<bool>("tnp")),
60  L3_(iConfig.getParameter<int>("L3")),
61  ptCut_(iConfig.getParameter<int>("ptCut")),
62  displaced_(iConfig.getParameter<int>("displaced")),
63  trOrMu_(iConfig.getParameter<int>("trOrMu")),
64  Jpsi_(iConfig.getParameter<int>("Jpsi")),
65  Upsilon_(iConfig.getParameter<int>("Upsilon")) // if ==1 path with Upsilon constraint
66  ,
67  enum_(iConfig.getParameter<int>("enum")),
68  seagull_(iConfig.getParameter<int>("seagull")),
69  maxmass_(iConfig.getParameter<double>("maxmass")),
70  minmass_(iConfig.getParameter<double>("minmass")),
71  maxmassJpsi(iConfig.getParameter<double>("maxmassJpsi")),
72  minmassJpsi(iConfig.getParameter<double>("minmassJpsi")),
73  maxmassUpsilon(iConfig.getParameter<double>("maxmassUpsilon")),
74  minmassUpsilon(iConfig.getParameter<double>("minmassUpsilon")),
75  maxmassTkTk(iConfig.getParameter<double>("maxmassTkTk")),
76  minmassTkTk(iConfig.getParameter<double>("minmassTkTk")),
77  maxmassJpsiTk(iConfig.getParameter<double>("maxmassJpsiTk")),
78  minmassJpsiTk(iConfig.getParameter<double>("minmassJpsiTk")),
79  kaon_mass(iConfig.getParameter<double>("kaon_mass")),
80  mu_mass(iConfig.getParameter<double>("mu_mass")),
81  min_dR(iConfig.getParameter<double>("min_dR")),
82  max_dR(iConfig.getParameter<double>("max_dR")),
83  minprob(iConfig.getParameter<double>("minprob")),
84  mincos(iConfig.getParameter<double>("mincos")),
85  minDS(iConfig.getParameter<double>("minDS")),
86  hltInputTag_1(iConfig.getParameter<edm::InputTag>("hltTriggerSummaryAOD")),
87  hltInputTag_(mayConsume<trigger::TriggerEvent>(iConfig.getParameter<edm::InputTag>("hltTriggerSummaryAOD"))),
88  hltpaths_num(iConfig.getParameter<edm::ParameterSet>("numGenericTriggerEventPSet")
89  .getParameter<std::vector<std::string>>("hltPaths")),
90  hltpaths_den(iConfig.getParameter<edm::ParameterSet>("denGenericTriggerEventPSet")
91  .getParameter<std::vector<std::string>>("hltPaths")),
92  trSelection_(iConfig.getParameter<std::string>("muoSelection")),
93  trSelection_ref(iConfig.getParameter<std::string>("trSelection_ref")),
94  DMSelection_ref(iConfig.getParameter<std::string>("DMSelection_ref")) {
95  muPhi_.numerator = nullptr;
96  muPhi_.denominator = nullptr;
97  muEta_.numerator = nullptr;
98  muEta_.denominator = nullptr;
99  muPt_.numerator = nullptr;
100  muPt_.denominator = nullptr;
101  mud0_.numerator = nullptr;
102  mud0_.denominator = nullptr;
103  muz0_.numerator = nullptr;
104  muz0_.denominator = nullptr;
105 
106  mu1Phi_.numerator = nullptr;
107  mu1Phi_.denominator = nullptr;
108  mu1Eta_.numerator = nullptr;
109  mu1Eta_.denominator = nullptr;
110  mu1Pt_.numerator = nullptr;
111  mu1Pt_.denominator = nullptr;
112 
113  mu2Phi_.numerator = nullptr;
114  mu2Phi_.denominator = nullptr;
115  mu2Eta_.numerator = nullptr;
116  mu2Eta_.denominator = nullptr;
117  mu2Pt_.numerator = nullptr;
118  mu2Pt_.denominator = nullptr;
119 
120  mu3Phi_.numerator = nullptr;
121  mu3Phi_.denominator = nullptr;
122  mu3Eta_.numerator = nullptr;
123  mu3Eta_.denominator = nullptr;
124  mu3Pt_.numerator = nullptr;
125  mu3Pt_.denominator = nullptr;
126 
127  phPhi_.numerator = nullptr;
128  phPhi_.denominator = nullptr;
129  phEta_.numerator = nullptr;
130  phEta_.denominator = nullptr;
131  phPt_.numerator = nullptr;
132  phPt_.denominator = nullptr;
133 
134  DiMuPhi_.numerator = nullptr;
135  DiMuPhi_.denominator = nullptr;
136  DiMuEta_.numerator = nullptr;
137  DiMuEta_.denominator = nullptr;
138  DiMuPt_.numerator = nullptr;
139  DiMuPt_.denominator = nullptr;
140  DiMuPVcos_.numerator = nullptr;
141  DiMuPVcos_.denominator = nullptr;
142  DiMuProb_.numerator = nullptr;
143  DiMuProb_.denominator = nullptr;
144  DiMuDS_.numerator = nullptr;
145  DiMuDS_.denominator = nullptr;
146  DiMuDCA_.numerator = nullptr;
147  DiMuDCA_.denominator = nullptr;
148  DiMuMass_.numerator = nullptr;
149  DiMuMass_.denominator = nullptr;
150  BMass_.numerator = nullptr;
151  BMass_.denominator = nullptr;
152  DiMudR_.numerator = nullptr;
153  DiMudR_.denominator = nullptr;
154 
155  // this vector has to be alligned to the the number of Tokens accessed by this module
156  warningPrinted4token_.push_back(false); // MuonCollection
157  warningPrinted4token_.push_back(false); // BeamSpot
158  warningPrinted4token_.push_back(false); // TrackCollection
159  warningPrinted4token_.push_back(false); // PhotonCollection
160  warningPrinted4token_.push_back(false); // VertexCollection
161 }
162 
168  delete hltPrescale_;
169 }
170 
172  // Due to the setup of the fillDescription only one of the
173  // two cases is possible at this point.
174  if (pset.existsAs<std::vector<double>>("edges")) {
175  return MEbinning{pset.getParameter<std::vector<double>>("edges")};
176  }
177 
178  return MEbinning{
179  pset.getParameter<int32_t>("nbins"),
180  pset.getParameter<double>("xmin"),
181  pset.getParameter<double>("xmax"),
182  };
183 }
184 
185 // MEbinning BPHMonitor::getHistoLSPSet(edm::ParameterSet pset)
186 // {
187 // return MEbinning{
188 // pset.getParameter<int32_t>("nbins"),
189 // 0.,
190 // double(pset.getParameter<int32_t>("nbins"))
191 // };
192 // }
193 
195  me.numerator->setAxisTitle(titleX, 1);
196  me.numerator->setAxisTitle(titleY, 2);
197  me.denominator->setAxisTitle(titleX, 1);
198  me.denominator->setAxisTitle(titleY, 2);
199 }
200 
202  METME& me,
203  std::string& histname,
204  std::string& histtitle,
205  int& nbins,
206  double& min,
207  double& max) {
208  me.numerator = ibooker.book1D(histname + "_numerator", histtitle + " (numerator)", nbins, min, max);
209  me.denominator = ibooker.book1D(histname + "_denominator", histtitle + " (denominator)", nbins, min, max);
210 }
212  DQMStore::IBooker& ibooker, METME& me, std::string& histname, std::string& histtitle, std::vector<double> binning) {
213  int nbins = binning.size() - 1;
214  std::vector<float> fbinning(binning.begin(), binning.end());
215  float* arr = &fbinning[0];
216  me.numerator = ibooker.book1D(histname + "_numerator", histtitle + " (numerator)", nbins, arr);
217  me.denominator = ibooker.book1D(histname + "_denominator", histtitle + " (denominator)", nbins, arr);
218 }
220  METME& me,
221  std::string& histname,
222  std::string& histtitle,
223  int& nbinsX,
224  double& xmin,
225  double& xmax,
226  double& ymin,
227  double& ymax) {
228  me.numerator =
229  ibooker.bookProfile(histname + "_numerator", histtitle + " (numerator)", nbinsX, xmin, xmax, ymin, ymax);
230  me.denominator =
231  ibooker.bookProfile(histname + "_denominator", histtitle + " (denominator)", nbinsX, xmin, xmax, ymin, ymax);
232 }
234  METME& me,
235  std::string& histname,
236  std::string& histtitle,
237  int& nbinsX,
238  double& xmin,
239  double& xmax,
240  int& nbinsY,
241  double& ymin,
242  double& ymax) {
243  me.numerator =
244  ibooker.book2D(histname + "_numerator", histtitle + " (numerator)", nbinsX, xmin, xmax, nbinsY, ymin, ymax);
245  me.denominator =
246  ibooker.book2D(histname + "_denominator", histtitle + " (denominator)", nbinsX, xmin, xmax, nbinsY, ymin, ymax);
247 }
249  METME& me,
250  std::string& histname,
251  std::string& histtitle,
252  std::vector<double> binningX,
253  std::vector<double> binningY) {
254  int nbinsX = binningX.size() - 1;
255  std::vector<float> fbinningX(binningX.begin(), binningX.end());
256  float* arrX = &fbinningX[0];
257  int nbinsY = binningY.size() - 1;
258  std::vector<float> fbinningY(binningY.begin(), binningY.end());
259  float* arrY = &fbinningY[0];
260 
261  me.numerator = ibooker.book2D(histname + "_numerator", histtitle + " (numerator)", nbinsX, arrX, nbinsY, arrY);
262  me.denominator = ibooker.book2D(histname + "_denominator", histtitle + " (denominator)", nbinsX, arrX, nbinsY, arrY);
263 }
264 
266  METME& me,
267  std::string& histname,
268  std::string& histtitle,
269  /*const*/ MEbinning& binning) {
270  // If the vector in the binning is filled use the bins defined there
271  // otherwise use a linear binning between min and max
272  if (binning.edges.empty()) {
273  this->bookME(ibooker, me, histname, histtitle, binning.nbins, binning.xmin, binning.xmax);
274  } else {
275  this->bookME(ibooker, me, histname, histtitle, binning.edges);
276  }
277 }
278 
279 void BPHMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
280  std::string histname, histtitle, istnp, trMuPh;
281  bool Ph_ = false;
282  if (enum_ == 7)
283  Ph_ = true;
284  if (tnp_)
285  istnp = "Tag_and_Probe/";
286  else
287  istnp = "";
288  std::string currentFolder = folderName_ + istnp;
289  ibooker.setCurrentFolder(currentFolder);
290  if (trOrMu_)
291  trMuPh = "tr";
292  else if (Ph_)
293  trMuPh = "ph";
294  else
295  trMuPh = "mu";
296 
297  if (enum_ == 7 || enum_ == 1 || enum_ == 9 || enum_ == 10) {
298  histname = trMuPh + "Pt";
299  histtitle = trMuPh + "_P_{t}";
300  bookME(ibooker, muPt_, histname, histtitle, pt_binning_);
301  setMETitle(muPt_, trMuPh + "_Pt[GeV]", "events / 1 GeV");
302 
303  histname = trMuPh + "Phi";
304  histtitle = trMuPh + "Phi";
305  bookME(ibooker, muPhi_, histname, histtitle, phi_binning_);
306  setMETitle(muPhi_, trMuPh + "_#phi", "events / 0.1 rad");
307 
308  histname = trMuPh + "Eta";
309  histtitle = trMuPh + "_Eta";
310  bookME(ibooker, muEta_, histname, histtitle, eta_binning_);
311  setMETitle(muEta_, trMuPh + "_#eta", "events / 0.2");
312 
313  if (enum_ == 9) {
314  histname = "BMass";
315  histtitle = "BMass";
316  bookME(ibooker, BMass_, histname, histtitle, Bmass_binning_);
317  setMETitle(BMass_, "B_#mass", "events /");
318  }
319  } else {
320  if (enum_ != 8) {
321  histname = trMuPh + "1Pt";
322  histtitle = trMuPh + "1_P_{t}";
323  bookME(ibooker, mu1Pt_, histname, histtitle, pt_binning_);
324  setMETitle(mu1Pt_, trMuPh + "_Pt[GeV]", "events / 1 GeV");
325 
326  histname = trMuPh + "1Phi";
327  histtitle = trMuPh + "1Phi";
328  bookME(ibooker, mu1Phi_, histname, histtitle, phi_binning_);
329  setMETitle(mu1Phi_, trMuPh + "_#phi", "events / 0.1 rad");
330 
331  histname = trMuPh + "1Eta";
332  histtitle = trMuPh + "1_Eta";
333  bookME(ibooker, mu1Eta_, histname, histtitle, eta_binning_);
334  setMETitle(mu1Eta_, trMuPh + "_#eta", "events / 0.2");
335 
336  histname = trMuPh + "2Pt";
337  histtitle = trMuPh + "2_P_{t}";
338  bookME(ibooker, mu2Pt_, histname, histtitle, pt_binning_);
339  setMETitle(mu2Pt_, trMuPh + "_Pt[GeV]", "events / 1 GeV");
340 
341  histname = trMuPh + "2Phi";
342  histtitle = trMuPh + "2Phi";
343  bookME(ibooker, mu2Phi_, histname, histtitle, phi_binning_);
344  setMETitle(mu2Phi_, trMuPh + "_#phi", "events / 0.1 rad");
345 
346  histname = trMuPh + "2Eta";
347  histtitle = trMuPh + "2_Eta";
348  bookME(ibooker, mu2Eta_, histname, histtitle, eta_binning_);
349  setMETitle(mu2Eta_, trMuPh + "_#eta", "events / 0.2");
350  if (enum_ == 11) {
351  histname = "BMass";
352  histtitle = "BMass";
353  bookME(ibooker, BMass_, histname, histtitle, Bmass_binning_);
354  setMETitle(BMass_, "B_#mass", "events /");
355  }
356  }
357  if (enum_ == 6) {
358  histname = trMuPh + "3Eta";
359  histtitle = trMuPh + "3Eta";
360  bookME(ibooker, mu3Eta_, histname, histtitle, eta_binning_);
361  setMETitle(mu3Eta_, trMuPh + "3#eta", "events / 0.2");
362 
363  histname = trMuPh + "3Pt";
364  histtitle = trMuPh + "3_P_{t}";
365  bookME(ibooker, mu3Pt_, histname, histtitle, pt_binning_);
366  setMETitle(mu3Pt_, trMuPh + "3_Pt[GeV]", "events / 1 GeV");
367 
368  histname = trMuPh + "3Phi";
369  histtitle = trMuPh + "3Phi";
370  bookME(ibooker, mu3Phi_, histname, histtitle, phi_binning_);
371  setMETitle(mu3Phi_, trMuPh + "3_#phi", "events / 0.1 rad");
372 
373  } else if (enum_ == 2 || enum_ == 4 || enum_ == 5 || enum_ == 8) {
374  histname = "DiMuEta";
375  histtitle = "DiMuEta";
376  bookME(ibooker, DiMuEta_, histname, histtitle, eta_binning_);
377  setMETitle(DiMuEta_, "DiMu#eta", "events / 0.2");
378 
379  histname = "DiMuPt";
380  histtitle = "DiMu_P_{t}";
381  bookME(ibooker, DiMuPt_, histname, histtitle, dMu_pt_binning_);
382  setMETitle(DiMuPt_, "DiMu_Pt[GeV]", "events / 1 GeV");
383 
384  histname = "DiMuPhi";
385  histtitle = "DiMuPhi";
386  bookME(ibooker, DiMuPhi_, histname, histtitle, phi_binning_);
387  setMETitle(DiMuPhi_, "DiMu_#phi", "events / 0.1 rad");
388 
389  if (enum_ == 4 || enum_ == 5) {
390  histname = "DiMudR";
391  histtitle = "DiMudR";
392  bookME(ibooker, DiMudR_, histname, histtitle, dR_binning_);
393  setMETitle(DiMudR_, "DiMu_#dR", "events /");
394 
395  if (enum_ == 4) {
396  histname = "DiMuMass";
397  histtitle = "DiMuMass";
398  bookME(ibooker, DiMuMass_, histname, histtitle, mass_binning_);
399  setMETitle(DiMuMass_, "DiMu_#mass", "events /");
400  }
401  } else if (enum_ == 8) {
402  histname = "DiMuProb";
403  histtitle = "DiMuProb";
404  bookME(ibooker, DiMuProb_, histname, histtitle, prob_binning_);
405  setMETitle(DiMuProb_, "DiMu_#prob", "events /");
406 
407  histname = "DiMuPVcos";
408  histtitle = "DiMuPVcos";
409  bookME(ibooker, DiMuPVcos_, histname, histtitle, cos_binning_);
410  setMETitle(DiMuPVcos_, "DiMu_#cosPV", "events /");
411 
412  histname = "DiMuDS";
413  histtitle = "DiMuDS";
414  bookME(ibooker, DiMuDS_, histname, histtitle, ds_binning_);
415  setMETitle(DiMuDS_, "DiMu_#ds", "events /");
416 
417  histname = "DiMuDCA";
418  histtitle = "DiMuDCA";
419  bookME(ibooker, DiMuDCA_, histname, histtitle, dca_binning_);
420  setMETitle(DiMuDCA_, "DiMu_#dca", "events /");
421  }
422  } // if (enum_ == 2 || enum_ == 4 || enum_ == 5 || enum_ == 8)
423  }
424 
425  // Initialize the GenericTriggerEventFlag
427  num_genTriggerEventFlag_->initRun(iRun, iSetup);
429  den_genTriggerEventFlag_->initRun(iRun, iSetup);
430  bool changed = true;
431 
432  hltPrescale_->init(iRun, iSetup, "HLT", changed);
434 }
435 
438  iEvent.getByToken(bsToken_, beamSpot);
439  if (!beamSpot.isValid()) {
440  if (!warningPrinted4token_[0]) {
441  warningPrinted4token_[0] = true;
442  edm::LogWarning("BPHMonitor") << "skipping events because the collection " << bsInputTag_.label().c_str()
443  << " is not available";
444  }
445  return;
446  }
447 
449  iEvent.getByToken(muoToken_, muoHandle);
450  if (!muoHandle.isValid()) {
451  if (!warningPrinted4token_[1]) {
452  warningPrinted4token_[1] = true;
453  edm::LogWarning("BPHMonitor") << "skipping events because the collection " << muoInputTag_.label().c_str()
454  << " is not available";
455  }
456  return;
457  }
458 
460  iEvent.getByToken(trToken_, trHandle);
461  if (!trHandle.isValid()) {
462  if (!warningPrinted4token_[2]) {
463  warningPrinted4token_[2] = true;
464  edm::LogWarning("BPHMonitor") << "skipping events because the collection " << trInputTag_.label().c_str()
465  << " is not available";
466  }
467  return;
468  }
469 
471  iEvent.getByToken(phToken_, phHandle);
472 
473  edm::Handle<edm::TriggerResults> handleTriggerTrigRes;
474 
475  edm::ESHandle<MagneticField> bFieldHandle;
476 
477  const std::string& hltpath = getTriggerName(hltpaths_den[0]);
478  const std::string& hltpath1 = getTriggerName(hltpaths_num[0]);
479 
480  double PrescaleWeight = 1.0;
481  if (den_genTriggerEventFlag_->on() && den_genTriggerEventFlag_->accept(iEvent, iSetup) &&
483  PrescaleWeight = Prescale(hltpath1, hltpath, iEvent, iSetup, hltPrescale_);
484 
485  if (tnp_ > 0) { //TnP method
486 
487  if (den_genTriggerEventFlag_->on() && !den_genTriggerEventFlag_->accept(iEvent, iSetup))
488  return;
490  if (handleTriggerEvent->sizeFilters() == 0)
491  return;
492 
493  std::vector<reco::Muon> tagMuons;
494  for (auto const& m : *muoHandle) { // applying tag selection
495  if (!matchToTrigger(hltpath, m))
496  continue;
497  if (muoSelection_ref(m))
498  tagMuons.push_back(m);
499  }
500 
501  for (int i = 0; i < int(tagMuons.size()); i++) {
502  for (auto const& m : *muoHandle) {
503  if (!matchToTrigger(hltpath, m))
504  continue;
505  if ((tagMuons[i].pt() == m.pt()))
506  continue; //not the same
507  if ((tagMuons[i].p4() + m.p4()).M() > minmass_ &&
508  (tagMuons[i].p4() + m.p4()).M() < maxmass_) { //near to J/psi mass
509  muPhi_.denominator->Fill(m.phi());
510  muEta_.denominator->Fill(m.eta());
511  muPt_.denominator->Fill(m.pt());
513  muPhi_.numerator->Fill(m.phi(), PrescaleWeight);
514  muEta_.numerator->Fill(m.eta(), PrescaleWeight);
515  muPt_.numerator->Fill(m.pt(), PrescaleWeight);
516  }
517  }
518  }
519  }
520 
521  } else { // reference method
522 
523  if (den_genTriggerEventFlag_->on() && (!den_genTriggerEventFlag_->accept(iEvent, iSetup)))
524  return;
525 
527  if (handleTriggerEvent->sizeFilters() == 0)
528  return;
529 
530  for (auto const& m : *muoHandle) {
531  if (!muoSelection_ref(m))
532  continue;
533  if (!matchToTrigger(hltpath, m))
534  continue;
535 
536  for (auto const& m1 : *muoHandle) {
537  if (!(m1.pt() > m.pt()))
538  continue;
539  if (ptCut_) {
540  if (!muoSelection_(m1))
541  continue;
542  } else if (!muoSelection_ref(m1))
543  continue;
544  if (!matchToTrigger(hltpath, m1))
545  continue;
546 
547  if (enum_ != 10) {
548  if (!DMSelection_ref(m1.p4() + m.p4()))
549  continue;
550  if (m.charge() * m1.charge() > 0)
551  continue;
552  }
553 
554  // dimuon vertex reconstruction
555  iSetup.get<IdealMagneticFieldRecord>().get(bFieldHandle);
556  const reco::BeamSpot& vertexBeamSpot = *beamSpot;
557  std::vector<reco::TransientTrack> j_tks;
558  reco::TransientTrack mu1TT(m.track(), &(*bFieldHandle));
559  reco::TransientTrack mu2TT(m1.track(), &(*bFieldHandle));
560  j_tks.push_back(mu1TT);
561  j_tks.push_back(mu2TT);
562  KalmanVertexFitter jkvf;
563  TransientVertex jtv = jkvf.vertex(j_tks);
564  if (!jtv.isValid())
565  continue;
566  reco::Vertex jpsivertex = jtv;
567  float dimuonCL = 0;
568  if ((jpsivertex.chi2() >= 0) && (jpsivertex.ndof() > 0))
569  dimuonCL = TMath::Prob(jpsivertex.chi2(), jpsivertex.ndof());
570  math::XYZVector jpperp(m.px() + m1.px(), m.py() + m1.py(), 0.);
571  GlobalPoint jVertex = jtv.position();
572  GlobalError jerr = jtv.positionError();
573  GlobalPoint displacementFromBeamspotJpsi(
574  -1 * ((vertexBeamSpot.x0() - jVertex.x()) + (jVertex.z() - vertexBeamSpot.z0()) * vertexBeamSpot.dxdz()),
575  -1 * ((vertexBeamSpot.y0() - jVertex.y()) + (jVertex.z() - vertexBeamSpot.z0()) * vertexBeamSpot.dydz()),
576  0);
577  reco::Vertex::Point vperpj(displacementFromBeamspotJpsi.x(), displacementFromBeamspotJpsi.y(), 0.);
578  float jpsi_cos = vperpj.Dot(jpperp) / (vperpj.R() * jpperp.R());
579  TrajectoryStateClosestToPoint mu1TS = mu1TT.impactPointTSCP();
580  TrajectoryStateClosestToPoint mu2TS = mu2TT.impactPointTSCP();
582  if (mu1TS.isValid() && mu2TS.isValid()) {
583  if (!cApp.calculate(mu1TS.theState(), mu2TS.theState()))
584  continue;
585  } else
586  continue;
587  double DiMuMass = (m1.p4() + m.p4()).M();
588 
589  switch (
590  enum_) { // enum_ = 1...9, represents different sets of variables for different paths, we want to have different hists for different paths
591 
592  case 1:
593 
594  tnp_ = true; // already filled hists for tnp method
595  [[fallthrough]];
596  case 2:
597 
598  if ((Jpsi_) && (!Upsilon_))
599  if (DiMuMass > maxmassJpsi || DiMuMass < minmassJpsi)
600  continue;
601  if ((!Jpsi_) && (Upsilon_))
602  if (DiMuMass > maxmassUpsilon || DiMuMass < minmassUpsilon)
603  continue;
604  if (dimuonCL < minprob)
605  continue;
606 
607  mu1Phi_.denominator->Fill(m.phi());
608  mu1Eta_.denominator->Fill(m.eta());
609  mu1Pt_.denominator->Fill(m.pt());
610  mu2Phi_.denominator->Fill(m1.phi());
611  mu2Eta_.denominator->Fill(m1.eta());
612  mu2Pt_.denominator->Fill(m1.pt());
613  DiMuPt_.denominator->Fill((m1.p4() + m.p4()).Pt());
614  DiMuEta_.denominator->Fill((m1.p4() + m.p4()).Eta());
615  DiMuPhi_.denominator->Fill((m1.p4() + m.p4()).Phi());
616 
617  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
618  if (!matchToTrigger(hltpath1, m1))
619  continue;
620  if (!matchToTrigger(hltpath1, m))
621  continue;
622  mu1Phi_.numerator->Fill(m.phi(), PrescaleWeight);
623  mu1Eta_.numerator->Fill(m.eta(), PrescaleWeight);
624  mu1Pt_.numerator->Fill(m.pt(), PrescaleWeight);
625  mu2Phi_.numerator->Fill(m1.phi(), PrescaleWeight);
626  mu2Eta_.numerator->Fill(m1.eta(), PrescaleWeight);
627  mu2Pt_.numerator->Fill(m1.pt(), PrescaleWeight);
628  DiMuPt_.numerator->Fill((m1.p4() + m.p4()).Pt(), PrescaleWeight);
629  DiMuEta_.numerator->Fill((m1.p4() + m.p4()).Eta(), PrescaleWeight);
630  DiMuPhi_.numerator->Fill((m1.p4() + m.p4()).Phi(), PrescaleWeight);
631  }
632 
633  break;
634 
635  case 3:
636 
637  if ((Jpsi_) && (!Upsilon_))
638  if (DiMuMass > maxmassJpsi || DiMuMass < minmassJpsi)
639  continue;
640  if ((!Jpsi_) && (Upsilon_))
641  if (DiMuMass > maxmassUpsilon || DiMuMass < minmassUpsilon)
642  continue;
643  if (dimuonCL < minprob)
644  continue;
645 
646  mu1Phi_.denominator->Fill(m.phi());
647  mu1Eta_.denominator->Fill(m.eta());
648  mu1Pt_.denominator->Fill(m.pt());
649  mu2Phi_.denominator->Fill(m1.phi());
650  mu2Eta_.denominator->Fill(m1.eta());
651  mu2Pt_.denominator->Fill(m1.pt());
652 
653  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
654  if (!matchToTrigger(hltpath1, m1))
655  continue;
656  if (!matchToTrigger(hltpath1, m))
657  continue;
658  mu1Phi_.numerator->Fill(m.phi(), PrescaleWeight);
659  mu1Eta_.numerator->Fill(m.eta(), PrescaleWeight);
660  mu1Pt_.numerator->Fill(m.pt(), PrescaleWeight);
661  mu2Phi_.numerator->Fill(m1.phi(), PrescaleWeight);
662  mu2Eta_.numerator->Fill(m1.eta(), PrescaleWeight);
663  mu2Pt_.numerator->Fill(m1.pt(), PrescaleWeight);
664  }
665 
666  break;
667 
668  case 4:
669 
670  if (dimuonCL < minprob)
671  continue;
672 
673  // fill mass plots without selecting mass region
674  DiMuMass_.denominator->Fill(DiMuMass);
675  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup) &&
676  !(seagull_ && m.charge() * deltaPhi(m.phi(), m1.phi()) > 0) && matchToTrigger(hltpath1, m1) &&
677  matchToTrigger(hltpath1, m))
678  DiMuMass_.numerator->Fill(DiMuMass, PrescaleWeight);
679 
680  if ((Jpsi_) && (!Upsilon_))
681  if (DiMuMass > maxmassJpsi || DiMuMass < minmassJpsi)
682  continue;
683  if ((!Jpsi_) && (Upsilon_))
684  if (DiMuMass > maxmassUpsilon || DiMuMass < minmassUpsilon)
685  continue;
686 
687  mu1Phi_.denominator->Fill(m.phi());
688  mu1Eta_.denominator->Fill(m.eta());
689  mu1Pt_.denominator->Fill(m.pt());
690  mu2Phi_.denominator->Fill(m1.phi());
691  mu2Eta_.denominator->Fill(m1.eta());
692  mu2Pt_.denominator->Fill(m1.pt());
693  DiMuPt_.denominator->Fill((m1.p4() + m.p4()).Pt());
694  DiMuEta_.denominator->Fill((m1.p4() + m.p4()).Eta());
695  DiMuPhi_.denominator->Fill((m1.p4() + m.p4()).Phi());
697 
698  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
699  if (seagull_ && m.charge() * deltaPhi(m.phi(), m1.phi()) > 0)
700  continue;
701  if (!matchToTrigger(hltpath1, m1))
702  continue;
703  if (!matchToTrigger(hltpath1, m))
704  continue;
705  mu1Phi_.numerator->Fill(m.phi(), PrescaleWeight);
706  mu1Eta_.numerator->Fill(m.eta(), PrescaleWeight);
707  mu1Pt_.numerator->Fill(m.pt(), PrescaleWeight);
708  mu2Phi_.numerator->Fill(m1.phi(), PrescaleWeight);
709  mu2Eta_.numerator->Fill(m1.eta(), PrescaleWeight);
710  mu2Pt_.numerator->Fill(m1.pt(), PrescaleWeight);
711  DiMuPt_.numerator->Fill((m1.p4() + m.p4()).Pt(), PrescaleWeight);
712  DiMuEta_.numerator->Fill((m1.p4() + m.p4()).Eta(), PrescaleWeight);
713  DiMuPhi_.numerator->Fill((m1.p4() + m.p4()).Phi(), PrescaleWeight);
714  DiMudR_.numerator->Fill(reco::deltaR(m, m1), PrescaleWeight);
715  }
716 
717  break;
718 
719  case 5:
720 
721  if (dimuonCL < minprob)
722  continue;
723  if ((Jpsi_) && (!Upsilon_))
724  if (DiMuMass > maxmassJpsi || DiMuMass < minmassJpsi)
725  continue;
726  if ((!Jpsi_) && (Upsilon_))
727  if (DiMuMass > maxmassUpsilon || DiMuMass < minmassUpsilon)
728  continue;
729 
730  mu1Phi_.denominator->Fill(m.phi());
731  mu1Eta_.denominator->Fill(m.eta());
732  mu1Pt_.denominator->Fill(m.pt());
733  mu2Phi_.denominator->Fill(m1.phi());
734  mu2Eta_.denominator->Fill(m1.eta());
735  mu2Pt_.denominator->Fill(m1.pt());
736  DiMuPt_.denominator->Fill((m1.p4() + m.p4()).Pt());
737  DiMuEta_.denominator->Fill((m1.p4() + m.p4()).Eta());
738  DiMuPhi_.denominator->Fill((m1.p4() + m.p4()).Phi());
740 
741  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
742  if (seagull_ && m.charge() * deltaPhi(m.phi(), m1.phi()) > 0)
743  continue;
744  if (!matchToTrigger(hltpath1, m1))
745  continue;
746  if (!matchToTrigger(hltpath1, m))
747  continue;
748  mu1Phi_.numerator->Fill(m.phi(), PrescaleWeight);
749  mu1Eta_.numerator->Fill(m.eta(), PrescaleWeight);
750  mu1Pt_.numerator->Fill(m.pt(), PrescaleWeight);
751  mu2Phi_.numerator->Fill(m1.phi(), PrescaleWeight);
752  mu2Eta_.numerator->Fill(m1.eta(), PrescaleWeight);
753  mu2Pt_.numerator->Fill(m1.pt(), PrescaleWeight);
754  DiMuPt_.numerator->Fill((m1.p4() + m.p4()).Pt(), PrescaleWeight);
755  DiMuEta_.numerator->Fill((m1.p4() + m.p4()).Eta(), PrescaleWeight);
756  DiMuPhi_.numerator->Fill((m1.p4() + m.p4()).Phi(), PrescaleWeight);
757  DiMudR_.numerator->Fill(reco::deltaR(m, m1), PrescaleWeight);
758  }
759 
760  break;
761 
762  case 6:
763 
764  if (dimuonCL < minprob)
765  continue;
766  if ((Jpsi_) && (!Upsilon_))
767  if (DiMuMass > maxmassJpsi || DiMuMass < minmassJpsi)
768  continue;
769  if ((!Jpsi_) && (Upsilon_))
770  if (DiMuMass > maxmassUpsilon || DiMuMass < minmassUpsilon)
771  continue;
772 
773  for (auto const& m2 : *muoHandle) {
774  if (m2.pt() == m.pt())
775  continue; // remove duplicates but do not introduce ordering
776  if (m2.pt() == m1.pt())
777  continue; // -> m2 will be the non-resonant and non-vertexing muon in the triplet
778  if (!matchToTrigger(hltpath, m2))
779  continue;
780 
781  mu1Phi_.denominator->Fill(m.phi());
782  mu1Eta_.denominator->Fill(m.eta());
783  mu1Pt_.denominator->Fill(m.pt());
784  mu2Phi_.denominator->Fill(m1.phi());
785  mu2Eta_.denominator->Fill(m1.eta());
786  mu2Pt_.denominator->Fill(m1.pt());
787  mu3Phi_.denominator->Fill(m2.phi());
788  mu3Eta_.denominator->Fill(m2.eta());
789  mu3Pt_.denominator->Fill(m2.pt());
790 
791  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
792  if (!matchToTrigger(hltpath1, m1))
793  continue;
794  if (!matchToTrigger(hltpath1, m))
795  continue;
796  if (!matchToTrigger(hltpath1, m2))
797  continue;
798  mu1Phi_.numerator->Fill(m.phi(), PrescaleWeight);
799  mu1Eta_.numerator->Fill(m.eta(), PrescaleWeight);
800  mu1Pt_.numerator->Fill(m.pt(), PrescaleWeight);
801  mu2Phi_.numerator->Fill(m1.phi(), PrescaleWeight);
802  mu2Eta_.numerator->Fill(m1.eta(), PrescaleWeight);
803  mu2Pt_.numerator->Fill(m1.pt(), PrescaleWeight);
804  mu3Phi_.numerator->Fill(m2.phi(), PrescaleWeight);
805  mu3Eta_.numerator->Fill(m2.eta(), PrescaleWeight);
806  mu3Pt_.numerator->Fill(m2.pt(), PrescaleWeight);
807  }
808  }
809 
810  break;
811 
812  case 7:
813 
814  if (phHandle.isValid()) {
815  if (!phHandle->empty())
816  for (auto const& p : *phHandle) {
817  if (!matchToTrigger(hltpath, p))
818  continue;
819 
820  phPhi_.denominator->Fill(p.phi());
821  phEta_.denominator->Fill(p.eta());
822  phPt_.denominator->Fill(p.pt());
823 
824  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
825  if (!matchToTrigger(hltpath1, p))
826  continue;
827  if (!matchToTrigger(hltpath1, m))
828  continue;
829  if (!matchToTrigger(hltpath1, m1))
830  continue;
831  phPhi_.numerator->Fill(p.phi(), PrescaleWeight);
832  phEta_.numerator->Fill(p.eta(), PrescaleWeight);
833  phPt_.numerator->Fill(p.pt(), PrescaleWeight);
834  }
835  }
836  } else {
837  if (!warningPrinted4token_[3]) {
838  warningPrinted4token_[3] = true;
839  if (phInputTag_.label().empty())
840  edm::LogWarning("BPHMonitor") << "PhotonCollection not set";
841  else
842  edm::LogWarning("BPHMonitor") << "skipping events because the collection "
843  << phInputTag_.label().c_str() << " is not available";
844  }
845  // if Handle is not valid, because the InputTag has been mis-configured, then skip the event
846  if (!phInputTag_.label().empty())
847  return;
848  }
849 
850  break;
851 
852  case 8: //vtx monitoring, filling probability, DS, DCA, cos of pointing angle to the PV, eta, pT of dimuon
853 
854  if (displaced_)
855  if ((displacementFromBeamspotJpsi.perp() / sqrt(jerr.rerr(displacementFromBeamspotJpsi))) < minDS)
856  continue;
857  if ((Jpsi_) && (!Upsilon_))
858  if (DiMuMass > maxmassJpsi || DiMuMass < minmassJpsi)
859  continue;
860  if ((!Jpsi_) && (Upsilon_))
861  if (DiMuMass > maxmassUpsilon || DiMuMass < minmassUpsilon)
862  continue;
863 
864  // fill vtx-prob plots before selecting on this variable
865  DiMuProb_.denominator->Fill(dimuonCL);
866  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup) &&
867  matchToTrigger(hltpath1, m1) && matchToTrigger(hltpath1, m))
868  DiMuProb_.numerator->Fill(dimuonCL, PrescaleWeight);
869 
870  if (dimuonCL < minprob)
871  continue;
872 
873  DiMuDS_.denominator->Fill(displacementFromBeamspotJpsi.perp() /
874  sqrt(jerr.rerr(displacementFromBeamspotJpsi)));
875  DiMuPVcos_.denominator->Fill(jpsi_cos);
876  DiMuPt_.denominator->Fill((m1.p4() + m.p4()).Pt());
877  DiMuEta_.denominator->Fill((m1.p4() + m.p4()).Eta());
878  DiMuPhi_.denominator->Fill((m1.p4() + m.p4()).Phi());
880 
881  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
882  if (!matchToTrigger(hltpath1, m1))
883  continue;
884  if (!matchToTrigger(hltpath1, m))
885  continue;
887  displacementFromBeamspotJpsi.perp() / sqrt(jerr.rerr(displacementFromBeamspotJpsi)), PrescaleWeight);
888  DiMuPVcos_.numerator->Fill(jpsi_cos, PrescaleWeight);
889  DiMuPt_.numerator->Fill((m1.p4() + m.p4()).Pt(), PrescaleWeight);
890  DiMuEta_.numerator->Fill((m1.p4() + m.p4()).Eta(), PrescaleWeight);
891  DiMuPhi_.numerator->Fill((m1.p4() + m.p4()).Phi(), PrescaleWeight);
892  DiMuDCA_.numerator->Fill(cApp.distance(), PrescaleWeight);
893  }
894 
895  break;
896 
897  case 9:
898 
899  if (dimuonCL < minprob)
900  continue;
901  if (fabs(jpsi_cos) < mincos)
902  continue;
903  if ((displacementFromBeamspotJpsi.perp() / sqrt(jerr.rerr(displacementFromBeamspotJpsi))) < minDS)
904  continue;
905 
906  if (trHandle.isValid())
907  for (auto const& t : *trHandle) {
908  if (!trSelection_ref(t))
909  continue;
910  const reco::Track& itrk1 = t;
911  if (reco::deltaR(t, m1) <= min_dR)
912  continue;
913  if (reco::deltaR(t, m) <= min_dR)
914  continue;
916  continue;
917 
918  // reconstruct B+ hadron
920  double trackMass2 = kaon_mass * kaon_mass;
921  double MuMass2 = mu_mass * mu_mass;
922  double e1 = sqrt(m.momentum().Mag2() + MuMass2);
923  double e2 = sqrt(m1.momentum().Mag2() + MuMass2);
924  double e3 = sqrt(itrk1.momentum().Mag2() + trackMass2);
925  p1 = reco::Particle::LorentzVector(m.px(), m.py(), m.pz(), e1);
926  p2 = reco::Particle::LorentzVector(m1.px(), m1.py(), m1.pz(), e2);
927  p3 = reco::Particle::LorentzVector(itrk1.px(), itrk1.py(), itrk1.pz(), e3);
928  pB = p1 + p2 + p3;
929  if (pB.mass() > maxmassJpsiTk || pB.mass() < minmassJpsiTk)
930  continue;
931  reco::TransientTrack trTT(itrk1, &(*bFieldHandle));
932  std::vector<reco::TransientTrack> t_tks;
933  t_tks.push_back(mu1TT);
934  t_tks.push_back(mu2TT);
935  t_tks.push_back(trTT);
936  KalmanVertexFitter kvf;
937  TransientVertex tv = kvf.vertex(t_tks);
938  reco::Vertex vertex = tv;
939  if (!tv.isValid())
940  continue;
941  float JpsiTkCL = 0;
942  if ((vertex.chi2() >= 0.0) && (vertex.ndof() > 0))
943  JpsiTkCL = TMath::Prob(vertex.chi2(), vertex.ndof());
944  math::XYZVector pperp(m.px() + m1.px() + itrk1.px(), m.py() + m1.py() + itrk1.py(), 0.);
947  GlobalPoint displacementFromBeamspot(
948  -1 * ((vertexBeamSpot.x0() - secondaryVertex.x()) +
949  (secondaryVertex.z() - vertexBeamSpot.z0()) * vertexBeamSpot.dxdz()),
950  -1 * ((vertexBeamSpot.y0() - secondaryVertex.y()) +
951  (secondaryVertex.z() - vertexBeamSpot.z0()) * vertexBeamSpot.dydz()),
952  0);
953  reco::Vertex::Point vperp(displacementFromBeamspot.x(), displacementFromBeamspot.y(), 0.);
954  float jpsiKcos = vperp.Dot(pperp) / (vperp.R() * pperp.R());
955  if (JpsiTkCL < minprob)
956  continue;
957  if (fabs(jpsiKcos) < mincos)
958  continue;
959  if ((displacementFromBeamspot.perp() / sqrt(err.rerr(displacementFromBeamspot))) < minDS)
960  continue;
961 
962  muPhi_.denominator->Fill(t.phi());
963  muEta_.denominator->Fill(t.eta());
964  muPt_.denominator->Fill(t.pt());
965  BMass_.denominator->Fill(pB.mass());
966 
967  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
968  if (!matchToTrigger(hltpath1, m1))
969  continue;
970  if (!matchToTrigger(hltpath1, m))
971  continue;
972  if (!matchToTrigger(hltpath1, t))
973  continue;
974  muPhi_.numerator->Fill(t.phi(), PrescaleWeight);
975  muEta_.numerator->Fill(t.eta(), PrescaleWeight);
976  muPt_.numerator->Fill(t.pt(), PrescaleWeight);
977  BMass_.numerator->Fill(pB.mass(), PrescaleWeight);
978  }
979  }
980 
981  break;
982 
983  case 10:
984 
985  if (trHandle.isValid())
986  for (auto const& t : *trHandle) {
987  if (!trSelection_ref(t))
988  continue;
989  const reco::Track& itrk1 = t;
990  if (reco::deltaR(t, m1) <= min_dR)
991  continue;
992  if (reco::deltaR(t, m) <= min_dR)
993  continue;
995  continue;
996 
997  // reconstruct Mu+TkMu structure
999  double trackMass2 = kaon_mass * kaon_mass;
1000  double MuMass2 = mu_mass * mu_mass;
1001  double e2 = sqrt(m1.momentum().Mag2() + MuMass2);
1002  double e3 = sqrt(itrk1.momentum().Mag2() + trackMass2);
1003  p2 = reco::Particle::LorentzVector(m1.px(), m1.py(), m1.pz(), e2);
1004  p3 = reco::Particle::LorentzVector(itrk1.px(), itrk1.py(), itrk1.pz(), e3);
1005  pB = p2 + p3;
1006  if (pB.mass() > maxmassJpsiTk || pB.mass() < minmassJpsiTk)
1007  continue;
1008  reco::TransientTrack trTT(itrk1, &(*bFieldHandle));
1009  std::vector<reco::TransientTrack> t_tks;
1010  t_tks.push_back(mu2TT);
1011  t_tks.push_back(trTT);
1012  KalmanVertexFitter kvf;
1013  TransientVertex tv = kvf.vertex(t_tks);
1014  reco::Vertex vertex = tv;
1015  if (!tv.isValid())
1016  continue;
1017  float JpsiTkCL = 0;
1018  if ((vertex.chi2() >= 0.0) && (vertex.ndof() > 0))
1019  JpsiTkCL = TMath::Prob(vertex.chi2(), vertex.ndof());
1020  math::XYZVector pperp(m1.px() + itrk1.px(), m1.py() + itrk1.py(), 0.);
1022  GlobalError err = tv.positionError();
1023  GlobalPoint displacementFromBeamspot(
1024  -1 * ((vertexBeamSpot.x0() - secondaryVertex.x()) +
1025  (secondaryVertex.z() - vertexBeamSpot.z0()) * vertexBeamSpot.dxdz()),
1026  -1 * ((vertexBeamSpot.y0() - secondaryVertex.y()) +
1027  (secondaryVertex.z() - vertexBeamSpot.z0()) * vertexBeamSpot.dydz()),
1028  0);
1029  reco::Vertex::Point vperp(displacementFromBeamspot.x(), displacementFromBeamspot.y(), 0.);
1030  if (JpsiTkCL < minprob)
1031  continue;
1032 
1033  muPhi_.denominator->Fill(m1.phi());
1034  muEta_.denominator->Fill(m1.eta());
1035  muPt_.denominator->Fill(m1.pt());
1036 
1037  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
1038  if (!matchToTrigger(hltpath1, m1))
1039  continue;
1040  if (!matchToTrigger(hltpath1, m))
1041  continue;
1042  if (!matchToTrigger(hltpath1, t))
1043  continue;
1044  muPhi_.numerator->Fill(m1.phi(), PrescaleWeight);
1045  muEta_.numerator->Fill(m1.eta(), PrescaleWeight);
1046  muPt_.numerator->Fill(m1.pt(), PrescaleWeight);
1047  }
1048  }
1049 
1050  break;
1051 
1052  case 11:
1053 
1054  if (dimuonCL < minprob)
1055  continue;
1056  if (fabs(jpsi_cos) < mincos)
1057  continue;
1058  if (displacementFromBeamspotJpsi.perp() / sqrt(jerr.rerr(displacementFromBeamspotJpsi)) < minDS)
1059  continue;
1060 
1061  if (trHandle.isValid())
1062  for (auto const& t : *trHandle) {
1063  if (!trSelection_ref(t))
1064  continue;
1065  if ((reco::deltaR(t, m) <= min_dR))
1066  continue;
1067  if ((reco::deltaR(t, m1) <= min_dR))
1068  continue;
1069 
1070  for (auto const& t1 : *trHandle) {
1071  if (&t - &(*trHandle)[0] >= &t1 - &(*trHandle)[0])
1072  continue; // not enough, need the following DeltaR checks
1073  if (!trSelection_ref(t1))
1074  continue;
1075  if ((reco::deltaR(t1, m) <= min_dR))
1076  continue;
1077  if ((reco::deltaR(t1, m1) <= min_dR))
1078  continue;
1079  if ((reco::deltaR(t, t1) <= min_dR))
1080  continue;
1081  const reco::Track& itrk1 = t;
1082  const reco::Track& itrk2 = t1;
1084  continue;
1086  continue;
1087 
1088  // reconstruct Bs candidate
1089  reco::Particle::LorentzVector pB, pTkTk, p1, p2, p3, p4;
1090  double trackMass2 = kaon_mass * kaon_mass;
1091  double MuMass2 = mu_mass * mu_mass;
1092  double e1 = sqrt(m.momentum().Mag2() + MuMass2);
1093  double e2 = sqrt(m1.momentum().Mag2() + MuMass2);
1094  double e3 = sqrt(itrk1.momentum().Mag2() + trackMass2);
1095  double e4 = sqrt(itrk2.momentum().Mag2() + trackMass2);
1096  p1 = reco::Particle::LorentzVector(m.px(), m.py(), m.pz(), e1);
1097  p2 = reco::Particle::LorentzVector(m1.px(), m1.py(), m1.pz(), e2);
1098  p3 = reco::Particle::LorentzVector(itrk1.px(), itrk1.py(), itrk1.pz(), e3);
1099  p4 = reco::Particle::LorentzVector(itrk2.px(), itrk2.py(), itrk2.pz(), e4);
1100  pTkTk = p3 + p4;
1101  if (pTkTk.mass() > maxmassTkTk || pTkTk.mass() < minmassTkTk)
1102  continue;
1103  pB = p1 + p2 + p3 + p4;
1104  if (pB.mass() > maxmassJpsiTk || pB.mass() < minmassJpsiTk)
1105  continue;
1106  reco::TransientTrack mu1TT(m.track(), &(*bFieldHandle));
1107  reco::TransientTrack mu2TT(m1.track(), &(*bFieldHandle));
1108  reco::TransientTrack trTT(itrk1, &(*bFieldHandle));
1109  reco::TransientTrack tr1TT(itrk2, &(*bFieldHandle));
1110  std::vector<reco::TransientTrack> t_tks;
1111  t_tks.push_back(mu1TT);
1112  t_tks.push_back(mu2TT);
1113  t_tks.push_back(trTT);
1114  t_tks.push_back(tr1TT);
1115  KalmanVertexFitter kvf;
1116  TransientVertex tv = kvf.vertex(t_tks); // this will compare the tracks
1117  reco::Vertex vertex = tv;
1118  if (!tv.isValid())
1119  continue;
1120  float JpsiTkCL = 0;
1121  if ((vertex.chi2() >= 0.0) && (vertex.ndof() > 0))
1122  JpsiTkCL = TMath::Prob(vertex.chi2(), vertex.ndof());
1123  math::XYZVector pperp(
1124  m.px() + m1.px() + itrk1.px() + itrk2.px(), m.py() + m1.py() + itrk1.py() + itrk2.py(), 0.);
1126  GlobalError err = tv.positionError();
1127  GlobalPoint displacementFromBeamspot(
1128  -1 * ((vertexBeamSpot.x0() - secondaryVertex.x()) +
1129  (secondaryVertex.z() - vertexBeamSpot.z0()) * vertexBeamSpot.dxdz()),
1130  -1 * ((vertexBeamSpot.y0() - secondaryVertex.y()) +
1131  (secondaryVertex.z() - vertexBeamSpot.z0()) * vertexBeamSpot.dydz()),
1132  0);
1133  reco::Vertex::Point vperp(displacementFromBeamspot.x(), displacementFromBeamspot.y(), 0.);
1134  float jpsiKcos = vperp.Dot(pperp) / (vperp.R() * pperp.R());
1135  if (JpsiTkCL < minprob)
1136  continue;
1137  if (fabs(jpsiKcos) < mincos)
1138  continue;
1139  if ((displacementFromBeamspot.perp() / sqrt(err.rerr(displacementFromBeamspot))) < minDS)
1140  continue;
1141 
1142  mu1Phi_.denominator->Fill(t.phi());
1143  mu1Eta_.denominator->Fill(t.eta());
1144  mu1Pt_.denominator->Fill(t.pt());
1145  mu2Phi_.denominator->Fill(t1.phi());
1146  mu2Eta_.denominator->Fill(t1.eta());
1147  mu2Pt_.denominator->Fill(t1.pt());
1148  BMass_.denominator->Fill(pB.mass());
1149 
1150  if (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup)) {
1151  if (!matchToTrigger(hltpath1, m))
1152  continue;
1153  if (!matchToTrigger(hltpath1, m1))
1154  continue;
1155  if (!matchToTrigger(hltpath1, t))
1156  continue;
1157  if (!matchToTrigger(hltpath1, t1))
1158  continue;
1159  mu1Phi_.numerator->Fill(t.phi(), PrescaleWeight);
1160  mu1Eta_.numerator->Fill(t.eta(), PrescaleWeight);
1161  mu1Pt_.numerator->Fill(t.pt(), PrescaleWeight);
1162  mu2Phi_.numerator->Fill(t1.phi(), PrescaleWeight);
1163  mu2Eta_.numerator->Fill(t1.eta(), PrescaleWeight);
1164  mu2Pt_.numerator->Fill(t1.pt(), PrescaleWeight);
1165  BMass_.numerator->Fill(pB.mass(), PrescaleWeight);
1166  }
1167 
1168  } // for (auto const & t1 : *trHandle)
1169  } // for (auto const & t : *trHandle)
1170 
1171  break;
1172  }
1173  }
1174  }
1175  }
1176 }
1177 
1179  pset.addNode((edm::ParameterDescription<int>("nbins", true) and edm::ParameterDescription<double>("xmin", true) and
1180  edm::ParameterDescription<double>("xmax", true)) xor
1181  edm::ParameterDescription<std::vector<double>>("edges", true));
1182 }
1183 
1185 
1188  desc.add<std::string>("FolderName", "HLT/BPH/");
1189  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
1190  desc.add<edm::InputTag>("photons", edm::InputTag("photons"));
1191  desc.add<edm::InputTag>("offlinePVs", edm::InputTag("offlinePrimaryVertices"));
1192  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
1193  desc.add<edm::InputTag>("muons", edm::InputTag("muons"));
1194  desc.add<edm::InputTag>("hltTriggerSummaryAOD", edm::InputTag("hltTriggerSummaryAOD", "", "HLT"));
1195  desc.add<std::string>("muoSelection", "");
1196  desc.add<std::string>("muoSelection_ref",
1197  "isPFMuon & isGlobalMuon & innerTrack.hitPattern.trackerLayersWithMeasurement>5 & "
1198  "innerTrack.hitPattern.numberOfValidPixelHits> 0");
1199  desc.add<std::string>(
1200  "muoSelection_tag",
1201  "isGlobalMuon && isPFMuon && isTrackerMuon && abs(eta) < 2.4 && innerTrack.hitPattern.numberOfValidPixelHits > 0 "
1202  "&& innerTrack.hitPattern.trackerLayersWithMeasurement > 5 && globalTrack.hitPattern.numberOfValidMuonHits > 0 "
1203  "&& globalTrack.normalizedChi2 < 10"); // tight selection for tag muon
1204  desc.add<std::string>("muoSelection_probe",
1205  "isPFMuon & isGlobalMuon & innerTrack.hitPattern.trackerLayersWithMeasurement>5 & "
1206  "innerTrack.hitPattern.numberOfValidPixelHits> 0");
1207  desc.add<std::string>("trSelection_ref", "");
1208  desc.add<std::string>("DMSelection_ref", "Pt>4 & abs(eta)");
1209 
1210  desc.add<int>("nmuons", 1);
1211  desc.add<bool>("tnp", false);
1212  desc.add<int>("L3", 0);
1213  desc.add<int>("ptCut", 0);
1214  desc.add<int>("displaced", 0);
1215  desc.add<int>("trOrMu", 0); // if =0, track param monitoring
1216  desc.add<int>("Jpsi", 0);
1217  desc.add<int>("Upsilon", 0);
1218  desc.add<int>("enum", 1); // 1...9, 9 sets of variables to be filled, depends on the hlt path
1219  desc.add<int>("seagull", 1);
1220  desc.add<double>("maxmass", 3.596);
1221  desc.add<double>("minmass", 2.596);
1222  desc.add<double>("maxmassJpsi", 3.2);
1223  desc.add<double>("minmassJpsi", 3.);
1224  desc.add<double>("maxmassUpsilon", 10.0);
1225  desc.add<double>("minmassUpsilon", 8.8);
1226  desc.add<double>("maxmassTkTk", 10);
1227  desc.add<double>("minmassTkTk", 0);
1228  desc.add<double>("maxmassJpsiTk", 5.46);
1229  desc.add<double>("minmassJpsiTk", 5.1);
1230  desc.add<double>("kaon_mass", 0.493677);
1231  desc.add<double>("mu_mass", 0.1056583745);
1232  desc.add<double>("min_dR", 0.001);
1233  desc.add<double>("max_dR", 1.4);
1234  desc.add<double>("minprob", 0.005);
1235  desc.add<double>("mincos", 0.95);
1236  desc.add<double>("minDS", 3.);
1237 
1239  genericTriggerEventPSet.add<bool>("andOr");
1240  genericTriggerEventPSet.add<edm::InputTag>("dcsInputTag", edm::InputTag("scalersRawToDigi"));
1241  genericTriggerEventPSet.add<edm::InputTag>("hltInputTag", edm::InputTag("TriggerResults::HLT"));
1242  genericTriggerEventPSet.add<std::vector<int>>("dcsPartitions", {});
1243  genericTriggerEventPSet.add<bool>("andOrDcs", false);
1244  genericTriggerEventPSet.add<bool>("errorReplyDcs", true);
1245  genericTriggerEventPSet.add<std::string>("dbLabel", "");
1246  genericTriggerEventPSet.add<bool>("andOrHlt", true);
1247  genericTriggerEventPSet.add<bool>("andOrL1", true);
1248  genericTriggerEventPSet.add<std::vector<std::string>>("hltPaths", {});
1249  genericTriggerEventPSet.add<std::vector<std::string>>("l1Algorithms", {});
1250  genericTriggerEventPSet.add<std::string>("hltDBKey", "");
1251  genericTriggerEventPSet.add<bool>("errorReplyHlt", false);
1252  genericTriggerEventPSet.add<bool>("errorReplyL1", true);
1253  genericTriggerEventPSet.add<bool>("l1BeforeMask", true);
1254  genericTriggerEventPSet.add<unsigned int>("verbosityLevel", 0);
1255  desc.add<edm::ParameterSetDescription>("numGenericTriggerEventPSet", genericTriggerEventPSet);
1256  desc.add<edm::ParameterSetDescription>("denGenericTriggerEventPSet", genericTriggerEventPSet);
1257 
1274  fillHistoPSetDescription(phiPSet);
1275  fillHistoPSetDescription(ptPSet);
1276  fillHistoPSetDescription(dMu_ptPSet);
1277  fillHistoPSetDescription(etaPSet);
1278  fillHistoPSetDescription(z0PSet);
1279  fillHistoPSetDescription(d0PSet);
1280  fillHistoPSetDescription(dRPSet);
1281  fillHistoPSetDescription(massPSet);
1282  fillHistoPSetDescription(BmassPSet);
1283  fillHistoPSetDescription(dcaPSet);
1284  fillHistoPSetDescription(dsPSet);
1285  fillHistoPSetDescription(cosPSet);
1286  fillHistoPSetDescription(probPSet);
1287  histoPSet.add<edm::ParameterSetDescription>("d0PSet", d0PSet);
1288  histoPSet.add<edm::ParameterSetDescription>("etaPSet", etaPSet);
1289  histoPSet.add<edm::ParameterSetDescription>("phiPSet", phiPSet);
1290  histoPSet.add<edm::ParameterSetDescription>("ptPSet", ptPSet);
1291  histoPSet.add<edm::ParameterSetDescription>("dMu_ptPSet", dMu_ptPSet);
1292  histoPSet.add<edm::ParameterSetDescription>("z0PSet", z0PSet);
1293  histoPSet.add<edm::ParameterSetDescription>("dRPSet", dRPSet);
1294  histoPSet.add<edm::ParameterSetDescription>("massPSet", massPSet);
1295  histoPSet.add<edm::ParameterSetDescription>("BmassPSet", BmassPSet);
1296  histoPSet.add<edm::ParameterSetDescription>("dcaPSet", dcaPSet);
1297  histoPSet.add<edm::ParameterSetDescription>("dsPSet", dsPSet);
1298  histoPSet.add<edm::ParameterSetDescription>("cosPSet", cosPSet);
1299  histoPSet.add<edm::ParameterSetDescription>("probPSet", probPSet);
1300  desc.add<edm::ParameterSetDescription>("histoPSet", histoPSet);
1301  descriptions.add("bphMonitoring", desc);
1302 }
1303 
1305  const std::string trigger_name_tmp = partialName.substr(0, partialName.find("v*"));
1306  const unsigned int Ntriggers(hltConfig_.size());
1307  std::string trigger_name = "";
1308  for (unsigned int i = 0; i < Ntriggers; i++) {
1309  trigger_name = hltConfig_.triggerName(i);
1310  if (trigger_name.find(trigger_name_tmp) != std::string::npos)
1311  break;
1312  }
1313 
1314  return trigger_name;
1315 }
1316 
1317 template <typename T>
1318 bool BPHMonitor::matchToTrigger(const std::string& theTriggerName, T t) {
1319  bool matched = false;
1320  //validity check
1321  if (!hltConfig_.inited())
1322  return false;
1323 
1324  //Find the precise trigger name
1325  std::string trigger_name = getTriggerName(theTriggerName);
1326  const unsigned int trigger_index = hltConfig_.triggerIndex(trigger_name);
1327 
1328  //loop over all the modules for this trigger
1329  //by default use the last one
1330  unsigned int Nmodules = hltConfig_.size(trigger_index);
1331  const vector<string>& moduleLabels(hltConfig_.moduleLabels(trigger_index));
1332  unsigned int fIdx = 0;
1333  for (unsigned int i = 0; i < Nmodules; i++) {
1334  const unsigned int tmp_fIdx =
1336  if (tmp_fIdx < handleTriggerEvent->sizeFilters()) //index of not used filters are set to sizeFilters()
1337  {
1338  fIdx = tmp_fIdx;
1339  } //good index
1340  }
1341 
1342  //loop over all the objects in the filter of choice
1343  const trigger::Keys& KEYS(handleTriggerEvent->filterKeys(fIdx));
1344  const trigger::size_type nK(KEYS.size());
1346  for (trigger::size_type i = 0; i != nK; ++i) {
1347  const trigger::TriggerObject& TO(TOC[KEYS[i]]);
1348  //perform matching: deltaR and pt check
1349  if ((reco::deltaR(t.eta(), t.phi(), TO.eta(), TO.phi()) <= 0.2) && (TMath::Abs(t.pt() - TO.pt()) < 0.12)) {
1350  matched = true;
1351  }
1352  }
1353 
1354  return matched;
1355 }
1356 
1357 double BPHMonitor::Prescale(const std::string hltpath1,
1358  const std::string hltpath,
1359  edm::Event const& iEvent,
1360  edm::EventSetup const& iSetup,
1362  int PrescaleHLT_num = 1;
1363  int PrescaleHLT_den = 1;
1364  double Prescale_num = 1;
1365  double L1P = 1, HLTP = 1;
1366  bool flag = true;
1367  std::vector<bool> theSame_den;
1368  std::vector<bool> theSame_num;
1369  //retrieving HLT prescale
1370  PrescaleHLT_den = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath)).second;
1371  PrescaleHLT_num = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).second;
1372  if (PrescaleHLT_den > 0 && PrescaleHLT_num > 0)
1373  HLTP = PrescaleHLT_num / std::__gcd(PrescaleHLT_num, PrescaleHLT_den);
1374 
1375  //retrieving L1 prescale
1376  //Checking if we have the same l1 seeds in den and num
1377  //taking into account that they can be written in different order in num and den
1378  //and some of them can be also switched off
1379 
1380  //check if for each den l1 there is the same l1 seed in num
1381  if (!(hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath)).first.empty()) {
1382  for (size_t iSeed = 0; iSeed < (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath)).first.size();
1383  ++iSeed) {
1384  std::string l1_den = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath)).first.at(iSeed).first;
1385  int l1_denp = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath)).first.at(iSeed).second;
1386  if (l1_denp < 1)
1387  continue;
1388  flag = false;
1389  for (size_t iSeed1 = 0; iSeed1 < (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.size();
1390  ++iSeed1) {
1391  std::string l1_num = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.at(iSeed1).first;
1392  int l1_nump = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.at(iSeed1).second;
1393  if (l1_num == l1_den && l1_nump >= 1) //the same seed
1394  {
1395  flag = true;
1396  break;
1397  }
1398  }
1399  theSame_den.push_back(flag);
1400  }
1401  }
1402  //check if for each num l1 there is the same l1 seed in den
1403  if (!(hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.empty()) {
1404  for (size_t iSeed = 0; iSeed < (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.size();
1405  ++iSeed) {
1406  std::string l1_num = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.at(iSeed).first;
1407  int l1_nump = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.at(iSeed).second;
1408  if (l1_nump < 1)
1409  continue;
1410  flag = false;
1411  for (size_t iSeed1 = 0; iSeed1 < (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath)).first.size();
1412  ++iSeed1) {
1413  std::string l1_den = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath)).first.at(iSeed1).first;
1414  int l1_denp = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath)).first.at(iSeed1).second;
1415  if (l1_den == l1_num && l1_denp >= 1) //the same seed
1416  {
1417  flag = true;
1418  break;
1419  }
1420  }
1421  theSame_num.push_back(flag);
1422  }
1423  }
1424  flag = true;
1425 
1426  if (theSame_num.size() == theSame_den.size()) {
1427  for (size_t i = 0; i < theSame_num.size(); ++i) {
1428  if ((!theSame_num.at(i)) || (!theSame_den.at(i))) {
1429  flag = false;
1430  break;
1431  }
1432  }
1433  }
1434 
1435  if (flag && (theSame_num.size() == theSame_den.size())) {
1436  L1P = 1; //den and num have the same set of l1 seeds
1437  } else {
1438  if (!(hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.empty()) {
1439  Prescale_num = 1;
1440  for (size_t iSeed = 0; iSeed < (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.size();
1441  ++iSeed) {
1442  int l1 = (hltPrescale_->prescaleValuesInDetail(iEvent, iSetup, hltpath1)).first.at(iSeed).second;
1443  if (l1 < 1)
1444  continue;
1445  if (l1 == 1) {
1446  Prescale_num = 1;
1447  break;
1448  } else
1449  Prescale_num *= 1 - (1.0 / (l1));
1450  }
1451  if (Prescale_num != 1)
1452  Prescale_num = 1.0 / (1 - Prescale_num);
1453  }
1454  L1P = Prescale_num;
1455  }
1456 
1457  return L1P * HLTP;
1458 }
1459 
unsigned int size() const
number of trigger paths in trigger table
GlobalError positionError() const
int seagull_
Definition: BPHMonitor.h:238
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:65
METME mu2Phi_
Definition: BPHMonitor.h:197
int Upsilon_
Definition: BPHMonitor.h:236
METME DiMuDCA_
Definition: BPHMonitor.h:217
std::pair< std::vector< std::pair< std::string, int > >, int > prescaleValuesInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
float distance() const override
METME phEta_
Definition: BPHMonitor.h:209
METME phPt_
Definition: BPHMonitor.h:210
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
T perp() const
Definition: PV3DBase.h:69
double maxmassJpsiTk
Definition: BPHMonitor.h:247
double kaon_mass
Definition: BPHMonitor.h:249
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
METME mu2Pt_
Definition: BPHMonitor.h:199
const std::string & triggerName(unsigned int triggerIndex) const
METME muPt_
Definition: BPHMonitor.h:188
HLTPrescaleProvider * hltPrescale_
Definition: BPHMonitor.h:224
METME mu1Eta_
Definition: BPHMonitor.h:193
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
METME phPhi_
Definition: BPHMonitor.h:208
float phi() const
Definition: TriggerObject.h:54
const FreeTrajectoryState & theState() const
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
StringCutObjectSelector< reco::Candidate::LorentzVector, true > DMSelection_ref
Definition: BPHMonitor.h:264
edm::EDGetTokenT< reco::MuonCollection > muoToken_
Definition: BPHMonitor.h:167
void bookME(DQMStore::IBooker &, METME &me, std::string &histname, std::string &histtitle, int &nbins, double &xmin, double &xmax)
Definition: BPHMonitor.cc:201
dqm::reco::MonitorElement * denominator
Definition: BPHMonitor.h:69
edm::InputTag bsInputTag_
Definition: BPHMonitor.h:162
std::string folderName_
Definition: BPHMonitor.h:158
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:132
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
double Prescale(const std::string num, const std::string den, edm::Event const &iEvent, edm::EventSetup const &iSetup, HLTPrescaleProvider *hltPrescale_)
Definition: BPHMonitor.cc:1357
T y() const
Definition: PV3DBase.h:60
static void fillHistoLSPSetDescription(edm::ParameterSetDescription &pset)
Definition: BPHMonitor.cc:1184
METME mu2Eta_
Definition: BPHMonitor.h:198
dqm::reco::MonitorElement * numerator
Definition: BPHMonitor.h:68
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
StringCutObjectSelector< reco::Muon, true > muoSelection_ref
Definition: BPHMonitor.h:226
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
METME DiMuPhi_
Definition: BPHMonitor.h:211
METME mu3Pt_
Definition: BPHMonitor.h:204
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
MEbinning eta_binning_
Definition: BPHMonitor.h:175
float eta() const
Definition: TriggerObject.h:53
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:605
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:629
edm::EDGetTokenT< trigger::TriggerEvent > hltInputTag_
Definition: BPHMonitor.h:259
double maxmassTkTk
Definition: BPHMonitor.h:245
uint16_t size_type
edm::EDGetTokenT< reco::TrackCollection > trToken_
Definition: BPHMonitor.h:169
double minmass_
Definition: BPHMonitor.h:240
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
double minprob
Definition: BPHMonitor.h:254
bool inited() const
Accessors (const methods)
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
U second(std::pair< T, U > const &p)
METME mu1Phi_
Definition: BPHMonitor.h:192
METME DiMuEta_
Definition: BPHMonitor.h:212
double dydz() const
dydz slope
Definition: BeamSpot.h:80
MEbinning dca_binning_
Definition: BPHMonitor.h:181
int displaced_
Definition: BPHMonitor.h:233
int iEvent
Definition: GenABIO.cc:224
void setMETitle(METME &me, std::string titleX, std::string titleY)
Definition: BPHMonitor.cc:194
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MEbinning pt_binning_
Definition: BPHMonitor.h:173
double mincos
Definition: BPHMonitor.h:255
double maxmassJpsi
Definition: BPHMonitor.h:241
std::vector< bool > warningPrinted4token_
Definition: BPHMonitor.h:272
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
edm::InputTag muoInputTag_
Definition: BPHMonitor.h:161
T sqrt(T t)
Definition: SSEVec.h:19
double p4[4]
Definition: TauolaWrapper.h:92
MEbinning dR_binning_
Definition: BPHMonitor.h:178
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
GlobalPoint position() const
T z() const
Definition: PV3DBase.h:61
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
Definition: DQMStore.cc:333
double mu_mass
Definition: BPHMonitor.h:250
StringCutObjectSelector< reco::Track, true > trSelection_ref
Definition: BPHMonitor.h:263
GenericTriggerEventFlag * den_genTriggerEventFlag_
Definition: BPHMonitor.h:223
T Abs(T a)
Definition: MathUtil.h:49
HLTConfigProvider hltConfig_
Definition: BPHMonitor.h:268
BPHMonitor(const edm::ParameterSet &)
Definition: BPHMonitor.cc:11
double chi2() const
chi-squares
Definition: Vertex.h:102
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
METME DiMuDS_
Definition: BPHMonitor.h:216
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
MEbinning phi_binning_
Definition: BPHMonitor.h:172
static void fillHistoPSetDescription(edm::ParameterSetDescription &pset)
Definition: BPHMonitor.cc:1178
T min(T a, T b)
Definition: MathUtil.h:58
MEbinning ds_binning_
Definition: BPHMonitor.h:182
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:70
double p2[4]
Definition: TauolaWrapper.h:90
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: BPHMonitor.cc:436
double maxmass_
Definition: BPHMonitor.h:239
MEbinning prob_binning_
Definition: BPHMonitor.h:184
MEbinning cos_binning_
Definition: BPHMonitor.h:183
double dxdz() const
dxdz slope
Definition: BeamSpot.h:78
double ndof() const
Definition: Vertex.h:109
std::vector< std::string > hltpaths_den
Definition: BPHMonitor.h:261
METME muz0_
Definition: BPHMonitor.h:190
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:611
METME DiMuProb_
Definition: BPHMonitor.h:215
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: BPHMonitor.cc:279
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
double minmassJpsiTk
Definition: BPHMonitor.h:248
edm::EDGetTokenT< reco::PhotonCollection > phToken_
Definition: BPHMonitor.h:170
edm::EDGetTokenT< reco::BeamSpot > bsToken_
Definition: BPHMonitor.h:168
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: BPHMonitor.cc:1186
~BPHMonitor() override
Definition: BPHMonitor.cc:163
double minDS
Definition: BPHMonitor.h:256
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
std::vector< size_type > Keys
T rerr(const GlobalPoint &aPoint) const
double minmassUpsilon
Definition: BPHMonitor.h:244
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
static MEbinning getHistoPSet(edm::ParameterSet pset)
Definition: BPHMonitor.cc:171
std::string getTriggerName(std::string partialName)
Definition: BPHMonitor.cc:1304
edm::Handle< trigger::TriggerEvent > handleTriggerEvent
Definition: BPHMonitor.h:266
void add(std::string const &label, ParameterSetDescription const &psetDescription)
StringCutObjectSelector< reco::Muon, true > muoSelection_
Definition: BPHMonitor.h:225
MEbinning dMu_pt_binning_
Definition: BPHMonitor.h:174
edm::InputTag hltInputTag_1
Definition: BPHMonitor.h:258
double maxmassUpsilon
Definition: BPHMonitor.h:243
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:531
HLTConfigProvider const & hltConfigProvider() const
std::string const & label() const
Definition: InputTag.h:36
std::string const & process() const
Definition: InputTag.h:40
double minmassTkTk
Definition: BPHMonitor.h:246
bool matchToTrigger(const std::string &theTriggerName, T t)
Definition: BPHMonitor.cc:1318
fixed size matrix
METME muEta_
Definition: BPHMonitor.h:187
HLT enums.
double p1[4]
Definition: TauolaWrapper.h:89
edm::InputTag trInputTag_
Definition: BPHMonitor.h:163
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
METME BMass_
Definition: BPHMonitor.h:219
METME DiMuMass_
Definition: BPHMonitor.h:218
T get() const
Definition: EventSetup.h:73
METME DiMuPt_
Definition: BPHMonitor.h:213
MEbinning mass_binning_
Definition: BPHMonitor.h:179
METME mud0_
Definition: BPHMonitor.h:189
double y0() const
y coordinate
Definition: BeamSpot.h:63
METME mu1Pt_
Definition: BPHMonitor.h:194
METME mu3Phi_
Definition: BPHMonitor.h:202
std::vector< std::string > hltpaths_num
Definition: BPHMonitor.h:260
METME mu3Eta_
Definition: BPHMonitor.h:203
double minmassJpsi
Definition: BPHMonitor.h:242
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
edm::InputTag phInputTag_
Definition: BPHMonitor.h:164
METME DiMuPVcos_
Definition: BPHMonitor.h:214
long double T
METME DiMudR_
Definition: BPHMonitor.h:220
T x() const
Definition: PV3DBase.h:59
GenericTriggerEventFlag * num_genTriggerEventFlag_
Definition: BPHMonitor.h:222
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
bool isValid() const
METME muPhi_
Definition: BPHMonitor.h:186
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
MEbinning Bmass_binning_
Definition: BPHMonitor.h:180
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:608
Definition: Run.h:45
double p3[4]
Definition: TauolaWrapper.h:91
double x0() const
x coordinate
Definition: BeamSpot.h:61
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
double min_dR
Definition: BPHMonitor.h:251