ATLAS Offline Software
Loading...
Searching...
No Matches
TrigElectron_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: TrigElectron_v1.cxx 797628 2017-02-16 21:31:00Z rwhite $
6
7// System include(s):
8#include <cmath>
9
10// EDM include(s):
12
13// Local include(s):
15
16namespace xAOD {
17
27
29 //
30 // Implementation of the functions inherited from IParticle
31 //
32
34
35
42
43 return genvecP4().E();
44 }
45
53
54 return genvecP4().Rapidity();
55 }
56
64 p4.SetPtEtaPhiM( pt(), eta(), phi(),m());
65 return p4;
66 }
67
72
73 //
75
77 //
78 // Implementation of the "simple" electron properties
79 //
80
82 setRoiWord )
83
86 setCharge )
87
89 setNTRTHits )
92 setNTRTHiThresholdHits )
93
95 setRcore )
97 setEratio )
99 setEtHad )
101 setEtHad1 )
102
107
108 //
110
112 //
113 // Implementation of the 4-momentum handling functions
114 //
115
117 setTrkEtaAtCalo )
119 setTrkPhiAtCalo )
120
122 setEtOverPt )
123
124 float TrigElectron_v1::trkClusDeta() const {
125
126 return std::abs( trkEtaAtCalo() - caloEta() );
127 }
128
129 float TrigElectron_v1::trkClusDphi() const {
130
131 float result = std::abs( trkPhiAtCalo() - caloPhi() );
132 if( ! ( result < M_PI ) ) {
133 result = 2 * M_PI - result;
134 }
135 return result;
136 }
137
139 setPt )
140
142 setCaloEta )
144 setCaloPhi )
145
146 //
148
150 //
151 // Implementation of the constituent accessor functions
152 //
153
154
163
164 // The link accessor:
165 static const Accessor< EMClusterLink_t > acc( "emClusterLink" );
166
167 // Check if the link is available:
168 if( ! acc.isAvailable( *this ) ) {
169 return nullptr;
170 }
171
172 // Check if the link is valid:
173 const EMClusterLink_t& link = acc( *this );
174 if( ! link.isValid() ) {
175 return nullptr;
176 }
177
178 // Return the pointer:
179 return *link;
180 }
181
184 emClusterLink,
185 setEmClusterLink )
186
187
196
197 // The link accessor:
198 static const Accessor< TrackParticleLink_t > acc( "trackParticleLink" );
199
200 // Check if the link is available:
201 if( ! acc.isAvailable( *this ) ) {
202 return nullptr;
203 }
204
205 // Check if the link is valid:
206 const TrackParticleLink_t& link = acc( *this );
207 if( ! link.isValid() ) {
208 return nullptr;
209 }
210
211 // Return the pointer:
212 return *link;
213 }
214
217 trackParticleLink,
218 setTrackParticleLink )
219
220 //
222
234 float trkEtaAtCalo, float trkPhiAtCalo,
235 float etOverPt,
236 const EMClusterLink_t& clLink,
237 const TrackParticleLink_t& tpLink ) {
238
239 setRoiWord( roi );
240 setZvtx( 0 );
241 setCharge( 0 );
242 setNTRTHits( 0 );
247 setCaloEta( 0 );
248 setCaloPhi( 0 );
249 setEtHad( 0 );
250 setEtHad1( 0 );
251 setRcore( 0 );
252 setEratio( 0 );
253 setF0( 0 );
254 setF1( 0 );
255 setF2( 0 );
256 setF3( 0 );
257
258 // Links to associated trigger track and EM cluster.
259 setTrackParticleLink( tpLink );
260 setEmClusterLink( clLink );
261
262 // Stash tracking variables
263 if( tpLink.isValid() ) {
264
265 // Get the pointer:
266 const TrackParticle* tpPtr = *tpLink;
267
268 // get track author and nr. trt hits from track
269 // setTrackAlgo(*tr_ptr->algorithmId()); ----> this is clearly wrong, but I still don't know about ELs...
270 // All of this code needs to be updated to modern interface one-at-a-time.
271 uint8_t TRThits;
272 if( tpPtr->summaryValue( TRThits, xAOD::numberOfTRTHits ) ) {
273 setNTRTHits( TRThits );
274 }
275
276 uint8_t TRTThresholdhits;
277 if( tpPtr->summaryValue( TRTThresholdhits,
279 setNTRTHiThresholdHits( TRTThresholdhits );
280 }
281
282 // Initialize 4-momentum base-class angular quantities from track
283 // data: assume that track parameters at perigee give better
284 // estimates of angular quantities near vertex
285 setZvtx( tpPtr->z0() );
286 setCharge( tpPtr->charge() ); // is this correct? Needs to be checked by Calo experts
287 }
288
289 // Stash calo cluster variables.
290 if( clLink.isValid() ) {
291
292 // Get the pointer:
293 const TrigEMCluster* clPtr = *clLink;
294
295 /* Initialize 4-momentum base-class ET from cluster data: assume
296 cluster quantities give better estimate of transverse energy */
297 setPt( clPtr->et() );
298
299 // eta-phi of cluster
300 setCaloEta( clPtr->eta() );
301 setCaloPhi( clPtr->phi() );
302
303 // EThad
304 if( caloEta() != 0 ) {
305 const float ehad1 = clPtr->ehad1();
306 const float abseta = std::abs( caloEta() );
307 const float cl_EThad = ehad1 / std::cosh( abseta ); // Ehad1/cosh(fabs(eta) */
308 setEtHad( cl_EThad );
309 setEtHad1( cl_EThad );
310 } else {
311 setEtHad( clPtr->ehad1() ); // Ehad (=EThad1)
312 setEtHad1( clPtr->ehad1() ); // Ehad1 (=EThad)
313 }
314
315 // Rcore (test for positive energy to avoid zeros)
316 const float e277 = clPtr->e277();
317 const float e237 = clPtr->e237();
318 if( e277 != 0 ) { // (VD) before it was '>'
319 setRcore( e237 / e277 );
320 } else {
321 setRcore( 0 );
322 }
323
324 // Eratio (test for positive energy to avoid zeros)
325 const float emaxs1 = clPtr->emaxs1();
326 const float e2tsts1 = clPtr->e2tsts1();
327 if( emaxs1 + e2tsts1 > 0 ) {
328 const float cl_Eratio = ( ( emaxs1 - e2tsts1 ) /
329 ( emaxs1 + e2tsts1 ) );
330 setEratio( cl_Eratio );
331 } else {
332 setEratio( 0 );
333 }
334
335 // energy and energy fraction per sample
336 const float tmp_cl_energy = clPtr->energy();
337
338 if( std::abs( tmp_cl_energy ) > 0.00001 ) { // avoid floating-point exceptions
339
340 const float cl_e_frac_S0 =
341 ( clPtr->energy( CaloSampling::PreSamplerB ) +
342 clPtr->energy( CaloSampling::PreSamplerE ) ) / tmp_cl_energy;
343 setF0( cl_e_frac_S0 );
344
345 const float cl_e_frac_S1 =
346 ( clPtr->energy( CaloSampling::EMB1 ) +
347 clPtr->energy( CaloSampling::EME1 ) ) / tmp_cl_energy;
348 setF1( cl_e_frac_S1 );
349
350 const float cl_e_frac_S2 =
351 ( clPtr->energy( CaloSampling::EMB2 ) +
352 clPtr->energy( CaloSampling::EME2 ) ) / tmp_cl_energy;
353 setF2( cl_e_frac_S2 );
354
355 const float cl_e_frac_S3 =
356 ( clPtr->energy( CaloSampling::EMB3 ) +
357 clPtr->energy( CaloSampling::EME3 ) ) / tmp_cl_energy;
358 setF3( cl_e_frac_S3 );
359
360 } else {
361 setF0(0);
362 setF1(0);
363 setF2(0);
364 setF3(0);
365 }
366
367 }
368
369 return;
370 }
371
372} // namespace xAOD
#define M_PI
#define AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME)
Macro creating a getter function with a type conversion.
#define AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME, SETTER)
Macro creating a setter function with a type conversion.
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of complex auxiliary properties.
INav4MomToTrackParticleAssocs::asso_link TrackParticleLink_t
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
float ehad1() const
get hadronic Energy (first hadronic layer)
float emaxs1() const
get maximum energy in sampling 1 (strip layer)
float e2tsts1() const
get second maximum energy in sampling 1 (strip layer)
float e277() const
get Energy in a 7x7 cluster (no calibration) around hottest cell
float e237() const
get Energy in a 3x7 cluster (no calibration) around hottest cell
IParticle()=default
TLorentzVector FourMom_t
Definition of the 4-momentum type.
Class describing an electron reconstructed in the HLT.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
const TrigEMCluster * emCluster() const
The associated EM cluster, as a simple pointer.
void setEratio(float eratio)
Documentation to be added.
void setNTRTHiThresholdHits(int nTRTHiThresholdHits)
Set the number of high-threshold TRT hits used in the reconstruction.
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > GenVecFourMom_t
Base 4 Momentum type for egamma.
float trkEtaAtCalo() const
Get the track's pseudorapidity extrapolated to the calorimeter.
virtual double phi() const
The azimuthal angle ( ) of the particle.
void setZvtx(float zVtx)
Set the Z position of the vertex that the electron is associated to.
float trkPhiAtCalo() const
Get the track's azimuthal angle extrapolated to the calorimeter.
void setCaloEta(float caloEta)
Set the pseudorapidity ( ) of the electron in the calorimeter.
virtual double rapidity() const
The true rapidity (y) of the particle.
void setF0(float value)
Documentation to be added.
virtual double e() const
The total energy of the particle.
float etOverPt() const
Get for the electron.
void setEtOverPt(float etOverpt)
Set for the electron.
void setF3(float value)
Documentation to be added.
ElementLink< TrackParticleContainer > TrackParticleLink_t
The type of the track particle link.
void setTrkPhiAtCalo(float trPhi)
Set the track's azimuthal angle extrapolated to the calorimeter.
void setTrkEtaAtCalo(float trEta)
Set the track's pseudorapidity extrapolated to the calorimeter.
virtual double eta() const
The pseudorapidity ( ) of the particle.
void setF2(float value)
Documentation to be added.
void setF1(float value)
Documentation to be added.
void setNTRTHits(int nTRTHits)
Set the number of TRT hits that were used in the reconstruction.
void setTrackParticleLink(const TrackParticleLink_t &value)
Set the ElementLink pointing to the track particle constituent.
void setEmClusterLink(const EMClusterLink_t &value)
Set the ElementLink pointing to the EM cluster constituent.
ElementLink< TrigEMClusterContainer > EMClusterLink_t
Type of the EM cluster link.
virtual double pt() const
The transverse momentum ( ) of the particle.
float caloEta() const
Pseudorapidity ( ) of the electron in the calorimeter.
void setRcore(float rcore)
Documentation to be added.
void setCaloPhi(float caloPhi)
Set the azimuthal angle ( ) of the electron in the calorimeter.
const TrackParticle * trackParticle() const
The associated track particle, as a simple pointer.
void setRoiWord(uint32_t roi)
Set the RoI word that seeded the reconstruction of this object.
void init(uint32_t roi, float trkEtaAtCalo, float trkPhiAtCalo, float etOverPt, const EMClusterLink_t &clLink, const TrackParticleLink_t &tpLink)
Initialisation function, setting most properties of the object.
void setCharge(float charge)
Set the charge of the electron.
virtual double m() const
The invariant mass of the particle.
void setPt(double pt)
Set the transverse momentum ( ) of the electron.
void setEtHad(float etHad)
Documentation to be added.
TrigElectron_v1()
Default constructor.
void setEtHad1(float etHad1)
Documentation to be added.
float caloPhi() const
Azimuthal angle ( ) of the electron in the calorimeter.
float trkClusDphi() const
The absolute value of the track-calo phi measurement difference.
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : internal egamma type.
@ e237
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x7
Definition EgammaEnums.h:78
@ emaxs1
energy of strip with maximal energy deposit
@ ehad1
E leakage into 1st sampling of had calo (CaloSampling::HEC0 + CaloSampling::TileBar0 + CaloSampling::...
Definition EgammaEnums.h:49
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setCharge nTRTHiThresholdHits
setRcore setEtHad setFside pt
TrackParticle_v1 TrackParticle
Reference the current persistent version:
setEt setPhi setE277 setWeta2 setEta1 e2tsts1
setRcore setEtHad setFside setPt caloPhi
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
TrigEMCluster_v1 TrigEMCluster
Define the latest version of the trigger EM cluster class.
setCharge setNTRTHiThresholdHits setEratio etHad1
setRcore etHad
setEt setPhi e277
setCharge setNTRTHiThresholdHits setEratio setEtHad1 trkPhiAtCalo
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfTRTHighThresholdHits
number of TRT hits which pass the high threshold (only xenon counted) [unit8_t].
setEventNumber uint32_t
setCharge setNTRTHiThresholdHits eratio