ATLAS Offline Software
TauPi0Selector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 TauPi0Selector::TauPi0Selector(const std::string& name) :
11  declareProperty("ClusterEtCut", m_clusterEtCut);
12  declareProperty("ClusterBDTCut_1prong", m_clusterBDTCut_1prong);
13  declareProperty("ClusterBDTCut_mprong", m_clusterBDTCut_mprong);
14 }
15 
16 
17 
19  // Clear vector of cell-based pi0 PFO Links. Required when rerunning on xAOD level.
20  pTau.clearProtoPi0PFOLinks();
21 
22  // Decay mode enum
23  auto kDecayModeProto = xAOD::TauJetParameters::PanTau_DecayModeProto;
24 
25  // 0, >=5 prong taus will have Mode_NotSet
26  if (pTau.nTracks() == 0 || pTau.nTracks() >5 ) {
28  return StatusCode::SUCCESS;
29  }
30 
31  // 1-5 prong taus have Mode_Other by default
32  // 1, 3 prong taus will be over-written
34 
35  // Apply selection to the pi0, and count the number
36  int nRecoPi0s=0;
37  for(size_t i=0; i<pTau.nProtoNeutralPFOs(); i++) {
38  xAOD::PFO* neutralPFO = neutralPFOContainer.at( pTau.protoNeutralPFO(i)->index() );
39 
40  // Set number of pi0s to 0 for all neutral PFOs. Required when rerunning on xAOD level
42 
43  // Only consider PFOs within 0.2 cone of the tau axis
44  if (pTau.p4().DeltaR(neutralPFO->p4()) > 0.2) continue;
45 
46  int etaBin = getEtaBin( neutralPFO->cluster(0)->eta() );
47 
48  // Apply Et cut
49  if (neutralPFO->p4().Et() < m_clusterEtCut.at(etaBin)) continue;
50 
51  // Apply BDT score cut
52  double BDTScore = neutralPFO->bdtPi0Score();
53  if ((pTau.nTracks() == 1 && BDTScore < m_clusterBDTCut_1prong.at(etaBin)) ||
54  (pTau.nTracks() > 1 && BDTScore < m_clusterBDTCut_mprong.at(etaBin))) continue;
55 
56  int nHitsInEM1 = 0;
57  if (!neutralPFO->attribute(xAOD::PFODetails::cellBased_NHitsInEM1, nHitsInEM1)) {
58  ATH_MSG_WARNING("Couldn't retrieve nHitsInEM1. Will set it to 0.");
59  }
60 
61  // nHitsInEM1 < 3 --- one pi0; nHitsInEM1 >= 3 --- two pi0s
62  // FIXME: what about nHitsInEM1 == 0 ?
63  if (nHitsInEM1 < 3) {
65  ++nRecoPi0s;
66  }
67  else {
69  nRecoPi0s += 2;
70  }
71 
72  pTau.addProtoPi0PFOLink(ElementLink< xAOD::PFOContainer > (neutralPFO, neutralPFOContainer));
73  }
74 
75  // Set Proto Decay Mode based on the number charged tracks and pi0s
76  if (pTau.nTracks()==1) {
77  if (nRecoPi0s==0) {
79  }
80  else if (nRecoPi0s==1) {
82  }
83  else {
85  }
86  }
87  else if (pTau.nTracks()==3) {
88  if (nRecoPi0s==0) {
90  }
91  else {
93  }
94  }
95 
96  return StatusCode::SUCCESS;
97 }
98 
99 
100 
101 int TauPi0Selector::getEtaBin(double eta) const {
102  int etaBin = -1;
103 
104  double absEta = std::abs(eta);
105 
106  if (absEta < 0.80) {
107  etaBin = 0;
108  }
109  else if (absEta < 1.40) {
110  etaBin = 1;
111  }
112  else if (absEta < 1.50) {
113  etaBin = 2;
114  }
115  else if (absEta < 1.90) {
116  etaBin = 3;
117  }
118  else {
119  etaBin = 4;
120  }
121 
122  return etaBin;
123 }
xAOD::TauJetParameters::Mode_1p0n
@ Mode_1p0n
Definition: TauDefs.h:386
xAOD::TauJetParameters::Mode_1p1n
@ Mode_1p1n
Definition: TauDefs.h:387
TauPi0Selector::m_clusterBDTCut_mprong
std::vector< double > m_clusterBDTCut_mprong
Definition: TauPi0Selector.h:37
xAOD::TauJet_v3::nProtoNeutralPFOs
size_t nProtoNeutralPFOs() const
Get the number of cellbased_neutral PFO particles associated with this tau.
Definition: TauJet_v3.cxx:944
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::TauJet_v3::setPanTauDetail
void setPanTauDetail(TauJetParameters::PanTauDetails panTauDetail, int value)
Definition: TauJet_v3.cxx:395
xAOD::PFO_v1::attribute
bool attribute(PFODetails::PFOAttributes AttributeType, T &anAttribute) const
get a PFO Variable via enum
xAOD::TauJet_v3::nTracks
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
Definition: TauJet_v3.cxx:526
TauRecToolBase
The base class for all tau tools.
Definition: TauRecToolBase.h:21
xAOD::PFODetails::cellBased_NHitsInEM1
@ cellBased_NHitsInEM1
Definition: Event/xAOD/xAODPFlow/xAODPFlow/PFODefs.h:132
TauPi0Selector::TauPi0Selector
TauPi0Selector(const std::string &name)
Definition: TauPi0Selector.cxx:9
TauPi0Selector::executePi0nPFO
virtual StatusCode executePi0nPFO(xAOD::TauJet &pTau, xAOD::PFOContainer &pNeutralPFOContainer) const override
Definition: TauPi0Selector.cxx:18
xAOD::TauJetParameters::Mode_1pXn
@ Mode_1pXn
Definition: TauDefs.h:388
TauPi0Selector.h
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
xAOD::TauJet_v3::clearProtoPi0PFOLinks
void clearProtoPi0PFOLinks()
Remove all cellbased_pi0 PFOs from the tau.
Definition: TauJet_v3.cxx:985
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
lumiFormat.i
int i
Definition: lumiFormat.py:85
TauPi0Selector::m_clusterEtCut
std::vector< double > m_clusterEtCut
Definition: TauPi0Selector.h:35
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
xAOD::PFO_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: PFO_v1.cxx:95
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
xAOD::PFO_v1::bdtPi0Score
float bdtPi0Score() const
get BDT Score used to classify clusters as Pi0 like or not
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::TauJetParameters::Mode_3p0n
@ Mode_3p0n
Definition: TauDefs.h:389
TauPi0Selector::m_clusterBDTCut_1prong
std::vector< double > m_clusterBDTCut_1prong
Definition: TauPi0Selector.h:36
xAOD::PFO_v1
Class describing a particle flow object.
Definition: PFO_v1.h:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
xAOD::TauJet_v3::addProtoPi0PFOLink
void addProtoPi0PFOLink(const ElementLink< PFOContainer > &pfo)
add a cellbased_pi0 PFO to the tau
Definition: TauJet_v3.cxx:979
xAOD::PFODetails::nPi0Proto
@ nPi0Proto
Definition: Event/xAOD/xAODPFlow/xAODPFlow/PFODefs.h:31
xAOD::TauJetParameters::PanTau_DecayModeProto
@ PanTau_DecayModeProto
Definition: TauDefs.h:359
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::TauJet_v3::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: TauJet_v3.cxx:97
TauGNNUtils::Variables::absEta
bool absEta(const xAOD::TauJet &tau, double &out)
Definition: TauGNNUtils.cxx:234
xAOD::TauJetParameters::Mode_3pXn
@ Mode_3pXn
Definition: TauDefs.h:390
xAOD::TauJet_v3::protoNeutralPFO
const PFO * protoNeutralPFO(size_t i) const
Get the pointer to a given cellbased_neutral PFO associated with this tau.
xAOD::PFO_v1::cluster
const CaloCluster * cluster(unsigned int index) const
Retrieve a const pointer to a CaloCluster.
Definition: PFO_v1.cxx:669
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
xAOD::PFO_v1::setAttribute
void setAttribute(PFODetails::PFOAttributes AttributeType, const T &anAttribute)
Set a PFO Variable via enum - overwrite is allowed.
xAOD::TauJetParameters::Mode_NotSet
@ Mode_NotSet
Definition: TauDefs.h:392
TauPi0Selector::getEtaBin
int getEtaBin(double eta) const
Get eta bin of Pi0Cluster.
Definition: TauPi0Selector.cxx:101
xAOD::TauJetParameters::Mode_Other
@ Mode_Other
Definition: TauDefs.h:391