VMC Examples Version 6.6
Loading...
Searching...
No Matches
A01RootDetectorConstruction Class Reference

The detector construction (via TGeo ) More...

#include <A01RootDetectorConstruction.h>

Inheritance diagram for A01RootDetectorConstruction:

Public Member Functions

 A01RootDetectorConstruction (const TString &geometryFileName)
 
virtual ~A01RootDetectorConstruction ()
 
void ConstructGeometry ()
 
void SetUseLocalMagField (Bool_t localMagField)
 

Private Attributes

TString fGeometryFileName
 The root geometry file name.
 
Bool_t fUseLocalMagField
 Option to use local magnetic field (working only with Geant4 !)
 

Detailed Description

The detector construction (via TGeo )

Date
12/05/2012
Author
I. Hrivnacova; IPN, Orsay

Definition at line 29 of file A01RootDetectorConstruction.h.

Constructor & Destructor Documentation

◆ A01RootDetectorConstruction()

A01RootDetectorConstruction::A01RootDetectorConstruction ( const TString & geometryFileName)

Standard constuctor

Parameters
geometryFileNameThe root geometry file name

Definition at line 31 of file A01RootDetectorConstruction.cxx.

33 : TObject(), fGeometryFileName(geometryFileName), fUseLocalMagField(false)
34{
35 /// Standard constuctor
36 /// \param geometryFileName The root geometry file name
37}
TString fGeometryFileName
The root geometry file name.
Bool_t fUseLocalMagField
Option to use local magnetic field (working only with Geant4 !)

◆ ~A01RootDetectorConstruction()

A01RootDetectorConstruction::~A01RootDetectorConstruction ( )
virtual

Destructor

Definition at line 40 of file A01RootDetectorConstruction.cxx.

41{
42 /// Destructor
43}

Member Function Documentation

◆ ConstructGeometry()

void A01RootDetectorConstruction::ConstructGeometry ( )

Contruct volumes using TGeo modeller

Definition at line 50 of file A01RootDetectorConstruction.cxx.

51{
52 /// Contruct volumes using TGeo modeller
53
54 TGeoManager::Import(fGeometryFileName.Data());
55
56 // Update media parameters (needed for Geant3)
57 TList* media = gGeoManager->GetListOfMedia();
58 TIter next(media);
59 while (TObject* obj = next()) {
60 TGeoMedium* medium = (TGeoMedium*)obj;
61 medium->SetParam(1, 2); // ifield - User defined magnetic field
62 medium->SetParam(2, 10); // fieldm - Maximum field value (in kiloGauss)
63 medium->SetParam(6, .001); // epsil - Tracking precision
64 }
65
66 // Create local magnetic field
68 // Constant magnetic field (in kiloGauss)
69 // field value: 1.0*tesla (= 10.0 kiloGauss) in y
70 TVirtualMagField* magField = new A01LocalMagField(0, 10.0, 0);
71
72 // set the field to "magneticLogical" volume
73 TGeoVolume* magneticVolume = gGeoManager->FindVolumeFast("magneticLogical");
74 if (magneticVolume) {
75 magneticVolume->SetField(magField);
76 }
77 else {
78 std::cerr << "The Tube volume was not found in geometry." << std::endl;
79 std::cerr << "Local magnetic field has not been set." << std::endl;
80 delete magField;
81 }
82 }
83 // notify VMC about Root geometry
84 gMC->SetRootGeometry();
85}
Definition of a uniform magnetic field within a given region.

◆ SetUseLocalMagField()

void A01RootDetectorConstruction::SetUseLocalMagField ( Bool_t localMagField)
inline

Set the option to use local magnetic field (working only with Geant4 !)

Parameters
localMagFieldThe new value of the option

Definition at line 55 of file A01RootDetectorConstruction.h.

57{
58 fUseLocalMagField = localMagField;
59}

Member Data Documentation

◆ fGeometryFileName

TString A01RootDetectorConstruction::fGeometryFileName
private

The root geometry file name.

Definition at line 43 of file A01RootDetectorConstruction.h.

◆ fUseLocalMagField

Bool_t A01RootDetectorConstruction::fUseLocalMagField
private

Option to use local magnetic field (working only with Geant4 !)

Definition at line 46 of file A01RootDetectorConstruction.h.


The documentation for this class was generated from the following files: