REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorGeometry.cxx
1 
19 #include "TRestDetectorGeometry.h"
20 
21 using namespace std;
22 
23 ClassImp(TRestDetectorGeometry);
24 
25 TRestDetectorGeometry::TRestDetectorGeometry()
26  : TGeoManager() //, fGfGeometry(0), fDriftElec(0)
27 {
28 #if defined USE_Garfield
29  // TRestDetectorGeometry default constructor
30  vReadoutElec.clear();
31  vGfComponent.clear();
32  vGfSensor.clear();
33 #endif
34 }
35 
36 TRestDetectorGeometry::~TRestDetectorGeometry() {
37 #if defined USE_Garfield
38  // TRestDetectorGeometry destructor
39  vReadoutElec.clear();
40  vGfSensor.clear();
41  vGfComponent.clear();
42 #endif
43 }
44 
45 //------------------------------------------------------------------------------
46 
48 #if defined USE_Garfield
49  fGfGeometry = new Garfield::GeometryRoot();
50  fGfGeometry->SetGeometry(this);
51 #endif
52 }
53 
54 //------------------------------------------------------------------------------
55 
56 void TRestDetectorGeometry::PrintGeometry() {
57  cout << "--------------------------------------" << endl;
58  cout << "Volumes : " << this->GetListOfVolumes()->GetEntries() << endl;
59  cout << "Mother volume : " << this->GetTopVolume()->GetName() << endl;
60  cout << "--------------------------------------" << endl;
61 
62  TGeoVolume* vol;
63  TGeoMaterial* mat;
64  for (int volID = 0; volID < this->GetListOfVolumes()->GetEntries(); volID++) {
65  vol = this->GetVolume(volID);
66  mat = vol->GetMaterial();
67  cout << "Volume " << volID << endl;
68  cout << " Name : " << vol->GetName() << endl;
69  cout << " Material : " << mat->GetName() << endl;
70  cout << " Density : " << mat->GetDensity() << endl;
71  }
72 }
void InitGfGeometry()
initialize Garfield::GeometryRoot geometry object