ATLAS Offline Software
TrigTauCaloHypoTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6  *
7  * NAME: TrigTauCaloHypoTool.cxx
8  * PACKAGE: Trigger/TrigHypothesis/TrigTauHypo
9  *
10  * AUTHORS: P.O. DeViveiros, J.Y. Beaucamp
11  * CREATED: Sometime in early 2015
12  *
13  * DESCRIPTION: Implementation of CaloMVA cuts. Based on the original
14  * TrigTauGenericHypo.
15  *
16  *********************************************************************/
17 
21 #include "GaudiKernel/SystemOfUnits.h"
22 
23 #include "TrigTauCaloHypoTool.h"
24 
25 
26 using namespace TrigCompositeUtils;
27 
28 TrigTauCaloHypoTool::TrigTauCaloHypoTool(const std::string& type, const std::string& name, const IInterface* parent)
29  : base_class(type, name, parent), m_decisionId(HLT::Identifier::fromToolName(name))
30 {
31 
32 }
33 
34 
36 {
37  if(!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
38 
39  ATH_MSG_DEBUG("Tool configured for chain/id: " << m_decisionId);
40  ATH_MSG_DEBUG(" - PtMin: " << m_ptMin.value());
41  ATH_MSG_DEBUG(" - AcceptAll: " << m_acceptAll.value());
42 
43  return StatusCode::SUCCESS;
44 }
45 
46 
48 {
49  // Monitoring config
50  auto passedCuts = Monitored::Scalar<unsigned int>("CutCounter", 0);
51  auto pT = Monitored::Scalar<float>("pT", 0);
52  auto mon = Monitored::Group(m_monTool, passedCuts);
53 
54 
55  // Get TauJet collection
56  const xAOD::TauJetContainer* tauJets = input.tauContainer;
57 
58  if(tauJets->empty()){
59  ATH_MSG_DEBUG("No taus in input collection: Rejecting");
60  return false;
61  }
62 
63 
64  // Tau pass flag
65  bool pass = false;
66 
67  if(m_acceptAll) {
68  pass = true;
69  ATH_MSG_DEBUG("AcceptAll property is set: taking all events");
70  }
71 
72 
73  // There should only be a single TauJet in the container (one TauJet in the view);
74  // just in case we still run the loop
75  for(const xAOD::TauJet* tau : *tauJets) {
76  ATH_MSG_DEBUG(" New HLT TauJet candidate");
77 
78  ATH_MSG_DEBUG(" pT: " << tau->pt() / Gaudi::Units::GeV);
79 
80  // Evaluate minimum pT cut
81  if(!(tau->pt() > m_ptMin)) continue;
82  passedCuts++;
83  pT = tau->pt() / Gaudi::Units::GeV;
84 
85  pass = true;
86 
87  ATH_MSG_DEBUG(" Pass hypo tool: " << pass);
88  }
89 
90  return pass;
91 }
92 
93 
94 StatusCode TrigTauCaloHypoTool::decide(std::vector<ITrigTauCaloHypoTool::ToolInfo>& input) const
95 {
96  for(auto& i : input) {
97  if(passed(m_decisionId.numeric(), i.previousDecisionIDs)) {
98  if(decide(i)) {
99  addDecisionID(m_decisionId, i.decision);
100  }
101  }
102  }
103  return StatusCode::SUCCESS;
104 }
105 
TrigTauCaloHypoTool.h
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
ITrigTauCaloHypoTool::ToolInfo
Definition: ITrigTauCaloHypoTool.h:25
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
TrigTauCaloHypoTool::decide
virtual StatusCode decide(std::vector< ITrigTauCaloHypoTool::ToolInfo > &input) const override
Definition: TrigTauCaloHypoTool.cxx:94
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
TrigTauCaloHypoTool::initialize
virtual StatusCode initialize() override
Definition: TrigTauCaloHypoTool.cxx:35
TrigTauCaloHypoTool::TrigTauCaloHypoTool
TrigTauCaloHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigTauCaloHypoTool.cxx:28
TrigCompositeUtils.h
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TauJetContainer.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
TrigTauCaloHypoTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigTauCaloHypoTool.h:49
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
TrigTauCaloHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: TrigTauCaloHypoTool.h:43
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
TrigTauCaloHypoTool::m_ptMin
Gaudi::Property< float > m_ptMin
Definition: TrigTauCaloHypoTool.h:45
TrigTauCaloHypoTool::m_acceptAll
Gaudi::Property< bool > m_acceptAll
Definition: TrigTauCaloHypoTool.h:47
Identifier
Definition: IdentifierFieldParser.cxx:14