ATLAS Offline Software
Tool_TauConstituentSelector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 
10 
12  asg::AsgTool(name),
13  m_Tool_InformationStore("PanTau::Tool_InformationStore/Tool_InformationStore")
14 {
15  declareProperty("Tool_InformationStore", m_Tool_InformationStore, "Link to tool with all information");
16  declareProperty("Tool_InformationStoreName", m_Tool_InformationStoreName, "Link to tool with all information");
17 }
18 
19 
21 
22 
24 
25  ATH_MSG_INFO(" initialize()");
26  m_init=true;
27 
28  ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_InformationStore, m_Tool_InformationStoreName ) );
29  ATH_CHECK( m_Tool_InformationStore.retrieve() );
30 
31  ATH_CHECK( m_Tool_InformationStore->getInfo_Double("TauConstituents_MaxEta", m_MaxEta) );
32 
33  //eta bin edges
34  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_BinEdges_Eta", m_BinEdges_Eta) );
35 
36  //et cuts for types used in mode reco
37  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_Selection_Neutral_EtaBinned_EtCut", m_Selection_Neutral_EtaBinned_EtCut) );
38  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_Selection_Pi0Neut_EtaBinned_EtCut", m_Selection_Pi0Neut_EtaBinned_EtCut) );
39  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_Selection_Charged_EtaBinned_EtCut", m_Selection_Charged_EtaBinned_EtCut) );
40 
41  //et cuts for types interesting for jet rej.
42  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_Selection_OutNeut_EtaBinned_EtCut", m_Selection_OutNeut_EtaBinned_EtCut) );
43  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_Selection_OutChrg_EtaBinned_EtCut", m_Selection_OutChrg_EtaBinned_EtCut) );
44 
45  //et cuts for neutral test types with lower et cuts
46  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_Selection_NeutLowA_EtaBinned_EtCut", m_Selection_NeutLowA_EtaBinned_EtCut) );
47  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_Selection_NeutLowB_EtaBinned_EtCut", m_Selection_NeutLowB_EtaBinned_EtCut) );
48 
49  return StatusCode::SUCCESS;
50 }
51 
52 
54 
55  for (unsigned int iEtaBin=0; iEtaBin<m_BinEdges_Eta.size()-1; iEtaBin++) {
56  if (m_BinEdges_Eta[iEtaBin] <= eta && eta < m_BinEdges_Eta[iEtaBin+1]) {
57  switch(constituentType) {
58  case PanTau::TauConstituent::t_Charged: return m_Selection_Charged_EtaBinned_EtCut[iEtaBin];
59  case PanTau::TauConstituent::t_Neutral: return m_Selection_Neutral_EtaBinned_EtCut[iEtaBin];
60  case PanTau::TauConstituent::t_Pi0Neut: return m_Selection_Pi0Neut_EtaBinned_EtCut[iEtaBin];
61  case PanTau::TauConstituent::t_OutNeut: return m_Selection_OutNeut_EtaBinned_EtCut[iEtaBin];
62  case PanTau::TauConstituent::t_OutChrg: return m_Selection_OutChrg_EtaBinned_EtCut[iEtaBin];
63  case PanTau::TauConstituent::t_NeutLowA: return m_Selection_NeutLowA_EtaBinned_EtCut[iEtaBin];
64  case PanTau::TauConstituent::t_NeutLowB: return m_Selection_NeutLowB_EtaBinned_EtCut[iEtaBin];
65  default:
66  return 9999999.;
67  }
68  }
69  }
70 
71  ATH_MSG_WARNING("Eta value of " << eta << " could not be matched to any eta bin!");
72  return 9999999.;
73 }
74 
75 
81  std::vector<TauConstituent*>& outputList) const {
82 
83  for (unsigned int iConst=0; iConst<inputList.size(); iConst++) {
84 
85  PanTau::TauConstituent* curConstituent = inputList[iConst];
86 
87  //general preselection:
88  double curEta = std::abs( curConstituent->p4().Eta() );
89  if (curEta > m_MaxEta) {
90  ATH_MSG_DEBUG("\tNot using constituent with eta of " << curEta);
91  continue;
92  }
93 
94  bool passesSelection = false;
95 
96  // check if constituent is charged:
97  if (curConstituent->isOfType(PanTau::TauConstituent::t_Charged)) {
98  passesSelection = passesSelection_ChargedConstituent(curConstituent);
99 
100  // check if constituent is neutral, assign correctly pi0neut and neut flags:
101  } else if (curConstituent->isOfType(PanTau::TauConstituent::t_Neutral)) {
102  passesSelection = passesSelection_NeutralConstituent(curConstituent);
103 
104  //special treatment for the testing neutral flags
105  // a constituent can be a NeutLowA but not a neutral (because neutral Et cut is higher)
106  // => need that the constituent is in the seed for calculating test variables, but need it to NOT be tagged as neutral
107  // => remove the neutral-tag and check if it passes NeutLowA
108  //-> repeat those steps for NeutLowB
109  if (!passesSelection) {
112  passesSelection = passesSelection_NeutLowAConstituent(curConstituent);
113  if (!passesSelection) {
115  passesSelection = passesSelection_NeutLowBConstituent(curConstituent);
116  }
117  }
118  // apply further selection to constituent in isolation cone:
119  } else if (curConstituent->isOfType(PanTau::TauConstituent::t_OutChrg)) {
120  passesSelection = passesSelection_OutChrgConstituent(curConstituent);
121 
122  } else if (curConstituent->isOfType(PanTau::TauConstituent::t_OutNeut)) {
123  passesSelection = passesSelection_OutNeutConstituent(curConstituent);
124 
125  } else {
126  ATH_MSG_WARNING("Unhandled constituent type (" << curConstituent->getTypeNameString()
127  << ") when trying to apply constituent selection - constituent will not be selected!");
128  passesSelection = false;
129  }
130 
131  if (!passesSelection) continue;
132 
133  outputList.push_back(inputList[iConst]);
134  }
135 
136  return StatusCode::SUCCESS;
137 }
138 
139 
141 
142  TLorentzVector tlv_Constituent = tauConstituent->p4();
143 
144  if (tlv_Constituent.Et() < getEtCut(std::abs(tlv_Constituent.Eta()), PanTau::TauConstituent::t_Neutral)) {
145  ATH_MSG_DEBUG("\tNot using constituent at eta " << tlv_Constituent.Eta() << " with et of " << tlv_Constituent.Et());
146  return false;
147  }
148 
149  return true;
150 }
151 
152 
154 
155  TLorentzVector tlv_Constituent = tauConstituent->p4();
156  if (tlv_Constituent.Et() < getEtCut(std::abs(tlv_Constituent.Eta()), PanTau::TauConstituent::t_Pi0Neut)) {
157  ATH_MSG_DEBUG("\tNot using constituent at eta " << tlv_Constituent.Eta() << " with et of " << tlv_Constituent.Et());
158  return false;
159  }
160 
161  return true;
162 }
163 
164 
166  // we want to use all tracks
167  return true;
168 }
169 
170 
172  TLorentzVector tlv_Constituent = TauConstituent->p4();
173 
174  return tlv_Constituent.Et() >= getEtCut(std::abs(tlv_Constituent.Eta()), PanTau::TauConstituent::t_OutNeut);
175 
176 }
177 
178 
180  // we want to use all tracks
181  return true;
182 }
183 
184 
186  TLorentzVector tlv_Constituent = TauConstituent->p4();
187 
188  return tlv_Constituent.Pt() >= getEtCut(std::abs(tlv_Constituent.Eta()), PanTau::TauConstituent::t_NeutLowA);
189 }
190 
191 
193  TLorentzVector tlv_Constituent = TauConstituent->p4();
194 
195  return tlv_Constituent.Pt() >= getEtCut(std::abs(tlv_Constituent.Eta()), PanTau::TauConstituent::t_NeutLowB);
196 }
PanTau::Tool_TauConstituentSelector::passesSelection_OutChrgConstituent
virtual bool passesSelection_OutChrgConstituent(TauConstituent *TauConstituent) const
Definition: Tool_TauConstituentSelector.cxx:179
PanTau::Tool_TauConstituentSelector::m_Tool_InformationStore
ToolHandle< PanTau::ITool_InformationStore > m_Tool_InformationStore
Definition: Tool_TauConstituentSelector.h:51
PanTau::TauConstituent::t_Neutral
@ t_Neutral
Definition: TauConstituent.h:45
PanTau::TauConstituent::Type
Type
Type enumeration to specify type of this tau constituent.
Definition: TauConstituent.h:42
PanTau::Tool_TauConstituentSelector::getEtCut
virtual double getEtCut(double eta, PanTau::TauConstituent::Type constituentType) const
Definition: Tool_TauConstituentSelector.cxx:53
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PanTau::Tool_TauConstituentSelector::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: Tool_TauConstituentSelector.cxx:23
PanTau::TauConstituent::t_Charged
@ t_Charged
Definition: TauConstituent.h:44
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
HelperFunctions.h
PanTau::Tool_TauConstituentSelector::~Tool_TauConstituentSelector
virtual ~Tool_TauConstituentSelector()
asg
Definition: DataHandleTestTool.h:28
PanTau::TauConstituent::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle as a TLorentzVector.
Definition: TauConstituent.cxx:100
PanTau::TauConstituent::getTypeNameString
std::string getTypeNameString() const
Definition: TauConstituent.cxx:199
TauConstituent.h
PanTau::Tool_TauConstituentSelector::passesSelection_NeutralConstituent
virtual bool passesSelection_NeutralConstituent(TauConstituent *tauConstituent) const
Definition: Tool_TauConstituentSelector.cxx:140
PanTau::TauConstituent::t_OutNeut
@ t_OutNeut
Definition: TauConstituent.h:48
PanTau::Tool_TauConstituentSelector::passesSelection_OutNeutConstituent
virtual bool passesSelection_OutNeutConstituent(TauConstituent *TauConstituent) const
Definition: Tool_TauConstituentSelector.cxx:171
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PlotRamps.passesSelection
def passesSelection(gain, offset)
Definition: PlotRamps.py:8
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Tool_TauConstituentSelector.h
PanTau::Tool_TauConstituentSelector::passesSelection_NeutLowBConstituent
virtual bool passesSelection_NeutLowBConstituent(TauConstituent *TauConstituent) const
Definition: Tool_TauConstituentSelector.cxx:192
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
PanTau::HelperFunctions::bindToolHandle
static StatusCode bindToolHandle(ToolHandle< T > &, std::string)
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:60
PanTau::TauConstituent::isOfType
bool isOfType(TauConstituent::Type aType) const
Definition: TauConstituent.cxx:220
PanTau::TauConstituent::t_Pi0Neut
@ t_Pi0Neut
Definition: TauConstituent.h:46
PanTau::Tool_TauConstituentSelector::Tool_TauConstituentSelector
Tool_TauConstituentSelector(const std::string &name)
Definition: Tool_TauConstituentSelector.cxx:11
Tool_InformationStore.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
PanTau::TauConstituent::t_NeutLowB
@ t_NeutLowB
Definition: TauConstituent.h:50
run_AODTCCLinking.inputList
list inputList
Definition: run_AODTCCLinking.py:93
PanTau::Tool_TauConstituentSelector::SelectTauConstituents
virtual StatusCode SelectTauConstituents(const std::vector< TauConstituent * > &inputList, std::vector< TauConstituent * > &outputList) const
Function to further select PFOs of the various categories (basically apply additional ET cuts):
Definition: Tool_TauConstituentSelector.cxx:80
PanTau::TauConstituent::t_NeutLowA
@ t_NeutLowA
Definition: TauConstituent.h:49
PanTau::Tool_TauConstituentSelector::passesSelection_NeutLowAConstituent
virtual bool passesSelection_NeutLowAConstituent(TauConstituent *TauConstituent) const
Definition: Tool_TauConstituentSelector.cxx:185
PanTau::TauConstituent
Definition: TauConstituent.h:25
PanTau::Tool_TauConstituentSelector::passesSelection_Pi0NeutConstituent
virtual bool passesSelection_Pi0NeutConstituent(TauConstituent *tauConstituent) const
Definition: Tool_TauConstituentSelector.cxx:153
PanTau::Tool_TauConstituentSelector::passesSelection_ChargedConstituent
virtual bool passesSelection_ChargedConstituent(TauConstituent *tauConstituent) const
Definition: Tool_TauConstituentSelector.cxx:165
PanTau::TauConstituent::t_OutChrg
@ t_OutChrg
Definition: TauConstituent.h:47
PanTau::Tool_TauConstituentSelector::m_Tool_InformationStoreName
std::string m_Tool_InformationStoreName
Definition: Tool_TauConstituentSelector.h:52
PanTau::TauConstituent::removeTypeFlag
void removeTypeFlag(TauConstituent::Type aType)
Definition: TauConstituent.cxx:151