ATLAS Offline Software
Loading...
Searching...
No Matches
DecoratePromptLeptonRNN.h
Go to the documentation of this file.
1// This is -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef DECORATELEPTONTAGGERRNN_H
8#define DECORATELEPTONTAGGERRNN_H
9
10/**********************************************************************************
11 * @Package: PhysicsAnpProd
12 * @Class : DecoratePromptLeptonRNN
13 * @Author : Rustem Ospanov
14 * @Author : Fudong He
15 *
16 * @Brief : Algorithm to compute RNN score for electrons and muons
17 *
18 **********************************************************************************/
19
20// Local
21#include "IRNNTool.h"
22
23// ROOT
24#include "TStopwatch.h"
25
26// Gaudi
27#include "GaudiKernel/ITHistSvc.h"
28#include "GaudiKernel/ToolHandle.h"
29
30// Athena
41#include <unordered_map>
42
43namespace Prompt
44{
45 // Forward declaration
46 class VarHolder;
47
48 // Main body
49
51 {
52 /*
53 Select the ID tracks near to the lepton, and prepare the RNN inputs variables of those ID tracks to the VarHolder objects.
54 Then pass the VarHolder objects to RNNTool class to get the RNN prediction.
55 Decorate the lepton with the RNN predictions.
56
57 */
58 public:
59
60 DecoratePromptLeptonRNN(const std::string& name, ISvcLocator* pSvcLocator);
61
62 virtual StatusCode initialize() override;
63 virtual StatusCode execute() override;
64 virtual StatusCode finalize() override;
65
67
69
70 const xAOD::Jet* findClosestTrackJet(const xAOD::TrackParticle *particle, const xAOD::JetContainer &trackJets);
71
72 bool compDummy(const xAOD::IParticle &particle,
73 std::vector<decoratorFloatH_t>& decors) const;
74
76 const xAOD::TrackParticle &track,
77 const xAOD::TrackParticle &lepton,
78 const xAOD::Jet &trackJet,
79 const xAOD::Vertex &priVtx,
80 const xAOD::EventInfo event);
81
82 bool compScore(const xAOD::IParticle &particle,
83 const std::vector<Prompt::VarHolder> &tracks,
84 std::vector<decoratorFloatH_t>& decors);
85
87
88 StatusCode makeHist(TH1 *&h, const std::string &key, int nbin, double xmin, double xmax);
89
90 // Properties:
91 Gaudi::Property<std::string> m_outputStream {this, "outputStream", "", "Path of the ROOT output directory of the histograms for RNN debug"};
92 Gaudi::Property<std::string> m_decorationPrefixRNN {this, "decorationPrefixRNN", "", "Prefix of the name for the decorator of RNN to the lepton"};
93
94 Gaudi::Property<double> m_minTrackpT {this, "minTrackpT", 500.0, "pT cut config for the input tracks to RNN"};
95 Gaudi::Property<double> m_maxTrackEta {this, "maxTrackEta", 2.5, "abs(eta) cut config for the input tracks to RNN"};
96 Gaudi::Property<double> m_maxTrackZ0Sin {this, "maxTrackZ0Sin", 1.0, "Z0sin cut config for the input tracks to RNN"};
97
98 Gaudi::Property<double> m_minTrackLeptonDR {this, "minTrackLeptonDR", 1.0e-6, "Delta R between lepton and track cut config for the input tracks to RNN"};
99 Gaudi::Property<double> m_maxTrackLeptonDR {this, "maxTrackLeptonDR", 0.4, "Delta R between lepton and track cut config for the input tracks to RNN"};
100 Gaudi::Property<double> m_maxLepTrackJetDR {this, "maxLepTrackJetDR", 0.4, "Maximum distance between lepton and track jet for track jet matching"};
101
102 Gaudi::Property<double> m_maxTrackSharedSiHits {this, "maxTrackSharedSiHits", 1.5, "track shared si hits cut config for the input tracks to RNN"};
103 Gaudi::Property<unsigned> m_minTrackSiHits {this, "minTrackSiHits", 6.5, "track silicon detector hits cut config for the input tracks to RNN"};
104 Gaudi::Property<unsigned> m_maxTrackSiHoles {this, "maxTrackSiHoles", 2.5, "track holes cut config for the input tracks to RNN"};
105 Gaudi::Property<unsigned> m_maxTrackPixHoles {this, "maxTrackPixHoles", 1.5, "track pixel holes cut config for the input tracks to RNN"};
106
107 Gaudi::Property<bool> m_debug {this, "debug", false, "debug statement"};
108 Gaudi::Property<bool> m_printTime {this, "printTime", false, "print running time, for debug"};
109
110 // Tools and services:
111 ToolHandle<IRNNTool> m_toolRNN {
112 this, "toolRNN", "defaultToolRNN", "Dedicated tool for RNN prediction"
113 };
114
116
117 // Read/write handles:
119 this, "inputContainerLepton", "",
120 "Container's name of the lepton that you want to decorate"
121 };
123 this, "inputContainerTrack", "", "Track container name"
124 };
126 this, "inputContainerTrackJet", "", "Track Jet container name"
127 };
129 this, "inputContainerPrimaryVertices", "", "Primary vertex container name"
130 };
131
133 this, "EventHandleKey", "EventInfo"
134 };
135
136 // Variables:
137 TStopwatch m_timerEvent;
139
140 std::map<std::string, TH1*> m_hists;
141
142 std::unique_ptr<SG::AuxElement::ConstAccessor<unsigned char> > m_accessQuality;
143
146 std::unordered_map<std::string, size_t> m_decorNameMap;
147 };
148}
149
150#endif
Handle class for adding a decoration to an object.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Header file for AthHistogramAlgorithm.
virtual StatusCode finalize() override
SG::ReadHandleKey< xAOD::JetContainer > m_inputContainerTrackJetKey
Gaudi::Property< double > m_maxTrackEta
SG::WriteDecorHandle< xAOD::IParticleContainer, float > decoratorFloatH_t
const xAOD::TrackParticle * findMuonTrack(const xAOD::Muon *muon)
bool compDummy(const xAOD::IParticle &particle, std::vector< decoratorFloatH_t > &decors) const
Gaudi::Property< unsigned > m_minTrackSiHits
std::map< std::string, TH1 * > m_hists
DecoratePromptLeptonRNN(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< unsigned > m_maxTrackSiHoles
StatusCode makeHist(TH1 *&h, const std::string &key, int nbin, double xmin, double xmax)
std::unordered_map< std::string, size_t > m_decorNameMap
Gaudi::Property< double > m_maxTrackLeptonDR
const xAOD::Jet * findClosestTrackJet(const xAOD::TrackParticle *particle, const xAOD::JetContainer &trackJets)
SG::ReadHandleKey< xAOD::IParticleContainer > m_inputContainerLeptonKey
Gaudi::Property< double > m_maxLepTrackJetDR
std::unique_ptr< SG::AuxElement::ConstAccessor< unsigned char > > m_accessQuality
Gaudi::Property< double > m_maxTrackZ0Sin
virtual StatusCode initialize() override
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_decorHandleKeys
SG::ReadHandleKey< xAOD::VertexContainer > m_inputContainerPrimaryVerticesKey
Gaudi::Property< std::string > m_decorationPrefixRNN
Gaudi::Property< std::string > m_outputStream
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inputContainerTrackKey
bool compScore(const xAOD::IParticle &particle, const std::vector< Prompt::VarHolder > &tracks, std::vector< decoratorFloatH_t > &decors)
virtual StatusCode execute() override
Gaudi::Property< double > m_maxTrackSharedSiHits
Gaudi::Property< unsigned > m_maxTrackPixHoles
SG::ReadHandleKey< xAOD::EventInfo > m_eventHandleKey
Gaudi::Property< double > m_minTrackLeptonDR
bool prepTrackObject(Prompt::VarHolder &p, const xAOD::TrackParticle &track, const xAOD::TrackParticle &lepton, const xAOD::Jet &trackJet, const xAOD::Vertex &priVtx, const xAOD::EventInfo event)
Gaudi::Property< double > m_minTrackpT
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for adding a decoration to an object.
Class providing the definition of the 4-vector interface.
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60
DecorHandleKeyArray< WriteDecorHandle< T, S >, WriteDecorHandleKey< T >, Gaudi::DataHandle::Writer > WriteDecorHandleKeyArray
Jet_v1 Jet
Definition of the current "jet version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
Muon_v1 Muon
Reference the current persistent version:
JetContainer_v1 JetContainer
Definition of the current "jet container version".