ATLAS Offline Software
Loading...
Searching...
No Matches
TauJetTraits.h
Go to the documentation of this file.
1// emacs: this is -*- c++ -*-
13
14#ifndef IDTPM2_TAUJETTRAITS_H
15#define IDTPM2_TAUJETTRAITS_H
16
18
19#include "TrackTraits.h"
20
21#include <cmath>
22#include <iostream>
23
28
29template<>
30struct TrackTraits<xAOD::TauJet> : public TrackTraitsBase<xAOD::TauJet> {
31
32private:
33
39
40public:
41
42 static float eta(const xAOD::TauJet& t) { return t.eta(); }
43 static float phi(const xAOD::TauJet& t) { return t.phi(); }
44
47 static float pt(const xAOD::TauJet& t) { return t.pt(); }
48
49 static float theta(const xAOD::TauJet& t) { return 2*std::atan(std::exp(-t.eta())); }
50 static float qOverP(const xAOD::TauJet& t) { return t.charge()*std::sin(theta(t))/std::fabs(t.pt()); }
51
52 static float E(const xAOD::TauJet& t) { return t.e(); }
53
54 static float ET(const xAOD::TauJet& t) { return t.e()*std::sin(theta(t)); }
55
56 static float m(const xAOD::TauJet& t) { return t.m(); }
57
58 static float p(const xAOD::TauJet& t) {
59 double th = theta(t);
60 if ( th==0 ) throw std::runtime_error( "divide by 0 - tau theta is 0" );
61 return t.pt()/std::sin(th);
62 }
63
64 static float charge(const xAOD::TauJet& t) { return t.charge(); }
65
67 template<typename U>
68 static void addChildren( const xAOD::TauJet& t, std::vector<U>& v) {
69 auto tt = t.tracks();
70 for ( size_t i=0 ; i<tt.size() ; i++ ) {
71 const auto& links = m_trackAcc(*tt[i]);
72 if ( !links.empty() && links[0].isValid() ) v.emplace_back(tt[i]->track());
76 // else std::cerr << "duff TauTrack ElementLink for: " << tt[i] << std::endl;
77 }
78 }
79
80};
81
82
83
84
85#endif // IDTPM2_TAUJETTRAITS_H
86
87
88
89
90
91
92
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.
TauJet_v3 TauJet
Definition of the current "tau version".
Definition TauJet.h:17
raw track traits - use for the TrackParticle by default, specialise for anything else,...
Definition TrackTraits.h:47
static float p(const xAOD::TauJet &t)
static float qOverP(const xAOD::TauJet &t)
static float theta(const xAOD::TauJet &t)
static void addChildren(const xAOD::TauJet &t, std::vector< U > &v)
talk about insanity ,...
static float charge(const xAOD::TauJet &t)
static float m(const xAOD::TauJet &t)
static float ET(const xAOD::TauJet &t)
static const SG::ConstAccessor< xAOD::TauTrack_v1::TrackParticleLinks_t > m_trackAcc
the TauTrack may not always have an valid ElementLink but the TauTrack code does not properly check w...
static float pt(const xAOD::TauJet &t)
is tau pt signed ?
static float eta(const xAOD::TauJet &t)
static float phi(const xAOD::TauJet &t)
static float E(const xAOD::TauJet &t)