ATLAS Offline Software
FillAlignTrkInfo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 
7 
8 ********************************************************************/
9 
10 //#include "GaudiKernel/MsgStream.h"
11 #include "FillAlignTrkInfo.h"
13 #include "TrkTrack/Track.h"
18 #include "GaudiKernel/TypeNameString.h"
19 
20 #include <map>
21 
22 FillAlignTrkInfo::FillAlignTrkInfo(const std::string& type, const std::string& name, const IInterface* parent) :
24  {}
25 
27 {
28  msg(MSG::INFO) << "initialize()" << endmsg;
29  if (m_TrackSummaryTool.retrieve().isFailure()) {
30  msg(MSG::FATAL) << "Cannot get TrackSummaryTool" << endmsg;
31  return StatusCode::FAILURE;
32  }
33  msg(MSG::INFO) << "finished initialize()" << endmsg;
34  return StatusCode::SUCCESS ;
35 }
36 
37 
38 bool FillAlignTrkInfo::fill(const Trk::Track* aTrack, TRT::TrackInfo* output, const xAOD::EventInfo& /* eventInfo */,
39  const xAOD::VertexContainer& /* vertices */) {
40 
41  // track parameters
42  const Trk::Perigee* mesp=(aTrack->perigeeParameters());
43  if (mesp!=nullptr) {
44  (*output)[TRT::Track::d0]=mesp->parameters()[Trk::d0];
45  (*output)[TRT::Track::z0]=mesp->parameters()[Trk::z0];
46  (*output)[TRT::Track::phi]=mesp->parameters()[Trk::phi];
47  // transform back to cot(theta), q/pt representation for alignment ntuple
48  float theta = mesp->parameters()[Trk::theta];
49  if(fabs(theta)==0) theta=1e-24;
50  (*output)[TRT::Track::cotTheta]=1/tan(theta);
51  (*output)[TRT::Track::qOverPT]=(mesp->parameters()[Trk::qOverP])/sin(theta);
52  (*output)[TRT::Track::t0] = 0.0 ;
53  } else {
54  msg(MSG::FATAL) << " Could not get Trk::Perigee " << endmsg;
55  (*output)[TRT::Track::d0]=0.0;
56  (*output)[TRT::Track::z0]=0.0;
57  (*output)[TRT::Track::phi]=0.0;
58  (*output)[TRT::Track::cotTheta]=0.0;
59  (*output)[TRT::Track::qOverPT]=0.0;
60  (*output)[TRT::Track::t0] = 0.0 ;
61  }
62  (*output)[TRT::Track::chiSquare]=aTrack->fitQuality()->chiSquared();
63  (*output)[TRT::Track::degreesOfFreedom]=aTrack->fitQuality()->numberDoF();
64 
65  // implicit memory allocation in createSummary, need to clean up later
66  std::unique_ptr<Trk::TrackSummary> summary = m_TrackSummaryTool->summary(Gaudi::Hive::currentContext(), *aTrack);
70 
71 
72  // All ok
73  if (msgLvl(MSG::DEBUG)) msg() << "Track info filled .... " << endmsg;
74  return true;
75 }
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ITrackSummaryTool.h
Trk::Track::fitQuality
const FitQuality * fitQuality() const
return a pointer to the fit quality const-overload
TrackParameters.h
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
TRT::Track::chiSquare
@ chiSquare
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:67
TRT::Track::numberOfSCTHits
@ numberOfSCTHits
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:77
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
TRT::Track::phi
@ phi
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:64
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
Trk::z0
@ z0
Definition: ParamDefs.h:64
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
TRT::Track::qOverPT
@ qOverPT
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:66
TRT::TrackInfo
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:83
Track.h
FillAlignTrkInfo.h
TrackInfo.h
Trk::theta
@ theta
Definition: ParamDefs.h:66
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::numberOfSCTHits
@ numberOfSCTHits
number of SCT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:71
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
test_pyathena.parent
parent
Definition: test_pyathena.py:15
FillAlignTrkInfo::FillAlignTrkInfo
FillAlignTrkInfo(const std::string &type, const std::string &name, const IInterface *parent)
Definition: FillAlignTrkInfo.cxx:22
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
TrackSummary.h
FillAlignTrkInfo::fill
virtual bool fill(const Trk::Track *aTrack, TRT::TrackInfo *output, const xAOD::EventInfo &eventInfo, const xAOD::VertexContainer &vertices)
Definition: FillAlignTrkInfo.cxx:38
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
merge.output
output
Definition: merge.py:17
Trk::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
Trk::numberOfTRTHits
@ numberOfTRTHits
number of TRT outliers
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:79
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trk::d0
@ d0
Definition: ParamDefs.h:63
TRT::Track::degreesOfFreedom
@ degreesOfFreedom
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:79
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
TRT::Track::numberOfTRTHits
@ numberOfTRTHits
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:78
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
TRT::Track::numberOfPixelHits
@ numberOfPixelHits
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:76
TRT::Track::cotTheta
@ cotTheta
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:65
FillAlignTrkInfo::initialize
virtual StatusCode initialize()
Definition: FillAlignTrkInfo.cxx:26
Trk::FitQuality::chiSquared
double chiSquared() const
returns the of the overall track fit
Definition: FitQuality.h:56
Trk::phi
@ phi
Definition: ParamDefs.h:75
Trk::FitQuality::numberDoF
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition: FitQuality.h:60
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
AthAlgTool
Definition: AthAlgTool.h:26
FitQuality.h
TRT::Track::t0
@ t0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:68
FillAlignTrkInfo::m_TrackSummaryTool
ToolHandle< Trk::ITrackSummaryTool > m_TrackSummaryTool
Definition: FillAlignTrkInfo.h:50
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65