35 const std::vector<std::unique_ptr<IsolationWP>>& WPs) :
39 for (
const std::unique_ptr<IsolationWP>& W : WPs) {
40 for (
const auto&
C : W->conditions()) {
41 for (
unsigned int t = 0; t <
C->num_types(); ++t) {
44 return known.Accessor->isotype() == iso_type;
65 branch.Accessor = std::make_unique<IsoVariableHelper>(branch.Accessor->isotype(), prefix);
71 Error(
"IsoCorrectionTestHelper::Fill()",
"No particles given");
72 return StatusCode::FAILURE;
84 if (!
FillIsolationBranches(
object, branch.Accessor, branch.original_cones, branch.corrected_cones).isSuccess()) {
85 Error(
"IsoCorrectionTestHelper()",
"Failed to fill isolation");
86 return StatusCode::FAILURE;
89 if (
m_acc_passDefault != std::nullopt && !(*m_acc_passDefault).isAvailable(*
object)) {
90 Error(
"IsoCorrectionTestHelper()",
"It has not been stored whether the particle passes the default isolation");
91 return StatusCode::FAILURE;
96 Error(
"IsoCorrectionTestHelper()",
"It has not been stored whether the particle passes the corrected isolation.");
97 return StatusCode::FAILURE;
108 assoc_track = mu->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
110 assoc_cluster = mu->cluster();
114 return xAOD::P4Helpers::deltaR2(a, mu) < xAOD::P4Helpers::deltaR2(b, mu);
120 assoc_cluster = el->caloCluster(0);
125 return xAOD::P4Helpers::deltaR2(a, object) < xAOD::P4Helpers::deltaR2(b, object);
134 }
else if (assoc_cluster) {
147 }
else if (assoc_flow) {
157 return StatusCode::SUCCESS;
164 return acc_charge(*
P);
169 if (!Acc)
return StatusCode::SUCCESS;
171 if (Acc->getOriginalIsolation(
P, IsoValue).code() !=
CorrectionCode::Ok)
return StatusCode::FAILURE;
173 if (Acc->getIsolation(
P, IsoValue).code() !=
CorrectionCode::Ok)
return StatusCode::FAILURE;
175 return StatusCode::SUCCESS;
@ Ok
The correction was done successfully.
MuonVal::VectorBranch< float > & m_assoc_track_pt
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
MuonVal::VectorBranch< bool > & m_orig_passIso
IsoCorrectionTestHelper(MuonVal::MuonTesterTree &outTree, const std::string &ContainerName, const std::vector< std::unique_ptr< IsolationWP > > &WP)
MuonVal::VectorBranch< float > & m_assoc_pflow_phi
MuonVal::VectorBranch< float > & m_assoc_cluster_phi
bool fill(const EventContext &ctx) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
MuonVal::VectorBranch< float > & m_e
void SetIsolationDecorator(const std::string &acc)
Pipe the name of te decorator encoding whether the object already passed the vanilla isolation.
void SetClusters(const ClusterSet &clusters)
set the list of all clusters from the Cluster container matched by the IsolationCloseByCorrectionTool...
MuonVal::VectorBranch< float > & m_assoc_pflow_eta
MuonVal::VectorBranch< int > & m_Q
MuonVal::VectorBranch< float > & m_assoc_cluster_eta
MuonVal::VectorBranch< float > & m_pt
std::optional< CharAccessor > m_acc_used_for_corr
void SetFlowElements(const PflowSet &flows)
MuonVal::VectorBranch< bool > & m_corr_passIso
MuonVal::VectorBranch< float > & m_phi
StatusCode FillIsolationBranches(const xAOD::IParticle *P, const IsoHelperPtr &Acc, MuonVal::VectorBranch< float > &Original, MuonVal::VectorBranch< float > &Corrected)
StatusCode Fill(const xAOD::IParticleContainer *Particles)
MuonVal::VectorBranch< float > & m_assoc_cluster_et
void SetUpdatedIsoDecorator(const std::string &acc)
Pipe the name of te decorator encoding whether the object already passed the corrected isolation.
std::optional< CharAccessor > m_acc_passCorrected
MuonVal::VectorBranch< float > & m_eta
std::optional< CharAccessor > m_acc_passDefault
void SetSelectionDecorator(const std::string &acc)
Pipe the name of the decorator selecting the objects dumped to the TTree.
float Charge(const xAOD::IParticle *P) const
std::vector< IsolationBranches > m_iso_branches
MuonVal::VectorBranch< float > & m_assoc_pflow_et
void SetBackupPreFix(const std::string &prefix)
Specify whether the vanilla isolation variable is backuped to another set of decorators.
MuonTesterBranch(MuonTesterTree &tree, const std::string &br_name)
void push_back(const T &value)
Adds a new element at the end of the vector.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual double phi() const override
The azimuthal angle ( ) of the particle.
virtual double eta() const override
The pseudorapidity ( ) of the particle.
virtual double e() const override
The total energy of the particle.
Class providing the definition of the 4-vector interface.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
bool add(const std::string &hname, TKey *tobj)
Select isolated Photons, Electrons and Muons.
std::unique_ptr< IsoVariableHelper > IsoHelperPtr
SG::AuxElement::ConstAccessor< char > CharAccessor
static const FloatAccessor acc_assocClustPhi
xAOD::Iso::IsolationType IsoType
static const FloatAccessor acc_assocClustEta
std::set< FlowElementPtr > PflowSet
static const CharAccessor acc_assocPflowIsDec
static const FloatAccessor acc_assocPflowEta
SG::AuxElement::ConstAccessor< float > FloatAccessor
static const CharAccessor acc_assocCaloIsDec
static const FloatAccessor acc_assocPflowPhi
static const FloatAccessor acc_assocClustEne
static const FloatAccessor acc_assocPflowEne
std::set< CaloClusterPtr > ClusterSet
SortedObjPtr< xAOD::CaloCluster > CaloClusterPtr
@ Muon
The object is a muon.
@ Electron
The object is an electron.
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:
Muon_v1 Muon
Reference the current persistent version:
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
Electron_v1 Electron
Definition of the current "egamma version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
For the flow elements we need a special derivate which also contains the weights.