ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::JetRestrictedSumPtVertexWeightCalculator Class Reference

#include <JetRestrictedSumPtVertexWeightCalculator.h>

Inheritance diagram for Trk::JetRestrictedSumPtVertexWeightCalculator:
Collaboration diagram for Trk::JetRestrictedSumPtVertexWeightCalculator:

Public Member Functions

virtual StatusCode initialize () override
virtual StatusCode finalize () override
 JetRestrictedSumPtVertexWeightCalculator (const std::string &t, const std::string &n, const IInterface *p)
 constructor
virtual ~JetRestrictedSumPtVertexWeightCalculator ()=default
 destructor
virtual double estimateSignalCompatibility (const xAOD::Vertex &vertex) const override final
 WeightCalculator.
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 sysInitialize () override
 Perform system initialization for an algorithm.
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

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool interface methods.

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

Gaudi::Property< bool > m_doSumPt2Selection { this, "DoSumPt2Selection", true }
 Flag to Set SumPt^2 not SumPt as selection criteria.
Gaudi::Property< float > m_cone_dR { this, "JetConeDeltaR", 0.4 }
Gaudi::Property< float > m_jet_ptmin { this, "JetMinPt", 20e3 }
ToolHandle< xAOD::ITrackParticlesInConeToolm_tracksInCone { this, "TracksInConeTool", "xAOD::TrackParticlesInConeTool/TrackParticlesInConeTool" }
SG::ReadHandleKey< xAOD::JetContainerm_jetContKey { this, "JetContainer", "AntiKt4EMTopoJets", "Name of the jet container" }
Gaudi::Property< std::string > m_plainSumPtKey { this, "PlainSumPtDecor", "", "Optional decoration name holding the unrestricted vertex sumpt" }
std::unique_ptr< SG::AuxElement::Decorator< float > > m_decPlainSumPt
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

Author
Teng Jian Khoo, July 2024

Definition at line 31 of file JetRestrictedSumPtVertexWeightCalculator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JetRestrictedSumPtVertexWeightCalculator()

Trk::JetRestrictedSumPtVertexWeightCalculator::JetRestrictedSumPtVertexWeightCalculator ( const std::string & t,
const std::string & n,
const IInterface * p )

constructor

Definition at line 45 of file JetRestrictedSumPtVertexWeightCalculator.cxx.

49 : AthAlgTool(t, n, p)
50{
51 declareInterface<IVertexWeightCalculator>(this);
52}
AthAlgTool()
Default constructor:

◆ ~JetRestrictedSumPtVertexWeightCalculator()

virtual Trk::JetRestrictedSumPtVertexWeightCalculator::~JetRestrictedSumPtVertexWeightCalculator ( )
virtualdefault

destructor

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::detStore ( ) const
inlineinherited

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

Definition at line 95 of file AthCommonDataStore.h.

◆ estimateSignalCompatibility()

double Trk::JetRestrictedSumPtVertexWeightCalculator::estimateSignalCompatibility ( const xAOD::Vertex & vertex) const
finaloverridevirtual

WeightCalculator.

Implements Trk::IVertexWeightCalculator.

Definition at line 55 of file JetRestrictedSumPtVertexWeightCalculator.cxx.

57{
58 //::First get the jet containers
59 SG::ReadHandle<xAOD::JetContainer> jetContHandle(m_jetContKey);
60 if (!jetContHandle.isValid()){
61 ATH_MSG_ERROR ("HardScatterSelectionTool configured to use jet collection "<<m_jetContKey.key()<<", but collection is not found!");
62 }
63 const xAOD::JetContainer* jetCont{jetContHandle.cptr()};
64
65 // Retrieve tracks within jet cone (cached lookup)
66 // Add to a set for comparison later
67 std::set<const xAOD::TrackParticle*> tracks_in_jets;
68 for(const xAOD::Jet* jet : *jetCont) {
69 std::vector<const xAOD::TrackParticle*> tracks_in_this_jet;
70 m_tracksInCone->particlesInCone( jet->eta(), jet->phi(), m_cone_dR, tracks_in_this_jet );
71 tracks_in_jets.insert(tracks_in_this_jet.begin(),tracks_in_this_jet.end());
72 }
73 ATH_MSG_VERBOSE("Collected " << tracks_in_jets.size() << " tracks in " << jetCont->size() << " jets");
74
75 size_t n_selected_tracks{0};
76 double total_pt{0.}, jet_only_pt{0.};
77 ATH_MSG_DEBUG("Estimating vertex sorting score from "
78 << vertex.nTrackParticles() << " tracks at vertex.");
79 for (const auto& elTrackParticle : vertex.trackParticleLinks()) {
80
81 if (not elTrackParticle.isValid()) {
83 "No valid link to tracks in xAOD::Vertex object. Skipping track for "
84 "signal compatibility (may be serious).");
85 continue;
86 }
87
88 const Trk::Perigee& perigee =
89 (*elTrackParticle.cptr())->perigeeParameters();
90 float increment = 0.;
92 increment = std::pow(1. / perigee.parameters()[Trk::qOverP] *
93 sin(perigee.parameters()[Trk::theta]) / 1000.,
94 2);
95 } else {
96 increment = std::fabs(1. / perigee.parameters()[Trk::qOverP]) *
97 sin(perigee.parameters()[Trk::theta]) / 1000.;
98 }
99 total_pt += increment;
100
101 if(tracks_in_jets.contains(*elTrackParticle)) {
102 ATH_MSG_VERBOSE("Accepted track with index " << (*elTrackParticle)->index() << " in jet vicinity.");
103 ++n_selected_tracks;
104 jet_only_pt += increment;
105 }
106
107 }
108 ATH_MSG_DEBUG("Counted " << n_selected_tracks << "/" << vertex.nTrackParticles()
109 << " towards vertex sumpt " << std::setprecision(3) << jet_only_pt << " (unrestricted sum: " << total_pt << ")");
110
111 if(m_decPlainSumPt!=nullptr) {
112 (*m_decPlainSumPt)(vertex) = total_pt;
113 }
114
115 if(jetCont->empty()){
116 ATH_MSG_DEBUG("No jets found in this event, fall back to unrestricted sum");
117 jet_only_pt = total_pt;
118 }
119 return jet_only_pt;
120}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Gaudi::Property< bool > m_doSumPt2Selection
Flag to Set SumPt^2 not SumPt as selection criteria.
std::unique_ptr< SG::AuxElement::Decorator< float > > m_decPlainSumPt
ToolHandle< xAOD::ITrackParticlesInConeTool > m_tracksInCone
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ finalize()

StatusCode Trk::JetRestrictedSumPtVertexWeightCalculator::finalize ( )
overridevirtual

Definition at line 39 of file JetRestrictedSumPtVertexWeightCalculator.cxx.

40{
41 return StatusCode::SUCCESS;
42}

◆ initialize()

StatusCode Trk::JetRestrictedSumPtVertexWeightCalculator::initialize ( )
overridevirtual

Definition at line 20 of file JetRestrictedSumPtVertexWeightCalculator.cxx.

21{
22 // We definitely need a jet collection for the track selection
23 if(m_jetContKey.empty()) {
24 ATH_MSG_ERROR("No jet collection provided for selecting tracks!");
25 return StatusCode::FAILURE;
26 } else {
27 ATH_CHECK(m_jetContKey.initialize());
28 }
29 ATH_CHECK(m_tracksInCone.retrieve());
30
31 if(!m_plainSumPtKey.empty()) {
32 m_decPlainSumPt = std::make_unique<SG::AuxElement::Decorator<float> >(m_plainSumPtKey);
33 }
34
35 return StatusCode::SUCCESS;
36} // end of initialize method
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ interfaceID()

const InterfaceID & Trk::IVertexWeightCalculator::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 47 of file IVertexWeightCalculator.h.

48 {
50 };
static const InterfaceID IID_IVertexWeightCalculator("IVertexWeightCalculator", 1, 0)

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< AlgTool >::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< AlgTool > >::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.

◆ 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< AlgTool > >::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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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_cone_dR

Gaudi::Property<float> Trk::JetRestrictedSumPtVertexWeightCalculator::m_cone_dR { this, "JetConeDeltaR", 0.4 }
private

Definition at line 64 of file JetRestrictedSumPtVertexWeightCalculator.h.

64{ this, "JetConeDeltaR", 0.4 };

◆ m_decPlainSumPt

std::unique_ptr<SG::AuxElement::Decorator<float> > Trk::JetRestrictedSumPtVertexWeightCalculator::m_decPlainSumPt
private

Definition at line 69 of file JetRestrictedSumPtVertexWeightCalculator.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doSumPt2Selection

Gaudi::Property<bool> Trk::JetRestrictedSumPtVertexWeightCalculator::m_doSumPt2Selection { this, "DoSumPt2Selection", true }
private

Flag to Set SumPt^2 not SumPt as selection criteria.

Definition at line 63 of file JetRestrictedSumPtVertexWeightCalculator.h.

63{ this, "DoSumPt2Selection", true };

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_jet_ptmin

Gaudi::Property<float> Trk::JetRestrictedSumPtVertexWeightCalculator::m_jet_ptmin { this, "JetMinPt", 20e3 }
private

Definition at line 65 of file JetRestrictedSumPtVertexWeightCalculator.h.

65{ this, "JetMinPt", 20e3 };

◆ m_jetContKey

SG::ReadHandleKey<xAOD::JetContainer> Trk::JetRestrictedSumPtVertexWeightCalculator::m_jetContKey { this, "JetContainer", "AntiKt4EMTopoJets", "Name of the jet container" }
private

Definition at line 67 of file JetRestrictedSumPtVertexWeightCalculator.h.

67{ this, "JetContainer", "AntiKt4EMTopoJets", "Name of the jet container" };

◆ m_plainSumPtKey

Gaudi::Property<std::string> Trk::JetRestrictedSumPtVertexWeightCalculator::m_plainSumPtKey { this, "PlainSumPtDecor", "", "Optional decoration name holding the unrestricted vertex sumpt" }
private

Definition at line 68 of file JetRestrictedSumPtVertexWeightCalculator.h.

68{ this, "PlainSumPtDecor", "", "Optional decoration name holding the unrestricted vertex sumpt" };

◆ m_tracksInCone

ToolHandle<xAOD::ITrackParticlesInConeTool> Trk::JetRestrictedSumPtVertexWeightCalculator::m_tracksInCone { this, "TracksInConeTool", "xAOD::TrackParticlesInConeTool/TrackParticlesInConeTool" }
private

Definition at line 66 of file JetRestrictedSumPtVertexWeightCalculator.h.

66{ this, "TracksInConeTool", "xAOD::TrackParticlesInConeTool/TrackParticlesInConeTool" };

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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