ATLAS Offline Software
Loading...
Searching...
No Matches
Reconstruction/tauRecTools/Root/HelperFunctions.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <TObjString.h>
8#include <TObjArray.h>
9#include <TFile.h>
10#include <TTree.h>
11
12#include <iostream>
13
14namespace tauRecTools {
15 ANA_MSG_SOURCE(msgHelperFunction, "HelperFunction")
16}
17
18
19
21 const xAOD::Vertex* jetVertex = nullptr;
22
23 bool isAvailable = jet.getAssociatedObject("OriginVertex", jetVertex);
24 if (! isAvailable) {
25 return nullptr;
26 }
27
28 return jetVertex;
29}
30
31
32
33TLorentzVector tauRecTools::getTauAxis(const xAOD::TauJet& tau, bool doVertexCorrection) {
34 TLorentzVector tauAxis;
35 if (doVertexCorrection) {
37 }
38 else {
40 }
41
42 return tauAxis;
43}
44
45//________________________________________________________________________________
47 const int flagsize=sizeof(flag)*8;
48 flag=flag<<(flagsize-xAOD::TauJetParameters::classifiedFake-1);
49 flag=flag>>(flagsize-xAOD::TauJetParameters::classifiedCharged+1);
50 return flag;
51}
52
53//________________________________________________________________________________
55{
56 //should we be safe and ask if the links are available?
57 const xAOD::TauTrack* xTrack1 = *l1;
58 const xAOD::TauTrack* xTrack2 = *l2;
59
60 //return classified charged, then isolation (wide tracks), else by pt
63
64 if(f1==f2)
65 return xTrack1->pt()>xTrack2->pt();
66 return f1<f2;
67}
68
69//________________________________________________________________________________
70TLorentzVector tauRecTools::GetConstituentP4(const xAOD::JetConstituent& constituent) {
71 using namespace tauRecTools::msgHelperFunction;
72
73 TLorentzVector constituentP4;
74
75 if( constituent->type() == xAOD::Type::CaloCluster ) {
76 const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>( constituent->rawConstituent() );
77 constituentP4 = cluster->p4();
78 }
79 else if ( constituent->type() == xAOD::Type::FlowElement ) {
80 const xAOD::FlowElement* fe = static_cast<const xAOD::FlowElement*>( constituent->rawConstituent() );
81 constituentP4 = fe->p4();
82 }
83 else {
84 ANA_MSG_ERROR("GetConstituentP4: Seed jet constituent type not supported!");
85 constituentP4.SetPtEtaPhiE(constituent.pt(), constituent.eta(), constituent.phi(), constituent.e());
86 }
87
88 return constituentP4;
89}
90
91
92
94 // build pi0s and shots for 0-5p taus
95 return ( tau.nTracks() <= 5 );
96}
#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".