Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F03DetectorConstruction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 /// \file field/field03/src/F03DetectorConstruction.cc
27 /// \brief Implementation of the F03DetectorConstruction class
28 //
29 //
30 // $Id: F03DetectorConstruction.cc 77655 2013-11-27 08:51:59Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
37 #include "F03DetectorMessenger.hh"
38 
39 #include "F03CalorimeterSD.hh"
40 #include "F03FieldSetup.hh"
41 
42 #include "G4GeometryManager.hh"
43 #include "G4PhysicalVolumeStore.hh"
44 #include "G4LogicalVolumeStore.hh"
45 #include "G4SolidStore.hh"
46 
47 #include "G4Material.hh"
48 #include "G4Tubs.hh"
49 #include "G4LogicalVolume.hh"
50 #include "G4PVPlacement.hh"
51 #include "G4RunManager.hh"
52 #include "G4AutoDelete.hh"
53 
54 #include "G4PhysicalConstants.hh"
55 #include "G4SystemOfUnits.hh"
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
61  fDetectorMessenger(0),
62  fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
63  fSolidAbsorber(0), fLogicAbsorber(0), fPhysiAbsorber(0),
64  fSolidRadSlice(0), fLogicRadSlice(0), fPhysiRadSlice(0),
65  fSolidRadiator(0), fLogicRadiator(0), fPhysiRadiator(0),
66  fWorldMaterial(0), fAbsorberMaterial(0), fRadiatorMat(0),
67  // default parameter values of the calorimeter
68  fWorldSizeR( 22000.*mm),
69  fWorldSizeZ( 44000.*mm),
70  fAbsorberThickness( 1.*mm),
71  fAbsorberRadius( 20000.*mm),
72  fZAbsorber( 21990.*mm),
73  fZStartAbs( 0.),
74  fZEndAbs( 0.),
75  fRadThickness( 100.*mm),
76  fGasGap( 100.*mm),
77  fDetGap( 1.*mm),
78  fFoilNumber(1)
79 {
80  fDetectorMessenger = new F03DetectorMessenger(this);
81 
82  // create materials
83 
84  DefineMaterials();
85 
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 
91 {
92  delete fDetectorMessenger;
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96 
98 {
99  return ConstructCalorimeter();
100 }
101 
102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103 
104 void F03DetectorConstruction::DefineMaterials()
105 {
106  //This function illustrates the possible ways to define materials
107 
108  G4String name, symbol; // a=mass of a mole;
109  G4double a, z, density; // z=mean number of protons;
110  G4int nel;
111  G4int ncomponents;
112  G4double fractionmass, pressure, temperature;
113 
114  //
115  // define Elements
116  //
117 
118  a = 1.01*g/mole;
119  G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
120 
121  a = 12.01*g/mole;
122  G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a);
123 
124  a = 14.01*g/mole;
125  G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
126 
127  a = 16.00*g/mole;
128  G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
129 
130  a = 39.948*g/mole;
131  G4Element* elAr = new G4Element(name="Argon", symbol="Ar", z=18., a);
132 
133  //
134  // define simple materials
135  //
136 
137  // Mylar
138 
139  density = 1.39*g/cm3;
140  G4Material* mylar = new G4Material(name="Mylar", density, nel=3);
141  mylar->AddElement(elO,2);
142  mylar->AddElement(elC,5);
143  mylar->AddElement(elH,4);
144 
145  // Polypropelene
146 
147  G4Material* CH2 = new G4Material ("Polypropelene" , 0.91*g/cm3, 2);
148  CH2->AddElement(elH,2);
149  CH2->AddElement(elC,1);
150 
151  // Krypton as detector gas, STP
152 
153  density = 3.700*mg/cm3;
154  a = 83.80*g/mole;
155  G4Material* Kr = new G4Material(name="Kr",z=36., a, density );
156 
157  // Dry air (average composition)
158 
159  density = 1.7836*mg/cm3; // STP
160  G4Material* argon = new G4Material(name="Argon" , density, ncomponents=1);
161  argon->AddElement(elAr, 1);
162 
163  density = 1.25053*mg/cm3; // STP
164  G4Material* nitrogen = new G4Material(name="N2" , density, ncomponents=1);
165  nitrogen->AddElement(elN, 2);
166 
167  density = 1.4289*mg/cm3; // STP
168  G4Material* oxygen = new G4Material(name="O2" , density, ncomponents=1);
169  oxygen->AddElement(elO, 2);
170 
171  density = 1.2928*mg/cm3; // STP
172  density *= 1.0e-8; // pumped vacuum
173  temperature = STP_Temperature;
174  pressure = 1.0e-8*STP_Pressure;
175 
176  G4Material* air = new G4Material(name="Air" , density, ncomponents=3,
177  kStateGas,temperature,pressure);
178  air->AddMaterial( nitrogen, fractionmass = 0.7557 );
179  air->AddMaterial( oxygen, fractionmass = 0.2315 );
180  air->AddMaterial( argon, fractionmass = 0.0128 );
181 
182  // Xenon as detector gas, STP
183 
184  density = 5.858*mg/cm3;
185  a = 131.29*g/mole;
186  G4Material* Xe = new G4Material(name="Xenon",z=54., a, density );
187 
188  // Carbon dioxide, STP
189 
190  density = 1.842*mg/cm3;
191  G4Material* CarbonDioxide = new G4Material(name="CO2", density, nel=2);
192  CarbonDioxide->AddElement(elC,1);
193  CarbonDioxide->AddElement(elO,2);
194 
195  // 80% Xe + 20% CO2, STP
196 
197  density = 5.0818*mg/cm3;
198  G4Material* Xe20CO2 = new G4Material(name="Xe20CO2", density, ncomponents=2);
199  Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 );
200  Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 );
201 
202  // 80% Kr + 20% CO2, STP
203 
204  density = 3.601*mg/cm3;
205  G4Material* Kr20CO2 = new G4Material(name="Kr20CO2", density, ncomponents=2);
206  Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 );
207  Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 );
208 
210 
211  //default materials of the calorimeter and TR radiator
212 
213  fRadiatorMat = air; // CH2 ; // mylar;
214 
215  fAbsorberMaterial = air; // Kr20CO2; // XeCO2CF4;
216 
217  fWorldMaterial = air;
218 }
219 
220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
221 
222 G4VPhysicalVolume* F03DetectorConstruction::ConstructCalorimeter()
223 {
224  // Cleanup old geometry
225 
226  if (fPhysiWorld)
227  {
232  }
233 
234  // complete the Calor parameters definition and Print
235 
236  ComputeCalorParameters();
238 
239  fSolidWorld = new G4Tubs("World", // its name
240  0.,fWorldSizeR,fWorldSizeZ/2.,0.,twopi);// its size
241 
242  fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid
243  fWorldMaterial, // its material
244  "World"); // its name
245 
246  fPhysiWorld = new G4PVPlacement(0, // no rotation
247  G4ThreeVector(), // at (0,0,0)
248  "World", // its name
249  fLogicWorld, // its logical volume
250  0, // its mother volume
251  false, // no boolean op.
252  0); // copy number
253 
254  // TR radiator envelope
255 
256  G4double radThick = fFoilNumber*(fRadThickness + fGasGap) + fDetGap;
257 
258  G4double zRad = fZAbsorber - 20*cm - 0.5*radThick;
259  G4cout << "zRad = " << zRad/mm << " mm" << G4endl;
260 
261  radThick *= 1.02;
262  G4cout << "radThick = " << radThick/mm << " mm" << G4endl;
263  G4cout << "fFoilNumber = " << fFoilNumber << G4endl;
264  G4cout << "fRadiatorMat = " << fRadiatorMat->GetName() << G4endl;
265  G4cout << "WorldMaterial = " << fWorldMaterial->GetName() << G4endl;
266 
267  fSolidRadiator = new G4Tubs("Radiator",0.0,
268  1.01*fAbsorberRadius,
269  0.5*radThick,0.0, twopi);
270 
271  fLogicRadiator = new G4LogicalVolume(fSolidRadiator,
272  fWorldMaterial,
273  "Radiator");
274 
275  fPhysiRadiator = new G4PVPlacement(0,
276  G4ThreeVector(0,0,zRad),
277  "Radiator", fLogicRadiator,
278  fPhysiWorld, false, 0);
279 
280  fSolidRadSlice = new G4Tubs("RadSlice",0.0,
281  fAbsorberRadius,0.5*fRadThickness,0.0,twopi);
282 
283  fLogicRadSlice = new G4LogicalVolume(fSolidRadSlice,fRadiatorMat,
284  "RadSlice",0,0,0);
285 
286  G4double zModule, zRadiator;
287  zModule = zRad + 0.5*radThick/1.02;
288  G4cout << "zModule = " << zModule/mm << " mm" << G4endl;
289 
290  for (G4int j=0;j<fFoilNumber;j++)
291  {
292  zRadiator = zModule - j*(fRadThickness + fGasGap);
293  G4cout << zRadiator/mm << " mm" << "\t";
294  // G4cout << "j = " << j << "\t";
295 
296  fPhysiRadSlice = new G4PVPlacement(0,G4ThreeVector(0.,0.,zRadiator-zRad),
297  "RadSlice",fLogicRadSlice,
298  fPhysiRadiator,false,j);
299  }
300  G4cout << G4endl;
301 
302  // Absorber
303 
304  fSolidAbsorber = new G4Tubs("Absorber", 1.0*mm,
305  fAbsorberRadius,
306  fAbsorberThickness/2.,
307  0.0,twopi);
308 
309  fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber,
310  fAbsorberMaterial,
311  "Absorber");
312 
313  fPhysiAbsorber = new G4PVPlacement(0,
314  G4ThreeVector(0.,0.,fZAbsorber),
315  "Absorber",
316  fLogicAbsorber,
317  fPhysiWorld,
318  false,
319  0);
320 
321  return fPhysiWorld;
322 }
323 
324 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
325 
327 {
328  G4cout << "\n The WORLD is made of "
329  << fWorldSizeZ/mm << "mm of " << fWorldMaterial->GetName();
330  G4cout << ", the transverse size (R) of the world is "
331  << fWorldSizeR/mm << " mm. " << G4endl;
332  G4cout << " The ABSORBER is made of "
333  << fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName();
334  G4cout << ", the transverse size (R) is " << fAbsorberRadius/mm
335  << " mm. " << G4endl;
336  G4cout << " Z position of the (middle of the) absorber "
337  << fZAbsorber/mm << " mm." << G4endl;
338  G4cout << G4endl;
339 }
340 
341 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
342 
344 {
345  // get the pointer to the material table
346  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
347 
348  // search the material by its name
350  for (size_t j=0 ; j<theMaterialTable->size() ; j++)
351  { material = (*theMaterialTable)[j];
352  if (material->GetName() == materialChoice)
353  {
354  fAbsorberMaterial = material;
355  fLogicAbsorber->SetMaterial(material);
357  }
358  }
359 }
360 
361 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
362 
364 {
365  // get the pointer to the material table
366  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
367 
368  // search the material by its name
370  for (size_t j=0 ; j<theMaterialTable->size() ; j++)
371  { material = (*theMaterialTable)[j];
372  if(material->GetName() == materialChoice)
373  {
374  fWorldMaterial = material;
375  fLogicWorld->SetMaterial(material);
377  }
378  }
379 }
380 
381 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
382 
384 {
385  // change Absorber thickness and recompute the calorimeter parameters
386  fAbsorberThickness = val;
387  ComputeCalorParameters();
389 }
390 
391 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
392 
394 {
395  // change the transverse size and recompute the calorimeter parameters
396  fAbsorberRadius = val;
397  ComputeCalorParameters();
399 }
400 
401 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
402 
404 {
405  fWorldSizeZ = val;
406  ComputeCalorParameters();
408 }
409 
410 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
411 
413 {
414  fWorldSizeR = val;
415  ComputeCalorParameters();
417 }
418 
419 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
420 
422 {
423  fZAbsorber = val;
424  ComputeCalorParameters();
426 }
427 
428 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
429 
431 {
432  // Sensitive Detectors: Absorber
433 
434  if (!fCalorimeterSD.Get()) {
435  F03CalorimeterSD* calorimeterSD = new F03CalorimeterSD("CalorSD",this);
436  fCalorimeterSD.Put(calorimeterSD);
437  }
438  SetSensitiveDetector(fLogicAbsorber, fCalorimeterSD.Get());
439 
440  // Construct the field creator - this will register the field it creates
441 
442  if (!fEmFieldSetup.Get()) {
443  F03FieldSetup* emFieldSetup = new F03FieldSetup();
444 
445  fEmFieldSetup.Put(emFieldSetup);
446  G4AutoDelete::Register(emFieldSetup); //Kernel will delete the messenger
447  }
448  // Set local field manager and local field in radiator and its daughters:
449  G4bool allLocal = true;
450  fLogicRadiator->SetFieldManager(fEmFieldSetup.Get()->GetLocalFieldManager(),
451  allLocal );
452 }
453 
454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4FieldManager * GetLocalFieldManager()
G4String symbol
Definition: TRTMaterials.hh:40
CLHEP::Hep3Vector G4ThreeVector
void AddMaterial(G4Material *material, G4double fraction)
Definition: G4Material.cc:450
G4double z
Definition: TRTMaterials.hh:39
const G4String & GetName() const
Definition: G4Material.hh:176
value_type & Get() const
Definition: G4Cache.hh:253
Definition: G4Tubs.hh:84
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
G4Element * elC
Definition: TRTMaterials.hh:48
std::vector< G4Material * > G4MaterialTable
static void Clean()
Definition: G4SolidStore.cc:79
const XML_Char * name
float STP_Temperature
Definition: hepunit.py:302
int G4int
Definition: G4Types.hh:78
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters)
G4Element * elN
Definition: TRTMaterials.hh:44
Definition of the F03DetectorConstruction class.
G4Element * elH
Definition: TRTMaterials.hh:50
static G4PhysicalVolumeStore * GetInstance()
string material
Definition: eplot.py:19
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
void Register(T *inst)
Definition: G4AutoDelete.hh:65
G4GLOB_DLL std::ostream G4cout
G4Element * elO
Definition: TRTMaterials.hh:46
void PhysicsHasBeenModified()
bool G4bool
Definition: G4Types.hh:79
static G4LogicalVolumeStore * GetInstance()
static G4SolidStore * GetInstance()
static G4GeometryManager * GetInstance()
Definition of the F03CalorimeterSD class.
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
#define G4endl
Definition: G4ios.hh:61
Definition of the F03DetectorMessenger class.
void OpenGeometry(G4VPhysicalVolume *vol=0)
virtual G4VPhysicalVolume * Construct()
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:345
double G4double
Definition: G4Types.hh:76
void SetMaterial(G4Material *pMaterial)
Definition of the F03FieldSetup class.
void Put(const value_type &val) const
Definition: G4Cache.hh:257
G4int nel
Definition: TRTMaterials.hh:41
int STP_Pressure
Definition: hepunit.py:303