CMS 3D CMS Logo

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