|
ATLAS Offline Software
|
Go to the documentation of this file.
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)) {
94 if (prim->type() == xAOD::Type::ObjectType::Muon)
96 else if (prim->type() == xAOD::Type::ObjectType::Electron)
98 else if (prim->type() == xAOD::Type::ObjectType::Photon)
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()) {
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;
145 return StatusCode::FAILURE;
148 if (!passSelection(ctx,
p))
continue;
150 TrackSet part_trks = m_closeByCorrTool->getTrackCandidates(ctx,
p);
151 tracks.insert(part_trks.begin(), part_trks.end());
153 return StatusCode::SUCCESS;
156 bool IsoCloseByCorrectionTrkSelAlg::passSelection(
const EventContext& ctx,
const xAOD::Electron* elec)
const {
157 if (!m_elecSelKey.empty()) {
159 if (!decor(*elec))
return false;
161 return elec->
pt() >= m_minElecPt && (m_elecSelTool.empty() || m_elecSelTool->accept(ctx, elec));
163 bool IsoCloseByCorrectionTrkSelAlg::passSelection(
const EventContext& ctx,
const xAOD::Photon* phot)
const {
164 if (!m_photSelKey.empty()) {
166 if (!decor(*phot))
return false;
168 return phot->
pt() >= m_minPhotPt && (m_photSelTool.empty() || m_photSelTool->accept(phot));
170 bool IsoCloseByCorrectionTrkSelAlg::passSelection(
const EventContext& ctx,
const xAOD::Muon*
muon)
const {
171 if (!m_photSelKey.empty()) {
173 if (!decor(*
muon))
return false;
175 return muon->pt() >= m_minMuonPt && (m_muonSelTool.empty() || m_muonSelTool->accept(*
muon));
StatusCode finalize() override
ToolHandle< IAsgPhotonIsEMSelector > m_photSelTool
SG::ReadHandleKey< xAOD::PhotonContainer > m_photKey
ToolHandle< CP::IIsolationCloseByCorrectionTool > m_closeByCorrTool
These tools shall be configured to pick up the same Inner detector tracks as for the isolation buildi...
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Handle for requesting thinning for a data object.
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_elecSelKey
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_thinKey
std::set< TrackPtr > TrackSet
std::atomic< Long64_t > m_tot_trks
Total track counter.
Small helper struct to have sets of particle pointers sorted by pt.
Gaudi::Property< std::string > m_stream
Output stream to be used for the thinning decision.
const std::string & key() const
Return the StoreGate ID for the referenced object.
Property holding a SG store/key/clid from which a ReadHandle is made.
bool empty() const
Test if the key is blank.
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
ToolHandle< CP::IMuonSelectionTool > m_muonSelTool
Optionally the user can also parse the elec / muon / photon selection tools.
Handle for requesting thinning for a data object.
ToolHandle< IAsgElectronLikelihoodTool > m_elecSelTool
StatusCode initialize() override
An algorithm that can be simultaneously executed in multiple threads.
std::set< const xAOD::IParticle * > LepContainer
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Handle class for recording to StoreGate.
SG::ReadHandleKey< xAOD::MuonContainer > m_muonKey
Input containers to retrieve from the storegate.
Handle class for reading a decoration on an object.
StatusCode execute(const EventContext &ctx) const override
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
::StatusCode StatusCode
StatusCode definition for legacy code.
Handle class for adding a decoration to an object.
Out copy_if(In first, const In &last, Out res, const Pred &p)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
IsoCloseByCorrectionTrkSelAlg(const std::string &name, ISvcLocator *svcLoc)
StatusCode loadTracks(const EventContext &ctx, const SG::ReadHandleKey< CONT_TYPE > &key, TrackSet &tracks, LepContainer &prim_objs) const
SG::WriteHandleKey< ConstDataVector< xAOD::TrackParticleContainer > > m_trkKey
Optionally the user can also dump a TrackParticleContainer containing all the tracks entring the cone...
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_photSelKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_elecKey
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Handle class for reading a decoration on an object.
Class describing a TrackParticle.
Handle class for reading from StoreGate.
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_mounSelKey
The keys serve to declare the data dependency on the optional selection decorator properly.
Gaudi::Property< std::string > m_selDecoration
External selection criteria.
Gaudi::Property< float > m_maxConeSize
SortedObjPtr< xAOD::TrackParticle > TrackPtr