ATLAS Offline Software
TrigTauGenericHypo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6  *
7  * NAME: TrigTauGenericHypo.cxx
8  * PACKAGE: Trigger/TrigHypothesis/TrigTauHypo
9  *
10  * AUTHORS: P.O. DeViveiros
11  * CREATED: Sometime in early 2015
12  *
13  * DESCRIPTION:
14  *
15  * Generic cut-based hypo
16  *
17  *********************************************************************/
18 
19 #include "GaudiKernel/StatusCode.h"
21 
22 #include "xAODJet/Jet.h"
23 #include "xAODTau/TauJet.h"
24 
25 #include "TrigTauGenericHypo.h"
27 
28 
30  const std::string& name,
31  const IInterface* parent )
32  : base_class( type, name, parent ),
33  m_decisionId( HLT::Identifier::fromToolName( name ) )
34 {
35  declareProperty("Details", m_member);
36  declareProperty("Formulas", m_formula);
37 }
38 
39 
41 
42  if ( !m_monTool.empty() ) CHECK( m_monTool.retrieve() );
43 
44  ATH_MSG_DEBUG("Tool configured for chain/id: " << m_decisionId <<
45  ", AcceptAll = " << (m_acceptAll ? "True" : "False"));
46 
47  // Here we store the formulas since they need to compile
48  m_store.reserve(m_member.size());
49  msg(MSG::DEBUG) << "Cuts: ";
50  for(unsigned int i=0; i<m_member.size(); i++)
51  {
52  m_store.push_back(TFormula(("TauHypoCut"+m_formula.at(i)).c_str(), m_formula.at(i).c_str()));
53  msg(MSG::DEBUG) << "(" << m_formula.at(i) << ") ";
54  // x is the ID variables, y is Tau pT and z is Tau eta
55  }
56  msg(MSG::DEBUG) << endmsg;
57 
58  return StatusCode::SUCCESS;
59 }
60 
61 
63 
64  bool pass = false;
65 
66  auto passedCuts = Monitored::Scalar<unsigned int>( "CutCounter", 0 );
67  auto monitorIt = Monitored::Group( m_monTool, passedCuts );
68 
69  if ( m_acceptAll ) {
70  pass = true;
71  ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" );
72  }
73 
74  // get tau collection
75  auto pTauCont = input.taucontainer;
76 
77  if( not pTauCont->empty() ){
78  ATH_MSG_DEBUG("Input tau collection has size " << pTauCont->size());
79  }else {
80  ATH_MSG_DEBUG("No taus in input collection: Rejecting");
81  return false;
82  }
83 
84  const xAOD::TauJet* aTau = pTauCont->back();
85 
86  // We have to implement the cuts here - Eventually, declare the formulas in the initialize
87  for(unsigned int i=0; i<m_member.size(); i++)
88  {
89  float theValue = 0;
90 
91  // Detail -1 ignores by convention the ID variables
92  if(m_member.at(i) != -1)
93  {
95  aTau->detail(myDetail, theValue);
96  }
97 
98  // What about upper and lower bounds? can work using x, y, z, t...
99  double theResult = m_store.at(i).Eval(theValue, aTau->pt(), aTau->eta());
100  ATH_MSG_DEBUG("Evaluating Hypothesis on ID Variable #: " << m_member.at(i) <<
101  " with cut = " << m_formula.at(i).c_str() <<
102  " and value x (ID), y (pT), z (Eta) = " << theValue <<", "<< aTau->pt() <<
103  ", " << aTau->eta() <<
104  ", Result = " << (theResult > 0.5));
105 
106  if(theResult < 0.5)
107  break; // cut failed
108  else
109  ++passedCuts;
110  }
111 
112  if ( passedCuts!=m_member.size() )
113  {
114  ATH_MSG_DEBUG(" REGTEST: Cut Number: " << passedCuts
115  << " did not pass the threshold");
116  return pass;
117  }
118 
119  pass = true;
120  ATH_MSG_DEBUG(" REGTEST: TE accepted !! ");
121 
122  return pass;
123 }
124 
125 
126 
127 StatusCode TrigTauGenericHypo::decide( std::vector<ClusterInfo>& input ) const {
128 
129  using namespace TrigCompositeUtils;
130 
131  for ( auto& i: input ) {
132  if ( passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) {
133  if ( decide( i ) ) {
134  addDecisionID( m_decisionId, i.decision );
135  }
136  }
137  }
138  return StatusCode::SUCCESS;
139 }
140 
Jet.h
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
TrigTauGenericHypo::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigTauGenericHypo.h:68
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
xAOD::TauJet_v3::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
TrigTauGenericHypo::m_acceptAll
Gaudi::Property< bool > m_acceptAll
Definition: TrigTauGenericHypo.h:66
TrigTauGenericHypo::m_decisionId
HLT::Identifier m_decisionId
Definition: TrigTauGenericHypo.h:59
TrigTauGenericHypo::decide
virtual StatusCode decide(std::vector< ITrigTauGenericHypoTool::ClusterInfo > &input) const override
TrigTauGenericHypo::TrigTauGenericHypo
TrigTauGenericHypo(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigTauGenericHypo.cxx:29
xAOD::TauJet_v3::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
xAOD::TauJetParameters::Detail
Detail
Enum for tau parameters - used mainly for backward compatibility with the analysis code.
Definition: TauDefs.h:156
TrigTauGenericHypo::initialize
virtual StatusCode initialize() override
Definition: TrigTauGenericHypo.cxx:40
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:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
ITrigTauGenericHypoTool::ClusterInfo
Definition: ITrigTauGenericHypoTool.h:24
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigTauGenericHypo::m_formula
std::vector< std::string > m_formula
Definition: TrigTauGenericHypo.h:61
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
xAOD::TauJet_v3::detail
bool detail(TauJetParameters::Detail detail, int &value) const
Set veto flag.
Definition: TauJet_v3.cxx:292
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigTauGenericHypo::m_member
std::vector< int > m_member
Definition: TrigTauGenericHypo.h:60
TrigTauGenericHypo.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TauJet.h
DEBUG
#define DEBUG
Definition: page_access.h:11
HLTIdentifier.h
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
TrigTauGenericHypo::m_store
std::vector< TFormula > m_store
Definition: TrigTauGenericHypo.h:62
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7