ATLAS Offline Software
FPGATrackSimMappingSvc.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
6 
7 FPGATrackSimMappingSvc::FPGATrackSimMappingSvc(const std::string& name, ISvcLocator*svc) :
8  base_class(name, svc),
9  m_EvtSel("FPGATrackSimEventSelectionSvc", name)
10 {
11 }
12 
13 
15 {
16  if (m_pmap_path.value().empty())
17  ATH_MSG_FATAL("Main plane map definition missing");
18  else if (m_rmap_path.value().empty())
19  ATH_MSG_FATAL("Missing region map path");
20  else if (m_modulelut_path.value().empty())
21  ATH_MSG_FATAL("Module LUT file is missing");
22  else
23  return StatusCode::SUCCESS;
24 
25  return StatusCode::FAILURE;
26 }
27 
28 
30 {
31  if (!m_pmap_1st)
32  ATH_MSG_FATAL("Error using 1st stage plane map: " << m_pmap_path);
33  if (!m_pmap_2nd)
34  ATH_MSG_FATAL("Error using 2nd stage plane map: " << m_pmap_path);
35  if (!m_rmap_1st)
36  ATH_MSG_FATAL("Error creating region map for 1st stage from: " << m_rmap_path);
37  if (!m_rmap_2nd)
38  ATH_MSG_FATAL("Error creating region map for 2nd stage from: " << m_rmap_path);
39  if (!m_subrmap)
40  ATH_MSG_FATAL("Error creating sub-region map from: " << m_subrmap_path);
41  if (!m_subrmap_2nd)
42  ATH_MSG_FATAL("Error creating second stage sub-region map from: " << m_subrmap_path);
43 
44  return StatusCode::SUCCESS;
45 }
46 
47 
49 {
50  ATH_CHECK(m_EvtSel.retrieve());
52 
53  if (m_mappingType.value() == "FILE")
54  {
55  ATH_MSG_DEBUG("Creating the 1st stage plane map");
56  m_pmap_1st = std::unique_ptr<FPGATrackSimPlaneMap>(new FPGATrackSimPlaneMap(PathResolverFindCalibFile(m_pmap_path.value()), m_EvtSel->getRegionID(), 1, m_layerOverrides));
57 
58  ATH_MSG_DEBUG("Creating the 2nd stage plane map");
59  m_pmap_2nd = std::unique_ptr<FPGATrackSimPlaneMap>(new FPGATrackSimPlaneMap(PathResolverFindCalibFile(m_pmap_path.value()), m_EvtSel->getRegionID(), 2));
60 
61  ATH_MSG_DEBUG("Creating the 1st stage region map");
62  m_rmap_1st = std::unique_ptr<FPGATrackSimRegionMap>(new FPGATrackSimRegionMap(m_pmap_1st.get(), PathResolverFindCalibFile(m_rmap_path.value())));
63 
64  ATH_MSG_DEBUG("Creating the 2nd stage region map");
65  m_rmap_2nd = std::unique_ptr<FPGATrackSimRegionMap>(new FPGATrackSimRegionMap(m_pmap_2nd.get(), PathResolverFindCalibFile(m_rmap_path.value())));
66 
67  ATH_MSG_DEBUG("Creating the sub-region map");
68  m_subrmap = std::unique_ptr<FPGATrackSimRegionMap>(new FPGATrackSimRegionMap(m_pmap_1st.get(), PathResolverFindCalibFile(m_subrmap_path.value())));
69 
70  ATH_MSG_DEBUG("Creating the 2nd stage sub-region map");
71  m_subrmap_2nd = std::unique_ptr<FPGATrackSimRegionMap>(new FPGATrackSimRegionMap(m_pmap_2nd.get(), PathResolverFindCalibFile(m_subrmap_path.value())));
72 
73  ATH_MSG_DEBUG("Setting the Modules LUT for Region Maps");
74  m_rmap_1st->loadModuleIDLUT(PathResolverFindCalibFile(m_modulelut_path.value()));
75  m_rmap_2nd->loadModuleIDLUT(PathResolverFindCalibFile(m_modulelut_path.value()));
76 
77  // We probably need two versions of this path for the second stage.
78  ATH_MSG_DEBUG("Setting the average radius per logical layer for Region and Subregion Maps");
79  m_rmap_1st->loadRadiiFile(PathResolverFindCalibFile(m_radii_path.value()));
80  m_subrmap->loadRadiiFile(PathResolverFindCalibFile(m_radii_path.value()));
81 
82  ATH_MSG_DEBUG("Creating NN weighting map");
83  if ( ! m_NNmap_path.empty() ) {
84  m_NNmap = std::make_unique<FPGATrackSimNNMap>(PathResolverFindCalibFile(m_NNmap_path.value()));
85  } else {
86  m_NNmap = nullptr;
87  }
88  }
89 
91 
92  return StatusCode::SUCCESS;
93 }
94 
95 
FPGATrackSimMappingSvc::m_rmap_2nd
std::unique_ptr< FPGATrackSimRegionMap > m_rmap_2nd
Definition: FPGATrackSimMappingSvc.h:53
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
FPGATrackSimMappingSvc::m_pmap_1st
std::unique_ptr< FPGATrackSimPlaneMap > m_pmap_1st
Definition: FPGATrackSimMappingSvc.h:50
FPGATrackSimMappingSvc::FPGATrackSimMappingSvc
FPGATrackSimMappingSvc(const std::string &name, ISvcLocator *svc)
Definition: FPGATrackSimMappingSvc.cxx:7
FPGATrackSimMappingSvc::m_pmap_2nd
std::unique_ptr< FPGATrackSimPlaneMap > m_pmap_2nd
Definition: FPGATrackSimMappingSvc.h:51
FPGATrackSimMappingSvc::m_NNmap
std::unique_ptr< FPGATrackSimNNMap > m_NNmap
Definition: FPGATrackSimMappingSvc.h:56
FPGATrackSimMappingSvc::m_radii_path
Gaudi::Property< std::string > m_radii_path
Definition: FPGATrackSimMappingSvc.h:46
FPGATrackSimMappingSvc::checkAllocs
StatusCode checkAllocs()
Definition: FPGATrackSimMappingSvc.cxx:29
FPGATrackSimMappingSvc::m_rmap_1st
std::unique_ptr< FPGATrackSimRegionMap > m_rmap_1st
Definition: FPGATrackSimMappingSvc.h:52
FPGATrackSimMappingSvc::m_layerOverrides
Gaudi::Property< std::vector< int > > m_layerOverrides
Definition: FPGATrackSimMappingSvc.h:47
FPGATrackSimMappingSvc::m_subrmap_2nd
std::unique_ptr< FPGATrackSimRegionMap > m_subrmap_2nd
Definition: FPGATrackSimMappingSvc.h:55
FPGATrackSimMappingSvc::m_pmap_path
Gaudi::Property< std::string > m_pmap_path
Definition: FPGATrackSimMappingSvc.h:43
FPGATrackSimMappingSvc::m_EvtSel
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_EvtSel
Definition: FPGATrackSimMappingSvc.h:36
FPGATrackSimMappingSvc::m_modulelut_path
Gaudi::Property< std::string > m_modulelut_path
Definition: FPGATrackSimMappingSvc.h:44
FPGATrackSimMappingSvc::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimMappingSvc.cxx:48
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimMappingSvc::m_NNmap_path
Gaudi::Property< std::string > m_NNmap_path
Definition: FPGATrackSimMappingSvc.h:45
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
FPGATrackSimPlaneMap
Definition: FPGATrackSimPlaneMap.h:62
PathResolver.h
FPGATrackSimMappingSvc::m_rmap_path
Gaudi::Property< std::string > m_rmap_path
Definition: FPGATrackSimMappingSvc.h:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
FPGATrackSimMappingSvc::m_mappingType
Gaudi::Property< std::string > m_mappingType
Definition: FPGATrackSimMappingSvc.h:40
FPGATrackSimMappingSvc::m_subrmap_path
Gaudi::Property< std::string > m_subrmap_path
Definition: FPGATrackSimMappingSvc.h:42
IFPGATrackSimEventSelectionSvc.h
FPGATrackSimMappingSvc::m_subrmap
std::unique_ptr< FPGATrackSimRegionMap > m_subrmap
Definition: FPGATrackSimMappingSvc.h:54
FPGATrackSimMappingSvc::checkInputs
StatusCode checkInputs()
Definition: FPGATrackSimMappingSvc.cxx:14
FPGATrackSimRegionMap
Definition: FPGATrackSimRegionMap.h:62
FPGATrackSimMappingSvc.h