8#include "GaudiKernel/SystemOfUnits.h"
10constexpr float invGeV = 1./CLHEP::GeV;
37 return StatusCode::SUCCESS;
50 ATH_CHECK(eflowRecTracksWriteHandle.
record(std::make_unique<eflowRecTrackContainer>()));
54 if (!tracksReadHandle.
isValid()) {
55 ATH_MSG_WARNING(
"Can not retrieve xAOD::TrackParticleContainer with name: " << tracksReadHandle.
key());
56 return StatusCode::FAILURE;
61 for (
const auto *thisTrack : *tracksReadHandle){
68 ATH_MSG_DEBUG(
"Have track with E, pt, eta and phi of " << thisTrack->e() <<
", " << thisTrack->pt() <<
", "
69 << thisTrack->eta() <<
" and " << thisTrack->phi());
84 eta_track = thisTrack->eta();
85 pt_track = thisTrack->pt() *
invGeV;
86 if(trkcont==
nullptr) {
92 thisEFRecTrack->setTrackId(trackIndex);
93 eflowRecTracksWriteHandle->push_back(std::move(thisEFRecTrack));
103 N_tracks = eflowRecTracksWriteHandle->size();
105 return StatusCode::SUCCESS;
128 if (electronsReadHandle.
isValid()) {
130 for (
const auto* thisElectron : *electronsReadHandle) {
133 unsigned int nTrack = thisElectron->nTrackParticles();
138 if (track == origTrack) {
143 ATH_MSG_WARNING(
"Electron object map has NULL pointer to original TrackParticle");
152 ATH_MSG_WARNING(
"Invalid ReadHandle for electrons with key: " << electronsReadHandle.
key());
165 if (muonsReadHandle.
isValid()) {
167 for (
const auto* theMuon : *muonsReadHandle) {
169 ATH_MSG_DEBUG(
"Considering muon in isMuon with e,pt, eta and phi of "
170 << theMuon->e() <<
", " << theMuon->pt() <<
", " << theMuon->eta() <<
" and " << theMuon->phi());
175 if (track == ID_track){
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
An algorithm that can be simultaneously executed in multiple threads.
ElementLink implementation for ROOT usage.
bool isValid() const
Test to see if the link can be dereferenced.
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
Helper class to create a scoped timer.
bool selectTrack(const xAOD::TrackParticle &track) const
This applys a selection criteria to the track using the tracking CP track selection tool.
SG::WriteHandleKey< eflowRecTrackContainer > m_eflowRecTracksWriteHandleKey
WriteHandleKey for the eflowRecTrackContainer to write out.
bool isMuon(const xAOD::TrackParticle *track) const
check if track belongs to an muon
bool isElectron(const xAOD::TrackParticle *track) const
check if track belongs to an electron
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
PFTrackSelector(const std::string &name, ISvcLocator *pSvcLocator)
Default constructor.
StatusCode initialize()
Gaudi AthAlgorithm hooks.
ToolHandle< eflowTrackExtrapolatorBaseAlgTool > m_theTrackExtrapolatorTool
ToolHandle for track extrapolation to calorimeter tool.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_tracksReadHandleKey
ReadHandleKey for the TrackParticleContainer to be used as input.
StatusCode execute(const EventContext &ctx) const
ToolHandle< InDet::IInDetTrackSelectionTool > m_trackSelectorTool
ToolHandle to track selection tool provided by tracking CP.
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsReadHandleKey
ReadHandleKey for the MuonContainer to be used as input.
ToolHandle< GenericMonitoringTool > m_monTool
Online monitoring tool for recording histograms of the alg in action.
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsReadHandleKey
ReadHandleKey for the ElectronContainer to be used as input.
Gaudi::Property< float > m_upperTrackPtCut
Upper limit on track Pt for input tracks.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
const xAOD::TrackParticle * getOriginalTrackParticle(const xAOD::Electron *el)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the electron.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".