DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
DDGear.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : F.Gaede
11 //
12 //==========================================================================
13 #ifndef DDREC_DDGEAR_H
14 #define DDREC_DDGEAR_H
15 
16 #include "DD4hep/Detector.h"
17 #include "DD4hep/DetElement.h"
18 
19 #include "gear/GEAR.h"
20 #include "gearimpl/GearParametersImpl.h"
21 #include "gearimpl/SimpleMaterialImpl.h"
22 #include "gear/GearMgr.h"
23 
24 namespace gear{
25  class GearParametersImpl ;
26  class GearMgr ;
27 }
28 
29 namespace dd4hep {
30  namespace rec {
31 
40  class GearHandle {
41 
42  protected:
43  gear::GearParametersImpl* _gObj ;
44  std::string _name ;
45  std::vector< gear::SimpleMaterialImpl > _materials ;
46 
47  public :
49  GearHandle() : _gObj( 0 ) , _name( "UNKNOWN" ) {}
50 
53  GearHandle( gear::GearParametersImpl* gearObj, const std::string& nam ) : _gObj( gearObj ) , _name( nam ) {}
54 
56  virtual ~GearHandle() {
57  if( _gObj)
58  delete _gObj ;
59  }
60 
62  const std::string& name() { return _name ; }
63 
65  gear::GearParametersImpl* gearObject() { return _gObj ; }
66 
68  gear::GearParametersImpl* takeGearObject() {
69  gear::GearParametersImpl* obj = _gObj ;
70  _gObj = 0 ;
71  return obj ;
72  }
73 
74 
76  void addMaterial(const std::string nam, double A, double Z, double density, double radLen, double intLen){
77 
78  _materials.push_back( gear::SimpleMaterialImpl (nam, A, Z, density, radLen, intLen) ) ;
79  }
80 
82  const std::vector< gear::SimpleMaterialImpl >& materials() { return _materials ; }
83 
84 
86  GearHandle(const DetElement& /*d*/) : _gObj(0) {}
87  GearHandle(const GearHandle& /*c*/,const DetElement& /*det*/) : _gObj(0) {}
88  } ;
89 
90 
91  //===============================================================================================================
92 
98  gear::GearMgr* createGearMgr( Detector& description , const std::string& pluginName="GearForILD" ) ;
99 
100  }}
101 
102 
103 
104 #endif
dd4hep::rec::GearHandle::gearObject
gear::GearParametersImpl * gearObject()
Definition: DDGear.h:65
dd4hep::rec::GearHandle::_name
std::string _name
Definition: DDGear.h:44
Detector.h
dd4hep::rec::GearHandle::GearHandle
GearHandle(const DetElement &)
Definition: DDGear.h:86
dd4hep::rec::GearHandle::takeGearObject
gear::GearParametersImpl * takeGearObject()
Definition: DDGear.h:68
dd4hep::rec::GearHandle::GearHandle
GearHandle()
Definition: DDGear.h:49
dd4hep::rec::GearHandle::GearHandle
GearHandle(const GearHandle &, const DetElement &)
Definition: DDGear.h:87
dd4hep::rec::GearHandle::_gObj
gear::GearParametersImpl * _gObj
Definition: DDGear.h:43
dd4hep::rec::GearHandle::name
const std::string & name()
Definition: DDGear.h:62
dd4hep::rec::GearHandle::_materials
std::vector< gear::SimpleMaterialImpl > _materials
Definition: DDGear.h:45
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::rec::createGearMgr
gear::GearMgr * createGearMgr(Detector &description, const std::string &pluginName="GearForILD")
Definition: DDGear.cpp:39
dd4hep::rec::GearHandle
Definition: DDGear.h:40
gear
Definition: DDGear.h:24
dd4hep::rec::GearHandle::~GearHandle
virtual ~GearHandle()
Definition: DDGear.h:56
dd4hep::rec::GearHandle::materials
const std::vector< gear::SimpleMaterialImpl > & materials()
get all materials assigned to this wrapper
Definition: DDGear.h:82
dd4hep::rec::GearHandle::addMaterial
void addMaterial(const std::string nam, double A, double Z, double density, double radLen, double intLen)
add a SimpleMaterial object
Definition: DDGear.h:76
DetElement.h
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::rec::GearHandle::GearHandle
GearHandle(gear::GearParametersImpl *gearObj, const std::string &nam)
Definition: DDGear.h:53