46 enum vertexCatogory_tracks {
52 enum vertexCategory_vertex {
54 multipleTruthVertices,
60 multiset<const xAOD::TruthVertex*> truth_vertices;
63 set<const xAOD::TruthVertex*> truth_vertices_types;
65 vector<const xAOD::TrackParticle*> reco_tracks;
66 vector<const xAOD::TrackParticle*> orphan_tracks;
67 vector<const xAOD::TrackParticle*> fake_tracks;
73 for(
size_t itrk=0; itrk<vertex->nTrackParticles(); itrk++ ) {
74 const auto *trk = vertex->trackParticle( itrk );
76 ATH_MSG_VERBOSE(
"categorizeVertexTruthTopology(): track loop itrk = " << itrk );
79 const truthLink& link = truthParticleLinkAcc(*trk);
82 fake_tracks.emplace_back( trk );
88 orphan_tracks.emplace_back( trk );
92 reco_tracks.emplace_back( trk );
94 truth_vertices_types .insert( truth->
prodVtx() );
95 truth_vertices .insert( truth->
prodVtx() );
101 ATH_MSG_VERBOSE(
"categorizeVertexTruthTopology(): Add truth track pattern to the reco vertex" );
103 if( reco_tracks.size() == vertex->nTrackParticles() ) {
104 trkpatAcc( *vertex ) = allTruthAssociated;
105 }
else if( fake_tracks.size() == vertex->nTrackParticles() ) {
106 trkpatAcc( *vertex ) = allFakeTracks;
108 trkpatAcc( *vertex ) = hasFakeTracks;
113 ATH_MSG_VERBOSE(
"categorizeVertexTruthTopology(): Histogramming - counting the number of appearing truth vertices connected" );
114 vector< tuple<const xAOD::TruthVertex*, size_t> > truth_vertex_histogram;
115 for(
const auto *v : truth_vertices_types ) {
116 size_t count = truth_vertices.count( v );
117 truth_vertex_histogram.emplace_back( v,
count );
121 ATH_MSG_VERBOSE(
"categorizeVertexTruthTopology(): Determine the truth vertex associated to this vertex by majority decision" );
122 tuple<const xAOD::TruthVertex*, size_t> tmp_tuple(
nullptr, 0 );
123 for(
const auto& t : truth_vertex_histogram ) {
124 const size_t& size_tmp =
get<1>( tmp_tuple );
125 const size_t& size_this =
get<1>( t );
126 if( size_tmp < size_this ) tmp_tuple = t;
130 ATH_MSG_VERBOSE(
"categorizeVertexTruthTopology(): Add truth track pattern to the reco vertex" );
131 char truth_vtx_pattern = 0;
132 if( truth_vertices_types.empty() ) {
133 truth_vtx_pattern = noTruthVertex;
134 }
else if( truth_vertices_types.size() == 1 ) {
135 truth_vtx_pattern = uniqueTruthVertex;
137 truth_vtx_pattern = multipleTruthVertices;
140 vtxpatAcc(*vertex) = truth_vtx_pattern;
144 if( noTruthVertex != truth_vtx_pattern ) {
147 ATH_MSG_VERBOSE(
"categorizeVertexTruthTopology(): Retrieve the truth vertex container for element link" );
152 ATH_MSG_VERBOSE(
"categorizeVertexTruthTopology(): create the element link" );
153 const auto *theVertex =
get<0>( tmp_tuple );
157 ATH_MSG_VERBOSE(
"categorizeVertexTruthTopology(): Add the truth vertex element link to the reco vertex" );
163 linkAcc(
"truth_vtx_link" );
164 linkAcc(*vertex) = vtx_link;
166 return StatusCode::SUCCESS;
bool hasProdVtx() const
Check for a production vertex on this particle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.