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 92 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 140 of file JetCaloCalculations.cxx.

140 {
141 const xAOD::FlowElement* fe = static_cast<const xAOD::FlowElement*>(it->rawConstituent());
142
143 // Add up the four individual HEC layers
144 const static SG::AuxElement::ConstAccessor<float> accHEC0("LAYERENERGY_HEC0");
145 const static SG::AuxElement::ConstAccessor<float> accHEC1("LAYERENERGY_HEC1");
146 const static SG::AuxElement::ConstAccessor<float> accHEC2("LAYERENERGY_HEC2");
147 const static SG::AuxElement::ConstAccessor<float> accHEC3("LAYERENERGY_HEC3");
148
149 float sum_HEC = 0.0;
150
151 // The variables are available for PFOs but not UFOs
152 if(accHEC0.isAvailable(*fe) && accHEC1.isAvailable(*fe) && accHEC2.isAvailable(*fe) && accHEC3.isAvailable(*fe)){
153 sum_HEC = accHEC0(*fe) + accHEC1(*fe) + accHEC2(*fe) + accHEC3(*fe);
154 }
155 else{
156 for (size_t n = 0; n < fe->otherObjects().size(); ++n) {
157 if(! fe->otherObject(n)) continue;
158 const auto* neutralObject = (fe->otherObject(n));
159
160 const xAOD::CaloCluster* cluster = nullptr;
161
162 //If we have a cluster, we can directly access the calorimeter information
163 if(neutralObject->type() == xAOD::Type::CaloCluster){
164 cluster = dynamic_cast<const xAOD::CaloCluster*> (neutralObject);
165 }
166 //If we have a PFO (in case of fe being a UFO), we need to get the associated cluster first
167 else {
168 const xAOD::FlowElement* pfo = static_cast<const xAOD::FlowElement*>(neutralObject);
169 if(!pfo->otherObjects().empty() && pfo->otherObject(0) && pfo->otherObject(0)->type() == xAOD::Type::CaloCluster){
170 cluster = dynamic_cast<const xAOD::CaloCluster*> (pfo->otherObject(0));
171 }
172 }
173 if(cluster){
174 sum_HEC += cluster->eSample( CaloSampling::HEC0 ) + cluster->eSample( CaloSampling::HEC1 ) + cluster->eSample( CaloSampling::HEC2 ) + cluster->eSample( CaloSampling::HEC3 );
175 }
176 }
177 }
178 return sum_HEC;
179 }
size_t size() const
Number of registered mappings.
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 100 of file JetCaloCalculations.cxx.

100 {
101 float m=0.;
102 const xAOD::FlowElement* fe = static_cast<const xAOD::FlowElement*>(it->rawConstituent());
103 FEHelpers::getClusterMoment(*fe, momentType, m);
104 return m;
105 }
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 107 of file JetCaloCalculations.cxx.

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

◆ valid()

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

Reimplemented from CaloConstitHelpers::CaloConstitExtractor.

Definition at line 94 of file JetCaloCalculations.cxx.

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

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