ATLAS Offline Software
Loading...
Searching...
No Matches
egammaTrkRefitterTool Class Referencefinal

#include <egammaTrkRefitterTool.h>

Inheritance diagram for egammaTrkRefitterTool:
Collaboration diagram for egammaTrkRefitterTool:

Classes

struct  MeasurementsAndTrash

Public Types

typedef IegammaTrkRefitterTool::Cache Cache

Public Member Functions

 egammaTrkRefitterTool (const std::string &, const std::string &, const IInterface *)
 Constructor with AlgTool parameters.
virtual ~egammaTrkRefitterTool ()=default
 Destructor.
virtual StatusCode initialize () override
 AlgTool initialise method.
virtual StatusCode finalize () override
 AlgTool finalise method.
virtual StatusCode refitTrack (const EventContext &ctx, const Trk::Track *, Cache &cache) const override final
 Refit a track.
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 ()
 Alg tool and IAlgTool interface method.

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

std::vector< const Trk::MeasurementBase * > getIDHits (const Trk::Track *track) const
 Get the hits from the Inner Detector.
MeasurementsAndTrash addPointsToTrack (const EventContext &ctx, const Trk::Track *track, const xAOD::Electron *eg=nullptr) const
 Adds a beam spot to the Measurements passed to the track refitter.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< Trk::ITrackFitterm_ITrackFitter
 The track refitter.
ToolHandle< ICaloCluster_OnTrackBuilderm_CCOTBuilder { this, "CCOTBuilder", "CaloCluster_OnTrackBuilder", "" }
Gaudi::Property< int > m_matEffects
 type of material interaction in extrapolation
Trk::ParticleHypothesis m_ParticleHypothesis
 Particle Hypothesis.
const AtlasDetectorIDm_idHelper
Gaudi::Property< bool > m_useClusterPosition
Gaudi::Property< bool > m_RemoveTRT
 Option to remove TRT hits from track.
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 35 of file egammaTrkRefitterTool.h.

Member Typedef Documentation

◆ Cache

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ egammaTrkRefitterTool()

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

Constructor with AlgTool parameters.

Definition at line 26 of file egammaTrkRefitterTool.cxx.

29 : AthAlgTool(type, name, parent)
31 , m_idHelper(nullptr)
32{
33 declareInterface<IegammaTrkRefitterTool>(this);
34}
AthAlgTool()
Default constructor:
const AtlasDetectorID * m_idHelper
Trk::ParticleHypothesis m_ParticleHypothesis
Particle Hypothesis.

◆ ~egammaTrkRefitterTool()

virtual egammaTrkRefitterTool::~egammaTrkRefitterTool ( )
virtualdefault

Destructor.

Member Function Documentation

◆ addPointsToTrack()

egammaTrkRefitterTool::MeasurementsAndTrash egammaTrkRefitterTool::addPointsToTrack ( const EventContext & ctx,
const Trk::Track * track,
const xAOD::Electron * eg = nullptr ) const
private

Adds a beam spot to the Measurements passed to the track refitter.

Definition at line 135 of file egammaTrkRefitterTool.cxx.

138{
139 egammaTrkRefitterTool::MeasurementsAndTrash collect{};
140 /* The issue here is that some of the returned measurements are owned by
141 * storegate some not. For the ones that are not put them in a vector of
142 * unique_ptr which we will also return to the caller*/
143 if (m_useClusterPosition && eg->caloCluster()) {
144 int charge(0);
145 if (track->perigeeParameters()) {
146 charge = (int)track->perigeeParameters()->charge();
147 }
148 std::unique_ptr<const Trk::CaloCluster_OnTrack> ccot(
149 m_CCOTBuilder->buildClusterOnTrack(ctx, eg->caloCluster(), charge));
150 if (ccot != nullptr) {
151 collect.m_trash.push_back(std::move(ccot));
152 collect.m_measurements.push_back(collect.m_trash.back().get());
153 }
154 }
155 std::vector<const Trk::MeasurementBase*> vecIDHits = getIDHits(track);
156 std::vector<const Trk::MeasurementBase*>::const_iterator it =
157 vecIDHits.begin();
158 std::vector<const Trk::MeasurementBase*>::const_iterator itend =
159 vecIDHits.end();
160 // Fill the track , these are not trash
161 for (; it != itend; ++it) {
162 collect.m_measurements.push_back(*it);
163 }
164 return collect;
165}
double charge(const T &p)
Definition AtlasPID.h:997
ToolHandle< ICaloCluster_OnTrackBuilder > m_CCOTBuilder
Gaudi::Property< bool > m_useClusterPosition
std::vector< const Trk::MeasurementBase * > getIDHits(const Trk::Track *track) const
Get the hits from the Inner Detector.
void collect(const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, const std::string &label, unsigned int condition, const std::string &teName, const HLT::TrigNavStructure *navstructure)
actual feature acceess implementation It has (thanks to the ClassTraits) functionality to flatten con...

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

◆ 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 egammaTrkRefitterTool::finalize ( )
overridevirtual

AlgTool finalise method.

Definition at line 56 of file egammaTrkRefitterTool.cxx.

57{
58 return StatusCode::SUCCESS;
59}

◆ getIDHits()

std::vector< const Trk::MeasurementBase * > egammaTrkRefitterTool::getIDHits ( const Trk::Track * track) const
private

Get the hits from the Inner Detector.

Definition at line 168 of file egammaTrkRefitterTool.cxx.

169{
170
171 //store measurement to fit in the measurementSet
172 std::vector<const Trk::MeasurementBase*> measurementSet;
173 measurementSet.reserve(track->trackStateOnSurfaces()->size());
174
175 for (const auto* tsos : *(track->trackStateOnSurfaces())) {
176 if (!tsos) {
178 "This track contains an empty TrackStateOnSurface "
179 "that won't be included in the fit");
180 continue;
181 }
184
185 const auto* meas = tsos->measurementOnTrack();
186 if (meas) {
187 const Trk::RIO_OnTrack* rio = nullptr;
189 rio = static_cast<const Trk::RIO_OnTrack*>(meas);
190 }
191 if (rio != nullptr) {
192 const Identifier& surfaceID = (rio->identify());
193 if (m_idHelper->is_sct(surfaceID) ||
194 m_idHelper->is_pixel(surfaceID) ||
195 (!m_RemoveTRT && m_idHelper->is_trt(surfaceID))) {
196 measurementSet.push_back(meas);
197 }
198 }
199 }
200 }
201 }
202 return measurementSet;
203}
#define ATH_MSG_WARNING(x)
Identifier identify() const
return the identifier -extends MeasurementBase
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
Gaudi::Property< bool > m_RemoveTRT
Option to remove TRT hits from track.

◆ initialize()

StatusCode egammaTrkRefitterTool::initialize ( )
overridevirtual

AlgTool initialise method.

Definition at line 37 of file egammaTrkRefitterTool.cxx.

38{
39 // Retrieve fitter
40 ATH_CHECK(m_ITrackFitter.retrieve());
41
42 ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID"));
43
44 // configure calo cluster on track builder (only if used)
46 ATH_CHECK(m_CCOTBuilder.retrieve());
47 } else {
48 m_CCOTBuilder.disable();
49 }
50 // Set the particle hypothesis to match the material effects
52 return StatusCode::SUCCESS;
53}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
ToolHandle< Trk::ITrackFitter > m_ITrackFitter
The track refitter.
Gaudi::Property< int > m_matEffects
type of material interaction in extrapolation
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ 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 & IegammaTrkRefitterTool::interfaceID ( )
inlinestaticinherited

Alg tool and IAlgTool interface method.

Definition at line 34 of file IegammaTrkRefitterTool.h.

35 { return IID_egammaTrkRefitterTool; };
static const InterfaceID IID_egammaTrkRefitterTool("IegammaTrkRefitterTool", 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.

◆ refitTrack()

StatusCode egammaTrkRefitterTool::refitTrack ( const EventContext & ctx,
const Trk::Track * track,
Cache & cache ) const
finaloverridevirtual

Refit a track.

Implements IegammaTrkRefitterTool.

Definition at line 62 of file egammaTrkRefitterTool.cxx.

65{
66 cache.refittedTrack = nullptr;
67 cache.refittedTrackPerigee = nullptr;
68 cache.originalTrack = nullptr;
69 cache.originalTrackPerigee = nullptr;
70 if (!track) {
71 return StatusCode::FAILURE;
72 }
73 // Set the pointer to the track
74 cache.originalTrack = track;
75
76 // Set pointer to the original perigee
77 cache.originalTrackPerigee = cache.originalTrack->perigeeParameters();
78
79 if (cache.originalTrackPerigee != nullptr) {
80 double od0 = cache.originalTrackPerigee->parameters()[Trk::d0];
81 double oz0 = cache.originalTrackPerigee->parameters()[Trk::z0];
82 double ophi0 = cache.originalTrackPerigee->parameters()[Trk::phi0];
83 double otheta = cache.originalTrackPerigee->parameters()[Trk::theta];
84 double oqOverP = cache.originalTrackPerigee->parameters()[Trk::qOverP];
85 ATH_MSG_DEBUG("Original parameters " << od0 << " " << oz0 << " " << ophi0
86 << " " << otheta << " " << oqOverP
87 << " " << 1 / oqOverP);
88 } else {
89 ATH_MSG_WARNING("Could not get Trk::Perigee of original track");
90 }
91
92 // Refit the track with the beam spot if desired otherwise just refit the
93 // original track
95 egammaTrkRefitterTool::MeasurementsAndTrash collect =
96 addPointsToTrack(ctx, cache.originalTrack, cache.electron);
97 if (collect.m_measurements.size() > 4) {
98 cache.refittedTrack =
99 m_ITrackFitter->fit(ctx,
100 collect.m_measurements,
101 *cache.originalTrack->perigeeParameters(),
102 false,
104 } else {
105 cache.refittedTrack = nullptr;
106 }
107 } else {
108 std::vector<const Trk::MeasurementBase*> measurements =
109 getIDHits(cache.originalTrack);
110 if (measurements.size() > 4) {
111 cache.refittedTrack =
112 m_ITrackFitter->fit(ctx,
113 measurements,
114 *cache.originalTrack->perigeeParameters(),
115 false,
117 } else {
118 cache.refittedTrack = nullptr;
119 }
120 }
121
122 // Store refitted perigee pointers
123 if (cache.refittedTrack) {
124 cache.refittedTrackPerigee = cache.refittedTrack->perigeeParameters();
125 if (cache.refittedTrackPerigee == nullptr) {
126 ATH_MSG_WARNING("Could not get refitted Trk::Perigee");
127 return StatusCode::FAILURE;
128 }
129 return StatusCode::SUCCESS;
130 }
131 return StatusCode::FAILURE;
132}
#define ATH_MSG_DEBUG(x)
MeasurementsAndTrash addPointsToTrack(const EventContext &ctx, const Trk::Track *track, const xAOD::Electron *eg=nullptr) const
Adds a beam spot to the Measurements passed to the track refitter.
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64

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

ToolHandle<ICaloCluster_OnTrackBuilder> egammaTrkRefitterTool::m_CCOTBuilder { this, "CCOTBuilder", "CaloCluster_OnTrackBuilder", "" }
private

Definition at line 92 of file egammaTrkRefitterTool.h.

92{ this, "CCOTBuilder", "CaloCluster_OnTrackBuilder", "" };

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

const AtlasDetectorID* egammaTrkRefitterTool::m_idHelper
private

Definition at line 105 of file egammaTrkRefitterTool.h.

◆ m_ITrackFitter

ToolHandle<Trk::ITrackFitter> egammaTrkRefitterTool::m_ITrackFitter
private
Initial value:
{
this,
"FitterTool",
"Trk__GaussianSumFitter/GSFTrackFitter",
"ToolHandle for track fitter implementation"
}

The track refitter.

Definition at line 84 of file egammaTrkRefitterTool.h.

84 {
85 this,
86 "FitterTool",
87 "Trk__GaussianSumFitter/GSFTrackFitter",
88 "ToolHandle for track fitter implementation"
89 };

◆ m_matEffects

Gaudi::Property<int> egammaTrkRefitterTool::m_matEffects
private
Initial value:
{
this,
"matEffects",
1,
"Type of material interaction in extrapolation (Default Electron)"
}

type of material interaction in extrapolation

Definition at line 95 of file egammaTrkRefitterTool.h.

95 {
96 this,
97 "matEffects",
98 1,
99 "Type of material interaction in extrapolation (Default Electron)"
100 };

◆ m_ParticleHypothesis

Trk::ParticleHypothesis egammaTrkRefitterTool::m_ParticleHypothesis
private

Particle Hypothesis.

Definition at line 103 of file egammaTrkRefitterTool.h.

◆ m_RemoveTRT

Gaudi::Property<bool> egammaTrkRefitterTool::m_RemoveTRT
private
Initial value:
{ this,
"RemoveTRTHits",
false,
"RemoveTRT Hits" }

Option to remove TRT hits from track.

Definition at line 115 of file egammaTrkRefitterTool.h.

115 { this,
116 "RemoveTRTHits",
117 false,
118 "RemoveTRT Hits" };

◆ m_useClusterPosition

Gaudi::Property<bool> egammaTrkRefitterTool::m_useClusterPosition
private
Initial value:
{
this,
"useClusterPosition",
false,
"Switch to control use of Cluster position measurement"
}

Definition at line 107 of file egammaTrkRefitterTool.h.

107 {
108 this,
109 "useClusterPosition",
110 false,
111 "Switch to control use of Cluster position measurement"
112 };

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