ATLAS Offline Software
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"
13 #include "StoreGate/StoreGateSvc.h"
14 
18 ForwardRegionGeoModelTool::ForwardRegionGeoModelTool( const std::string& type, const std::string& name, const IInterface* parent )
20 {
21  m_Config.clear();
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);
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 
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 }
_FWD_CONFIGURATION::TCL5JawDistB2I
double TCL5JawDistB2I
Definition: ForwardRegionGeoModelFactory.h:28
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
ForwardRegionGeoModelTool::~ForwardRegionGeoModelTool
virtual ~ForwardRegionGeoModelTool() override final
Destructor.
Definition: ForwardRegionGeoModelTool.cxx:51
_FWD_CONFIGURATION::posZDC2
double posZDC2
Definition: ForwardRegionGeoModelFactory.h:44
_FWD_CONFIGURATION::TCL6JawDistB2I
double TCL6JawDistB2I
Definition: ForwardRegionGeoModelFactory.h:29
ForwardRegionGeoModelTool::ForwardRegionGeoModelTool
ForwardRegionGeoModelTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s)
Definition: ForwardRegionGeoModelTool.cxx:18
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
_FWD_CONFIGURATION::TCL6JawDistB2O
double TCL6JawDistB2O
Definition: ForwardRegionGeoModelFactory.h:32
_FWD_CONFIGURATION::newPosB7R1
double newPosB7R1
Definition: ForwardRegionGeoModelFactory.h:38
_FWD_CONFIGURATION::TCL5JawDistB1O
double TCL5JawDistB1O
Definition: ForwardRegionGeoModelFactory.h:25
_FWD_CONFIGURATION::TCL5JawDistB1I
double TCL5JawDistB1I
Definition: ForwardRegionGeoModelFactory.h:22
_FWD_CONFIGURATION::TCL4JawDistB2I
double TCL4JawDistB2I
Definition: ForwardRegionGeoModelFactory.h:27
ForwardRegionGeoModelTool::create
virtual StatusCode create() override final
Create the Detector Node corresponding to this tool.
Definition: ForwardRegionGeoModelTool.cxx:65
_FWD_CONFIGURATION::posAFPL1
double posAFPL1
Definition: ForwardRegionGeoModelFactory.h:39
GeoModelExperiment
Definition: GeoModelExperiment.h:32
_FWD_CONFIGURATION::posAFPL2
double posAFPL2
Definition: ForwardRegionGeoModelFactory.h:40
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
_FWD_CONFIGURATION::vp1Compatibility
bool vp1Compatibility
Definition: ForwardRegionGeoModelFactory.h:35
GeoModelExperiment.h
_FWD_CONFIGURATION::ALFAInNewPosition
bool ALFAInNewPosition
Definition: ForwardRegionGeoModelFactory.h:36
ForwardRegionGeoModelTool.h
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
_FWD_CONFIGURATION::TCL4JawDistB1I
double TCL4JawDistB1I
Definition: ForwardRegionGeoModelFactory.h:21
_FWD_CONFIGURATION::buildTCL6
bool buildTCL6
Definition: ForwardRegionGeoModelFactory.h:34
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
_FWD_CONFIGURATION::posAFPR2
double posAFPR2
Definition: ForwardRegionGeoModelFactory.h:42
ForwardRegionGeoModelFactory
Definition: ForwardRegionGeoModelFactory.h:49
_FWD_CONFIGURATION::newPosB7L1
double newPosB7L1
Definition: ForwardRegionGeoModelFactory.h:37
test_pyathena.parent
parent
Definition: test_pyathena.py:15
GeoModelTool
Definition: GeoModelTool.h:17
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
_FWD_CONFIGURATION::TCL6JawDistB1O
double TCL6JawDistB1O
Definition: ForwardRegionGeoModelFactory.h:26
GeoModelTool::m_detector
GeoVDetectorManager * m_detector
Definition: GeoModelTool.h:36
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
_FWD_CONFIGURATION::clear
void clear()
Definition: ForwardRegionGeoModelFactory.cxx:47
_FWD_CONFIGURATION::TCL6JawDistB1I
double TCL6JawDistB1I
Definition: ForwardRegionGeoModelFactory.h:23
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
_FWD_CONFIGURATION::posAFPR1
double posAFPR1
Definition: ForwardRegionGeoModelFactory.h:41
_FWD_CONFIGURATION::TCL5JawDistB2O
double TCL5JawDistB2O
Definition: ForwardRegionGeoModelFactory.h:31
_FWD_CONFIGURATION::posZDC1
double posZDC1
Definition: ForwardRegionGeoModelFactory.h:43
_FWD_CONFIGURATION::TCL4JawDistB1O
double TCL4JawDistB1O
Definition: ForwardRegionGeoModelFactory.h:24
ForwardRegionGeoModelFactory.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
_FWD_CONFIGURATION::buildTCL4
bool buildTCL4
Definition: ForwardRegionGeoModelFactory.h:33
ForwardRegionGeoModelTool::m_Config
FWD_CONFIGURATION m_Config
Definition: ForwardRegionGeoModelTool.h:24
ForwardRegionGeoModelManager.h
StoreGateSvc.h
_FWD_CONFIGURATION::TCL4JawDistB2O
double TCL4JawDistB2O
Definition: ForwardRegionGeoModelFactory.h:30