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 //-------------------------------
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 #include <cmath>
26 using namespace std;
27 
28 //-------------------
29 // Initializations --
30 //-------------------
31 
32 //----------------
33 // Constructors --
34 //----------------
36  const string& daug1Name,
37  double daug1Mass,
38  double daug1Sigma,
39  const string& daug2Name,
40  double daug2Mass,
41  double daug2Sigma,
42  const BPHRecoBuilder::BPHGenericCollection* daug1Collection,
43  const BPHRecoBuilder::BPHGenericCollection* daug2Collection,
44  double expectedMass)
46  BPHDecayToV0Builder(es, daug1Name, daug2Name, daug1Collection, daug2Collection),
48  daug1Name,
49  daug1Mass,
50  daug1Sigma,
51  daug2Name,
52  daug2Mass,
53  daug2Sigma,
54  daug1Collection,
55  daug2Collection,
56  expectedMass),
57  p1Mass(daug1Mass),
58  p2Mass(daug2Mass),
59  p1Sigma(daug1Sigma),
60  p2Sigma(daug2Sigma),
61  expMass(expectedMass) {}
62 
64  const string& daug1Name,
65  double daug1Mass,
66  double daug1Sigma,
67  const string& daug2Name,
68  double daug2Mass,
69  double daug2Sigma,
70  const vector<reco::VertexCompositeCandidate>* v0Collection,
71  double expectedMass,
72  const string& searchList)
74  BPHDecayToV0Builder(es, daug1Name, daug2Name, v0Collection, searchList),
76  es, daug1Name, daug1Mass, daug1Sigma, daug2Name, daug2Mass, daug2Sigma, nullptr, nullptr, expectedMass),
77  p1Mass(daug1Mass),
78  p2Mass(daug2Mass),
79  p1Sigma(daug1Sigma),
80  p2Sigma(daug2Sigma),
81  expMass(expectedMass) {}
82 
84  const string& daug1Name,
85  double daug1Mass,
86  double daug1Sigma,
87  const string& daug2Name,
88  double daug2Mass,
89  double daug2Sigma,
90  const vector<reco::VertexCompositePtrCandidate>* vpCollection,
91  double expectedMass,
92  const string& searchList)
94  BPHDecayToV0Builder(es, daug1Name, daug2Name, vpCollection, searchList),
96  es, daug1Name, daug1Mass, daug1Sigma, daug2Name, daug2Mass, daug2Sigma, nullptr, nullptr, expectedMass),
97  p1Mass(daug1Mass),
98  p2Mass(daug2Mass),
99  p1Sigma(daug1Sigma),
100  p2Sigma(daug2Sigma),
101  expMass(expectedMass) {}
102 
103 //--------------
104 // Operations --
105 //--------------
108  return;
109 }
110 
112  const reco::Candidate* c2,
113  const void* v0,
114  v0Type type) {
117  BPHPlusMinusCandidate* cptrX = candX.get();
118  BPHPlusMinusCandidate* cptrY = candY.get();
119  cptrX->add(p1Name, c1, sList, p1Mass, p1Sigma);
120  cptrX->add(p2Name, c2, sList, p2Mass, p2Sigma);
121  cptrY->add(p1Name, c2, sList, p1Mass, p1Sigma);
122  cptrY->add(p2Name, c1, sList, p2Mass, p2Sigma);
123  double mv0 = 0.0;
124  switch (type) {
126  mv0 = static_cast<const reco::VertexCompositeCandidate*>(v0)->mass();
127  break;
129  mv0 = static_cast<const reco::VertexCompositePtrCandidate*>(v0)->mass();
130  break;
131  default:
132  mv0 = expMass;
133  break;
134  }
135  double m1 = 0.0;
136  double m2 = 0.0;
137  if (p1Mass > p2Mass) {
138  m1 = c1->mass();
139  m2 = c2->mass();
140  } else {
141  m1 = c2->mass();
142  m2 = c1->mass();
143  }
144  // check daughter masses in V0 CompositeCandidate
145  double mcut = (p1Mass + p2Mass) / 2;
146  if ((m1 > mcut) && (m2 < mcut))
147  return candX;
148  if ((m1 < mcut) && (m2 > mcut))
149  return candY;
150  // choose combination having the best invariant mass
151  return (fabs(mv0 - cptrX->mass()) < fabs(mv0 - cptrY->mass()) ? candX : candY);
152 }
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
virtual std::vector< prod_ptr > build()
build candidates
const BPHEventSetupWrapper * evSetup
void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0) override
BPHGenericPtr< BPHPlusMinusCandidate >::type BPHPlusMinusCandidatePtr
static type create(Args &&... args)
Definition: BPHGenericPtr.h:10
common object to interface with edm collections
virtual ParticleMass mass() const
BPHDecayToV0DiffMassBuilder(const BPHEventSetupWrapper &es, const std::string &daug1Name, double daug1Mass, double daug1Sigma, const std::string &daug2Name, double daug2Mass, double daug2Sigma, const BPHRecoBuilder::BPHGenericCollection *posCollection, const BPHRecoBuilder::BPHGenericCollection *negCollection, double expectedMass)