ATLAS Offline Software
PFSubtractionTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PFSUBTRACTIONTOOL_H
6 #define PFSUBTRACTIONTOOL_H
7 
9 #include "GaudiKernel/ToolHandle.h"
10 
12 #include "eflowRec/EtaPhiLUT.h"
14 #include "eflowRec/PFData.h"
24 
30 
31 class PFSubtractionTool : public extends<AthAlgTool, IPFSubtractionTool>
32 {
33 
34 public:
35  PFSubtractionTool(const std::string &type, const std::string &name, const IInterface *parent);
37 
39  void execute(eflowCaloObjectContainer *theEflowCaloObjectContainer, eflowRecTrackContainer *recTrackContainer, eflowRecClusterContainer *recClusterContainer) const;
41 
42 private:
43 
45  unsigned int matchAndCreateEflowCaloObj(PFData &data) const;
46 
47  void performSubtraction(const unsigned int& startingPoint,PFData &data) const;
48  void performSubtraction(eflowCaloObject& thisEflowCaloObject) const;
49  void performTruthSubtraction(PFData &data) const;
50  void performTruthSubtraction(eflowCaloObject& thisEflowCaloObject) const;
51 
52  bool isEOverPFail(double expectedEnergy, double sigma, double clusterEnergy) const;
53 
54  bool canAnnihilate(double expectedEnergy, double sigma, double clusterEnergy) const;
55 
56  static std::string printTrack(const xAOD::TrackParticle* track);
57  static std::string printCluster(const xAOD::CaloCluster* cluster);
58  void printAllClusters(const eflowRecClusterContainer& recClusterContainer) const;
59 
60  void addSubtractedCells(eflowCaloObject& thisEflowCaloObject, const std::vector<std::pair<xAOD::CaloCluster *, bool> >& clusterList) const;
61 
63  ToolHandle<IEFlowCellEOverPTool> m_theEOverPTool{this, "eflowCellEOverPTool", "eflowCellEOverPTool", "Energy Flow E/P Values and Shower Parameters Tool"};
64 
65  std::unique_ptr<eflowEEtaBinnedParameters> m_binnedParameters;
66 
68  std::unique_ptr<PFMatch::TrackEtaPhiInFixedLayersProvider> m_trkpos;
69 
71  ToolHandle<PFTrackClusterMatchingTool> m_theMatchingTool{this, "PFTrackClusterMatchingTool", "PFTrackClusterMatchingTool/CalObjBldMatchingTool", "The track-cluster matching tool"};
72 
73  /* Track-cluster matching tools for calculating the pull */
74  ToolHandle<PFTrackClusterMatchingTool> m_theMatchingToolForPull_015{this, "PFTrackClusterMatchingTool_015", "PFTrackClusterMatchingTool/PFPullMatchingTool_015", "The 0.15 track-cluster matching tool to calculate the pull"};
75  ToolHandle<PFTrackClusterMatchingTool> m_theMatchingToolForPull_02{this, "PFTrackClusterMatchingTool_02", "PFTrackClusterMatchingTool/PFPullMatchingTool_02", "The 0.2 track-cluster matching tool to calculate the pull"};
76 
78  Gaudi::Property<bool> m_recoverSplitShowers{this,"RecoverSplitShowers",false,"Toggle whether we are recovering split showers or not"};
79 
81  Gaudi::Property<int> m_nClusterMatchesToUse{this, "nClusterMatchesToUse", 1, "Number of clusters to match to each track"};
82 
84  Gaudi::Property<bool> m_isHLLHC{this, "isHLLHC", false, "Toggle whether we have the HLLHC setup"};
85 
87  Gaudi::Property<bool> m_calcEOverP{this, "CalcEOverP", false, "Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed"};
88 
90  Gaudi::Property<double> m_consistencySigmaCut{this, "ConsistencySigmaCut", 1.0, "Parameter that controls whether a track, in a track-cluster system, will be processed by the split shower recovery algorithm"};
91 
93  Gaudi::Property<double> m_subtractionSigmaCut{this, "SubtractionSigmaCut", 1.5, "Parameter that controls whether to use retain remaining calorimeter energy in track-cluster system, after charged shower subtraction"};
94 
96  Gaudi::Property<bool> m_addCPData{this,"addCPData",false,"Toggle whether to decorate FlowElements with addutional data for Combined Performance studies "};
97 
98  //Helpers
102 
104  ToolHandle<PFEnergyPredictorTool> m_NNEnergyPredictorTool{this, "NNEnergyPredictorTool", "","Tool for getting predictiing the energy using an ONNX model "};
105 
107  Gaudi::Property<bool> m_useNNEnergy{this, "useNNEnergy", false, "Toggle whether we use the neural net energy"};
108 
109  //Only turn this on for MC samples without pileup that have calibration hits avaialble
111  Gaudi::Property<bool> m_useTruthMatching{this, "useTrackClusterTruthMatching", false, "Toggle whether to cheat and use truth information for track-cluster matching"};
112 
114  Gaudi::Property<bool> m_useTruthForChargedShowerSubtraction{this, "useTruthForChargedShowerSubtraction", false, "Toggle whether we use truth information for the charged shower subtraction or not"};
115 
117  Gaudi::Property<bool> m_useFullCellTruthSubtraction{this,"useFullCellTruthSubtraction",true,"Toggle whether we fully remove a cell with a truth deposit or reweight it based on truth contribution"};
118 
119  ToolHandle<PFSimulateTruthShowerTool> m_theTruthShowerSimulator{this, "PFSimulateTruthShowerTool", "", "The truth shower simulator"};
120 
123 
129  Gaudi::Property<bool> m_useLegacyEBinIndex{this, "useLegacyEBinIndex", true, "Toggle whether we use the legacy energy bin index"};
130 
131 };
132 
133 #endif
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
PFSubtractionTool::performTruthSubtraction
void performTruthSubtraction(PFData &data) const
Definition: PFSubtractionTool.cxx:489
eflowEEtaBinnedParameters
Inherits from eflowEEtaBinBase.
Definition: eflowEEtaBinnedParameters.h:56
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
IPFSubtractionTool.h
PFSubtractionTool::m_isHLLHC
Gaudi::Property< bool > m_isHLLHC
Toggle whether we have the HLLHC setup.
Definition: PFSubtractionTool.h:84
PFSubtractionTool::m_useTruthMatching
Gaudi::Property< bool > m_useTruthMatching
Toggle whether to cheat and use truth information for track-cluster matching - only for performance s...
Definition: PFSubtractionTool.h:111
PFSubtractionTool::m_subtractor
eflowSubtract::Subtractor m_subtractor
Definition: PFSubtractionTool.h:101
PFData.h
PFSubtractionTool::m_NNEnergyPredictorTool
ToolHandle< PFEnergyPredictorTool > m_NNEnergyPredictorTool
Tool for getting predictiing the energy using an ONNX model.
Definition: PFSubtractionTool.h:104
IEFlowCellEOverPTool
Pure virtual base class, from which concrete classes inherit and define reference e/p mean and widths...
Definition: IEFlowCellEOverPTool.h:30
eflowRecClusterContainer
Definition: eflowRecCluster.h:275
eflowSubtractor.h
PFSubtractionTool::m_consistencySigmaCut
Gaudi::Property< double > m_consistencySigmaCut
Parameter that controls whether a track, in a track-cluster system, will be processed by the split sh...
Definition: PFSubtractionTool.h:90
PFSubtractionTool::m_useTruthForChargedShowerSubtraction
Gaudi::Property< bool > m_useTruthForChargedShowerSubtraction
Toggle whether we use truth information for the charged shower subtraction or not.
Definition: PFSubtractionTool.h:114
PFSubtractionTool::m_trkpos
std::unique_ptr< PFMatch::TrackEtaPhiInFixedLayersProvider > m_trkpos
Track position provider to be used to preselect clusters.
Definition: PFSubtractionTool.h:68
PFSubtractionTool::matchAndCreateEflowCaloObj
unsigned int matchAndCreateEflowCaloObj(PFData &data) const
This matches ID tracks and CaloClusters, and then creates eflowCaloObjects.
Definition: PFSubtractionTool.cxx:98
eflowCaloObject
An internal EDM object which stores information about systems of associated tracks and calorimeter cl...
Definition: eflowCaloObject.h:34
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
PFSubtractionStatusSetter
This class contains a few functions to set the amount of energy removed from a xAOD::CaloCluster by a...
Definition: PFSubtractionStatusSetter.h:20
PFSubtractionTool::m_pfSubtractionStatusSetter
PFSubtractionStatusSetter m_pfSubtractionStatusSetter
Definition: PFSubtractionTool.h:99
PFSubtractionTool::m_theEOverPTool
ToolHandle< IEFlowCellEOverPTool > m_theEOverPTool
Tool for getting e/p values and hadronic shower cell ordering principle parameters.
Definition: PFSubtractionTool.h:63
PFSubtractionTool::m_useNNEnergy
Gaudi::Property< bool > m_useNNEnergy
Toggle whether we use the neural net energy.
Definition: PFSubtractionTool.h:107
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:62
PFSubtractionTool::execute
void execute(eflowCaloObjectContainer *theEflowCaloObjectContainer, eflowRecTrackContainer *recTrackContainer, eflowRecClusterContainer *recClusterContainer) const
Definition: PFSubtractionTool.cxx:66
PFSubtractionTool::m_nClusterMatchesToUse
Gaudi::Property< int > m_nClusterMatchesToUse
Number of clusters to match to each track if not doing recover split shower subtraction.
Definition: PFSubtractionTool.h:81
PFSubtractionTool::printAllClusters
void printAllClusters(const eflowRecClusterContainer &recClusterContainer) const
Definition: PFSubtractionTool.cxx:589
PFSubtractionTool::isEOverPFail
bool isEOverPFail(double expectedEnergy, double sigma, double clusterEnergy) const
Definition: PFSubtractionTool.cxx:566
CaloCluster.h
PFSubtractionTool::performSubtraction
void performSubtraction(const unsigned int &startingPoint, PFData &data) const
Definition: PFSubtractionTool.cxx:280
PFSubtractionStatusSetter.h
eflowSubtract::Subtractor
Used in eflowCellLevelSubtractionTool and eflowRecoverSplitShowersTool to perform the removal of calo...
Definition: eflowSubtractor.h:35
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PFSubtractionTool::initialize
StatusCode initialize()
Definition: PFSubtractionTool.cxx:31
PFSubtractionTool::PFSubtractionTool
PFSubtractionTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: PFSubtractionTool.cxx:23
PFSubtractionTool::m_theMatchingToolForPull_02
ToolHandle< PFTrackClusterMatchingTool > m_theMatchingToolForPull_02
Definition: PFSubtractionTool.h:75
PFTrackClusterMatchingTool.h
AthAlgTool.h
PFSubtractionTool::m_calcEOverP
Gaudi::Property< bool > m_calcEOverP
Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed.
Definition: PFSubtractionTool.h:87
test_pyathena.parent
parent
Definition: test_pyathena.py:15
PFSubtractionTool::~PFSubtractionTool
~PFSubtractionTool()
PFEnergyPredictorTool.h
PFData
Definition: PFData.h:11
PFSubtractionTool
Definition: PFSubtractionTool.h:32
PFSubtractionTool::m_pfSubtractionEnergyRatioCalculator
PFSubtractionEnergyRatioCalculator m_pfSubtractionEnergyRatioCalculator
Definition: PFSubtractionTool.h:100
PFSubtractionTool::m_recoverSplitShowers
Gaudi::Property< bool > m_recoverSplitShowers
Toggle whether we are recovering split showers or not.
Definition: PFSubtractionTool.h:78
PFSubtractionTool::m_useLegacyEBinIndex
Gaudi::Property< bool > m_useLegacyEBinIndex
Further discussion about why this flag exists can be found in https://its.cern.ch/jira/browse/ATLJETM...
Definition: PFSubtractionTool.h:129
PFSubtractionTool::printTrack
static std::string printTrack(const xAOD::TrackParticle *track)
Definition: PFSubtractionTool.cxx:577
EtaPhiLUT.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
PFSubtractionTool::m_caloClusterReadDecorHandleKeyNLeadingTruthParticles
SG::ReadDecorHandleKey< xAOD::CaloClusterContainer > m_caloClusterReadDecorHandleKeyNLeadingTruthParticles
Read handle key to decorate CaloCluster with threeN leading truth particle uniqueID and energy.
Definition: PFSubtractionTool.h:122
eflowCaloObject.h
PFSubtractionTool::addSubtractedCells
void addSubtractedCells(eflowCaloObject &thisEflowCaloObject, const std::vector< std::pair< xAOD::CaloCluster *, bool > > &clusterList) const
Definition: PFSubtractionTool.cxx:604
PFSubtractionTool::m_subtractionSigmaCut
Gaudi::Property< double > m_subtractionSigmaCut
Parameter that controls whether to use retain remaining calorimeter energy in track-cluster system,...
Definition: PFSubtractionTool.h:93
PFSubtractionTool::canAnnihilate
bool canAnnihilate(double expectedEnergy, double sigma, double clusterEnergy) const
Definition: PFSubtractionTool.cxx:572
PFSubtractionTool::m_useFullCellTruthSubtraction
Gaudi::Property< bool > m_useFullCellTruthSubtraction
Toggle whether we fully remove a cell with a truth deposit or reweight it based on truth contribution...
Definition: PFSubtractionTool.h:117
eflowRecTrackContainer
Definition: eflowRecTrack.h:191
TrackParticle.h
PFSubtractionTool::m_theMatchingTool
ToolHandle< PFTrackClusterMatchingTool > m_theMatchingTool
Default track-cluster matching tool.
Definition: PFSubtractionTool.h:71
PFSubtractionTool::printCluster
static std::string printCluster(const xAOD::CaloCluster *cluster)
Definition: PFSubtractionTool.cxx:583
PFSubtractionEnergyRatioCalculator
Class to calculate the ratio of new to old energies of CaloClusters after the particle flow charged s...
Definition: PFSubtractionEnergyRatioCalculator.h:20
PFSubtractionTool::m_theTruthShowerSimulator
ToolHandle< PFSimulateTruthShowerTool > m_theTruthShowerSimulator
Definition: PFSubtractionTool.h:119
PFMatchPositions.h
PFSubtractionEnergyRatioCalculator.h
PFSubtractionTool::m_binnedParameters
std::unique_ptr< eflowEEtaBinnedParameters > m_binnedParameters
Definition: PFSubtractionTool.h:65
PFSubtractionTool::m_theMatchingToolForPull_015
ToolHandle< PFTrackClusterMatchingTool > m_theMatchingToolForPull_015
Definition: PFSubtractionTool.h:74
PFSubtractionTool::finalize
StatusCode finalize()
Definition: PFSubtractionTool.cxx:620
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:44
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
eflowCaloObjectContainer
Definition: eflowCaloObject.h:101
PFSubtractionTool::m_addCPData
Gaudi::Property< bool > m_addCPData
Toggle whether to decorate eflowRecTrack with addutional data for Combined Performance studies.
Definition: PFSubtractionTool.h:96
PFSimulateTruthShowerTool.h