30 for(
int iv=0; iv<(int)WrkVrtSet->size(); iv++) {
32 <<
"= "<<(*WrkVrtSet)[iv].vertex[0]
33 <<
", "<<(*WrkVrtSet)[iv].vertex[1]
34 <<
", "<<(*WrkVrtSet)[iv].vertex[2]
35 <<
" NTrk="<<(*WrkVrtSet)[iv].selTrk.size()
36 <<
" is good="<<std::boolalpha<<(*WrkVrtSet)[iv].Good<<std::noboolalpha
37 <<
" Chi2="<<(*WrkVrtSet)[iv].chi2
38 <<
" Mass="<<(*WrkVrtSet)[iv].vertexMom.M()
39 <<
" detached="<<(*WrkVrtSet)[iv].detachedTrack
40 <<
" proj.dist="<<(*WrkVrtSet)[iv].projectedVrt
42 for(
int kk=0; kk<(int)(*WrkVrtSet)[iv].selTrk.size(); kk++) {
43 msg(MSG::INFO)<<
", "<<(*WrkVrtSet)[iv].selTrk[kk];}
44 for(
int kk=0; kk<(int)(*WrkVrtSet)[iv].selTrk.size(); kk++) {
45 msg(MSG::INFO)<<
", "<<
momAtVrt((*WrkVrtSet)[iv].trkAtVrt[kk]).Pt();}
47 if((*WrkVrtSet)[iv].Good)nGoodV++;
49 msg(MSG::INFO)<<name<<
" N="<<nGoodV<<
endmsg;
56 TVector3 SV_PV( SV.x()-PV.
x(), SV.y()-PV.
y(), SV.z()-PV.
z() );
57 return Direction.Vect().Unit()*SV_PV.Unit();
61 const std::vector<double>& secVrtErr,
double& signif)
64 double distx = primVrt.
x()- secVrt.x();
65 double disty = primVrt.
y()- secVrt.y();
66 double distz = primVrt.
z()- secVrt.z();
70 primCovMtx(0,0) += secVrtErr[0];
71 primCovMtx(0,1) += secVrtErr[1];
72 primCovMtx(1,0) += secVrtErr[1];
73 primCovMtx(1,1) += secVrtErr[2];
74 primCovMtx(0,2) += secVrtErr[3];
75 primCovMtx(2,0) += secVrtErr[3];
76 primCovMtx(1,2) += secVrtErr[4];
77 primCovMtx(2,1) += secVrtErr[4];
78 primCovMtx(2,2) += secVrtErr[5];
82 signif = distx*wgtMtx(0,0)*distx
83 +disty*wgtMtx(1,1)*disty
84 +distz*wgtMtx(2,2)*distz
85 +2.*distx*wgtMtx(0,1)*disty
86 +2.*distx*wgtMtx(0,2)*distz
87 +2.*disty*wgtMtx(1,2)*distz;
88 signif=std::sqrt(std::abs(signif));
89 if( signif!=signif ) signif = 0.;
90 return std::sqrt(distx*distx+disty*disty+distz*distz);
94 const std::vector<double>& secVrtErr,
double& signif)
97 double distx = primVrt.
x()- secVrt.x();
98 double disty = primVrt.
y()- secVrt.y();
101 AmgSymMatrix(3) primCovMtx=primVrt.covariancePosition();
103 covMtx(0,0) = primCovMtx(0,0) + secVrtErr[0];
104 covMtx(0,1) = primCovMtx(0,1) + secVrtErr[1];
105 covMtx(1,0) = primCovMtx(1,0) + secVrtErr[1];
106 covMtx(1,1) = primCovMtx(1,1) + secVrtErr[2];
110 signif = distx*wgtMtx(0,0)*distx
111 +disty*wgtMtx(1,1)*disty
112 +2.*distx*wgtMtx(0,1)*disty;
113 signif=std::sqrt(std::abs(signif));
114 if( signif!=signif ) signif = 0.;
115 return std::sqrt(distx*distx+disty*disty);
120 const Amg::Vector3D & vrt2,
const std::vector<double> & vrtErr2)
123 double distx = vrt1.x()- vrt2.x();
124 double disty = vrt1.y()- vrt2.y();
125 double distz = vrt1.z()- vrt2.z();
128 primCovMtx(0,0) = vrtErr1[0]+vrtErr2[0];
129 primCovMtx(0,1) = primCovMtx(1,0) = vrtErr1[1]+vrtErr2[1];
130 primCovMtx(1,1) = vrtErr1[2]+vrtErr2[2];
131 primCovMtx(0,2) = primCovMtx(2,0) = vrtErr1[3]+vrtErr2[3];
132 primCovMtx(1,2) = primCovMtx(2,1) = vrtErr1[4]+vrtErr2[4];
133 primCovMtx(2,2) = vrtErr1[5]+vrtErr2[5];
138 distx*wgtMtx(0,0)*distx
139 +disty*wgtMtx(1,1)*disty
140 +distz*wgtMtx(2,2)*distz
141 +2.*distx*wgtMtx(0,1)*disty
142 +2.*distx*wgtMtx(0,2)*distz
143 +2.*disty*wgtMtx(1,2)*distz;
144 signif=std::sqrt(std::abs(signif));
145 if(signif != signif) signif = 0.;
151 double dx = Vrt1.x()- Vrt2.x();
152 double dy = Vrt1.y()- Vrt2.y();
153 double dz = Vrt1.z()- Vrt2.z();
154 return std::sqrt(dx*dx+dy*dy*dz*dz);
162 double DirX=SecVrt.x(), DirY=SecVrt.y();
163 double Covar = DirX*VrtErr[0]*DirX
164 +2.*DirX*VrtErr[1]*DirY
165 +DirY*VrtErr[2]*DirY;
166 Covar /= DirX*DirX + DirY*DirY;
167 Covar=std::sqrt(std::abs(Covar));
168 if(Covar != Covar) Covar = 0.;
178 double massP,
double massPi )
181 double ap1i=std::abs(TrkAtVrt[0][2]);
double ap2i=std::abs(TrkAtVrt[1][2]);
186 double px = phi1.
cs * theta1.
sn * ap1i
187 + phi2.
cs * theta2.
sn * ap2i;
188 double py = phi1.
sn * theta1.
sn * ap1i
189 + phi2.
sn * theta2.
sn * ap2i;
190 double pz = theta1.
cs * ap1i
192 double ee= (ap1i > ap2i) ?
193 (std::sqrt(ap1i*ap1i+massP*massP)+std::sqrt(ap2i*ap2i+massPi*massPi)):
194 (std::sqrt(ap2i*ap2i+massP*massP)+std::sqrt(ap1i*ap1i+massPi*massPi));
195 double test=(ee-pz)*(ee+pz)-px*px-py*py;
196 return test>0 ? std::sqrt(test) : 0.;
203 double api=1./std::abs(inpTrk[2]);
206 double px =
phi.cs *
theta.sn * api;
207 double py =
phi.sn *
theta.sn * api;
208 double pz =
theta.cs * api;
210 return {px,py,pz,ee};
216 uint8_t IBLhit,IBLexp;
218 if( IBLexp==0 )
return -1;
227 if( BLexp==0 )
return -1;
235 uint32_t HitPattern=Part->hitPattern();
244 truthParticleLinkAcc (
"truthParticleLink");
247 if( !tplink.
isValid() )
return 0;
249 if( truthMatchProbabilityAcc( *TP ) < 0.75 )
return 0;
253 if(!parent1 || !parent1->
isHadron())
return 0;
258 if(!parent2 || !parent2->
isHadron())
return 0;
263 if(!parent3 || !parent3->
isHadron())
return 0;
272 return *(child->
prodVtx()->incomingParticleLinks())[0];
278 if( !tp->hasProdVtx() )
return false;
279 if( !tp->hasDecayVtx() )
return false;
280 Amg::Vector3D pvrt(tp->prodVtx()->x(),tp->prodVtx()->y(),tp->prodVtx()->z());
281 Amg::Vector3D dvrt(tp->decayVtx()->x(),tp->decayVtx()->y(),tp->decayVtx()->z());
282 return Amg::distance(pvrt,dvrt) < 0.001*Gaudi::Units::mm ? true :
false;
290 if( !tplink.
isValid() )
return false;
291 if((*tplink)->hasProdVtx() && (*tplink)->prodVtx()->perp() > 1.*Gaudi::Units::mm)
return true;
298 truthParticleLinkAcc (
"truthParticleLink");
301 truthParticleLinkAcc( *TP );
308 truthParticleLinkAcc (
"truthParticleLink");
311 truthParticleLinkAcc( *TP );
312 if( !tplink.
isValid() )
return 1;
320 if(!TP)
return barVrt;
325 if( !tplink.
isValid() )
return barVrt;
335 if(!parent->isHadron())
return barVrt;
336 if(!parent->hasProdVtx())
return barVrt;
337 Amg::Vector3D vpos1(parent->prodVtx()->x(),parent->prodVtx()->y(),parent->prodVtx()->z());
341 if(parent->prodVtx()->nIncomingParticles()!=1)
return barVrt;
345 if(!grandparent->
isHadron())
return barVrt;
355 if(!biggrandparent->
isHadron())
return barVrt;
356 if(!biggrandparent->
hasProdVtx())
return barVrt;
367 if( !TP1 || !TP2 )
return false;
369 if( !truthParticleLinkAcc.
isAvailable(*TP1) )
return false;
370 if( !truthParticleLinkAcc.
isAvailable(*TP2) )
return false;
372 if( !tplink1.
isValid() )
return false;
374 if( !tplink2.
isValid() )
return false;
391 const EventContext& ctx = Gaudi::Hive::currentContext();
392 if(Vrt.
fitVertex.perp()<20.)
return 1.e9;
401 someLayer = volume->associatedLayer(Vrt.
fitVertex);
404 nextLayerP=someLayer;
417 if(nextLayerP){ extrapParP =
m_extrapolator->extrapolate(ctx, pseudoVrtPart,
419 if(nextLayerN){ extrapParN =
m_extrapolator->extrapolate(ctx, pseudoVrtPart,
422 float distanceP=1.e9, distanceN=1.e9;
425 if(distanceP==1.e9 && distanceN==1.e9)
return 1.e9;
431 std::vector<double> pntCovar={1.e-2,0.,1.e-2,0.,0.,4.e-2};
441 std::vector<double> estimation(3,0.);
442 int ntsel=selTrk.size();
443 for(
int i=0; i<ntsel-1; i++){
444 for(
int j=i+1; j<ntsel; j++){
445 int k = selTrk[i]<selTrk[j] ? selTrk[i]*nTrk+selTrk[j] : selTrk[j]*nTrk+selTrk[i];
446 estimation[0]+=vrt.at(k)[0];
447 estimation[1]+=vrt[k][1];
448 estimation[2]+=vrt[k][2];
450 estimation[0] /= ntsel*(ntsel-1)/2;
451 estimation[1] /= ntsel*(ntsel-1)/2;
452 estimation[2] /= ntsel*(ntsel-1)/2;
Scalar phi() const
phi method
Scalar theta() const
theta method
double charge(const T &p)
Helper class to provide constant type-safe access to aux data.
#define AmgSymMatrix(dim)
bool msgLvl(const MSG::Level lvl) const
ElementLink implementation for ROOT usage.
bool isValid() const
Test to see if the link can be dereferenced.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Base Class for a Detector Layer in the Tracking realm.
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
const Layer * nextLayer(const Amg::Vector3D &gp, const Amg::Vector3D &udir) const
getting the next/previous Layer if registered - unit for direction vector required
const LayerMaterialProperties * layerMaterialProperties() const
getting the LayerMaterialProperties including full/pre/post update
const Amg::Vector3D & position() const
Access method for the position.
bool isBottomHadron() const
Determine if the PID is that of a b-hadron.
bool isHadron() const
Whether the particle is a hadron.
bool hasProdVtx() const
Check for a production vertex on this particle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
bool isCharmHadron() const
Determine if the PID is that of a c-hadron.
float z() const
Vertex longitudinal distance along the beam line form the origin.
float y() const
Vertex y displacement.
size_t nOutgoingParticles() const
Get the number of outgoing particles.
size_t nIncomingParticles() const
Get the number of incoming particles.
float x() const
Vertex x displacement.
float z() const
Returns the z position.
float y() const
Returns the y position.
float x() const
Returns the x position.
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Eigen::Matrix< double, 3, 1 > Vector3D
bool is_simulation_vertex(const T &v)
Method to establish if the vertex was created during simulation (TODO migrate to be based on status).
constexpr int UNDEFINED_ID
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersBase< TrackParametersDim, Charged > TrackParameters
@ pixelEndCap0
three pixel discs (on each side)
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TruthParticle_v1 TruthParticle
Typedef to implementation.
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
Helper to simultaneously calculate sin and cos of the same angle.
Helper to simultaneously calculate sin and cos of the same angle.