ATLAS Offline Software
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 
16 namespace xAOD {
17 
24  : IParticle() {
25 
26  }
27 
29  //
30  // Implementation of the functions inherited from IParticle
31  //
32 
34 
35 
36  double TrigElectron_v1::e() const {
42 
43  return genvecP4().E();
44  }
45 
52  double TrigElectron_v1::rapidity() const {
53 
54  return genvecP4().Rapidity();
55  }
56 
63  FourMom_t p4;
64  p4.SetPtEtaPhiM( pt(), eta(), phi(),m());
65  return p4;
66  }
67 
70  return GenVecFourMom_t(pt(), eta(), phi(), m());
71  }
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 
138  AUXSTORE_PRIMITIVE_SETTER_WITH_CAST( TrigElectron_v1, float, double, pt,
139  setPt )
140 
141  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( TrigElectron_v1, float, caloEta,
142  setCaloEta )
143  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( TrigElectron_v1, float, caloPhi,
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 
182  AUXSTORE_OBJECT_SETTER_AND_GETTER( TrigElectron_v1,
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 
215  AUXSTORE_OBJECT_SETTER_AND_GETTER( TrigElectron_v1,
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
xAOD::EgammaParameters::ehad1
@ ehad1
E leakage into 1st sampling of had calo (CaloSampling::HEC0 + CaloSampling::TileBar0 + CaloSampling::...
Definition: EgammaEnums.h:48
xAOD::AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
xAOD::TrigElectron_v1::setEratio
void setEratio(float eratio)
Documentation to be added.
xAOD::eratio
setCharge setNTRTHiThresholdHits eratio
Definition: TrigElectron_v1.cxx:96
xAOD::TrigElectron_v1
Class describing an electron reconstructed in the HLT.
Definition: TrigElectron_v1.h:39
xAOD::TrigElectron_v1::e
virtual double e() const
The total energy of the particle.
Definition: TrigElectron_v1.cxx:41
get_generator_info.result
result
Definition: get_generator_info.py:21
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
xAOD::TrigElectron_v1::GenVecFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > GenVecFourMom_t
Base 4 Momentum type for egamma.
Definition: TrigElectron_v1.h:65
xAOD::trkPhiAtCalo
setCharge setNTRTHiThresholdHits setEratio setEtHad1 trkPhiAtCalo
Definition: TrigElectron_v1.cxx:118
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
AuxStoreAccessorMacros.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigEMCluster::e2tsts1
float e2tsts1() const
get second maximum energy in sampling 1 (strip layer)
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:133
xAOD::TrigElectron_v1::setPt
void setPt(double pt)
Set the transverse momentum ( ) of the electron.
TrigEMCluster::phi
float phi() const
get Phi (calibrated)
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:116
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::TrigElectron_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::numberOfTRTHits
@ numberOfTRTHits
number of TRT hits [unit8_t].
Definition: TrackingPrimitives.h:275
TrigEMCluster
Class with calibrated variables for egamma clustering.
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:31
xAOD::pt
setRcore setEtHad setFside pt
Definition: TrigPhoton_v1.cxx:106
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
xAOD::TrigElectron_v1::emCluster
const TrigEMCluster * emCluster() const
The associated EM cluster, as a simple pointer.
TrigEMCluster::e277
float e277() const
get Energy in a 7x7 cluster (no calibration) around hottest cell
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:120
xAOD::TrigElectron_v1::setTrackParticleLink
void setTrackParticleLink(const TrackParticleLink_t &value)
Set the ElementLink pointing to the track particle constituent.
xAOD::TrigElectron_v1::setRoiWord
void setRoiWord(uint32_t roi)
Set the RoI word that seeded the reconstruction of this object.
xAOD::numberOfTRTHighThresholdHits
@ numberOfTRTHighThresholdHits
number of TRT hits which pass the high threshold (only xenon counted) [unit8_t].
Definition: TrackingPrimitives.h:278
xAOD::TrigElectron_v1::setNTRTHiThresholdHits
void setNTRTHiThresholdHits(int nTRTHiThresholdHits)
Set the number of high-threshold TRT hits used in the reconstruction.
xAOD::TrigElectron_v1::setF1
void setF1(float value)
Documentation to be added.
xAOD::etHad
setRcore etHad
Definition: TrigPhoton_v1.cxx:83
xAOD::IParticle::FourMom_t
TLorentzVector FourMom_t
Definition of the 4-momentum type.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:68
read_hist_ntuple.f2
f2
Definition: read_hist_ntuple.py:20
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::TrigElectron_v1::trkEtaAtCalo
float trkEtaAtCalo() const
Get the track's pseudorapidity extrapolated to the calorimeter.
xAOD::EgammaParameters::f3
@ f3
fraction of energy reconstructed in 3rd sampling
Definition: EgammaEnums.h:54
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
xAOD::AUXSTORE_PRIMITIVE_SETTER_WITH_CAST
AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CompositeParticle_v1, float, double, px, setPx) AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CompositeParticle_v1
xAOD::TrigElectron_v1::setF0
void setF0(float value)
Documentation to be added.
TrigEMCluster::e237
float e237() const
get Energy in a 3x7 cluster (no calibration) around hottest cell
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:118
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
xAOD::e2tsts1
setEt setPhi setE277 setWeta2 setEta1 e2tsts1
Definition: TrigEMCluster_v1.cxx:45
xAOD::TrigElectron_v1::trkPhiAtCalo
float trkPhiAtCalo() const
Get the track's azimuthal angle extrapolated to the calorimeter.
xAOD::AUXSTORE_PRIMITIVE_GETTER_WITH_CAST
AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(Muon_v1, uint8_t, Muon_v1::EnergyLossType, energyLossType) AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(Muon_v1
xAOD::charge
charge
Definition: TrigElectron_v1.cxx:85
xAOD::TrigElectron_v1::setEmClusterLink
void setEmClusterLink(const EMClusterLink_t &value)
Set the ElementLink pointing to the EM cluster constituent.
xAOD::TrigElectron_v1::setTrkPhiAtCalo
void setTrkPhiAtCalo(float trPhi)
Set the track's azimuthal angle extrapolated to the calorimeter.
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
xAOD::TrigElectron_v1::setCharge
void setCharge(float charge)
Set the charge of the electron.
xAOD::TrigElectron_v1::etOverPt
float etOverPt() const
Get for the electron.
xAOD::e277
setEt setPhi e277
Definition: TrigEMCluster_v1.cxx:33
xAOD::TrigElectron_v1::setNTRTHits
void setNTRTHits(int nTRTHits)
Set the number of TRT hits that were used in the reconstruction.
xAOD::caloPhi
setRcore setEtHad setFside setPt caloPhi
Definition: TrigPhoton_v1.cxx:111
TrigEMCluster::eta
float eta() const
get Eta (calibrated)
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:114
xAOD::TrigElectron_v1::EMClusterLink_t
ElementLink< TrigEMClusterContainer > EMClusterLink_t
Type of the EM cluster link.
Definition: TrigElectron_v1.h:188
xAOD::TrigElectron_v1::TrackParticleLink_t
ElementLink< TrackParticleContainer > TrackParticleLink_t
The type of the track particle link.
Definition: TrigElectron_v1.h:198
TrigEMCluster::ehad1
float ehad1() const
get hadronic Energy (first hadronic layer)
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:127
TrigEMCluster::energy
float energy() const
get Energy (calibrated)
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:102
xAOD::etHad1
setCharge setNTRTHiThresholdHits setEratio etHad1
Definition: TrigElectron_v1.cxx:100
xAOD::TrigElectron_v1::m
virtual double m() const
The invariant mass of the particle.
Definition: TrigElectron_v1.h:55
xAOD::TrigElectron_v1::setCaloEta
void setCaloEta(float caloEta)
Set the pseudorapidity ( ) of the electron in the calorimeter.
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
xAOD::TrigElectron_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: TrigElectron_v1.h:53
xAOD::TrigElectron_v1::setCaloPhi
void setCaloPhi(float caloPhi)
Set the azimuthal angle ( ) of the electron in the calorimeter.
xAOD::TrigElectron_v1::init
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.
xAOD::TrigElectron_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: TrigElectron_v1.h:51
xAOD::rcore
rcore
Definition: TrigPhoton_v1.cxx:79
xAOD::TrigElectron_v1::genvecP4
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : internal egamma type.
Definition: TrigElectron_v1.cxx:69
xAOD::TrigElectron_v1::setF3
void setF3(float value)
Documentation to be added.
TrigEMCluster::emaxs1
float emaxs1() const
get maximum energy in sampling 1 (strip layer)
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:131
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
xAOD::TrigElectron_v1::setTrkEtaAtCalo
void setTrkEtaAtCalo(float trEta)
Set the track's pseudorapidity extrapolated to the calorimeter.
xAOD::TrigElectron_v1::trkClusDphi
float trkClusDphi() const
The absolute value of the track-calo phi measurement difference.
xAOD::TrigElectron_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: TrigElectron_v1.cxx:62
xAOD::TrigElectron_v1::caloPhi
float caloPhi() const
Azimuthal angle ( ) of the electron in the calorimeter.
xAOD::EgammaParameters::e237
@ e237
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x7
Definition: EgammaEnums.h:77
xAOD::nTRTHiThresholdHits
setCharge nTRTHiThresholdHits
Definition: TrigElectron_v1.cxx:91
xAOD::TrigElectron_v1::trackParticle
const TrackParticle * trackParticle() const
The associated track particle, as a simple pointer.
xAOD::TrigElectron_v1::setRcore
void setRcore(float rcore)
Documentation to be added.
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
xAOD::TrigElectron_v1::TrigElectron_v1
TrigElectron_v1()
Default constructor.
Definition: TrigElectron_v1.cxx:23
xAOD::EgammaParameters::emaxs1
@ emaxs1
energy of strip with maximal energy deposit
Definition: EgammaEnums.h:145
xAOD::TrigElectron_v1::setZvtx
void setZvtx(float zVtx)
Set the Z position of the vertex that the electron is associated to.
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
xAOD::TrigElectron_v1::caloEta
float caloEta() const
Pseudorapidity ( ) of the electron in the calorimeter.
xAOD::TrigElectron_v1::setEtHad1
void setEtHad1(float etHad1)
Documentation to be added.
xAOD::TrigElectron_v1::setEtHad
void setEtHad(float etHad)
Documentation to be added.
xAOD::TrigElectron_v1::rapidity
virtual double rapidity() const
The true rapidity (y) of the particle.
Definition: TrigElectron_v1.cxx:52
xAOD::AUXSTORE_OBJECT_SETTER_AND_GETTER
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1
Definition: CaloRings_v1.cxx:27
read_hist_ntuple.f1
f1
Definition: read_hist_ntuple.py:4
xAOD::TrigElectron_v1::setEtOverPt
void setEtOverPt(float etOverpt)
Set for the electron.
TrigEMCluster::et
float et() const
get Et (calibrated)
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMCluster.h:106
TrigElectron_v1.h
xAOD::TrigElectron_v1::setF2
void setF2(float value)
Documentation to be added.