ATLAS Offline Software
Loading...
Searching...
No Matches
eflowRecCluster.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * eflowRecCluster.cxx
7 *
8 * Created on: 30.09.2013
9 * Author: tlodd
10 */
11
16
19 const xAOD::CaloCluster* originalCluster = *clusElementLink;
21 newClusContainer.push_back(m_cluster);
22 m_clusElementLink = ElementLink<xAOD::CaloClusterContainer>(newClusContainer,newClusContainer.size()-1);
23
24 const CaloClusterCellLink* theOldCellLinks = originalCluster->getCellLinks();
25
26 CaloClusterCellLink *newLinks = new CaloClusterCellLink(*theOldCellLinks);
27 m_cluster->addCellLink(newLinks);
30
31 m_cluster->setRawE(m_cluster->calE());
32 m_cluster->setRawEta(m_cluster->calEta());
33 m_cluster->setRawPhi(m_cluster->calPhi());
34 m_cluster->setRawM(m_cluster->calM());
35
36 m_matchCluster = std::make_unique<eflowMatchCluster>(this);
38}
39
41 : m_clusterId (originalEflowRecCluster.m_clusterId),
42 m_calorimeterType (originalEflowRecCluster.m_calorimeterType),
43 m_cluster (originalEflowRecCluster.m_cluster),
45 m_clusElementLink (originalEflowRecCluster.m_clusElementLink),
46 m_isTouchable (originalEflowRecCluster.m_isTouchable),
47 m_matchCluster (std::make_unique<eflowMatchCluster>(this))
48{
49}
50
52
53bool eflowRecCluster::isEOverPFail(bool consistencySigmaCut, bool useGoldenMode) {
54
55 double expectedEnergy = getSumExpectedEnergy();
56 double clusterEnergy = m_cluster->e();
57
58 if ((expectedEnergy == 0) && (clusterEnergy > 0)) {
59 return false;
60 }
61
62 double sigma = sqrt(getVarianceOfSumExpectedEnergy());
63
64 bool result = useGoldenMode ? fabs(clusterEnergy - expectedEnergy) > consistencySigmaCut*sigma
65 : clusterEnergy < expectedEnergy - consistencySigmaCut*sigma;
66 return result;
67}
68
70 double expectedEnergy(0);
71 int nTrk = getNTracks();
72 for (int iTrk = 0; iTrk < nTrk; ++iTrk){
73 expectedEnergy += m_trackMatches[iTrk]->getTrack()->getEExpect();
74 }
75 return expectedEnergy;
76}
78 double varianceExpectedEnergy(0);
79 int nTrk = getNTracks();
80 for (int iTrk = 0; iTrk < nTrk; ++iTrk){
81 varianceExpectedEnergy += m_trackMatches[iTrk]->getTrack()->getVarEExpect();
82 }
83 return varianceExpectedEnergy;
84}
85
87
88 double EMB_E = m_cluster->eSample(xAOD::CaloCluster::CaloSample::PreSamplerB)
89 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::EMB1)
90 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::EMB2)
91 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::EMB3);
92 double EME_E = m_cluster->eSample(xAOD::CaloCluster::CaloSample::PreSamplerE)
93 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::EME1)
94 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::EME2)
95 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::EME3);
96 double HEC_E = m_cluster->eSample(xAOD::CaloCluster::CaloSample::HEC0)
97 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::HEC1)
98 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::HEC2)
99 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::HEC3);
100 double Tile_E = m_cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar0)
101 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar1)
102 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar2)
103 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap1)
104 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap2)
105 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap3)
106 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt0)
107 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt1)
108 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt2);
109 double FCAL_E = m_cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL0)
110 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL1)
111 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL2);
112 double MiniFCAL_E = m_cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL0)
113 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL1)
114 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL2)
115 + m_cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL3);
116
117 double totalEnergy = EMB_E + EME_E + HEC_E + Tile_E + FCAL_E + MiniFCAL_E;
118 if(std::abs(totalEnergy) < 1.0e-4){
120 return;
121 }
122 double ratioEM = (EMB_E+EME_E)/totalEnergy;
123 double ratioHCAL = (HEC_E+Tile_E)/totalEnergy;
124 double ratioFCAL = (FCAL_E + MiniFCAL_E)/totalEnergy;
126 if(ratioEM > 0.5) {
128 } else if (ratioHCAL > 0.5) {
130 } else if (ratioFCAL > 0.5) {
132 } else {
134 }
136}
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.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
This class, which inherits from the pure virtual ICluster, stores a pointer to an eflowRecCluster.
ElementLink< xAOD::CaloClusterContainer > m_originalClusElementLink
eflowRecCluster(const ElementLink< xAOD::CaloClusterContainer > &clusElementLink, xAOD::CaloClusterContainer &newClusContainer)
std::unique_ptr< eflowMatchCluster > m_matchCluster
bool isEOverPFail(bool consistencySigmaCut, bool useGoldenMode)
double getVarianceOfSumExpectedEnergy()
virtual ~eflowRecCluster()
std::vector< eflowTrackClusterLink * > m_trackMatches
double getSumExpectedEnergy()
xAOD::CaloCluster * m_cluster
ElementLink< xAOD::CaloClusterContainer > m_clusElementLink
int getNTracks() const
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
STL namespace.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.