16#include "CLHEP/Vector/LorentzVector.h"
31 const std::string& name,
32 const IInterface* parent)
34 declareInterface<ConversionPostSelector>(
this);
42 return StatusCode::SUCCESS;
46 return StatusCode::SUCCESS;
50 std::vector<Amg::Vector3D>& trkL)
const{
54 double maxChi2 = 1000.;
55 double invMassCut = 1000.;
56 double fitMomentum = 0.;
57 double radius = 1000.;
79 if (vertex->nTrackParticles() != 2) {
80 ATH_MSG_DEBUG(
"Incorrect number of tracks used in conversion fit.");
84 float reducedChi2 = vertex->chiSquared()/vertex->numberDoF();
85 if (reducedChi2 > maxChi2) pass =
false;
86 if (reducedChi2 > maxChi2) pass =
false;
89 double vtxR = vertex->position().perp();
90 if(vtxR < radius) pass =
false;
93 std::vector< Trk::VxTrackAtVertex >& trkAtVx = vertex->vxTrackAtVertex();
94 if (trkAtVx.size() != 2 ||
95 !trkAtVx[0].perigeeAtVertex() ||
96 !trkAtVx[1].perigeeAtVertex())
98 ATH_MSG_DEBUG(
"VxTrackAtVertex or perigeeAtVertex not available");
105 CLHEP::HepLorentzVector momentum;
108 double ee = std::sqrt(m2 + perigee1.
momentum().mag2()) + std::sqrt(m2 + perigee2.
momentum().mag2());
109 momentum.setPx(sum_mom.x()); momentum.setPy(sum_mom.y()); momentum.setPz(sum_mom.z()); momentum.setE(ee);
110 double inv_mass = momentum.m();
111 double photonP = std::sqrt(momentum.x()*momentum.x() + momentum.y()*momentum.y());
112 double pt1 = perigee1.
pT();
double pt2 = perigee2.
pT();
115 if (std::fabs(inv_mass) > invMassCut) pass =
false;
116 if (photonP < fitMomentum) pass =
false;
119 std::vector<Amg::Vector3D>::const_iterator ipb=trkL.begin();
120 std::vector<Amg::Vector3D>::const_iterator ipbe=trkL.end();
121 for(; ipb!=ipbe;++ipb){
122 double tmpfR = (*ipb).perp();
123 if(tmpfR<fR) fR = tmpfR;
125 if(flag==1 && fR-vtxR<
m_maxdR) pass =
false;
127 double PhiVtxTrk = vertex->position().phi() - perigee1.parameters()[
Trk::phi0];
128 if (PhiVtxTrk < -
M_PI) PhiVtxTrk +=
twopi;
129 if (PhiVtxTrk >
M_PI) PhiVtxTrk -=
twopi;
134 ATH_MSG_DEBUG(
"Decorating vertex with values used in post selector");
135 decorateVertex(*vertex, inv_mass, pt1, pt2, fR, std::fabs(PhiVtxTrk) );
146 std::vector<Amg::Vector3D>& trkL,
151 bool isLambda =
false;
152 bool isLambdaBar =
false;
156 double maxChi2 = 1000.;
157 double fitMomentum = 0.;
158 double radius = 1000.;
178 if (vertex->nTrackParticles() != 2) {
179 ATH_MSG_DEBUG(
"Incorrect number of tracks used in conversion fit.");
182 float reducedChi2 = vertex->chiSquared()/vertex->numberDoF();
183 if (reducedChi2 > maxChi2) pass =
false;
186 double vtxR = vertex->position().perp();
187 if(vtxR < radius) pass =
false;
190 std::vector< Trk::VxTrackAtVertex >& trkAtVx = vertex->vxTrackAtVertex();
191 if (trkAtVx.size() != 2 ||
192 !trkAtVx[0].perigeeAtVertex() ||
193 !trkAtVx[1].perigeeAtVertex())
195 ATH_MSG_DEBUG(
"VxTrackAtVertex or perigeeAtVertex not available");
201 double pt1 = perigee1.
pT();
double pt2 = perigee2.
pT();
205 std::vector<Amg::Vector3D>::const_iterator ipb=trkL.begin();
206 std::vector<Amg::Vector3D>::const_iterator ipbe=trkL.end();
207 for(; ipb!=ipbe;++ipb){
208 double tmpfR = (*ipb).perp();
209 if(tmpfR<fR) fR = tmpfR;
211 if(flag==1 && fR-vtxR<
m_maxdR) pass =
false;
214 CLHEP::HepLorentzVector momentumK0 =
fourP(perigee1,perigee2,
m_massK0,
false);
215 double inv_massK0 = momentumK0.m();
218 double inv_massL = momentumL.m();
221 double inv_massLb = momentumLb.m();
223 if (!isLambdaBar && !isLambda && !isK0) pass =
false;
224 CLHEP::HepLorentzVector momentum;
225 if(isK0 && isLambda && !isLambdaBar) {momentum = momentumK0; kind = 110;}
226 if(isK0 && isLambdaBar && !isLambda) {momentum = momentumK0; kind = 101;}
227 if(isK0 && !isLambda && !isLambdaBar) {momentum = momentumK0; kind = 100;}
228 if(!isK0 && isLambda && !isLambdaBar) {momentum = momentumL; kind = 10;}
229 if(!isK0 && isLambdaBar && !isLambda) {momentum = momentumLb; kind = 1;}
230 if(!isK0 && isLambda && isLambdaBar) {momentum = momentumL; kind = 11;}
231 double particleP = std::sqrt(momentum.x()*momentum.x() + momentum.y()*momentum.y());
232 if (particleP < fitMomentum) pass =
false;
238 CLHEP::HepLorentzVector
244 CLHEP::HepLorentzVector momentum;
246 double mp1 = 0.;
double mp2 = 0.;
269 double ee = std::sqrt(mp1 + per1.
momentum().mag2()) + std::sqrt(mp2 + per2.
momentum().mag2());
270 momentum.setPx(sum_mom.x()); momentum.setPy(sum_mom.y()); momentum.setPz(sum_mom.z()); momentum.setE(ee);
280 float deltaPhiVtxTrk)
283 accMass(vertex) = inv_mass;
285 accPt1(vertex) = pt1;
287 accPt2(vertex) = pt2;
289 accMinRfirstHit(vertex) = fR;
291 accDeltaPhiVtxTrk(vertex) = deltaPhiVtxTrk;
bool selectConversionCandidate(xAOD::Vertex *myCandidate, int flag, std::vector< Amg::Vector3D > &trkL) const
Conversion candidate post-fit selectors.
DoubleArrayProperty m_fitMomentum
DoubleArrayProperty m_invMassCut
static constexpr double m_massLambda
ConversionPostSelector(const std::string &type, const std::string &name, const IInterface *parent)
static void decorateVertex(xAOD::Vertex &vertex, float inv_mass, float pt1, float pt2, float fR, float deltaPhiVtxTrk)
Decorate vertices with values used in post selector.
DoubleArrayProperty m_maxChi2
Properties for track selection: all cuts are ANDed.
DoubleProperty m_maxPhiVtxTrk
bool selectSecVtxCandidate(xAOD::Vertex *myCandidate, int flag, std::vector< Amg::Vector3D > &trkL, int &) const
BooleanProperty m_decorateVertices
static constexpr double m_sigmaLambda
static constexpr double m_massK0
Masses and mass ranges for different V0 hypotheses.
virtual StatusCode finalize() override
static constexpr double m_sigmaK0
static const InterfaceID & interfaceID()
DoubleArrayProperty m_minRadius
virtual StatusCode initialize() override
static CLHEP::HepLorentzVector fourP(const Trk::TrackParameters &, const Trk::TrackParameters &, double, bool)
Compute the four-momentum of a particle according to a mass hypothesis.
SG::Accessor< T, ALLOC > Accessor
const Amg::Vector3D & momentum() const
Access method for the momentum.
double charge() const
Returns the charge.
double pT() const
Access method for transverse momentum.
Eigen::Matrix< double, 3, 1 > Vector3D
static const InterfaceID IID_IConversionPostSelector("InDet::ConversionPostSelector", 1, 0)
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
ParametersBase< TrackParametersDim, Charged > TrackParameters
Vertex_v1 Vertex
Define the latest version of the vertex class.