ATLAS Offline Software
TRT_DriftCircleOnTrackTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // Implementation file for class TRT_DriftCircleOnTrackTool
8 // (c) ATLAS Detector software
10 // AlgTool used for TRT_DriftCircleOnTrack object production
12 // Version 1.0 21/04/2004 I.Gavrilenko
14 
19 
20 
22 // Constructor
24 
26 (const std::string& ty,const std::string& na,const IInterface* pa)
27  : AthAlgTool(ty,na,pa)
28 {
29  declareInterface<IRIO_OnTrackCreator>(this);
30 }
31 
33 // Destructor
35 
37 
39 // Initialisation
41 
43 {
45 
46  // get the error scaling tool
49  if (m_lumiDataKey.key().empty()) {
50  ATH_MSG_DEBUG("Luminosity conditions data key not set. No mu correction." );
51  }
52  return sc;
53 }
54 
56 // Finalize
58 
60 {
61  StatusCode sc = AlgTool::finalize(); return sc;
62 }
63 
65 // Trk::TRT_DriftCircleOnTrack production
67 
69 (const Trk::PrepRawData& rio,const Trk::TrackParameters& TP,const EventContext& ctx) const
70 {
71  const InDet::TRT_DriftCircle* DC = dynamic_cast<const InDet::TRT_DriftCircle*>(&rio);
72  if(!DC) return nullptr;
73 
74  // Straw identification
75  //
76  const InDetDD::TRT_BaseElement* pE = DC->detectorElement(); if(!pE) return nullptr;
77 
78  // Identifier iD = DC->identify();
79  // IdentifierHash iH = trt_id->straw_layer_hash(trt_id->layer_id(iD));
80  IdentifierHash iH = pE->identifyHash();
81 
82 
83  // Global direction of the track parameters
84  //
85  const AmgVector(5)& P = TP.parameters();
86  double se = sin(P[3]);
87  Amg::Vector3D dir(cos(P[2])*se,sin(P[2])*se,cos(P[3]));
88 
89  double predictedLocZ=P[1];
90 
91  double sign = (TP.parameters()[0] < 0.) ? -1. : 1.;
92 
93 
94  //only create objects within the active area
95  if(predictedLocZ>pE->strawLength()/2.){
96  predictedLocZ=pE->strawLength()/2.;
97  }else if(predictedLocZ<-pE->strawLength()/2.){
98  predictedLocZ=-pE->strawLength()/2.;
99  }
100 
101 
102 
103  // TRT_DriftCircleOnTrack production
104  //
106  if (!m_trtErrorScalingKey.key().empty()) {
107  double mu=0.;
108  if (!m_lumiDataKey.empty()) {
110  mu = lumiData->lbAverageInteractionsPerCrossing();
111  }
112 
113  bool endcap = false;
114  if(dynamic_cast<const InDetDD::TRT_EndcapElement*>(pE)) endcap = true;
116  cov = Trk::ErrorScalingCast<TRTRIO_OnTrackErrorScaling>(*error_scaling)
117  ->getScaledCovariance(std::move(cov), endcap, mu);
118  }
119 
120  if(!m_useErrorCorrection || DC->localPosition().x() > .30) {
123  return new InDet::TRT_DriftCircleOnTrack(DC, std::move(lp), std::move(cov),
124  iH, predictedLocZ, dir,
125  Trk::DECIDED);
126  }
127 
128  cov(0,0) = DC->localPosition().x()*DC->localPosition().x() +.09;
129 
132 
134  DC, std::move(lp), std::move(cov), iH, predictedLocZ, dir, Trk::DECIDED);
135 }
136 
Trk::LocalParameters
Definition: LocalParameters.h:98
TRT_DriftCircleOnTrackTool.h
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
InDetDD::TRT_BaseElement::strawLength
virtual const double & strawLength() const =0
Active straw length.
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Trk::locX
@ locX
Definition: ParamDefs.h:37
InDet::TRT_DriftCircleOnTrackTool::TRT_DriftCircleOnTrackTool
TRT_DriftCircleOnTrackTool(const std::string &, const std::string &, const IInterface *)
Definition: TRT_DriftCircleOnTrackTool.cxx:26
DMTest::P
P_v1 P
Definition: P.h:23
initialize
void initialize()
Definition: run_EoverP.cxx:894
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
InDet::TRT_DriftCircle::detectorElement
virtual const InDetDD::TRT_BaseElement * detectorElement() const override final
return the detector element corresponding to this PRD
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
InDetDD::TRT_EndcapElement
Definition: TRT_EndcapElement.h:44
InDet::TRT_DriftCircleOnTrackTool::m_useErrorCorrection
BooleanProperty m_useErrorCorrection
Definition: TRT_DriftCircleOnTrackTool.h:68
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
keylayer_zslicemap.se
se
Definition: keylayer_zslicemap.py:194
InDet::TRT_DriftCircleOnTrack
Definition: TRT_DriftCircleOnTrack.h:53
InDet::TRT_DriftCircleOnTrackTool::correct
virtual InDet::TRT_DriftCircleOnTrack * correct(const Trk::PrepRawData &, const Trk::TrackParameters &, const EventContext &ctx=Gaudi::Hive::currentContext()) const override
abstract base method for the creation of RIO_OnTrack it takes a RIO (PrepRawData) and the given Track...
Definition: TRT_DriftCircleOnTrackTool.cxx:69
InDet::TRT_DriftCircle
Definition: TRT_DriftCircle.h:32
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Trk::DefinedParameter
std::pair< double, ParamDefs > DefinedParameter
Definition: DefinedParameter.h:27
TRT_EndcapElement.h
InDet::TRT_DriftCircleOnTrackTool::m_lumiDataKey
SG::ReadCondHandleKey< LuminosityCondData > m_lumiDataKey
Definition: TRT_DriftCircleOnTrackTool.h:62
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::ParametersBase
Definition: ParametersBase.h:55
InDetDD::TRT_BaseElement::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::DECIDED
@ DECIDED
sign of drift radius has been determined
Definition: DriftCircleStatus.h:18
Trk::PrepRawData
Definition: PrepRawData.h:62
InDet::TRT_DriftCircleOnTrackTool::m_trtErrorScalingKey
SG::ReadCondHandleKey< RIO_OnTrackErrorScaling > m_trtErrorScalingKey
Definition: TRT_DriftCircleOnTrackTool.h:65
LuminosityCondData::lbAverageInteractionsPerCrossing
float lbAverageInteractionsPerCrossing() const
Definition: LuminosityCondData.cxx:26
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
InDet::TRT_DriftCircleOnTrackTool::~TRT_DriftCircleOnTrackTool
virtual ~TRT_DriftCircleOnTrackTool()
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
LocalParameters.h
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
InDet::TRT_DriftCircleOnTrackTool::initialize
virtual StatusCode initialize() override
Definition: TRT_DriftCircleOnTrackTool.cxx:42
ErrorScalingCast.h
InDet::TRT_DriftCircleOnTrackTool::finalize
virtual StatusCode finalize() override
Definition: TRT_DriftCircleOnTrackTool.cxx:59
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
AthAlgTool
Definition: AthAlgTool.h:26
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
InDetDD::TRT_BaseElement
Definition: TRT_BaseElement.h:57