CMS 3D CMS Logo

BPHX3872ToJPsiPiPiBuilder.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 //-------------------------------
23 
24 //---------------
25 // C++ Headers --
26 //---------------
27 using namespace std;
28 
29 //-------------------
30 // Initializations --
31 //-------------------
32 
33 //----------------
34 // Constructors --
35 //----------------
37  const std::vector<BPHPlusMinusConstCandPtr>& jpsiCollection,
38  const BPHRecoBuilder::BPHGenericCollection* posCollection,
39  const BPHRecoBuilder::BPHGenericCollection* negCollection)
40  : jPsiName("JPsi"),
41  pionPosName("PionPos"),
42  pionNegName("PionNeg"),
43  evSetup(&es),
44  jCollection(&jpsiCollection),
45  pCollection(posCollection),
46  nCollection(negCollection) {
47  jpsiSel = new BPHMassSelect(2.80, 3.40);
48  ptMin = 1.0;
49  etaMax = 10.0;
50  massSel = new BPHMassSelect(3.00, 4.50);
51  chi2Sel = new BPHChi2Select(0.02);
53  massConstr = true;
54  minPDiff = 1.0e-4;
55  updated = false;
56 }
57 
58 //--------------
59 // Destructor --
60 //--------------
62  delete jpsiSel;
63  delete massSel;
64  delete chi2Sel;
65  delete mFitSel;
66 }
67 
68 //--------------
69 // Operations --
70 //--------------
71 vector<BPHRecoConstCandPtr> BPHX3872ToJPsiPiPiBuilder::build() {
72  if (updated)
73  return x3872List;
74 
75  x3872List.clear();
76 
77  // extract basic informations from input collections
78 
79  class Particle {
80  public:
81  Particle(const reco::Candidate* c, const reco::Track* tk, double x, double y, double z, double p)
82  : cand(c), track(tk), px(x), py(y), pz(z), ePion(p) {}
83  const reco::Candidate* cand;
84  const reco::Track* track;
85  double px;
86  double py;
87  double pz;
88  double ePion;
89  };
90 
91  vector<Particle> pList;
92  vector<Particle> nList;
93 
94  int nPos = pCollection->size();
95  int nNeg = nCollection->size();
96 
97  pList.reserve(nPos);
98  nList.reserve(nNeg);
99 
100  // filter input collections
101 
102  int iPos;
103  int iNeg;
104 
105  for (iPos = 0; iPos < nPos; ++iPos) {
106  const reco::Candidate& cand = pCollection->get(iPos);
107  if (cand.charge() != +1)
108  continue;
110  if (p4.pt() < ptMin)
111  continue;
112  if (p4.eta() > etaMax)
113  continue;
114  const reco::Track* tk = BPHTrackReference::getTrack(cand, "cfhp");
115  if (tk == nullptr)
116  continue;
117  double px = p4.px();
118  double py = p4.py();
119  double pz = p4.pz();
120  double p2 = (px * px) + (py * py) + (pz * pz);
121  pList.push_back(
123  }
124 
125  for (iNeg = 0; iNeg < nNeg; ++iNeg) {
126  const reco::Candidate& cand = nCollection->get(iNeg);
127  if (cand.charge() != -1)
128  continue;
130  if (p4.pt() < ptMin)
131  continue;
132  if (p4.eta() > etaMax)
133  continue;
134  const reco::Track* tk = BPHTrackReference::getTrack(cand, "cfhp");
135  if (tk == nullptr)
136  continue;
137  double px = p4.px();
138  double py = p4.py();
139  double pz = p4.pz();
140  double p2 = (px * px) + (py * py) + (pz * pz);
141  nList.push_back(
143  }
144 
145  // filter basic candidates
146 
147  nPos = pList.size();
148  nNeg = nList.size();
149 
150  double mMax = getMassMax() - (0.8 * BPHParticleMasses::jPsiMass);
151 
152  struct PionPair {
153  const reco::Candidate* posPion;
154  const reco::Candidate* negPion;
155  };
156  vector<const PionPair*> pionPairs;
157  pionPairs.reserve(nPos * nNeg);
158 
159  for (iPos = 0; iPos < nPos; ++iPos) {
160  Particle& pc = pList[iPos];
161  const reco::Track* pt = pc.track;
162  double px = pc.px;
163  double py = pc.py;
164  double pz = pc.pz;
165  double pe = pc.ePion;
166  for (iNeg = 0; iNeg < nNeg; ++iNeg) {
167  Particle& nc = nList[iNeg];
168  const reco::Track* nt = nc.track;
169  if (fabs(nt->dz() - pt->dz()) > 1.0)
170  continue;
171  double nx = nc.px;
172  double ny = nc.py;
173  double nz = nc.pz;
174  double ne = nc.ePion;
175  const float tx = px + nx;
176  const float ty = py + ny;
177  const float tz = pz + nz;
178  const float te = pe + ne;
179  float mass = (te * te) - ((tx * tx) + (ty * ty) + (tz * tz));
180  if (mass > mMax)
181  continue;
182  PionPair* pp = new PionPair;
183  pp->posPion = pc.cand;
184  pp->negPion = nc.cand;
185  pionPairs.push_back(pp);
186  }
187  }
188 
189  vector<BPHPlusMinusConstCandPtr> jPsi;
190  int nJPsi = jCollection->size();
191  int iJPsi;
192  jPsi.reserve(nJPsi);
193  for (iJPsi = 0; iJPsi < nJPsi; ++iJPsi) {
194  const BPHPlusMinusConstCandPtr& jpCand = jCollection->at(iJPsi);
195  if (jpsiSel->accept(*jpCand))
196  jPsi.push_back(jpCand);
197  }
198  nJPsi = jPsi.size();
199 
200  int nPair = pionPairs.size();
201  int iPair;
202  for (iPair = 0; iPair < nPair; ++iPair) {
203  const PionPair* pp = pionPairs[iPair];
204  for (iJPsi = 0; iJPsi < nJPsi; ++iJPsi) {
206  BPHRecoCandidatePtr xPtr(x3872);
207  x3872->add(jPsiName, jPsi[iJPsi]);
210  if (!massSel->accept(*x3872))
211  continue;
212  if ((chi2Sel != nullptr) && !chi2Sel->accept(*x3872))
213  continue;
214  if (!mFitSel->accept(*x3872))
215  continue;
216  x3872List.push_back(xPtr);
217  }
218  delete pp;
219  }
220 
221  updated = true;
222  return x3872List;
223 }
224 
227  updated = false;
228  jpsiSel->setMassMin(m);
229  return;
230 }
231 
233  updated = false;
234  jpsiSel->setMassMax(m);
235  return;
236 }
237 
239  updated = false;
240  ptMin = pt;
241  return;
242 }
243 
245  updated = false;
246  etaMax = eta;
247  return;
248 }
249 
251  updated = false;
252  massSel->setMassMin(m);
253  return;
254 }
255 
257  updated = false;
258  massSel->setMassMax(m);
259  return;
260 }
261 
263  updated = false;
264  delete chi2Sel;
265  chi2Sel = (p < 0.0 ? nullptr : new BPHChi2Select(p));
266  return;
267 }
268 
270  updated = false;
271  mFitSel->setMassMin(m);
272  return;
273 }
274 
276  updated = false;
277  mFitSel->setMassMax(m);
278  return;
279 }
280 
282  updated = false;
283  massConstr = flag;
284  return;
285 }
286 
289 
291 
293 
295 
297 
299 
300 double BPHX3872ToJPsiPiPiBuilder::getProbMin() const { return (chi2Sel == nullptr ? -1.0 : chi2Sel->getProbMin()); }
301 
303 
305 
BPHX3872ToJPsiPiPiBuilder::getPiEtaMax
double getPiEtaMax() const
Definition: BPHX3872ToJPsiPiPiBuilder.cc:294
BPHX3872ToJPsiPiPiBuilder::getJPsiMassMax
double getJPsiMassMax() const
Definition: BPHX3872ToJPsiPiPiBuilder.cc:290
BPHMassCuts::setMassMax
void setMassMax(double m)
Definition: BPHMassCuts.h:52
DDAxes::y
BPHChi2Select.h
BPHTrackReference.h
BPHMassFitSelect.h
BPHParticleMasses::jPsiMass
static const double jPsiMass
Definition: BPHParticleMasses.h:40
BPHX3872ToJPsiPiPiBuilder::ptMin
double ptMin
Definition: BPHX3872ToJPsiPiPiBuilder.h:99
nt
int nt
Definition: AMPTWrapper.h:42
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
BPHX3872ToJPsiPiPiBuilder::jCollection
const std::vector< BPHPlusMinusConstCandPtr > * jCollection
Definition: BPHX3872ToJPsiPiPiBuilder.h:94
BPHChi2Select::getProbMin
double getProbMin() const
get current prob min
Definition: BPHChi2Select.h:66
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
BPHRecoCandidatePtr
BPHGenericPtr< BPHRecoCandidate >::type BPHRecoCandidatePtr
Definition: BPHRecoCandidatePtr.h:7
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BPHX3872ToJPsiPiPiBuilder::chi2Sel
BPHChi2Select * chi2Sel
Definition: BPHX3872ToJPsiPiPiBuilder.h:103
BPHMassCuts::getMassMin
double getMassMin() const
get current mass cuts
Definition: BPHMassCuts.h:58
BPHRecoBuilder::BPHGenericCollection::get
virtual const reco::Candidate & get(int i) const =0
BPHX3872ToJPsiPiPiBuilder::massConstr
bool massConstr
Definition: BPHX3872ToJPsiPiPiBuilder.h:106
BPHX3872ToJPsiPiPiBuilder::getMassMax
double getMassMax() const
Definition: BPHX3872ToJPsiPiPiBuilder.cc:298
DDAxes::x
BPHX3872ToJPsiPiPiBuilder::build
std::vector< BPHRecoConstCandPtr > build()
build X3872 candidates
Definition: BPHX3872ToJPsiPiPiBuilder.cc:71
BPHX3872ToJPsiPiPiBuilder::~BPHX3872ToJPsiPiPiBuilder
virtual ~BPHX3872ToJPsiPiPiBuilder()
Definition: BPHX3872ToJPsiPiPiBuilder.cc:61
BPHX3872ToJPsiPiPiBuilder::setMassFitMax
void setMassFitMax(double m)
Definition: BPHX3872ToJPsiPiPiBuilder.cc:275
BPHX3872ToJPsiPiPiBuilder::x3872List
std::vector< BPHRecoConstCandPtr > x3872List
Definition: BPHX3872ToJPsiPiPiBuilder.h:110
BPHX3872ToJPsiPiPiBuilder::mFitSel
BPHMassFitSelect * mFitSel
Definition: BPHX3872ToJPsiPiPiBuilder.h:104
BPHTrackReference::getTrack
static const reco::Track * getTrack(const reco::Candidate &rc, const char *modeList="cfhbpmnigset", char *modeFlag=nullptr)
Definition: BPHTrackReference.h:60
BPHParticleMasses.h
BPHX3872ToJPsiPiPiBuilder::getMassFitMax
double getMassFitMax() const
Definition: BPHX3872ToJPsiPiPiBuilder.cc:304
BPHX3872ToJPsiPiPiBuilder::pionPosName
std::string pionPosName
Definition: BPHX3872ToJPsiPiPiBuilder.h:90
PVValHelper::eta
Definition: PVValidationHelpers.h:69
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
BPHX3872ToJPsiPiPiBuilder::getJPsiMassMin
double getJPsiMassMin() const
get current cuts
Definition: BPHX3872ToJPsiPiPiBuilder.cc:288
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
reco::Track
Definition: Track.h:27
BPHMassSelect
Definition: BPHMassSelect.h:31
p2
double p2[4]
Definition: TauolaWrapper.h:90
BPHX3872ToJPsiPiPiBuilder::setMassFitMin
void setMassFitMin(double m)
Definition: BPHX3872ToJPsiPiPiBuilder.cc:269
BPHMassCuts::setMassMin
void setMassMin(double m)
set mass cuts
Definition: BPHMassCuts.h:48
BPHX3872ToJPsiPiPiBuilder::getConstr
bool getConstr() const
Definition: BPHX3872ToJPsiPiPiBuilder.cc:306
BPHX3872ToJPsiPiPiBuilder::getMassMin
double getMassMin() const
Definition: BPHX3872ToJPsiPiPiBuilder.cc:296
BPHX3872ToJPsiPiPiBuilder::setPiPtMin
void setPiPtMin(double pt)
set cuts
Definition: BPHX3872ToJPsiPiPiBuilder.cc:238
BPHX3872ToJPsiPiPiBuilder::getPiPtMin
double getPiPtMin() const
get current cuts
Definition: BPHX3872ToJPsiPiPiBuilder.cc:292
BPHX3872ToJPsiPiPiBuilder::pCollection
const BPHRecoBuilder::BPHGenericCollection * pCollection
Definition: BPHX3872ToJPsiPiPiBuilder.h:95
BPHX3872ToJPsiPiPiBuilder::BPHX3872ToJPsiPiPiBuilder
BPHX3872ToJPsiPiPiBuilder(const edm::EventSetup &es, const std::vector< BPHPlusMinusConstCandPtr > &jpsiCollection, const BPHRecoBuilder::BPHGenericCollection *posCollection, const BPHRecoBuilder::BPHGenericCollection *negCollection)
Definition: BPHX3872ToJPsiPiPiBuilder.cc:36
BPHParticleMasses::pionMass
static const double pionMass
Definition: BPHParticleMasses.h:33
BPHParticleMasses::pionMSigma
static const double pionMSigma
Definition: BPHParticleMasses.h:48
BPHX3872ToJPsiPiPiBuilder::setJPsiMassMin
void setJPsiMassMin(double m)
set cuts
Definition: BPHX3872ToJPsiPiPiBuilder.cc:226
BPHMassSelect.h
BPHX3872ToJPsiPiPiBuilder::setConstr
void setConstr(bool flag)
Definition: BPHX3872ToJPsiPiPiBuilder.cc:281
cand
Definition: decayParser.h:34
BPHX3872ToJPsiPiPiBuilder::nCollection
const BPHRecoBuilder::BPHGenericCollection * nCollection
Definition: BPHX3872ToJPsiPiPiBuilder.h:96
p4
double p4[4]
Definition: TauolaWrapper.h:92
BPHRecoBuilder::BPHGenericCollection::size
virtual int size() const =0
BPHMassCuts::getMassMax
double getMassMax() const
Definition: BPHMassCuts.h:59
BPHX3872ToJPsiPiPiBuilder::massSel
BPHMassSelect * massSel
Definition: BPHX3872ToJPsiPiPiBuilder.h:102
BPHX3872ToJPsiPiPiBuilder::etaMax
double etaMax
Definition: BPHX3872ToJPsiPiPiBuilder.h:100
BPHX3872ToJPsiPiPiBuilder.h
edm::EventSetup
Definition: EventSetup.h:57
BPHChi2Select
Definition: BPHChi2Select.h:31
BPHPlusMinusConstCandPtr
BPHGenericPtr< const BPHPlusMinusCandidate >::type BPHPlusMinusConstCandPtr
Definition: BPHPlusMinusCandidatePtr.h:9
BPHRecoBuilder.h
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
BPHX3872ToJPsiPiPiBuilder::getProbMin
double getProbMin() const
Definition: BPHX3872ToJPsiPiPiBuilder.cc:300
reco::Candidate
Definition: Candidate.h:27
BPHRecoBuilder::BPHGenericCollection
Definition: BPHRecoBuilder.h:70
BPHX3872ToJPsiPiPiBuilder::pionNegName
std::string pionNegName
Definition: BPHX3872ToJPsiPiPiBuilder.h:91
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
BPHX3872ToJPsiPiPiBuilder::setMassMin
void setMassMin(double m)
Definition: BPHX3872ToJPsiPiPiBuilder.cc:250
BPHX3872ToJPsiPiPiBuilder::updated
bool updated
Definition: BPHX3872ToJPsiPiPiBuilder.h:108
BPHX3872ToJPsiPiPiBuilder::setMassMax
void setMassMax(double m)
Definition: BPHX3872ToJPsiPiPiBuilder.cc:256
std
Definition: JetResolutionObject.h:76
BPHPlusMinusCandidate.h
BPHX3872ToJPsiPiPiBuilder::minPDiff
float minPDiff
Definition: BPHX3872ToJPsiPiPiBuilder.h:107
BPHX3872ToJPsiPiPiBuilder::jPsiName
std::string jPsiName
Definition: BPHX3872ToJPsiPiPiBuilder.h:89
BPHX3872ToJPsiPiPiBuilder::evSetup
const edm::EventSetup * evSetup
Definition: BPHX3872ToJPsiPiPiBuilder.h:93
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
Particle
Definition: Particle.py:1
BPHX3872ToJPsiPiPiBuilder::getMassFitMin
double getMassFitMin() const
Definition: BPHX3872ToJPsiPiPiBuilder.cc:302
BPHX3872ToJPsiPiPiBuilder::setProbMin
void setProbMin(double p)
Definition: BPHX3872ToJPsiPiPiBuilder.cc:262
BPHX3872ToJPsiPiPiBuilder::setPiEtaMax
void setPiEtaMax(double eta)
Definition: BPHX3872ToJPsiPiPiBuilder.cc:244
BPHRecoCandidate::add
virtual void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
Definition: BPHRecoCandidate.h:69
BPHMassSelect::accept
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:48
BPHX3872ToJPsiPiPiBuilder::jpsiSel
BPHMassSelect * jpsiSel
Definition: BPHX3872ToJPsiPiPiBuilder.h:98
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
createTree.pp
pp
Definition: createTree.py:17
BPHChi2Select::accept
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:48
BPHRecoCandidate
Definition: BPHRecoCandidate.h:46
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
BPHX3872ToJPsiPiPiBuilder::setJPsiMassMax
void setJPsiMassMax(double m)
Definition: BPHX3872ToJPsiPiPiBuilder.cc:232
BPHMassFitSelect::accept
bool accept(const BPHKinematicFit &cand) const override
select particle
Definition: BPHMassFitSelect.h:71
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
BPHParticleMasses::jPsiMWidth
static const double jPsiMWidth
Definition: BPHParticleMasses.h:55
BPHMassFitSelect
Definition: BPHMassFitSelect.h:34