69 {
70
71
73#define CHECK( ARG ) do {ASG_CHECK_SA( APP_NAME, ARG );} while (false)
74
76
77 if( argc < 2 ) {
82 return 1;
83 }
84 } else {
86 }
87
88
89 StatusCode::enableFailure();
90
91
93
94
96 unique_ptr< TFile >
ifile( TFile::Open(
fileName.data(),
"READ" ) );
97 StatusCode gotFile =
ifile.get()!=
nullptr ? StatusCode::SUCCESS : StatusCode::FAILURE;
99
100
104
105
106 Long64_t
entries =
event.getEntries();
107 if( argc > 2 ) {
108 const Long64_t
e = atoll( argv[ 2 ] );
111 }
112 }
113
114 unique_ptr< TFile >
outFile(
new TFile(
"IDTrackSelectionToolTestOut.root",
"RECREATE"));
116
117 const vector<string> cutNames = {"NoCut", "Loose", "LoosePrimary", "TightPrimary", "LooseMuon", "LooseElectron", "MinBias", "HILoose", "HITight", "HILooseOptimized", "HITightOptimized"};
118 const vector<string> otherCutNames = {"IP", "IPSigma", "IPSignificance"};
119 std::map<string, unique_ptr<TrkSelTool> > selToolMap;
120 std::map<string, unique_ptr<HistFamily> > histFamilyMap;
121 for (const auto& cut : cutNames) {
122 selToolMap[
cut] = unique_ptr<TrkSelTool>(
new TrkSelTool( (cut+
"TrackSelection") ));
125 histFamilyMap[
cut] = unique_ptr<HistFamily>(
new HistFamily(cut));
126 }
127 selToolMap[
"IP"] = unique_ptr<TrkSelTool>(
new TrkSelTool(
"IPTrackSelection"));
131 histFamilyMap[
"IP"] = unique_ptr<HistFamily>(
new HistFamily(
"IP"));
132 selToolMap[
"IPSigma"] = unique_ptr<TrkSelTool>(
new TrkSelTool(
"IPSigmaTrackSelection"));
136 histFamilyMap[
"IPSigma"] = unique_ptr<HistFamily>(
new HistFamily(
"IPSigma"));
137 selToolMap[
"IPSignificance"] = unique_ptr<TrkSelTool>(
new TrkSelTool(
"IPSignificanceTrackSelection"));
138 CHECK( selToolMap[
"IPSignificance"]->
setProperty(
"maxD0overSigmaD0", 3.0 ) );
139 CHECK( selToolMap[
"IPSignificance"]->
setProperty(
"maxZ0SinThetaoverSigmaZ0SinTheta", 3.0 ) );
141 histFamilyMap[
"IPSignificance"] = unique_ptr<HistFamily>(
new HistFamily(
"IPSignificance"));
142
143
145
146
148
149
151 CHECK(
static_cast<StatusCode
>(
event.retrieve( tracks,
"InDetTrackParticles" )) );
152
154 CHECK(
static_cast<StatusCode
>(
event.retrieve( vertices,
"PrimaryVertices" )) );
155 const auto it_pv = std::find_if(vertices->
cbegin(), vertices->
cend(),
157 {return vtx->vertexType() == xAOD::VxType::PriVtx;});
158 const xAOD::Vertex* primaryVertex = (it_pv == vertices->
cend()) ? nullptr : *it_pv;
159 if (primaryVertex ==
nullptr) Warning(
APP_NAME,
"No primary vertex found." );
160
162 if (track == nullptr) {
164 continue;
165 }
166 for (const auto& cut : cutNames) {
167 if (selToolMap[cut]->
accept(*track, primaryVertex)) histFamilyMap[
cut]->fill(*track, primaryVertex);
168 }
169 for (const auto& cut : otherCutNames) {
170 if (selToolMap[cut]->
accept(*track, primaryVertex)) histFamilyMap[
cut]->fill(*track, primaryVertex);
171 }
172
173 }
174
175 }
176
177 for (
const auto& selTool : selToolMap)
CHECK( selTool.second->finalize() );
178
179
181
182
183 return 0;
184}
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
const_iterator cbegin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const_iterator cend() const noexcept
Return a const_iterator pointing past the end of the collection.
Tool for accessing xAOD files outside of Athena.
@ kClassAccess
Access auxiliary data using the aux containers.
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
StatusCode accept(const xAOD::Muon *mu)
outFile
Comment Out Those You do not wish to run.
Error
The different types of error that can be flagged in the L1TopoRDO.
std::string getenv(const std::string &variableName)
get an environment variable
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
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".