Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
DerivationFramework::MuonExtrapolationTool Class Reference

#include <MuonExtrapolationTool.h>

Inheritance diagram for DerivationFramework::MuonExtrapolationTool:
Collaboration diagram for DerivationFramework::MuonExtrapolationTool:

Public Member Functions

 MuonExtrapolationTool (const std::string &t, const std::string &n, const IInterface *p)
 
virtual StatusCode initialize ()
 
virtual StatusCode addBranches () const
 

Public Attributes

ToolHandle< Trk::IExtrapolatorm_extrapolator
 

Private Member Functions

const Trk::TrackParametersextrapolateToTriggerPivotPlane (const xAOD::TrackParticle &track) const
 run the extrapolation - only available in full athena More...
 
bool extrapolateAndDecorateTrackParticle (const xAOD::TrackParticle *particle, float &eta, float &phi) const
 
const xAOD::TrackParticlegetPreferredTrackParticle (const xAOD::IParticle *probe) const
 

Private Attributes

double m_endcapPivotPlaneZ
 
double m_endcapPivotPlaneMinimumRadius
 
double m_endcapPivotPlaneMaximumRadius
 
double m_barrelPivotPlaneRadius
 
double m_barrelPivotPlaneHalfLength
 
std::string m_muonContainerName
 

Detailed Description

Definition at line 20 of file MuonExtrapolationTool.h.

Constructor & Destructor Documentation

◆ MuonExtrapolationTool()

DerivationFramework::MuonExtrapolationTool::MuonExtrapolationTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 16 of file MuonExtrapolationTool.cxx.

17  :
18  base_class(t, n, p),
19  m_extrapolator("Trk::Extrapolator/AtlasExtrapolator")
20 {
21  declareProperty("EndcapPivotPlaneZ", m_endcapPivotPlaneZ = 15525.);// z position of pivot plane in endcap region
22  declareProperty("EndcapPivotPlaneMinimumRadius", m_endcapPivotPlaneMinimumRadius = 0.);// minimum radius of pivot plane in endcap region
23  declareProperty("EndcapPivotPlaneMaximumRadius", m_endcapPivotPlaneMaximumRadius = 11977.); // maximum radius of pivot plane in endcap region
24  declareProperty("BarrelPivotPlaneRadius", m_barrelPivotPlaneRadius = 8000.);// radius of pivot plane in barrel region
25  declareProperty("BarrelPivotPlaneHalfLength", m_barrelPivotPlaneHalfLength = 9700.);// half length of pivot plane in barrel region
26  declareProperty("Extrapolator", m_extrapolator);
27  declareProperty("MuonCollection", m_muonContainerName = "Muons");
28 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::MuonExtrapolationTool::addBranches ( ) const
virtual

Definition at line 95 of file MuonExtrapolationTool.cxx.

96 {
97  const xAOD::MuonContainer* muons = NULL;
98  CHECK(evtStore()->retrieve(muons, m_muonContainerName));
99  for(auto muon : *muons){
101  float eta, phi = 0;
103  if( muon->pt() > 3500.){
104  //only complain if the muon has sufficient pT to actually reach the pivot plane
105  //extrapolation will often fail for muons with pT < 3500 MeV
106  ATH_MSG_WARNING("Failed to extrapolate+decorate muon with pivot plane coords - Muon params: pt "<<muon->pt()<<", eta "<< muon->eta()<<", phi "<< muon->phi());
107  }
108  }
109  }
110  return StatusCode::SUCCESS;
111 }

◆ extrapolateAndDecorateTrackParticle()

bool DerivationFramework::MuonExtrapolationTool::extrapolateAndDecorateTrackParticle ( const xAOD::TrackParticle particle,
float &  eta,
float &  phi 
) const
private

Definition at line 42 of file MuonExtrapolationTool.cxx.

43 {
44 
45  // decorators used to access or store the information
46  static const SG::AuxElement::Decorator< char > Decorated ("DecoratedPivotEtaPhi");
47  static const SG::AuxElement::Decorator< float > Eta ("EtaTriggerPivot");
48  static const SG::AuxElement::Decorator< float > Phi ("PhiTriggerPivot");
49 
50  if (! Decorated.isAvailable(*particle) || !Decorated(*particle)){
51  // in the athena release, we can run the extrapolation if needed
53  if(!pTag) {
54  Decorated(*particle) = false;
55  return false;
56  }
57  Eta(*particle) = pTag->position().eta();
58  Phi(*particle) = pTag->position().phi();
59  Decorated(*particle) = true;
60  delete pTag;
61  }
62  // if we get here, the decoration was either already present or just added by us
63  // so we can finally read the values
64  eta = Eta(*particle);
65  phi = Phi(*particle);
66  return true;
67 }

◆ extrapolateToTriggerPivotPlane()

const Trk::TrackParameters * DerivationFramework::MuonExtrapolationTool::extrapolateToTriggerPivotPlane ( const xAOD::TrackParticle track) const
private

run the extrapolation - only available in full athena

Definition at line 113 of file MuonExtrapolationTool.cxx.

114 {
115  // BARREL
116  const EventContext& ctx = Gaudi::Hive::currentContext();
117  const Trk::Perigee& perigee = track.perigeeParameters();
118 
119  // create the barrel as a cylinder surface centered at 0,0,0
120  Amg::Vector3D barrelCentre(0., 0., 0.);
121  Amg::Transform3D matrix = Amg::Transform3D(Amg::RotationMatrix3D::Identity(), barrelCentre);
122 
123  Trk::CylinderSurface* cylinder =
127  if (!cylinder) {
128  ATH_MSG_WARNING("extrapolateToTriggerPivotPlane :: new Trk::CylinderSurface failed.");
129  return 0;
130  }
131  // and then attempt to extrapolate our track to this surface, checking for the boundaries of the barrel
132  bool boundaryCheck = true;
133  const Trk::Surface* surface = cylinder;
134  const Trk::TrackParameters* p = m_extrapolator->extrapolate(
135  ctx, perigee, *surface, Trk::alongMomentum, boundaryCheck, Trk::muon).release();
136  delete cylinder;
137  // if the extrapolation worked out (so we are in the barrel) we are done and can return the
138  // track parameters at this surface.
139  if (p) return p;
140 
141  // if we get here, the muon did not cross the barrel surface
142  // so we assume it is going into the endcap.
143  // ENDCAP
144 
145  // After 2 years of using this code, we realised that ATLAS actually has endcaps on both sides ;-)
146  // So better make sure we place our endcap at the correct side of the detector!
147  // Hopefully no-one will ever read this comment...
148  float SignOfEta = track.eta() > 0 ? 1. : -1.;
149 
150  Amg::Vector3D endcapCentre(0., 0., m_endcapPivotPlaneZ);
151  // much better!
152  matrix = Amg::Transform3D(Amg::RotationMatrix3D::Identity(), SignOfEta * endcapCentre);
153 
154  Trk::DiscSurface* disc =
158  if (!disc) {
159  ATH_MSG_WARNING("extrapolateToTriggerPivotPlane :: new Trk::DiscSurface failed.");
160  return 0;
161  }
162 
163  // for the endcap, we turn off the boundary check, extending the EC infinitely to catch stuff heading for the transition region
164  boundaryCheck = false;
165  surface = disc;
166  p = m_extrapolator->extrapolate(
167  ctx, perigee, *surface, Trk::alongMomentum, boundaryCheck, Trk::muon).release();
168  delete disc;
169  return p;
170 }

◆ getPreferredTrackParticle()

const xAOD::TrackParticle * DerivationFramework::MuonExtrapolationTool::getPreferredTrackParticle ( const xAOD::IParticle probe) const
private

Definition at line 71 of file MuonExtrapolationTool.cxx.

72 {
73  if (dynamic_cast<const xAOD::TruthParticle*>(muon)){
74  ATH_MSG_WARNING("Pivot plane extrapolation not supported for Truth muons!");
75  return 0;
76  }
77  const xAOD::TrackParticle* muonTrack = dynamic_cast<const xAOD::TrackParticle*>(muon);
78  if(!muonTrack && dynamic_cast<const xAOD::Muon*>(muon)) {
79  const xAOD::Muon* theMuon = dynamic_cast<const xAOD::Muon*>(muon);
80  muonTrack = theMuon->trackParticle( xAOD::Muon::MuonSpectrometerTrackParticle );
81  if(!muonTrack) {
82  muonTrack = theMuon->primaryTrackParticle();
83  if(!muonTrack) {
84  muonTrack = theMuon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
85  }
86  }
87  }
88  if(!muonTrack){
89  ATH_MSG_WARNING("no valid track found for extrapolating the muon to the pivot plane!");
90  }
91  return muonTrack;
92 
93 }

◆ initialize()

StatusCode DerivationFramework::MuonExtrapolationTool::initialize ( )
virtual

Definition at line 33 of file MuonExtrapolationTool.cxx.

34 {
35  ATH_CHECK(m_extrapolator.retrieve());
36  return StatusCode::SUCCESS;
37 }

Member Data Documentation

◆ m_barrelPivotPlaneHalfLength

double DerivationFramework::MuonExtrapolationTool::m_barrelPivotPlaneHalfLength
private

Definition at line 53 of file MuonExtrapolationTool.h.

◆ m_barrelPivotPlaneRadius

double DerivationFramework::MuonExtrapolationTool::m_barrelPivotPlaneRadius
private

Definition at line 52 of file MuonExtrapolationTool.h.

◆ m_endcapPivotPlaneMaximumRadius

double DerivationFramework::MuonExtrapolationTool::m_endcapPivotPlaneMaximumRadius
private

Definition at line 51 of file MuonExtrapolationTool.h.

◆ m_endcapPivotPlaneMinimumRadius

double DerivationFramework::MuonExtrapolationTool::m_endcapPivotPlaneMinimumRadius
private

Definition at line 50 of file MuonExtrapolationTool.h.

◆ m_endcapPivotPlaneZ

double DerivationFramework::MuonExtrapolationTool::m_endcapPivotPlaneZ
private

Definition at line 49 of file MuonExtrapolationTool.h.

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> DerivationFramework::MuonExtrapolationTool::m_extrapolator

Definition at line 28 of file MuonExtrapolationTool.h.

◆ m_muonContainerName

std::string DerivationFramework::MuonExtrapolationTool::m_muonContainerName
private

Definition at line 54 of file MuonExtrapolationTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:196
DerivationFramework::MuonExtrapolationTool::m_barrelPivotPlaneRadius
double m_barrelPivotPlaneRadius
Definition: MuonExtrapolationTool.h:52
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
DerivationFramework::MuonExtrapolationTool::m_endcapPivotPlaneMinimumRadius
double m_endcapPivotPlaneMinimumRadius
Definition: MuonExtrapolationTool.h:50
xAOD::Muon_v1::trackParticle
const TrackParticle * trackParticle(TrackParticleType type) const
Returns a pointer (which can be NULL) to the TrackParticle used in identification of this muon.
Definition: Muon_v1.cxx:486
DerivationFramework::MuonExtrapolationTool::extrapolateAndDecorateTrackParticle
bool extrapolateAndDecorateTrackParticle(const xAOD::TrackParticle *particle, float &eta, float &phi) const
Definition: MuonExtrapolationTool.cxx:42
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
DerivationFramework::MuonExtrapolationTool::m_barrelPivotPlaneHalfLength
double m_barrelPivotPlaneHalfLength
Definition: MuonExtrapolationTool.h:53
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
DerivationFramework::MuonExtrapolationTool::m_endcapPivotPlaneZ
double m_endcapPivotPlaneZ
Definition: MuonExtrapolationTool.h:49
Trk::alongMomentum
@ alongMomentum
Definition: PropDirection.h:20
Phi
@ Phi
Definition: RPCdef.h:8
Trk::DiscSurface
Definition: DiscSurface.h:54
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DerivationFramework::MuonExtrapolationTool::m_endcapPivotPlaneMaximumRadius
double m_endcapPivotPlaneMaximumRadius
Definition: MuonExtrapolationTool.h:51
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
beamspotman.n
n
Definition: beamspotman.py:731
Trk::CylinderSurface
Definition: CylinderSurface.h:55
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
Trk::ParametersBase
Definition: ParametersBase.h:55
jobOptions.pTag
string pTag
Definition: jobOptions.py:28
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DerivationFramework::MuonExtrapolationTool::extrapolateToTriggerPivotPlane
const Trk::TrackParameters * extrapolateToTriggerPivotPlane(const xAOD::TrackParticle &track) const
run the extrapolation - only available in full athena
Definition: MuonExtrapolationTool.cxx:113
DerivationFramework::MuonExtrapolationTool::getPreferredTrackParticle
const xAOD::TrackParticle * getPreferredTrackParticle(const xAOD::IParticle *probe) const
Definition: MuonExtrapolationTool.cxx:71
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DerivationFramework::MuonExtrapolationTool::m_muonContainerName
std::string m_muonContainerName
Definition: MuonExtrapolationTool.h:54
xAOD::Muon_v1::primaryTrackParticle
const TrackParticle * primaryTrackParticle() const
Returns a pointer (which should not usually be NULL, but might be if the muon has been stripped of in...
Definition: Muon_v1.cxx:400
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
DerivationFramework::MuonExtrapolationTool::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
Definition: MuonExtrapolationTool.h:28
Eta
@ Eta
Definition: RPCdef.h:8