ATLAS Offline Software
eflowSubtractor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * eflowSubtractor.cxx
7  *
8  * Created on: Feb 25, 2015
9  * Author: zhangrui
10  */
11 
18 #include "eflowRec/eflowRecTrack.h"
23 
24 namespace eflowSubtract {
25 
26 void
28  eflowRecTrack* efRecTrack,
29  std::vector<std::pair<xAOD::CaloCluster*, bool>>& clusterSubtractionList, const bool& addCPData) const
30 {
31 
32  /* Make ordered cell list */
33  /* (Invokes newCluster() on orderedCells, than adds all the cells in
34  * tracksClus) */
35  eflowCellList orderedCells;
37  efRecTrack->getTrackCaloPoints(), clusterSubtractionList, orderedCells);
38 
39  /* Get the cellSubtractionManager from the eflowCaloObject */
41  efRecTrack->getCellSubtractionManager();
42 
43  bool annFlag;
45  ranking, *efRecTrack, clusterSubtractionList, orderedCells, annFlag, addCPData);
46 
47  orderedCells.eraseList();
48 }
49 
50 void
52  const eflowTrackCaloPoints& trackCalo,
53  const std::vector<std::pair<xAOD::CaloCluster*, bool>>& clusters,
54  eflowCellList& orderedCells)
55 {
56  orderedCells.setNewExtrapolatedTrack(trackCalo);
57 
58  unsigned int countMatchedClusters = 0;
59  for (auto thisPair : clusters) {
60 
61  xAOD::CaloCluster* thisCluster = thisPair.first;
62 
63  const CaloClusterCellLink* theCellLink = thisCluster->getCellLinks();
64  CaloClusterCellLink::const_iterator firstCell = theCellLink->begin();
65  CaloClusterCellLink::const_iterator lastCell = theCellLink->end();
66 
67  /* Loop over cells in cluster */
68  for (; firstCell != lastCell; ++firstCell) {
69  std::pair<const CaloCell*, int> myPair((*firstCell),
70  countMatchedClusters);
71  orderedCells.addCell(myPair);
72  }
73  countMatchedClusters++;
74  }
75 }
76 
77 void
79  std::vector<std::pair<xAOD::CaloCluster*, bool>>& clusters)
80 {
81 
82  for (auto& thisPair : clusters) {
83  annihilateCluster(thisPair.first);
84  // mark subtraction status as true
85  thisPair.second = true;
86  }
87 }
88 
89 void
91 {
92 
93  CaloClusterCellLink* theCellLink = cluster->getOwnCellLinks();
94  theCellLink->clear();
95 
96  cluster->setE(0.0);
97  cluster->setRawE(0.0);
98  CaloClusterKineHelper::calculateKine(cluster, true, true);
99 }
100 
101 } // namespace eflowSubtract
CaloClusterKineHelper.h
PFRunESDtoAOD_WithJetsTausMET_CPData_mc21_13p6TeV.addCPData
addCPData
Definition: PFRunESDtoAOD_WithJetsTausMET_CPData_mc21_13p6TeV.py:13
eflowTrackCaloPoints
This class stores a map of calorimeter layers and track parameters (the result of the track extrapola...
Definition: eflowTrackCaloPoints.h:30
eflowSubtract
Definition: eflowSubtractor.h:27
eflowSubtractor.h
eflowCellList::setNewExtrapolatedTrack
void setNewExtrapolatedTrack(const eflowTrackCaloPoints *trackCalo)
Definition: eflowCellList.cxx:35
eflowCellList::addCell
void addCell(std::pair< const CaloCell *, int > cell)
Definition: eflowCellList.cxx:53
eflowSubtract::Subtractor::subtractTracksFromClusters
void subtractTracksFromClusters(eflowRecTrack *efRecTrack, std::vector< std::pair< xAOD::CaloCluster *, bool >> &clusterSubtractionList, const bool &addCPData) const
Definition: eflowSubtractor.cxx:27
eflowCellList
Concrete class derived class from pure virtual eflowAbstractCellList.
Definition: eflowCellList.h:42
eflowRecTrack
This class extends the information about a xAOD::Track.
Definition: eflowRecTrack.h:46
eflowRecTrack::getCellSubtractionManager
eflowRingSubtractionManager & getCellSubtractionManager()
Definition: eflowRecTrack.h:63
xAOD::CaloCluster_v1::setE
void setE(flt_t)
Definition: CaloCluster_v1.cxx:375
eflowLayerIntegrator.h
eflowRecTrack.h
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
eflowSubtract::Subtractor::annihilateCluster
static void annihilateCluster(xAOD::CaloCluster *cluster)
Definition: eflowSubtractor.cxx:90
xAOD::CaloCluster_v1::setRawE
void setRawE(flt_t)
Set Energy for signal state UNCALIBRATED.
Definition: CaloCluster_v1.cxx:284
CaloCluster.h
eflowCellList::eraseList
void eraseList()
Definition: eflowCellList.h:76
eflowCellSubtractionFacilitator::subtractCells
double subtractCells(eflowRingSubtractionManager &ringSubtractionManager, eflowRecTrack &theTrack, xAOD::CaloCluster *tracksClus, eflowCellList &orderedCells, bool &annFlag, const bool &addCPData) const
Definition: eflowCellSubtractionFacilitator.cxx:24
eflowRecCluster.h
eflowSubtract::Subtractor::m_facilitator
eflowCellSubtractionFacilitator m_facilitator
Definition: eflowSubtractor.h:56
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
Definition: CaloCluster_v1.cxx:905
eflowRingSubtractionManager.h
eflowRingSubtractionManager
This stores information, a rank and ring thickness, about cell rings in an ordered way.
Definition: eflowRingSubtractionManager.h:31
eflowCellSubtractionFacilitator.h
eflowCaloObject.h
eflowRecTrack::getTrackCaloPoints
const eflowTrackCaloPoints & getTrackCaloPoints() const
Definition: eflowRecTrack.h:56
eflowSubtract::Subtractor::makeOrderedCellList
static void makeOrderedCellList(const eflowTrackCaloPoints &trackCalo, const std::vector< std::pair< xAOD::CaloCluster *, bool >> &clusters, eflowCellList &orderedCells)
Definition: eflowSubtractor.cxx:51
xAOD::CaloCluster_v1::getOwnCellLinks
CaloClusterCellLink * getOwnCellLinks()
Get a pointer to the owned CaloClusterCellLink object (non-const version)
Definition: CaloCluster_v1.h:762
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
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
eflowEEtaBinnedParameters.h
eflowSubtract::Subtractor::annihilateClusters
static void annihilateClusters(std::vector< std::pair< xAOD::CaloCluster *, bool >> &clusters)
Definition: eflowSubtractor.cxx:78