ATLAS Offline Software
Loading...
Searching...
No Matches
Prompt::DecoratePromptLeptonRNN Class Reference

#include <DecoratePromptLeptonRNN.h>

Inheritance diagram for Prompt::DecoratePromptLeptonRNN:

Public Types

using decoratorFloatH_t = SG::WriteDecorHandle<xAOD::IParticleContainer, float>

Public Member Functions

 DecoratePromptLeptonRNN (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode finalize () override
const xAOD::TrackParticlefindMuonTrack (const xAOD::Muon *muon)
const xAOD::JetfindClosestTrackJet (const xAOD::TrackParticle *particle, const xAOD::JetContainer &trackJets)
bool compDummy (const xAOD::IParticle &particle, std::vector< decoratorFloatH_t > &decors) const
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)
bool compScore (const xAOD::IParticle &particle, const std::vector< Prompt::VarHolder > &tracks, std::vector< decoratorFloatH_t > &decors)
bool passTrack (Prompt::VarHolder &p)
StatusCode makeHist (TH1 *&h, const std::string &key, int nbin, double xmin, double xmax)
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Public Attributes

Gaudi::Property< std::string > m_outputStream {this, "outputStream", "", "Path of the ROOT output directory of the histograms for RNN debug"}
Gaudi::Property< std::string > m_decorationPrefixRNN {this, "decorationPrefixRNN", "", "Prefix of the name for the decorator of RNN to the lepton"}
Gaudi::Property< double > m_minTrackpT {this, "minTrackpT", 500.0, "pT cut config for the input tracks to RNN"}
Gaudi::Property< double > m_maxTrackEta {this, "maxTrackEta", 2.5, "abs(eta) cut config for the input tracks to RNN"}
Gaudi::Property< double > m_maxTrackZ0Sin {this, "maxTrackZ0Sin", 1.0, "Z0sin cut config for the input tracks to RNN"}
Gaudi::Property< double > m_minTrackLeptonDR {this, "minTrackLeptonDR", 1.0e-6, "Delta R between lepton and track cut config for the input tracks to RNN"}
Gaudi::Property< double > m_maxTrackLeptonDR {this, "maxTrackLeptonDR", 0.4, "Delta R between lepton and track cut config for the input tracks to RNN"}
Gaudi::Property< double > m_maxLepTrackJetDR {this, "maxLepTrackJetDR", 0.4, "Maximum distance between lepton and track jet for track jet matching"}
Gaudi::Property< double > m_maxTrackSharedSiHits {this, "maxTrackSharedSiHits", 1.5, "track shared si hits cut config for the input tracks to RNN"}
Gaudi::Property< unsigned > m_minTrackSiHits {this, "minTrackSiHits", 6.5, "track silicon detector hits cut config for the input tracks to RNN"}
Gaudi::Property< unsigned > m_maxTrackSiHoles {this, "maxTrackSiHoles", 2.5, "track holes cut config for the input tracks to RNN"}
Gaudi::Property< unsigned > m_maxTrackPixHoles {this, "maxTrackPixHoles", 1.5, "track pixel holes cut config for the input tracks to RNN"}
Gaudi::Property< bool > m_debug {this, "debug", false, "debug statement"}
Gaudi::Property< bool > m_printTime {this, "printTime", false, "print running time, for debug"}
ToolHandle< IRNNToolm_toolRNN
ServiceHandle< ITHistSvc > m_histSvc
SG::ReadHandleKey< xAOD::IParticleContainerm_inputContainerLeptonKey
SG::ReadHandleKey< xAOD::TrackParticleContainerm_inputContainerTrackKey
SG::ReadHandleKey< xAOD::JetContainerm_inputContainerTrackJetKey
SG::ReadHandleKey< xAOD::VertexContainerm_inputContainerPrimaryVerticesKey
SG::ReadHandleKey< xAOD::EventInfom_eventHandleKey
TStopwatch m_timerEvent
int m_countEvent
std::map< std::string, TH1 * > m_hists
std::unique_ptr< SG::AuxElement::ConstAccessor< unsigned char > > m_accessQuality
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainerm_decorHandleKeys { this, "DecorHandleKeys", {} }
std::unordered_map< std::string, size_t > m_decorNameMap

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 50 of file DecoratePromptLeptonRNN.h.

Member Typedef Documentation

◆ decoratorFloatH_t

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ DecoratePromptLeptonRNN()

Prompt::DecoratePromptLeptonRNN::DecoratePromptLeptonRNN ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 21 of file DecoratePromptLeptonRNN.cxx.

21 :
22 AthAlgorithm(name, pSvcLocator),
23 m_histSvc ("THistSvc/THistSvc", name),
25{}
AthAlgorithm()
Default constructor:

Member Function Documentation

◆ compDummy()

bool Prompt::DecoratePromptLeptonRNN::compDummy ( const xAOD::IParticle & particle,
std::vector< decoratorFloatH_t > & decors ) const

Definition at line 436 of file DecoratePromptLeptonRNN.cxx.

438{
439 //
440 // Fill dummy values for RNN outputs
441 //
442 for (auto& d : decors) {
443 d(particle) = -1.0;
444 }
445
446 return true;
447}

◆ compScore()

bool Prompt::DecoratePromptLeptonRNN::compScore ( const xAOD::IParticle & particle,
const std::vector< Prompt::VarHolder > & tracks,
std::vector< decoratorFloatH_t > & decors )

Definition at line 375 of file DecoratePromptLeptonRNN.cxx.

378{
379 //
380 // Call the RNN tool to get the RNN prediction for the leptons and decorate the lepton with those RNN scores.
381 //
382 ATH_MSG_DEBUG("compScore - number of tracks: " << tracks.size());
383
384 for(const Prompt::VarHolder &o: tracks) {
385 ATH_MSG_DEBUG("compScore - track: LepTrackDR = " << o.getVar(Def::LepTrackDR)
386 << ", TrackJetDR = " << o.getVar(Def::TrackJetDR)
387 << ", D0Sig = " << o.getVar(Def::D0Sig)
388 << ", Z0Sin = " << o.getVar(Def::Z0Sin)
389 << ", NumberOfPIXHits = " << o.getVar(Def::NumberOfPIXHits)
390 << ", NumberOfSCTHits = " << o.getVar(Def::NumberOfSCTHits)
391 << ", PtFrac = " << o.getVar(Def::TrackPtOverTrackJetPt) );
392 }
393
394 const std::map<std::string, double> results = m_toolRNN->computeRNNOutput(tracks);
395
396 for(const std::pair<const std::string, double>& v: results) {
397 //
398 // Decorate muon
399 //
400
401 ATH_MSG_DEBUG("DecoratePromptLeptonRNN compScore - " << v.first << " = " << v.second );
402
403 auto dit = m_decorNameMap.find (v.first);
404
405 if(dit != m_decorNameMap.end()) {
406 decors.at(dit->second)(particle) = v.second;
407 }
408 else {
409 ATH_MSG_WARNING("CompScore - unknown output label=\"" << v.first << "\"");
410 }
411
412 if(m_debug) {
413 std::map<std::string, TH1*>::iterator hit = m_hists.find(v.first);
414
415 if(hit == m_hists.end()) {
416 TH1* h = 0;
417
418 StatusCode hist_status = makeHist(h, v.first, 100, 0.0, 1.0);
419 if (hist_status != StatusCode::SUCCESS){
420 ATH_MSG_WARNING("DecoratePromptLeptonRNN compScore - failed to make hist");
421 }
422
423 hit = m_hists.insert(std::map<std::string, TH1*>::value_type(v.first, h)).first;
424 }
425
426 if(hit->second) {
427 hit->second->Fill(v.second);
428 }
429 }
430 }
431
432 return true;
433}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::map< std::string, TH1 * > m_hists
StatusCode makeHist(TH1 *&h, const std::string &key, int nbin, double xmin, double xmax)
std::unordered_map< std::string, size_t > m_decorNameMap
::StatusCode StatusCode
StatusCode definition for legacy code.
@ NumberOfPIXHits
Definition VarHolder.h:48
@ NumberOfSCTHits
Definition VarHolder.h:49
@ TrackPtOverTrackJetPt
Definition VarHolder.h:55
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode Prompt::DecoratePromptLeptonRNN::execute ( )
overridevirtual

Definition at line 72 of file DecoratePromptLeptonRNN.cxx.

73{
74 //
75 // Process current event
76 //
77 TimerScopeHelper timer(m_timerEvent);
78
79 const EventContext& ctx = Gaudi::Hive::currentContext();
80
81 ATH_MSG_DEBUG("execute() - begin...");
82
84
85 //
86 // Retrieve object containers and event info
87 //
88 SG::ReadHandle<xAOD::IParticleContainer> h_leptons (m_inputContainerLeptonKey, ctx);
89 SG::ReadHandle<xAOD::TrackParticleContainer> h_tracks (m_inputContainerTrackKey, ctx);
90 SG::ReadHandle<xAOD::JetContainer> h_trackJets (m_inputContainerTrackJetKey, ctx);
91 SG::ReadHandle<xAOD::VertexContainer> h_vertices (m_inputContainerPrimaryVerticesKey, ctx);
92
93 SG::ReadHandle<xAOD::EventInfo> event_handle (m_eventHandleKey, ctx);
94
95 ATH_MSG_DEBUG("Size of LeptonContainer: " << h_leptons->size());
96
97 std::vector<decoratorFloatH_t> decors;
98 decors.reserve (m_decorHandleKeys.size());
99 for (const SG::WriteDecorHandleKey<xAOD::IParticleContainer>& k : m_decorHandleKeys) {
100 decors.emplace_back (k, ctx);
101 }
102
103 //
104 // Find default Primary Vertex
105 //
106 const xAOD::Vertex *primaryVertex = nullptr;
107
108 for(const xAOD::Vertex *vertex: *h_vertices) {
109 if(vertex->vertexType() == xAOD::VxType::PriVtx) {
110 primaryVertex = vertex;
111 break;
112 }
113 }
114
115 //
116 // Collect tracks
117 //
118 for(const xAOD::IParticle *lepton: *h_leptons) {
119 //
120 // Select lepton track
121 //
122 const xAOD::TrackParticle *trackLep = nullptr;
123 const xAOD::Electron *elec = dynamic_cast<const xAOD::Electron*>(lepton);
124 const xAOD::Muon *muon = dynamic_cast<const xAOD::Muon *>(lepton);
125
126 if(elec) {
127 const xAOD::TrackParticle *bestmatchedGSFElTrack = elec->trackParticle(0);
128 if(bestmatchedGSFElTrack) {
129 trackLep = xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF(bestmatchedGSFElTrack);
130 }
131 }
132 else if (muon) {
133 trackLep = findMuonTrack(muon);
134 }
135 else {
136 ATH_MSG_WARNING("execute - failed to find electron or muon: should never happen!");
137 }
138
139 //
140 // Find closest track jet
141 //
142 const xAOD::Jet *trackJet = findClosestTrackJet(trackLep, *h_trackJets);
143
144 if(!trackLep || !trackJet) {
145 compDummy(*lepton, decors);
146 continue;
147 }
148
149 //
150 // Select tracks within cone around lepton track.
151 //
152 std::vector<Prompt::VarHolder > select_tracks;
153
154 Prompt::VarHolder lepton_obj;
155
156 if(!prepTrackObject(lepton_obj, *trackLep, *trackLep, *trackJet, *primaryVertex, *event_handle)) {
157 continue;
158 }
159
160 //
161 // Add lepton track as one of the cone tracks.
162 //
163 select_tracks.push_back(lepton_obj);
164
165 for(const xAOD::TrackParticle *track: *h_tracks) {
166
167 if(!track) {
168 ATH_MSG_WARNING("Prompt::DecoratePromptLeptonRNN::execute - skip null track pointer - should never happen");
169 continue;
170 }
171
172 Prompt::VarHolder track_obj;
173
174 if(!prepTrackObject(track_obj, *track, *trackLep, *trackJet, *primaryVertex, *event_handle)) {
175 continue;
176 }
177
178 if(passTrack(track_obj)) {
179 select_tracks.push_back(track_obj);
180
181 ATH_MSG_DEBUG("Prompt::DecoratePromptLeptonRNN::execute - passed track pT= " << track->pt());
182 }
183 }
184
185 //
186 // Sort tracks by DR distance to lepton
187 //
188 std::sort(select_tracks.begin(), select_tracks.end(), Prompt::SortObjectByVar(Def::LepTrackDR, msg()));
189
190 //
191 // Compute RNN
192 //
193 compScore(*lepton, select_tracks, decors);
194
195 ATH_MSG_DEBUG("DecoratePromptLeptonRNN::CompScore - " << std::endl
196 << "lepton pT= " << lepton->pt()
197 << ", number of tracks: " << select_tracks.size());
198 }
199
200 return StatusCode::SUCCESS;
201}
MsgStream & msg() const
SG::ReadHandleKey< xAOD::JetContainer > m_inputContainerTrackJetKey
const xAOD::TrackParticle * findMuonTrack(const xAOD::Muon *muon)
bool compDummy(const xAOD::IParticle &particle, std::vector< decoratorFloatH_t > &decors) const
const xAOD::Jet * findClosestTrackJet(const xAOD::TrackParticle *particle, const xAOD::JetContainer &trackJets)
SG::ReadHandleKey< xAOD::IParticleContainer > m_inputContainerLeptonKey
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_decorHandleKeys
SG::ReadHandleKey< xAOD::VertexContainer > m_inputContainerPrimaryVerticesKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inputContainerTrackKey
bool compScore(const xAOD::IParticle &particle, const std::vector< Prompt::VarHolder > &tracks, std::vector< decoratorFloatH_t > &decors)
SG::ReadHandleKey< xAOD::EventInfo > m_eventHandleKey
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)
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
timer(name, disabled=False)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
const xAOD::TrackParticle * getOriginalTrackParticleFromGSF(const xAOD::TrackParticle *trkPar)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the GSF Track Particle...
@ PriVtx
Primary vertex.
Jet_v1 Jet
Definition of the current "jet 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:
Electron_v1 Electron
Definition of the current "egamma version".

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode Prompt::DecoratePromptLeptonRNN::finalize ( )
overridevirtual

Definition at line 204 of file DecoratePromptLeptonRNN.cxx.

205{
206 //
207 // Finalize output
208 //
209 if(m_printTime) {
210 //
211 // Print full time stopwatch
212 //
213 ATH_MSG_INFO("DecoratePromptLeptonRNN - total time: " << PrintResetStopWatch(m_timerEvent));
214 ATH_MSG_INFO("DecoratePromptLeptonRNN - processed " << m_countEvent << " events.");
215 }
216
217 return StatusCode::SUCCESS;
218}
#define ATH_MSG_INFO(x)
std::string PrintResetStopWatch(TStopwatch &watch)

◆ findClosestTrackJet()

const xAOD::Jet * Prompt::DecoratePromptLeptonRNN::findClosestTrackJet ( const xAOD::TrackParticle * particle,
const xAOD::JetContainer & trackJets )

Definition at line 240 of file DecoratePromptLeptonRNN.cxx.

242{
243 //
244 // Find track jet closest to IParticle and within fixed cone
245 //
246 if(!particle) {
247 return 0;
248 }
249
250 const xAOD::Jet *trackJet = 0;
251 double currTrackJetDR = -1.0;
252
253 //
254 // Select track jet within cone around muon
255 //
256 for(const xAOD::Jet *jet: trackJets) {
257 const double dr = particle->p4().DeltaR(jet->p4());
258
259 if(currTrackJetDR < 0.0 || dr < currTrackJetDR) {
260 trackJet = jet;
261 currTrackJetDR = dr;
262 }
263 }
264
265 if(trackJet && currTrackJetDR < m_maxLepTrackJetDR) {
266 return trackJet;
267 }
268
269 return 0;
270}
Gaudi::Property< double > m_maxLepTrackJetDR

◆ findMuonTrack()

const xAOD::TrackParticle * Prompt::DecoratePromptLeptonRNN::findMuonTrack ( const xAOD::Muon * muon)

Definition at line 221 of file DecoratePromptLeptonRNN.cxx.

222{
223 //
224 // Process muon - return true if all information present for RNN
225 //
226 if(muon->muonType() != xAOD::Muon::Combined || !muon->inDetTrackParticleLink().isValid()) {
227 return 0;
228 }
229
230 const unsigned char quality = (*m_accessQuality)(*muon);
231
232 ATH_MSG_DEBUG("muon pT=" << muon->pt() << " quality=" << int(quality) << " medium=" << int(xAOD::Muon::Medium));
233
234 const xAOD::TrackParticle *trackLep = *(muon->inDetTrackParticleLink());
235
236 return trackLep;
237}

◆ initialize()

StatusCode Prompt::DecoratePromptLeptonRNN::initialize ( )
overridevirtual

Definition at line 28 of file DecoratePromptLeptonRNN.cxx.

29{
30 ATH_MSG_DEBUG("Initializing DecoratePromptLeptonRNN...");
31
32 // Initialize read/write handles
37
38 ATH_CHECK(m_eventHandleKey.initialize());
39
40 //
41 // Initialize tools and services
42 //
43 ATH_CHECK( m_histSvc.retrieve() );
44
45 m_decorHandleKeys.clear();
46 for(const std::string &label: m_toolRNN->getOutputLabels()) {
47 const std::string key = m_decorationPrefixRNN + label;
48
49 ATH_MSG_DEBUG("Add output RNN label: \"" << key << "\"");
50
51 m_decorNameMap.try_emplace (label, m_decorHandleKeys.size());
53 }
54 ATH_CHECK(m_decorHandleKeys.initialize());
55
56 ATH_MSG_DEBUG("inputContainerMuon=\"" << m_inputContainerLeptonKey << "\"");
57
58 //
59 // Instantiate Muon quality accessors
60 //
61 m_accessQuality = std::make_unique<SG::AuxElement::ConstAccessor<unsigned char> >("quality");
62
63 m_timerEvent.Reset();
64
65 ATH_MSG_DEBUG("DecoratePromptLeptonRNN initialized successfully.");
66
67 return StatusCode::SUCCESS;
68
69}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::unique_ptr< SG::AuxElement::ConstAccessor< unsigned char > > m_accessQuality
Gaudi::Property< std::string > m_decorationPrefixRNN
std::string label(const std::string &format, int i)
Definition label.h:19
std::string makeContDecorKey(const std::string &cont, const std::string &decor)
Make a StoreGate key from container and decoration name.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ makeHist()

StatusCode Prompt::DecoratePromptLeptonRNN::makeHist ( TH1 *& h,
const std::string & key,
int nbin,
double xmin,
double xmax )

Definition at line 450 of file DecoratePromptLeptonRNN.cxx.

451{
452 //
453 // Initiliase histogram pointer. If configured to run in validation mode, then create and register histogram
454 //
455 h = 0;
456
457 if(m_outputStream.empty() || key.empty()) {
458 return StatusCode::SUCCESS;
459 }
460
461 const std::string hname = name() + "_" + key;
462 const std::string hist_key = "/"+m_outputStream+"/"+hname;
463
464 h = new TH1D(hname.c_str(), hname.c_str(), nbin, xmin, xmax);
465 h->SetDirectory(0);
466
467 return m_histSvc->regHist(hist_key, h);
468}
Gaudi::Property< std::string > m_outputStream
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ passTrack()

bool Prompt::DecoratePromptLeptonRNN::passTrack ( Prompt::VarHolder & p)

Definition at line 348 of file DecoratePromptLeptonRNN.cxx.

349{
350 //
351 // Select cone tracks
352 //
353 if(p.getVar(Def::LepTrackDR) < m_minTrackLeptonDR) return false;
354 if(p.getVar(Def::LepTrackDR) > m_maxTrackLeptonDR) return false;
355
356 //
357 // Kinematic track selection
358 //
359 if(p.getVar(Def::Pt) < m_minTrackpT) return false;
360 if(p.getVar(Def::AbsEta) > m_maxTrackEta) return false;
361 if(std::fabs(p.getVar(Def::Z0Sin)) > m_maxTrackZ0Sin) return false;
362
363 //
364 // Hit quality track selection
365 //
366 if(p.getVar(Def::NumberOfSiHits) < m_minTrackSiHits) return false;
367 if(p.getVar(Def::NumberOfSharedSiHits) > m_maxTrackSharedSiHits) return false;
368 if(p.getVar(Def::NumberOfSiHoles) > m_maxTrackSiHoles) return false;
369 if(p.getVar(Def::NumberOfPixelHoles) > m_maxTrackPixHoles) return false;
370
371 return true;
372}
Gaudi::Property< double > m_maxTrackEta
Gaudi::Property< unsigned > m_minTrackSiHits
Gaudi::Property< unsigned > m_maxTrackSiHoles
Gaudi::Property< double > m_maxTrackLeptonDR
Gaudi::Property< double > m_maxTrackZ0Sin
Gaudi::Property< double > m_maxTrackSharedSiHits
Gaudi::Property< unsigned > m_maxTrackPixHoles
Gaudi::Property< double > m_minTrackLeptonDR
Gaudi::Property< double > m_minTrackpT
@ NumberOfPixelHoles
Definition VarHolder.h:53
@ NumberOfSharedSiHits
Definition VarHolder.h:51
@ NumberOfSiHoles
Definition VarHolder.h:52

◆ prepTrackObject()

bool Prompt::DecoratePromptLeptonRNN::prepTrackObject ( Prompt::VarHolder & p,
const xAOD::TrackParticle & track,
const xAOD::TrackParticle & lepton,
const xAOD::Jet & trackJet,
const xAOD::Vertex & priVtx,
const xAOD::EventInfo event )

Definition at line 273 of file DecoratePromptLeptonRNN.cxx.

281{
282 //
283 // Add xAOD::TrackParticle variables to the track object VarHolder
284 //
291
292 if(!(track.summaryValue(numberOfPixelHits, xAOD::numberOfPixelHits))) return false;
293 if(!(track.summaryValue(numberOfSCTHits, xAOD::numberOfSCTHits))) return false;
294 if(!(track.summaryValue(numberOfPixelHoles, xAOD::numberOfPixelHoles))) return false;
295 if(!(track.summaryValue(numberOfSCTHoles, xAOD::numberOfSCTHoles))) return false;
296 if(!(track.summaryValue(numberOfPixelSharedHits, xAOD::numberOfPixelSharedHits))) return false;
297 if(!(track.summaryValue(numberOfSCTSharedHits, xAOD::numberOfSCTSharedHits))) return false;
298
299 const uint8_t NSiHits = numberOfPixelHits + numberOfSCTHits;
301 const float NSiShHits = float(numberOfPixelSharedHits) + float(numberOfSCTSharedHits)/2.0;
302
303 p.addVar(Def::Pt, track.pt());
304 p.addVar(Def::AbsEta, std::fabs(track.eta()));
305 p.addVar(Def::NumberOfPIXHits, numberOfPixelHits);
306 p.addVar(Def::NumberOfSCTHits, numberOfSCTHits);
307 p.addVar(Def::NumberOfSiHits, NSiHits);
308 p.addVar(Def::NumberOfSharedSiHits, NSiShHits);
309 p.addVar(Def::NumberOfSiHoles, NSiHoles);
310 p.addVar(Def::NumberOfPixelHoles, numberOfPixelHoles);
311
312 //
313 // Add lepton - jet variables to VarHolder
314 //
315 double PtFrac = -99.;
316
317 if(track.pt() > 0.0 && trackJet.pt() > 0.0) {
318 PtFrac = track.pt() / trackJet.pt();
319 }
320
321 p.addVar(Def::TrackPtOverTrackJetPt, PtFrac);
322 p.addVar(Def::TrackJetDR, track.p4().DeltaR(trackJet.p4()));
323 p.addVar(Def::LepTrackDR, track.p4().DeltaR(lepton.p4()));
324
325 //
326 // Add Impact Parameters
327 //
328 double d0_significance = -99.;
329 double Z0Sin = 0.0;
330
331 if(track.definingParametersCovMatrixVec().size() > 0 && track.definingParametersCovMatrixVec().at(0) > 0.0) {
332 d0_significance = xAOD::TrackingHelpers::d0significance(&track,
333 event.beamPosSigmaX(),
334 event.beamPosSigmaY(),
335 event.beamPosSigmaXY());
336 }
337
338 const double deltaZ0 = track.z0() + track.vz() - priVtx.z();
339 Z0Sin = deltaZ0*std::sin(track.theta());
340
341 p.addVar(Def::Z0Sin, Z0Sin);
342 p.addVar(Def::D0Sig, d0_significance);
343
344 return true;
345}
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition Jet_v1.cxx:71
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
float z() const
Returns the z position.
double d0significance(const xAOD::TrackParticle *tp, double d0_uncert_beam_spot_2)
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].
@ numberOfSCTHoles
number of SCT holes [unit8_t].

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_ERROR(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_accessQuality

std::unique_ptr<SG::AuxElement::ConstAccessor<unsigned char> > Prompt::DecoratePromptLeptonRNN::m_accessQuality

Definition at line 142 of file DecoratePromptLeptonRNN.h.

◆ m_countEvent

int Prompt::DecoratePromptLeptonRNN::m_countEvent

Definition at line 138 of file DecoratePromptLeptonRNN.h.

◆ m_debug

Gaudi::Property<bool> Prompt::DecoratePromptLeptonRNN::m_debug {this, "debug", false, "debug statement"}

Definition at line 107 of file DecoratePromptLeptonRNN.h.

107{this, "debug", false, "debug statement"};

◆ m_decorationPrefixRNN

Gaudi::Property<std::string> Prompt::DecoratePromptLeptonRNN::m_decorationPrefixRNN {this, "decorationPrefixRNN", "", "Prefix of the name for the decorator of RNN to the lepton"}

Definition at line 92 of file DecoratePromptLeptonRNN.h.

92{this, "decorationPrefixRNN", "", "Prefix of the name for the decorator of RNN to the lepton"};

◆ m_decorHandleKeys

SG::WriteDecorHandleKeyArray<xAOD::IParticleContainer> Prompt::DecoratePromptLeptonRNN::m_decorHandleKeys { this, "DecorHandleKeys", {} }

Definition at line 144 of file DecoratePromptLeptonRNN.h.

145{ this, "DecorHandleKeys", {} };

◆ m_decorNameMap

std::unordered_map<std::string, size_t> Prompt::DecoratePromptLeptonRNN::m_decorNameMap

Definition at line 146 of file DecoratePromptLeptonRNN.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_eventHandleKey

SG::ReadHandleKey<xAOD::EventInfo> Prompt::DecoratePromptLeptonRNN::m_eventHandleKey
Initial value:
{
this, "EventHandleKey", "EventInfo"
}

Definition at line 132 of file DecoratePromptLeptonRNN.h.

132 {
133 this, "EventHandleKey", "EventInfo"
134 };

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_hists

std::map<std::string, TH1*> Prompt::DecoratePromptLeptonRNN::m_hists

Definition at line 140 of file DecoratePromptLeptonRNN.h.

◆ m_histSvc

ServiceHandle<ITHistSvc> Prompt::DecoratePromptLeptonRNN::m_histSvc

Definition at line 115 of file DecoratePromptLeptonRNN.h.

◆ m_inputContainerLeptonKey

SG::ReadHandleKey<xAOD::IParticleContainer> Prompt::DecoratePromptLeptonRNN::m_inputContainerLeptonKey
Initial value:
{
this, "inputContainerLepton", "",
"Container's name of the lepton that you want to decorate"
}

Definition at line 118 of file DecoratePromptLeptonRNN.h.

118 {
119 this, "inputContainerLepton", "",
120 "Container's name of the lepton that you want to decorate"
121 };

◆ m_inputContainerPrimaryVerticesKey

SG::ReadHandleKey<xAOD::VertexContainer> Prompt::DecoratePromptLeptonRNN::m_inputContainerPrimaryVerticesKey
Initial value:
{
this, "inputContainerPrimaryVertices", "", "Primary vertex container name"
}

Definition at line 128 of file DecoratePromptLeptonRNN.h.

128 {
129 this, "inputContainerPrimaryVertices", "", "Primary vertex container name"
130 };

◆ m_inputContainerTrackJetKey

SG::ReadHandleKey<xAOD::JetContainer> Prompt::DecoratePromptLeptonRNN::m_inputContainerTrackJetKey
Initial value:
{
this, "inputContainerTrackJet", "", "Track Jet container name"
}

Definition at line 125 of file DecoratePromptLeptonRNN.h.

125 {
126 this, "inputContainerTrackJet", "", "Track Jet container name"
127 };

◆ m_inputContainerTrackKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> Prompt::DecoratePromptLeptonRNN::m_inputContainerTrackKey
Initial value:
{
this, "inputContainerTrack", "", "Track container name"
}

Definition at line 122 of file DecoratePromptLeptonRNN.h.

122 {
123 this, "inputContainerTrack", "", "Track container name"
124 };

◆ m_maxLepTrackJetDR

Gaudi::Property<double> Prompt::DecoratePromptLeptonRNN::m_maxLepTrackJetDR {this, "maxLepTrackJetDR", 0.4, "Maximum distance between lepton and track jet for track jet matching"}

Definition at line 100 of file DecoratePromptLeptonRNN.h.

100{this, "maxLepTrackJetDR", 0.4, "Maximum distance between lepton and track jet for track jet matching"};

◆ m_maxTrackEta

Gaudi::Property<double> Prompt::DecoratePromptLeptonRNN::m_maxTrackEta {this, "maxTrackEta", 2.5, "abs(eta) cut config for the input tracks to RNN"}

Definition at line 95 of file DecoratePromptLeptonRNN.h.

95{this, "maxTrackEta", 2.5, "abs(eta) cut config for the input tracks to RNN"};

◆ m_maxTrackLeptonDR

Gaudi::Property<double> Prompt::DecoratePromptLeptonRNN::m_maxTrackLeptonDR {this, "maxTrackLeptonDR", 0.4, "Delta R between lepton and track cut config for the input tracks to RNN"}

Definition at line 99 of file DecoratePromptLeptonRNN.h.

99{this, "maxTrackLeptonDR", 0.4, "Delta R between lepton and track cut config for the input tracks to RNN"};

◆ m_maxTrackPixHoles

Gaudi::Property<unsigned> Prompt::DecoratePromptLeptonRNN::m_maxTrackPixHoles {this, "maxTrackPixHoles", 1.5, "track pixel holes cut config for the input tracks to RNN"}

Definition at line 105 of file DecoratePromptLeptonRNN.h.

105{this, "maxTrackPixHoles", 1.5, "track pixel holes cut config for the input tracks to RNN"};

◆ m_maxTrackSharedSiHits

Gaudi::Property<double> Prompt::DecoratePromptLeptonRNN::m_maxTrackSharedSiHits {this, "maxTrackSharedSiHits", 1.5, "track shared si hits cut config for the input tracks to RNN"}

Definition at line 102 of file DecoratePromptLeptonRNN.h.

102{this, "maxTrackSharedSiHits", 1.5, "track shared si hits cut config for the input tracks to RNN"};

◆ m_maxTrackSiHoles

Gaudi::Property<unsigned> Prompt::DecoratePromptLeptonRNN::m_maxTrackSiHoles {this, "maxTrackSiHoles", 2.5, "track holes cut config for the input tracks to RNN"}

Definition at line 104 of file DecoratePromptLeptonRNN.h.

104{this, "maxTrackSiHoles", 2.5, "track holes cut config for the input tracks to RNN"};

◆ m_maxTrackZ0Sin

Gaudi::Property<double> Prompt::DecoratePromptLeptonRNN::m_maxTrackZ0Sin {this, "maxTrackZ0Sin", 1.0, "Z0sin cut config for the input tracks to RNN"}

Definition at line 96 of file DecoratePromptLeptonRNN.h.

96{this, "maxTrackZ0Sin", 1.0, "Z0sin cut config for the input tracks to RNN"};

◆ m_minTrackLeptonDR

Gaudi::Property<double> Prompt::DecoratePromptLeptonRNN::m_minTrackLeptonDR {this, "minTrackLeptonDR", 1.0e-6, "Delta R between lepton and track cut config for the input tracks to RNN"}

Definition at line 98 of file DecoratePromptLeptonRNN.h.

98{this, "minTrackLeptonDR", 1.0e-6, "Delta R between lepton and track cut config for the input tracks to RNN"};

◆ m_minTrackpT

Gaudi::Property<double> Prompt::DecoratePromptLeptonRNN::m_minTrackpT {this, "minTrackpT", 500.0, "pT cut config for the input tracks to RNN"}

Definition at line 94 of file DecoratePromptLeptonRNN.h.

94{this, "minTrackpT", 500.0, "pT cut config for the input tracks to RNN"};

◆ m_minTrackSiHits

Gaudi::Property<unsigned> Prompt::DecoratePromptLeptonRNN::m_minTrackSiHits {this, "minTrackSiHits", 6.5, "track silicon detector hits cut config for the input tracks to RNN"}

Definition at line 103 of file DecoratePromptLeptonRNN.h.

103{this, "minTrackSiHits", 6.5, "track silicon detector hits cut config for the input tracks to RNN"};

◆ m_outputStream

Gaudi::Property<std::string> Prompt::DecoratePromptLeptonRNN::m_outputStream {this, "outputStream", "", "Path of the ROOT output directory of the histograms for RNN debug"}

Definition at line 91 of file DecoratePromptLeptonRNN.h.

91{this, "outputStream", "", "Path of the ROOT output directory of the histograms for RNN debug"};

◆ m_printTime

Gaudi::Property<bool> Prompt::DecoratePromptLeptonRNN::m_printTime {this, "printTime", false, "print running time, for debug"}

Definition at line 108 of file DecoratePromptLeptonRNN.h.

108{this, "printTime", false, "print running time, for debug"};

◆ m_timerEvent

TStopwatch Prompt::DecoratePromptLeptonRNN::m_timerEvent

Definition at line 137 of file DecoratePromptLeptonRNN.h.

◆ m_toolRNN

ToolHandle<IRNNTool> Prompt::DecoratePromptLeptonRNN::m_toolRNN
Initial value:
{
this, "toolRNN", "defaultToolRNN", "Dedicated tool for RNN prediction"
}

Definition at line 111 of file DecoratePromptLeptonRNN.h.

111 {
112 this, "toolRNN", "defaultToolRNN", "Dedicated tool for RNN prediction"
113 };

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: