ATLAS Offline Software
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
PFSubtractionTool Class Reference

#include <PFSubtractionTool.h>

Inheritance diagram for PFSubtractionTool:
Collaboration diagram for PFSubtractionTool:

Public Member Functions

 PFSubtractionTool (const std::string &type, const std::string &name, const IInterface *parent)
 
 ~PFSubtractionTool ()
 
StatusCode initialize ()
 
void execute (eflowCaloObjectContainer *theEflowCaloObjectContainer, eflowRecTrackContainer *recTrackContainer, eflowRecClusterContainer *recClusterContainer) const
 
StatusCode finalize ()
 

Private Member Functions

unsigned int matchAndCreateEflowCaloObj (PFData &data) const
 This matches ID tracks and CaloClusters, and then creates eflowCaloObjects. More...
 
void performSubtraction (const unsigned int &startingPoint, PFData &data) const
 
void performSubtraction (eflowCaloObject &thisEflowCaloObject) const
 
void performTruthSubtraction (PFData &data) const
 
void performTruthSubtraction (eflowCaloObject &thisEflowCaloObject) const
 
bool isEOverPFail (double expectedEnergy, double sigma, double clusterEnergy) const
 
bool canAnnihilate (double expectedEnergy, double sigma, double clusterEnergy) const
 
void printAllClusters (const eflowRecClusterContainer &recClusterContainer) const
 
void addSubtractedCells (eflowCaloObject &thisEflowCaloObject, const std::vector< std::pair< xAOD::CaloCluster *, bool > > &clusterList) const
 

Static Private Member Functions

static std::string printTrack (const xAOD::TrackParticle *track)
 
static std::string printCluster (const xAOD::CaloCluster *cluster)
 

Private Attributes

ToolHandle< IEFlowCellEOverPToolm_theEOverPTool {this, "eflowCellEOverPTool", "eflowCellEOverPTool", "Energy Flow E/P Values and Shower Parameters Tool"}
 Tool for getting e/p values and hadronic shower cell ordering principle parameters. More...
 
std::unique_ptr< eflowEEtaBinnedParametersm_binnedParameters
 
std::unique_ptr< PFMatch::TrackEtaPhiInFixedLayersProviderm_trkpos
 Track position provider to be used to preselect clusters. More...
 
ToolHandle< PFTrackClusterMatchingToolm_theMatchingTool {this, "PFTrackClusterMatchingTool", "PFTrackClusterMatchingTool/CalObjBldMatchingTool", "The track-cluster matching tool"}
 Default track-cluster matching tool. More...
 
ToolHandle< PFTrackClusterMatchingToolm_theMatchingToolForPull_015 {this, "PFTrackClusterMatchingTool_015", "PFTrackClusterMatchingTool/PFPullMatchingTool_015", "The 0.15 track-cluster matching tool to calculate the pull"}
 
ToolHandle< PFTrackClusterMatchingToolm_theMatchingToolForPull_02 {this, "PFTrackClusterMatchingTool_02", "PFTrackClusterMatchingTool/PFPullMatchingTool_02", "The 0.2 track-cluster matching tool to calculate the pull"}
 
Gaudi::Property< bool > m_recoverSplitShowers {this,"RecoverSplitShowers",false,"Toggle whether we are recovering split showers or not"}
 Toggle whether we are recovering split showers or not. More...
 
Gaudi::Property< int > m_nClusterMatchesToUse {this, "nClusterMatchesToUse", 1, "Number of clusters to match to each track"}
 Number of clusters to match to each track if not doing recover split shower subtraction. More...
 
Gaudi::Property< bool > m_isHLLHC {this, "isHLLHC", false, "Toggle whether we have the HLLHC setup"}
 Toggle whether we have the HLLHC setup. More...
 
Gaudi::Property< bool > m_calcEOverP {this, "CalcEOverP", false, "Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed"}
 Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed. More...
 
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"}
 Parameter that controls whether a track, in a track-cluster system, will be processed by the split shower recovery algorithm. More...
 
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"}
 Parameter that controls whether to use retain remaining calorimeter energy in track-cluster system, after charged shower subtraction. More...
 
Gaudi::Property< bool > m_addCPData {this,"addCPData",false,"Toggle whether to decorate FlowElements with addutional data for Combined Performance studies "}
 Toggle whether to decorate eflowRecTrack with addutional data for Combined Performance studies. More...
 
PFCalcRadialEnergyProfiles m_pfCalc {}
 
PFSubtractionStatusSetter m_pfSubtractionStatusSetter {}
 
PFSubtractionEnergyRatioCalculator m_pfSubtractionEnergyRatioCalculator {}
 
eflowSubtract::Subtractor m_subtractor {}
 
ToolHandle< PFEnergyPredictorToolm_NNEnergyPredictorTool {this, "NNEnergyPredictorTool", "","Tool for getting predictiing the energy using an ONNX model "}
 Tool for getting predictiing the energy using an ONNX model. More...
 
Gaudi::Property< bool > m_useNNEnergy {this, "useNNEnergy", false, "Toggle whether we use the neural net energy"}
 Toggle whether we use the neural net energy. More...
 
Gaudi::Property< bool > m_useTruthMatching {this, "useTrackClusterTruthMatching", false, "Toggle whether to cheat and use truth information for track-cluster matching"}
 Toggle whether to cheat and use truth information for track-cluster matching - only for performance studies! More...
 
Gaudi::Property< bool > m_useTruthForChargedShowerSubtraction {this, "useTruthForChargedShowerSubtraction", false, "Toggle whether we use truth information for the charged shower subtraction or not"}
 Toggle whether we use truth information for the charged shower subtraction or not. More...
 
Gaudi::Property< bool > m_useFullCellTruthSubtraction {this,"useFullCellTruthSubtraction",false,"Toggle whether we fully remove a cell with a truth deposit or reweight it based on truth contribution"}
 Toggle whether we fully remove a cell with a truth deposit or reweight it based on truth contribution. More...
 
ToolHandle< PFSimulateTruthShowerToolm_theTruthShowerSimulator {this, "PFSimulateTruthShowerTool", "", "The truth shower simulator"}
 
SG::ReadDecorHandleKey< xAOD::CaloClusterContainerm_caloClusterReadDecorHandleKeyNLeadingTruthParticles {this,"CaloClusterReadDecorHandleKey_NLeadingTruthParticles",""}
 Read handle key to decorate CaloCluster with threeN leading truth particle barcode and energy. More...
 
Gaudi::Property< bool > m_useLegacyEBinIndex {this, "useLegacyEBinIndex", true, "Toggle whether we use the legacy energy bin index"}
 Further discussion about why this flag exists can be found in https://its.cern.ch/jira/browse/ATLJETMET-1692 and https://indico.cern.ch/event/1388633/contributions/5837876/attachments/2809591/4903439/PFlow_EOverP_Feb2024.pdf The Jira report discusses assorted problems with the treatment of energy bin indexes for the lookup of e/p values. More...
 

Detailed Description

Definition at line 34 of file PFSubtractionTool.h.

Constructor & Destructor Documentation

◆ PFSubtractionTool()

PFSubtractionTool::PFSubtractionTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 23 of file PFSubtractionTool.cxx.

23  : base_class(type, name, parent),
24  m_binnedParameters(std::make_unique<eflowEEtaBinnedParameters>())
25 {
26 }

◆ ~PFSubtractionTool()

PFSubtractionTool::~PFSubtractionTool ( )
default

Member Function Documentation

◆ addSubtractedCells()

void PFSubtractionTool::addSubtractedCells ( eflowCaloObject thisEflowCaloObject,
const std::vector< std::pair< xAOD::CaloCluster *, bool > > &  clusterList 
) const
private

Definition at line 596 of file PFSubtractionTool.cxx.

596  {
597 
598  unsigned int numTracks = thisEflowCaloObject.nTracks();
599 
600  for (unsigned int iTrack = 0; iTrack < numTracks; ++iTrack){
601  eflowRecTrack* thisTrack = thisEflowCaloObject.efRecTrack(iTrack);
602  for (auto thisPair : clusterList){
603  xAOD::CaloCluster* thisCluster = thisPair.first;
604  const CaloClusterCellLink* theCellLink = thisCluster->getCellLinks();
605  CaloClusterCellLink::const_iterator theCell = theCellLink->begin();
606  CaloClusterCellLink::const_iterator lastCell = theCellLink->end();
607  for (; theCell != lastCell; ++theCell) thisTrack->addSubtractedCaloCell(ElementLink<CaloCellContainer>("AllCalo",theCell.index()),theCell.weight()/numTracks);
608  }
609  }
610 }

◆ canAnnihilate()

bool PFSubtractionTool::canAnnihilate ( double  expectedEnergy,
double  sigma,
double  clusterEnergy 
) const
private

Definition at line 564 of file PFSubtractionTool.cxx.

565 {
566  return clusterEnergy - expectedEnergy < m_subtractionSigmaCut * sigma;
567 }

◆ execute()

void PFSubtractionTool::execute ( eflowCaloObjectContainer theEflowCaloObjectContainer,
eflowRecTrackContainer recTrackContainer,
eflowRecClusterContainer recClusterContainer 
) const

Definition at line 67 of file PFSubtractionTool.cxx.

68 {
69 
70  ATH_MSG_DEBUG("Executing");
71 
72  PFData data;
73  data.caloObjects = theEflowCaloObjectContainer;
74  const PFTrackFiller pfTrackFiller;
77 
78  const PFClusterFiller pfClusterFiller;
81 
82  ATH_MSG_DEBUG("This event has " << data.tracks.size() << " tracks " << data.clusters.size() << " clusters ");
83 
84  unsigned int numMatches = matchAndCreateEflowCaloObj(data);
85 
86  if (msgLvl(MSG::DEBUG)) printAllClusters(*recClusterContainer);
87 
88  if (!m_calcEOverP){
91  else performSubtraction(numMatches,data);
92  }
94  }
95  else{
97  }
98 
99 }

◆ finalize()

StatusCode PFSubtractionTool::finalize ( )

Definition at line 612 of file PFSubtractionTool.cxx.

612 { return StatusCode::SUCCESS; }

◆ initialize()

StatusCode PFSubtractionTool::initialize ( )

Definition at line 31 of file PFSubtractionTool.cxx.

32 {
33 
34  ATH_CHECK(m_theEOverPTool.retrieve());
35 
36  ATH_CHECK(m_theEOverPTool->fillBinnedParameters(m_binnedParameters.get()));
37 
39  if (!m_trkpos)
40  {
41  ATH_MSG_ERROR("Failed to get TrackPositionProvider for cluster preselection!");
42  return StatusCode::FAILURE;
43  }
44 
45  //Retrieve track-cluster matching tools
46  ATH_CHECK(m_theMatchingTool.retrieve());
49 
51 
52  //Set the level of the helpers to the same as the tool here
53  m_pfCalc.msg().setLevel(this->msg().level());
54  m_pfSubtractionStatusSetter.msg().setLevel(this->msg().level());
55  m_pfSubtractionEnergyRatioCalculator.msg().setLevel(this->msg().level());
56  m_subtractor.m_facilitator.msg().setLevel(this->msg().level());
57 
60  }
61 
63 
64  return StatusCode::SUCCESS;
65 }

◆ isEOverPFail()

bool PFSubtractionTool::isEOverPFail ( double  expectedEnergy,
double  sigma,
double  clusterEnergy 
) const
private

Definition at line 558 of file PFSubtractionTool.cxx.

559 {
560  if ((expectedEnergy == 0) && (clusterEnergy > 0)) return false;
561  return clusterEnergy < expectedEnergy - m_consistencySigmaCut * sigma;
562 }

◆ matchAndCreateEflowCaloObj()

unsigned int PFSubtractionTool::matchAndCreateEflowCaloObj ( PFData data) const
private

This matches ID tracks and CaloClusters, and then creates eflowCaloObjects.

No point to do anything if e/p reference bin does not exist

Add cluster matches needed for pull calculation (in eflowCaloObject::simulateShowers) which is used to determine whether to run the charged shower subtraction or not. / Clusters in both a cone of 0.15 and 0.2 are needed for this. / The clusters in a cone of 0.2 are also used as the matched cluster list for recover split showers mode.

Start loop from nCaloObj, which should be zero on a first pass

Definition at line 101 of file PFSubtractionTool.cxx.

101  {
102 
103  //Counts up how many tracks found at least 1 calorimeter cluster matched to it.
104  unsigned int nMatches(0);
105 
106  /* Cache the original number of eflowCaloObjects, if there were any */
107  const unsigned int nCaloObj = data.caloObjects->size();
108  const EventContext &ctx = Gaudi::Hive::currentContext();
109 
110  /* loop tracks in data.tracks and do matching */
111  for (auto *thisEfRecTrack : data.tracks)
112  {
114  if (!thisEfRecTrack->hasBin()) {
115  std::unique_ptr<eflowCaloObject> thisEflowCaloObject = std::make_unique<eflowCaloObject>();
116  thisEflowCaloObject->addTrack(thisEfRecTrack);
117  data.caloObjects->push_back(std::move(thisEflowCaloObject));
118  continue;
119  }
120 
121  if (msgLvl(MSG::DEBUG))
122  {
123  const xAOD::TrackParticle *track = thisEfRecTrack->getTrack();
124  ATH_MSG_DEBUG("Matching track with e,pt, eta and phi " << track->e() << ", " << track->pt() << ", " << track->eta() << " and " << track->phi());
125  }
126 
127  std::vector<eflowTrackClusterLink*> bestClusters;
128  std::vector<float> deltaRPrime;
129 
130  if (m_useTruthMatching){
131 
132  const xAOD::TruthParticle* trackMatchedTruthParticle = nullptr;
134 
135  const static SG::AuxElement::Accessor<TruthLink> truthLinkAccessor("truthParticleLink");
136 
137  TruthLink truthLink = truthLinkAccessor(*(thisEfRecTrack->getTrack()));
138  //if not valid don't print a WARNING because this is an expected condition as discussed here:
139  //https://indico.cern.ch/event/795039/contributions/3391771/attachments/1857138/3050771/TruthTrackFTAGWS.pdf
140  if (truthLink.isValid()) trackMatchedTruthParticle = *truthLink;
141 
142  if (trackMatchedTruthParticle){
143  double barcode = trackMatchedTruthParticle->barcode(); // FIXME barcode-based
144 
146  if (!caloClusterReadDecorHandleNLeadingTruthParticles.isValid()){
147  ATH_MSG_WARNING("Failed to retrieve CaloCluster decoration with key " << caloClusterReadDecorHandleNLeadingTruthParticles.key());
148  }
149 
150  for (auto * thisCluster : data.clusters){
151  //accessor for decoration
152  //split key into substring to get the name of the decoration
153 
154  std::string decorHandleName = m_caloClusterReadDecorHandleKeyNLeadingTruthParticles.key();
155  std::string::size_type pos = decorHandleName.find(".");
156  std::string decorName = decorHandleName.substr(pos+1);
157 
159 
160  std::vector<std::pair<unsigned int, double > > barCodeTruthPairs = accessor(*(thisCluster->getCluster())); // FIXME barcode-based
161 
162  for (auto &barCodeTruthPair : barCodeTruthPairs){ // FIXME barcode-based
163  if (barCodeTruthPair.first == barcode){ // FIXME barcode-based
164  eflowTrackClusterLink* thisLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, thisCluster, ctx);
165  bestClusters.push_back(thisLink);
166  break;
167  }
168  }//loop over calocluster truth pair decorations
169  }//loop over caloclusters
170 
171  }//if have truth particle matched to track
172  else ATH_MSG_WARNING("Track with pt, eta and phi " << thisEfRecTrack->getTrack()->pt() << ", " << thisEfRecTrack->getTrack()->eta() << " and " << thisEfRecTrack->getTrack()->phi() << " does not have a valid truth pointer");
173  }
174  else if (!m_recoverSplitShowers){
179  std::vector<std::pair<eflowRecCluster *, float>> bestClusters_02 = m_theMatchingToolForPull_02->doMatches(thisEfRecTrack, data.clusters, -1);
180  for (auto &matchpair : bestClusters_02)
181  {
182  eflowRecCluster *theCluster = matchpair.first;
183  float distancesq = matchpair.second;
184  eflowTrackClusterLink *trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, theCluster, ctx);
185  if (distancesq < 0.15 * 0.15)
186  {
187  // Narrower cone is a subset of the selected clusters
188  // Distance returned is deltaR^2
189  thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink, "cone_015");
190  }
191  thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink, "cone_02");
192  }//loop over bestClusters_02
193 
194  //This matching scheme is used to match the calorimeter cluster(s) to be used in the charged showers subtraction for this track.
195  std::vector<std::pair<eflowRecCluster *, float>> matchedClusters = m_theMatchingTool->doMatches(thisEfRecTrack, data.clusters,m_nClusterMatchesToUse);
196  for (auto thePair : matchedClusters) {
197  bestClusters.push_back(eflowTrackClusterLink::getInstance(thisEfRecTrack, thePair.first, ctx));
198  if (m_addCPData) deltaRPrime.push_back(std::sqrt(thePair.second));
199  }
200  }
201  else {
202  const std::vector<eflowTrackClusterLink*>* matchedClusters_02 = thisEfRecTrack->getAlternativeClusterMatches("cone_02");
203  if (!matchedClusters_02) continue;
204  else bestClusters = *matchedClusters_02;
205  }
206 
207  if (bestClusters.empty()) continue;
208 
209  if (msgLvl(MSG::DEBUG))
210  {
211  for (auto *thisClusterLink : bestClusters ) {
212  xAOD::CaloCluster* thisCluster = thisClusterLink->getCluster()->getCluster();
213  ATH_MSG_DEBUG("Matched this track to cluster with e,pt, eta and phi " << thisCluster->e() << ", " << thisCluster->pt() << ", " << thisCluster->eta() << " and " << thisCluster->phi());
214  }
215  }
216 
217  nMatches++;
218 
219  //loop over the matched calorimeter clusters and associate tracks and clusters to each other as needed.
220  unsigned int linkIndex = 0;
221  for (auto *trkClusLink : bestClusters){
222 
223  eflowRecCluster *thisEFRecCluster = trkClusLink->getCluster();
224 
226  // Look up whether this cluster is intended for recovery
227  if (std::find(data.clusters.begin(), data.clusters.end(), trkClusLink->getCluster()) == data.clusters.end()) {
228  linkIndex++;
229  continue;
230  }
231  }
232 
233  eflowTrackClusterLink *trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, thisEFRecCluster, ctx);
234  thisEfRecTrack->addClusterMatch(trackClusterLink);
236  thisEfRecTrack->addDeltaRPrime(deltaRPrime[linkIndex]);
237  }
238  thisEFRecCluster->addTrackMatch(trackClusterLink);
239  }
240  linkIndex++;
241  }
242 
243  /* Create 3 types eflowCaloObjects: track-only, cluster-only, track-cluster-link */
244  std::vector<eflowRecCluster *> clusters(data.clusters.begin(), data.clusters.end());
246  unsigned int nCaloObjects = eflowCaloObjectMaker::makeTrkCluCaloObjects(data.tracks, clusters, data.caloObjects);
247  ATH_MSG_DEBUG("Created " << nCaloObjects << " eflowCaloObjects.");
248  if (msgLvl(MSG::DEBUG)){
249  for (auto thisEFlowCaloObject : *(data.caloObjects)){
250  ATH_MSG_DEBUG("This eflowCaloObject has " << thisEFlowCaloObject->nTracks() << " tracks and " << thisEFlowCaloObject->nClusters() << " clusters ");
251  for (unsigned int count = 0; count < thisEFlowCaloObject->nTracks(); count++){
252  const xAOD::TrackParticle* thisTrack = thisEFlowCaloObject->efRecTrack(count)->getTrack();
253  ATH_MSG_DEBUG("Have track with e, pt, eta and phi of " << thisTrack->e() << ", " << thisTrack->pt() << ", " << thisTrack->eta() << " and " << thisTrack->phi());
254  }
255  for (unsigned int count = 0; count < thisEFlowCaloObject->nClusters(); count++){
256  const xAOD::CaloCluster* thisCluster = thisEFlowCaloObject->efRecCluster(count)->getCluster();
257  ATH_MSG_DEBUG("Have cluster with e, pt, eta and phi of " << thisCluster->e() << ", " << thisCluster->pt() << ", " << thisCluster->eta() << " and " << thisCluster->phi());
258  }
259  }
260  }
261 
262  const double gaussianRadius = 0.032;
263  const double gaussianRadiusError = 1.0e-3;
264  const double maximumRadiusSigma = 3.0;
265 
266  eflowLayerIntegrator integrator(gaussianRadius, gaussianRadiusError, maximumRadiusSigma, m_isHLLHC);
267 
269  if (!m_recoverSplitShowers && 0 != nCaloObj) ATH_MSG_WARNING("Not in Split Showers Mode and already have " << nCaloObj << " eflowCaloObjects");
270 
271  //For each eflowCaloObject we calculate the expected energy deposit in the calorimeter and cell ordering for subtraction.
272  for (unsigned int iCalo = nCaloObj; iCalo < data.caloObjects->size(); ++iCalo) {
273  eflowCaloObject* thisEflowCaloObject = data.caloObjects->at(iCalo);
274  thisEflowCaloObject->simulateShower(&integrator, m_binnedParameters.get(), m_useNNEnergy ? &(*m_NNEnergyPredictorTool) : nullptr, m_useLegacyEBinIndex);
275  if (m_useTruthForChargedShowerSubtraction) m_theTruthShowerSimulator->simulateShower(*thisEflowCaloObject);
276 
277  }
278 
279  if (!m_recoverSplitShowers) return nMatches;
280  else return nCaloObj;
281 }

◆ performSubtraction() [1/2]

void PFSubtractionTool::performSubtraction ( const unsigned int &  startingPoint,
PFData data 
) const
private

Definition at line 283 of file PFSubtractionTool.cxx.

283  {
284  unsigned int nEFCaloObs = data.caloObjects->size();
285  for (unsigned int iCalo = startingPoint; iCalo < nEFCaloObs; ++iCalo) {
286  eflowCaloObject* thisEflowCaloObject = data.caloObjects->at(iCalo);
287  this->performSubtraction(*thisEflowCaloObject);
288  }
289 }

◆ performSubtraction() [2/2]

void PFSubtractionTool::performSubtraction ( eflowCaloObject thisEflowCaloObject) const
private

Definition at line 291 of file PFSubtractionTool.cxx.

291  {
292 
293  ATH_MSG_DEBUG("In performSubtraction");
294 
295  unsigned int nClusters = thisEflowCaloObject.nClusters();
296  unsigned int nTrackMatches = thisEflowCaloObject.nTracks();
297 
298  ATH_MSG_DEBUG("Have got an eflowCaloObject with " << nClusters << " clusters and " << nTrackMatches << " track matches");
299 
300  if (msgLevel(MSG::DEBUG)){
301  for (unsigned int iTrack = 0; iTrack < nTrackMatches; ++iTrack){
302  eflowRecTrack* thisTrack = thisEflowCaloObject.efRecTrack(iTrack);
303  ATH_MSG_DEBUG("eflowCaloObject has track with E, pt and eta " << thisTrack->getTrack()->e() << ", " << thisTrack->getTrack()->pt() << " and " << thisTrack->getTrack()->eta());
304  }
305  }
306 
307  //To keep historical behaviour when in recover split showers mode allow tracks with no cluster matches to proceed.
308  if (!m_recoverSplitShowers && nClusters < 1) return;
309 
310  //Need at least one track in this eflowCaloObject to continue.
311  if (nTrackMatches < 1) return;
312 
313  double expectedEnergy = thisEflowCaloObject.getExpectedEnergy();
314  double clusterEnergy = thisEflowCaloObject.getClusterEnergy();
315  double expectedSigma = sqrt(thisEflowCaloObject.getExpectedVariance());
316 
317  /* Check e/p, if on first pass - return if e/p not consistent with expected e/p */
318  if (!m_recoverSplitShowers){
319  if (isEOverPFail(expectedEnergy, expectedSigma, clusterEnergy)) return;
320  }
321 
322  const std::vector<std::pair<eflowTrackClusterLink *, std::pair<float, float>>> &matchedTrackList = thisEflowCaloObject.efRecLink();
323 
324  ATH_MSG_DEBUG("Matched Track List has size " << matchedTrackList.size());
325 
326  if (msgLevel(MSG::DEBUG))
327  {
328  for (unsigned int iTrack = 0; iTrack < nTrackMatches; ++iTrack)
329  {
330  const xAOD::TrackParticle *thisTrack = thisEflowCaloObject.efRecTrack(iTrack)->getTrack();
331  ATH_MSG_DEBUG("eflowCaloObject has track match with E, pt and eta " << thisTrack->e() << ", " << thisTrack->pt() << " and " << thisTrack->eta());
332  }
333  }
334 
335  ATH_MSG_DEBUG("About to perform subtraction for this eflowCaloObject");
336 
337  bool wasAnnihilated = false;
338 
339  //First deal with non-split showers mode
340  if (!m_recoverSplitShowers){
341  /* Check if we can annihilate right away - true if matched cluster has only the expected energy deposit */
342  if (canAnnihilate(expectedEnergy, expectedSigma, clusterEnergy)){
343 
344  wasAnnihilated = true;
345 
346  std::vector<std::pair<xAOD::CaloCluster *, bool>> clusterList;
347  std::map<xAOD::CaloCluster *, double> clusterEnergyMap;
348  unsigned nCluster = thisEflowCaloObject.nClusters();
349  for (unsigned iCluster = 0; iCluster < nCluster; ++iCluster){
350  clusterList.emplace_back(thisEflowCaloObject.efRecCluster(iCluster)->getCluster(), false);
351  }
352 
353  ATH_MSG_DEBUG("We are going to annihilate. ExpectedEnergy, expectedSigma and clusterEnergy are " << expectedEnergy << ", " << expectedSigma << " and " << clusterEnergy);
354  if (msgLevel(MSG::DEBUG))
355  for (auto thisPair : clusterList)
356  ATH_MSG_DEBUG("Annihilating cluster with E and eta " << thisPair.first->e() << " and " << thisPair.first->eta());
357 
359 
360  //before we remove all the cells, we create a list of the removed cells if in doCPData mode
361  if (m_addCPData) this->addSubtractedCells(thisEflowCaloObject, clusterList);
362 
363  Subtractor::annihilateClusters(clusterList);
364 
365  if (msgLevel(MSG::DEBUG))
366  for (auto thisPair : clusterList)
367  ATH_MSG_DEBUG("Have Annihilated cluster with E and eta " << thisPair.first->e() << " and " << thisPair.first->eta());
368 
369  /* Flag all tracks in this system as subtracted */
370  for (unsigned iTrack = 0; iTrack < thisEflowCaloObject.nTracks(); ++iTrack){
371  eflowRecTrack *thisEfRecTrack = (matchedTrackList[iTrack].first)->getTrack();
372  if (!thisEfRecTrack->isSubtracted()) thisEfRecTrack->setSubtracted();
373  }
374 
375  }//if can annihilate this track-cluster systems matched cluster
376  }//split shower recovery mode or regular mode where above annihilation was not triggered
377  if (m_recoverSplitShowers || !wasAnnihilated){
378 
379  for (unsigned iTrack = 0; iTrack < thisEflowCaloObject.nTracks(); ++iTrack){
380 
381  eflowRecTrack *thisEfRecTrack = thisEflowCaloObject.efRecTrack(iTrack);
382 
383  ATH_MSG_DEBUG("About to subtract track with e, pt, eta and phi of " << thisEfRecTrack->getTrack()->e() << ", " << thisEfRecTrack->getTrack()->pt() << ", " << thisEfRecTrack->getTrack()->eta() << " and "
384  << thisEfRecTrack->getTrack()->eta());
385 
386  if (!thisEfRecTrack->hasBin()) continue;
387 
388  ATH_MSG_DEBUG("Have bin for this eflowCaloObject");
389 
390  if (thisEfRecTrack->isInDenseEnvironment() && !m_recoverSplitShowers) continue;
391 
392  ATH_MSG_DEBUG("Am not in dense environment for this eflowCaloObject");
393 
394  /* Get matched cluster via Links */
395  std::vector<eflowRecCluster *> matchedClusters;
396  std::vector<eflowTrackClusterLink *> links = thisEfRecTrack->getClusterMatches();
397  matchedClusters.reserve(links.size());
398  for (auto* thisEFlowTrackClusterLink : links)
399  matchedClusters.push_back(thisEFlowTrackClusterLink->getCluster());
401  std::sort(matchedClusters.begin(),
402  matchedClusters.end(),
404 
405  if (msgLvl(MSG::DEBUG)) {
406  for (auto* thisClus : matchedClusters)
408  "Haved matched cluster "
409  << thisClus->getCluster()->index() << " with e,pt, eta and phi of "
410  << thisClus->getCluster()->e() << ", "
411  << thisClus->getCluster()->pt() << ", "
412  << thisClus->getCluster()->eta() << " and "
413  << thisClus->getCluster()->phi() << " will be subtracted");
414  }
415 
416  /* Do subtraction */
417  std::vector<std::pair<xAOD::CaloCluster *, bool>> clusterSubtractionList;
418  clusterSubtractionList.reserve(matchedClusters.size());
419  std::map<xAOD::CaloCluster *, double> clusterEnergyMap;
420  for (auto *thisEFlowRecCluster : matchedClusters){
421  xAOD::CaloCluster *thisCluster = thisEFlowRecCluster->getCluster();
422  clusterSubtractionList.emplace_back(thisCluster, false);
423  clusterEnergyMap[thisCluster] = thisCluster->e();
424  }
425 
426  ATH_MSG_DEBUG("Have filled clusterSubtractionList for this eflowCaloObject");
427 
428  unsigned int trackIndex = thisEfRecTrack->getTrack()->index();
429 
430  //Previously we only checked this in recover split showers, but makes sense to check it in both passes.
431  auto sumClusEnergy = [](double accumulator, std::pair<xAOD::CaloCluster *, bool> thisPair){ return accumulator += thisPair.first->e();};
432  double totalClusterEnergy = std::accumulate(clusterSubtractionList.begin(),clusterSubtractionList.end(),0.0,sumClusEnergy);
433 
434  /* Check if we can annihilate right away - true if matched cluster has only the expected energy deposit */
435  if(canAnnihilate(thisEfRecTrack->getEExpect(),sqrt(thisEfRecTrack->getVarEExpect()),totalClusterEnergy)){
436 
437  if (msgLevel(MSG::DEBUG))
438  for (auto thisPair : clusterSubtractionList)
439  ATH_MSG_DEBUG("Annihilating cluster with E and eta " << thisPair.first->e() << " and " << thisPair.first->eta());
440 
441  //before we remove all the cells, we create a list of the removed cells if in doCPData mode
442  if (m_addCPData) this->addSubtractedCells(thisEflowCaloObject, clusterSubtractionList);
443 
444  Subtractor::annihilateClusters(clusterSubtractionList);
445  //Now we should mark all of these clusters as being subtracted
446  //Now need to mark which clusters were modified in the subtraction procedure
447  std::vector<std::pair<float, float>> clusterSubtractedEnergyRatios;
448  m_pfSubtractionEnergyRatioCalculator.calculateSubtractedEnergyRatiosForAnnih(clusterSubtractionList, clusterEnergyMap, clusterSubtractedEnergyRatios);
449  m_pfSubtractionStatusSetter.markSubtractionStatus(clusterSubtractionList, clusterSubtractedEnergyRatios, thisEflowCaloObject, trackIndex);
450  }
451  else
452  {
453 
454  /* Subtract the track from all matched clusters */
455  m_subtractor.subtractTracksFromClusters(thisEfRecTrack, clusterSubtractionList, m_addCPData);
456 
457  //recalculate total cluster energy from the clusters afer subtraction
458  totalClusterEnergy = std::accumulate(clusterSubtractionList.begin(),clusterSubtractionList.end(),0.0,sumClusEnergy);
459 
460  /* Annihilate the cluster(s) if the remnant is small (i.e. below k*sigma) */
461  if (canAnnihilate(0.0,sqrt(thisEfRecTrack->getVarEExpect()), totalClusterEnergy)){
462 
463  if (msgLevel(MSG::DEBUG))
464  for (auto thisPair : clusterSubtractionList){
465  ATH_MSG_DEBUG("Annihilating remnant cluster with E and eta " << thisPair.first->e() << " and " << thisPair.first->eta());
466  }
467  eflowSubtract::Subtractor::annihilateClusters(clusterSubtractionList);
468  //Now we should mark all of these clusters as being subtracted
469  std::vector<std::pair<float, float>> clusterSubtractedEnergyRatios;
470  m_pfSubtractionEnergyRatioCalculator.calculateSubtractedEnergyRatiosForAnnih(clusterSubtractionList, clusterEnergyMap, clusterSubtractedEnergyRatios);
471  m_pfSubtractionStatusSetter.markSubtractionStatus(clusterSubtractionList, clusterSubtractedEnergyRatios, thisEflowCaloObject, trackIndex);
472  }//if remove the remnant after cell by cell subtraction
473  else
474  {
475  std::vector<std::pair<float, float>> clusterSubtractedEnergyRatios;
476  m_pfSubtractionEnergyRatioCalculator.calculateSubtractedEnergyRatios(clusterSubtractionList, clusterEnergyMap, clusterSubtractedEnergyRatios);
477  m_pfSubtractionStatusSetter.markSubtractionStatus(clusterSubtractionList, clusterSubtractedEnergyRatios, thisEflowCaloObject, trackIndex);
478  }//if don't remove the remnant after cell by cell subtraction
479 
480  }//if not annihilating, and instead subtracting cell by cell
481 
482  ATH_MSG_DEBUG("Have subtracted charged shower for this eflowRecTrack");
483 
484  /* Flag tracks as subtracted */
485  if (!thisEfRecTrack->isSubtracted()) thisEfRecTrack->setSubtracted();
486 
487  }//loop over tracks in eflowCaloObject
488  }//cell by cell subtraction
489 
490 }

◆ performTruthSubtraction() [1/2]

void PFSubtractionTool::performTruthSubtraction ( eflowCaloObject thisEflowCaloObject) const
private

Definition at line 505 of file PFSubtractionTool.cxx.

505  {
506 
507  for (unsigned iTrack = 0; iTrack < thisEflowCaloObject.nTracks(); ++iTrack){
508  eflowRecTrack *thisEfRecTrack = thisEflowCaloObject.efRecTrack(iTrack);
509 
510  //although we are subtracting the truth, to be consistent we only do it if a reco
511  //e/p lookup bin exists for this track
512  if (!thisEfRecTrack->hasBin()) continue;
513 
514  //Similarly we skip tracks in a dense environment
515  if (thisEfRecTrack->isInDenseEnvironment()) continue;
516 
517  thisEfRecTrack->setSubtracted();
518 
519  //get the set of matched clusters
520  std::vector<eflowTrackClusterLink *> links = thisEfRecTrack->getClusterMatches();
521 
522  for (auto thisLink : links){
523  xAOD::CaloCluster *thisCluster = thisLink->getCluster()->getCluster();
524  CaloClusterCellLink* theCellLinks = thisCluster->getOwnCellLinks();
525  CaloClusterCellLink::iterator theCell = theCellLinks->begin();
526  CaloClusterCellLink::iterator lastCell = theCellLinks->end();
527 
528  //loop over the cells in this cluster and subtract shower using truth information
529  //We can either remove a cell entireley if it has any truth deposit (closer to what the real
530  //reco algorithm does) or reweight the cells contribution based on subtracting the truth
531  //energy from the reco cell energy
532 
533  for (; theCell != lastCell; ++theCell){
534  //get the truth energy for this cell
535  double truthEnergy = thisEfRecTrack->getCellTruthEnergy(*theCell);
536  //reweight the cell such that energy*weight gives the new energy
537  double oldCellEnergy = theCell->energy()*(theCell.weight());
538  double subtractedCellWeight = (oldCellEnergy - truthEnergy)/oldCellEnergy;
539 
540  if (0.0 != truthEnergy && m_useFullCellTruthSubtraction) thisCluster->removeCell(*theCell);
541  else if (!m_useFullCellTruthSubtraction) theCell.reweight(subtractedCellWeight);
542  }//cell loop
543 
544  float oldEnergy = thisCluster->e();
545  CaloClusterKineHelper::calculateKine(thisCluster, true, true);
546  if (0.0 != oldEnergy) {
547  float energyAdjustment = thisCluster->e() / oldEnergy;
548  thisCluster->setRawE(thisCluster->rawE() * energyAdjustment);
549  thisCluster->setRawEta(thisCluster->eta());
550  thisCluster->setRawPhi(thisCluster->phi());
551  }
552  }
553 
554  }//eflowCaloObject track loop
555 
556 }

◆ performTruthSubtraction() [2/2]

void PFSubtractionTool::performTruthSubtraction ( PFData data) const
private

Definition at line 492 of file PFSubtractionTool.cxx.

492  {
493 
494  ATH_MSG_DEBUG("In performTruthSubtraction");
495 
496  unsigned int nEFCaloObs = data.caloObjects->size();
497 
498  for (unsigned int iCalo = 0; iCalo < nEFCaloObs; ++iCalo) {
499  eflowCaloObject* thisEflowCaloObject = data.caloObjects->at(iCalo);
500  this->performTruthSubtraction(*thisEflowCaloObject);
501  }
502 
503 }

◆ printAllClusters()

void PFSubtractionTool::printAllClusters ( const eflowRecClusterContainer recClusterContainer) const
private

Definition at line 581 of file PFSubtractionTool.cxx.

581  {
582 
583  for ( const auto *thisEFRecCluster : recClusterContainer){
584  if (thisEFRecCluster->getTrackMatches().empty()) {
585  ATH_MSG_DEBUG("Isolated" << printCluster(thisEFRecCluster->getCluster()));
586  } else {
587  ATH_MSG_DEBUG("Matched" << printCluster(thisEFRecCluster->getCluster()));
588  std::vector<eflowTrackClusterLink*> theTrackLinks = thisEFRecCluster->getTrackMatches();
589  for ( auto *thisTrack : theTrackLinks){
590  ATH_MSG_DEBUG("Matched" << printTrack(thisTrack->getTrack()->getTrack()));
591  }
592  }
593  }
594 }

◆ printCluster()

std::string PFSubtractionTool::printCluster ( const xAOD::CaloCluster cluster)
staticprivate

Definition at line 575 of file PFSubtractionTool.cxx.

575  {
576  std::stringstream result;
577  result << " cluster with E, eta and phi of " << cluster->e() << ", " << cluster->eta() << " and " << cluster->phi();
578  return result.str();
579 }

◆ printTrack()

std::string PFSubtractionTool::printTrack ( const xAOD::TrackParticle track)
staticprivate

Definition at line 569 of file PFSubtractionTool.cxx.

569  {
570  std::stringstream result;
571  result << " track with E, eta and phi "<< track->e() << ", " << track->eta() << " and " << track->phi();
572  return result.str();
573 }

Member Data Documentation

◆ m_addCPData

Gaudi::Property<bool> PFSubtractionTool::m_addCPData {this,"addCPData",false,"Toggle whether to decorate FlowElements with addutional data for Combined Performance studies "}
private

Toggle whether to decorate eflowRecTrack with addutional data for Combined Performance studies.

Definition at line 99 of file PFSubtractionTool.h.

◆ m_binnedParameters

std::unique_ptr<eflowEEtaBinnedParameters> PFSubtractionTool::m_binnedParameters
private

Definition at line 68 of file PFSubtractionTool.h.

◆ m_calcEOverP

Gaudi::Property<bool> PFSubtractionTool::m_calcEOverP {this, "CalcEOverP", false, "Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed"}
private

Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed.

Definition at line 90 of file PFSubtractionTool.h.

◆ m_caloClusterReadDecorHandleKeyNLeadingTruthParticles

SG::ReadDecorHandleKey<xAOD::CaloClusterContainer> PFSubtractionTool::m_caloClusterReadDecorHandleKeyNLeadingTruthParticles {this,"CaloClusterReadDecorHandleKey_NLeadingTruthParticles",""}
private

Read handle key to decorate CaloCluster with threeN leading truth particle barcode and energy.

Definition at line 126 of file PFSubtractionTool.h.

◆ m_consistencySigmaCut

Gaudi::Property<double> PFSubtractionTool::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"}
private

Parameter that controls whether a track, in a track-cluster system, will be processed by the split shower recovery algorithm.

Definition at line 93 of file PFSubtractionTool.h.

◆ m_isHLLHC

Gaudi::Property<bool> PFSubtractionTool::m_isHLLHC {this, "isHLLHC", false, "Toggle whether we have the HLLHC setup"}
private

Toggle whether we have the HLLHC setup.

Definition at line 87 of file PFSubtractionTool.h.

◆ m_nClusterMatchesToUse

Gaudi::Property<int> PFSubtractionTool::m_nClusterMatchesToUse {this, "nClusterMatchesToUse", 1, "Number of clusters to match to each track"}
private

Number of clusters to match to each track if not doing recover split shower subtraction.

Definition at line 84 of file PFSubtractionTool.h.

◆ m_NNEnergyPredictorTool

ToolHandle<PFEnergyPredictorTool> PFSubtractionTool::m_NNEnergyPredictorTool {this, "NNEnergyPredictorTool", "","Tool for getting predictiing the energy using an ONNX model "}
private

Tool for getting predictiing the energy using an ONNX model.

Definition at line 108 of file PFSubtractionTool.h.

◆ m_pfCalc

PFCalcRadialEnergyProfiles PFSubtractionTool::m_pfCalc {}
private

Definition at line 102 of file PFSubtractionTool.h.

◆ m_pfSubtractionEnergyRatioCalculator

PFSubtractionEnergyRatioCalculator PFSubtractionTool::m_pfSubtractionEnergyRatioCalculator {}
private

Definition at line 104 of file PFSubtractionTool.h.

◆ m_pfSubtractionStatusSetter

PFSubtractionStatusSetter PFSubtractionTool::m_pfSubtractionStatusSetter {}
private

Definition at line 103 of file PFSubtractionTool.h.

◆ m_recoverSplitShowers

Gaudi::Property<bool> PFSubtractionTool::m_recoverSplitShowers {this,"RecoverSplitShowers",false,"Toggle whether we are recovering split showers or not"}
private

Toggle whether we are recovering split showers or not.

Definition at line 81 of file PFSubtractionTool.h.

◆ m_subtractionSigmaCut

Gaudi::Property<double> PFSubtractionTool::m_subtractionSigmaCut {this, "SubtractionSigmaCut", 1.5, "Parameter that controls whether to use retain remaining calorimeter energy in track-cluster system, after charged shower subtraction"}
private

Parameter that controls whether to use retain remaining calorimeter energy in track-cluster system, after charged shower subtraction.

Definition at line 96 of file PFSubtractionTool.h.

◆ m_subtractor

eflowSubtract::Subtractor PFSubtractionTool::m_subtractor {}
private

Definition at line 105 of file PFSubtractionTool.h.

◆ m_theEOverPTool

ToolHandle<IEFlowCellEOverPTool> PFSubtractionTool::m_theEOverPTool {this, "eflowCellEOverPTool", "eflowCellEOverPTool", "Energy Flow E/P Values and Shower Parameters Tool"}
private

Tool for getting e/p values and hadronic shower cell ordering principle parameters.

Definition at line 66 of file PFSubtractionTool.h.

◆ m_theMatchingTool

ToolHandle<PFTrackClusterMatchingTool> PFSubtractionTool::m_theMatchingTool {this, "PFTrackClusterMatchingTool", "PFTrackClusterMatchingTool/CalObjBldMatchingTool", "The track-cluster matching tool"}
private

Default track-cluster matching tool.

Definition at line 74 of file PFSubtractionTool.h.

◆ m_theMatchingToolForPull_015

ToolHandle<PFTrackClusterMatchingTool> PFSubtractionTool::m_theMatchingToolForPull_015 {this, "PFTrackClusterMatchingTool_015", "PFTrackClusterMatchingTool/PFPullMatchingTool_015", "The 0.15 track-cluster matching tool to calculate the pull"}
private

Definition at line 77 of file PFSubtractionTool.h.

◆ m_theMatchingToolForPull_02

ToolHandle<PFTrackClusterMatchingTool> PFSubtractionTool::m_theMatchingToolForPull_02 {this, "PFTrackClusterMatchingTool_02", "PFTrackClusterMatchingTool/PFPullMatchingTool_02", "The 0.2 track-cluster matching tool to calculate the pull"}
private

Definition at line 78 of file PFSubtractionTool.h.

◆ m_theTruthShowerSimulator

ToolHandle<PFSimulateTruthShowerTool> PFSubtractionTool::m_theTruthShowerSimulator {this, "PFSimulateTruthShowerTool", "", "The truth shower simulator"}
private

Definition at line 123 of file PFSubtractionTool.h.

◆ m_trkpos

std::unique_ptr<PFMatch::TrackEtaPhiInFixedLayersProvider> PFSubtractionTool::m_trkpos
private

Track position provider to be used to preselect clusters.

Definition at line 71 of file PFSubtractionTool.h.

◆ m_useFullCellTruthSubtraction

Gaudi::Property<bool> PFSubtractionTool::m_useFullCellTruthSubtraction {this,"useFullCellTruthSubtraction",false,"Toggle whether we fully remove a cell with a truth deposit or reweight it based on truth contribution"}
private

Toggle whether we fully remove a cell with a truth deposit or reweight it based on truth contribution.

Definition at line 121 of file PFSubtractionTool.h.

◆ m_useLegacyEBinIndex

Gaudi::Property<bool> PFSubtractionTool::m_useLegacyEBinIndex {this, "useLegacyEBinIndex", true, "Toggle whether we use the legacy energy bin index"}
private

Further discussion about why this flag exists can be found in https://its.cern.ch/jira/browse/ATLJETMET-1692 and https://indico.cern.ch/event/1388633/contributions/5837876/attachments/2809591/4903439/PFlow_EOverP_Feb2024.pdf The Jira report discusses assorted problems with the treatment of energy bin indexes for the lookup of e/p values.

In order to not change the behaviour of produciton code a legacy option is introduced to allow us to fix the problem in future iterations of e/p derivations.s

Definition at line 133 of file PFSubtractionTool.h.

◆ m_useNNEnergy

Gaudi::Property<bool> PFSubtractionTool::m_useNNEnergy {this, "useNNEnergy", false, "Toggle whether we use the neural net energy"}
private

Toggle whether we use the neural net energy.

Definition at line 111 of file PFSubtractionTool.h.

◆ m_useTruthForChargedShowerSubtraction

Gaudi::Property<bool> PFSubtractionTool::m_useTruthForChargedShowerSubtraction {this, "useTruthForChargedShowerSubtraction", false, "Toggle whether we use truth information for the charged shower subtraction or not"}
private

Toggle whether we use truth information for the charged shower subtraction or not.

Definition at line 118 of file PFSubtractionTool.h.

◆ m_useTruthMatching

Gaudi::Property<bool> PFSubtractionTool::m_useTruthMatching {this, "useTrackClusterTruthMatching", false, "Toggle whether to cheat and use truth information for track-cluster matching"}
private

Toggle whether to cheat and use truth information for track-cluster matching - only for performance studies!

Definition at line 115 of file PFSubtractionTool.h.


The documentation for this class was generated from the following files:
eflowRecCluster
This class extends the information about a xAOD::CaloCluster.
Definition: eflowRecCluster.h:40
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
eflowRecCluster::SortDescendingPt
Definition: eflowRecCluster.h:124
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
xAOD::CaloCluster_v1::rawE
flt_t rawE() const
eflowCaloObject::nClusters
unsigned nClusters() const
Definition: eflowCaloObject.h:60
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
PFSubtractionTool::performTruthSubtraction
void performTruthSubtraction(PFData &data) const
Definition: PFSubtractionTool.cxx:492
eflowCaloObject::getExpectedEnergy
double getExpectedEnergy() const
Definition: eflowCaloObject.cxx:40
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
eflowLayerIntegrator
This class calculates the LHED (Layer of Highest Energy Density) in a cluster or group of clusters.
Definition: eflowLayerIntegrator.h:35
get_generator_info.result
result
Definition: get_generator_info.py:21
eflowCaloObject::efRecLink
const std::vector< std::pair< eflowTrackClusterLink *, std::pair< float, float > > > & efRecLink() const
Definition: eflowCaloObject.h:65
PFSubtractionTool::m_isHLLHC
Gaudi::Property< bool > m_isHLLHC
Toggle whether we have the HLLHC setup.
Definition: PFSubtractionTool.h:87
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
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:115
PFSubtractionTool::m_subtractor
eflowSubtract::Subtractor m_subtractor
Definition: PFSubtractionTool.h:105
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
eflowRecTrack::isInDenseEnvironment
bool isInDenseEnvironment() const
Definition: eflowRecTrack.h:103
PFClusterFiller::fillClustersToRecover
static void fillClustersToRecover(PFData &data)
Definition: PFClusterFiller.cxx:5
eflowRecCluster::addTrackMatch
void addTrackMatch(eflowTrackClusterLink *trackMatch)
Definition: eflowRecCluster.h:69
PFSubtractionEnergyRatioCalculator::calculateSubtractedEnergyRatios
void calculateSubtractedEnergyRatios(const std::vector< std::pair< xAOD::CaloCluster *, bool >> &clusterSubtractionList, std::map< xAOD::CaloCluster *, double > &clusterEnergyMap, std::vector< std::pair< float, float >> &clusterSubtractedEnergyRatios) const
For each xAOD::CaloCluster in clusterSubtractionList we calculate the ratio of new to old energy afte...
Definition: PFSubtractionEnergyRatioCalculator.cxx:13
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
PFSubtractionTool::m_NNEnergyPredictorTool
ToolHandle< PFEnergyPredictorTool > m_NNEnergyPredictorTool
Tool for getting predictiing the energy using an ONNX model.
Definition: PFSubtractionTool.h:108
PFSubtractionStatusSetter::markAllTracksAnnihStatus
void markAllTracksAnnihStatus(eflowCaloObject &thisEflowCaloObject) const
Set the ratio of new to old cluster energy, to zero, for all cluster matched to all tracks attached t...
Definition: PFSubtractionStatusSetter.cxx:71
eflowRecTrack::getCellTruthEnergy
double getCellTruthEnergy(const CaloCell *cell) const
Definition: eflowRecTrack.cxx:95
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
TruthLink
ElementLink< xAOD::TruthParticleContainer > TruthLink
Definition: TruthRelatedMuonPlotOrganizer.cxx:12
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:93
PFSubtractionTool::m_useTruthForChargedShowerSubtraction
Gaudi::Property< bool > m_useTruthForChargedShowerSubtraction
Toggle whether we use truth information for the charged shower subtraction or not.
Definition: PFSubtractionTool.h:118
eflowRecTrack::hasBin
bool hasBin() const
Definition: eflowRecTrack.h:74
PFSubtractionTool::m_trkpos
std::unique_ptr< PFMatch::TrackEtaPhiInFixedLayersProvider > m_trkpos
Track position provider to be used to preselect clusters.
Definition: PFSubtractionTool.h:71
PFSubtractionTool::matchAndCreateEflowCaloObj
unsigned int matchAndCreateEflowCaloObj(PFData &data) const
This matches ID tracks and CaloClusters, and then creates eflowCaloObjects.
Definition: PFSubtractionTool.cxx:101
eflowCaloObject
An internal EDM object which stores information about systems of associated tracks and calorimeter cl...
Definition: eflowCaloObject.h:34
eflowSubtract::Subtractor::subtractTracksFromClusters
void subtractTracksFromClusters(eflowRecTrack *efRecTrack, std::vector< std::pair< xAOD::CaloCluster *, bool >> &clusterSubtractionList, const bool &addCPData) const
Definition: eflowSubtractor.cxx:27
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
PFMatch::TrackPositionFactory::Get
static std::unique_ptr< IPositionProvider > Get(const std::string &positionType)
Definition: PFMatchPositions.h:95
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:311
eflowRecTrack::addSubtractedCaloCell
void addSubtractedCaloCell(ElementLink< CaloCellContainer > theCellLink, const double &weight)
Definition: eflowRecTrack.h:115
eflowCaloObject::getExpectedVariance
double getExpectedVariance() const
Definition: eflowCaloObject.cxx:48
eflowCaloObject::addTrack
void addTrack(eflowRecTrack *track)
Definition: eflowCaloObject.h:40
eflowRecTrack
This class extends the information about a xAOD::Track.
Definition: eflowRecTrack.h:46
PFTrackFiller
Definition: PFTrackFiller.h:7
PFSubtractionTool::m_pfSubtractionStatusSetter
PFSubtractionStatusSetter m_pfSubtractionStatusSetter
Definition: PFSubtractionTool.h:103
eflowRecTrack::setSubtracted
void setSubtracted()
Definition: eflowRecTrack.cxx:100
eflowRecTrack::getClusterMatches
const std::vector< eflowTrackClusterLink * > & getClusterMatches() const
Definition: eflowRecTrack.h:67
PFSubtractionTool::m_theEOverPTool
ToolHandle< IEFlowCellEOverPTool > m_theEOverPTool
Tool for getting e/p values and hadronic shower cell ordering principle parameters.
Definition: PFSubtractionTool.h:66
PFSubtractionTool::m_useNNEnergy
Gaudi::Property< bool > m_useNNEnergy
Toggle whether we use the neural net energy.
Definition: PFSubtractionTool.h:111
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
eflowCaloObject::efRecTrack
const eflowRecTrack * efRecTrack(int i) const
Definition: eflowCaloObject.h:52
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:84
xAOD::CaloCluster_v1::setRawE
void setRawE(flt_t)
Set Energy for signal state UNCALIBRATED.
Definition: CaloCluster_v1.cxx:284
PFSubtractionTool::printAllClusters
void printAllClusters(const eflowRecClusterContainer &recClusterContainer) const
Definition: PFSubtractionTool.cxx:581
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::CaloCluster_v1::removeCell
bool removeCell(const CaloCell *ptr)
Method to remove a cell to the cluster (slow!) (Beware: Kinematics not updated!)
Definition: CaloCluster_v1.cxx:923
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
PFSubtractionTool::isEOverPFail
bool isEOverPFail(double expectedEnergy, double sigma, double clusterEnergy) const
Definition: PFSubtractionTool.cxx:558
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
PFSubtractionTool::m_pfCalc
PFCalcRadialEnergyProfiles m_pfCalc
Definition: PFSubtractionTool.h:102
PFSubtractionTool::performSubtraction
void performSubtraction(const unsigned int &startingPoint, PFData &data) const
Definition: PFSubtractionTool.cxx:283
eflowRecTrack::isSubtracted
bool isSubtracted() const
Definition: eflowRecTrack.h:80
DMTest::links
links
Definition: CLinks_v1.cxx:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
PFSubtractionTool::m_theMatchingToolForPull_02
ToolHandle< PFTrackClusterMatchingTool > m_theMatchingToolForPull_02
Definition: PFSubtractionTool.h:78
PFClusterFiller
Definition: PFClusterFiller.h:7
PFCalcRadialEnergyProfiles::calculate
void calculate(const PFData &data) const
Definition: PFCalcRadialEnergyProfiles.cxx:11
PFSubtractionStatusSetter::markSubtractionStatus
void markSubtractionStatus(const std::vector< std::pair< xAOD::CaloCluster *, bool >> &clusterList, std::vector< std::pair< float, float >> &clusterSubtractedEnergyRatios, eflowCaloObject &thisEflowCaloObject, unsigned int trackIndex) const
Set the ratio of new to old cluster energy for each cluster matched to a track with trackIndex.
Definition: PFSubtractionStatusSetter.cxx:17
PFSubtractionEnergyRatioCalculator::calculateSubtractedEnergyRatiosForAnnih
void calculateSubtractedEnergyRatiosForAnnih(const std::vector< std::pair< xAOD::CaloCluster *, bool >> &clusterSubtractionList, std::map< xAOD::CaloCluster *, double > &clusterEnergyMap, std::vector< std::pair< float, float >> &clusterSubtractedEnergyRatios) const
If we have decided to annihiliate all clusters in clusterSubtractionList we use this function to set ...
Definition: PFSubtractionEnergyRatioCalculator.cxx:49
eflowRecTrack::getEExpect
double getEExpect() const
Definition: eflowRecTrack.h:84
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
PFSubtractionTool::m_calcEOverP
Gaudi::Property< bool > m_calcEOverP
Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed.
Definition: PFSubtractionTool.h:90
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::CaloCluster_v1::setRawEta
void setRawEta(flt_t)
Set for signal state UNCALIBRATED.
Definition: CaloCluster_v1.cxx:289
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
eflowRecCluster::getCluster
xAOD::CaloCluster * getCluster()
Definition: eflowRecCluster.h:49
eflowCaloObject::nTracks
unsigned nTracks() const
Definition: eflowCaloObject.h:54
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
xAOD::TruthParticle_v1::barcode
int barcode() const
Barcode.
eflowSubtract::Subtractor::m_facilitator
eflowCellSubtractionFacilitator m_facilitator
Definition: eflowSubtractor.h:56
PFData
Definition: PFData.h:11
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
Definition: CaloCluster_v1.cxx:905
PFSubtractionTool::m_pfSubtractionEnergyRatioCalculator
PFSubtractionEnergyRatioCalculator m_pfSubtractionEnergyRatioCalculator
Definition: PFSubtractionTool.h:104
PFSubtractionTool::m_recoverSplitShowers
Gaudi::Property< bool > m_recoverSplitShowers
Toggle whether we are recovering split showers or not.
Definition: PFSubtractionTool.h:81
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:133
PFSubtractionTool::printTrack
static std::string printTrack(const xAOD::TrackParticle *track)
Definition: PFSubtractionTool.cxx:569
xAOD::CaloCluster_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters)
Definition: CaloCluster_v1.cxx:247
eflowRecTrack::getTrack
const xAOD::TrackParticle * getTrack() const
Definition: eflowRecTrack.h:54
python.EventInfoMgtInit.release
release
Definition: EventInfoMgtInit.py:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
PFSubtractionTool::m_caloClusterReadDecorHandleKeyNLeadingTruthParticles
SG::ReadDecorHandleKey< xAOD::CaloClusterContainer > m_caloClusterReadDecorHandleKeyNLeadingTruthParticles
Read handle key to decorate CaloCluster with threeN leading truth particle barcode and energy.
Definition: PFSubtractionTool.h:126
eflowCaloObjectMaker::makeTrkCluCaloObjects
static unsigned int makeTrkCluCaloObjects(eflowRecTrackContainer *eflowTrackContainer, eflowRecClusterContainer *eflowClusterContainer, eflowCaloObjectContainer *caloObjectContainer)
Definition: eflowCaloObjectMaker.cxx:25
PFSubtractionTool::addSubtractedCells
void addSubtractedCells(eflowCaloObject &thisEflowCaloObject, const std::vector< std::pair< xAOD::CaloCluster *, bool > > &clusterList) const
Definition: PFSubtractionTool.cxx:596
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:96
PFClusterFiller::fillClustersToConsider
static void fillClustersToConsider(PFData &data, eflowRecClusterContainer &recClusterContainer)
Definition: PFClusterFiller.cxx:25
xAOD::TrackParticle_v1::e
virtual double e() const override final
The total energy of the particle.
Definition: TrackParticle_v1.cxx:109
PFSubtractionTool::canAnnihilate
bool canAnnihilate(double expectedEnergy, double sigma, double clusterEnergy) const
Definition: PFSubtractionTool.cxx:564
xAOD::JetAttributeAccessor::accessor
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.
Definition: JetAccessorMap.h:26
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
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:121
PFTrackFiller::fillTracksToConsider
static void fillTracksToConsider(PFData &data, eflowRecTrackContainer &recTrackContainer)
Definition: PFTrackFiller.cxx:57
PFSubtractionTool::m_theMatchingTool
ToolHandle< PFTrackClusterMatchingTool > m_theMatchingTool
Default track-cluster matching tool.
Definition: PFSubtractionTool.h:74
PFSubtractionTool::printCluster
static std::string printCluster(const xAOD::CaloCluster *cluster)
Definition: PFSubtractionTool.cxx:575
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
eflowCaloObject::efRecCluster
const eflowRecCluster * efRecCluster(int i) const
Definition: eflowCaloObject.h:58
PFSubtractionTool::m_theTruthShowerSimulator
ToolHandle< PFSimulateTruthShowerTool > m_theTruthShowerSimulator
Definition: PFSubtractionTool.h:123
eflowRecTrack::getVarEExpect
double getVarEExpect() const
Definition: eflowRecTrack.h:85
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::CaloCluster_v1::getOwnCellLinks
CaloClusterCellLink * getOwnCellLinks()
Get a pointer to the owned CaloClusterCellLink object (non-const version)
Definition: CaloCluster_v1.h:762
DEBUG
#define DEBUG
Definition: page_access.h:11
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
PFMatch::TrackEtaPhiInFixedLayersProvider
Definition: PFMatchPositions.h:76
CaloClusterKineHelper::calculateKine
static void calculateKine(xAOD::CaloCluster *clu, const bool useweight=true, const bool updateLayers=true, const bool useGPUCriteria=false)
Helper class to calculate cluster kinematics based on cells.
Definition: CaloClusterKineHelper.cxx:223
PFSubtractionTool::m_binnedParameters
std::unique_ptr< eflowEEtaBinnedParameters > m_binnedParameters
Definition: PFSubtractionTool.h:68
PFSubtractionTool::m_theMatchingToolForPull_015
ToolHandle< PFTrackClusterMatchingTool > m_theMatchingToolForPull_015
Definition: PFSubtractionTool.h:77
eflowCaloObject::getClusterEnergy
double getClusterEnergy() const
Definition: eflowCaloObject.cxx:56
egammaParameters::linkIndex
@ linkIndex
link index for multiple track and vertex matches
Definition: egammaParamDefs.h:574
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
PFTrackFiller::fillTracksToRecover
static void fillTracksToRecover(PFData &data)
Definition: PFTrackFiller.cxx:5
PFSubtractionTool::m_addCPData
Gaudi::Property< bool > m_addCPData
Toggle whether to decorate eflowRecTrack with addutional data for Combined Performance studies.
Definition: PFSubtractionTool.h:99
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
eflowCaloObject::simulateShower
void simulateShower(eflowLayerIntegrator *integrator, const eflowEEtaBinnedParameters *binnedParameters, const PFEnergyPredictorTool *energyP, bool useLegacyEnergyBinIndexing)
Definition: eflowCaloObject.cxx:64
xAOD::TrackParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
xAOD::CaloCluster_v1::setRawPhi
void setRawPhi(flt_t)
Set for signal state UNCALIBRATED.
Definition: CaloCluster_v1.cxx:294
eflowSubtract::Subtractor::annihilateClusters
static void annihilateClusters(std::vector< std::pair< xAOD::CaloCluster *, bool >> &clusters)
Definition: eflowSubtractor.cxx:78