ATLAS Offline Software
Loading...
Searching...
No Matches
FakeTrackBuilder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "FakeTrackBuilder.h"
6#include <iostream>
7
9
10// include Tracking EDM
11#include "TrkTrack/Track.h"
16
17// include MaterialEffects classes
23
24//VertexOnTrack
26
27// include InDet EDM
33
37
40
42#include <memory>
43
44
46 using namespace Trk;
47 using namespace InDet;
48 //unsigned int counter=0;
49 //std::cout<<counter++<<std::endl;
50 auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
51 PerigeeSurface periSurf;
52 auto trackParameter = std::make_unique<Perigee>(4.0, 3.0, 2.0, 1.0, 0.001, periSurf);
53 //parameters to TrackStateOnSurface are unique_ptr to: RIO_OnTrack, TrackParameters, MaterialEffectsBase
54 trackStateOnSurfaces->push_back( new TrackStateOnSurface(nullptr, std::move(trackParameter), nullptr) );
55
56 //std::cout<<counter++<<std::endl;
57
58 // test state #1 - arbitrary TP AtaCylinder
59 Trk::CylinderSurface surface(1.0, 2*M_PI, 4.0);
60 auto trackParameter2=surface.createUniqueParameters<5,Trk::Charged>(0.0,1.0,3.0,4.0,0.5,std::nullopt);
61 trackStateOnSurfaces->push_back( new TrackStateOnSurface(nullptr, std::move(trackParameter2), nullptr) );
62
63 // test state #2 - arbitrary TP AtaDisc
64 Amg::Translation3D amgtranslation(1.,2.,3.);
65 Amg::Transform3D amgTransf = Amg::Transform3D(amgtranslation);
66 DiscSurface discSf(amgTransf, 1.0, 2.0);
67 auto trackParameter3 = discSf.createUniqueParameters<5,Trk::Charged>(0.0,1.0,3.0,4.0,0.5,std::nullopt);
68 trackStateOnSurfaces->push_back( new TrackStateOnSurface(nullptr, std::move(trackParameter3), nullptr) );
69
70 // test state #3 - arbitrary AtaPlane + Estimated Brem
71 Amg::Transform3D amgTransf2(amgtranslation);
72 PlaneSurface planeSf(amgTransf2, 1.0, 2.0);
73 auto trackParameter4 = planeSf.createUniqueParameters<5,Trk::Charged>(0.0,1.0,3.0,4.0,0.5,std::nullopt);
74 auto ebr = std::make_unique<EstimatedBremOnTrack>((0.7), -0.3,0.3, 0.03,planeSf);
75 std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type1(0);
77 trackStateOnSurfaces->push_back( new TrackStateOnSurface(nullptr, std::move(trackParameter4), std::move(ebr),type1) );
78
79 if (elements){
80 // test state #4 - AtaPlane at a valid detector element + MatEffects
81 IdentifierHash idHash(0); // should be first pixel
82 const InDetDD::SiDetectorElement * detEl = elements->getDetectorElement( idHash);
83
84 // MaterialEffects
85 auto eloss = std::make_unique<Trk::EnergyLoss>((0.5),0.19);
86 auto scatt = Trk::ScatteringAngles(.1,.2,.3,.4);
87 std::bitset<Trk::MaterialEffectsBase::NumberOfMaterialEffectsTypes> mefPattern(0);
91 //std::cout<<counter++<<std::endl;
92
93 //AtaPlane on det el
94 const PlaneSurface& planeDetElSf = dynamic_cast<const PlaneSurface&>(detEl->surface());
95 auto trackParameter5 = planeDetElSf.createUniqueParameters<5,Trk::Charged>(0.0,1.0,3.0,4.0,0.5,std::nullopt);
96
97 auto mefBase = std::make_unique<Trk::MaterialEffectsOnTrack>(70.7,scatt,std::move(eloss),planeDetElSf, mefPattern);
98 std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
100 trackStateOnSurfaces->push_back( new TrackStateOnSurface(nullptr, std::move(trackParameter5), std::move(mefBase), typePattern) );
101 }
102 //Curvi
103 Amg::Vector3D pos(1.0,2.0,3.0);
104 Amg::Vector3D mom(4.0,5.0,6.0);
105
106 auto trackParameter6 = std::make_unique<CurvilinearParameters>(pos,mom,1.0);
107 std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
109 trackStateOnSurfaces->push_back( new TrackStateOnSurface(nullptr, std::move(trackParameter6), nullptr, typePattern) );
110
111 AmgSymMatrix(2) locCov;
112 locCov.setIdentity(); // sets it to identity
113 locCov(0,0) = 0.001; locCov(1,1)=0.002;
114
115 if (elements) {
116 const InDetDD::SiDetectorElement * detEl = *(elements->begin());
117 if (!detEl)
118 std::cerr<<"Unable to find any pixel Detector element!! Aborting this part of the test."<<std::endl;
119 else {
121 = new InDet::PixelClusterOnTrack(); // make PRD-less ROT
122 fakePix1->m_detEl = detEl;
123 fakePix1->m_identifier = detEl->identify();
124 Amg::Vector2D locpos( 5.559011, 22.613205);
125 //2 Trk::LocalPosition locpos = Trk::LocalPosition( 7.315356, 21.303871);
126 fakePix1->m_localParams = Trk::LocalParameters(locpos);
127 fakePix1->m_localCovariance = locCov;
128 unsigned int pix2 = 2832020859UL; // CLHEP::bar l1 mod(6,0) index(309,122)
129 Identifier idPix2(pix2);
132 fakePix2->m_detEl = detEl;
133 fakePix2->m_identifier = idPix2;
134 locpos = Amg::Vector2D( 7.315356, 21.303871);
135 fakePix2->m_localParams = Trk::LocalParameters(locpos);
136 locCov(0,0) = 0.001; locCov(1,1)=0.0135;
137 fakePix2->m_localCovariance = locCov;
138 auto childrots = std::vector<const InDet::PixelClusterOnTrack*>();
139 childrots.push_back(fakePix1);
140 childrots.push_back(fakePix2);
141 auto assgnProb = std::vector<double>();
142 assgnProb.push_back(0.4);
143 assgnProb.push_back(0.6);
144 auto cProt = std::make_unique<InDet::CompetingPixelClustersOnTrack>(
145 std::move(childrots), std::move(assgnProb));
146 trackStateOnSurfaces->push_back(
147 new TrackStateOnSurface(std::move(cProt), nullptr, nullptr));
148 }
149 }
150
151 //create Track and add to collection
152 auto fitQuality = std::make_unique<FitQuality>(1.0, 2);
153
155 //std::cout<<counter++<<std::endl;
156 return new Trk::Track(info, std::move(trackStateOnSurfaces), std::move(fitQuality));
157}
158
162
#define M_PI
#define AmgSymMatrix(dim)
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
This is an Identifier helper class for the TRT subdetector.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
static Trk::Track * buildTrack(const InDetDD::SiDetectorElementCollection *elements)
static Trk::Track * buildBrokenTrack(const InDetDD::SiDetectorElementCollection *elements)
static Rec::TrackParticle * buildTrackParticle(const InDetDD::SiDetectorElementCollection *elements)
This is a "hash" representation of an Identifier.
Class to hold the SiDetectorElement objects to be put in the detector store.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Class to hold geometrical description of a silicon detector element.
virtual Identifier identify() const override final
identifier of this detector element (inline)
Trk::Surface & surface()
Element Surface.
Specific class to represent the pixel measurements.
const InDetDD::SiDetectorElement * m_detEl
corresponding detector element
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
std::unique_ptr< ParametersT< DIM, T, PlaneSurface > > createUniqueParameters(double l1, double l2, double phi, double theta, double qop, std::optional< AmgSymMatrix(DIM)> cov=std::nullopt) const
Use the Surface as a ParametersBase constructor, from local parameters.
Simple helper class for defining track parameters for charged particles.
Definition Charged.h:27
Class for a CylinderSurface in the ATLAS detector.
std::unique_ptr< ParametersT< DIM, T, CylinderSurface > > createUniqueParameters(double l1, double l2, double phi, double theta, double qop, std::optional< AmgSymMatrix(DIM)> cov=std::nullopt) const
Use the Surface as a ParametersBase constructor, from local parameters.
Class for a DiscSurface in the ATLAS detector.
Definition DiscSurface.h:54
std::unique_ptr< ParametersT< DIM, T, DiscSurface > > createUniqueParameters(double l1, double l2, double phi, double theta, double qop, std::optional< AmgSymMatrix(DIM)> cov=std::nullopt) const
Use the Surface as a ParametersBase constructor, from local parameters.
@ ScatteringEffects
contains material effects due to multiple scattering
@ FittedMaterialEffects
contains values obtained by fitting the scatterer or e-loss
@ EnergyLossEffects
contains energy loss corrections
LocalParameters m_localParams
Amg::MatrixX m_localCovariance
Class describing the Line to which the Perigee refers to.
Identifier m_identifier
Identifier of the RIO_OnTrack (comes from the associated Trk::PrepRawData)
represents a deflection of the track caused through multiple scattering in material.
Contains information about the 'fitter' of this track.
represents the track state (measurement, material, fit parameters and quality) at a surface.
@ BremPoint
This represents a brem point on the track, and so will contain TrackParameters and MaterialEffectsBas...
@ Parameter
This TSOS contains a Trk::ParameterBase.
@ Scatterer
This represents a scattering point on the track, and so will contain TrackParameters and MaterialEffe...
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
Primary Vertex Finder.
Ensure that the ATLAS eigen extensions are properly loaded.