CMS 3D CMS Logo

BPHHistoSpecificDecay.cc
Go to the documentation of this file.
1 
3 
5 
7 
9 
13 
15 
17 #include "TMath.h"
18 #include "Math/VectorUtil.h"
19 #include "TVector3.h"
20 
21 #include "TH1.h"
22 #include "TTree.h"
23 #include "TFile.h"
24 
25 #include <set>
26 #include <string>
27 #include <iostream>
28 #include <fstream>
29 #include <cmath>
30 
31 using namespace std;
32 
33 #define SET_LABEL(NAME, PSET) (NAME = PSET.getParameter<string>(#NAME))
34 // SET_LABEL(xyz,ps);
35 // is equivalent to
36 // xyz = ps.getParameter<string>( "xyx" );
37 
38 #define CAT3(A, B, C) A##B##C
39 #define STRING_NX(A) #A
40 #define STRING(A) STRING_NX(A)
41 #define CHK_TRIG(RESULTS, NAMES, INDEX, PATH) \
42  if (NAMES[INDEX].find(STRING(CAT3(HLT_, PATH, _v))) == 0) { \
43  flag_##PATH = RESULTS->accept(INDEX); \
44  continue; \
45  }
46 // CHK_TRIG( trigResults, names, i, xyz );
47 // is equivalent to
48 // if ( names[i].find( "HLT_xyz_v" ) == 0 ) { flag_xyz = trigResults->accept( i ); break; }
49 
51 public:
52  static double cAlpha(const reco::Vertex* pvtx, const reco::Vertex* svtx, float px, float py) {
53  TVector3 disp(svtx->x() - pvtx->x(), svtx->y() - pvtx->y(), 0);
54  TVector3 cmom(px, py, 0);
55  return disp.Dot(cmom) / (disp.Perp() * cmom.Perp());
56  }
57  static double cAlpha(const reco::Vertex* pvtx, const reco::Vertex* svtx, const TVector3& cmom) {
58  TVector3 disp(svtx->x() - pvtx->x(), svtx->y() - pvtx->y(), 0);
59  return disp.Dot(cmom) / (disp.Perp() * cmom.Perp());
60  }
61  static void dist2D(const reco::Vertex* pvtx,
62  const reco::Vertex* svtx,
63  float px,
64  float py,
65  float mass,
66  double& ctauPV,
67  double& ctauErrPV) {
68  dist2D(pvtx, svtx, px, py, cAlpha(pvtx, svtx, px, py), mass, ctauPV, ctauErrPV);
69  return;
70  }
71  static void dist2D(const reco::Vertex* pvtx,
72  const reco::Vertex* svtx,
73  float px,
74  float py,
75  double cosAlpha,
76  float mass,
77  double& ctauPV,
78  double& ctauErrPV) {
79  TVector3 cmom(px, py, 0);
80  AlgebraicVector3 vmom(px, py, 0);
81  VertexDistanceXY vdistXY;
82  Measurement1D distXY = vdistXY.distance(*svtx, *pvtx);
83  ctauPV = distXY.value() * cosAlpha * mass / cmom.Perp();
84  GlobalError sve = svtx->error();
85  GlobalError pve = pvtx->error();
86  AlgebraicSymMatrix33 vXYe = sve.matrix() + pve.matrix();
87  ctauErrPV = sqrt(ROOT::Math::Similarity(vmom, vXYe)) * mass / cmom.Perp2();
88  return;
89  }
90 };
91 
92 class BPHUserData {
93 public:
94  template <class T>
95  static const T* get(const pat::CompositeCandidate& cand, const string& name) {
96  if (cand.hasUserData(name))
97  return cand.userData<T>(name);
98  return nullptr;
99  }
100  static float get(const pat::CompositeCandidate& cand, const string& name, float d = 0.0) {
101  if (cand.hasUserFloat(name))
102  return cand.userFloat(name);
103  return d;
104  }
105  template <class T>
106  static const T* getByRef(const pat::CompositeCandidate& cand, const string& name) {
107  if (cand.hasUserData(name)) {
108  typedef edm::Ref<vector<T> > objRef;
109  const objRef* ref = cand.userData<objRef>(name);
110  if (ref == nullptr)
111  return nullptr;
112  if (ref->isNull())
113  return nullptr;
114  return ref->get();
115  }
116  return nullptr;
117  }
118 };
119 
121 public:
122  static vector<const reco::Candidate*> get(const pat::CompositeCandidate& cand, float massMin, float massMax) {
123  int i;
124  int n = cand.numberOfDaughters();
125  vector<const reco::Candidate*> v;
126  v.reserve(n);
127  for (i = 0; i < n; ++i) {
128  const reco::Candidate* dptr = cand.daughter(i);
129  float mass = dptr->mass();
130  if ((mass > massMin) && (mass < massMax))
131  v.push_back(dptr);
132  }
133  return v;
134  }
135 };
136 
138 public:
139  BPHSoftMuonSelect(int cutTrackerLayers = 5,
140  int cutPixelLayers = 0,
141  float maxDxy = 0.3,
142  float maxDz = 20.0,
143  bool goodMuon = true,
144  bool highPurity = true)
145  : cutTL(cutTrackerLayers), cutPL(cutPixelLayers), maxXY(maxDxy), maxZ(maxDz), gM(goodMuon), hP(highPurity) {}
146  ~BPHSoftMuonSelect() = default;
147  bool accept(const reco::Candidate& cand, const reco::Vertex* pv) const {
148  const pat::Muon* p = dynamic_cast<const pat::Muon*>(&cand);
149  if (p == nullptr)
150  return false;
152  return false;
153  if (p->innerTrack()->hitPattern().trackerLayersWithMeasurement() <= cutTL)
154  return false;
155  if (p->innerTrack()->hitPattern().pixelLayersWithMeasurement() <= cutPL)
156  return false;
157  if (hP && !p->innerTrack()->quality(reco::TrackBase::highPurity))
158  return false;
159  if (pv == nullptr)
160  return true;
161  const reco::Vertex::Point& pos = pv->position();
162  if (fabs(p->innerTrack()->dxy(pos)) >= maxXY)
163  return false;
164  if (fabs(p->innerTrack()->dz(pos)) >= maxZ)
165  return false;
166  return true;
167  }
168 
169 private:
170  const reco::Vertex* pv;
171  int cutTL;
172  int cutPL;
173  float maxXY;
174  float maxZ;
175  bool gM;
176  bool hP;
177 };
178 
180 public:
181  BPHDaughterSelect(float ptMinLoose,
182  float ptMinTight,
183  float etaMaxLoose,
184  float etaMaxTight,
185  const BPHSoftMuonSelect* softMuonselector = nullptr)
186  : pLMin(ptMinLoose), pTMin(ptMinTight), eLMax(etaMaxLoose), eTMax(etaMaxTight), sms(softMuonselector) {}
187  ~BPHDaughterSelect() override = default;
188  bool accept(const pat::CompositeCandidate& cand, const reco::Vertex* pv = nullptr) const override {
189  return accept(cand, pLMin, pTMin, eLMax, eTMax, pv, sms);
190  }
191  static bool accept(const pat::CompositeCandidate& cand,
192  float ptMinLoose,
193  float ptMinTight,
194  float etaMaxLoose,
195  float etaMaxTight,
196  const reco::Vertex* pv = nullptr,
197  const BPHSoftMuonSelect* softMuonselector = nullptr) {
198  const reco::Candidate* dptr0 = cand.daughter(0);
199  const reco::Candidate* dptr1 = cand.daughter(1);
200  if (dptr0 == nullptr)
201  return false;
202  if (dptr1 == nullptr)
203  return false;
204  float pt0 = dptr0->pt();
205  float pt1 = dptr1->pt();
206  if ((pt0 < ptMinLoose) || (pt1 < ptMinLoose))
207  return false;
208  if ((pt0 < ptMinTight) && (pt1 < ptMinTight))
209  return false;
210  float eta0 = fabs(dptr0->eta());
211  float eta1 = fabs(dptr1->eta());
212  if ((etaMaxLoose > 0) && ((eta0 > etaMaxLoose) || (eta1 > etaMaxLoose)))
213  return false;
214  if ((etaMaxTight > 0) && ((eta0 > etaMaxTight) && (eta1 > etaMaxTight)))
215  return false;
216  if (softMuonselector != nullptr) {
217  const reco::Vertex* pvtx = BPHUserData::getByRef<reco::Vertex>(cand, "primaryVertex");
218  if (pvtx == nullptr)
219  return false;
220  if (!softMuonselector->accept(*dptr0, pvtx))
221  return false;
222  if (!softMuonselector->accept(*dptr1, pvtx))
223  return false;
224  }
225  return true;
226  }
227 
228 private:
229  float pLMin;
230  float pTMin;
231  float eLMax;
232  float eTMax;
234 };
235 
237 public:
239  float massMin, float massMax, float ptMin = -1.0, float etaMax = -1.0, float rapidityMax = -1.0)
240  : mMin(massMin), mMax(massMax), pMin(ptMin), eMax(etaMax), yMax(rapidityMax) {}
241  ~BPHCompositeBasicSelect() override = default;
242  bool accept(const pat::CompositeCandidate& cand, const reco::Vertex* pv = nullptr) const override {
243  if (((mMin > 0) && (mMax < 0)) || ((mMin < 0) && (mMax > 0)) || ((mMin > 0) && (mMax > 0) && (mMin < mMax))) {
244  float mass = cand.mass();
245  if (mass < mMin)
246  return false;
247  if ((mMax > 0) && (mass > mMax))
248  return false;
249  }
250  if (cand.pt() < pMin)
251  return false;
252  if ((eMax > 0) && (fabs(cand.eta()) > eMax))
253  return false;
254  if ((yMax > 0) && (fabs(cand.rapidity()) > yMax))
255  return false;
256  return true;
257  }
258 
259 private:
260  float mMin;
261  float mMax;
262  float pMin;
263  float eMax;
264  float yMax;
265 };
266 
268 public:
269  BPHFittedBasicSelect(float massMin, float massMax, float ptMin = -1.0, float etaMax = -1.0, float rapidityMax = -1.0)
270  : mMin(massMin), mMax(massMax), pMin(ptMin), eMax(etaMax), yMax(rapidityMax) {}
271  ~BPHFittedBasicSelect() override = default;
272  bool accept(const pat::CompositeCandidate& cand, const reco::Vertex* pv = nullptr) const override {
273  if (!cand.hasUserFloat("fitMass"))
274  return false;
275  float mass = cand.userFloat("fitMass");
276  if (((mMin > 0) && (mMax < 0)) || ((mMin < 0) && (mMax > 0)) || ((mMin > 0) && (mMax > 0) && (mMin < mMax))) {
277  if (mass < mMin)
278  return false;
279  if ((mMax > 0) && (mass > mMax))
280  return false;
281  }
282  const Vector3DBase<float, GlobalTag>* fmom = BPHUserData::get<Vector3DBase<float, GlobalTag> >(cand, "fitMomentum");
283  if (fmom == nullptr)
284  return false;
285  if (pMin > 0) {
286  if (fmom->transverse() < pMin)
287  return false;
288  }
289  if (eMax > 0) {
290  if (fabs(fmom->eta()) > eMax)
291  return false;
292  }
293  if (yMax > 0) {
294  float x = fmom->x();
295  float y = fmom->y();
296  float z = fmom->z();
297  float e = sqrt((x * x) + (y * y) + (z * z) + (mass * mass));
298  float r = log((e + z) / (e - z)) / 2;
299  if (fabs(r) > yMax)
300  return false;
301  }
302  return true;
303  }
304 
305 private:
306  float mMin;
307  float mMax;
308  float pMin;
309  float eMax;
310  float yMax;
311 };
312 
314 public:
315  BPHGenericVertexSelect(char vType, float probMin, float cosMin = -2.0, float sigMin = -1.0, char dMode = 'r')
316  : type(vType), pMin(probMin), cMin(cosMin), sMin(sigMin), mode(dMode) {}
317  ~BPHGenericVertexSelect() override = default;
318  bool accept(const pat::CompositeCandidate& cand, const reco::Vertex* pvtx) const override {
319  if (pvtx == nullptr)
320  return false;
321  const reco::Vertex* svtx = nullptr;
322  float px;
323  float py;
324  float mass;
325  switch (type) {
326  case 'c':
327  svtx = BPHUserData::get<reco::Vertex>(cand, "vertex");
328  px = cand.px();
329  py = cand.py();
330  mass = cand.mass();
331  break;
332  case 'f':
333  svtx = BPHUserData::get<reco::Vertex>(cand, "fitVertex");
334  {
335  const Vector3DBase<float, GlobalTag>* fmom =
336  BPHUserData::get<Vector3DBase<float, GlobalTag> >(cand, "fitMomentum");
337  if (fmom == nullptr)
338  return false;
339  px = fmom->x();
340  py = fmom->y();
341  }
342  if (!cand.hasUserFloat("fitMass"))
343  return false;
344  mass = cand.userFloat("fitMass");
345  break;
346  default:
347  return false;
348  }
349  if (svtx == nullptr)
350  return false;
351  if (pMin > 0) {
352  if (ChiSquaredProbability(svtx->chi2(), svtx->ndof()) < pMin)
353  return false;
354  }
355  if ((cMin > -1.0) || (sMin > 0)) {
356  float cosAlpha = VertexAnalysis::cAlpha(pvtx, svtx, px, py);
357  if (cosAlpha < cMin)
358  return false;
359  if (sMin < 0)
360  return true;
361  double ctauPV;
362  double ctauErrPV;
363  VertexAnalysis::dist2D(pvtx, svtx, px, py, cosAlpha, mass, ctauPV, ctauErrPV);
364  float dTest;
365  switch (mode) {
366  case 'a':
367  case 'd':
368  dTest = ctauPV;
369  break;
370  case 'r':
371  case 's':
372  default:
373  dTest = ctauPV / ctauErrPV;
374  break;
375  }
376  if (dTest < sMin)
377  return false;
378  }
379  return true;
380  }
381 
382 private:
383  char type;
384  float pMin;
385  float cMin;
386  float sMin;
387  char mode;
388 };
389 
391  useTrig = (!SET_LABEL(trigResultsLabel, ps).empty());
392  useOnia = (!SET_LABEL(oniaCandsLabel, ps).empty());
393  useSd = (!SET_LABEL(sdCandsLabel, ps).empty());
394  useSs = (!SET_LABEL(ssCandsLabel, ps).empty());
395  useBu = (!SET_LABEL(buCandsLabel, ps).empty());
396  useBd = (!SET_LABEL(bdCandsLabel, ps).empty());
397  useBs = (!SET_LABEL(bsCandsLabel, ps).empty());
398  useK0 = (!SET_LABEL(k0CandsLabel, ps).empty());
399  useL0 = (!SET_LABEL(l0CandsLabel, ps).empty());
400  useB0 = (!SET_LABEL(b0CandsLabel, ps).empty());
401  useLb = (!SET_LABEL(lbCandsLabel, ps).empty());
402  useBc = (!SET_LABEL(bcCandsLabel, ps).empty());
403  useX3872 = (!SET_LABEL(x3872CandsLabel, ps).empty());
404  if (useTrig)
405  consume<edm::TriggerResults>(trigResultsToken, trigResultsLabel);
406  if (useOnia)
407  consume<vector<pat::CompositeCandidate> >(oniaCandsToken, oniaCandsLabel);
408  if (useSd)
409  consume<vector<pat::CompositeCandidate> >(sdCandsToken, sdCandsLabel);
410  if (useSs)
411  consume<vector<pat::CompositeCandidate> >(ssCandsToken, ssCandsLabel);
412  if (useBu)
413  consume<vector<pat::CompositeCandidate> >(buCandsToken, buCandsLabel);
414  if (useBd)
415  consume<vector<pat::CompositeCandidate> >(bdCandsToken, bdCandsLabel);
416  if (useBs)
417  consume<vector<pat::CompositeCandidate> >(bsCandsToken, bsCandsLabel);
418  if (useK0)
419  consume<vector<pat::CompositeCandidate> >(k0CandsToken, k0CandsLabel);
420  if (useL0)
421  consume<vector<pat::CompositeCandidate> >(l0CandsToken, l0CandsLabel);
422  if (useB0)
423  consume<vector<pat::CompositeCandidate> >(b0CandsToken, b0CandsLabel);
424  if (useLb)
425  consume<vector<pat::CompositeCandidate> >(lbCandsToken, lbCandsLabel);
426  if (useBc)
427  consume<vector<pat::CompositeCandidate> >(bcCandsToken, bcCandsLabel);
428  if (useX3872)
429  consume<vector<pat::CompositeCandidate> >(x3872CandsToken, x3872CandsLabel);
430 
431  static const BPHSoftMuonSelect* sms = new BPHSoftMuonSelect;
432 
434 
435  double phiIMassMin = 0.85;
436  double phiIMassMax = 1.20;
437  double phiIPtMin = 18.0;
438  double phiIEtaMax = -1.0;
439  double phiIYMax = -1.0;
440  double phiBMassMin = 0.85;
441  double phiBMassMax = 1.20;
442  double phiBPtMin = 14.0;
443  double phiBEtaMax = -1.0;
444  double phiBYMax = 1.25;
445  double jPsiIMassMin = 2.80;
446  double jPsiIMassMax = 3.40;
447  double jPsiIPtMin = 25.0;
448  double jPsiIEtaMax = -1.0;
449  double jPsiIYMax = -1.0;
450  double jPsiBMassMin = 2.80;
451  double jPsiBMassMax = 3.40;
452  double jPsiBPtMin = 20.0;
453  double jPsiBEtaMax = -1.0;
454  double jPsiBYMax = 1.25;
455  double psi2IMassMin = 3.40;
456  double psi2IMassMax = 4.00;
457  double psi2IPtMin = 18.0;
458  double psi2IEtaMax = -1.0;
459  double psi2IYMax = -1.0;
460  double psi2BMassMin = 3.40;
461  double psi2BMassMax = 4.00;
462  double psi2BPtMin = 10.0;
463  double psi2BEtaMax = -1.0;
464  double psi2BYMax = 1.25;
465  double upsIMassMin = 8.50;
466  double upsIMassMax = 11.0;
467  double upsIPtMin = 15.0;
468  double upsIEtaMax = -1.0;
469  double upsIYMax = -1.0;
470  double upsBMassMin = 8.50;
471  double upsBMassMax = 11.0;
472  double upsBPtMin = 12.0;
473  // double upsBEtaMax = 1.5; // 2017
474  // double upsBYMax = -1.0; // 2017
475  double upsBEtaMax = -1.0; // 2018
476  double upsBYMax = 1.4; // 2018
477 
478  double oniaProbMin = 0.005;
479  double oniaCosMin = -2.0;
480  double oniaSigMin = -1.0;
481 
482  double oniaMuPtMinLoose = 2.0;
483  double oniaMuPtMinTight = -1.0;
484  double oniaMuEtaMaxLoose = -1.0;
485  double oniaMuEtaMaxTight = -1.0;
486 
487  phiIBasicSelect = new BPHCompositeBasicSelect(phiIMassMin, phiIMassMax, phiIPtMin, phiIEtaMax, phiIYMax);
488  phiBBasicSelect = new BPHCompositeBasicSelect(phiBMassMin, phiBMassMax, phiBPtMin, phiBEtaMax, phiBYMax);
489  jPsiIBasicSelect = new BPHCompositeBasicSelect(jPsiIMassMin, jPsiIMassMax, jPsiIPtMin, jPsiIEtaMax, jPsiIYMax);
490  jPsiBBasicSelect = new BPHCompositeBasicSelect(jPsiBMassMin, jPsiBMassMax, jPsiBPtMin, jPsiBEtaMax, jPsiBYMax);
491  psi2IBasicSelect = new BPHCompositeBasicSelect(psi2IMassMin, psi2IMassMax, psi2IPtMin, psi2IEtaMax, psi2IYMax);
492  psi2BBasicSelect = new BPHCompositeBasicSelect(psi2BMassMin, psi2BMassMax, psi2BPtMin, psi2BEtaMax, psi2BYMax);
493  upsIBasicSelect = new BPHCompositeBasicSelect(upsIMassMin, upsIMassMax, upsIPtMin, upsIEtaMax, upsIYMax);
494  upsBBasicSelect = new BPHCompositeBasicSelect(upsBMassMin, upsBMassMax, upsBPtMin, upsBEtaMax, upsBYMax);
495  oniaVertexSelect = new BPHGenericVertexSelect('c', oniaProbMin, oniaCosMin, oniaSigMin);
496  oniaDaughterSelect =
497  new BPHDaughterSelect(oniaMuPtMinLoose, oniaMuPtMinTight, oniaMuEtaMaxLoose, oniaMuEtaMaxTight, sms);
498 
499  double npJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
500  double npJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
501  double npJPsiPtMin = 8.0;
502  double npJPsiEtaMax = -1.0;
503  double npJPsiYMax = -1.0;
504  double npMuPtMinLoose = 4.0;
505  double npMuPtMinTight = -1.0;
506  double npMuEtaMaxLoose = 2.2;
507  double npMuEtaMaxTight = -1.0;
508 
509  npJPsiBasicSelect = new BPHCompositeBasicSelect(npJPsiMassMin, npJPsiMassMax, npJPsiPtMin, npJPsiEtaMax, npJPsiYMax);
510  npJPsiDaughterSelect = new BPHDaughterSelect(npMuPtMinLoose, npMuPtMinTight, npMuEtaMaxLoose, npMuEtaMaxTight, sms);
511 
513 
514  double buIMassMin = 0.0;
515  double buIMassMax = 999999.0;
516  double buIPtMin = 27.0;
517  double buIEtaMax = -1.0;
518  double buIYMax = -1.0;
519  double buIJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
520  double buIJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
521  double buIJPsiPtMin = 25.0;
522  double buIJPsiEtaMax = -1.0;
523  double buIJPsiYMax = -1.0;
524  double buIProbMin = 0.15;
525  double buICosMin = -2.0;
526  double buISigMin = -1.0;
527  // *** example code for additional selections ***
528  // double buIMuPtMinLoose = -1.0;
529  // double buIMuPtMinTight = -1.0;
530  // double buIMuEtaMaxLoose = -1.0;
531  // double buIMuEtaMaxTight = -1.0;
532 
533  buIKPtMin = 2.0;
534 
535  buIBasicSelect = new BPHFittedBasicSelect(buIMassMin, buIMassMax, buIPtMin, buIEtaMax, buIYMax);
536  buIJPsiBasicSelect =
537  new BPHCompositeBasicSelect(buIJPsiMassMin, buIJPsiMassMax, buIJPsiPtMin, buIJPsiEtaMax, buIJPsiYMax);
538  buIVertexSelect = new BPHGenericVertexSelect('f', buIProbMin, buICosMin, buISigMin);
539  buIJPsiDaughterSelect = nullptr;
540  // *** example code for additional selections ***
541  // buIJPsiDaughterSelect = new BPHDaughterSelect(
542  // buIMuPtMinLoose , buIMuPtMinTight ,
543  // buIMuEtaMaxLoose, buMuEtaMaxTight, sms );
544 
545  double buDMassMin = 0.0;
546  double buDMassMax = 999999.0;
547  double buDPtMin = 10.0;
548  double buDEtaMax = -1.0;
549  double buDYMax = -1.0;
550  double buDJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
551  double buDJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
552  double buDJPsiPtMin = 8.0;
553  double buDJPsiEtaMax = -1.0;
554  double buDJPsiYMax = -1.0;
555  double buDProbMin = 0.10;
556  double buDCosMin = 0.99;
557  double buDSigMin = 3.0;
558  // *** example code for additional selections ***
559  // double buDMuPtMinLoose = -1.0;
560  // double buDMuPtMinTight = -1.0;
561  // double buDMuEtaMaxLoose = -1.0;
562  // double buDMuEtaMaxTight = -1.0;
563 
564  buDKPtMin = 1.6;
565 
566  buDBasicSelect = new BPHFittedBasicSelect(buDMassMin, buDMassMax, buDPtMin, buDEtaMax, buDYMax);
567  buDJPsiBasicSelect =
568  new BPHCompositeBasicSelect(buDJPsiMassMin, buDJPsiMassMax, buDJPsiPtMin, buDJPsiEtaMax, buDJPsiYMax);
569  buDVertexSelect = new BPHGenericVertexSelect('f', buDProbMin, buDCosMin, buDSigMin);
570  buDJPsiDaughterSelect = nullptr;
571  // *** example code for additional selections ***
572  // buDJPsiDaughterSelect = new BPHDaughterSelect(
573  // buDMuPtMinLoose , buDMuPtMinTight ,
574  // buDMuEtaMaxLoose, buDMuEtaMaxTight, sms );
575 
577 
578  double bdIMassMin = 0.0;
579  double bdIMassMax = 999999.0;
580  double bdIPtMin = 27.0;
581  double bdIEtaMax = -1.0;
582  double bdIYMax = -1.0;
583  double bdIJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
584  double bdIJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
585  double bdIJPsiPtMin = 25.0;
586  double bdIJPsiEtaMax = -1.0;
587  double bdIJPsiYMax = -1.0;
588  double bdIKx0MassMin = BPHParticleMasses::kx0Mass - 0.100;
589  double bdIKx0MassMax = BPHParticleMasses::kx0Mass + 0.100;
590  double bdIKx0PtMin = -1.0;
591  double bdIKx0EtaMax = -1.0;
592  double bdIKx0YMax = -1.0;
593  double bdIProbMin = 0.15;
594  double bdICosMin = -2.0;
595  double bdISigMin = -1.0;
596  // *** example code for additional selections ***
597  // double bdIMuPtMinLoose = -1.0;
598  // double bdIMuPtMinTight = -1.0;
599  // double bdIMuEtaMaxLoose = -1.0;
600  // double bdIMuEtaMaxTight = -1.0;
601 
602  bdIBasicSelect = new BPHFittedBasicSelect(bdIMassMin, bdIMassMax, bdIPtMin, bdIEtaMax, bdIYMax);
603  bdIJPsiBasicSelect =
604  new BPHCompositeBasicSelect(bdIJPsiMassMin, bdIJPsiMassMax, bdIJPsiPtMin, bdIJPsiEtaMax, bdIJPsiYMax);
605  bdIKx0BasicSelect = new BPHCompositeBasicSelect(bdIKx0MassMin, bdIKx0MassMax, bdIKx0PtMin, bdIKx0EtaMax, bdIKx0YMax);
606  bdIVertexSelect = new BPHGenericVertexSelect('f', bdIProbMin, bdICosMin, bdISigMin);
607  bdIJPsiDaughterSelect = nullptr;
608  // *** example code for additional selections ***
609  // bdIJPsiDaughterSelect = new BPHDaughterSelect(
610  // bdIMuPtMinLoose , bdIMuPtMinTight ,
611  // bdIMuEtaMaxLoose, bdIMuEtaMaxTight, sms );
612 
613  double bdDMassMin = 0.0;
614  double bdDMassMax = 999999.0;
615  double bdDPtMin = 10.0;
616  double bdDEtaMax = -1.0;
617  double bdDYMax = -1.0;
618  double bdDJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
619  double bdDJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
620  double bdDJPsiPtMin = 8.0;
621  double bdDJPsiEtaMax = -1.0;
622  double bdDJPsiYMax = -1.0;
623  double bdDKx0MassMin = BPHParticleMasses::kx0Mass - 0.100;
624  double bdDKx0MassMax = BPHParticleMasses::kx0Mass + 0.100;
625  double bdDKx0PtMin = -1.0;
626  double bdDKx0EtaMax = -1.0;
627  double bdDKx0YMax = -1.0;
628  double bdDProbMin = 0.10;
629  double bdDCosMin = 0.99;
630  double bdDSigMin = 3.0;
631  // *** example code for additional selections ***
632  // double bdDMuPtMinLoose = -1.0;
633  // double bdDMuPtMinTight = -1.0;
634  // double bdDMuEtaMaxLoose = -1.0;
635  // double bdDMuEtaMaxTight = -1.0;
636 
637  bdDBasicSelect = new BPHFittedBasicSelect(bdDMassMin, bdDMassMax, bdDPtMin, bdDEtaMax, bdDYMax);
638  bdDJPsiBasicSelect =
639  new BPHCompositeBasicSelect(bdDJPsiMassMin, bdDJPsiMassMax, bdDJPsiPtMin, bdDJPsiEtaMax, bdDJPsiYMax);
640  bdDKx0BasicSelect = new BPHCompositeBasicSelect(bdDKx0MassMin, bdDKx0MassMax, bdDKx0PtMin, bdDKx0EtaMax, bdDKx0YMax);
641  bdDVertexSelect = new BPHGenericVertexSelect('f', bdDProbMin, bdDCosMin, bdDSigMin);
642  bdDJPsiDaughterSelect = nullptr;
643  // *** example code for additional selections ***
644  // bdDJPsiDaughterSelect = new BPHDaughterSelect(
645  // bdDMuPtMinLoose , bdDMuPtMinTight ,
646  // bdDMuEtaMaxLoose, bdDMuEtaMaxTight, sms );
647 
649 
650  double bsIMassMin = 0.0;
651  double bsIMassMax = 999999.0;
652  double bsIPtMin = 27.0;
653  double bsIEtaMax = -1.0;
654  double bsIYMax = -1.0;
655  double bsIJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
656  double bsIJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
657  double bsIJPsiPtMin = 25.0;
658  double bsIJPsiEtaMax = -1.0;
659  double bsIJPsiYMax = -1.0;
660  double bsIPhiMassMin = BPHParticleMasses::phiMass - 0.010;
661  double bsIPhiMassMax = BPHParticleMasses::phiMass + 0.010;
662  double bsIPhiPtMin = -1.0;
663  double bsIPhiEtaMax = -1.0;
664  double bsIPhiYMax = -1.0;
665  double bsIProbMin = 0.15;
666  double bsICosMin = -2.0;
667  double bsISigMin = -1.0;
668  // *** example code for additional selections ***
669  // double bsIMuPtMinLoose = -1.0;
670  // double bsIMuPtMinTight = -1.0;
671  // double bsIMuEtaMaxLoose = -1.0;
672  // double bsIMuEtaMaxTight = -1.0;
673 
674  bsIBasicSelect = new BPHFittedBasicSelect(bsIMassMin, bsIMassMax, bsIPtMin, bsIEtaMax, bsIYMax);
675  bsIJPsiBasicSelect =
676  new BPHCompositeBasicSelect(bsIJPsiMassMin, bsIJPsiMassMax, bsIJPsiPtMin, bsIJPsiEtaMax, bsIJPsiYMax);
677  bsIPhiBasicSelect = new BPHCompositeBasicSelect(bsIPhiMassMin, bsIPhiMassMax, bsIPhiPtMin, bsIPhiEtaMax, bsIPhiYMax);
678  bsIVertexSelect = new BPHGenericVertexSelect('f', bsIProbMin, bsICosMin, bsISigMin);
679  bsIJPsiDaughterSelect = nullptr;
680  // *** example code for additional selections ***
681  // bsIJPsiDaughterSelect = new BPHDaughterSelect(
682  // bsIMuPtMinLoose , bsIMuPtMinTight ,
683  // bsIMuEtaMaxLoose, bsIMuEtaMaxTight, sms );
684 
685  double bsDMassMin = 0.0;
686  double bsDMassMax = 999999.0;
687  double bsDPtMin = 10.0;
688  double bsDEtaMax = -1.0;
689  double bsDYMax = -1.0;
690  double bsDJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
691  double bsDJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
692  double bsDJPsiPtMin = 8.0;
693  double bsDJPsiEtaMax = -1.0;
694  double bsDJPsiYMax = -1.0;
695  double bsDPhiMassMin = BPHParticleMasses::phiMass - 0.010;
696  double bsDPhiMassMax = BPHParticleMasses::phiMass + 0.010;
697  double bsDPhiPtMin = -1.0;
698  double bsDPhiEtaMax = -1.0;
699  double bsDPhiYMax = -1.0;
700  double bsDProbMin = 0.10;
701  double bsDCosMin = 0.99;
702  double bsDSigMin = 3.0;
703  // *** example code for additional selections ***
704  // double bsDMuPtMinLoose = -1.0;
705  // double bsDMuPtMinTight = -1.0;
706  // double bsDMuEtaMaxLoose = -1.0;
707  // double bsDMuEtaMaxTight = -1.0;
708 
709  bsDBasicSelect = new BPHFittedBasicSelect(bsDMassMin, bsDMassMax, bsDPtMin, bsDEtaMax, bsDYMax);
710  bsDJPsiBasicSelect =
711  new BPHCompositeBasicSelect(bsDJPsiMassMin, bsDJPsiMassMax, bsDJPsiPtMin, bsDJPsiEtaMax, bsDJPsiYMax);
712  bsDPhiBasicSelect = new BPHCompositeBasicSelect(bsDPhiMassMin, bsDPhiMassMax, bsDPhiPtMin, bsDPhiEtaMax, bsDPhiYMax);
713  bsDVertexSelect = new BPHGenericVertexSelect('f', bsDProbMin, bsDCosMin, bsDSigMin);
714  bsDJPsiDaughterSelect = nullptr;
715  // *** example code for additional selections ***
716  // bsDJPsiDaughterSelect = new BPHDaughterSelect(
717  // bsDMuPtMinLoose , bsDMuPtMinTight ,
718  // bsDMuEtaMaxLoose, bsDMuEtaMaxTight, sms );
719 
721 
722  double b0IMassMin = 0.0;
723  double b0IMassMax = 999999.0;
724  double b0IPtMin = 27.0;
725  double b0IEtaMax = -1.0;
726  double b0IYMax = -1.0;
727  double b0IJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
728  double b0IJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
729  double b0IJPsiPtMin = 25.0;
730  double b0IJPsiEtaMax = -1.0;
731  double b0IJPsiYMax = -1.0;
732  double b0IK0sMassMin = BPHParticleMasses::k0sMass - 0.010;
733  double b0IK0sMassMax = BPHParticleMasses::k0sMass + 0.010;
734  double b0IK0sPtMin = -1.0;
735  double b0IK0sEtaMax = -1.0;
736  double b0IK0sYMax = -1.0;
737  double b0IProbMin = 0.15;
738  double b0ICosMin = -2.0;
739  double b0ISigMin = -1.0;
740  // *** example code for additional selections ***
741  // double b0IMuPtMinLoose = -1.0;
742  // double b0IMuPtMinTight = -1.0;
743  // double b0IMuEtaMaxLoose = -1.0;
744  // double b0IMuEtaMaxTight = -1.0;
745 
746  b0IBasicSelect = new BPHFittedBasicSelect(b0IMassMin, b0IMassMax, b0IPtMin, b0IEtaMax, b0IYMax);
747  b0IJPsiBasicSelect =
748  new BPHCompositeBasicSelect(b0IJPsiMassMin, b0IJPsiMassMax, b0IJPsiPtMin, b0IJPsiEtaMax, b0IJPsiYMax);
749  b0IK0sBasicSelect = new BPHFittedBasicSelect(b0IK0sMassMin, b0IK0sMassMax, b0IK0sPtMin, b0IK0sEtaMax, b0IK0sYMax);
750  b0IVertexSelect = new BPHGenericVertexSelect('f', b0IProbMin, b0ICosMin, b0ISigMin);
751  b0IJPsiDaughterSelect = nullptr;
752  // *** example code for additional selections ***
753  // b0IJPsiDaughterSelect = new BPHDaughterSelect(
754  // b0IMuPtMinLoose , b0IMuPtMinTight ,
755  // b0IMuEtaMaxLoose, b0IMuEtaMaxTight, sms );
756 
757  double b0DMassMin = 0.0;
758  double b0DMassMax = 999999.0;
759  double b0DPtMin = 10.0;
760  double b0DEtaMax = -1.0;
761  double b0DYMax = -1.0;
762  double b0DJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
763  double b0DJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
764  double b0DJPsiPtMin = 8.0;
765  double b0DJPsiEtaMax = -1.0;
766  double b0DJPsiYMax = -1.0;
767  double b0DK0sMassMin = BPHParticleMasses::k0sMass - 0.010;
768  double b0DK0sMassMax = BPHParticleMasses::k0sMass + 0.010;
769  double b0DK0sPtMin = -1.0;
770  double b0DK0sEtaMax = -1.0;
771  double b0DK0sYMax = -1.0;
772  double b0DProbMin = 0.10;
773  double b0DCosMin = 0.99;
774  double b0DSigMin = 3.0;
775  // *** example code for additional selections ***
776  // double b0DMuPtMinLoose = -1.0;
777  // double b0DMuPtMinTight = -1.0;
778  // double b0DMuEtaMaxLoose = -1.0;
779  // double b0DMuEtaMaxTight = -1.0;
780 
781  b0DBasicSelect = new BPHFittedBasicSelect(b0DMassMin, b0DMassMax, b0DPtMin, b0DEtaMax, b0DYMax);
782  b0DJPsiBasicSelect =
783  new BPHCompositeBasicSelect(b0DJPsiMassMin, b0DJPsiMassMax, b0DJPsiPtMin, b0DJPsiEtaMax, b0DJPsiYMax);
784  b0DK0sBasicSelect = new BPHFittedBasicSelect(b0DK0sMassMin, b0DK0sMassMax, b0DK0sPtMin, b0DK0sEtaMax, b0DK0sYMax);
785  b0DVertexSelect = new BPHGenericVertexSelect('f', b0DProbMin, b0DCosMin, b0DSigMin);
786  b0DJPsiDaughterSelect = nullptr;
787  // *** example code for additional selections ***
788  // b0DJPsiDaughterSelect = new BPHDaughterSelect(
789  // b0DMuPtMinLoose , b0DMuPtMinTight ,
790  // b0DMuEtaMaxLoose, b0DMuEtaMaxTight, sms );
791 
793 
794  double lbIMassMin = 0.0;
795  double lbIMassMax = 999999.0;
796  double lbIPtMin = 27.0;
797  double lbIEtaMax = -1.0;
798  double lbIYMax = -1.0;
799  double lbIJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
800  double lbIJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
801  double lbIJPsiPtMin = 25.0;
802  double lbIJPsiEtaMax = -1.0;
803  double lbIJPsiYMax = -1.0;
804  double lbILambda0MassMin = BPHParticleMasses::lambda0Mass - 0.006;
805  double lbILambda0MassMax = BPHParticleMasses::lambda0Mass + 0.006;
806  double lbILambda0PtMin = -1.0;
807  double lbILambda0EtaMax = -1.0;
808  double lbILambda0YMax = -1.0;
809  double lbIProbMin = 0.10;
810  double lbICosMin = -2.0;
811  double lbISigMin = -1.0;
812  // *** example code for additional selections ***
813  // double lbIMuPtMinLoose = -1.0;
814  // double lbIMuPtMinTight = -1.0;
815  // double lbIMuEtaMaxLoose = -1.0;
816  // double lbIMuEtaMaxTight = -1.0;
817 
818  lbIBasicSelect = new BPHFittedBasicSelect(lbIMassMin, lbIMassMax, lbIPtMin, lbIEtaMax, lbIYMax);
819  lbIJPsiBasicSelect =
820  new BPHCompositeBasicSelect(lbIJPsiMassMin, lbIJPsiMassMax, lbIJPsiPtMin, lbIJPsiEtaMax, lbIJPsiYMax);
821  lbILambda0BasicSelect =
822  new BPHFittedBasicSelect(lbILambda0MassMin, lbILambda0MassMax, lbILambda0PtMin, lbILambda0EtaMax, lbILambda0YMax);
823  lbIVertexSelect = new BPHGenericVertexSelect('f', lbIProbMin, lbICosMin, lbISigMin);
824  lbIJPsiDaughterSelect = nullptr;
825  // *** example code for additional selections ***
826  // lbIJPsiDaughterSelect = new BPHDaughterSelect(
827  // lbIMuPtMinLoose , lbIMuPtMinTight ,
828  // lbIMuEtaMaxLoose, lbIMuEtaMaxTight, sms );
829 
830  double lbDMassMin = 0.0;
831  double lbDMassMax = 999999.0;
832  double lbDPtMin = 10.0;
833  double lbDEtaMax = -1.0;
834  double lbDYMax = -1.0;
835  double lbDJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
836  double lbDJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
837  double lbDJPsiPtMin = 8.0;
838  double lbDJPsiEtaMax = -1.0;
839  double lbDJPsiYMax = -1.0;
840  double lbDLambda0MassMin = BPHParticleMasses::lambda0Mass - 0.006;
841  double lbDLambda0MassMax = BPHParticleMasses::lambda0Mass + 0.006;
842  double lbDLambda0PtMin = -1.0;
843  double lbDLambda0EtaMax = -1.0;
844  double lbDLambda0YMax = -1.0;
845  double lbDProbMin = 0.10;
846  double lbDCosMin = 0.99;
847  double lbDSigMin = 3.0;
848  // *** example code for additional selections ***
849  // double lbDMuPtMinLoose = -1.0;
850  // double lbDMuPtMinTight = -1.0;
851  // double lbDMuEtaMaxLoose = -1.0;
852  // double lbDMuEtaMaxTight = -1.0;
853 
854  lbDBasicSelect = new BPHFittedBasicSelect(lbDMassMin, lbDMassMax, lbDPtMin, lbDEtaMax, lbDYMax);
855  lbDJPsiBasicSelect =
856  new BPHCompositeBasicSelect(lbDJPsiMassMin, lbDJPsiMassMax, lbDJPsiPtMin, lbDJPsiEtaMax, lbDJPsiYMax);
857  lbDLambda0BasicSelect =
858  new BPHFittedBasicSelect(lbDLambda0MassMin, lbDLambda0MassMax, lbDLambda0PtMin, lbDLambda0EtaMax, lbDLambda0YMax);
859  lbDVertexSelect = new BPHGenericVertexSelect('f', lbDProbMin, lbDCosMin, lbDSigMin);
860  lbDJPsiDaughterSelect = nullptr;
861  // *** example code for additional selections ***
862  // lbDJPsiDaughterSelect = new BPHDaughterSelect(
863  // lbDMuPtMinLoose , lbDMuPtMinTight ,
864  // lbDMuEtaMaxLoose, lbDMuEtaMaxTight, sms );
865 
867 
868  double bcIMassMin = 0.0;
869  double bcIMassMax = 999999.0;
870  double bcIPtMin = 27.0;
871  double bcIEtaMax = -1.0;
872  double bcIYMax = -1.0;
873  double bcIJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
874  double bcIJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
875  double bcIJPsiPtMin = 25.0;
876  double bcIJPsiEtaMax = -1.0;
877  double bcIJPsiYMax = -1.0;
878  double bcIJPsiProbMin = 0.005;
879  double bcIProbMin = 0.10;
880  double bcICosMin = -2.0;
881  double bcISigMin = -1.0;
882  double bcIDistMin = 0.01;
883  // *** example code for additional selections ***
884  // double bcIMuPtMinLoose = -1.0;
885  // double bcIMuPtMinTight = -1.0;
886  // double bcIMuEtaMaxLoose = -1.0;
887  // double bcIMuEtaMaxTight = -1.0;
888 
889  bcIPiPtMin = 3.5;
890 
891  bcIBasicSelect = new BPHFittedBasicSelect(bcIMassMin, bcIMassMax, bcIPtMin, bcIEtaMax, bcIYMax);
892  bcIJPsiBasicSelect =
893  new BPHCompositeBasicSelect(bcIJPsiMassMin, bcIJPsiMassMax, bcIJPsiPtMin, bcIJPsiEtaMax, bcIJPsiYMax);
894  bcIJPsiVertexSelect = new BPHGenericVertexSelect('c', bcIJPsiProbMin);
895  bcIVertexSelect = new BPHGenericVertexSelect('f', bcIProbMin, bcICosMin, bcISigMin, bcIDistMin);
896  bcIJPsiDaughterSelect = nullptr;
897  // *** example code for additional selections ***
898  // bcIJPsiDaughterSelect = new BPHDaughterSelect(
899  // bcIMuPtMinLoose , bcIMuPtMinTight ,
900  // bcIMuEtaMaxLoose, bcMuEtaMaxTight, sms );
901 
902  double bcDMassMin = 0.0;
903  double bcDMassMax = 999999.0;
904  double bcDPtMin = 8.0;
905  double bcDEtaMax = -1.0;
906  double bcDYMax = -1.0;
907  double bcDJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
908  double bcDJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
909  double bcDJPsiPtMin = 7.0;
910  double bcDJPsiEtaMax = -1.0;
911  double bcDJPsiYMax = -1.0;
912  double bcDJPsiProbMin = 0.005;
913  double bcDProbMin = 0.10;
914  double bcDCosMin = 0.99;
915  double bcDSigMin = 3.0;
916  // *** example code for additional selections ***
917  // double bcDMuPtMinLoose = -1.0;
918  // double bcDMuPtMinTight = -1.0;
919  // double bcDMuEtaMaxLoose = -1.0;
920  // double bcDMuEtaMaxTight = -1.0;
921 
922  bcJPsiDcaMax = 0.5;
923  bcDPiPtMin = 3.5;
924 
925  bcDBasicSelect = new BPHFittedBasicSelect(bcDMassMin, bcDMassMax, bcDPtMin, bcDEtaMax, bcDYMax);
926  bcDJPsiBasicSelect =
927  new BPHCompositeBasicSelect(bcDJPsiMassMin, bcDJPsiMassMax, bcDJPsiPtMin, bcDJPsiEtaMax, bcDJPsiYMax);
928  bcDJPsiVertexSelect = new BPHGenericVertexSelect('c', bcDJPsiProbMin);
929  bcDVertexSelect = new BPHGenericVertexSelect('f', bcDProbMin, bcDCosMin, bcDSigMin);
930  bcDJPsiDaughterSelect = nullptr;
931  // *** example code for additional selections ***
932  // bcDJPsiDaughterSelect = new BPHDaughterSelect(
933  // bcDMuPtMinLoose , bcDMuPtMinTight ,
934  // bcDMuEtaMaxLoose, bcDMuEtaMaxTight, sms );
935 
937 
938  double x3872IMassMin = 0.0;
939  double x3872IMassMax = 999999.0;
940  double x3872IPtMin = 27.0;
941  double x3872IEtaMax = -1.0;
942  double x3872IYMax = -1.0;
943  double x3872IJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
944  double x3872IJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
945  double x3872IJPsiPtMin = 25.0;
946  double x3872IJPsiEtaMax = -1.0;
947  double x3872IJPsiYMax = -1.0;
948  double x3872IJPsiProbMin = 0.10;
949  double x3872IProbMin = 0.10;
950  double x3872ICosMin = -2.0;
951  double x3872ISigMin = -1.0;
952  double x3872IDistMin = 0.01;
953  // *** example code for additional selections ***
954  // double x3872IMuPtMinLoose = -1.0;
955  // double x3872IMuPtMinTight = -1.0;
956  // double x3872IMuEtaMaxLoose = -1.0;
957  // double x3872IMuEtaMaxTight = -1.0;
958 
959  x3872JPsiDcaMax = 0.5;
960  x3872IPiPtMin = 1.2;
961 
962  x3872IBasicSelect = new BPHFittedBasicSelect(x3872IMassMin, x3872IMassMax, x3872IPtMin, x3872IEtaMax, x3872IYMax);
963  x3872IJPsiBasicSelect = new BPHCompositeBasicSelect(
964  x3872IJPsiMassMin, x3872IJPsiMassMax, x3872IJPsiPtMin, x3872IJPsiEtaMax, x3872IJPsiYMax);
965  x3872IJPsiVertexSelect = new BPHGenericVertexSelect('c', x3872IJPsiProbMin);
966  x3872IVertexSelect = new BPHGenericVertexSelect('f', x3872IProbMin, x3872ICosMin, x3872ISigMin, x3872IDistMin);
967  x3872IJPsiDaughterSelect = nullptr;
968  // *** example code for additional selections ***
969  // x3872IJPsiDaughterSelect = new BPHDaughterSelect(
970  // x3872IMuPtMinLoose , x3872IMuPtMinTight,
971  // x3872IMuEtaMaxLoose, x3872MuEtaMaxTight,
972  // sms );
973 
974  double x3872DMassMin = 0.0;
975  double x3872DMassMax = 999999.0;
976  double x3872DPtMin = 8.0;
977  double x3872DEtaMax = -1.0;
978  double x3872DYMax = -1.0;
979  double x3872DJPsiMassMin = BPHParticleMasses::jPsiMass - 0.150;
980  double x3872DJPsiMassMax = BPHParticleMasses::jPsiMass + 0.150;
981  double x3872DJPsiPtMin = 7.0;
982  double x3872DJPsiEtaMax = -1.0;
983  double x3872DJPsiYMax = -1.0;
984  double x3872DJPsiProbMin = 0.10;
985  double x3872DProbMin = 0.10;
986  double x3872DCosMin = 0.99;
987  double x3872DSigMin = 3.0;
988  // *** example code for additional selections ***
989  // double x3872DMuPtMinLoose = -1.0;
990  // double x3872DMuPtMinTight = -1.0;
991  // double x3872DMuEtaMaxLoose = -1.0;
992  // double x3872DMuEtaMaxTight = -1.0;
993 
994  x3872DPiPtMin = 1.2;
995 
996  x3872DBasicSelect = new BPHFittedBasicSelect(x3872DMassMin, x3872DMassMax, x3872DPtMin, x3872DEtaMax, x3872DYMax);
997  x3872DJPsiBasicSelect = new BPHCompositeBasicSelect(
998  x3872DJPsiMassMin, x3872DJPsiMassMax, x3872DJPsiPtMin, x3872DJPsiEtaMax, x3872DJPsiYMax);
999  x3872DJPsiVertexSelect = new BPHGenericVertexSelect('c', x3872DJPsiProbMin);
1000  x3872DVertexSelect = new BPHGenericVertexSelect('f', x3872DProbMin, x3872DCosMin, x3872DSigMin);
1001  x3872DJPsiDaughterSelect = nullptr;
1002  // *** example code for additional selections ***
1003  // x3872DJPsiDaughterSelect = new BPHDaughterSelect(
1004  // x3872DMuPtMinLoose , x3872DMuPtMinTight ,
1005  // x3872DMuEtaMaxLoose, x3872DMuEtaMaxTight,,
1006  // sms );
1007 }
1008 
1010  delete phiIBasicSelect;
1011  delete phiBBasicSelect;
1012  delete jPsiIBasicSelect;
1013  delete jPsiBBasicSelect;
1014  delete psi2IBasicSelect;
1015  delete psi2BBasicSelect;
1016  delete upsIBasicSelect;
1017  delete upsBBasicSelect;
1018  delete oniaVertexSelect;
1019  delete oniaDaughterSelect;
1020 
1021  delete npJPsiBasicSelect;
1022  delete npJPsiDaughterSelect;
1023 
1024  delete buIBasicSelect;
1025  delete buIJPsiBasicSelect;
1026  delete buIVertexSelect;
1027  delete buIJPsiDaughterSelect;
1028  delete buDBasicSelect;
1029  delete buDJPsiBasicSelect;
1030  delete buDVertexSelect;
1031  delete buDJPsiDaughterSelect;
1032 
1033  delete bdIBasicSelect;
1034  delete bdIJPsiBasicSelect;
1035  delete bdIKx0BasicSelect;
1036  delete bdIVertexSelect;
1037  delete bdIJPsiDaughterSelect;
1038  delete bdDBasicSelect;
1039  delete bdDJPsiBasicSelect;
1040  delete bdDKx0BasicSelect;
1041  delete bdDVertexSelect;
1042  delete bdDJPsiDaughterSelect;
1043 
1044  delete bsIBasicSelect;
1045  delete bsIJPsiBasicSelect;
1046  delete bsIPhiBasicSelect;
1047  delete bsIVertexSelect;
1048  delete bsIJPsiDaughterSelect;
1049  delete bsDBasicSelect;
1050  delete bsDJPsiBasicSelect;
1051  delete bsDPhiBasicSelect;
1052  delete bsDVertexSelect;
1053  delete bsDJPsiDaughterSelect;
1054 
1055  delete b0IBasicSelect;
1056  delete b0IJPsiBasicSelect;
1057  delete b0IK0sBasicSelect;
1058  delete b0IVertexSelect;
1059  delete b0IJPsiDaughterSelect;
1060  delete b0DBasicSelect;
1061  delete b0DJPsiBasicSelect;
1062  delete b0DK0sBasicSelect;
1063  delete b0DVertexSelect;
1064  delete b0DJPsiDaughterSelect;
1065 
1066  delete lbIBasicSelect;
1067  delete lbIJPsiBasicSelect;
1068  delete lbILambda0BasicSelect;
1069  delete lbIVertexSelect;
1070  delete lbIJPsiDaughterSelect;
1071  delete lbDBasicSelect;
1072  delete lbDJPsiBasicSelect;
1073  delete lbDLambda0BasicSelect;
1074  delete lbDVertexSelect;
1075  delete lbDJPsiDaughterSelect;
1076 
1077  delete bcIBasicSelect;
1078  delete bcIJPsiBasicSelect;
1079  delete bcIJPsiVertexSelect;
1080  delete bcIVertexSelect;
1081  delete bcIJPsiDaughterSelect;
1082  delete bcDBasicSelect;
1083  delete bcDJPsiBasicSelect;
1084  delete bcDJPsiVertexSelect;
1085  delete bcDVertexSelect;
1086  delete bcDJPsiDaughterSelect;
1087 
1088  delete x3872IBasicSelect;
1089  delete x3872IJPsiBasicSelect;
1090  delete x3872IJPsiVertexSelect;
1091  delete x3872IVertexSelect;
1092  delete x3872IJPsiDaughterSelect;
1093  delete x3872DBasicSelect;
1094  delete x3872DJPsiBasicSelect;
1095  delete x3872DJPsiVertexSelect;
1096  delete x3872DVertexSelect;
1097  delete x3872DJPsiDaughterSelect;
1098 }
1099 
1102  desc.add<string>("trigResultsLabel", "");
1103  desc.add<string>("oniaCandsLabel", "");
1104  desc.add<string>("sdCandsLabel", "");
1105  desc.add<string>("ssCandsLabel", "");
1106  desc.add<string>("buCandsLabel", "");
1107  desc.add<string>("bdCandsLabel", "");
1108  desc.add<string>("bsCandsLabel", "");
1109  desc.add<string>("k0CandsLabel", "");
1110  desc.add<string>("l0CandsLabel", "");
1111  desc.add<string>("b0CandsLabel", "");
1112  desc.add<string>("lbCandsLabel", "");
1113  desc.add<string>("bcCandsLabel", "");
1114  desc.add<string>("x3872CandsLabel", "");
1115  descriptions.add("process.bphHistoSpecificDecay", desc);
1116  return;
1117 }
1118 
1120  createHisto("massDIPhi", 50, 0.90, 1.15); // Phi mass inclusive
1121  createHisto("massTIPhi", 50, 0.90, 1.15); // Phi mass inclusive
1122  createHisto("massDBPhi", 50, 0.90, 1.15); // Phi mass barrel
1123  createHisto("massTBPhi", 50, 0.90, 1.15); // Phi mass barrel
1124  createHisto("massDIJPsi", 35, 2.95, 3.30); // JPsi mass inclusive
1125  createHisto("massTIJPsi", 35, 2.95, 3.30); // JPsi mass inclusive
1126  createHisto("massDBJPsi", 35, 2.95, 3.30); // JPsi mass barrel
1127  createHisto("massTBJPsi", 35, 2.95, 3.30); // JPsi mass barrel
1128  createHisto("massDIPsi2", 60, 3.40, 4.00); // Psi2 mass inclusive
1129  createHisto("massTIPsi2", 60, 3.40, 4.00); // Psi2 mass inclusive
1130  createHisto("massDBPsi2", 60, 3.40, 4.00); // Psi2 mass barrel
1131  createHisto("massTBPsi2", 60, 3.40, 4.00); // Psi2 mass barrel
1132  createHisto("massDIUps123", 115, 8.70, 11.0); // Ups mass inclusive
1133  createHisto("massTIUps123", 115, 8.70, 11.0); // Ups mass inclusive
1134  createHisto("massDBUps123", 115, 8.70, 11.0); // Ups mass barrel
1135  createHisto("massTBUps123", 115, 8.70, 11.0); // Ups mass barrel
1136  createHisto("massDIBu", 100, 5.00, 6.00); // Bu mass inclusive
1137  createHisto("massTIBu", 100, 5.00, 6.00); // Bu mass inclusive
1138  createHisto("massDDBu", 100, 5.00, 6.00); // Bu mass displaced
1139  createHisto("massTDBu", 100, 5.00, 6.00); // Bu mass displaced
1140  createHisto("massDIBd", 100, 5.00, 6.00); // Bd mass inclusive
1141  createHisto("massTIBd", 100, 5.00, 6.00); // Bd mass inclusive
1142  createHisto("massDDBd", 100, 5.00, 6.00); // Bd mass displaced
1143  createHisto("massTDBd", 100, 5.00, 6.00); // Bd mass displaced
1144  createHisto("massDIBs", 100, 5.00, 6.00); // Bs mass inclusive
1145  createHisto("massTIBs", 100, 5.00, 6.00); // Bs mass inclusive
1146  createHisto("massDDBs", 100, 5.00, 6.00); // Bs mass displaced
1147  createHisto("massTDBs", 100, 5.00, 6.00); // Bs mass displaced
1148  createHisto("massDIBc", 100, 6.00, 7.00); // Bc mass inclusive
1149  createHisto("massTIBc", 100, 6.00, 7.00); // Bc mass inclusive
1150  createHisto("massDDBc", 100, 6.00, 7.00); // Bc mass displaced
1151  createHisto("massTDBc", 100, 6.00, 7.00); // Bc mass displaced
1152  createHisto("massDIX3872", 40, 3.60, 4.00); // X3872 mass inclusive
1153  createHisto("massTIX3872", 40, 3.60, 4.00); // X3872 mass inclusive
1154  createHisto("massDDX3872", 40, 3.60, 4.00); // X3872 mass displaced
1155  createHisto("massTDX3872", 40, 3.60, 4.00); // X3872 mass displaced
1156  createHisto("mfitDIBu", 100, 5.00, 6.00); // Bu mass, with constr.
1157  createHisto("mfitTIBu", 100, 5.00, 6.00); // Bu mass, with constr.
1158  createHisto("mfitDDBu", 100, 5.00, 6.00); // Bu mass, with constr.
1159  createHisto("mfitTDBu", 100, 5.00, 6.00); // Bu mass, with constr.
1160  createHisto("mfitDIBd", 100, 5.00, 6.00); // Bd mass, with constr.
1161  createHisto("mfitTIBd", 100, 5.00, 6.00); // Bd mass, with constr.
1162  createHisto("mfitDDBd", 100, 5.00, 6.00); // Bd mass, with constr.
1163  createHisto("mfitTDBd", 100, 5.00, 6.00); // Bd mass, with constr.
1164  createHisto("mfitDIBs", 100, 5.00, 6.00); // Bs mass, with constr.
1165  createHisto("mfitTIBs", 100, 5.00, 6.00); // Bs mass, with constr.
1166  createHisto("mfitDDBs", 100, 5.00, 6.00); // Bs mass, with constr.
1167  createHisto("mfitTDBs", 100, 5.00, 6.00); // Bs mass, with constr.
1168  createHisto("mfitDIBc", 100, 6.00, 7.00); // Bc mass, with constr.
1169  createHisto("mfitTIBc", 100, 6.00, 7.00); // Bc mass, with constr.
1170  createHisto("mfitDDBc", 100, 6.00, 7.00); // Bc mass, with constr.
1171  createHisto("mfitTDBc", 100, 6.00, 7.00); // Bc mass, with constr.
1172  createHisto("mfitDIX3872", 40, 3.60, 4.00); // X3872 mass, with constr.
1173  createHisto("mfitTIX3872", 40, 3.60, 4.00); // X3872 mass, with constr.
1174  createHisto("mfitDDX3872", 40, 3.60, 4.00); // X3872 mass, with constr.
1175  createHisto("mfitTDX3872", 40, 3.60, 4.00); // X3872 mass, with constr.
1176  createHisto("massDIBuJPsi", 35, 2.95, 3.30); // JPsi mass in Bu decay
1177  createHisto("massTIBuJPsi", 35, 2.95, 3.30); // JPsi mass in Bu decay
1178  createHisto("massDDBuJPsi", 35, 2.95, 3.30); // JPsi mass in Bu decay
1179  createHisto("massTDBuJPsi", 35, 2.95, 3.30); // JPsi mass in Bu decay
1180  createHisto("massDIBdJPsi", 35, 2.95, 3.30); // JPsi mass in Bd decay
1181  createHisto("massTIBdJPsi", 35, 2.95, 3.30); // JPsi mass in Bd decay
1182  createHisto("massDDBdJPsi", 35, 2.95, 3.30); // JPsi mass in Bd decay
1183  createHisto("massTDBdJPsi", 35, 2.95, 3.30); // JPsi mass in Bd decay
1184  createHisto("massDIBdKx0", 50, 0.80, 1.05); // Kx0 mass in Bd decay
1185  createHisto("massTIBdKx0", 50, 0.80, 1.05); // Kx0 mass in Bd decay
1186  createHisto("massDDBdKx0", 50, 0.80, 1.05); // Kx0 mass in Bd decay
1187  createHisto("massTDBdKx0", 50, 0.80, 1.05); // Kx0 mass in Bd decay
1188  createHisto("massDIBsJPsi", 35, 2.95, 3.30); // JPsi mass in Bs decay
1189  createHisto("massTIBsJPsi", 35, 2.95, 3.30); // JPsi mass in Bs decay
1190  createHisto("massDDBsJPsi", 35, 2.95, 3.30); // JPsi mass in Bs decay
1191  createHisto("massTDBsJPsi", 35, 2.95, 3.30); // JPsi mass in Bs decay
1192  createHisto("massDIBsPhi", 50, 1.01, 1.03); // Phi mass in Bs decay
1193  createHisto("massTIBsPhi", 50, 1.01, 1.03); // Phi mass in Bs decay
1194  createHisto("massDDBsPhi", 50, 1.01, 1.03); // Phi mass in Bs decay
1195  createHisto("massTDBsPhi", 50, 1.01, 1.03); // Phi mass in Bs decay
1196  createHisto("massDIBcJPsi", 35, 2.95, 3.30); // JPsi mass in Bc decay
1197  createHisto("massTIBcJPsi", 35, 2.95, 3.30); // JPsi mass in Bc decay
1198  createHisto("massDDBcJPsi", 35, 2.95, 3.30); // JPsi mass in Bc decay
1199  createHisto("massTDBcJPsi", 35, 2.95, 3.30); // JPsi mass in Bc decay
1200  createHisto("massDIX3JPsi", 35, 2.95, 3.30); // JPsi mass in X3872 decay
1201  createHisto("massTIX3JPsi", 35, 2.95, 3.30); // JPsi mass in X3872 decay
1202  createHisto("massDDX3JPsi", 35, 2.95, 3.30); // JPsi mass in X3872 decay
1203  createHisto("massTDX3JPsi", 35, 2.95, 3.30); // JPsi mass in X3872 decay
1204  createHisto("massDK0s", 50, 0.40, 0.60); // K0s mass
1205  createHisto("mfitDK0s", 50, 0.40, 0.60); // K0s mass
1206  createHisto("massDLambda0", 60, 1.00, 1.30); // Lambda0 mass
1207  createHisto("mfitDLambda0", 60, 1.00, 1.30); // Lambda0 mass
1208  createHisto("massDIB0", 50, 5.00, 6.00); // B0 mass inclusive
1209  createHisto("massTIB0", 50, 5.00, 6.00); // B0 mass inclusive
1210  createHisto("massDDB0", 50, 5.00, 6.00); // B0 mass displaced
1211  createHisto("massTDB0", 50, 5.00, 6.00); // B0 mass displaced
1212  createHisto("mfitDIB0", 50, 5.00, 6.00); // B0 mass, with constr.
1213  createHisto("mfitTIB0", 50, 5.00, 6.00); // B0 mass, with constr.
1214  createHisto("mfitDDB0", 50, 5.00, 6.00); // B0 mass, with constr.
1215  createHisto("mfitTDB0", 50, 5.00, 6.00); // B0 mass, with constr.
1216  createHisto("massDIB0JPsi", 35, 2.95, 3.30); // JPsi mass in B0 decay
1217  createHisto("massTIB0JPsi", 35, 2.95, 3.30); // JPsi mass in B0 decay
1218  createHisto("massDDB0JPsi", 35, 2.95, 3.30); // JPsi mass in B0 decay
1219  createHisto("massTDB0JPsi", 35, 2.95, 3.30); // JPsi mass in B0 decay
1220  createHisto("massDIB0K0s", 50, 0.40, 0.60); // K0s mass in B0 decay
1221  createHisto("massTIB0K0s", 50, 0.40, 0.60); // K0s mass in B0 decay
1222  createHisto("massDDB0K0s", 50, 0.40, 0.60); // K0s mass in B0 decay
1223  createHisto("massTDB0K0s", 50, 0.40, 0.60); // K0s mass in B0 decay
1224  createHisto("mfitDIB0K0s", 50, 0.40, 0.60); // K0s mass in B0 decay
1225  createHisto("mfitTIB0K0s", 50, 0.40, 0.60); // K0s mass in B0 decay
1226  createHisto("mfitDDB0K0s", 50, 0.40, 0.60); // K0s mass in B0 decay
1227  createHisto("mfitTDB0K0s", 50, 0.40, 0.60); // K0s mass in B0 decay
1228  createHisto("massDILambdab", 25, 5.00, 6.00); // Lambdab mass inclusive
1229  createHisto("massTILambdab", 25, 5.00, 6.00); // Lambdab mass inclusive
1230  createHisto("massDDLambdab", 25, 5.00, 6.00); // Lambdab mass displaced
1231  createHisto("massTDLambdab", 25, 5.00, 6.00); // Lambdab mass displaced
1232  createHisto("mfitDILambdab", 25, 5.00, 6.00); // Lambdab mass, with constr.
1233  createHisto("mfitTILambdab", 25, 5.00, 6.00); // Lambdab mass, with constr.
1234  createHisto("mfitDDLambdab", 25, 5.00, 6.00); // Lambdab mass, with constr.
1235  createHisto("mfitTDLambdab", 25, 5.00, 6.00); // Lambdab mass, with constr.
1236  createHisto("massDILbJPsi", 35, 2.95, 3.30); // JPsi mass in Lambdab decay
1237  createHisto("massTILbJPsi", 35, 2.95, 3.30); // JPsi mass in Lambdab decay
1238  createHisto("massDDLbJPsi", 35, 2.95, 3.30); // JPsi mass in Lambdab decay
1239  createHisto("massTDLbJPsi", 35, 2.95, 3.30); // JPsi mass in Lambdab decay
1240  createHisto("massDILbL0", 60, 1.00, 1.30); // L0 mass in Lambdab decay
1241  createHisto("massTILbL0", 60, 1.00, 1.30); // L0 mass in Lambdab decay
1242  createHisto("massDDLbL0", 60, 1.00, 1.30); // L0 mass in Lambdab decay
1243  createHisto("massTDLbL0", 60, 1.00, 1.30); // L0 mass in Lambdab decay
1244  createHisto("mfitDILbL0", 60, 1.00, 1.30); // L0 mass in Lambdab decay
1245  createHisto("mfitTILbL0", 60, 1.00, 1.30); // L0 mass in Lambdab decay
1246  createHisto("mfitDDLbL0", 60, 1.00, 1.30); // L0 mass in Lambdab decay
1247  createHisto("mfitTDLbL0", 60, 1.00, 1.30); // L0 mass in Lambdab decay
1248 
1249  createHisto("massFull", 200, 2.00, 12.0); // Full onia mass
1250 
1251  createHisto("ctauDIJPsi", 60, -0.05, 0.25); // JPsi ctau inclusive
1252  createHisto("ctauTIJPsi", 60, -0.05, 0.25); // JPsi ctau inclusive
1253  createHisto("ctauDBJPsi", 60, -0.05, 0.25); // JPsi ctau barrel
1254  createHisto("ctauTBJPsi", 60, -0.05, 0.25); // JPsi ctau barrel
1255  createHisto("ctauDIBu", 60, -0.05, 0.25); // Bu ctau inclusive
1256  createHisto("ctauTIBu", 60, -0.05, 0.25); // Bu ctau inclusive
1257  createHisto("ctauDDBu", 60, -0.05, 0.25); // Bu ctau displaced
1258  createHisto("ctauTDBu", 60, -0.05, 0.25); // Bu ctau displaced
1259  createHisto("ctauDIBd", 60, -0.05, 0.25); // Bd ctau inclusive
1260  createHisto("ctauTIBd", 60, -0.05, 0.25); // Bd ctau inclusive
1261  createHisto("ctauDDBd", 60, -0.05, 0.25); // Bd ctau displaced
1262  createHisto("ctauTDBd", 60, -0.05, 0.25); // Bd ctau displaced
1263  createHisto("ctauDIBs", 60, -0.05, 0.25); // Bs ctau inclusive
1264  createHisto("ctauTIBs", 60, -0.05, 0.25); // Bs ctau inclusive
1265  createHisto("ctauDDBs", 60, -0.05, 0.25); // Bs ctau displaced
1266  createHisto("ctauTDBs", 60, -0.05, 0.25); // Bs ctau displaced
1267  createHisto("ctauDIB0", 60, -0.05, 0.25); // B0 ctau inclusive
1268  createHisto("ctauTIB0", 60, -0.05, 0.25); // B0 ctau inclusive
1269  createHisto("ctauDDB0", 60, -0.05, 0.25); // B0 ctau displaced
1270  createHisto("ctauTDB0", 60, -0.05, 0.25); // B0 ctau displaced
1271  createHisto("ctauDILambdab", 60, -0.05, 0.25); // Lambdab ctau inclusive
1272  createHisto("ctauTILambdab", 60, -0.05, 0.25); // Lambdab ctau inclusive
1273  createHisto("ctauDDLambdab", 60, -0.05, 0.25); // Lambdab ctau displaced
1274  createHisto("ctauTDLambdab", 60, -0.05, 0.25); // Lambdab ctau displaced
1275 
1276  recoName = new string;
1277  tree = fs->make<TTree>("BPHReco", "BPHReco");
1278  b_runNumber = tree->Branch("runNumber", &runNumber, "runNumber/i");
1279  b_lumiSection = tree->Branch("lumiSection", &lumiSection, "lumiSection/i");
1280  b_eventNumber = tree->Branch("eventNumber", &eventNumber, "eventNumber/i");
1281  b_recoName = tree->Branch("recoName", &recoName, 8192, 99);
1282  b_recoMass = tree->Branch("recoMass", &recoMass, "recoMass/F");
1283  b_recoTime = tree->Branch("recoTime", &recoTime, "recoTime/F");
1284  b_recoErrT = tree->Branch("recoErrT", &recoErrT, "recoErrT/F");
1285 
1286  return;
1287 }
1288 
1290  static map<string, ofstream*> ofMap;
1291  if (ofMap.empty()) {
1292  ofMap["BarPhi"] = nullptr;
1293  ofMap["IncJPsi"] = nullptr;
1294  ofMap["BarJPsi"] = nullptr;
1295  ofMap["IncPsi2"] = nullptr;
1296  ofMap["BarPsi2"] = nullptr;
1297  ofMap["BarUpsilon123"] = nullptr;
1298  ofMap["InclusiveBu"] = nullptr;
1299  ofMap["DisplacedBu"] = nullptr;
1300  ofMap["InclusiveBd"] = nullptr;
1301  ofMap["DisplacedBd"] = nullptr;
1302  ofMap["InclusiveBs"] = nullptr;
1303  ofMap["DisplacedBs"] = nullptr;
1304  ofMap["K0s"] = nullptr;
1305  ofMap["Lambda0"] = nullptr;
1306  ofMap["InclusiveB0"] = nullptr;
1307  ofMap["DisplacedB0"] = nullptr;
1308  ofMap["InclusiveLambdab"] = nullptr;
1309  ofMap["DisplacedLambdab"] = nullptr;
1310  ofMap["InclusiveBc"] = nullptr;
1311  ofMap["DisplacedBc"] = nullptr;
1312  ofMap["InclusiveX3872"] = nullptr;
1313  ofMap["DisplacedX3872"] = nullptr;
1314  map<string, ofstream*>::iterator iter = ofMap.begin();
1315  map<string, ofstream*>::iterator iend = ofMap.end();
1316  string name = "list";
1317  while (iter != iend) {
1318  iter->second = new ofstream(name + iter->first);
1319  ++iter;
1320  }
1321  }
1322 
1323  // event number
1324  runNumber = ev.id().run();
1325  lumiSection = ev.id().luminosityBlock();
1326  eventNumber = ev.id().event();
1327 
1328  // get object collections
1329  // collections are got through "BPHTokenWrapper" interface to allow
1330  // uniform access in different CMSSW versions
1331 
1333 
1335  const edm::TriggerNames* trigNames = nullptr;
1336  if (useTrig) {
1337  trigResultsToken.get(ev, trigResults);
1338  if (trigResults.isValid())
1339  trigNames = &ev.triggerNames(*trigResults);
1340  }
1341 
1342  bool flag_Dimuon25_Jpsi = false;
1343  bool flag_Dimuon20_Jpsi_Barrel_Seagulls = false;
1344  bool flag_Dimuon14_Phi_Barrel_Seagulls = false;
1345  bool flag_Dimuon18_PsiPrime = false;
1346  bool flag_Dimuon10_PsiPrime_Barrel_Seagulls = false;
1347  bool flag_Dimuon12_Upsilon_eta1p5 = false;
1348  bool flag_Dimuon12_Upsilon_y1p4 = false;
1349  bool flag_DoubleMu4_JpsiTrk_Displaced = false;
1350  if (trigNames != nullptr) {
1351  const edm::TriggerNames::Strings& names = trigNames->triggerNames();
1352  int iObj;
1353  int nObj = names.size();
1354  for (iObj = 0; iObj < nObj; ++iObj) {
1355  // cout << names[iObj] << endl;
1356  CHK_TRIG(trigResults, names, iObj, Dimuon25_Jpsi)
1357  CHK_TRIG(trigResults, names, iObj, Dimuon20_Jpsi_Barrel_Seagulls)
1358  CHK_TRIG(trigResults, names, iObj, Dimuon14_Phi_Barrel_Seagulls)
1359  CHK_TRIG(trigResults, names, iObj, Dimuon18_PsiPrime)
1360  CHK_TRIG(trigResults, names, iObj, Dimuon10_PsiPrime_Barrel_Seagulls)
1361  CHK_TRIG(trigResults, names, iObj, Dimuon12_Upsilon_eta1p5)
1362  CHK_TRIG(trigResults, names, iObj, Dimuon12_Upsilon_y1p4)
1363  CHK_TRIG(trigResults, names, iObj, DoubleMu4_JpsiTrk_Displaced)
1364  }
1365  }
1366 
1368 
1370  int iqo;
1371  int nqo = 0;
1372  if (useOnia) {
1373  oniaCandsToken.get(ev, oniaCands);
1374  nqo = oniaCands->size();
1375  }
1376 
1377  for (iqo = 0; iqo < nqo; ++iqo) {
1378  LogTrace("DataDump") << "*********** quarkonium " << iqo << "/" << nqo << " ***********";
1379  const pat::CompositeCandidate& cand = oniaCands->at(iqo);
1380  if (!oniaVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(cand, "primaryVertex")))
1381  continue;
1382  if (!oniaDaughterSelect->accept(cand))
1383  continue;
1384  fillHisto("Full", cand, 'c');
1385  if (phiBBasicSelect->accept(cand)) {
1386  fillHisto("DBPhi", cand, 'c');
1387  if (flag_Dimuon14_Phi_Barrel_Seagulls)
1388  fillHisto("TBPhi", cand, 'c');
1389  if (flag_Dimuon14_Phi_Barrel_Seagulls)
1390  *ofMap["BarPhi"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1391  << cand.mass() << endl;
1392  }
1393  if (jPsiIBasicSelect->accept(cand)) {
1394  fillHisto("DIJPsi", cand, 'c');
1395  if (flag_Dimuon25_Jpsi)
1396  fillHisto("TIJPsi", cand, 'c');
1397  if (flag_Dimuon25_Jpsi)
1398  *ofMap["IncJPsi"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1399  << cand.mass() << endl;
1400  }
1401  if (jPsiBBasicSelect->accept(cand)) {
1402  fillHisto("DBJPsi", cand, 'c');
1403  if (flag_Dimuon20_Jpsi_Barrel_Seagulls)
1404  fillHisto("TBJPsi", cand, 'c');
1405  if (flag_Dimuon20_Jpsi_Barrel_Seagulls)
1406  *ofMap["BarJPsi"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1407  << cand.mass() << endl;
1408  }
1409  if (psi2IBasicSelect->accept(cand)) {
1410  fillHisto("DIPsi2", cand, 'c');
1411  if (flag_Dimuon18_PsiPrime)
1412  fillHisto("TIPsi2", cand, 'c');
1413  if (flag_Dimuon18_PsiPrime)
1414  *ofMap["IncPsi2"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1415  << cand.mass() << endl;
1416  }
1417  if (psi2BBasicSelect->accept(cand)) {
1418  fillHisto("DBPsi2", cand, 'c');
1419  if (flag_Dimuon10_PsiPrime_Barrel_Seagulls)
1420  fillHisto("TBPsi2", cand, 'c');
1421  if (flag_Dimuon10_PsiPrime_Barrel_Seagulls)
1422  *ofMap["BarPsi2"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1423  << cand.mass() << endl;
1424  }
1425  if (upsBBasicSelect->accept(cand)) {
1426  fillHisto("DBUps123", cand, 'c');
1427  if (flag_Dimuon12_Upsilon_eta1p5 || flag_Dimuon12_Upsilon_y1p4)
1428  fillHisto("TBUps123", cand, 'c');
1429  if (flag_Dimuon12_Upsilon_eta1p5 || flag_Dimuon12_Upsilon_y1p4)
1430  *ofMap["BarUpsilon123"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1431  << cand.mass() << endl;
1432  }
1433  }
1434 
1436 
1438  int ibu;
1439  int nbu = 0;
1440  if (useBu) {
1441  buCandsToken.get(ev, buCands);
1442  nbu = buCands->size();
1443  }
1444 
1445  for (ibu = 0; ibu < nbu; ++ibu) {
1446  LogTrace("DataDump") << "*********** Bu " << ibu << "/" << nbu << " ***********";
1447  const pat::CompositeCandidate& cand = buCands->at(ibu);
1448  const pat::CompositeCandidate* jPsi = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToJPsi");
1449  LogTrace("DataDump") << "JPsi: " << jPsi;
1450  if (jPsi == nullptr)
1451  continue;
1452  if (!npJPsiBasicSelect->accept(*jPsi))
1453  continue;
1454  if (!npJPsiDaughterSelect->accept(*jPsi))
1455  continue;
1456  const reco::Candidate* kptr = BPHDaughters::get(cand, 0.49, 0.50).front();
1457  if (kptr == nullptr)
1458  continue;
1459  if (buIBasicSelect->accept(cand) && buIJPsiBasicSelect->accept(*jPsi) &&
1460  // *** example code for additional selections ***
1461  // buIJPsiDaughterSelect->accept( *jPsi ) &&
1462  buIVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1463  (kptr->pt() > buIKPtMin)) {
1464  fillHisto("DIBu", cand, 'f');
1465  fillHisto("DIBuJPsi", *jPsi, 'c');
1466  if (flag_Dimuon25_Jpsi) {
1467  fillHisto("TIBu", cand, 'f');
1468  fillHisto("TIBuJPsi", *jPsi, 'c');
1469  *ofMap["InclusiveBu"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1470  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1471  }
1472  }
1473  if (buDBasicSelect->accept(cand) && buDJPsiBasicSelect->accept(*jPsi) &&
1474  // *** example code for additional selections ***
1475  // buDJPsiDaughterSelect->accept( *jPsi ) &&
1476  buDVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1477  (kptr->pt() > buDKPtMin)) {
1478  fillHisto("DDBu", cand, 'f');
1479  fillHisto("DDBuJPsi", *jPsi, 'c');
1480  if (flag_DoubleMu4_JpsiTrk_Displaced) {
1481  fillHisto("TDBu", cand, 'f');
1482  fillHisto("TDBuJPsi", *jPsi, 'c');
1483  *ofMap["DisplacedBu"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1484  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1485  }
1486  }
1487  }
1488 
1490 
1492  int ibd;
1493  int nbd = 0;
1494  if (useBd) {
1495  bdCandsToken.get(ev, bdCands);
1496  nbd = bdCands->size();
1497  }
1498 
1499  for (ibd = 0; ibd < nbd; ++ibd) {
1500  LogTrace("DataDump") << "*********** Bd " << ibd << "/" << nbd << " ***********";
1501  const pat::CompositeCandidate& cand = bdCands->at(ibd);
1502  const pat::CompositeCandidate* jPsi = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToJPsi");
1503  LogTrace("DataDump") << "JPsi: " << jPsi;
1504  if (jPsi == nullptr)
1505  continue;
1506  if (!npJPsiBasicSelect->accept(*jPsi))
1507  continue;
1508  if (!npJPsiDaughterSelect->accept(*jPsi))
1509  continue;
1510  const pat::CompositeCandidate* kx0 = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToKx0");
1511  LogTrace("DataDump") << "Kx0: " << kx0;
1512  if (kx0 == nullptr)
1513  continue;
1514  if (bdIBasicSelect->accept(cand) && bdIJPsiBasicSelect->accept(*jPsi) && bdIKx0BasicSelect->accept(*kx0) &&
1515  // *** example code for additional selections ***
1516  // bdIJPsiDaughterSelect->accept( *jPsi ) &&
1517  bdIVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex"))) {
1518  fillHisto("DIBd", cand, 'f');
1519  fillHisto("DIBdJPsi", *jPsi, 'c');
1520  fillHisto("DIBdKx0", *kx0, 'c');
1521  if (flag_Dimuon25_Jpsi) {
1522  fillHisto("TIBd", cand, 'f');
1523  fillHisto("TIBdJPsi", *jPsi, 'c');
1524  fillHisto("TIBdKx0", *kx0, 'c');
1525  *ofMap["InclusiveBd"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1526  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1527  }
1528  }
1529  if (bdDBasicSelect->accept(cand) && bdDJPsiBasicSelect->accept(*jPsi) && bdDKx0BasicSelect->accept(*kx0) &&
1530  // *** example code for additional selections ***
1531  // bdDJPsiDaughterSelect->accept( *jPsi ) &&
1532  bdDVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex"))) {
1533  fillHisto("DDBd", cand, 'f');
1534  fillHisto("DDBdJPsi", *jPsi, 'c');
1535  fillHisto("DDBdKx0", *kx0, 'c');
1536  if (flag_DoubleMu4_JpsiTrk_Displaced) {
1537  fillHisto("TDBd", cand, 'f');
1538  fillHisto("TDBdJPsi", *jPsi, 'c');
1539  fillHisto("TDBdKx0", *kx0, 'c');
1540  *ofMap["DisplacedBd"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1541  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1542  }
1543  }
1544  }
1545 
1547 
1549  int ibs;
1550  int nbs = 0;
1551  if (useBs) {
1552  bsCandsToken.get(ev, bsCands);
1553  nbs = bsCands->size();
1554  }
1555 
1556  for (ibs = 0; ibs < nbs; ++ibs) {
1557  LogTrace("DataDump") << "*********** Bs " << ibs << "/" << nbs << " ***********";
1558  const pat::CompositeCandidate& cand = bsCands->at(ibs);
1559  const pat::CompositeCandidate* jPsi = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToJPsi");
1560  LogTrace("DataDump") << "JPsi: " << jPsi;
1561  if (jPsi == nullptr)
1562  continue;
1563  if (!npJPsiBasicSelect->accept(*jPsi))
1564  continue;
1565  if (!npJPsiDaughterSelect->accept(*jPsi))
1566  continue;
1567  const pat::CompositeCandidate* phi = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToPhi");
1568  LogTrace("DataDump") << "Phi: " << phi;
1569  if (phi == nullptr)
1570  continue;
1571  if (bsIBasicSelect->accept(cand) && bsIJPsiBasicSelect->accept(*jPsi) && bsIPhiBasicSelect->accept(*phi) &&
1572  // *** example code for additional selections ***
1573  // bsIJPsiDaughterSelect->accept( *jPsi ) &&
1574  bsIVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex"))) {
1575  fillHisto("DIBs", cand, 'f');
1576  fillHisto("DIBsJPsi", *jPsi, 'c');
1577  fillHisto("DIBsPhi", *phi, 'c');
1578  if (flag_Dimuon25_Jpsi) {
1579  fillHisto("TIBs", cand, 'f');
1580  fillHisto("TIBsJPsi", *jPsi, 'c');
1581  fillHisto("TIBsPhi", *phi, 'c');
1582  *ofMap["InclusiveBs"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1583  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1584  }
1585  }
1586  if (bsDBasicSelect->accept(cand) && bsDJPsiBasicSelect->accept(*jPsi) && bsDPhiBasicSelect->accept(*phi) &&
1587  // *** example code for additional selections ***
1588  // bsDJPsiDaughterSelect->accept( *jPsi ) &&
1589  bsDVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex"))) {
1590  fillHisto("DDBs", cand, 'f');
1591  fillHisto("DDBsJPsi", *jPsi, 'c');
1592  fillHisto("DDBsPhi", *phi, 'c');
1593  if (flag_DoubleMu4_JpsiTrk_Displaced) {
1594  fillHisto("TDBs", cand, 'f');
1595  fillHisto("TDBsJPsi", *jPsi, 'c');
1596  fillHisto("TDBsPhi", *phi, 'c');
1597  *ofMap["DisplacedBs"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1598  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1599  }
1600  }
1601  }
1602 
1604 
1606  int ik0;
1607  int nk0 = 0;
1608  if (useK0) {
1609  k0CandsToken.get(ev, k0Cands);
1610  nk0 = k0Cands->size();
1611  }
1612 
1613  for (ik0 = 0; ik0 < nk0; ++ik0) {
1614  LogTrace("DataDump") << "*********** K0 " << ik0 << "/" << nk0 << " ***********";
1615  const pat::CompositeCandidate& cand = k0Cands->at(ik0);
1616  fillHisto("DK0s", cand, 'f');
1617  *ofMap["K0s"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1618  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1619  }
1620 
1622 
1624  int il0;
1625  int nl0 = 0;
1626  if (useL0) {
1627  l0CandsToken.get(ev, l0Cands);
1628  nl0 = l0Cands->size();
1629  }
1630 
1631  for (il0 = 0; il0 < nl0; ++il0) {
1632  LogTrace("DataDump") << "*********** Lambda0 " << il0 << "/" << nl0 << " ***********";
1633  const pat::CompositeCandidate& cand = l0Cands->at(il0);
1634  fillHisto("DLambda0", cand, 'f');
1635  *ofMap["Lambda0"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1636  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1637  }
1638 
1640 
1642  int ib0;
1643  int nb0 = 0;
1644  if (useB0) {
1645  b0CandsToken.get(ev, b0Cands);
1646  nb0 = b0Cands->size();
1647  }
1648 
1649  for (ib0 = 0; ib0 < nb0; ++ib0) {
1650  LogTrace("DataDump") << "*********** B0 " << ib0 << "/" << nb0 << " ***********";
1651  const pat::CompositeCandidate& cand = b0Cands->at(ib0);
1652  const pat::CompositeCandidate* jPsi = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToJPsi");
1653  LogTrace("DataDump") << "JPsi: " << jPsi;
1654  if (jPsi == nullptr)
1655  continue;
1656  if (!npJPsiBasicSelect->accept(*jPsi))
1657  continue;
1658  if (!npJPsiDaughterSelect->accept(*jPsi))
1659  continue;
1660  const pat::CompositeCandidate* k0s = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToK0s");
1661  LogTrace("DataDump") << "K0s: " << k0s;
1662  if (k0s == nullptr)
1663  continue;
1664  if (b0IBasicSelect->accept(cand) && b0IJPsiBasicSelect->accept(*jPsi) && b0IK0sBasicSelect->accept(*k0s) &&
1665  // *** example code for additional selections ***
1666  // b0IJPsiDaughterSelect->accept( *jPsi ) &&
1667  b0IVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex"))) {
1668  fillHisto("DIB0", cand, 'f');
1669  fillHisto("DIB0JPsi", *jPsi, 'c');
1670  fillHisto("DIB0K0s", *k0s, 'c');
1671  if (flag_Dimuon25_Jpsi) {
1672  fillHisto("TIB0", cand, 'f');
1673  fillHisto("TIB0JPsi", *jPsi, 'c');
1674  fillHisto("TIB0K0s", *k0s, 'c');
1675  *ofMap["InclusiveB0"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1676  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1677  }
1678  }
1679  if (b0DBasicSelect->accept(cand) && b0DJPsiBasicSelect->accept(*jPsi) && b0DK0sBasicSelect->accept(*k0s) &&
1680  // *** example code for additional selections ***
1681  // b0DJPsiDaughterSelect->accept( *jPsi ) &&
1682  b0DVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex"))) {
1683  fillHisto("DDB0", cand, 'f');
1684  fillHisto("DDB0JPsi", *jPsi, 'c');
1685  fillHisto("DDB0K0s", *k0s, 'c');
1686  if (flag_DoubleMu4_JpsiTrk_Displaced) {
1687  fillHisto("TDB0", cand, 'f');
1688  fillHisto("TDB0JPsi", *jPsi, 'c');
1689  fillHisto("TDB0K0s", *k0s, 'c');
1690  *ofMap["DisplacedB0"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1691  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1692  }
1693  }
1694  }
1695 
1697 
1699  int ilb;
1700  int nlb = 0;
1701  if (useLb) {
1702  lbCandsToken.get(ev, lbCands);
1703  nlb = lbCands->size();
1704  }
1705 
1706  for (ilb = 0; ilb < nlb; ++ilb) {
1707  LogTrace("DataDump") << "*********** Lambdab " << ilb << "/" << nlb << " ***********";
1708  const pat::CompositeCandidate& cand = lbCands->at(ilb);
1709  const pat::CompositeCandidate* jPsi = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToJPsi");
1710  LogTrace("DataDump") << "JPsi: " << jPsi;
1711  if (jPsi == nullptr)
1712  continue;
1713  if (!npJPsiBasicSelect->accept(*jPsi))
1714  continue;
1715  if (!npJPsiDaughterSelect->accept(*jPsi))
1716  continue;
1717  const pat::CompositeCandidate* l0 = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToLambda0");
1718  LogTrace("DataDump") << "Lambda0: " << l0;
1719  if (l0 == nullptr)
1720  continue;
1721  if (lbIBasicSelect->accept(cand) && lbIJPsiBasicSelect->accept(*jPsi) && lbILambda0BasicSelect->accept(*l0) &&
1722  // *** example code for additional selections ***
1723  // lbIJPsiDaughterSelect->accept( *jPsi ) &&
1724  lbIVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex"))) {
1725  fillHisto("DILambdab", cand, 'f');
1726  fillHisto("DILbJPsi", *jPsi, 'c');
1727  fillHisto("DILbL0", *l0, 'c');
1728  if (flag_Dimuon25_Jpsi) {
1729  fillHisto("TILambdab", cand, 'f');
1730  fillHisto("TILbJPsi", *jPsi, 'c');
1731  fillHisto("TILbL0", *l0, 'c');
1732  *ofMap["InclusiveLambdab"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1733  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1734  }
1735  }
1736  if (lbDBasicSelect->accept(cand) && lbDJPsiBasicSelect->accept(*jPsi) && lbDLambda0BasicSelect->accept(*l0) &&
1737  // *** example code for additional selections ***
1738  // lbDJPsiDaughterSelect->accept( *jPsi ) &&
1739  lbDVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex"))) {
1740  fillHisto("DDLambdab", cand, 'f');
1741  fillHisto("DDLbJPsi", *jPsi, 'c');
1742  fillHisto("DDLbL0", *l0, 'c');
1743  if (flag_DoubleMu4_JpsiTrk_Displaced) {
1744  fillHisto("TDLambdab", cand, 'f');
1745  fillHisto("TDLbJPsi", *jPsi, 'c');
1746  fillHisto("TDLbL0", *l0, 'c');
1747  *ofMap["DisplacedLambdab"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1748  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1749  }
1750  }
1751  }
1752 
1754 
1756  int ibc;
1757  int nbc = 0;
1758  if (useBc) {
1759  bcCandsToken.get(ev, bcCands);
1760  nbc = bcCands->size();
1761  }
1762 
1763  for (ibc = 0; ibc < nbc; ++ibc) {
1764  LogTrace("DataDump") << "*********** Bc " << ibc << "/" << nbc << " ***********";
1765  const pat::CompositeCandidate& cand = bcCands->at(ibc);
1766  const pat::CompositeCandidate* jPsi = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToJPsi");
1767  LogTrace("DataDump") << "JPsi: " << jPsi;
1768  if (jPsi == nullptr)
1769  continue;
1770  // *** instruction temporarily disabled, to fix ***
1771  // if ( BPHUserData::get( *jPsi, "dca", -1.0 ) < bcJPsiDcaMax ) continue;
1772  if (!npJPsiBasicSelect->accept(*jPsi))
1773  continue;
1774  if (!npJPsiDaughterSelect->accept(*jPsi))
1775  continue;
1776  const reco::Candidate* pptr = BPHDaughters::get(cand, 0.13, 0.14).front();
1777  if (pptr == nullptr)
1778  continue;
1779 
1780  if (bcIBasicSelect->accept(cand) && bcIJPsiBasicSelect->accept(*jPsi) &&
1781  // *** example code for additional selections ***
1782  // bcIJPsiDaughterSelect->accept( *jPsi ) &&
1783  bcIJPsiVertexSelect->accept(*jPsi, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1784  bcIVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1785  (pptr->pt() > bcIPiPtMin)) {
1786  fillHisto("DIBc", cand, 'f');
1787  fillHisto("DIBcJPsi", *jPsi, 'c');
1788  if (flag_Dimuon25_Jpsi) {
1789  fillHisto("TIBc", cand, 'f');
1790  fillHisto("TIBcJPsi", *jPsi, 'c');
1791  *ofMap["InclusiveBc"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1792  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1793  }
1794  }
1795  if (bcDBasicSelect->accept(cand) && bcDJPsiBasicSelect->accept(*jPsi) &&
1796  // *** example code for additional selections ***
1797  // bcDJPsiDaughterSelect->accept( *jPsi ) &&
1798  bcDVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1799  bcDVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1800  (pptr->pt() > bcDPiPtMin)) {
1801  fillHisto("DDBc", cand, 'f');
1802  fillHisto("DDBcJPsi", *jPsi, 'c');
1803  if (flag_DoubleMu4_JpsiTrk_Displaced) {
1804  fillHisto("TDBc", cand, 'f');
1805  fillHisto("TDBcJPsi", *jPsi, 'c');
1806  *ofMap["DisplacedBc"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1807  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1808  }
1809  }
1810  }
1811 
1813 
1815  int ix3872;
1816  int nx3872 = 0;
1817  if (useX3872) {
1818  x3872CandsToken.get(ev, x3872Cands);
1819  nx3872 = x3872Cands->size();
1820  }
1821 
1822  for (ix3872 = 0; ix3872 < nx3872; ++ix3872) {
1823  LogTrace("DataDump") << "*********** X3872 " << ix3872 << "/" << nx3872 << " ***********";
1824  const pat::CompositeCandidate& cand = x3872Cands->at(ix3872);
1825  const pat::CompositeCandidate* jPsi = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToJPsi");
1826  LogTrace("DataDump") << "JPsi: " << jPsi;
1827  if (jPsi == nullptr)
1828  continue;
1829  // *** instruction temporarily disabled, to fix ***
1830  // if ( BPHUserData::get( *jPsi, "dca", -1.0 ) < x3872JPsiDcaMax ) continue;
1831  if (!npJPsiBasicSelect->accept(*jPsi))
1832  continue;
1833  if (!npJPsiDaughterSelect->accept(*jPsi))
1834  continue;
1835  const reco::Candidate* ppt1 = BPHDaughters::get(cand, 0.13, 0.14)[0];
1836  const reco::Candidate* ppt2 = BPHDaughters::get(cand, 0.13, 0.14)[1];
1837  if (ppt1 == nullptr)
1838  continue;
1839  if (ppt2 == nullptr)
1840  continue;
1841  if (x3872IBasicSelect->accept(cand) && x3872IJPsiBasicSelect->accept(*jPsi) &&
1842  // *** example code for additional selections ***
1843  // x3872IJPsiDaughterSelect->accept( *jPsi ) &&
1844  x3872IJPsiVertexSelect->accept(*jPsi, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1845  x3872IVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1846  (ppt1->pt() > x3872IPiPtMin) && (ppt2->pt() > x3872IPiPtMin)) {
1847  fillHisto("DIX3872", cand, 'f');
1848  fillHisto("DIX3872JPsi", *jPsi, 'c');
1849  if (flag_Dimuon25_Jpsi) {
1850  fillHisto("TIX3872", cand, 'f');
1851  fillHisto("TIX3872JPsi", *jPsi, 'c');
1852  *ofMap["InclusiveX3872"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1853  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1854  }
1855  }
1856  if (x3872DBasicSelect->accept(cand) && x3872DJPsiBasicSelect->accept(*jPsi) &&
1857  // *** example code for additional selections ***
1858  // x3872DJPsiDaughterSelect->accept( *jPsi ) &&
1859  x3872DVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1860  x3872DVertexSelect->accept(cand, BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex")) &&
1861  (ppt1->pt() > x3872DPiPtMin) && (ppt2->pt() > x3872DPiPtMin)) {
1862  fillHisto("DDX3872", cand, 'f');
1863  fillHisto("DDX3872JPsi", *jPsi, 'c');
1864  if (flag_DoubleMu4_JpsiTrk_Displaced) {
1865  fillHisto("TDX3872", cand, 'f');
1866  fillHisto("TDX3872JPsi", *jPsi, 'c');
1867  *ofMap["DisplacedX3872"] << ev.id().run() << ' ' << ev.id().luminosityBlock() << ' ' << ev.id().event() << ' '
1868  << (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1) << endl;
1869  }
1870  }
1871  }
1872 
1873  return;
1874 }
1875 
1877 
1878 void BPHHistoSpecificDecay::fillHisto(const string& name, const pat::CompositeCandidate& cand, char svType) {
1879  *recoName = name;
1880  float mass = (cand.hasUserFloat("fitMass") ? cand.userFloat("fitMass") : -1);
1881  fillHisto("mass" + name, cand.mass());
1882  fillHisto("mfit" + name, mass);
1883  recoMass = mass;
1884  recoTime = -999999.0;
1885  recoErrT = -999999.0;
1886 
1887  const reco::Vertex* pvtx = BPHUserData::getByRef<reco::Vertex>(cand, "primaryVertex");
1888  if (pvtx == nullptr) {
1889  const pat::CompositeCandidate* jPsi = BPHUserData::getByRef<pat::CompositeCandidate>(cand, "refToJPsi");
1890  if (jPsi == nullptr)
1891  return;
1892  pvtx = BPHUserData::getByRef<reco::Vertex>(*jPsi, "primaryVertex");
1893  }
1894 
1895  if (pvtx != nullptr) {
1896  const reco::Vertex* svtx = nullptr;
1897  if (svType == 'f')
1898  svtx = BPHUserData::get<reco::Vertex>(cand, "fitVertex");
1899  if (svtx == nullptr)
1900  svtx = BPHUserData::get<reco::Vertex>(cand, "vertex");
1901  if (svtx != nullptr) {
1902  float px;
1903  float py;
1904  const Vector3DBase<float, GlobalTag>* fmom =
1905  BPHUserData::get<Vector3DBase<float, GlobalTag> >(cand, "fitMomentum");
1906  if (fmom != nullptr) {
1907  px = fmom->x();
1908  py = fmom->y();
1909  } else {
1910  px = cand.px();
1911  py = cand.py();
1912  }
1913  double ctauPV2;
1914  double ctauErrPV2;
1915  VertexAnalysis::dist2D(pvtx, svtx, px, py, mass, ctauPV2, ctauErrPV2);
1916  recoTime = ctauPV2;
1917  recoErrT = ctauErrPV2;
1918  fillHisto("ctau" + name, ctauPV2);
1919  }
1920  }
1921  tree->Fill();
1922  return;
1923 }
1924 
1925 void BPHHistoSpecificDecay::fillHisto(const string& name, float x) {
1926  map<string, TH1F*>::iterator iter = histoMap.find(name);
1927  map<string, TH1F*>::iterator iend = histoMap.end();
1928  if (iter == iend)
1929  return;
1930  iter->second->Fill(x);
1931  return;
1932 }
1933 
1934 void BPHHistoSpecificDecay::createHisto(const string& name, int nbin, float hmin, float hmax) {
1935  histoMap[name] = fs->make<TH1F>(name.c_str(), name.c_str(), nbin, hmin, hmax);
1936  return;
1937 }
1938 
1940 
Analysis-level particle class.
BPHDaughterSelect(float ptMinLoose, float ptMinTight, float etaMaxLoose, float etaMaxTight, const BPHSoftMuonSelect *softMuonselector=nullptr)
#define CHK_TRIG(RESULTS, NAMES, INDEX, PATH)
static bool accept(const pat::CompositeCandidate &cand, float ptMinLoose, float ptMinTight, float etaMaxLoose, float etaMaxTight, const reco::Vertex *pv=nullptr, const BPHSoftMuonSelect *softMuonselector=nullptr)
const reco::Vertex * pv
static void dist2D(const reco::Vertex *pvtx, const reco::Vertex *svtx, float px, float py, float mass, double &ctauPV, double &ctauErrPV)
BPHHistoSpecificDecay(const edm::ParameterSet &ps)
BPHCompositeBasicSelect(float massMin, float massMax, float ptMin=-1.0, float etaMax=-1.0, float rapidityMax=-1.0)
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
static const T * getByRef(const pat::CompositeCandidate &cand, const string &name)
std::vector< std::string > Strings
Definition: TriggerNames.h:58
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual double mass() const =0
mass
constexpr float ptMin
static void dist2D(const reco::Vertex *pvtx, const reco::Vertex *svtx, float px, float py, double cosAlpha, float mass, double &ctauPV, double &ctauErrPV)
bool accept(const pat::CompositeCandidate &cand, const reco::Vertex *pv=nullptr) const override
static const double jPsiMass
static const double k0sMass
double ndof() const
Definition: Vertex.h:123
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
const std::string names[nVars_]
#define LogTrace(id)
Error error() const
return SMatrix
Definition: Vertex.h:163
void analyze(const edm::Event &ev, const edm::EventSetup &es) override
static const double kx0Mass
bool accept(const pat::CompositeCandidate &cand, const reco::Vertex *pv=nullptr) const override
T sqrt(T t)
Definition: SSEVec.h:19
void createHisto(const std::string &name, int nbin, float hmin, float hmax)
def pv(vc)
Definition: MetAnalyzer.py:7
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
float ChiSquaredProbability(double chiSquared, double nrDOF)
const AlgebraicSymMatrix33 matrix() const
BPHFittedBasicSelect(float massMin, float massMax, float ptMin=-1.0, float etaMax=-1.0, float rapidityMax=-1.0)
void fillHisto(const std::string &name, const pat::CompositeCandidate &cand, char svType)
double x() const
x coordinate
Definition: Vertex.h:129
d
Definition: ztail.py:151
double y() const
y coordinate
Definition: Vertex.h:131
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
static const double lambda0Mass
static const double phiMass
static double cAlpha(const reco::Vertex *pvtx, const reco::Vertex *svtx, float px, float py)
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
bool accept(const pat::CompositeCandidate &cand, const reco::Vertex *pvtx) const override
BPHGenericVertexSelect(char vType, float probMin, float cosMin=-2.0, float sigMin=-1.0, char dMode='r')
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool isValid() const
Definition: HandleBase.h:70
double value() const
Definition: Measurement1D.h:25
double chi2() const
chi-squares
Definition: Vertex.h:116
ROOT::Math::SVector< double, 3 > AlgebraicVector3
BPHSoftMuonSelect(int cutTrackerLayers=5, int cutPixelLayers=0, float maxDxy=0.3, float maxDz=20.0, bool goodMuon=true, bool highPurity=true)
static vector< const reco::Candidate * > get(const pat::CompositeCandidate &cand, float massMin, float massMax)
float x
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Definition: tree.py:1
bool accept(const reco::Candidate &cand, const reco::Vertex *pv) const
long double T
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const BPHSoftMuonSelect * sms
Analysis-level muon class.
Definition: Muon.h:51
static double cAlpha(const reco::Vertex *pvtx, const reco::Vertex *svtx, const TVector3 &cmom)
#define SET_LABEL(NAME, PSET)
bool accept(const pat::CompositeCandidate &cand, const reco::Vertex *pv=nullptr) const override
virtual double eta() const =0
momentum pseudorapidity