ATLAS Offline Software
Tool_TauConstituentSelector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 
10 
12  asg::AsgTool(name)
13 {
14 }
15 
16 
18 
19 
21 
22  ATH_MSG_INFO(" initialize()");
23  m_init=true;
24 
25  ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_InformationStore, m_Tool_InformationStoreName ) );
26  ATH_CHECK( m_Tool_InformationStore.retrieve() );
27 
28  ATH_CHECK( m_Tool_InformationStore->getInfo_Double("TauConstituents_MaxEta", m_MaxEta) );
29 
30  //eta bin edges
31  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_BinEdges_Eta", m_BinEdges_Eta) );
32 
33  //et cuts for types used in mode reco
34  ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("TauConstituents_Selection_Neutral_EtaBinned_EtCut", m_Selection_Neutral_EtaBinned_EtCut) );
35 
36  return StatusCode::SUCCESS;
37 }
38 
39 
41 
42  for (unsigned int iEtaBin=0; iEtaBin<m_BinEdges_Eta.size()-1; iEtaBin++) {
43  if (m_BinEdges_Eta[iEtaBin] <= eta && eta < m_BinEdges_Eta[iEtaBin+1]) {
44  switch(constituentType) {
45  case PanTau::TauConstituent::t_Neutral: return m_Selection_Neutral_EtaBinned_EtCut[iEtaBin];
46  default:
47  return 9999999.;
48  }
49  }
50  }
51 
52  ATH_MSG_WARNING("Eta value of " << eta << " could not be matched to any eta bin!");
53  return 9999999.;
54 }
55 
56 
62  std::vector<TauConstituent*>& outputList) const {
63 
64  for (unsigned int iConst=0; iConst<inputList.size(); iConst++) {
65 
66  PanTau::TauConstituent* curConstituent = inputList[iConst];
67 
68  //general preselection:
69  double curEta = std::abs( curConstituent->p4().Eta() );
70  if (curEta > m_MaxEta) {
71  ATH_MSG_DEBUG("\tNot using constituent with eta of " << curEta);
72  continue;
73  }
74 
75  bool passesSelection = false;
76 
77  // check if constituent is charged:
78  if (curConstituent->isOfType(PanTau::TauConstituent::t_Charged)) {
79  // we want to use all tracks
80  passesSelection = true;
81 
82  // check if constituent is neutral, assign correctly pi0neut and neut flags:
83  } else if (curConstituent->isOfType(PanTau::TauConstituent::t_Neutral)) {
84  passesSelection = passesSelection_NeutralConstituent(curConstituent);
85 
86  //special treatment for the testing neutral flags
87  if (!passesSelection) {
90  }
91  } else {
92  ATH_MSG_DEBUG("Unhandled constituent type (" << curConstituent->getTypeNameString()
93  << ") when trying to apply constituent selection - constituent will not be selected!");
94  passesSelection = false;
95  }
96 
97  if (!passesSelection) continue;
98 
99  outputList.push_back(inputList[iConst]);
100  }
101 
102  return StatusCode::SUCCESS;
103 }
104 
105 
107 
108  TLorentzVector tlv_Constituent = tauConstituent->p4();
109 
110  if (tlv_Constituent.Et() < getEtCut(std::abs(tlv_Constituent.Eta()), PanTau::TauConstituent::t_Neutral)) {
111  ATH_MSG_DEBUG("\tNot using constituent at eta " << tlv_Constituent.Eta() << " with et of " << tlv_Constituent.Et());
112  return false;
113  }
114 
115  return true;
116 }
117 
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:40
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:20
PanTau::TauConstituent::t_Charged
@ t_Charged
Definition: TauConstituent.h:44
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:192
TauConstituent.h
PanTau::Tool_TauConstituentSelector::passesSelection_NeutralConstituent
virtual bool passesSelection_NeutralConstituent(TauConstituent *tauConstituent) const
Definition: Tool_TauConstituentSelector.cxx:106
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
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
PanTau::HelperFunctions::bindToolHandle
static StatusCode bindToolHandle(ToolHandle< T > &, std::string)
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:56
PanTau::TauConstituent::isOfType
bool isOfType(TauConstituent::Type aType) const
Definition: TauConstituent.cxx:213
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
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:61
PanTau::TauConstituent
Definition: TauConstituent.h:25
PanTau::TauConstituent::removeTypeFlag
void removeTypeFlag(TauConstituent::Type aType)
Definition: TauConstituent.cxx:151