ATLAS Offline Software
Loading...
Searching...
No Matches
Reconstruction/tauRecTools/Root/HelperFunctions.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8namespace tauRecTools {
9 ANA_MSG_SOURCE(msgHelperFunction, "HelperFunction")
10}
11
12
13
15 const xAOD::Vertex* jetVertex = nullptr;
16
17 bool isAvailable = jet.getAssociatedObject("OriginVertex", jetVertex);
18 if (! isAvailable) {
19 return nullptr;
20 }
21
22 return jetVertex;
23}
24
25
26
27TLorentzVector tauRecTools::getTauAxis(const xAOD::TauJet& tau, bool doVertexCorrection) {
28 TLorentzVector tauAxis;
29 if (doVertexCorrection) {
31 }
32 else {
34 }
35
36 return tauAxis;
37}
38
39//________________________________________________________________________________
41 const int flagsize=sizeof(flag)*8;
42 flag=flag<<(flagsize-xAOD::TauJetParameters::classifiedFake-1);
43 flag=flag>>(flagsize-xAOD::TauJetParameters::classifiedCharged+1);
44 return flag;
45}
46
47//________________________________________________________________________________
49{
50 //should we be safe and ask if the links are available?
51 const xAOD::TauTrack* xTrack1 = *l1;
52 const xAOD::TauTrack* xTrack2 = *l2;
53
54 //return classified charged, then isolation (wide tracks), else by pt
57
58 if(f1==f2)
59 return xTrack1->pt()>xTrack2->pt();
60 return f1<f2;
61}
62
63//________________________________________________________________________________
64TLorentzVector tauRecTools::GetConstituentP4(const xAOD::JetConstituent& constituent) {
65 using namespace tauRecTools::msgHelperFunction;
66
67 TLorentzVector constituentP4;
68
69 if( constituent->type() == xAOD::Type::CaloCluster ) {
70 const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>( constituent->rawConstituent() );
71 constituentP4 = cluster->p4();
72 }
73 else if ( constituent->type() == xAOD::Type::FlowElement ) {
74 const xAOD::FlowElement* fe = static_cast<const xAOD::FlowElement*>( constituent->rawConstituent() );
75 constituentP4 = fe->p4();
76 }
77 else {
78 ANA_MSG_ERROR("GetConstituentP4: Seed jet constituent type not supported!");
79 constituentP4.SetPtEtaPhiE(constituent.pt(), constituent.eta(), constituent.phi(), constituent.e());
80 }
81
82 return constituentP4;
83}
84
85
86
88 // build pi0s and shots for 0-5p taus
89 return ( tau.nTracks() <= 5 );
90}
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_MSG_SOURCE(NAME, TITLE)
the source code part of ANA_MSG_SOURCE
virtual FourMom_t p4() const
The full 4-momentum of the particle.
virtual FourMom_t p4() const override
The full 4-momentum of the particle.
4-vector of jet constituent at the scale used during jet finding.
double eta() const
The pseudorapidity ( ) of the particle.
double phi() const
The azimuthal angle ( ) of the particle.
Type::ObjectType type() const
The full 4-momentum of the particle.
const IParticle * rawConstituent() const
Access the real underlying IParticle.
double e() const
The total energy of the particle.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition TauJet_v3.cxx:96
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
uint16_t TrackFlagType
Definition TauTrack_v1.h:61
TrackFlagType flagSet() const
virtual double pt() const
The transverse momentum ( ) of the particle.
Implementation of a TrackClassifier based on an RNN.
Definition BDTHelper.cxx:12
bool doPi0andShots(const xAOD::TauJet &tau)
Determines whether pi0s and shots should be built for a tau candidate.
bool sortTracks(const ElementLink< xAOD::TauTrackContainer > &l1, const ElementLink< xAOD::TauTrackContainer > &l2)
const xAOD::Vertex * getJetVertex(const xAOD::Jet &jet)
Return the vertex of jet candidate.
xAOD::TauTrack::TrackFlagType isolateClassifiedBits(xAOD::TauTrack::TrackFlagType flag)
TLorentzVector getTauAxis(const xAOD::TauJet &tau, bool doVertexCorrection=true)
Return the four momentum of the tau axis The tau axis is widely used to select clusters and cells in ...
TLorentzVector GetConstituentP4(const xAOD::JetConstituent &constituent)
@ FlowElement
The object is a track-calo-cluster.
Definition ObjectType.h:52
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39
Jet_v1 Jet
Definition of the current "jet version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16
Vertex_v1 Vertex
Define the latest version of the vertex class.
TauTrack_v1 TauTrack
Definition of the current version.
Definition TauTrack.h:16
TauJet_v3 TauJet
Definition of the current "tau version".