ATLAS Offline Software
Loading...
Searching...
No Matches
TrackingVolumesSvc.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// 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"
22
24Trk::TrackingVolumesSvc::TrackingVolumesSvc(const std::string& a_name,ISvcLocator* svc) :
25 base_class(a_name,svc),
26 m_pDetStore("DetectorStore",name())
27{
28
29 //set defaults
31 m_volumeNames.emplace_back("CalorimeterEntryLayer");
32 m_volumeNames.emplace_back("MuonSpectrometerEntryLayer");
33 m_volumeNames.emplace_back("MuonSpectrometerExitLayer");
34
35 // For the moment, assuming volumes are at 0,0,0 and perfectly aligned (i.e. passing 0)
36 // Adding values by hand - this should be changed (i.e. retrieved from a database?)
37 // EJWM
38
41 = new Trk::Volume(nullptr, std::make_shared<Trk::CylinderVolumeBounds>(1100.0, 3200.0));
43 = new Trk::Volume(nullptr, std::make_shared<Trk::CylinderVolumeBounds>(4250.0, 6779.0));
45 = new Trk::Volume(nullptr, std::make_shared<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{
61 ATH_CHECK( AthService::initialize());
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
@ MuonSpectrometerExitLayer
Tracking Volume which defines the outer surfaces of the MS.
@ CalorimeterEntryLayer
Tracking Volume which defines the entrance srufaces of the calorimeter.
@ MuonSpectrometerEntryLayer
Tracking Volume which defines the entrance surfaces of the MS.
TrackingVolumesSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
virtual StatusCode initialize() override
Initialize Service.
virtual StatusCode finalize() override
Finalize Service.
virtual ~TrackingVolumesSvc()
Standard Destructor.
std::vector< std::string > m_volumeNames
the names of the TrackingVolumes
std::vector< const Trk::Volume * > m_volumes
ServiceHandle< StoreGateSvc > m_pDetStore
the cached volumes
Base class for all volumes inside the tracking realm, it defines the interface for inherited Volume c...
Definition Volume.h:36