ATLAS Offline Software
Loading...
Searching...
No Matches
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
19#include "./xAODJetCollector.h"
20
24
30
31using namespace TrigCompositeUtils;
32
34 const std::string& name,
35 const IInterface* parent) :
36 AthAlgTool(type, name, parent),
37 m_decisionId(HLT::Identifier::fromToolName(name)){
38
39}
40
41
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
65StatusCode
66TrigJetEJsHypoTool::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}
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
virtual std::string toString() const override
Gaudi::Property< double > m_dr
HLT::Identifier m_decisionId
Gaudi::Property< double > m_ptf
Gaudi::Property< int > m_trackless
StatusCode decide(std::vector< JetInfo > &decisions) const
TrigJetEJsHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
ToolHandle< ITrigJetHypoToolHelper > m_helper
Gaudi::Property< bool > m_visitDebug
std::vector< std::string > lineSplitter(const std::string &s, char delimiter)
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
unsigned int DecisionID
std::set< DecisionID > DecisionIDContainer
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.