ATLAS Offline Software
FPGATrackSimPrototrackFitterAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
9 }
10 
12  ATH_CHECK(m_trackContainerKey.initialize());
13  ATH_CHECK(m_tracksBackendHandlesHelper.initialize(ActsTrk::prefixFromTrackContainerName(m_trackContainerKey.key())));
14  ATH_CHECK(m_actsFitter.retrieve());
15  ATH_CHECK(m_trackingGeometryTool.retrieve());
16  ATH_CHECK(m_extrapolationTool.retrieve());
17  ATH_CHECK(m_ProtoTrackCollectionFromFPGAKey.initialize());
18  ATH_CHECK(m_detectorElementToGeometryIdMapKey.initialize());
19 
20  return StatusCode::SUCCESS;
21 }
22 
24 {
25 
26  SG::WriteHandle<ActsTrk::TrackContainer> trackContainerHandle (m_trackContainerKey, ctx);
27  SG::ReadHandle<ActsTrk::ProtoTrackCollection> myProtoTracks(m_ProtoTrackCollectionFromFPGAKey,ctx);
28 
29  if (!myProtoTracks.isValid()){
30  ATH_MSG_WARNING("no Prototrack collections");
31  return StatusCode::SUCCESS;
32  }
33  ATH_MSG_DEBUG("I received " <<myProtoTracks->size()<<" proto-tracks");
34 
35 
46  detectorElementToGeometryIdMap{m_detectorElementToGeometryIdMapKey, ctx};
47  ATH_CHECK(detectorElementToGeometryIdMap.isValid());
48 
49  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
50  Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
51  // CalibrationContext converter not implemented yet.
52  Acts::CalibrationContext calContext = Acts::CalibrationContext();
53 
56  ActsTrk::MutableTrackContainer trackContainer;
57 
58  // now we fit each of the proto tracks
59  for (auto & proto : *myProtoTracks){
60  auto res = m_actsFitter->fit(ctx, proto.measurements, *proto.parameters,
61  m_trackingGeometryTool->getGeometryContext(ctx).context(),
62  m_extrapolationTool->getMagneticFieldContext(ctx),
63  Acts::CalibrationContext(),
64  **detectorElementToGeometryIdMap);
65 
66  if(!res) continue;
67  if (res->size() == 0 ) continue;
68  if(proto.measurements.empty()) continue;
69  ATH_MSG_DEBUG(".......Done track with size "<< proto.measurements.size());
70  const auto trackProxy = res->getTrack(0);
71  if (not trackProxy.hasReferenceSurface()) {
72  ATH_MSG_INFO("There is not reference surface for this track");
73  continue;
74  }
75  auto destProxy = trackContainer.getTrack(trackContainer.addTrack());
76  destProxy.copyFrom(trackProxy, true); // make sure we copy track states!
77  }
78  std::unique_ptr<ActsTrk::TrackContainer> constTracksContainer = m_tracksBackendHandlesHelper.moveToConst(std::move(trackContainer),
79  m_trackingGeometryTool->getGeometryContext(ctx).context(), ctx);
80  ATH_CHECK(trackContainerHandle.record(std::move(constTracksContainer)));
81 
82  return StatusCode::SUCCESS;
83 }
84 
85 
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::initialize
virtual StatusCode initialize() override final
uncomment and implement methods as required
Definition: FPGATrackSimPrototrackFitterAlg.cxx:11
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
ActsTrk::prefixFromTrackContainerName
std::string prefixFromTrackContainerName(const std::string &tracks)
Parse TrackContainer name to get the prefix for backends The name has to contain XYZTracks,...
Definition: TrackContainerHandlesHelper.cxx:18
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: FPGATrackSimPrototrackFitterAlg.cxx:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
FPGATrackSimPrototrackFitterAlg.h
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::FPGATrackSimPrototrackFitterAlg
FPGATrackSimPrototrackFitterAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FPGATrackSimPrototrackFitterAlg.cxx:8
ActsTrk::MutableTrackContainer
Definition: TrackContainer.h:122