ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsTrackReconstruction
src
RandomProtoTrackCreatorTool.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
#include "
src/RandomProtoTrackCreatorTool.h
"
6
#include "
TrkEventPrimitives/ParticleHypothesis.h
"
7
#include "Acts/Surfaces/PerigeeSurface.hpp"
8
9
10
ActsTrk::RandomProtoTrackCreatorTool::RandomProtoTrackCreatorTool
(
const
std::string&
type
,
11
const
std::string& name,
12
const
IInterface* parent)
13
: base_class(
type
,name,parent)
14
{}
15
16
StatusCode
ActsTrk::RandomProtoTrackCreatorTool::findProtoTracks
(
const
EventContext& ctx,
17
const
xAOD::PixelClusterContainer
& pixelContainer,
18
const
xAOD::StripClusterContainer
& stripContainer,
19
std::vector<ActsTrk::ProtoTrack> & foundProtoTracks )
const
{
20
// Sample N random hits for example
21
ATH_MSG_VERBOSE
(
"Generate a random proto track in "
<<ctx.eventID()<<
" from "
<<pixelContainer.size()<<
" pixel measurements "
22
<<
", "
<<stripContainer.size()<<
" strip measurements"
);
23
std::vector<const xAOD::UncalibratedMeasurement*> dummyPoints;
24
size_t
nPix = 1;
25
size_t
nStrip = 7;
26
for
(
size_t
k = 0; k < nPix; ++k){
27
//we don't worry about the quality of randomness for this purpose
28
//coverity[DC.WEAK_CRYPTO)]
29
auto
index
= rand() % pixelContainer.size();
30
dummyPoints.push_back(pixelContainer.at(
index
));
31
}
32
33
34
for
(
size_t
k = 0; k < nStrip; ++k){
35
//coverity[DC.WEAK_CRYPTO)]
36
auto
index
= rand() % stripContainer.size();
37
dummyPoints.push_back(stripContainer.at(
index
));
38
}
39
40
ATH_MSG_DEBUG
(
"Made a proto-track with "
<<dummyPoints.size()<<
" random clusters"
);
41
42
43
// Make the intput perigee
44
auto
inputPerigee =
makeDummyParams
(dummyPoints[0]);
45
46
// and add to the list (will only make one prototrack per event for now)
47
foundProtoTracks.push_back({std::move(dummyPoints),std::move(inputPerigee)});
48
49
return
StatusCode::SUCCESS;
50
}
51
52
Amg::Vector3D
ActsTrk::RandomProtoTrackCreatorTool::getMeasurementPos
(
const
xAOD::UncalibratedMeasurement
* theMeas)
const
{
53
if
(theMeas->
type
() ==
xAOD::UncalibMeasType::PixelClusterType
) {
54
return
static_cast <
const
xAOD::PixelCluster
*
>
(theMeas)->globalPosition().cast<
double
>();
55
}
else
if
(theMeas->
type
() ==
xAOD::UncalibMeasType::StripClusterType
){
56
return
static_cast<
const
xAOD::StripCluster
*
>
(theMeas)->globalPosition().cast<
double
>();
57
}
58
return
Amg::Vector3D::Zero();
59
}
60
61
62
std::unique_ptr<Acts::BoundTrackParameters>
ActsTrk::RandomProtoTrackCreatorTool::makeDummyParams
(
const
xAOD::UncalibratedMeasurement
* measurement)
const
{
63
64
using namespace
Acts::UnitLiterals;
65
std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
66
Acts::Vector3::Zero());
67
Acts::BoundVector params{};
68
69
auto
globalPos =
getMeasurementPos
(measurement);
70
71
// No, this is not a physically correct parameter estimate!
72
// We just want a placeholder to point in roughly the expected direction...
73
// A real track finder would do something more reasonable here.
74
params << 0., 0.,
75
globalPos.phi(), globalPos.theta(),
76
1. / (1000000000. * 1_MeV), 0.;
77
78
79
// Covariance - let's be honest and say we have no clue ;-)
80
Acts::BoundMatrix cov = Acts::BoundMatrix::Identity();
81
cov *= 100000;
82
83
return
std::make_unique<Acts::BoundTrackParameters>(actsSurface, params,
84
cov, Acts::ParticleHypothesis::pion());
85
86
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x,...)
Definition
AthMsgStreamMacros.h:42
ParticleHypothesis.h
RandomProtoTrackCreatorTool.h
ActsTrk::RandomProtoTrackCreatorTool::findProtoTracks
virtual StatusCode findProtoTracks(const EventContext &ctx, const xAOD::PixelClusterContainer &pixelContainer, const xAOD::StripClusterContainer &stripContainer, std::vector< ActsTrk::ProtoTrack > &foundProtoTracks) const override final
EF-style pattern recognition to create prototracks.
Definition
RandomProtoTrackCreatorTool.cxx:16
ActsTrk::RandomProtoTrackCreatorTool::getMeasurementPos
Amg::Vector3D getMeasurementPos(const xAOD::UncalibratedMeasurement *theMeas) const
get the global position for an uncalibrated measurement - delegates to the specialisation
Definition
RandomProtoTrackCreatorTool.cxx:52
ActsTrk::RandomProtoTrackCreatorTool::makeDummyParams
std::unique_ptr< Acts::BoundTrackParameters > makeDummyParams(const xAOD::UncalibratedMeasurement *firstPRD) const
creates a random, dummy set of parameters Warning: This is not a real parameter estimate.
Definition
RandomProtoTrackCreatorTool.cxx:62
ActsTrk::RandomProtoTrackCreatorTool::RandomProtoTrackCreatorTool
RandomProtoTrackCreatorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
RandomProtoTrackCreatorTool.cxx:10
xAOD::UncalibratedMeasurement_v1::type
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:48
index
Definition
index.py:1
xAOD::PixelClusterContainer
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
Definition
Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/PixelClusterContainer.h:14
xAOD::StripCluster
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
Definition
StripCluster.h:13
xAOD::UncalibratedMeasurement
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
Definition
UncalibratedMeasurementFwd.h:13
xAOD::StripClusterContainer
StripClusterContainer_v1 StripClusterContainer
Define the version of the strip cluster container.
Definition
StripClusterContainer.h:14
xAOD::PixelCluster
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
Definition
Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/PixelCluster.h:13
xAOD::UncalibMeasType::StripClusterType
@ StripClusterType
Definition
MeasurementDefs.h:28
xAOD::UncalibMeasType::PixelClusterType
@ PixelClusterType
Definition
MeasurementDefs.h:27
type
Generated on
for ATLAS Offline Software by
1.17.0