ATLAS Offline Software
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 
13 #include "eflowRec/eflowRecTrack.h"
16 
18  m_clusterId(-1), m_calorimeterType(UNASSIGNED) , m_originalClusElementLink(clusElementLink), m_isTouchable(false), m_matchCluster(nullptr) {
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 
35 
36  m_matchCluster = std::make_unique<eflowMatchCluster>(this);
38 }
39 
40 eflowRecCluster::eflowRecCluster(const eflowRecCluster& originalEflowRecCluster)
41  : m_clusterId (originalEflowRecCluster.m_clusterId),
42  m_calorimeterType (originalEflowRecCluster.m_calorimeterType),
43  m_cluster (originalEflowRecCluster.m_cluster),
44  m_originalClusElementLink (originalEflowRecCluster.m_originalClusElementLink),
45  m_clusElementLink (originalEflowRecCluster.m_clusElementLink),
46  m_isTouchable (originalEflowRecCluster.m_isTouchable),
47  m_matchCluster (std::make_unique<eflowMatchCluster>(this))
48 {
49 }
50 
52 
53 bool 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 
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  }
135  assert(m_calorimeterType!=UNASSIGNED);
136 }
eflowRecCluster
This class extends the information about a xAOD::CaloCluster.
Definition: eflowRecCluster.h:40
CaloClusterKineHelper.h
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
CaloCell_ID_FCS::TileExt2
@ TileExt2
Definition: FastCaloSim_CaloCell_ID.h:39
get_generator_info.result
result
Definition: get_generator_info.py:21
xAOD::CaloCluster_v1::setRawM
void setRawM(flt_t)
Set mass for singal state UNCALIBRATED.
Definition: CaloCluster_v1.cxx:299
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
eflowRecCluster::setClusterType
void setClusterType()
Definition: eflowRecCluster.cxx:86
eflowRecCluster::m_calorimeterType
int m_calorimeterType
Definition: eflowRecCluster.h:108
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
CaloCell_ID_FCS::TileExt0
@ TileExt0
Definition: FastCaloSim_CaloCell_ID.h:37
xAOD::CaloCluster_v1::calE
flt_t calE() const
Geet Energy in signal state CALIBRATED.
CaloCell_ID_FCS::TileBar1
@ TileBar1
Definition: FastCaloSim_CaloCell_ID.h:32
eflowRecCluster::getSumExpectedEnergy
double getSumExpectedEnergy()
Definition: eflowRecCluster.cxx:69
xAOD::CaloCluster_v1::calEta
flt_t calEta() const
Get in signal state CALIBRATED.
CaloCell_ID_FCS::FCAL1
@ FCAL1
Definition: FastCaloSim_CaloCell_ID.h:41
CaloCell_ID_FCS::HEC2
@ HEC2
Definition: FastCaloSim_CaloCell_ID.h:29
xAOD::CaloCluster_v1::calM
flt_t calM() const
Get mass in signal state CALIBRATED.
CaloCell_ID_FCS::TileGap3
@ TileGap3
Definition: FastCaloSim_CaloCell_ID.h:36
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
eflowRecCluster::UNASSIGNED
@ UNASSIGNED
Definition: eflowRecCluster.h:99
eflowRecTrack.h
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
eflowRecCluster::m_matchCluster
std::unique_ptr< eflowMatchCluster > m_matchCluster
Definition: eflowRecCluster.h:119
eflowRecCluster::eflowRecCluster
eflowRecCluster(const ElementLink< xAOD::CaloClusterContainer > &clusElementLink, xAOD::CaloClusterContainer &newClusContainer)
Definition: eflowRecCluster.cxx:17
xAOD::CaloCluster_v1::setRawE
void setRawE(flt_t)
Set Energy for signal state UNCALIBRATED.
Definition: CaloCluster_v1.cxx:284
CaloCell_ID_FCS::HEC1
@ HEC1
Definition: FastCaloSim_CaloCell_ID.h:28
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
eflowRecCluster::m_clusElementLink
ElementLink< xAOD::CaloClusterContainer > m_clusElementLink
Definition: eflowRecCluster.h:111
eflowRecCluster::m_trackMatches
std::vector< eflowTrackClusterLink * > m_trackMatches
Definition: eflowRecCluster.h:120
CaloCell_ID_FCS::TileBar0
@ TileBar0
Definition: FastCaloSim_CaloCell_ID.h:31
CaloCell_ID_FCS::TileGap2
@ TileGap2
Definition: FastCaloSim_CaloCell_ID.h:35
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
xAOD::CaloCluster_v1::setRawEta
void setRawEta(flt_t)
Set for signal state UNCALIBRATED.
Definition: CaloCluster_v1.cxx:289
eflowRecCluster::getNTracks
int getNTracks() const
Definition: eflowRecCluster.h:78
xAOD::CaloCluster_v1::calPhi
flt_t calPhi() const
Get in signal state CALIBRATED.
xAOD::CaloCluster_v1::Topo_420
@ Topo_420
Definition: CaloCluster_v1.h:102
eflowRecCluster.h
eflowRecCluster::m_cluster
xAOD::CaloCluster * m_cluster
Definition: eflowRecCluster.h:109
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CaloCell_ID_FCS::TileGap1
@ TileGap1
Definition: FastCaloSim_CaloCell_ID.h:34
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
Definition: CaloCluster_v1.cxx:905
eflowRecCluster::UNKNOWN
@ UNKNOWN
Definition: eflowRecCluster.h:103
eflowRecCluster::isEOverPFail
bool isEOverPFail(bool consistencySigmaCut, bool useGoldenMode)
Definition: eflowRecCluster.cxx:53
CaloCell_ID_FCS::TileExt1
@ TileExt1
Definition: FastCaloSim_CaloCell_ID.h:38
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
eflowRecCluster::~eflowRecCluster
virtual ~eflowRecCluster()
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
xAOD::CaloCluster_v1::eSample
float eSample(const CaloSample sampling) const
Definition: CaloCluster_v1.cxx:521
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
xAOD::CaloCluster_v1::addCellLink
void addCellLink(CaloClusterCellLink *CCCL)
Definition: CaloCluster_v1.h:721
xAOD::CaloCluster_v1::setClusterSize
void setClusterSize(const ClusterSize)
Get cluster size.
Definition: CaloCluster_v1.cxx:369
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
eflowMatchCluster
This class, which inherits from the pure virtual ICluster, stores a pointer to an eflowRecCluster.
Definition: eflowRecCluster.h:140
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
CaloCell_ID_FCS::FCAL2
@ FCAL2
Definition: FastCaloSim_CaloCell_ID.h:42
CaloCell_ID_FCS::HEC3
@ HEC3
Definition: FastCaloSim_CaloCell_ID.h:30
eflowRecCluster::HCAL
@ HCAL
Definition: eflowRecCluster.h:101
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
CaloCell_ID_FCS::TileBar2
@ TileBar2
Definition: FastCaloSim_CaloCell_ID.h:33
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
eflowRecCluster::ECAL
@ ECAL
Definition: eflowRecCluster.h:100
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
eflowRecCluster::getVarianceOfSumExpectedEnergy
double getVarianceOfSumExpectedEnergy()
Definition: eflowRecCluster.cxx:77
xAOD::CaloCluster_v1::setRawPhi
void setRawPhi(flt_t)
Set for signal state UNCALIBRATED.
Definition: CaloCluster_v1.cxx:294
eflowRecCluster::FCAL
@ FCAL
Definition: eflowRecCluster.h:102