ATLAS Offline Software
Loading...
Searching...
No Matches
TruthParticleTraits.h
Go to the documentation of this file.
1/* emacs: this is -*- c++ -*- */
13
14
15#ifndef TRUTHPARTICLETRAITS_H
16#define TRUTHPARTICLETRAITS_H
17
19
20#include "TrackTraits.h"
21
22#include <cmath>
23
26
27template<>
28struct TrackTraits<xAOD::TruthParticle> : public TrackTraitsBase<xAOD::TruthParticle> {
29
33
35
39 static float theta(const xAOD::TruthParticle& t) { return 2*std::atan(std::exp(-t.eta())); }
40 static float E(const xAOD::TruthParticle& t) { return t.e(); }
41 static float ET(const xAOD::TruthParticle& t) { return t.e()*std::sin(theta(t)); }
42 static float p(const xAOD::TruthParticle& t) { return t.charge()*std::sqrt( t.px()*t.px() + t.py()*t.py() + t.pz()*t.pz() ); }
43
44 static float m(const xAOD::TruthParticle& t) { return t.m(); }
45
48
49 static float z0(const xAOD::TruthParticle& t) {
50 static const Accessor acc("z0");
51 return acc(t);
52 }
53
54 static float d0(const xAOD::TruthParticle& t) {
55 static const Accessor acc("d0");
56 return acc(t);
57 }
58
59 static float phi(const xAOD::TruthParticle& t) {
60 static const Accessor acc("phi");
61 return acc(t);
62 }
63
64 static float qOverP(const xAOD::TruthParticle& t) {
65 float p_ = p(t);
66 if ( p_==0 ) throw std::runtime_error( "divide by 0 - track p() is 0" );
67 return 1/p_;
68 }
69
70};
71
72
73#endif // TRUTHPARTICLETRAITS_H
74
75
76
77
78
79
80
81
82
83
Scalar theta() const
theta method
Helper class to provide constant type-safe access to aux data.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TruthParticle_v1 TruthParticle
Typedef to implementation.
raw track traits - use for the TrackParticle by default, specialise for anything else,...
Definition TrackTraits.h:47
static float p(const T &)
Definition TrackTraits.h:56
static float m(const xAOD::TruthParticle &t)
static float z0(const xAOD::TruthParticle &t)
these need to be explicitly instantiated, or else we want to raise an exception, so no point checking...
static float p(const xAOD::TruthParticle &t)
static float E(const xAOD::TruthParticle &t)
static float qOverP(const xAOD::TruthParticle &t)
static float ET(const xAOD::TruthParticle &t)
SG::ConstAccessor< float > Accessor
are these TrackParticle specific variables really needed ?
static float d0(const xAOD::TruthParticle &t)
static float theta(const xAOD::TruthParticle &t)
what are we going to do with photons ?
static float phi(const xAOD::TruthParticle &t)