CMS 3D CMS Logo

BPHDecayToChargedXXbarBuilder.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 //-------------------------------
27 
28 //---------------
29 // C++ Headers --
30 //---------------
31 using namespace std;
32 
33 //-------------------
34 // Initializations --
35 //-------------------
36 
37 //----------------
38 // Constructors --
39 //----------------
41  const string& dPosName,
42  const string& dNegName,
43  double daugMass,
44  double daugSigma,
45  const BPHRecoBuilder::BPHGenericCollection* posCollection,
46  const BPHRecoBuilder::BPHGenericCollection* negCollection)
48  ptMin(-1.0),
49  etaMax(10.0),
50  dzMax(1.0),
51  pName(dPosName),
52  nName(dNegName),
53  dMass(daugMass),
54  dSigma(daugSigma),
55  pCollection(posCollection),
56  nCollection(negCollection) {}
57 
58 //--------------
59 // Operations --
60 //--------------
61 
64  outdated = true;
65  ptMin = pt;
66  return;
67 }
68 
70  outdated = true;
71  etaMax = eta;
72  return;
73 }
74 
76  outdated = true;
77  dzMax = dz;
78  return;
79 }
80 
83  // extract basic informations from input collections
84 
85  vector<Particle*> pList;
86  vector<Particle*> nList;
87 
88  addParticle(pCollection, +1, pList);
89  addParticle(nCollection, -1, nList);
90  int iPos;
91  int iNeg;
92  int nPos = pList.size();
93  int nNeg = nList.size();
94  double massMin = getMassMin();
95  double massMax = getMassMax();
96  double mSqMin = massMin * massMin * 0.9;
97  double mSqMax = massMax * massMax * 1.1;
98  if (mSqMin < 0.0)
99  mSqMin = 0.0;
100 
101  for (iPos = 0; iPos < nPos; ++iPos) {
102  Particle* pc = pList[iPos];
103  const reco::Track* pt = pc->track;
104  double px = pc->px;
105  double py = pc->py;
106  double pz = pc->pz;
107  double pe = pc->en;
108  for (iNeg = 0; iNeg < nNeg; ++iNeg) {
109  Particle* nc = nList[iNeg];
110  const reco::Track* nt = nc->track;
111  if (fabs(nt->dz() - pt->dz()) > 1.0)
112  continue;
113  double nx = nc->px;
114  double ny = nc->py;
115  double nz = nc->pz;
116  double ne = nc->en;
117  const float tx = px + nx;
118  const float ty = py + ny;
119  const float tz = pz + nz;
120  const float te = pe + ne;
121  const float m2 = (te * te) - ((tx * tx) + (ty * ty) + (tz * tz));
122  if (m2 < mSqMin)
123  continue;
124  if (m2 > mSqMax)
125  continue;
127  rc->add(pName, pc->cand, dMass, dSigma);
128  rc->add(nName, nc->cand, dMass, dSigma);
129  double mass = rc->composite().mass();
130  if (mass < massMin)
131  continue;
132  if (mass > massMax)
133  continue;
134  if (!chi2Sel->accept(*rc))
135  continue;
136  recList.push_back(rc);
137  }
138  }
139 
140  for (iPos = 0; iPos < nPos; ++iPos)
141  delete pList[iPos];
142  for (iNeg = 0; iNeg < nNeg; ++iNeg)
143  delete nList[iNeg];
144 
145  return;
146 }
147 
149  int charge,
150  vector<Particle*>& list) {
151  int i;
152  int n = collection->size();
153  list.reserve(n);
154  for (i = 0; i < n; ++i) {
155  const reco::Candidate& cand = collection->get(i);
156  int q = cand.charge();
157  if ((charge > 0) && (q <= 0))
158  continue;
159  if ((charge < 0) && (q >= 0))
160  continue;
161  const reco::Candidate::LorentzVector p4 = cand.p4();
162  if (p4.pt() < ptMin)
163  continue;
164  if (p4.eta() > etaMax)
165  continue;
166  const reco::Track* tk = BPHTrackReference::getTrack(cand, "cfhp");
167  if (tk == nullptr)
168  continue;
169  double px = p4.px();
170  double py = p4.py();
171  double pz = p4.pz();
172  list.push_back(new Particle(&cand, tk, px, py, pz, sqrt((px * px) + (py * py) + (pz * pz) + (dMass * dMass))));
173  }
174  return;
175 }
void fillRecList() override
build candidates
constexpr float ptMin
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:48
constexpr float dzMax
const BPHEventSetupWrapper * evSetup
double getMassMin() const
get current cuts
T sqrt(T t)
Definition: SSEVec.h:23
BPHGenericPtr< BPHPlusMinusCandidate >::type BPHPlusMinusCandidatePtr
static const reco::Track * getTrack(const reco::Candidate &rc, const char *modeList="cfhbpmnigset", char *modeFlag=nullptr)
const BPHRecoBuilder::BPHGenericCollection * pCollection
BPHDecayToChargedXXbarBuilder(const BPHEventSetupWrapper &es, const std::string &dPosName, const std::string &dNegName, double daugMass, double daugSigma, const BPHRecoBuilder::BPHGenericCollection *posCollection, const BPHRecoBuilder::BPHGenericCollection *negCollection)
int nt
Definition: AMPTWrapper.h:42
static type create(Args &&... args)
Definition: BPHGenericPtr.h:10
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
common object to interface with edm collections
void addParticle(const BPHRecoBuilder::BPHGenericCollection *collection, int charge, std::vector< Particle *> &list)
const BPHRecoBuilder::BPHGenericCollection * nCollection