29 m_CALO_INNER_R(1450.),
30 m_CALO_INNER_Z(3641.),
34 m_extrapolator(
"Trk::Extrapolator/AtlasExtrapolator"),
35 m_vxContainerName(
"VxPrimaryCandidate")
69 return StatusCode::SUCCESS;
82 return StatusCode::FAILURE;
86 return StatusCode::FAILURE;
90 std::vector<unsigned int> numTracksPerVertex(primcontainer->
size()-1, 0);
91 std::vector<float> trkParticlePt_atOrigin;
92 std::vector<float> trkParticleEta_atCaloEntrance;
93 std::vector<float> trkParticlePhi_atCaloEntrance;
95 for (
unsigned int v = 0 ;
v < primcontainer->
size()-1; ++
v)
97 const std::vector<Trk::VxTrackAtVertex*>* vxTrackAtVertex = primcontainer->
at(
v)->
vxTrackAtVertex();
98 for (std::vector<Trk::VxTrackAtVertex*>::const_iterator vxTrkItr = vxTrackAtVertex->begin(); vxTrkItr != vxTrackAtVertex->end(); ++vxTrkItr)
103 if (linkToTrackParticle !=
nullptr && linkToTrackParticle->
isValid()) {
105 if (theTrackParticle !=
nullptr)
108 numTracksPerVertex.at(
v)++;
109 trkParticlePt_atOrigin.push_back (theTrackParticle->
pt()/1.e3);
112 const std::vector< const Trk::TrackParameters * >& trackParametersVector = theTrackParticle->
trackParameters();
113 if (trackParametersVector.size() > 1) lastTrackParametersInID = trackParametersVector.at(trackParametersVector.size()-2);
114 else lastTrackParametersInID = trackParametersVector.at(0);
117 if (theTrackParticle->
eta() >
121 trackParameters_atCaloEntrance =
124 *lastTrackParametersInID,
129 }
else if (theTrackParticle->
eta() <
133 trackParameters_atCaloEntrance =
136 *lastTrackParametersInID,
143 trackParameters_atCaloEntrance =
146 *lastTrackParametersInID,
152 if (trackParameters_atCaloEntrance !=
nullptr) {
153 trkParticleEta_atCaloEntrance.push_back(trackParameters_atCaloEntrance->
position().eta());
154 trkParticlePhi_atCaloEntrance.push_back(trackParameters_atCaloEntrance->
position().phi());
155 ATH_MSG_DEBUG(
"At calo entrance R(1150mm) " << *trackParameters_atCaloEntrance );
156 ATH_MSG_DEBUG(
"TrkParticle eta/phi/pt[GeV] at calo " << trackParameters_atCaloEntrance->
position().eta() <<
"\t"
157 << trackParameters_atCaloEntrance->
position().phi() <<
"\t"
158 << trackParameters_atCaloEntrance->
position().perp()/1.e3 );
159 delete trackParameters_atCaloEntrance;
161 trkParticleEta_atCaloEntrance.push_back(999.);
162 trkParticlePhi_atCaloEntrance.push_back(999.);
169 double fabs_Dphi(9999.);
170 double fabs_Deta(9999.);
172 std::vector<float> sumPtOfMatchedTracksPerVertex(numTracksPerVertex.size(), 0.);
179 if (std::fabs(theCluster->
eta()) < 2.5)
184 unsigned int vertexCounter(0);
185 unsigned int totalTrackCounter(0);
186 for ( ; numTrksPerVertexItr != numTrksPerVertexItrE ; ++numTrksPerVertexItr, vertexCounter++)
188 sumPtOfMatchedTracksPerVertex.at(vertexCounter) = 0.;
189 for (
unsigned int track = 0;
track < (*numTrksPerVertexItr); ++
track, totalTrackCounter++)
191 if (trkParticleEta_atCaloEntrance.at(totalTrackCounter) < 900.)
193 fabs_Dphi =
calculateDPhi(trkParticlePhi_atCaloEntrance.at(totalTrackCounter), theCluster->
phi());
194 fabs_Deta = fabs(trkParticleEta_atCaloEntrance.at(totalTrackCounter) - theCluster->
eta());
195 dR2 = fabs_Deta * fabs_Deta + fabs_Dphi * fabs_Dphi;
197 sumPtOfMatchedTracksPerVertex.at(vertexCounter) += trkParticlePt_atOrigin.at(totalTrackCounter);
202 double totalSumPtOfMatchedTracksWhichWereAlsoUsedInAVertex(0.);
203 for (
unsigned int mTpV = 0; mTpV < sumPtOfMatchedTracksPerVertex.size(); ++mTpV) {
204 totalSumPtOfMatchedTracksWhichWereAlsoUsedInAVertex += sumPtOfMatchedTracksPerVertex.at(mTpV);
210 if (totalSumPtOfMatchedTracksWhichWereAlsoUsedInAVertex > 0.)
212 double sumPtInPrimary = sumPtOfMatchedTracksPerVertex.at(0);
213 cvf = sumPtOfMatchedTracksPerVertex.at(0)/totalSumPtOfMatchedTracksWhichWereAlsoUsedInAVertex;
214 std::sort(sumPtOfMatchedTracksPerVertex.begin(), sumPtOfMatchedTracksPerVertex.end());
215 double highestSumPt = sumPtOfMatchedTracksPerVertex.at(sumPtOfMatchedTracksPerVertex.size()-1);
216 if (highestSumPt > 0) ncvf = sumPtInPrimary/highestSumPt;
227 return StatusCode::SUCCESS;
232 double dPhi = std::fabs(phi1 - phi2);