ATLAS Offline Software
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 
7 #include "Acts/Surfaces/PerigeeSurface.hpp"
8 
9 
11  const std::string& name,
12  const IInterface* parent)
13  : base_class(type,name,parent)
14 {}
15 
19  std::vector<ActsTrk::ProtoTrack> & foundProtoTracks ) const {
20  // Sample N random hits for example
21  std::vector<ActsTrk::ATLASUncalibSourceLink> dummyPoints;
22  size_t nPix = 1;
23  size_t nStrip = 7;
24  for (size_t k = 0; k < nPix; ++k){
25  auto index = rand() % pixelContainer.size();
26  dummyPoints.push_back(makeATLASUncalibSourceLink(&pixelContainer, index, ctx));
27  }
28 
29 
30  for (size_t k = 0; k < nStrip; ++k){
31  auto index = rand() % stripContainer.size();
32  dummyPoints.push_back(makeATLASUncalibSourceLink(&stripContainer, index, ctx));
33  }
34 
35  ATH_MSG_DEBUG("Made a proto-track with " <<dummyPoints.size()<<" random clusters");
36 
37 
38  // Make the intput perigee
39  auto inputPerigee = makeDummyParams(dummyPoints[0]);
40 
41  // and add to the list (will only make one prototrack per event for now)
42  foundProtoTracks.push_back({dummyPoints,std::move(inputPerigee)});
43 
44  return StatusCode::SUCCESS;
45 }
46 
49  return dynamic_cast <const xAOD::PixelCluster*>(theMeas)->globalPosition().cast<double>();
50  } else if (theMeas->type() == xAOD::UncalibMeasType::StripClusterType){
51  return dynamic_cast<const xAOD::StripCluster*>(theMeas)->globalPosition().cast<double>();
52  }
53  return Amg::Vector3D::Zero();
54 }
55 
56 
57 std::unique_ptr<Acts::BoundTrackParameters> ActsTrk::RandomProtoTrackCreatorTool::makeDummyParams (const ActsTrk::ATLASUncalibSourceLink & firstPRD) const{
58 
59  const xAOD::UncalibratedMeasurement* measurement = &getUncalibratedMeasurement(firstPRD);
60  using namespace Acts::UnitLiterals;
61  std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
62  Acts::Vector3(0., 0., 0.));
63  Acts::BoundVector params;
64 
65  auto globalPos = getMeasurementPos(measurement);
66 
67  // No, this is not a physically correct parameter estimate!
68  // We just want a placeholder to point in roughly the expected direction...
69  // A real track finder would do something more reasonable here.
70  params << 0., 0.,
71  globalPos.phi(), globalPos.theta(),
72  1. / (1000000000. * 1_MeV), 0.;
73 
74 
75  // Covariance - let's be honest and say we have no clue ;-)
76  Acts::BoundSquareMatrix cov = Acts::BoundSquareMatrix::Identity();
77  cov *= 100000;
78 
79  return std::make_unique<Acts::BoundTrackParameters>(actsSurface, params,
81 
82 }
ActsTrk::RandomProtoTrackCreatorTool::makeDummyParams
std::unique_ptr< Acts::BoundTrackParameters > makeDummyParams(const ActsTrk::ATLASUncalibSourceLink &firstPRD) const
creates a random, dummy set of parameters Warning: This is not a real parameter estimate.
Definition: RandomProtoTrackCreatorTool.cxx:57
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:47
index
Definition: index.py:1
xAOD::UncalibMeasType::StripClusterType
@ StripClusterType
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
xAOD::pion
@ pion
Definition: TrackingPrimitives.h:196
DataPrepToActsConfig.stripContainer
stripContainer
Definition: DataPrepToActsConfig.py:10
xAOD::UncalibratedMeasurement_v1
Definition: UncalibratedMeasurement_v1.h:13
ActsTrk::makeATLASUncalibSourceLink
ATLASUncalibSourceLink makeATLASUncalibSourceLink(const xAOD::UncalibratedMeasurementContainer *container, std::size_t index, [[maybe_unused]] const EventContext &ctx)
Definition: ATLASSourceLink.h:30
LArG4FSStartPointFilter.rand
rand
Definition: LArG4FSStartPointFilter.py:80
xAOD::UncalibratedMeasurement_v1::type
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::RandomProtoTrackCreatorTool::RandomProtoTrackCreatorTool
RandomProtoTrackCreatorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: RandomProtoTrackCreatorTool.cxx:10
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::StripCluster_v1
Definition: StripCluster_v1.h:17
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
ParticleHypothesis.h
RandomProtoTrackCreatorTool.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::getUncalibratedMeasurement
const xAOD::UncalibratedMeasurement & getUncalibratedMeasurement(const ATLASUncalibSourceLink &source_link)
Definition: ATLASSourceLink.h:26
xAOD::TauJetParameters::nStrip
@ nStrip
Get number of strips.
Definition: TauDefs.h:204
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
xAOD::PixelCluster_v1
Definition: PixelCluster_v1.h:17
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
DataPrepToActsConfig.pixelContainer
pixelContainer
Definition: DataPrepToActsConfig.py:9
xAOD::UncalibMeasType::PixelClusterType
@ PixelClusterType
fitman.k
k
Definition: fitman.py:528
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32