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