ATLAS Offline Software
Loading...
Searching...
No Matches
CaloConstitHelpers::FlowElementExtractor Struct Reference
Inheritance diagram for CaloConstitHelpers::FlowElementExtractor:
Collaboration diagram for CaloConstitHelpers::FlowElementExtractor:

Public Member Functions

virtual ~FlowElementExtractor ()=default
virtual bool valid (JetConstitIterator &it) const override
virtual double moment (JetConstitIterator &it, xAOD::CaloCluster::MomentType momentType) const override
virtual double time (JetConstitIterator &it) const override
virtual double energyHEC (JetConstitIterator &it) const override

Detailed Description

Definition at line 91 of file JetCaloCalculations.cxx.

Constructor & Destructor Documentation

◆ ~FlowElementExtractor()

virtual CaloConstitHelpers::FlowElementExtractor::~FlowElementExtractor ( )
virtualdefault

Member Function Documentation

◆ energyHEC()

virtual double CaloConstitHelpers::FlowElementExtractor::energyHEC ( JetConstitIterator & it) const
inlineoverridevirtual

Reimplemented from CaloConstitHelpers::CaloConstitExtractor.

Definition at line 139 of file JetCaloCalculations.cxx.

139 {
140 const xAOD::FlowElement* fe = static_cast<const xAOD::FlowElement*>(it->rawConstituent());
141
142 // Add up the four individual HEC layers
143 const static SG::AuxElement::ConstAccessor<float> accHEC0("LAYERENERGY_HEC0");
144 const static SG::AuxElement::ConstAccessor<float> accHEC1("LAYERENERGY_HEC1");
145 const static SG::AuxElement::ConstAccessor<float> accHEC2("LAYERENERGY_HEC2");
146 const static SG::AuxElement::ConstAccessor<float> accHEC3("LAYERENERGY_HEC3");
147
148 float sum_HEC = 0.0;
149
150 // The variables are available for PFOs but not UFOs
151 if(accHEC0.isAvailable(*fe) && accHEC1.isAvailable(*fe) && accHEC2.isAvailable(*fe) && accHEC3.isAvailable(*fe)){
152 sum_HEC = accHEC0(*fe) + accHEC1(*fe) + accHEC2(*fe) + accHEC3(*fe);
153 }
154 else{
155 for (size_t n = 0; n < fe->otherObjects().size(); ++n) {
156 if(! fe->otherObject(n)) continue;
157 const auto* neutralObject = (fe->otherObject(n));
158
159 const xAOD::CaloCluster* cluster = nullptr;
160
161 //If we have a cluster, we can directly access the calorimeter information
162 if(neutralObject->type() == xAOD::Type::CaloCluster){
163 cluster = dynamic_cast<const xAOD::CaloCluster*> (neutralObject);
164 }
165 //If we have a PFO (in case of fe being a UFO), we need to get the associated cluster first
166 else {
167 const xAOD::FlowElement* pfo = dynamic_cast<const xAOD::FlowElement*>(neutralObject);
168 if(!pfo->otherObjects().empty() && pfo->otherObject(0) && pfo->otherObject(0)->type() == xAOD::Type::CaloCluster){
169 cluster = dynamic_cast<const xAOD::CaloCluster*> (pfo->otherObject(0));
170 }
171 }
172 if(cluster){
173 sum_HEC += cluster->eSample( CaloSampling::HEC0 ) + cluster->eSample( CaloSampling::HEC1 ) + cluster->eSample( CaloSampling::HEC2 ) + cluster->eSample( CaloSampling::HEC3 );
174 }
175 }
176 }
177 return sum_HEC;
178 }
float eSample(const CaloSample sampling) const
std::vector< const xAOD::IParticle * > otherObjects() const
const xAOD::IParticle * otherObject(std::size_t i) const
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16

◆ moment()

virtual double CaloConstitHelpers::FlowElementExtractor::moment ( JetConstitIterator & it,
xAOD::CaloCluster::MomentType momentType ) const
inlineoverridevirtual

Reimplemented from CaloConstitHelpers::CaloConstitExtractor.

Definition at line 99 of file JetCaloCalculations.cxx.

99 {
100 float m=0.;
101 const xAOD::FlowElement* fe = static_cast<const xAOD::FlowElement*>(it->rawConstituent());
102 FEHelpers::getClusterMoment(*fe, momentType, m);
103 return m;
104 }
bool getClusterMoment(const xAOD::FlowElement &fe, xAOD::CaloCluster::MomentType momentType, float &value)
Definition FEHelpers.cxx:51

◆ time()

virtual double CaloConstitHelpers::FlowElementExtractor::time ( JetConstitIterator & it) const
inlineoverridevirtual

Reimplemented from CaloConstitHelpers::CaloConstitExtractor.

Definition at line 106 of file JetCaloCalculations.cxx.

106 {
107 const xAOD::FlowElement* fe = static_cast<const xAOD::FlowElement*>(it->rawConstituent());
108 const static SG::AuxElement::ConstAccessor<float> accTiming("TIMING");
109
110 float timing = -1;
111
112 if(accTiming.isAvailable(*fe)){
113 timing = accTiming(*fe);
114 }
115 else{
116 if(fe->otherObjects().size() == 1 && fe->otherObject(0)){
117 const auto* neutralObject = (fe->otherObject(0));
118 const xAOD::CaloCluster* cluster = nullptr;
119
120 if(neutralObject->type() == xAOD::Type::CaloCluster){
121 cluster = dynamic_cast<const xAOD::CaloCluster*> (neutralObject);
122 }
123 //If we have a PFO (in case of fe being a UFO), we need to get the associated cluster first
124 else {
125 const xAOD::FlowElement* pfo = dynamic_cast<const xAOD::FlowElement*>(neutralObject);
126 if(!pfo->otherObjects().empty() && pfo->otherObject(0) && pfo->otherObject(0)->type() == xAOD::Type::CaloCluster){
127 cluster = dynamic_cast<const xAOD::CaloCluster*> (pfo->otherObject(0));
128 }
129 }
130
131 if(cluster){
132 timing = cluster->time();
133 }
134 }
135 }
136 return timing;
137 }
flt_t time() const
Access cluster time.

◆ valid()

virtual bool CaloConstitHelpers::FlowElementExtractor::valid ( JetConstitIterator & it) const
inlineoverridevirtual

Reimplemented from CaloConstitHelpers::CaloConstitExtractor.

Definition at line 93 of file JetCaloCalculations.cxx.

93 {
94 const xAOD::FlowElement* fe = dynamic_cast<const xAOD::FlowElement*>(it->rawConstituent());
95 if (fe != nullptr) return (!fe->isCharged());
96 return false;
97 }

The documentation for this struct was generated from the following file: