ATLAS Offline Software
Loading...
Searching...
No Matches
TauPi0Selector.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8
9TauPi0Selector::TauPi0Selector(const std::string& name) :
10 TauRecToolBase(name) {
11}
12
13
14
15StatusCode TauPi0Selector::executePi0nPFO(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer) const {
16 // Clear vector of cell-based pi0 PFO Links. Required when rerunning on xAOD level.
18
19 // Decay mode enum
21
22 // 0, >=5 prong taus will have Mode_NotSet
23 if (pTau.nTracks() == 0 || pTau.nTracks() >5 ) {
25 return StatusCode::SUCCESS;
26 }
27
28 // 1-5 prong taus have Mode_Other by default
29 // 1, 3 prong taus will be over-written
31
32 // Apply selection to the pi0, and count the number
33 int nRecoPi0s=0;
34 for(size_t i=0; i<pTau.nProtoNeutralPFOs(); i++) {
35 xAOD::PFO* neutralPFO = neutralPFOContainer.at( pTau.protoNeutralPFO(i)->index() );
36
37 // Set number of pi0s to 0 for all neutral PFOs. Required when rerunning on xAOD level
38 neutralPFO->setAttribute<int>(xAOD::PFODetails::PFOAttributes::nPi0Proto, 0);
39
40 // Only consider PFOs within 0.2 cone of the tau axis
41 if (pTau.p4().DeltaR(neutralPFO->p4()) > m_maxDeltaRNeutral) continue;
42
43 int etaBin = getEtaBin( neutralPFO->cluster(0)->eta() );
44
45 // Apply Et cut
46 if (neutralPFO->p4().Et() < m_pi0EtCut[etaBin]) continue;
47
48 // Apply BDT score cut
49 float BDTScore = neutralPFO->bdtPi0Score();
50 if ((pTau.nTracks() == 1 && BDTScore < m_pi0BDTCut_1prong[etaBin]) ||
51 (pTau.nTracks() > 1 && BDTScore < m_pi0BDTCut_mprong[etaBin])) continue;
52
53 int nHitsInEM1 = 0;
54 if (!neutralPFO->attribute(xAOD::PFODetails::cellBased_NHitsInEM1, nHitsInEM1)) {
55 ATH_MSG_WARNING("Couldn't retrieve nHitsInEM1. Will set it to 0.");
56 }
57
58 // nHitsInEM1 < 3 --- one pi0; nHitsInEM1 >= 3 --- two pi0s
59 // FIXME: what about nHitsInEM1 == 0 ?
60 if (nHitsInEM1 < 3) {
61 neutralPFO->setAttribute<int>(xAOD::PFODetails::PFOAttributes::nPi0Proto, 1);
62 ++nRecoPi0s;
63 }
64 else {
65 neutralPFO->setAttribute<int>(xAOD::PFODetails::PFOAttributes::nPi0Proto, 2);
66 nRecoPi0s += 2;
67 }
68
69 pTau.addProtoPi0PFOLink(ElementLink< xAOD::PFOContainer > (neutralPFO, neutralPFOContainer));
70 }
71
72 // Set Proto Decay Mode based on the number charged tracks and pi0s
73 if (pTau.nTracks()==1) {
74 if (nRecoPi0s==0) {
76 }
77 else if (nRecoPi0s==1) {
79 }
80 else {
82 }
83 }
84 else if (pTau.nTracks()==3) {
85 if (nRecoPi0s==0) {
87 }
88 else {
90 }
91 }
92
93 return StatusCode::SUCCESS;
94}
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.
size_t index() const
Return the index of this element within its container.
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
int getEtaBin(double eta) const
Get eta bin of Pi0Cluster.
virtual StatusCode executePi0nPFO(xAOD::TauJet &pTau, xAOD::PFOContainer &pNeutralPFOContainer) const override
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".