ATLAS Offline Software
Loading...
Searching...
No Matches
CaloTower_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5
8#include <cmath>
9
10namespace{
11const double s_towerMass{0.};
12}
13
17
18
21
22void xAOD::CaloTower_v1::addEnergy(double energy) {
23 f_ref_e() += energy;
24}
25
26void xAOD::CaloTower_v1::setEnergy(double energy) {
27 f_ref_e() = energy;
28}
29
31 f_ref_e() = 0.;
32}
33
34
35
36double xAOD::CaloTower_v1::e() const { return f_val_e(); }
37
38double xAOD::CaloTower_v1::eta() const {
39 const CaloTowerContainer_v1* pTowCont =
40 static_cast<const CaloTowerContainer_v1*>(container());
41 return pTowCont->eta(index());
42}
43
44double xAOD::CaloTower_v1::phi() const {
45 const CaloTowerContainer_v1* pTowCont =
46 static_cast<const CaloTowerContainer_v1*>(container());
47 return pTowCont->phi(index());
48}
49
50double xAOD::CaloTower_v1::m() const { return s_towerMass; }
51double xAOD::CaloTower_v1::rapidity() const { return eta(); }
52double xAOD::CaloTower_v1::pt() const { return genvecP4().Pt(); }
53
54// FIXME!!!
55xAOD::Type::ObjectType xAOD::CaloTower_v1::type() const { return Type::ObjectType::Other; }
56
57
59
61
62 if (e() <= 0) {
63 // negative energy towers do not have a valid four-momentum representation (but a valid energy, eta, phi)
64 return p4;
65 }
66
67 const CaloTowerContainer_v1* pTowCont =
68 static_cast<const CaloTowerContainer_v1*>(container());
69
70
71 const double eta=pTowCont->eta(index());
72 const double phi=pTowCont->phi(index());
73 const double invcosheta = 1./std::cosh(eta);
74 const double pt=e()*invcosheta;
75 p4.SetPtEtaPhiM(pt,eta,phi,m());
76 return p4;
77}
78
80
81 if (e() <= 0) {
82 // negative energy towers do not have a valid four-momentum representation (but a valid energy, eta, phi)
83 return GenVecFourMom_t();
84 }
85
86 const CaloTowerContainer_v1* pTowCont =
87 static_cast<const CaloTowerContainer_v1*>(container());
88
89
90 const double eta=pTowCont->eta(index());
91 const double phi=pTowCont->phi(index());
92 const double invcosheta = 1./std::cosh(eta);
93 const double pt=e()*invcosheta;
94 return GenVecFourMom_t(pt,eta,phi,m());
95}
Scalar eta() const
pseudorapidity method
const SG::AuxVectorData * container() const
Return the container holding this element.
Basic container storing all information need for xAOD::CaloTower_v1 objects.
double phi(size_t index) const
double eta(size_t index) const
virtual Type::ObjectType type() const
object type - presently Type::Other (FIXME)
void reset()
Reset function.
virtual double pt() const
transverse momentum
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > GenVecFourMom_t
Base 4 Momentum type for calo.
void setEnergy(double energy)
Sets the energy.
virtual FourMom_t p4() const
Four-momentum representation.
virtual double e() const
energy
float f_val_e() const
Accessor for energy.
virtual double m() const
mass (by convention)
virtual double eta() const
pseudorapidity $
virtual double phi() const
azimuth
float & f_ref_e()
Reference to modifiable energy store.
GenVecFourMom_t genvecP4() const
Four-momentum representation: GenVector.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
void addEnergy(double energy)
Add energy.
CaloTower_v1()
Default constructor.
virtual double rapidity() const
rapidity
~CaloTower_v1()
Destructor.
IParticle()=default
Definition index.py:1
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition ObjectType.h:32