ATLAS Offline Software
Loading...
Searching...
No Matches
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{
44 StatusCode sc = AlgTool::initialize();
45
46 // get the error scaling tool
47 ATH_CHECK(m_trtErrorScalingKey.initialize(!m_trtErrorScalingKey.key().empty()));
48 ATH_CHECK(m_lumiDataKey.initialize ( !m_lumiDataKey.key().empty() && !m_trtErrorScalingKey.key().empty()));
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));
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 //
105 Amg::MatrixX cov = DC->localCovariance();
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;
117 ->getScaledCovariance(std::move(cov), endcap, mu);
118 }
119
120 if(!m_useErrorCorrection || DC->localPosition().x() > .30) {
122 Trk::LocalParameters lp(radius);
123 return new InDet::TRT_DriftCircleOnTrack(DC, std::move(lp), std::move(cov),
124 iH, predictedLocZ, dir,
126 }
127
128 cov(0,0) = DC->localPosition().x()*DC->localPosition().x() +.09;
129
131 Trk::LocalParameters lp(radius);
132
134 DC, std::move(lp), std::move(cov), iH, predictedLocZ, dir, Trk::DECIDED);
135}
136
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
#define AmgVector(rows)
static Double_t P(Double_t *tt, Double_t *par)
static Double_t sc
int sign(int a)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
This is a "hash" representation of an Identifier.
Virtual base class of TRT readout elements.
virtual const double & strawLength() const =0
Active straw length.
virtual IdentifierHash identifyHash() const override final
identifier hash
Extended class of a TRT_BaseElement to describe a readout elment in the endcap.
TRT_DriftCircleOnTrackTool(const std::string &, const std::string &, const IInterface *)
SG::ReadCondHandleKey< RIO_OnTrackErrorScaling > m_trtErrorScalingKey
SG::ReadCondHandleKey< LuminosityCondData > m_lumiDataKey
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...
Represents 'corrected' measurements from the TRT (for example, corrected for wire sag).
virtual const InDetDD::TRT_BaseElement * detectorElement() const override final
return the detector element corresponding to this PRD
const Amg::Vector2D & localPosition() const
return the local position reference
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 3, 1 > Vector3D
@ DECIDED
sign of drift radius has been determined
@ locX
Definition ParamDefs.h:37
std::pair< double, ParamDefs > DefinedParameter
Typedef to of a std::pair<double, ParamDefs> to identify a passed-through double as a specific type o...
ParametersBase< TrackParametersDim, Charged > TrackParameters
const T_res * ErrorScalingCast(const T_src *src)