CMS 3D CMS Logo

BPHDecayToV0DiffMassBuilder.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //-----------------------
9 // This Class' Header --
10 //-----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 #include <cmath>
25 using namespace std;
26 
27 //-------------------
28 // Initializations --
29 //-------------------
30 
31 //----------------
32 // Constructors --
33 //----------------
35  const std::string& d1Name,
36  double d1Mass,
37  double d1Sigma,
38  const std::string& d2Name,
39  double d2Mass,
40  double d2Sigma,
41  const BPHRecoBuilder::BPHGenericCollection* posCollection,
42  const BPHRecoBuilder::BPHGenericCollection* negCollection,
43  double expectedMass)
44  : BPHDecayToV0Builder(es, d1Name, d2Name, posCollection, negCollection),
45  p1Mass(d1Mass),
46  p2Mass(d2Mass),
47  p1Sigma(d1Sigma),
48  p2Sigma(d2Sigma),
49  expMass(expectedMass) {}
50 
52  const std::string& d1Name,
53  double d1Mass,
54  double d1Sigma,
55  const std::string& d2Name,
56  double d2Mass,
57  double d2Sigma,
58  const std::vector<reco::VertexCompositeCandidate>* v0Collection,
59  double expectedMass,
60  const std::string& searchList)
61  : BPHDecayToV0Builder(es, d1Name, d2Name, v0Collection, searchList),
62  p1Mass(d1Mass),
63  p2Mass(d2Mass),
64  p1Sigma(d1Sigma),
65  p2Sigma(d2Sigma),
66  expMass(expectedMass) {}
67 
69  const edm::EventSetup& es,
70  const std::string& d1Name,
71  double d1Mass,
72  double d1Sigma,
73  const std::string& d2Name,
74  double d2Mass,
75  double d2Sigma,
76  const std::vector<reco::VertexCompositePtrCandidate>* vpCollection,
77  double expectedMass,
78  const std::string& searchList)
79  : BPHDecayToV0Builder(es, d1Name, d2Name, vpCollection, searchList),
80  p1Mass(d1Mass),
81  p2Mass(d2Mass),
82  p1Sigma(d1Sigma),
83  p2Sigma(d2Sigma),
84  expMass(expectedMass) {}
85 
86 //--------------
87 // Destructor --
88 //--------------
90 
91 //--------------
92 // Operations --
93 //--------------
97 
98  b.setTrk1PtMin(ptMin);
99  b.setTrk2PtMin(ptMin);
100  b.setTrk1EtaMax(etaMax);
101  b.setTrk2EtaMax(etaMax);
102  b.setMassRange(getMassMin(), getMassMax());
103  b.setProbMin(getProbMin());
104 
105  cList = b.build();
106 
107  return;
108 }
109 
111  const reco::Candidate* c2,
112  const void* v0,
113  v0Type type) {
116  BPHPlusMinusCandidate* cptrX = candX.get();
117  BPHPlusMinusCandidate* cptrY = candY.get();
118  cptrX->add(p1Name, c1, sList, p1Mass, p1Sigma);
119  cptrX->add(p2Name, c2, sList, p2Mass, p2Sigma);
120  cptrY->add(p1Name, c2, sList, p1Mass, p1Sigma);
121  cptrY->add(p2Name, c1, sList, p2Mass, p2Sigma);
122  double mv0 = 0.0;
123  switch (type) {
125  mv0 = static_cast<const reco::VertexCompositeCandidate*>(v0)->mass();
126  break;
128  mv0 = static_cast<const reco::VertexCompositePtrCandidate*>(v0)->mass();
129  break;
130  default:
131  mv0 = expMass;
132  break;
133  }
134  double m1 = 0.0;
135  double m2 = 0.0;
136  if (p1Mass > p2Mass) {
137  m1 = c1->mass();
138  m2 = c2->mass();
139  } else {
140  m1 = c2->mass();
141  m2 = c1->mass();
142  }
143  // check daughter masses in V0 CompositeCandidate
144  double mcut = (p1Mass + p2Mass) / 2;
145  if ((m1 > mcut) && (m2 < mcut))
146  return candX;
147  if ((m1 < mcut) && (m2 > mcut))
148  return candY;
149  // choose combination having the best invariant mass
150  return (fabs(mv0 - cptrX->mass()) < fabs(mv0 - cptrY->mass()) ? candX : candY);
151 }
void buildFromBPHGenericCollection() override
build candidates and link to V0
BPHPlusMinusCandidatePtr buildCandidate(const reco::Candidate *c1, const reco::Candidate *c2, const void *v0, v0Type type) override
virtual double mass() const =0
mass
double getMassMin() const
get current cuts
const BPHRecoBuilder::BPHGenericCollection * p2Collection
void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0) override
BPHGenericPtr< BPHPlusMinusCandidate >::type BPHPlusMinusCandidatePtr
const BPHRecoBuilder::BPHGenericCollection * p1Collection
std::vector< BPHPlusMinusConstCandPtr > cList
static type create(Args &&... args)
Definition: BPHGenericPtr.h:10
double b
Definition: hdecay.h:118
virtual ParticleMass mass() const
BPHDecayToV0DiffMassBuilder(const edm::EventSetup &es, const std::string &d1Name, double d1Mass, double d1Sigma, const std::string &d2Name, double d2Mass, double d2Sigma, const BPHRecoBuilder::BPHGenericCollection *posCollection, const BPHRecoBuilder::BPHGenericCollection *negCollection, double expectedMass)
const edm::EventSetup * evSetup