ATLAS Offline Software
TrigJetEJsHypoTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ********************************************************************
6 //
7 // NAME: TrigJetEJsHypoTool.cxx
8 // PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo
9 //
10 //
11 // ********************************************************************
12 
13 #include "TrigJetEJsHypoTool.h"
14 #include "GaudiKernel/StatusCode.h"
15 
18 #include "./DebugInfoCollector.h"
19 #include "./xAODJetCollector.h"
20 
24 
30 
31 using namespace TrigCompositeUtils;
32 
34  const std::string& name,
35  const IInterface* parent) :
37  m_decisionId(HLT::Identifier::fromToolName(name)){
38 
39 }
40 
41 
43 }
44 
46 
47  if (m_visitDebug){
48 
49  DebugInfoCollector collector(name());
50  CHECK(m_helper->getDescription(collector));
51  auto s = collector.toString();
52 
53  for(const auto& l : lineSplitter(s)){
54  ATH_MSG_INFO(l);
55  }
56  }
57 
58  return StatusCode::SUCCESS;
59 }
60 
62  return StatusCode::SUCCESS;
63 }
64 
66 TrigJetEJsHypoTool::decide( std::vector<JetInfo>& input ) const {
67 
68  for ( auto i: input ) {
69 
70  if ( i.previousDecisionsIDs.count( m_decisionId.numeric() ) == 0 ) {
71  continue;
72  }
73 
74  ATH_MSG_DEBUG("starting exotic/trackless jet chain");
75 
76  bool objDecision = true;
77 
78  // start with cut on jet pT
79  auto jetPt= (i.jet)->pt();
80  if((m_trackless == 0 && jetPt < m_jetPtCut_Exotics ) || \
81  (m_trackless == 1 && jetPt < m_jetPtCut_Trackless)) {
82  objDecision = false;
83  }
84 
85  // cut on jet eta
86  auto jetEta=std::abs( (i.jet)->p4().Eta() );
87  if ( (m_trackless == 0 && jetEta > m_jetEtaCut_Exotics ) || \
88  (m_trackless == 1 && jetEta > m_jetEtaCut_Trackless ) || \
89  (jetPt <= 0.0) ) {
90  objDecision = false;
91  }
92 
93  float promptTrackFrac = -2.0;
94 
95  if (objDecision == true) {
96 
97  // Exotics (emerging jets) chain decision
98  if (m_trackless == 0) {
99  promptTrackFrac = 0.0;
100  for (auto trackIter = i.AllTracks->begin(); trackIter != i.AllTracks->end(); ++trackIter){
101  float trackPt = (*trackIter)->pt();
102  if (std::abs((*trackIter)->z0() + (*trackIter)->vz() - i.PV->z()) > m_PV_z || trackPt < m_trackPtCut_Exotics || \
103  std::abs((*trackIter)->eta()) > m_trackEtaCut_Exotics || (i.jet)->p4().DeltaR((*trackIter)->p4()) > m_dr)
104  continue;
105 
106  float sigma = 1e6;
107  // Definition of promptTrackFrac background jet d0 RMS
108  if (trackPt > 0.0) sigma = 1000.0 * 0.0463 / trackPt + 0.0195;
109 
110  // if d0 greater than a multiple of sigma, is not a prompt track
111  if (std::abs((*trackIter)->d0()) > m_PTFSigmaCut*sigma) continue;
112  promptTrackFrac += trackPt;
113 
114  // Exit track loop if PTF is greater than cut, no need to continue loop
115  if (promptTrackFrac/jetPt > m_ptf) break;
116  }
117 
118  promptTrackFrac /= jetPt;
119 
120  ATH_MSG_DEBUG("exotics jets chain promptTrackFrac: " << promptTrackFrac);
121  if (promptTrackFrac < -0.5 || promptTrackFrac > m_ptf) objDecision = false;
122  }
123 
124  // Trackless chain decision
125  else if (m_trackless == 1) {
126  int matchedtracks = 0;
127  // Loop over tracks, selection ones passing pT, eta, and dR cuts to jet
128  for (auto trackIter = i.AllTracks->begin(); trackIter != i.AllTracks->end(); ++trackIter){
129  if ((*trackIter)->pt() < m_trackPtCut_Trackless || std::abs((*trackIter)->eta()) > m_trackEtaCut_Trackless \
130  || (i.jet)->p4().DeltaR((*trackIter)->p4()) > m_dr)
131  continue;
132  matchedtracks++;
133  if (matchedtracks > m_matchedTracksCut_Trackless) {
134  objDecision = false;
135  break;
136  }
137 
138  }
139  ATH_MSG_DEBUG("Number of matched tracks (" << matchedtracks << ") greater than cutoff - in trackless jet chain");
140  }
141 
142  } // end if objDecision == true
143 
144  if ( objDecision == true ) {
145  ATH_MSG_DEBUG("passed exotics/trackless jet chain decision with PTF: " << promptTrackFrac << "\ttrackless: " << m_trackless << "\tpt: " << jetPt << "\teta: " << jetEta);
146  addDecisionID( m_decisionId.numeric(), i.decision );
147  }
148 
149  } // end loop over inputs
150 
151  return StatusCode::SUCCESS;
152 }
TrigJetEJsHypoTool::m_jetPtCut_Trackless
double m_jetPtCut_Trackless
Definition: TrigJetEJsHypoTool.h:110
lineSplitter.h
TrigJetEJsHypoTool::m_PTFSigmaCut
double m_PTFSigmaCut
Definition: TrigJetEJsHypoTool.h:118
TrigJetEJsHypoTool::m_matchedTracksCut_Trackless
int m_matchedTracksCut_Trackless
Definition: TrigJetEJsHypoTool.h:121
DebugInfoCollector::toString
virtual std::string toString() const override
Definition: DebugInfoCollector.cxx:70
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
TrigCompositeUtils::DecisionContainer
xAOD::TrigCompositeContainer DecisionContainer
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigCompositeContainer.h:21
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
TrigJetEJsHypoTool::m_jetEtaCut_Exotics
double m_jetEtaCut_Exotics
Definition: TrigJetEJsHypoTool.h:114
TrigJetEJsHypoTool::m_jetPtCut_Exotics
double m_jetPtCut_Exotics
Definition: TrigJetEJsHypoTool.h:109
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
test_pyathena.pt
pt
Definition: test_pyathena.py:11
lineSplitter
std::vector< std::string > lineSplitter(const std::string &s, char delimiter)
Definition: lineSplitter.cxx:8
TrigJetEJsHypoTool::TrigJetEJsHypoTool
TrigJetEJsHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigJetEJsHypoTool.cxx:33
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
TrigJetEJsHypoTool::~TrigJetEJsHypoTool
~TrigJetEJsHypoTool()
Definition: TrigJetEJsHypoTool.cxx:42
TrigJetEJsHypoTool::m_dr
Gaudi::Property< double > m_dr
Definition: TrigJetEJsHypoTool.h:98
TrigCompositeUtils.h
TrigJetEJsHypoTool::decide
StatusCode decide(std::vector< JetInfo > &decisions) const
Definition: TrigJetEJsHypoTool.cxx:66
TrigJetEJsHypoTool::m_helper
ToolHandle< ITrigJetHypoToolHelper > m_helper
Definition: TrigJetEJsHypoTool.h:88
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
TrigJetEJsHypoTool::m_trackPtCut_Trackless
double m_trackPtCut_Trackless
Definition: TrigJetEJsHypoTool.h:106
TrigJetEJsHypoTool::m_trackless
Gaudi::Property< int > m_trackless
Definition: TrigJetEJsHypoTool.h:99
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
DebugInfoCollector.h
TrigJetEJsHypoTool::m_visitDebug
Gaudi::Property< bool > m_visitDebug
Definition: TrigJetEJsHypoTool.h:92
DebugInfoCollector
Definition: DebugInfoCollector.h:13
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
xAODJetCollector.h
TrigJetEJsHypoTool::finalize
StatusCode finalize()
Definition: TrigJetEJsHypoTool.cxx:61
TrigJetEJsHypoTool::initialize
StatusCode initialize()
Definition: TrigJetEJsHypoTool.cxx:45
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
TrigCompositeContainer.h
TauGNNUtils::Variables::Track::trackPt
bool trackPt(const xAOD::TauJet &, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:472
TrigJetEJsHypoTool::m_trackPtCut_Exotics
double m_trackPtCut_Exotics
Definition: TrigJetEJsHypoTool.h:105
TrigJetEJsHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: TrigJetEJsHypoTool.h:86
TrigJetEJsHypoTool::m_trackEtaCut_Trackless
double m_trackEtaCut_Trackless
Definition: TrigJetEJsHypoTool.h:103
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:20
xAODJetAsIJetFactory.h
TrigJetEJsHypoTool::m_ptf
Gaudi::Property< double > m_ptf
Definition: TrigJetEJsHypoTool.h:97
TrigJetEJsHypoTool::m_PV_z
double m_PV_z
Definition: TrigJetEJsHypoTool.h:123
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
HLTIdentifier.h
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
TrigJetEJsHypoTool.h
TrigJetEJsHypoTool::m_trackEtaCut_Exotics
double m_trackEtaCut_Exotics
Definition: TrigJetEJsHypoTool.h:102
AthAlgTool
Definition: AthAlgTool.h:26
TrigJetEJsHypoTool::m_jetEtaCut_Trackless
double m_jetEtaCut_Trackless
Definition: TrigJetEJsHypoTool.h:115
Identifier
Definition: IdentifierFieldParser.cxx:14