DD4hep  01.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
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 ;
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 
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
const std::vector< gear::SimpleMaterialImpl > & materials()
get all materials assigned to this wrapper
Definition: DDGear.h:82
gear::GearParametersImpl * gearObject()
Get GearParametersImpl object.
Definition: DDGear.h:65
const std::string & name()
Name of GearParametersImpl object - should be the canonical name used in gear, eg.
Definition: DDGear.h:62
std::string _name
Definition: DDGear.h:44
GearHandle(gear::GearParametersImpl *gearObj, const std::string &nam)
User c&#39;tor - specify a name (should be the canonical name used in gear, eg.
Definition: DDGear.h:53
GearHandle(const DetElement &)
dummy implementation of required c&#39;tors to allow using the extension mechanism
Definition: DDGear.h:86
void addMaterial(const std::string nam, double A, double Z, double density, double radLen, double intLen)
add a SimpleMaterial object
Definition: DDGear.h:76
STL class.
T push_back(T...args)
gear::GearMgr * createGearMgr(Detector &description, const std::string &pluginName="GearForILD")
Factory method that creates a GearMgr object pobulated with the GearParametersImpl objects from all (...
Definition: DDGear.cpp:39
gear::GearParametersImpl * takeGearObject()
Get GearParametersImpl object and transfer ownership.
Definition: DDGear.h:68
Simple wrapper class for objects of type GearParametersImpl that can be added to DetElements with the...
Definition: DDGear.h:40
std::vector< gear::SimpleMaterialImpl > _materials
Definition: DDGear.h:45
GearHandle()
Default c&#39;tor - only used by dd4hep extenbsion mechanism.
Definition: DDGear.h:49
virtual ~GearHandle()
D&#39;tor deletes GearParametersImpl object if ownerhsip has not been taken away.
Definition: DDGear.h:56
GearHandle(const GearHandle &, const DetElement &)
Definition: DDGear.h:87
gear::GearParametersImpl * _gObj
Definition: DDGear.h:43