42 ATH_MSG_ERROR(
"TauContainerName and HitsHandleKey must be provided to read hits for the GNN evaluation");
43 return StatusCode::FAILURE;
52 ATH_MSG_ERROR(
"Cannot load both prong-inclusive and prong-dependent networks!");
53 return StatusCode::FAILURE;
66 if(!
m_net_0p)
return StatusCode::FAILURE;
71 if(!
m_net_1p)
return StatusCode::FAILURE;
77 if(!
m_net_2p)
return StatusCode::FAILURE;
82 if(!
m_net_3p)
return StatusCode::FAILURE;
85 return StatusCode::SUCCESS;
90 if(network_file.empty())
return nullptr;
92 const std::string pr_network_file =
find_file(network_file);
93 if(pr_network_file.empty()) {
94 ATH_MSG_ERROR(
"Could not find network weights: " << network_file);
98 ATH_MSG_INFO(
"Using network config: " << pr_network_file);
102 config.nnFile = pr_network_file;
118 std::unique_ptr<TauGNN> net = std::make_unique<TauGNN>(config);
130 output(tau) = -1111.0f;
131 out_ptau(tau) = -1111.0f;
132 out_pjet(tau) = -1111.0f;
136 return StatusCode::SUCCESS;
141 if (tau.
nTracks()>5)
return StatusCode::SUCCESS;
146 if (tau.
nTracks()!=1 && tau.
nTracks()!=3)
return StatusCode::SUCCESS;
150 std::map<std::string, float> out_f;
151 std::map<std::string, std::vector<char>> out_vc;
152 std::map<std::string, std::vector<float>> out_vf;
166 n_tracks = std::count_if(trks.begin(), trks.end(),
171 if(n_tracks == 0 &&
m_net_0p) std::tie(out_f, out_vc, out_vf) =
m_net_0p->compute(tau);
172 else if(n_tracks == 1) std::tie(out_f, out_vc, out_vf) =
m_net_1p->compute(tau);
173 else if(n_tracks == 2) {
175 else std::tie(out_f, out_vc, out_vf) =
m_net_3p->compute(tau);
176 }
else if(n_tracks == 3) std::tie(out_f, out_vc, out_vf) =
m_net_3p->compute(tau);
191 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Helper class to provide type-safe access to aux data.
Gaudi::Property< std::string > m_weightfile_inclusive
TauGNNEvaluator(const std::string &name="TauGNNEvaluator")
Gaudi::Property< int > m_max_tracks
Gaudi::Property< std::string > m_input_layer_hits
std::unique_ptr< TauGNN > m_net_1p
Gaudi::Property< std::string > m_input_layer_scalar
std::string m_hits_decor_name
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_scoreHandleKey
virtual ~TauGNNEvaluator()
Gaudi::Property< float > m_max_cluster_dr
std::unique_ptr< TauGNN > m_net_3p
Gaudi::Property< float > m_minTauPt
std::unique_ptr< TauGNN > load_network(const std::string &network_file) const
Gaudi::Property< int > m_output_discriminant
Gaudi::Property< std::string > m_input_layer_clusters
Gaudi::Property< int > m_max_clusters
Gaudi::Property< float > m_min_prong_track_pt
Gaudi::Property< std::string > m_outnode_tau
std::unique_ptr< TauGNN > m_net_0p
Gaudi::Property< std::string > m_tauContainerName
Gaudi::Property< bool > m_doVertexCorrection
Gaudi::Property< int > m_max_hits
Gaudi::Property< bool > m_applyTightTrackSel
Gaudi::Property< std::string > m_output_varname
Gaudi::Property< std::string > m_output_pjet
Gaudi::Property< bool > m_useTRT
std::unique_ptr< TauGNN > m_net_inclusive
std::unique_ptr< TauGNN > m_net_2p
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_pJetHandleKey
Gaudi::Property< bool > m_doTrackClassification
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_pTauHandleKey
Gaudi::Property< std::string > m_outnode_jet
Gaudi::Property< std::string > m_output_ptau
Gaudi::Property< std::string > m_weightfile_1p
Gaudi::Property< std::string > m_weightfile_3p
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_hitsHandleKey
virtual StatusCode execute(xAOD::TauJet &tau) const override
Execute - called for each tau candidate.
Gaudi::Property< bool > m_applyLooseTrackSel
virtual StatusCode initialize() override
Tool initializer.
Gaudi::Property< std::string > m_weightfile_2p
Gaudi::Property< std::string > m_input_layer_tracks
Gaudi::Property< std::string > m_weightfile_0p
virtual double pt() const
The transverse momentum ( ) of the particle.
size_t nTracksCharged() const
std::vector< const TauTrack * > allTracks() const
Get the v<const pointer> to all tracks associated with this tau, regardless of classification.
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
TauTrack_v1 TauTrack
Definition of the current version.
TauJet_v3 TauJet
Definition of the current "tau version".