ATLAS Offline Software
DisplacedJetDispHypoTool.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 
11 using namespace TrigCompositeUtils;
12 
13 DisplacedJetDispHypoTool::DisplacedJetDispHypoTool( const std::string& type,const std::string& name,const IInterface* parent )
14 : AthAlgTool( type, name, parent ),
15 m_decisionId( HLT::Identifier::fromToolName( name ) ) {}
16 
18  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
19  return StatusCode::SUCCESS;
20 }
21 
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 }
grepfile.info
info
Definition: grepfile.py:38
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
DisplacedJetDispHypoTool::m_nother_frac
Gaudi::Property< float > m_nother_frac
Definition: DisplacedJetDispHypoTool.h:53
TrackParticlexAODHelpers.h
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
DisplacedJetDispHypoTool::m_d0sigcut
Gaudi::Property< float > m_d0sigcut
Definition: DisplacedJetDispHypoTool.h:48
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
DisplacedJetDispHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: DisplacedJetDispHypoTool.h:43
DisplacedJetDispHypoTool::m_d0cut
Gaudi::Property< float > m_d0cut
Definition: DisplacedJetDispHypoTool.h:45
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
DisplacedJetDispHypoTool::m_usebeamspot
Gaudi::Property< bool > m_usebeamspot
Definition: DisplacedJetDispHypoTool.h:57
DisplacedJetDispHypoTool::m_mindisp
Gaudi::Property< int > m_mindisp
Definition: DisplacedJetDispHypoTool.h:52
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
DisplacedJetDispHypoTool::m_cutname
Gaudi::Property< std::string > m_cutname
Definition: DisplacedJetDispHypoTool.h:55
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
DisplacedJetDispHypoTool::DisplacedJetDispHypoTool
DisplacedJetDispHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: DisplacedJetDispHypoTool.cxx:13
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.
DisplacedJetDispHypoTool::Info
Definition: DisplacedJetDispHypoTool.h:29
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DisplacedJetDispHypoTool::m_z0stcut
Gaudi::Property< float > m_z0stcut
Definition: DisplacedJetDispHypoTool.h:47
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
HLTIdentifier.h
DisplacedJetDispHypoTool::m_maxprompt
Gaudi::Property< int > m_maxprompt
Definition: DisplacedJetDispHypoTool.h:51
DisplacedJetDispHypoTool::decide
StatusCode decide(Info &info) const
Definition: DisplacedJetDispHypoTool.cxx:22
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
AthAlgTool
Definition: AthAlgTool.h:26
DisplacedJetDispHypoTool::initialize
virtual StatusCode initialize() override
Definition: DisplacedJetDispHypoTool.cxx:17
DisplacedJetDispHypoTool::m_min_trk_pt
Gaudi::Property< float > m_min_trk_pt
Definition: DisplacedJetDispHypoTool.h:44
DisplacedJetDispHypoTool.h
DisplacedJetDispHypoTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: DisplacedJetDispHypoTool.h:59
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288
Identifier
Definition: IdentifierFieldParser.cxx:14