ATLAS Offline Software
Loading...
Searching...
No Matches
L0MDT::PtEstimationTool Class Reference

#include <PtEstimationTool.h>

Inheritance diagram for L0MDT::PtEstimationTool:
Collaboration diagram for L0MDT::PtEstimationTool:

Public Member Functions

virtual ~PtEstimationTool () override=default
virtual StatusCode initialize () override
virtual std::optional< PtEstimateestimatePt (const Segment *biSeg, const Segment *bmSeg, const Segment *boSeg) const override
 Estimate the transverse momentum from up to three MDT segment references.
 AthAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor with parameters:
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
 DeclareInterfaceID (IPtEstimationTool, 1, 0)

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

float estimateTwoStationPt (float deltaBeta) const
 Compute a toy pT proxy from the angular deflection between two stations.
float estimateThreeStationPt (float sagitta, float leverArm) const
 Compute a toy pT proxy from the sagitta and lever arm of a three-station track.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

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 13 of file PtEstimationTool.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

◆ ~PtEstimationTool()

virtual L0MDT::PtEstimationTool::~PtEstimationTool ( )
overridevirtualdefault

Member Function Documentation

◆ AthAlgTool()

AthAlgTool::AthAlgTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor with parameters:

Definition at line 31 of file AthAlgTool.cxx.

◆ 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)

◆ DeclareInterfaceID()

L0MDT::IPtEstimationTool::DeclareInterfaceID ( IPtEstimationTool ,
1 ,
0  )
inherited

◆ 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.

◆ estimatePt()

std::optional< PtEstimate > L0MDT::PtEstimationTool::estimatePt ( const Segment * biSeg,
const Segment * bmSeg,
const Segment * boSeg ) const
overridevirtual

Estimate the transverse momentum from up to three MDT segment references.

Parameters
biSegPointer to the BI segment, or nullptr if not available
bmSegPointer to the BM segment, or nullptr if not available
boSegPointer to the BO segment, or nullptr if not available
Returns
A PtEstimate if at least two stations are available, std::nullopt otherwise

Implements L0MDT::IPtEstimationTool.

Definition at line 61 of file PtEstimationTool.cxx.

63 {
64 const bool hasBI = (biSeg != nullptr);
65 const bool hasBM = (bmSeg != nullptr);
66 const bool hasBO = (boSeg != nullptr);
67
68 const unsigned int nStations = static_cast<unsigned int>(hasBI) +
69 static_cast<unsigned int>(hasBM) +
70 static_cast<unsigned int>(hasBO);
71
72 // A meaningful geometric proxy needs at least two stations
73 if (nStations < 2) {
74 ATH_MSG_DEBUG("PtEstimationTool: fewer than 2 stations available, no pT proxy computed");
75 return std::nullopt;
76 }
77
78 PtEstimate result{};
79 result.nStations = nStations;
80
81 // --------------------------------------------------------------------------
82 // Two-station mode
83 //
84 // This branch estimates a toy pT proxy from the change in segment angle.
85 // This is only a bending proxy and is not a calibrated momentum estimate.
86 // --------------------------------------------------------------------------
87 if (nStations == 2) {
88 const Segment* inner = nullptr;
89 const Segment* outer = nullptr;
90
91 if (hasBI && hasBM) {
92 inner = biSeg;
93 outer = bmSeg;
94 } else if (hasBI && hasBO) {
95 inner = biSeg;
96 outer = boSeg;
97 } else if (hasBM && hasBO) {
98 inner = bmSeg;
99 outer = boSeg;
100 }
101
102 if (!inner || !outer) {
103 ATH_MSG_WARNING("PtEstimationTool: invalid 2-station configuration");
104 return std::nullopt;
105 }
106
107 const float thetaInner = thetaFromSlope(inner->m());
108 const float thetaOuter = thetaFromSlope(outer->m());
109
110 result.deltaBeta = thetaOuter - thetaInner;
111 result.pt = estimateTwoStationPt(result.deltaBeta);
112
113 ATH_MSG_DEBUG("Temporary 2-station pT proxy | "
114 << "deltaBeta=" << result.deltaBeta
115 << " ptProxy=" << result.pt);
116
117 return result;
118 }
119
120 // --------------------------------------------------------------------------
121 // Three-station mode
122 //
123 // This branch estimates a toy pT proxy from sagitta and lever arm.
124 // The result is purely geometric and ignores magnetic field and calibration.
125 // --------------------------------------------------------------------------
126 const float sagitta = pointToLineDistance(
127 bmSeg->zRef(), bmSeg->rRef(),
128 biSeg->zRef(), biSeg->rRef(),
129 boSeg->zRef(), boSeg->rRef());
130
131 const float leverArm = std::hypot(
132 boSeg->zRef() - biSeg->zRef(),
133 boSeg->rRef() - biSeg->rRef());
134
135 result.sagitta = sagitta;
136 result.leverArm = leverArm;
137 result.pt = estimateThreeStationPt(result.sagitta, result.leverArm);
138
139 ATH_MSG_DEBUG("Temporary 3-station pT proxy | "
140 << "sagitta=" << result.sagitta
141 << " leverArm=" << result.leverArm
142 << " ptProxy=" << result.pt);
143
144 return result;
145}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
float estimateTwoStationPt(float deltaBeta) const
Compute a toy pT proxy from the angular deflection between two stations.
float estimateThreeStationPt(float sagitta, float leverArm) const
Compute a toy pT proxy from the sagitta and lever arm of a three-station track.

◆ estimateThreeStationPt()

float L0MDT::PtEstimationTool::estimateThreeStationPt ( float sagitta,
float leverArm ) const
private

Compute a toy pT proxy from the sagitta and lever arm of a three-station track.

Parameters
sagittaPerpendicular distance of the middle station from the BI-BO line [mm]
leverArmDistance between inner and outer station in the (z, r) plane [mm]

Definition at line 162 of file PtEstimationTool.cxx.

162 {
163 // Protection against vanishing sagitta
164 constexpr float minAbsSagitta = 1.e-3f;
165
166 // Purely ad hoc scale factor for a temporary proxy
167 constexpr float kToyPtScale = 1.e-3f;
168
169 const float absSagitta = std::max(std::abs(sagitta), minAbsSagitta);
170
171 // Temporary proxy: pT ~ L^2 / sagitta
172 return kToyPtScale * leverArm * leverArm / absSagitta;
173}

◆ estimateTwoStationPt()

float L0MDT::PtEstimationTool::estimateTwoStationPt ( float deltaBeta) const
private

Compute a toy pT proxy from the angular deflection between two stations.

Parameters
deltaBetaDifference in segment angle between inner and outer station [rad]

Definition at line 148 of file PtEstimationTool.cxx.

148 {
149 // Protection against vanishing angular difference
150 constexpr float minAbsDeltaBeta = 1.e-4f;
151
152 // Purely ad hoc scale factor for a temporary proxy
153 constexpr float kToyPtScale = 1000.f;
154
155 const float absDeltaBeta = std::max(std::abs(deltaBeta), minAbsDeltaBeta);
156
157 // Temporary proxy: larger bending -> lower pT proxy
158 return kToyPtScale / absDeltaBeta;
159}

◆ 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

◆ initialize()

StatusCode L0MDT::PtEstimationTool::initialize ( )
overridevirtual

Definition at line 55 of file PtEstimationTool.cxx.

55 {
56 ATH_MSG_DEBUG("Initializing " << name());
57
58 return StatusCode::SUCCESS;
59}

◆ 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.

◆ 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_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_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_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: