ATLAS Offline Software
Loading...
Searching...
No Matches
TauPi0Selector.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
8TauPi0Selector::TauPi0Selector(const std::string& name) :
9 TauRecToolBase(name) {
10}
11
12
14 const EventContext& /*ctx*/,
15 xAOD::PFOContainer& neutralPFOContainer) const {
16
17 // Clear vector of cell-based pi0 PFO Links. Required when rerunning on xAOD level.
19
20 // Decay mode enum
22
23 // 0, >=5 prong taus will have Mode_NotSet
24 if (pTau.nTracks() == 0 || pTau.nTracks() >5 ) {
26 return StatusCode::SUCCESS;
27 }
28
29 // 1-5 prong taus have Mode_Other by default
30 // 1, 3 prong taus will be over-written
32
33 // Apply selection to the pi0, and count the number
34 int nRecoPi0s=0;
35 for(size_t i=0; i<pTau.nProtoNeutralPFOs(); i++) {
36 xAOD::PFO* neutralPFO = neutralPFOContainer.at( pTau.protoNeutralPFO(i)->index() );
37
38 // Set number of pi0s to 0 for all neutral PFOs. Required when rerunning on xAOD level
39 neutralPFO->setAttribute<int>(xAOD::PFODetails::PFOAttributes::nPi0Proto, 0);
40
41 // Only consider PFOs within 0.2 cone of the tau axis
42 if (pTau.p4().DeltaR(neutralPFO->p4()) > m_maxDeltaRNeutral) continue;
43
44 int etaBin = getEtaBin( neutralPFO->cluster(0)->eta() );
45
46 // Apply Et cut
47 if (neutralPFO->p4().Et() < m_pi0EtCut[etaBin]) continue;
48
49 // Apply BDT score cut
50 float BDTScore = neutralPFO->bdtPi0Score();
51 if ((pTau.nTracks() == 1 && BDTScore < m_pi0BDTCut_1prong[etaBin]) ||
52 (pTau.nTracks() > 1 && BDTScore < m_pi0BDTCut_mprong[etaBin])) continue;
53
54 int nHitsInEM1 = 0;
55 if (!neutralPFO->attribute(xAOD::PFODetails::cellBased_NHitsInEM1, nHitsInEM1)) {
56 ATH_MSG_WARNING("Couldn't retrieve nHitsInEM1. Will set it to 0.");
57 }
58
59 // nHitsInEM1 < 3 --- one pi0; nHitsInEM1 >= 3 --- two pi0s
60 // FIXME: what about nHitsInEM1 == 0 ?
61 if (nHitsInEM1 < 3) {
62 neutralPFO->setAttribute<int>(xAOD::PFODetails::PFOAttributes::nPi0Proto, 1);
63 ++nRecoPi0s;
64 }
65 else {
66 neutralPFO->setAttribute<int>(xAOD::PFODetails::PFOAttributes::nPi0Proto, 2);
67 nRecoPi0s += 2;
68 }
69
70 pTau.addProtoPi0PFOLink(ElementLink< xAOD::PFOContainer > (neutralPFO, neutralPFOContainer));
71 }
72
73 // Set Proto Decay Mode based on the number charged tracks and pi0s
74 if (pTau.nTracks()==1) {
75 if (nRecoPi0s==0) {
77 }
78 else if (nRecoPi0s==1) {
80 }
81 else {
83 }
84 }
85 else if (pTau.nTracks()==3) {
86 if (nRecoPi0s==0) {
88 }
89 else {
91 }
92 }
93
94 return StatusCode::SUCCESS;
95}
96
97
98int TauPi0Selector::getEtaBin(double eta) const {
99 int etaBin = -1;
100
101 double absEta = std::abs(eta);
102
103 if (absEta < 0.80) {
104 etaBin = 0;
105 }
106 else if (absEta < 1.40) {
107 etaBin = 1;
108 }
109 else if (absEta < 1.50) {
110 etaBin = 2;
111 }
112 else if (absEta < 1.90) {
113 etaBin = 3;
114 }
115 else {
116 etaBin = 4;
117 }
118
119 return etaBin;
120}
Scalar eta() const
pseudorapidity method
#define ATH_MSG_WARNING(x,...)
const T * at(size_type n) const
Access an element, as an rvalue.
Gaudi::Property< std::vector< float > > m_pi0BDTCut_mprong
Gaudi::Property< double > m_maxDeltaRNeutral
TauPi0Selector(const std::string &name)
Gaudi::Property< std::vector< float > > m_pi0EtCut
Gaudi::Property< std::vector< float > > m_pi0BDTCut_1prong
virtual StatusCode executeTool(xAOD::TauJet &pTau, const EventContext &ctx, xAOD::PFOContainer &pNeutralPFOContainer) const override
int getEtaBin(double eta) const
Get eta bin of Pi0Cluster.
TauRecToolBase(const std::string &name)
virtual double eta() const
The pseudorapidity ( ) of the particle.
bool attribute(PFODetails::PFOAttributes AttributeType, T &anAttribute) const
get a PFO Variable via enum
void setAttribute(PFODetails::PFOAttributes AttributeType, const T &anAttribute)
Set a PFO Variable via enum - overwrite is allowed.
float bdtPi0Score() const
get BDT Score used to classify clusters as Pi0 like or not
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition PFO_v1.cxx:95
const CaloCluster * cluster(unsigned int index) const
Retrieve a const pointer to a CaloCluster.
Definition PFO_v1.cxx:669
void setPanTauDetail(TauJetParameters::PanTauDetails panTauDetail, int value)
void addProtoPi0PFOLink(const ElementLink< PFOContainer > &pfo)
add a cellbased_pi0 PFO to the tau
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition TauJet_v3.cxx:96
void clearProtoPi0PFOLinks()
Remove all cellbased_pi0 PFOs from the tau.
const PFO * protoNeutralPFO(size_t i) const
Get the pointer to a given cellbased_neutral PFO associated with this tau.
size_t nProtoNeutralPFOs() const
Get the number of cellbased_neutral PFO particles associated with this tau.
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
PFO_v1 PFO
Definition of the current "pfo version".
Definition PFO.h:17
PFOContainer_v1 PFOContainer
Definition of the current "pfo container version".
TauJet_v3 TauJet
Definition of the current "tau version".
Definition TauJet.h:17