VMC Examples Version 6.6
Loading...
Searching...
No Matches
VMC::Gflash::DetectorConstruction Class Reference

The detector construction (via TGeo ) More...

#include <DetectorConstruction.h>

Inheritance diagram for VMC::Gflash::DetectorConstruction:

Public Member Functions

 DetectorConstruction ()
 
virtual ~DetectorConstruction ()
 
void Construct ()
 

Detailed Description

The detector construction (via TGeo )

Geant4 gflash example adapted to Virtual Monte Carlo.

Author
I. Hrivnacova; IPN, Orsay

Definition at line 39 of file DetectorConstruction.h.

Constructor & Destructor Documentation

◆ DetectorConstruction()

VMC::Gflash::DetectorConstruction::DetectorConstruction ( )

Default constuctor

Definition at line 42 of file DetectorConstruction.cxx.

42 : TObject()
43 {
44 /// Default constuctor
45 }

◆ ~DetectorConstruction()

VMC::Gflash::DetectorConstruction::~DetectorConstruction ( )
virtual

Destructor

Definition at line 48 of file DetectorConstruction.cxx.

49 {
50 /// Destructor
51 }

Member Function Documentation

◆ Construct()

void VMC::Gflash::DetectorConstruction::Construct ( )

Construct geometry using TGeo modeller

Definition at line 58 of file DetectorConstruction.cxx.

59 {
60 /// Construct geometry using TGeo modeller
61
62 // Create Root geometry manager
63 new TGeoManager("Gflash_geometry", "Gflash VMC example geometry");
64
65 // Elements
66 //
67 Double_t z, a;
68 TGeoElement* elN = new TGeoElement("Nitrogen", "N", z = 7., a = 14.01);
69 TGeoElement* elO = new TGeoElement("Oxygen", "O", z = 8., a = 16.00);
70 TGeoElement* elW = new TGeoElement("Tungsten", "W", z = 74., a = 183.84);
71 TGeoElement* elPb = new TGeoElement("Lead", "Pb", z = 82., a = 207.2);
72
73 // Materials
74 //
75 // G4_Air
76 Double_t density;
77 TGeoMixture* matAir = new TGeoMixture("AirA", 2, density = 1.29e-03);
78 matAir->AddElement(elN, 0.7);
79 matAir->AddElement(elO, 0.3);
80
81 // G4_Air
82 TGeoMixture* matAir2 = new TGeoMixture("AirB", 2, density = 1.29e-03);
83 matAir2->AddElement(elN, 0.7);
84 matAir2->AddElement(elO, 0.3);
85
86 // G4_PbWO4
87 TGeoMixture* matPbWO4 = new TGeoMixture("PbWO4", 3, density = 8.28);
88 matPbWO4->AddElement(elO, 4);
89 matPbWO4->AddElement(elW, 1);
90 matPbWO4->AddElement(elPb, 1);
91
92 // Tracking medias (defaut parameters)
93 //
94
95 // Paremeters for tracking media
96 Double_t param[20];
97 param[0] = 0; // isvol - Not used
98 param[1] = 2; // ifield - User defined magnetic field
99 param[2] = 10.; // fieldm - Maximum field value (in kiloGauss)
100 param[3] = -20.; // tmaxfd - Maximum angle due to field deflection
101 param[4] = -0.01; // stemax - Maximum displacement for multiple scat
102 param[5] = -.3; // deemax - Maximum fractional energy loss, DLS
103 param[6] = .001; // epsil - Tracking precision
104 param[7] = -.8; // stmin
105 for (Int_t i = 8; i < 20; ++i) param[i] = 0.;
106
107 Int_t mediumId = 0;
108 TGeoMedium* medAir = new TGeoMedium("AirA", ++mediumId, matAir, param);
109 TGeoMedium* medAir2 = new TGeoMedium("AirB", ++mediumId, matAir2, param);
110 TGeoMedium* medPbWO4 = new TGeoMedium("PbWO4", ++mediumId, matPbWO4, param);
111
112 // Volumes
113 //
114
115 // The Experimental Hall
116 Double_t experimentalHall_x = 1000.;
117 Double_t experimentalHall_y = 1000.;
118 Double_t experimentalHall_z = 1000.;
119
120 TGeoShape* experimentalHall_box = new TGeoBBox("expHall_box",
121 experimentalHall_x, // x size
122 experimentalHall_y, // y size
123 experimentalHall_z); // z size
124
125 TGeoVolume* experimentalHall_log =
126 new TGeoVolume("ExpHall_log", experimentalHall_box, medAir);
127 gGeoManager->SetTopVolume(experimentalHall_log);
128
129 //------------------------------
130 // Calorimeter segments
131 //------------------------------
132 // Simplified `CMS-like` PbWO4 crystal calorimeter
133
134 Int_t nbOfCrystals = 10; // this are the crystals PER ROW in this example
135 // cube of 10 x 10 crystals
136 // don't change it @the moment, since
137 // the readout in event action assumes this
138 // dimensions and is not automatically adapted
139 // in this version of the example :-(
140 Double_t crystalWidth = 3.;
141 Double_t crystalLenght = 24.;
142 Double_t calo_xside = (crystalWidth * nbOfCrystals) + 1.;
143 Double_t calo_yside = (crystalWidth * nbOfCrystals) + 1.;
144 Double_t calo_zside = crystalLenght;
145
146 TGeoShape* calo_box = new TGeoBBox("CMS_calorimeter", // its name
147 calo_xside / 2., // size
148 calo_yside / 2., calo_zside / 2.);
149 TGeoVolume* calo_log = new TGeoVolume("Calo_log", calo_box, medAir2);
150
151 Double_t Xpos = 0.0;
152 Double_t Ypos = 0.0;
153 Double_t Zpos = 100.0;
154
155 // TGeoRotation* rot = new TGeoRotation();
156 // rot->RotateY(-phi);
157 // !!! Different meaning of rotation in Root than in Geant4
158
159 experimentalHall_log->AddNode(
160 calo_log, 1, new TGeoTranslation(Xpos, Ypos, Zpos));
161
162 TGeoShape* crystal_box = new TGeoBBox(
163 "Crystal", crystalWidth / 2, crystalWidth / 2, crystalLenght / 2);
164 TGeoVolume* crystal_log =
165 new TGeoVolume("Crystal_log", crystal_box, medPbWO4);
166
167 for (Int_t i = 0; i < nbOfCrystals; i++) {
168 for (Int_t j = 0; j < nbOfCrystals; j++) {
169 Int_t n = i * nbOfCrystals + j;
170
171 Double_t crystalPos_x = (i * crystalWidth) - 13.5;
172 Double_t crystalPos_y = (j * crystalWidth) - 13.5;
173 Double_t crystalPos_z = 0;
174 calo_log->AddNode(crystal_log, n,
175 new TGeoTranslation(crystalPos_x, crystalPos_y, crystalPos_z));
176 }
177 }
178
179 // close geometry
180 gGeoManager->CloseGeometry();
181
182 // notify VMC about Root geometry
183 gMC->SetRootGeometry();
184
185 cout << "There are " << nbOfCrystals
186 << " crystals per row in the calorimeter, so in total "
187 << nbOfCrystals * nbOfCrystals << " crystals" << endl;
188 cout << "The have width of " << crystalWidth << " cm and a lenght of "
189 << crystalLenght << " cm. The Material is PbWO4" << endl;
190 }

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