ATLAS Offline Software
Loading...
Searching...
No Matches
Rec::MuidCaloTrackStateOnSurface Class Reference

#include <MuidCaloTrackStateOnSurface.h>

Inheritance diagram for Rec::MuidCaloTrackStateOnSurface:
Collaboration diagram for Rec::MuidCaloTrackStateOnSurface:

Public Member Functions

 MuidCaloTrackStateOnSurface (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~MuidCaloTrackStateOnSurface ()=default
StatusCode initialize () override
StatusCode finalize () override
std::vector< std::unique_ptr< const Trk::TrackStateOnSurface > > caloTSOS (const EventContext &ctx, const Trk::TrackParameters &parameters) const override
 IMuidCaloTrackStateOnSurface interface: to get the 3 scattering and energy deposit TSOS'es representing the calorimeter.
std::unique_ptr< Trk::TrackStateOnSurfaceinnerTSOS (const EventContext &ctx, const Trk::TrackParameters &parameters) const override
 IMuidCaloTrackStateOnSurface interface: to get individually the scattering TSOS'es representing the calorimeter.
std::unique_ptr< Trk::TrackStateOnSurfaceouterTSOS (const EventContext &ctx, const Trk::TrackParameters &parameters) const override
std::unique_ptr< Trk::TrackStateOnSurfacemiddleTSOS (const EventContext &ctx, const Trk::TrackParameters &middleParameters, const Trk::TrackParameters *innerParameters, const Trk::TrackParameters *outerParameters) const override
 IMuidCaloTrackStateOnSurface interface: to get the energy deposit TSOS representing the calorimeter.
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 and IAlgTool 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

enum  SurfaceLayer { Inner , Middle , Outer }
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

const Trk::SurfacegetCaloSurface (const double eta, const short layer) const
std::unique_ptr< const Trk::TrackParametersgetExtrapolatedParameters (const EventContext &ctx, const Trk::TrackParameters &parameters, const short layer) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static bool useEtaPhiFromDirection (const Trk::TrackParameters &parameters)

Private Attributes

ToolHandle< Rec::IMuidCaloEnergym_caloEnergyDeposit
ToolHandle< Rec::IMuidCaloEnergym_caloEnergyParam
ToolHandle< Rec::IMuidCaloMaterialParamm_caloMaterialParam
ToolHandle< Trk::IPropagatorm_propagator
Trk::MagneticFieldProperties m_magFieldProperties {Trk::FullField}
SG::ReadCondHandleKey< AtlasFieldCacheCondObjm_fieldCacheCondObjInputKey
double m_minCaloRadius
double m_minRemainingEnergy
double m_paramPtCut
std::atomic_int m_count {0}
std::atomic_int m_countArbitrarySolution {0}
std::atomic_int m_countCompleteFailure {0}
std::atomic_int m_countInnerFailure {0}
std::atomic_int m_countOuterFailure {0}
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 39 of file MuidCaloTrackStateOnSurface.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ SurfaceLayer

Constructor & Destructor Documentation

◆ MuidCaloTrackStateOnSurface()

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

Definition at line 38 of file MuidCaloTrackStateOnSurface.cxx.

38 :
39 AthAlgTool(type, name, parent),
40 m_minCaloRadius(0.4 * Gaudi::Units::meter),
41 m_minRemainingEnergy(0.5 * Gaudi::Units::GeV),
42 m_paramPtCut(15.0 * Gaudi::Units::GeV) {
43 declareInterface<IMuidCaloTrackStateOnSurface>(this);
44 declareProperty("MinCaloRadius", m_minCaloRadius);
45 declareProperty("MinRemainingEnergy", m_minRemainingEnergy);
46 declareProperty("ParamPtCut", m_paramPtCut);
47 }
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~MuidCaloTrackStateOnSurface()

virtual Rec::MuidCaloTrackStateOnSurface::~MuidCaloTrackStateOnSurface ( )
virtualdefault

Member Function Documentation

◆ caloTSOS()

std::vector< std::unique_ptr< const Trk::TrackStateOnSurface > > MuidCaloTrackStateOnSurface::caloTSOS ( const EventContext & ctx,
const Trk::TrackParameters & parameters ) const
overridevirtual

IMuidCaloTrackStateOnSurface interface: to get the 3 scattering and energy deposit TSOS'es representing the calorimeter.

The input TrackParameters may be anywhere along the track.

Implements Rec::IMuidCaloTrackStateOnSurface.

Definition at line 84 of file MuidCaloTrackStateOnSurface.cxx.

85 {
86 std::vector<std::unique_ptr<const Trk::TrackStateOnSurface>> caloTSOS;
87 caloTSOS.reserve(3);
88
89 std::unique_ptr<Trk::TrackStateOnSurface> innerTS, middleTS, outerTS;
90 std::unique_ptr<const Trk::TrackParameters> inParams, midParams;
91 const Trk::TrackParameters* innerParams = nullptr;
92 const Trk::TrackParameters* middleParams = nullptr;
93 const Trk::TrackParameters* outerParams = nullptr;
94
95 MagField::AtlasFieldCache fieldCache;
96 // Get field cache object
97 SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx};
98 const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
99
100 if (!fieldCondObj) {
101 ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key());
102 return caloTSOS;
103 }
104 fieldCondObj->getInitializedCache(fieldCache);
105
106 // track to calo surfaces - first decide in or outwards
107 bool trackOutwards = true;
108 if (dynamic_cast<const Trk::PerigeeSurface*>(&parameters.associatedSurface())) {
109 if (parameters.associatedSurface().center().perp() > 0.5 * Gaudi::Units::meter) trackOutwards = false;
110 } else if (std::abs(parameters.position().z()) > 4.0 * Gaudi::Units::meter ||
111 parameters.position().perp() > 1.2 * Gaudi::Units::meter) {
112 trackOutwards = false;
113 }
114
115 if (trackOutwards) // forward tracking
116 {
117 innerTS = innerTSOS(ctx, parameters);
118 if (innerTS) {
119 innerParams = innerTS->trackParameters();
120 if (innerParams->momentum().dot(innerParams->position()) > 0.) {
121 midParams = getExtrapolatedParameters(ctx, *innerParams, SurfaceLayer::Middle);
122 middleParams = midParams.get();
123 } else {
124 ATH_MSG_VERBOSE(" quit as looper " << innerParams);
125 }
126 if (middleParams) {
127 // get calo energy deposit
128 middleTS = m_caloEnergyParam->trackStateOnSurface(ctx, *midParams, innerParams, outerParams);
129 if (!middleTS) { middleParams = nullptr; }
130 }
131
132 if (middleParams) {
133 // apply energy deposit to give outgoing middleParams,
134 // note the iteration required to get optimum energy correction
135 std::unique_ptr<const Trk::TrackParameters> params;
136 for (int iterate = 0; iterate != 2; ++iterate) {
137 if (!middleTS) break;
138
139 const Trk::MaterialEffectsOnTrack* meot =
140 dynamic_cast<const Trk::MaterialEffectsOnTrack*>(middleTS->materialEffectsOnTrack());
141 const double energyDeposit = meot ? meot->energyLoss()->deltaE() : 0.;
142 middleParams = middleTS->trackParameters();
143 Amg::Vector3D momentum = middleParams->momentum();
144 double correctedEnergy = innerParams->momentum().mag() - energyDeposit;
145
146 // fail potential loopers
147 if (fieldCache.toroidOn() && correctedEnergy < m_minRemainingEnergy) {
148 middleTS.reset();
149 ATH_MSG_VERBOSE(" fail tracking outwards: momentum " << momentum.mag() / Gaudi::Units::GeV
150 << " energyDeposit " << energyDeposit / Gaudi::Units::GeV
151 << " correctedEnergy "
152 << correctedEnergy / Gaudi::Units::GeV << " (GeV units)");
153 break;
154 }
155 // toroid off: set floor for remaining energy
156 if (correctedEnergy < m_minRemainingEnergy) {
158 } else {
159 momentum *= correctedEnergy / momentum.mag();
160 }
161
162 const Trk::CylinderSurface* cylinder =
163 dynamic_cast<const Trk::CylinderSurface*>(&middleParams->associatedSurface());
164 if (cylinder) {
165 params =
166 std::make_unique<Trk::AtaCylinder>(middleParams->position(), momentum, middleParams->charge(), *cylinder);
167 } else {
168 const Trk::DiscSurface* disc = dynamic_cast<const Trk::DiscSurface*>(&middleParams->associatedSurface());
169 if (disc) {
170 params = std::make_unique<Trk::AtaDisc>(middleParams->position(), momentum, middleParams->charge(), *disc);
171 } else {
172 ATH_MSG_WARNING(" caloTSOS: unexpected TrackParameters type ");
173 }
174 }
175
176 // delete middle and outer,
177 // then recompute with parameters as for backwards tracking
178 if (!params) {
179 middleTS.reset();
180 } else if (params->momentum().perp() > m_paramPtCut) {
181 middleTS = m_caloEnergyDeposit->trackStateOnSurface(ctx, *params, innerParams, outerParams);
182 } else {
183 middleTS = m_caloEnergyParam->trackStateOnSurface(ctx, *params, innerParams, outerParams);
184 }
186 if (middleTS) { outerTS = outerTSOS(ctx, *params); }
187 }
188 if (!middleTS) { ATH_MSG_VERBOSE(" fail tracking outwards: no intersect at middle surface"); }
189 }
190 } else {
191 ATH_MSG_VERBOSE(" fail tracking ouwards: no intersect at inner surface");
192 }
193 } else // backward tracking
194 {
195 outerTS = outerTSOS(ctx, parameters);
196 if (outerTS) {
197 outerParams = outerTS->trackParameters();
198 midParams = getExtrapolatedParameters(ctx, *outerParams, SurfaceLayer::Middle);
199 middleParams = midParams.get();
200 if (middleParams) {
201 inParams = getExtrapolatedParameters(ctx, *midParams, SurfaceLayer::Inner);
202 innerParams = inParams.get();
203 if (inParams) {
204 // get calo energy deposit
205 if (middleParams->momentum().perp() > m_paramPtCut) {
206 middleTS = m_caloEnergyDeposit->trackStateOnSurface(ctx, *middleParams, inParams.get(), outerParams);
207 } else {
208 middleTS = m_caloEnergyParam->trackStateOnSurface(ctx, *middleParams, inParams.get(), outerParams);
209 }
210 // apply energy deposit
211 const Trk::MaterialEffectsOnTrack* meot =
212 middleTS ? dynamic_cast<const Trk::MaterialEffectsOnTrack*>(middleTS->materialEffectsOnTrack()) : nullptr;
213 const double energyDeposit = meot ? meot->energyLoss()->deltaE() : 0.;
214 Amg::Vector3D momentum = middleParams->momentum();
215 double correctedEnergy = momentum.mag() + energyDeposit;
216
217 // fail potential loopers
218 if (correctedEnergy < 0.5 * Gaudi::Units::GeV) {
219 middleTS.reset();
220 ATH_MSG_VERBOSE(" fail tracking inwards: momentum " << momentum.mag() / Gaudi::Units::GeV << " energyDeposit "
221 << energyDeposit / Gaudi::Units::GeV
222 << " correctedEnergy "
223 << correctedEnergy / Gaudi::Units::GeV << " (GeV units)");
224 } else {
225 momentum *= 1. + energyDeposit / momentum.mag();
226 std::unique_ptr<const Trk::TrackParameters> params;
227 const Trk::CylinderSurface* cylinder =
228 dynamic_cast<const Trk::CylinderSurface*>(&middleParams->associatedSurface());
229 std::optional<AmgSymMatrix(5)> cov =
230 middleParams->covariance() ? std::optional<AmgSymMatrix(5)>(*middleParams->covariance()) : std::nullopt;
231 if (cylinder) {
232 params = std::make_unique<Trk::AtaCylinder>(middleParams->position(), momentum, middleParams->charge(),
233 *cylinder, cov);
234 } else {
235 const Trk::DiscSurface* disc = dynamic_cast<const Trk::DiscSurface*>(&middleParams->associatedSurface());
236 if (disc) {
237 params = std::make_unique<Trk::AtaDisc>(middleParams->position(), momentum, middleParams->charge(),
238 *disc, cov);
239 } else {
240 ATH_MSG_WARNING(" caloTSOS: unexpected TrackParameters type ");
241 }
242 }
243 if (params && middleTS) { innerTS = innerTSOS(ctx, *params); }
244 }
245 } else {
246 ATH_MSG_VERBOSE(" fail tracking inwards: no intersect at inner surface");
247 }
248 } else {
249 ATH_MSG_VERBOSE(" fail tracking inwards: no intersect at middle surface");
250 }
251 }
252 }
253
254 if (innerTS)
255 caloTSOS.push_back(std::move(innerTS));
256 else
258 if (middleTS) caloTSOS.push_back(std::move(middleTS));
259 if (outerTS)
260 caloTSOS.push_back(std::move(outerTS));
261 else
263
264 // keep some statistics
265 ++m_count;
266
267 if (caloTSOS.empty()) { ++m_countCompleteFailure; }
268 return caloTSOS;
269 }
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define AmgSymMatrix(dim)
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
std::vector< std::unique_ptr< const Trk::TrackStateOnSurface > > caloTSOS(const EventContext &ctx, const Trk::TrackParameters &parameters) const override
IMuidCaloTrackStateOnSurface interface: to get the 3 scattering and energy deposit TSOS'es representi...
std::unique_ptr< Trk::TrackStateOnSurface > outerTSOS(const EventContext &ctx, const Trk::TrackParameters &parameters) const override
ToolHandle< Rec::IMuidCaloEnergy > m_caloEnergyDeposit
std::unique_ptr< const Trk::TrackParameters > getExtrapolatedParameters(const EventContext &ctx, const Trk::TrackParameters &parameters, const short layer) const
std::unique_ptr< Trk::TrackStateOnSurface > innerTSOS(const EventContext &ctx, const Trk::TrackParameters &parameters) const override
IMuidCaloTrackStateOnSurface interface: to get individually the scattering TSOS'es representing the c...
ToolHandle< Rec::IMuidCaloEnergy > m_caloEnergyParam
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
double deltaE() const
returns the
const EnergyLoss * energyLoss() const
returns the energy loss object.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
double charge() const
Returns the charge.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
Eigen::Matrix< double, 3, 1 > Vector3D
iterate(ROOT.TDirectory thisdir, ROOT.TDirectory targetdir, str prefix, typing.Pattern regex, bool excludeTrees)
@ energyDeposit
ParametersBase< TrackParametersDim, Charged > TrackParameters

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

◆ 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 MuidCaloTrackStateOnSurface::finalize ( )
override

Definition at line 73 of file MuidCaloTrackStateOnSurface.cxx.

73 {
74 ATH_MSG_INFO("finalized with " << m_count << " muons asking for calo association, out of which: " << endmsg << " "
75 << m_countInnerFailure << " failed to find the inner calo scattering plane," << endmsg << " "
76 << m_countOuterFailure << " failed to find the outer calo scattering plane," << endmsg
77 << " while another " << m_countCompleteFailure
78 << " completely failed to intersect the calorimeter." << endmsg << " "
79 << m_countArbitrarySolution << " with oscillation resolved by taking an arbitrary solution");
80
81 return StatusCode::SUCCESS;
82 }
#define endmsg
#define ATH_MSG_INFO(x)

◆ getCaloSurface()

const Trk::Surface * MuidCaloTrackStateOnSurface::getCaloSurface ( const double eta,
const short layer ) const
private

Definition at line 309 of file MuidCaloTrackStateOnSurface.cxx.

309 {
310 if (layer == SurfaceLayer::Inner) return m_caloMaterialParam->innerSurface(eta);
311 if (layer == SurfaceLayer::Middle) return m_caloMaterialParam->middleSurface(eta);
312 if (layer == SurfaceLayer::Outer) return m_caloMaterialParam->outerSurface(eta);
313 ATH_MSG_WARNING("Invalid layer id given " << layer);
314 return nullptr;
315 }
Scalar eta() const
pseudorapidity method
ToolHandle< Rec::IMuidCaloMaterialParam > m_caloMaterialParam

◆ getExtrapolatedParameters()

std::unique_ptr< const Trk::TrackParameters > MuidCaloTrackStateOnSurface::getExtrapolatedParameters ( const EventContext & ctx,
const Trk::TrackParameters & parameters,
const short layer ) const
private

The TrackParameters own their dedicated instance of the track surface... In cases, where the loop below resets the extrapolation we need to clone the surface as well this pointer is just the surface garbage collection

Definition at line 316 of file MuidCaloTrackStateOnSurface.cxx.

317 {
318 // will need to know whether forward or back tracking
319 Trk::PropDirection momentumDirection = Trk::alongMomentum;
320 Trk::PropDirection oppositeDirection = Trk::oppositeMomentum;
322 const std::string surf_layer_str = layer == SurfaceLayer::Inner ? "Inner" : (layer == SurfaceLayer::Middle ? "Middle" : "Outer");
323 // initial surface at track eta -
324 // using position or direction according to distance from origin
325 double startingPhi = 0.;
326 const Trk::Surface* surface = nullptr;
327 if (useEtaPhiFromDirection(parameters)) {
328 startingPhi = parameters.momentum().phi();
329 surface = getCaloSurface(parameters.momentum().eta(), layer);
330 } else {
331 startingPhi = parameters.position().phi();
332 surface = getCaloSurface(parameters.position().eta(), layer);
333 if (parameters.momentum().dot(parameters.position()) < 0.) {
334 momentumDirection = Trk::oppositeMomentum;
335 oppositeDirection = Trk::alongMomentum;
336 }
337 }
338 if (!surface) return nullptr;
339
340 // extrapolate to calo surface (take care to get correct cylinder intersect)
341 unsigned extrapolations = 0;
342 if (surface->type() == Trk::SurfaceType::Cylinder) {
343 if (parameters.position().perp() < surface->globalReferencePoint().perp()) {
344 propDirection = momentumDirection;
345 } else {
346 propDirection = oppositeDirection;
347 }
348 }
349 // tidy up ownership later
350 std::unique_ptr<const Trk::TrackParameters> extrapolation{
351 m_propagator->propagate(ctx, parameters, *surface, propDirection, false, m_magFieldProperties, Trk::nonInteracting)};
352 if (!extrapolation) return nullptr;
353
354 // phi flip means track has crossed beam-axis (so quit)
355 double deltaPhi = xAOD::P4Helpers::deltaPhi(extrapolation->position().phi(), startingPhi);
356 if (std::abs(deltaPhi) > M_PI_2) { return nullptr; }
357
358 // also quit wrong rz-direction in endcap
359 if (surface->type() != Trk::SurfaceType::Cylinder) {
360 double signRZ = (extrapolation->position().perp() - parameters.position().perp()) *
361 (extrapolation->position().z() - parameters.position().z());
362 if (signRZ * extrapolation->position().z() < 0.) {
363 ATH_MSG_VERBOSE(" wrong way in endcap ");
364 return nullptr;
365 }
366 }
367
368 // iterate if extrapolated surface is different
369 bool restart = false;
370 const Trk::Surface* oldSurface = surface;
371 const Trk::Surface* extrapolatedSurface = getCaloSurface(extrapolation->position().eta(), layer);
375 std::unique_ptr<const Trk::Surface> reset_surface;
376 while (++extrapolations < 5 && extrapolatedSurface != oldSurface) {
377 // take care to get correct solution for cylinder when starting from inside
378 if (surface->type() == Trk::SurfaceType::Cylinder) {
379 if (extrapolation->position().perp() < surface->globalReferencePoint().perp()) {
380 propDirection = momentumDirection;
381 } else {
382 propDirection = oppositeDirection;
383 }
384 } else {
385 propDirection = Trk::anyDirection;
386 }
387 std::unique_ptr<const Trk::TrackParameters> oldParameters = std::move(extrapolation);
388 extrapolation = m_propagator->propagate(ctx, *oldParameters, *extrapolatedSurface, propDirection, false, m_magFieldProperties,
390 if (!extrapolation) {
391 // restart from input parameters (if not already done)
392 // trap no solution after restart
393 if ((*oldParameters) == parameters) {
394 ATH_MSG_VERBOSE(" innerParameters: extrap fails ");
395 return nullptr;
396 }
397 if (restart) {
398 ATH_MSG_DEBUG(surf_layer_str << " Parameters: oscillating => arbitrary solution chosen");
400 extrapolation = std::move(oldParameters);
401 reset_surface.reset(extrapolation->associatedSurface().clone());
402 extrapolatedSurface = reset_surface.get();
403 surface = extrapolatedSurface;
404 restart = false;
405 } else {
406 ATH_MSG_VERBOSE(surf_layer_str << " Parameters: restart extrap after " << extrapolations << " extrapolations");
407 restart = true;
408 extrapolations -= 2;
409 extrapolation = parameters.uniqueClone();
410 surface = oldSurface;
411 }
412 } else {
413 // update surface
414 ATH_MSG_DEBUG(surf_layer_str << " Parameters: Extrapolation succeeded go to next iteration");
415 oldSurface = surface;
416 surface = extrapolatedSurface;
417 extrapolatedSurface = getCaloSurface(extrapolation->position().eta(), layer);
418 }
419 }
420
421 // final check for phi flip
422 deltaPhi = xAOD::P4Helpers::deltaPhi(extrapolation->position().phi(), startingPhi);
423 if (std::abs(deltaPhi) > M_PI_2) { return nullptr; }
424
425 ATH_MSG_VERBOSE(surf_layer_str << " Parameters: success after " << extrapolations << " extrapolation step(s). "
426 << std::setiosflags(std::ios::fixed) << " Intersection at: r,phi,z " << std::setw(7)
427 << std::setprecision(1) << extrapolation->position().perp() << std::setw(7) << std::setprecision(3)
428 << extrapolation->position().phi() << std::setw(8) << std::setprecision(1)
429 << extrapolation->position().z() << " Direction: eta,phi " << std::setw(7) << std::setprecision(3)
430 << extrapolation->momentum().eta() << std::setw(7) << std::setprecision(3)
431 << extrapolation->momentum().phi());
432
433 return extrapolation;
434 }
Scalar perp() const
perp method - perpendicular length
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_MSG_DEBUG(x)
#define z
const Trk::Surface * getCaloSurface(const double eta, const short layer) const
Trk::MagneticFieldProperties m_magFieldProperties
static bool useEtaPhiFromDirection(const Trk::TrackParameters &parameters)
ToolHandle< Trk::IPropagator > m_propagator
virtual constexpr SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
virtual const Amg::Vector3D & globalReferencePoint() const
Returns a global reference point on the surface, for PlaneSurface, StraightLineSurface,...
@ layer
Definition HitInfo.h:79
PropDirection
PropDirection, enum for direction of the propagation.
@ oppositeMomentum
@ alongMomentum
@ anyDirection
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[

◆ initialize()

StatusCode MuidCaloTrackStateOnSurface::initialize ( )
override

handle to the magnetic field cache

Definition at line 51 of file MuidCaloTrackStateOnSurface.cxx.

51 {
52 ATH_MSG_DEBUG("Initializing CombinedMuonTrackStateOnSurface");
53
54 // get the Tools
56 ATH_MSG_DEBUG("Retrieved tool " << m_caloEnergyDeposit);
57
58 ATH_CHECK(m_caloEnergyParam.retrieve());
59 ATH_MSG_DEBUG("Retrieved tool " << m_caloEnergyParam);
60
62 ATH_MSG_DEBUG("Retrieved tool " << m_caloMaterialParam);
63
66
67 ATH_CHECK(m_propagator.retrieve());
68 ATH_MSG_DEBUG("Retrieved tool " << m_propagator);
69
70 return StatusCode::SUCCESS;
71 }
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ innerTSOS()

std::unique_ptr< Trk::TrackStateOnSurface > MuidCaloTrackStateOnSurface::innerTSOS ( const EventContext & ctx,
const Trk::TrackParameters & parameters ) const
overridevirtual

IMuidCaloTrackStateOnSurface interface: to get individually the scattering TSOS'es representing the calorimeter.

The input TrackParameters may be anywhere along the track.

Implements Rec::IMuidCaloTrackStateOnSurface.

Definition at line 270 of file MuidCaloTrackStateOnSurface.cxx.

271 {
272 std::unique_ptr<const Trk::TrackParameters> extrapolation = getExtrapolatedParameters(ctx, parameters, SurfaceLayer::Inner);
273 if (!extrapolation || extrapolation->position().perp() < m_minCaloRadius) {
274 ATH_MSG_DEBUG(" innerTSOS: extrapolation fails ");
275 return nullptr;
276 }
277 return m_caloMaterialParam->trackStateOnSurface(*extrapolation);
278 }

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

AlgTool and IAlgTool interface methods.

Interface ID for IMuidCaloTrackStateOnSurface

Definition at line 40 of file IMuidCaloTrackStateOnSurface.h.

40 {
41 static const InterfaceID IID_IMuidCaloTrackStateOnSurface("IMuidCaloTrackStateOnSurface", 1, 0);
42 return IID_IMuidCaloTrackStateOnSurface;
43 }

◆ middleTSOS()

std::unique_ptr< Trk::TrackStateOnSurface > MuidCaloTrackStateOnSurface::middleTSOS ( const EventContext & ctx,
const Trk::TrackParameters & middleParameters,
const Trk::TrackParameters * innerParameters,
const Trk::TrackParameters * outerParameters ) const
overridevirtual

IMuidCaloTrackStateOnSurface interface: to get the energy deposit TSOS representing the calorimeter.

The input TrackParameters may be anywhere along the track, but when the inner or outer parameters are provided they must be expressed at the appropriate surface. The return TSOS surface is at the material midpoint.

Implements Rec::IMuidCaloTrackStateOnSurface.

Definition at line 288 of file MuidCaloTrackStateOnSurface.cxx.

291 {
292 std::unique_ptr<const Trk::TrackParameters> extrapolation = getExtrapolatedParameters(ctx, middleParams, SurfaceLayer::Middle);
293
294 if (!extrapolation || extrapolation->position().perp() < m_minCaloRadius) {
295 ATH_MSG_DEBUG(" middleTSOS: extrapolation fails ");
296 return nullptr;
297 }
298 std::unique_ptr<Trk::TrackStateOnSurface> TSOS;
299 if (extrapolation->momentum().perp() > m_paramPtCut) {
300 TSOS = m_caloEnergyDeposit->trackStateOnSurface(ctx, *extrapolation, innerParams, outerParams);
301 } else {
302 TSOS = m_caloEnergyParam->trackStateOnSurface(ctx, *extrapolation, innerParams, outerParams);
303 }
304 return TSOS;
305 }

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

◆ outerTSOS()

std::unique_ptr< Trk::TrackStateOnSurface > MuidCaloTrackStateOnSurface::outerTSOS ( const EventContext & ctx,
const Trk::TrackParameters & parameters ) const
overridevirtual

Implements Rec::IMuidCaloTrackStateOnSurface.

Definition at line 279 of file MuidCaloTrackStateOnSurface.cxx.

280 {
281 std::unique_ptr<const Trk::TrackParameters> extrapolation = getExtrapolatedParameters(ctx, parameters, SurfaceLayer::Outer);
282 if (!extrapolation || extrapolation->position().perp() < m_minCaloRadius) {
283 ATH_MSG_DEBUG(" outerTSOS: extrapolation fails ");
284 return nullptr;
285 }
286 return m_caloMaterialParam->trackStateOnSurface(*extrapolation);
287 }

◆ 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

◆ useEtaPhiFromDirection()

bool MuidCaloTrackStateOnSurface::useEtaPhiFromDirection ( const Trk::TrackParameters & parameters)
staticprivate

Definition at line 436 of file MuidCaloTrackStateOnSurface.cxx.

436 {
437 // estimate eta,phi for the track intersect with the calo from the track direction when the
438 // parameters are expressed near the beam-line, further out it's better to use the track position
439 double parameterDistance = parameters.position().mag();
440 if (dynamic_cast<const Trk::PerigeeSurface*>(&parameters.associatedSurface()))
441 parameterDistance = parameters.associatedSurface().center().perp();
442
443 return parameterDistance < 0.5 * Gaudi::Units::meter;
444 }

Member Data Documentation

◆ m_caloEnergyDeposit

ToolHandle<Rec::IMuidCaloEnergy> Rec::MuidCaloTrackStateOnSurface::m_caloEnergyDeposit
private
Initial value:
{
this,
"CaloEnergyDeposit",
"Rec::MuidCaloEnergyTool/MuidCaloEnergyTool",
}

Definition at line 80 of file MuidCaloTrackStateOnSurface.h.

80 {
81 this,
82 "CaloEnergyDeposit",
83 "Rec::MuidCaloEnergyTool/MuidCaloEnergyTool",
84 };

◆ m_caloEnergyParam

ToolHandle<Rec::IMuidCaloEnergy> Rec::MuidCaloTrackStateOnSurface::m_caloEnergyParam
private
Initial value:
{
this,
"CaloEnergyParam",
"Rec::MuidCaloEnergyTool/MuidCaloEnergyToolParam",
}

Definition at line 85 of file MuidCaloTrackStateOnSurface.h.

85 {
86 this,
87 "CaloEnergyParam",
88 "Rec::MuidCaloEnergyTool/MuidCaloEnergyToolParam",
89 };

◆ m_caloMaterialParam

ToolHandle<Rec::IMuidCaloMaterialParam> Rec::MuidCaloTrackStateOnSurface::m_caloMaterialParam
private
Initial value:
{
this,
"CaloMaterialParam",
"Rec::MuidCaloMaterialParam/MuidCaloMaterialParam",
}

Definition at line 90 of file MuidCaloTrackStateOnSurface.h.

90 {
91 this,
92 "CaloMaterialParam",
93 "Rec::MuidCaloMaterialParam/MuidCaloMaterialParam",
94 };

◆ m_count

std::atomic_int Rec::MuidCaloTrackStateOnSurface::m_count {0}
mutableprivate

Definition at line 113 of file MuidCaloTrackStateOnSurface.h.

113{0};

◆ m_countArbitrarySolution

std::atomic_int Rec::MuidCaloTrackStateOnSurface::m_countArbitrarySolution {0}
mutableprivate

Definition at line 114 of file MuidCaloTrackStateOnSurface.h.

114{0};

◆ m_countCompleteFailure

std::atomic_int Rec::MuidCaloTrackStateOnSurface::m_countCompleteFailure {0}
mutableprivate

Definition at line 115 of file MuidCaloTrackStateOnSurface.h.

115{0};

◆ m_countInnerFailure

std::atomic_int Rec::MuidCaloTrackStateOnSurface::m_countInnerFailure {0}
mutableprivate

Definition at line 116 of file MuidCaloTrackStateOnSurface.h.

116{0};

◆ m_countOuterFailure

std::atomic_int Rec::MuidCaloTrackStateOnSurface::m_countOuterFailure {0}
mutableprivate

Definition at line 117 of file MuidCaloTrackStateOnSurface.h.

117{0};

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

SG::ReadCondHandleKey<AtlasFieldCacheCondObj> Rec::MuidCaloTrackStateOnSurface::m_fieldCacheCondObjInputKey
private
Initial value:
{this, "AtlasFieldCacheCondObj", "fieldCondObj",
"Name of the Magnetic Field conditions object key"}

Definition at line 104 of file MuidCaloTrackStateOnSurface.h.

104 {this, "AtlasFieldCacheCondObj", "fieldCondObj",
105 "Name of the Magnetic Field conditions object key"};

◆ m_magFieldProperties

Trk::MagneticFieldProperties Rec::MuidCaloTrackStateOnSurface::m_magFieldProperties {Trk::FullField}
private

Definition at line 101 of file MuidCaloTrackStateOnSurface.h.

@ FullField
Field is set to be realistic, but within a given Volume.

◆ m_minCaloRadius

double Rec::MuidCaloTrackStateOnSurface::m_minCaloRadius
private

Definition at line 108 of file MuidCaloTrackStateOnSurface.h.

◆ m_minRemainingEnergy

double Rec::MuidCaloTrackStateOnSurface::m_minRemainingEnergy
private

Definition at line 109 of file MuidCaloTrackStateOnSurface.h.

◆ m_paramPtCut

double Rec::MuidCaloTrackStateOnSurface::m_paramPtCut
private

Definition at line 110 of file MuidCaloTrackStateOnSurface.h.

◆ m_propagator

ToolHandle<Trk::IPropagator> Rec::MuidCaloTrackStateOnSurface::m_propagator
private
Initial value:
{
this,
"Propagator",
"Trk::IntersectorWrapper/IntersectorWrapper",
}

Definition at line 95 of file MuidCaloTrackStateOnSurface.h.

95 {
96 this,
97 "Propagator",
98 "Trk::IntersectorWrapper/IntersectorWrapper",
99 };

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