ATLAS Offline Software
Loading...
Searching...
No Matches
DisplacedJetDispHypoTool.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
11using namespace TrigCompositeUtils;
12
13DisplacedJetDispHypoTool::DisplacedJetDispHypoTool( const std::string& type,const std::string& name,const IInterface* parent )
14: AthAlgTool( type, name, parent ),
15m_decisionId( HLT::Identifier::fromToolName( name ) ) {}
16
18 if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
19 return StatusCode::SUCCESS;
20}
21
22StatusCode DisplacedJetDispHypoTool::decide( Info& info ) const {
23 if ( info.previousDecisionIDs.count( m_decisionId.numeric() ) == 0 ) {
24 ATH_MSG_DEBUG("Already rejected");
25 return StatusCode::SUCCESS;
26 }
27
28 auto mon_ndisp = Monitored::Scalar<int>("ndisp", -1);
29 auto mon_nprompt = Monitored::Scalar<int>("nprompt", -1);
30 auto mon_frac_other = Monitored::Scalar<float>("frac_other", -1.0);
31
32 std::vector<float> monvec_trk_d0sig;
33 std::vector<float> monvec_trk_z0st;
34 std::vector<float> monvec_trk_d0;
35
36 auto mon_trk_d0sig = Monitored::Collection("trk_d0sig", monvec_trk_d0sig);
37 auto mon_trk_z0st = Monitored::Collection("trk_z0st", monvec_trk_z0st);
38 auto mon_trk_d0 = Monitored::Collection("trk_d0", monvec_trk_d0);
39
40 Monitored::Group mon_group(m_monTool, mon_ndisp, mon_nprompt, mon_frac_other, mon_trk_d0sig, mon_trk_z0st, mon_trk_d0);
41
42 //apply the track counting for the displaced tracks
43 int ndisp = info.counts->getDetail<int>("ndisp_"+m_cutname);
44 int nother = info.counts->getDetail<int>("nother_"+m_cutname);
45 int nprompt = info.counts->getDetail<int>("nprompt_"+m_cutname);
46
47
48 for(auto trk: *(info.lrt_tracks)){
49 if(trk->pt()/Gaudi::Units::GeV < m_min_trk_pt) continue;
50 unsigned int track_class = 0;
51
52 monvec_trk_d0.push_back(std::abs(trk->d0()));
53
54 if(std::abs(trk->d0()) < m_d0cut){
55 double dz0 = trk->z0() + trk->vz() - info.primary_vertex->z();
56 double dz0st = std::abs(std::sin(trk->theta()) * dz0);
57
58 monvec_trk_z0st.push_back(dz0st);
59
60 if(dz0st <= m_z0stcut){
61 track_class = 1; //prompt
62 }
63 }else{
64 double d0sig = 0.0;
65
66 if(m_usebeamspot){
67 d0sig = std::abs(xAOD::TrackingHelpers::d0significance(trk, info.beamspot.sigmaX(), info.beamspot.sigmaY(), info.beamspot.sigmaXY()));
68 }else{
69 d0sig = std::abs(xAOD::TrackingHelpers::d0significance(trk));
70 }
71
72 monvec_trk_d0sig.push_back(d0sig);
73
74 //candidate displaced
75 if(d0sig >= m_d0sigcut){
76 track_class = 2; //displaced
77 ATH_MSG_DEBUG("disp_trk in jet "<<info.jet->pt()/Gaudi::Units::GeV<<" accepted pT: "<<trk->pt()/Gaudi::Units::GeV<<" d0: "<<std::abs(trk->d0())<< " d0sig: "<<d0sig);
78 }else{
79 ATH_MSG_DEBUG("disp_trk in jet "<<info.jet->pt()/Gaudi::Units::GeV<<" dropped for d0sig pT: "<<trk->pt()/Gaudi::Units::GeV<<" d0: "<<std::abs(trk->d0())<< " d0sig: "<<d0sig);
80 }
81 }
82
83 if(track_class == 1){
84 nprompt += 1;
85 }else if(track_class == 2){
86 ndisp += 1;
87 }else if(track_class == 0){
88 nother += 1;
89 }
90 }
91 double nother_frac = 0.0;
92 //ensure divide by zero does not occur
93 if((nother + ndisp + nprompt) > 0){
94 nother_frac = nother*1.0/(nother + ndisp + nprompt);
95 }
96
97 ANA_MSG_DEBUG("jet pT = "<<info.jet->pt()/Gaudi::Units::GeV<<" nPrompt = "<<nprompt<<" nDisp = "<<ndisp<<" nother = "<<nother);
98
99 mon_ndisp = ndisp;
100 mon_nprompt = nprompt;
101 mon_frac_other = nother_frac;
102
103 if(ndisp >= m_mindisp && nprompt <= m_maxprompt && nother_frac <= m_nother_frac){
104 //monitor passing jet pt and eta
105 auto mon_jetpt = Monitored::Scalar<float>("pass_jet_pt", 0.0);
106 auto mon_jeteta = Monitored::Scalar<float>("pass_jet_eta", -100);
107 Monitored::Group mg_passing(m_monTool, mon_jetpt, mon_jeteta);
108 mon_jetpt = info.jet->pt()/Gaudi::Units::GeV;
109 mon_jeteta = info.jet->eta();
110
111 addDecisionID( m_decisionId.numeric(), info.decision );
112 }
113
114 return StatusCode::SUCCESS;
115}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
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:
virtual StatusCode initialize() override
Gaudi::Property< float > m_min_trk_pt
ToolHandle< GenericMonitoringTool > m_monTool
Gaudi::Property< float > m_d0cut
Gaudi::Property< bool > m_usebeamspot
Gaudi::Property< float > m_z0stcut
DisplacedJetDispHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< float > m_nother_frac
StatusCode decide(Info &info) const
Gaudi::Property< std::string > m_cutname
Gaudi::Property< int > m_maxprompt
Gaudi::Property< int > m_mindisp
Gaudi::Property< float > m_d0sigcut
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)