ATLAS Offline Software
Loading...
Searching...
No Matches
DisplacedJetPromptHypoTool.cxx
Go to the documentation of this file.
1
2/*
3Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4*/
5
6
10
12
13using namespace TrigCompositeUtils;
14
15DisplacedJetPromptHypoTool::DisplacedJetPromptHypoTool( const std::string& type,const std::string& name,const IInterface* parent )
16: AthAlgTool( type, name, parent ),
17m_decisionId( HLT::Identifier::fromToolName( name ) ) {}
18
20 if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
21 return StatusCode::SUCCESS;
22}
23
24StatusCode DisplacedJetPromptHypoTool::decide( Info& info ) const {
25 //setup monitoring
26 auto mon_nprompt = Monitored::Scalar<int>("nprompt", -1);
27
28 std::vector<float> monvec_trk_d0sig;
29 std::vector<float> monvec_trk_z0st;
30 std::vector<float> monvec_trk_d0;
31
32 auto mon_trk_d0sig = Monitored::Collection("trk_d0sig", monvec_trk_d0sig);
33 auto mon_trk_z0st = Monitored::Collection("trk_z0st", monvec_trk_z0st);
34 auto mon_trk_d0 = Monitored::Collection("trk_d0", monvec_trk_d0);
35 Monitored::Group mon_group(m_monTool, mon_nprompt, mon_trk_z0st, mon_trk_d0sig, mon_trk_d0);
36
37
38 if ( info.previousDecisionIDs.count( m_decisionId.numeric() ) == 0 ) {
39 ATH_MSG_DEBUG("Already rejected");
40 return StatusCode::SUCCESS;
41 }
42
43 //apply jet cuts
44 //jet pt cut
45 if(info.jet->pt()/Gaudi::Units::GeV < m_min_jet_pt){
46 return StatusCode::SUCCESS;
47 }
48
49 //reject jets outside the barrel region
50 if(std::abs(info.jet->eta()) > 2.4){
51 return StatusCode::SUCCESS;
52 }
53
54 //apply track counts
55 int nprompt = 0;
56 int nother = 0;
57 int ndisp = 0;
58
59 for(auto trk: info.tracks){
60 if(trk->pt()/Gaudi::Units::GeV < m_min_trk_pt) continue;
61 unsigned int track_class = 0;
62
63 monvec_trk_d0.push_back(std::abs(trk->d0()));
64
65 if(std::abs(trk->d0()) < m_d0cut){
66 double dz0 = trk->z0() + trk->vz() - info.primary_vertex->z();
67 double dz0st = std::abs(std::sin(trk->theta()) * dz0);
68
69 monvec_trk_z0st.push_back(dz0st);
70
71 if(dz0st <= m_z0stcut){
72 track_class = 1; //prompt
73 }
74 }else{
75 //candidate displaced
76 double d0sig = 0.0;
77
78 if(m_usebeamspot){
79 d0sig = std::abs(xAOD::TrackingHelpers::d0significance(trk, info.beamspot.sigmaX(), info.beamspot.sigmaY(), info.beamspot.sigmaXY()));
80 }else{
81 d0sig = std::abs(xAOD::TrackingHelpers::d0significance(trk));
82 }
83
84 monvec_trk_d0sig.push_back(d0sig);
85
86 if(d0sig >= m_d0sigcut){
87 track_class = 2; //displaced
88 }
89 }
90
91 if(track_class == 1){
92 nprompt += 1;
93 }else if(track_class == 2){
94 ndisp += 1;
95 }else if(track_class == 0){
96 nother += 1;
97 }
98 }
99
100 mon_nprompt = nprompt;
101
102 if(nprompt > m_maxprompt){
103 //reject the jet
104 return StatusCode::SUCCESS;
105 }
106
107 //store in counts container
108 info.counts->setDetail<int>("nprompt_"+m_cutname, nprompt);
109 info.counts->setDetail<int>("ndisp_"+m_cutname, ndisp);
110 info.counts->setDetail<int>("nother_"+m_cutname, nother);
111
112 ATH_MSG_DEBUG("Passing Jet pT = "<<info.jet->pt()/Gaudi::Units::GeV);
113
114 //record some info about the passed jet
115 auto mon_jetpt = Monitored::Scalar<float>("pass_jet_pt", 0.0);
116 auto mon_jeteta = Monitored::Scalar<float>("pass_jet_eta", -100);
117 Monitored::Group mg_passing(m_monTool, mon_jetpt, mon_jeteta);
118 mon_jetpt = info.jet->pt()/Gaudi::Units::GeV;
119 mon_jeteta = info.jet->eta();
120
121 addDecisionID(m_decisionId.numeric(), info.output_decision);
122
123 return StatusCode::SUCCESS;
124}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
Header file to be included by clients of the Monitored infrastructure.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Property< float > m_min_trk_pt
Gaudi::Property< float > m_d0sigcut
ToolHandle< GenericMonitoringTool > m_monTool
Gaudi::Property< float > m_min_jet_pt
Gaudi::Property< std::string > m_cutname
Gaudi::Property< bool > m_usebeamspot
virtual StatusCode initialize() override
DisplacedJetPromptHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode decide(Info &info) const
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
double d0significance(const xAOD::TrackParticle *tp, double d0_uncert_beam_spot_2)