ATLAS Offline Software
Loading...
Searching...
No Matches
ForwardRegionGeoModelTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
9#include "GaudiKernel/IService.h"
10#include "GaudiKernel/ISvcLocator.h"
11#include "GaudiKernel/MsgStream.h"
12#include "GaudiKernel/SystemOfUnits.h"
14
18ForwardRegionGeoModelTool::ForwardRegionGeoModelTool( const std::string& type, const std::string& name, const IInterface* parent )
19: GeoModelTool( type, name, parent )
20{
21 m_Config.clear();
22 declareProperty("TCL4JawDistB1I",m_Config.TCL4JawDistB1I=57*Gaudi::Units::mm);
23 declareProperty("TCL4JawDistB2I",m_Config.TCL4JawDistB2I=57*Gaudi::Units::mm);
24 declareProperty("TCL5JawDistB1I",m_Config.TCL5JawDistB1I=57*Gaudi::Units::mm);
25 declareProperty("TCL5JawDistB2I",m_Config.TCL5JawDistB2I=57*Gaudi::Units::mm);
26 declareProperty("TCL6JawDistB1I",m_Config.TCL6JawDistB1I=57*Gaudi::Units::mm);
27 declareProperty("TCL6JawDistB2I",m_Config.TCL6JawDistB2I=57*Gaudi::Units::mm);
28 declareProperty("TCL4JawDistB1O",m_Config.TCL4JawDistB1O=57*Gaudi::Units::mm);
29 declareProperty("TCL4JawDistB2O",m_Config.TCL4JawDistB2O=57*Gaudi::Units::mm);
30 declareProperty("TCL5JawDistB1O",m_Config.TCL5JawDistB1O=57*Gaudi::Units::mm);
31 declareProperty("TCL5JawDistB2O",m_Config.TCL5JawDistB2O=57*Gaudi::Units::mm);
32 declareProperty("TCL6JawDistB1O",m_Config.TCL6JawDistB1O=57*Gaudi::Units::mm);
33 declareProperty("TCL6JawDistB2O",m_Config.TCL6JawDistB2O=57*Gaudi::Units::mm);
34 declareProperty("vp1Compatibility", m_Config.vp1Compatibility=false);
35 declareProperty("buildTCL4",m_Config.buildTCL4=false);
36 declareProperty("buildTCL6",m_Config.buildTCL6=false);
37 declareProperty("ALFAInNewPosition",m_Config.ALFAInNewPosition=false);
38 declareProperty("newPosB7L1",m_Config.newPosB7L1=245656.77*Gaudi::Units::mm);
39 declareProperty("newPosB7R1",m_Config.newPosB7R1=-245656.11*Gaudi::Units::mm);
40 declareProperty("posAFPL1",m_Config.posAFPL1=204500*Gaudi::Units::mm);
41 declareProperty("posAFPR1",m_Config.posAFPR1=-204500*Gaudi::Units::mm);
42 declareProperty("posAFPL2",m_Config.posAFPL2=212675*Gaudi::Units::mm);
43 declareProperty("posAFPR2",m_Config.posAFPR2=-212675*Gaudi::Units::mm);
44 declareProperty("posZDC1",m_Config.posZDC1=141580*Gaudi::Units::mm);
45 declareProperty("posZDC2",m_Config.posZDC2=-141580*Gaudi::Units::mm);
46}
47
52{
53 // This will need to be modified once we register the DetectorNode in
54 // the Transient Detector Store
55 if ( 0 != m_detector ) {
56 delete m_detector;
57 m_detector = 0;
58 }
59}
60
64StatusCode
66{
67 MsgStream log(msgSvc(), name());
68 //
69 // Locate the top level experiment node
70 //
71 GeoModelExperiment* theExpt = nullptr;
72 StatusCode sc = detStore()->retrieve( theExpt, "ATLAS" );
73 if (StatusCode::SUCCESS != sc) {
74 log << MSG::ERROR
75 << "Could not find GeoModelExperiment ATLAS"
76 << endmsg;
77 return (StatusCode::FAILURE);
78 }
79
80 ForwardRegionGeoModelFactory theFactory(detStore().operator->(), &m_Config);
81 if ( 0 == m_detector ) {
82 // Create the DetectorNode instance
83 try {
84 //
85 // This strange way of casting is to avoid an
86 // utterly brain damaged compiler warning.
87 //
88 GeoPhysVol *world=&*theExpt->getPhysVol();
89 theFactory.create(world);
90 } catch (const std::bad_alloc&) {
91 log << MSG::FATAL << "Could not create new DetectorNode!" << endmsg;
92 return StatusCode::FAILURE;
93 }
94 // Register the DetectorNode instance with the Transient Detector Store
95 theExpt->addManager(theFactory.getDetectorManager());
96 sc = detStore()->record(theFactory.getDetectorManager(),theFactory.getDetectorManager()->getName());
97 if (StatusCode::SUCCESS != sc) {
98 log << MSG::ERROR
99 << "Could not register DetectorNode"
100 << endmsg;
101 return (StatusCode::FAILURE);
102 }
103 return StatusCode::SUCCESS;
104 }
105 return StatusCode::FAILURE;
106}
#define endmsg
static Double_t sc
virtual void create(GeoPhysVol *world)
virtual const ForwardRegionGeoModelManager * getDetectorManager() const
virtual StatusCode create() override final
Create the Detector Node corresponding to this tool.
virtual ~ForwardRegionGeoModelTool() override final
Destructor.
ForwardRegionGeoModelTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s)
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
GeoVDetectorManager * m_detector