52 return StatusCode::SUCCESS;
55 const Long64_t tot_acc = m_accepted_trks[0] + m_accepted_trks[1] + m_accepted_trks[2];
56 ATH_MSG_INFO(
"Accepted " << tot_acc <<
" tracks associated with collimated lepton pairs."
57 <<
" Track association split into particle type");
58 ATH_MSG_INFO(
" --- Muons: " << m_accepted_trks[0] <<
" out of " << m_selected_obj[0] <<
" ("
59 << (m_selected_obj[0] ? 100. * m_accepted_trks[0] / m_selected_obj[0] : 0.) <<
"%).");
60 ATH_MSG_INFO(
" --- Electrons: " << m_accepted_trks[1] <<
" out of " << m_selected_obj[1] <<
" ("
61 << (m_selected_obj[1] ? 100. * m_accepted_trks[1] / m_selected_obj[1] : 0.) <<
"%).");
62 ATH_MSG_INFO(
" --- Photons: " << m_accepted_trks[2] <<
" out of " << m_selected_obj[2] <<
" ("
63 << (m_selected_obj[2] ? 100. * m_accepted_trks[2] / m_selected_obj[2] : 0.) <<
"%).");
66 return StatusCode::SUCCESS;
73 const size_t n_muons = prim_objs.size();
75 const size_t n_elecs = prim_objs.size() - n_muons;
77 const size_t n_phots = prim_objs.size() - n_muons - n_elecs;
78 m_selected_obj[0] += n_muons;
79 m_selected_obj[1] += n_elecs;
80 m_selected_obj[2] += n_phots;
85 std::copy_if(assoc_trks.begin(), assoc_trks.end(), std::inserter(pruned_trks, pruned_trks.begin()),
92 if (assoc_trk.count(
track)) {
107 if (trk_idx != -1)
break;
109 if (ret_code) ++m_accepted_trks[trk_idx];
112 assoc_trks = std::move(pruned_trks);
116 if (!m_trkKey.empty()) {
117 auto tracks = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(
SG::VIEW_ELEMENTS);
118 for (
const TrackPtr& trk : assoc_trks) {
120 tracks->push_back(trk_p);
123 ATH_CHECK(writeHandle.record(std::move(tracks)));
125 if (!m_thinKey.empty()) {
126 SG::ThinningHandle<xAOD::TrackParticleContainer> thinner{m_thinKey, ctx};
127 m_tot_trks += thinner->size();
128 std::vector<bool> thin_dec(thinner->size(),
false);
129 for (
const TrackPtr& trk : assoc_trks) { thin_dec[trk->index()] =
true; }
130 thinner.
keep(thin_dec);
132 return StatusCode::SUCCESS;
135 template <
class CONT_TYPE>
139 ATH_MSG_DEBUG(
"No key has been defined. Assume that the container is disabled ");
140 return StatusCode::SUCCESS;
143 if (!particles.isValid()) {
145 return StatusCode::FAILURE;
147 for (
const auto* p : *particles) {
151 tracks.insert(part_trks.begin(), part_trks.end());
153 return StatusCode::SUCCESS;
159 if (!decor(*elec))
return false;
166 if (!decor(*phot))
return false;
173 if (!decor(*
muon))
return false;
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
Handle class for recording to StoreGate.
Handle for requesting thinning for a data object.
An algorithm that can be simultaneously executed in multiple threads.
StatusCode initialize() override
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_mounSelKey
The keys serve to declare the data dependency on the optional selection decorator properly.
SG::ReadHandleKey< xAOD::PhotonContainer > m_photKey
ToolHandle< CP::IMuonSelectionTool > m_muonSelTool
Optionally the user can also parse the elec / muon / photon selection tools.
SG::WriteHandleKey< ConstDataVector< xAOD::TrackParticleContainer > > m_trkKey
Optionally the user can also dump a TrackParticleContainer containing all the tracks entring the cone...
ToolHandle< IAsgPhotonIsEMSelector > m_photSelTool
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_photSelKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonKey
Input containers to retrieve from the storegate.
ToolHandle< CP::IIsolationCloseByCorrectionTool > m_closeByCorrTool
These tools shall be configured to pick up the same Inner detector tracks as for the isolation buildi...
SG::ReadHandleKey< xAOD::ElectronContainer > m_elecKey
Gaudi::Property< float > m_minElecPt
Kinematic cuts. The selection tools do not support kinematic cut selection unfortunately.
IsoCloseByCorrectionTrkSelAlg(const std::string &name, ISvcLocator *svcLoc)
Gaudi::Property< float > m_minPhotPt
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_thinKey
StatusCode loadTracks(const EventContext &ctx, const SG::ReadHandleKey< CONT_TYPE > &key, TrackSet &tracks, LepContainer &prim_objs) const
std::atomic< Long64_t > m_tot_trks
Total track counter.
ToolHandle< IAsgElectronLikelihoodTool > m_elecSelTool
StatusCode execute(const EventContext &ctx) const override
std::set< const xAOD::IParticle * > LepContainer
bool passSelection(const EventContext &ctx, const xAOD::Electron *elec) const
Gaudi::Property< float > m_minMuonPt
StatusCode finalize() override
Gaudi::Property< float > m_maxConeSize
Gaudi::Property< std::string > m_selDecoration
External selection criteria.
Gaudi::Property< std::string > m_stream
Output stream to be used for the thinning decision.
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_elecSelKey
Handle class for reading a decoration on an object.
Property holding a SG store/key/clid from which a ReadHandle is made.
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
std::set< TrackPtr > TrackSet
SortedObjPtr< xAOD::TrackParticle > TrackPtr
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ Photon
The object is a photon.
@ Muon
The object is a muon.
@ Electron
The object is an electron.
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".