ATLAS Offline Software
EGCrackVetoCleaningTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // EGCrackVetoCleaningTool.cxx, (c) ATLAS Detector software
8 //
9 
12 
13 namespace DerivationFramework {
14 
16  const std::string& n,
17  const IInterface* p)
18  : AthAlgTool(t, n, p)
19  , m_sgName("")
20 {
21  declareInterface<DerivationFramework::IAugmentationTool>(this);
22  declareProperty("StoreGateEntryName", m_sgName);
23 }
24 
27 {
28  if (m_sgName.empty()) {
30  "No SG name provided for the output of EGCrackVetoCleaningTool!");
31  return StatusCode::FAILURE;
32  }
33  ATH_CHECK(m_containerName.initialize());
35  ATH_CHECK(m_decoratorPass.initialize());
36  return StatusCode::SUCCESS;
37 }
38 
41 {
42 
43  // retrieve container
44  const EventContext& ctx = Gaudi::Hive::currentContext();
47  m_decoratorPass, ctx);
48 
49  // Write mask for each element and record to SG for subsequent selection
50  for (const xAOD::Egamma* eg : *particles) {
51  const xAOD::CaloCluster* clu = eg->caloCluster();
52  bool maybeBug = clu->hasSampling(CaloSampling::EMB2) &&
54  const std::vector<const xAOD::CaloCluster*> assocC =
56  double dRsatMax = -1.;
57  if (assocC.size() > 1) {
58  for (const xAOD::CaloCluster* sclu : assocC) {
59  // sometimes sclu can be 0 if the topocluster has been thinned away
60  if (not sclu) continue;
61  double dR = clu->p4().DeltaR(sclu->p4());
62  if (dR > dRsatMax)
63  dRsatMax = dR;
64  }
65  }
66  decoratorPass(*eg) = !maybeBug || assocC.size() <= 1 ||
67  dRsatMax <= 0.16; // (or dPhi > 0.15 better ?)
68  }
69 
70  return StatusCode::SUCCESS;
71 }
72 } // end namespace Derivation
DerivationFramework::EGCrackVetoCleaningTool::EGCrackVetoCleaningTool
EGCrackVetoCleaningTool(const std::string &t, const std::string &n, const IInterface *p)
Definition: EGCrackVetoCleaningTool.cxx:15
xAOD::EgammaHelpers::getAssociatedTopoClusters
std::vector< const xAOD::CaloCluster * > getAssociatedTopoClusters(const xAOD::CaloCluster *cluster)
Return a vector of all the topo clusters associated with the egamma cluster.
Definition: EgammaxAODHelpers.cxx:65
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ParticleTest.eg
eg
Definition: ParticleTest.py:29
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::EGCrackVetoCleaningTool::m_decoratorPass
SG::WriteDecorHandleKey< xAOD::EgammaContainer > m_decoratorPass
Definition: EGCrackVetoCleaningTool.h:47
DerivationFramework::EGCrackVetoCleaningTool::addBranches
virtual StatusCode addBranches() const override final
Pass the thinning service
Definition: EGCrackVetoCleaningTool.cxx:40
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
EgammaxAODHelpers.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DerivationFramework::EGCrackVetoCleaningTool::initialize
StatusCode initialize() override final
Definition: EGCrackVetoCleaningTool.cxx:26
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EGCrackVetoCleaningTool.h
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
xAOD::CaloCluster_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: CaloCluster_v1.cxx:465
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
AthAlgTool
Definition: AthAlgTool.h:26
xAOD::CaloCluster_v1::hasSampling
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
Definition: CaloCluster_v1.h:890
DerivationFramework::EGCrackVetoCleaningTool::m_containerName
SG::ReadHandleKey< xAOD::EgammaContainer > m_containerName
Definition: EGCrackVetoCleaningTool.h:39
DerivationFramework::EGCrackVetoCleaningTool::m_sgName
std::string m_sgName
Definition: EGCrackVetoCleaningTool.h:48
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56