ATLAS Offline Software
TrackingVolumesSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TrackingVolumesSvc.cxx, (c) ATLAS Detector software
8 
9 // Trk
11 #include "TrkVolumes/Volume.h"
12 //#include "TrkVolumes/VolumesDummy.h"
15 #include "TrkGeometry/Layer.h"
18 // GaudiKernel && Control
19 #include "GaudiKernel/ISvcLocator.h"
20 #include "GaudiKernel/MsgStream.h"
21 #include "StoreGate/StoreGateSvc.h"
22 
24 Trk::TrackingVolumesSvc::TrackingVolumesSvc(const std::string& a_name,ISvcLocator* svc) :
25  base_class(a_name,svc),
26  m_pDetStore("DetectorStore",name())
27 {
30 
31  //set defaults
32  m_volumeNames.emplace_back("CalorimeterEntryLayer");
33  m_volumeNames.emplace_back("MuonSpectrometerEntryLayer");
34  m_volumeNames.emplace_back("MuonSpectrometerExitLayer");
35 
36  // For the moment, assuming volumes are at 0,0,0 and perfectly aligned (i.e. passing 0)
37  // Adding values by hand - this should be changed (i.e. retrieved from a database?)
38  // EJWM
39 
41  = new Trk::Volume(nullptr, new Trk::CylinderVolumeBounds(1100.0, 3200.0));
43  = new Trk::Volume(nullptr, new Trk::CylinderVolumeBounds(4250.0, 6779.0));
45  = new Trk::Volume(nullptr, new Trk::CylinderVolumeBounds(15000.0, 21000.0)); // FIXME! Put in correct values. EJWM
46 
47  // the name of the TrackingVolume to be built --------------------------------
48  //declareProperty( "VolumeNames", m_volumeNames, "The names of the TrackingVolume to be built");
49  // EJWM - no point configuring this if the volume dimensions can't be configured. EJWM.
50 
51 }
52 
53 
56 = default;
57 
60 {
62 
63  // get the DetectorStore
64  ATH_CHECK( m_pDetStore.retrieve() );
65 
66  // record the volumes
67  for (unsigned int id=0 ; id!=ITrackingVolumesSvc::NumIdentifiers; id++){
68  // create Volume.
69  StatusCode result = m_pDetStore->record(m_volumes[id], m_volumeNames[id]);
70  if (result.isFailure()){
71  ATH_MSG_FATAL ( "Couldn't write Volume "<<m_volumeNames[id]<<" to DetectorStore." );
72  return result;
73  } else {
74  ATH_MSG_INFO ( "initialize() successful: TrackingVolume '" << m_volumeNames[id] << "' built and written to DetectorStore." );
75  }
76  }
77 
78  ATH_MSG_INFO ( "initialize() successful! " );
79 
80  return StatusCode::SUCCESS;
81 }
82 
85 {
86  ATH_MSG_INFO ( "finalize() successful." );
87  return StatusCode::SUCCESS;
88 }
Trk::TrackingVolumesSvc::TrackingVolumesSvc
TrackingVolumesSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: TrackingVolumesSvc.cxx:24
Trk::TrackingVolumesSvc::m_volumeNames
std::vector< std::string > m_volumeNames
the names of the TrackingVolumes
Definition: TrackingVolumesSvc.h:66
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
BinnedArray.h
initialize
void initialize()
Definition: run_EoverP.cxx:894
Trk::ITrackingVolumesSvc::MuonSpectrometerEntryLayer
@ MuonSpectrometerEntryLayer
Tracking Volume which defines the entrance surfaces of the MS.
Definition: ITrackingVolumesSvc.h:41
Trk::TrackingVolumesSvc::finalize
virtual StatusCode finalize() override
Finalize Service.
Definition: TrackingVolumesSvc.cxx:84
Trk::ITrackingVolumesSvc::NumIdentifiers
@ NumIdentifiers
Definition: ITrackingVolumesSvc.h:43
Layer.h
CylinderVolumeBounds.h
Trk::TrackingVolumesSvc::m_volumes
std::vector< const Trk::Volume * > m_volumes
Definition: TrackingVolumesSvc.h:64
Volume.h
Trk::TrackingVolumesSvc::initialize
virtual StatusCode initialize() override
Initialize Service.
Definition: TrackingVolumesSvc.cxx:59
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrackingVolumesSvc.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
Trk::ITrackingVolumesSvc::CalorimeterEntryLayer
@ CalorimeterEntryLayer
Tracking Volume which defines the entrance srufaces of the calorimeter.
Definition: ITrackingVolumesSvc.h:40
Trk::CylinderVolumeBounds
Definition: CylinderVolumeBounds.h:70
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Trk::TrackingVolumesSvc::~TrackingVolumesSvc
virtual ~TrackingVolumesSvc()
Standard Destructor.
IGeometryBuilder.h
Trk::Volume
Definition: Volume.h:35
Trk::ITrackingVolumesSvc::MuonSpectrometerExitLayer
@ MuonSpectrometerExitLayer
Tracking Volume which defines the outer surfaces of the MS.
Definition: ITrackingVolumesSvc.h:42
StoreGateSvc.h
LayerMaterialProperties.h