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

The detector construction (via TGeo ) More...

#include <Ex02DetectorConstruction.h>

Inheritance diagram for Ex02DetectorConstruction:

Public Member Functions

 Ex02DetectorConstruction ()
 
virtual ~Ex02DetectorConstruction ()
 
void ConstructMaterials ()
 
void ConstructGeometry ()
 
void SetTargetMaterial (const TString &name)
 
void SetChamberMaterial (const TString &name)
 
Double_t GetTrackerFullLength ()
 
Double_t GetTargetFullLength ()
 
Double_t GetWorldFullLength ()
 

Private Attributes

Double_t fWorldLength
 Full length of the world volume.
 
Double_t fTargetLength
 Full length of Target.
 
Double_t fTrackerLength
 Full length of Tracker.
 
Int_t fNofChambers
 Nb of chambers in the tracker region.
 
Double_t fChamberWidth
 Width of the chambers.
 
Double_t fChamberSpacing
 Distance between chambers.
 
Int_t fImedAir
 The Air medium Id.
 
Int_t fImedPb
 The Lead medium Id.
 
Int_t fImedXe
 The Xenon gas medium Id.
 

Detailed Description

The detector construction (via TGeo )

Date
21/04/2002
Author
I. Hrivnacova; IPN, Orsay

Definition at line 31 of file Ex02DetectorConstruction.h.

Constructor & Destructor Documentation

◆ Ex02DetectorConstruction()

Ex02DetectorConstruction::Ex02DetectorConstruction ( )

Default constuctor

Definition at line 36 of file Ex02DetectorConstruction.cxx.

37 : TObject(),
38 fWorldLength(0.),
39 fTargetLength(0.),
41 fNofChambers(0),
42 fChamberWidth(0.),
44 fImedAir(0),
45 fImedPb(0),
46 fImedXe(0)
47{
48 /// Default constuctor
49
50 // fpMagField = new ExN02MagneticField();
51
52 //--------- Sizes of the principal geometrical components (solids) ---------
53
54 fNofChambers = 5;
55 fChamberWidth = 20;
56 fChamberSpacing = 80;
57
59 (fNofChambers + 1) * fChamberSpacing; // Full length of Tracker
60 fTargetLength = 5.0; // Full length of Target
62}
Int_t fImedXe
The Xenon gas medium Id.
Double_t fChamberSpacing
Distance between chambers.
Double_t fChamberWidth
Width of the chambers.
Double_t fTrackerLength
Full length of Tracker.
Double_t fTargetLength
Full length of Target.
Int_t fImedPb
The Lead medium Id.
Int_t fImedAir
The Air medium Id.
Double_t fWorldLength
Full length of the world volume.
Int_t fNofChambers
Nb of chambers in the tracker region.

◆ ~Ex02DetectorConstruction()

Ex02DetectorConstruction::~Ex02DetectorConstruction ( )
virtual

Destructor

Definition at line 65 of file Ex02DetectorConstruction.cxx.

66{
67 /// Destructor
68
69 // delete fpMagField;
70}

Member Function Documentation

◆ ConstructMaterials()

void Ex02DetectorConstruction::ConstructMaterials ( )

Construct materials using TGeo modeller

Definition at line 73 of file Ex02DetectorConstruction.cxx.

74{
75 /// Construct materials using TGeo modeller
76
77 //--------- Material definition ---------
78
79 // Create Root geometry manager
80 new TGeoManager("E02_geometry", "E02 VMC example geometry");
81
82 Double_t a; // Mass of a mole in g/mole
83 Double_t z; // Atomic number
84 Double_t density; // Material density in g/cm3
85
86 // Elements
87
88 TGeoElement* elN = new TGeoElement("Nitrogen", "N", z = 7., a = 14.01);
89 TGeoElement* elO = new TGeoElement("Oxygen", "O", z = 8., a = 16.00);
90
91 // Materials
92
93 TGeoMixture* matAir = new TGeoMixture("Air", 2, density = 1.29e-03);
94 matAir->AddElement(elN, 0.7);
95 matAir->AddElement(elO, 0.3);
96
97 TGeoMaterial* matLead =
98 new TGeoMaterial("Lead", a = 207.19, z = 82., density = 11.35);
99
100 TGeoMaterial* matXe =
101 new TGeoMaterial("XenonGas", a = 131.29, z = 54., density = 5.458e-03);
102
103 Double_t atmosphere = 6.32421e+08;
104 Double_t pressure = 1. * atmosphere;
105 Double_t temperature = 293.15;
106 matXe->SetPressure(pressure);
107 matXe->SetTemperature(temperature);
108 matXe->SetState(TGeoMaterial::kMatStateGas);
109
110 // Tracking media
111
112 Double_t param[20];
113 param[0] = 0; // isvol - Not used
114 param[1] = 2; // ifield - User defined magnetic field
115 param[2] = 10.; // fieldm - Maximum field value (in kiloGauss)
116 param[3] = -20.; // tmaxfd - Maximum angle due to field deflection
117 param[4] = -0.01; // stemax - Maximum displacement for multiple scat
118 param[5] = -.3; // deemax - Maximum fractional energy loss, DLS
119 param[6] = .001; // epsil - Tracking precision
120 param[7] = -.8; // stmin
121 for (Int_t i = 8; i < 20; ++i) param[i] = 0.;
122
123 fImedAir = 1;
124 new TGeoMedium("Air", fImedAir, matAir, param);
125
126 fImedPb = 2;
127 new TGeoMedium("Lead", fImedPb, matLead, param);
128
129 fImedXe = 3;
130 new TGeoMedium("XenonGas", fImedXe, matXe, param);
131}

◆ ConstructGeometry()

void Ex02DetectorConstruction::ConstructGeometry ( )

Contruct volumes using TGeo modeller

Definition at line 134 of file Ex02DetectorConstruction.cxx.

135{
136 /// Contruct volumes using TGeo modeller
137
138 //--------- Sizes of the principal geometrical components (solids) ---------
139
140 Int_t targetMater = fImedPb;
141 Int_t chamberMater = fImedXe;
142
143 Double_t targetSize = 0.5 * fTargetLength; // Half length of the Target
144 Double_t trackerSize = 0.5 * fTrackerLength; // Half length of the Tracker
145
146 Double_t* ubuf = 0;
147
148 //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
149
150 //------------------------------
151 // World
152 //------------------------------
153
154 Double_t halfWorldLength = 0.5 * fWorldLength;
155
156 Double_t world[3];
157 world[0] = halfWorldLength;
158 world[1] = halfWorldLength;
159 world[2] = halfWorldLength;
160 TGeoVolume* top = gGeoManager->Volume("WRLD", "BOX", fImedAir, world, 3);
161 gGeoManager->SetTopVolume(top);
162
163 //------------------------------
164 // Target
165 //------------------------------
166
167 Double_t target[3];
168 target[0] = targetSize;
169 target[1] = targetSize;
170 target[2] = targetSize;
171 gGeoManager->Volume("TARG", "BOX", targetMater, target, 3);
172
173 Double_t posX = 0.;
174 Double_t posY = 0.;
175 Double_t posZ = -(targetSize + trackerSize);
176 gGeoManager->Node("TARG", 1, "WRLD", posX, posY, posZ, 0, kTRUE, ubuf);
177
178 cout << "Target is " << fTargetLength
179 << " cm"
180 //<< " of " << TargetMater->GetName()
181 << " of lead " << endl;
182
183 //------------------------------
184 // Tracker
185 //------------------------------
186
187 Double_t tracker[3];
188 tracker[0] = trackerSize;
189 tracker[1] = trackerSize;
190 tracker[2] = trackerSize;
191 gGeoManager->Volume("TRAK", "BOX", fImedAir, tracker, 3);
192
193 posX = 0.;
194 posY = 0.;
195 posZ = 0.;
196 gGeoManager->Node("TRAK", 1, "WRLD", posX, posY, posZ, 0, kTRUE, ubuf);
197
198 //------------------------------
199 // Tracker segments
200 //------------------------------
201 //
202 // An example of Parameterised volumes
203 // dummy values for G4Box -- modified by parameterised volume
204 // - implemented using Gsposp
205
206 Double_t chamber[3];
207 chamber[0] = -1;
208 chamber[1] = -1;
209 chamber[2] = -1;
210 gGeoManager->Volume("CHMB", "BOX", chamberMater, chamber, 0);
211
212 Double_t firstPosition = -trackerSize + 0.5 * fChamberWidth;
213 Double_t firstLength = fTrackerLength / 10;
214 Double_t lastLength = fTrackerLength;
215 Ex02ChamberParameterisation* chamberParam =
217 firstPosition, // Z of center of first
218 fChamberSpacing, // Z spacing of centers
219 fChamberWidth, // Width Chamber
220 firstLength, // lengthInitial
221 lastLength); // lengthFinal
222 for (Int_t i = 0; i < fNofChambers; i++) {
223 Double_t pos[3];
224 Double_t dim[3];
225 chamberParam->ComputeTransformation(i, pos);
226 chamberParam->ComputeDimensions(i, dim);
227 gGeoManager->Node(
228 "CHMB", i, "TRAK", pos[0], pos[1], pos[2], 0, kTRUE, dim, 3);
229 }
230
231 cout << "There are " << fNofChambers << " chambers in the tracker region. "
232 << "The chambers are " << fChamberWidth * 10.
233 << " mm of "
234 //<< ChamberMater->GetName()
235 << "Xenon gas"
236 << "\n The distance between chamber is " << fChamberSpacing << " cm"
237 << endl;
238
239 // close geometry
240 gGeoManager->CloseGeometry();
241
242 // notify VMC about Root geometry
243 gMC->SetRootGeometry();
244
245 //------------------------------------------------
246 // Sensitive detectors
247 //------------------------------------------------
248 /*
249
250 G4SDManager* SDman = G4SDManager::GetSDMpointer();
251
252 G4String trackerChamberSDname = "ExN02/TrackerChamberSD";
253 ExN02TrackerSD* aTrackerSD = new ExN02TrackerSD( trackerChamberSDname );
254 SDman->AddNewDetector( aTrackerSD );
255 logicChamber->SetSensitiveDetector( aTrackerSD );
256 */
257
258 //--------- Visualization attributes -------------------------------
259 /*
260 G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
261 logicWorld ->SetVisAttributes(BoxVisAtt);
262 logicTarget ->SetVisAttributes(BoxVisAtt);
263 logicTracker->SetVisAttributes(BoxVisAtt);
264
265 G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
266 logicChamber->SetVisAttributes(ChamberVisAtt);
267 */
268 //--------- example of User Limits -------------------------------
269
270 // below is an example of how to set tracking constraints in a given
271 // logical volume(see also in N02PhysicsList how to setup the process
272 // G4UserSpecialCuts).
273 // Sets a max Step length in the tracker region
274 // Double_t maxStep = 0.5*fChamberWidth, maxLength = 2*fTrackerLength;
275 // Double_t maxTime = 0.1*ns, minEkin = 10*MeV;
276 // logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
277 // minEkin));
278}
The chamber parameterisation.
void ComputeTransformation(Int_t copyNo, Double_t *position) const
void ComputeDimensions(Int_t copyNo, Double_t *dimension) const

◆ SetTargetMaterial()

void Ex02DetectorConstruction::SetTargetMaterial ( const TString & name)

Set target material (not available with VMC)

Definition at line 281 of file Ex02DetectorConstruction.cxx.

283{
284 /// Set target material (not available with VMC)
285
286 Warning("SetTargetMaterial", "Not available in virtual Monte Carlo");
287}

◆ SetChamberMaterial()

void Ex02DetectorConstruction::SetChamberMaterial ( const TString & name)

Set chamber material (not available with VMC)

Definition at line 290 of file Ex02DetectorConstruction.cxx.

292{
293 /// Set chamber material (not available with VMC)
294
295 Warning("SetTargetMaterial", "Not available in virtual Monte Carlo");
296}

◆ GetTrackerFullLength()

Double_t Ex02DetectorConstruction::GetTrackerFullLength ( )
inline
Returns
The tracker full length

Definition at line 46 of file Ex02DetectorConstruction.h.

46{ return fTrackerLength; };

◆ GetTargetFullLength()

Double_t Ex02DetectorConstruction::GetTargetFullLength ( )
inline
Returns
The target full length

Definition at line 48 of file Ex02DetectorConstruction.h.

48{ return fTargetLength; };

◆ GetWorldFullLength()

Double_t Ex02DetectorConstruction::GetWorldFullLength ( )
inline
Returns
The world full length

Definition at line 50 of file Ex02DetectorConstruction.h.

50{ return fWorldLength; };

Member Data Documentation

◆ fWorldLength

Double_t Ex02DetectorConstruction::fWorldLength
private

Full length of the world volume.

Definition at line 53 of file Ex02DetectorConstruction.h.

◆ fTargetLength

Double_t Ex02DetectorConstruction::fTargetLength
private

Full length of Target.

Definition at line 54 of file Ex02DetectorConstruction.h.

◆ fTrackerLength

Double_t Ex02DetectorConstruction::fTrackerLength
private

Full length of Tracker.

Definition at line 55 of file Ex02DetectorConstruction.h.

◆ fNofChambers

Int_t Ex02DetectorConstruction::fNofChambers
private

Nb of chambers in the tracker region.

Definition at line 56 of file Ex02DetectorConstruction.h.

◆ fChamberWidth

Double_t Ex02DetectorConstruction::fChamberWidth
private

Width of the chambers.

Definition at line 57 of file Ex02DetectorConstruction.h.

◆ fChamberSpacing

Double_t Ex02DetectorConstruction::fChamberSpacing
private

Distance between chambers.

Definition at line 58 of file Ex02DetectorConstruction.h.

◆ fImedAir

Int_t Ex02DetectorConstruction::fImedAir
private

The Air medium Id.

Definition at line 59 of file Ex02DetectorConstruction.h.

◆ fImedPb

Int_t Ex02DetectorConstruction::fImedPb
private

The Lead medium Id.

Definition at line 60 of file Ex02DetectorConstruction.h.

◆ fImedXe

Int_t Ex02DetectorConstruction::fImedXe
private

The Xenon gas medium Id.

Definition at line 61 of file Ex02DetectorConstruction.h.


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