36 {
37
38 using namespace asg::msgUserCode;
39
40
41 static const char*
APP_NAME =
"TrackVertexAssoValidator";
42
43
45
46
47 std::unique_ptr< TFile >
infile( TFile::Open(
"$ASG_TEST_FILE_MC",
48 "READ" ) );
49 if( ( ! infile ) ||
infile->IsZombie() ) {
51 return 1;
52 }
53
54
57
58
60 trktovxtool( "TrackVertexAssociationTool" );
62 MSG::ERROR ) );
65
66
67 const Long64_t
nentries =
event.getEntries();
70
71 if(nentries > 100) {
72 maxEntries = 100;
73 }
74 ATH_MSG_INFO(
"Running over first " << maxEntries <<
" events" );
75 for( Long64_t entry = 0;
entry < maxEntries; ++
entry ) {
76
77
78 if(
event.getEntry( entry ) < 0 ) {
80 return 1;
81 }
82
83
87 "InDetTrackParticles" ) );
89
90
91 if( ! vxCont->
size() ) {
93 continue;
94 }
95
96
97 ATH_MSG_INFO(
"Testing TrackVertexAssociationTool::isCompatible...");
98 if(trkCont->
size()!=0 && vxCont->
size()!=0)
99 {
100 bool isMatched = trktovxtool.isCompatible(*(trkCont->
at(0)), *(vxCont->
at(0)));
101 ATH_MSG_INFO(
"Is the first track compatible with the first vertex (the PriVx)? "<< isMatched);
102 }
103
104
105 ATH_MSG_INFO(
"Testing TrackVertexAssociationTool::getMatchMap...");
107 ATH_MSG_INFO(
"Number of vertices for track-vertex association: " << trkvxassoMap.size());
108 for (const auto& assoc: trkvxassoMap) {
110 ATH_MSG_INFO(
"vertex at x, y, z " << vx->
x() <<
", " << vx->
y() <<
", " << vx->
z() <<
111 " has " << assoc.second.size() << " associated tracks");
112 }
113
114 ATH_MSG_INFO(
"Testing TrackVertexAssociationTool::getUniqueMatchVertex...");
115 std::vector<const xAOD::Vertex* > v_vx;
116 v_vx.clear();
117 for(auto *vertex : *vxCont) {
118 v_vx.push_back(vertex);
119 }
120 if(trkCont->
size()!=0)
121 {
122 const xAOD::Vertex *vx = trktovxtool.getUniqueMatchVertex(*(trkCont->
at(0)), v_vx);
123 ATH_MSG_INFO(
"Unique match vertex for first track: " << vx);
124 }
125
126
127 ATH_MSG_INFO(
"Testing TrackVertexAssociationTool::getUniqueMatchVertexLink...");
128 if(trkCont->
size() > 2)
129 {
131
133 {
134 ATH_MSG_INFO(
"Uniquely matched vertex for third track - ");
135 ATH_MSG_INFO(
"Vertex ElementLink address: " << match_vx );
138 }
139 }
140
141
142 ATH_MSG_INFO(
"Testing TrackVertexAssociationTool::getUniqueMatchMap...");
144 ATH_MSG_INFO(
"Number of vertices for track-vertex association: " << trkvxassoUniqueMap.size());
145 for (const auto& assoc: trkvxassoUniqueMap) {
147 ATH_MSG_INFO(
"vertex at x, y, z " << vx->
x() <<
", " << vx->
y() <<
", " << vx->
z() <<
148 " has " << assoc.second.size() << " uniquely associated tracks");
149 }
150
151 }
152
153
154 return 0;
155}
#define ATH_MSG_WARNING(x)
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink implementation for ROOT usage.
bool isValid() const
Test to see if the link can be dereferenced.
Tool for accessing xAOD files outside of Athena.
float z() const
Returns the z position.
float y() const
Returns the y position.
float x() const
Returns the x position.
bool isMatched(int matchInfo)
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
std::map< const xAOD::Vertex *, xAOD::TrackVertexAssociationList > TrackVertexAssociationMap
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".