ATLAS Offline Software
DetectorGeometrySvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include "DetectorGeometrySvc.h"
7 
8 #include "G4VUserDetectorConstruction.hh"
9 
10 // For additional materials that are required
11 #include "G4NistManager.hh"
12 #include "G4Material.hh"
13 
14 DetectorGeometrySvc::DetectorGeometrySvc( const std::string& name, ISvcLocator* pSvcLocator )
15  : base_class(name,pSvcLocator)
16 {
17  ATH_MSG_DEBUG( "DetectorGeometrySvc being created!" );
18 }
19 
21 
22  // go through all tools and retrieve them
23  // This fires initialize() for each of those tools
24  ATH_MSG_DEBUG( "Setting up a DetectorConstruction " << m_detConstruction.name() );
25  ATH_CHECK(m_detConstruction.retrieve());
26 
27  ATH_MSG_DEBUG( "DetectorGeometrySvc initialized!!!" );
28  return StatusCode::SUCCESS;
29 }
30 
32  ATH_MSG_DEBUG( "DetectorGeometrySvc being finalized!!!" );
33  // // Code for G4Field debugging
34  // ATH_MSG_INFO("There are " << G4FieldManagerStore::GetInstance()->size() << " G4FieldManagers in the G4FieldManagerStore.");
35  // for(auto fieldMgr: *G4FieldManagerStore::GetInstance())
36  // {
37  // G4LogicalVolumeStore *g4lvs = G4LogicalVolumeStore::GetInstance();
38  // unsigned int numberOfVolumes = 0;
39  // for (const auto log_vol : *g4lvs)
40  // {
41  // if(fieldMgr== log_vol->GetFieldManager())
42  // {
43  // ++numberOfVolumes;
44  // }
45  // }
46  // ATH_MSG_INFO("Number of volumes = " << numberOfVolumes << ", GetDeltaIntersection = " << fieldMgr->GetDeltaIntersection() << ", GetDeltaOneStep() = " << fieldMgr->GetDeltaOneStep() << ", GetMinimumEpsilonStep() = " << fieldMgr->GetMinimumEpsilonStep() << ", GetMaximumEpsilonStep() = " << fieldMgr->GetMaximumEpsilonStep() << ", GetDeltaChord() = " << fieldMgr->GetChordFinder()->GetDeltaChord() );
47  // //fieldMgr->GetChordFinder()->PrintStatistics();
48  // G4MagInt_Driver* temp(fieldMgr->GetChordFinder()->GetIntegrationDriver());
49  // ATH_MSG_INFO("GetHmin() = " << temp->GetHmin() << ", GetSafety() = " << temp->GetSafety() << ", GetPshrnk() = " << temp->GetPshrnk() << ", GetPgrow() = " << temp->GetPgrow() << ", GetErrcon() = " << temp->GetErrcon());
50  // const G4MagIntegratorStepper* stepper(temp->GetStepper());
51  // std::string stepperName("Unknown");
52  // if (dynamic_cast<const G4HelixImplicitEuler*>(stepper)!=nullptr) stepperName = "HelixImplicitEuler";
53  // else if (dynamic_cast<const G4HelixSimpleRunge*>(stepper)!=nullptr) stepperName="HelixSimpleRunge";
54  // else if (dynamic_cast<const G4HelixExplicitEuler*>(stepper)!=nullptr) stepperName="HelixExplicitEuler";
55  // else if (dynamic_cast<const G4NystromRK4*>(stepper)!=nullptr) stepperName="NystromRK4";
56  // else if (dynamic_cast<const G4ClassicalRK4*>(stepper)!=nullptr) stepperName="ClassicalRK4";
57  // else if (dynamic_cast<const G4AtlasRK4*>(stepper)!=nullptr) stepperName="AtlasRK4";
58  // ATH_MSG_INFO("Stepper properties: GetNumberOfVariables() = " << stepper->GetNumberOfVariables() << ", GetNumberOfStateVariables() = " << stepper->GetNumberOfStateVariables() << ", IntegratorOrder() = " << stepper->IntegratorOrder() << ", Stepper Type = " << stepperName);
59  // }
60  return StatusCode::SUCCESS;
61 }
62 
63 G4VUserDetectorConstruction* DetectorGeometrySvc::GetDetectorConstruction()
64 {
65  return m_detConstruction->GetDetectorConstruction();
66 }
67 
68 std::vector<std::string>& DetectorGeometrySvc::GetParallelWorldNames()
69 {
70  return m_detConstruction->GetParallelWorldNames();
71 }
72 
DetectorGeometrySvc::GetParallelWorldNames
std::vector< std::string > & GetParallelWorldNames() override final
Definition: DetectorGeometrySvc.cxx:68
DetectorGeometrySvc::GetDetectorConstruction
G4VUserDetectorConstruction * GetDetectorConstruction() override final
Definition: DetectorGeometrySvc.cxx:63
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
DetectorGeometrySvc::m_detConstruction
PublicToolHandle< IDetectorConstructionTool > m_detConstruction
Definition: DetectorGeometrySvc.h:37
DetectorGeometrySvc::finalize
StatusCode finalize() override final
Definition: DetectorGeometrySvc.cxx:31
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
DetectorGeometrySvc::DetectorGeometrySvc
DetectorGeometrySvc(const std::string &name, ISvcLocator *pSvcLocator)
Definition: DetectorGeometrySvc.cxx:14
DetectorGeometrySvc.h
DetectorGeometrySvc::initialize
StatusCode initialize() override final
Definition: DetectorGeometrySvc.cxx:20