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