ATLAS Offline Software
Loading...
Searching...
No Matches
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
22FillAlignTrkInfo::FillAlignTrkInfo(const std::string& type, const std::string& name, const IInterface* parent) :
23 AthAlgTool(type, name, 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
38bool 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();
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);
68 (*output)[TRT::Track::numberOfSCTHits]=summary->get(Trk::numberOfSCTHits) ;
69 (*output)[TRT::Track::numberOfTRTHits]=summary->get(Trk::numberOfTRTHits) ;
70
71
72 // All ok
73 if (msgLvl(MSG::DEBUG)) msg() << "Track info filled .... " << endmsg;
74 return true;
75}
Scalar theta() const
theta method
#define endmsg
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
ToolHandle< Trk::ITrackSummaryTool > m_TrackSummaryTool
virtual StatusCode initialize()
virtual bool fill(const Trk::Track *aTrack, TRT::TrackInfo *output, const xAOD::EventInfo &eventInfo, const xAOD::VertexContainer &vertices)
FillAlignTrkInfo(const std::string &type, const std::string &name, const IInterface *parent)
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition FitQuality.h:60
double chiSquared() const
returns the of the overall track fit
Definition FitQuality.h:56
const Perigee * perigeeParameters() const
return Perigee.
const FitQuality * fitQuality() const
return a pointer to the fit quality const-overload
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ phi
Definition ParamDefs.h:75
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
@ numberOfPixelHits
number of pixel layers on track with absence of hits
EventInfo_v1 EventInfo
Definition of the latest event info version.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".