ATLAS Offline Software
DisplacedJetPromptHypoTool.cxx
Go to the documentation of this file.
1 
2 /*
3 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 
10 
12 
13 using namespace TrigCompositeUtils;
14 
15 DisplacedJetPromptHypoTool::DisplacedJetPromptHypoTool( const std::string& type,const std::string& name,const IInterface* parent )
16 : AthAlgTool( type, name, parent ),
17 m_decisionId( HLT::Identifier::fromToolName( name ) ) {}
18 
20  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
21  return StatusCode::SUCCESS;
22 }
23 
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 }
grepfile.info
info
Definition: grepfile.py:38
DisplacedJetPromptHypoTool::m_usebeamspot
Gaudi::Property< bool > m_usebeamspot
Definition: DisplacedJetPromptHypoTool.h:55
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
DisplacedJetPromptHypoTool::m_maxprompt
Gaudi::Property< int > m_maxprompt
Definition: DisplacedJetPromptHypoTool.h:49
DisplacedJetPromptHypoTool::DisplacedJetPromptHypoTool
DisplacedJetPromptHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: DisplacedJetPromptHypoTool.cxx:15
DisplacedJetPromptHypoTool::m_d0sigcut
Gaudi::Property< float > m_d0sigcut
Definition: DisplacedJetPromptHypoTool.h:48
TrackParticlexAODHelpers.h
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
xAOD::TrackingHelpers::d0significance
double d0significance(const xAOD::TrackParticle *tp, double d0_uncert_beam_spot_2)
Definition: TrackParticlexAODHelpers.cxx:42
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition: MonitoredGroup.h:54
DisplacedJetPromptHypoTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: DisplacedJetPromptHypoTool.h:58
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
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
DisplacedJetPromptHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: DisplacedJetPromptHypoTool.h:43
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
DisplacedJetPromptHypoTool::initialize
virtual StatusCode initialize() override
Definition: DisplacedJetPromptHypoTool.cxx:19
DisplacedJetPromptHypoTool::Info
Definition: DisplacedJetPromptHypoTool.h:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DisplacedJetPromptHypoTool::m_cutname
Gaudi::Property< std::string > m_cutname
Definition: DisplacedJetPromptHypoTool.h:52
DisplacedJetPromptHypoTool::m_d0cut
Gaudi::Property< float > m_d0cut
Definition: DisplacedJetPromptHypoTool.h:46
DisplacedJetPromptHypoTool.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
HLTIdentifier.h
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
DisplacedJetPromptHypoTool::m_min_trk_pt
Gaudi::Property< float > m_min_trk_pt
Definition: DisplacedJetPromptHypoTool.h:45
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
AthAlgTool
Definition: AthAlgTool.h:26
DisplacedJetPromptHypoTool::decide
StatusCode decide(Info &info) const
Definition: DisplacedJetPromptHypoTool.cxx:24
DisplacedJetPromptHypoTool::m_min_jet_pt
Gaudi::Property< float > m_min_jet_pt
Definition: DisplacedJetPromptHypoTool.h:44
DisplacedJetPromptHypoTool::m_z0stcut
Gaudi::Property< float > m_z0stcut
Definition: DisplacedJetPromptHypoTool.h:47
Identifier
Definition: IdentifierFieldParser.cxx:14