Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExErrorDetectorConstruction.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 //
28 
29 
32 #include "ExErrorMagneticField.hh"
33 
34 #include "G4NistManager.hh"
35 #include "G4Box.hh"
36 #include "G4LogicalVolume.hh"
37 #include "G4PVPlacement.hh"
38 #include "G4PVReplica.hh"
39 
40 #include "G4UserLimits.hh"
41 #include "G4VisAttributes.hh"
42 
43 #include "G4Colour.hh"
44 
45 #include "G4SystemOfUnits.hh"
46 #include "G4ios.hh"
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50  : fXBEAM(5.*cm), fXCDET(20.*cm), fXECAL(40.*cm), fXSOLN(10.*cm), fXHCAL(100.*cm),
51  fXMUON(50.*cm), fNdivECAL(40./10.), fNdivHCAL(100./10.), fYZLength(50.*cm),
52  fXHalfWorldLength(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL + fXMUON)
53 {
54 
55  // create UserLimits
56  fUserLimits = new G4UserLimits();
57 
59  fDetectorMessenger = new ExErrorDetectorMessenger(this);
60 
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 {
66  delete fMagField;
67  delete fDetectorMessenger;
68 }
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 {
73 //--------- Material definition ---------
74 
75  //Vacuum
76  /* a = 1.*g/mole;
77  density = 1.E-9*g/cm3;
78  G4Material* Vacuum = new G4Material(name="Vacuum", z=1., a, density);
79  */
80 
82  G4Material* air = nistMgr->FindOrBuildMaterial("G4_AIR");
83  //Al
84  G4Material* al = nistMgr->FindOrBuildMaterial("G4_Al");
85  //Fe
86  G4Material* fe = nistMgr->FindOrBuildMaterial("G4_Fe");
87  //Cu
88  G4Material* cu = nistMgr->FindOrBuildMaterial("G4_Cu");
89 
90  // Print all the materials defined.
91  //
92  G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
93  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
94 
95  //--------- Sizes of the principal geometrical components (solids) --------- (half lengths)
96  //double fXBEAM = 5.*2.*cm;
97  //double fXCDET = 90.*cm;
98  //double fXECAL = 40.*cm;
99  //double fXSOLN = 10.*cm;
100  //double fXHCAL = 100.*cm;
101  //double fXMUON = 50.*cm;
102  //double fNdivECAL = 10;
103  //double fNdivHCAL = 10;
104  //double fYZLength = 100.*cm;
105 
106  // double fXWorldLength= fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL + fXMUON;
107 
108 
109 //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
110 
111  //------------------------------
112  // World
113  //------------------------------
114  //- G4double HalfWorldLength = fXWorldLength;
115  G4cout << " HalfWorldLength " << fXHalfWorldLength << G4endl;
116 
117  G4Box* solidWorld= new G4Box("world",fXHalfWorldLength,fYZLength,fYZLength);
118  G4LogicalVolume* logicWorld= new G4LogicalVolume( solidWorld, air, "World", 0, 0, 0);
119  // Must place the World Physical volume unrotated at (0,0,0).
120  //
121  G4VPhysicalVolume* physiWorld
122  = new G4PVPlacement(0, // no rotation
123  G4ThreeVector(), // at (0,0,0)
124  "World", // its name
125  logicWorld, // its logical volume
126  0, // its mother volume
127  false, // no boolean operations
128  0); // no field specific to volum
129 
130  //------------------------------
131  // BEAM
132  //------------------------------
133  G4Box* solidBEAM = new G4Box("BEAM",fXBEAM,fYZLength,fYZLength);
134  G4LogicalVolume* logicBEAM = new G4LogicalVolume(solidBEAM,air,"BEAM",0,0,0);
135  G4ThreeVector positionBEAM = G4ThreeVector(0.,0.,0.);
136  //G4VPhysicalVolume* physiBEAM =
137  new G4PVPlacement(0, // no rotation
138  positionBEAM, // at (x,y,z)
139  "BEAM", // its name
140  logicBEAM, // its logical volume
141  physiWorld, // its mother volume
142  false, // no boolean operations
143  0); // no particular field
144 
145  //------------------------------
146  // CDET (Central DETector)
147  //------------------------------
148  G4ThreeVector positionCdet = G4ThreeVector(fXBEAM + fXCDET/2.,0.,0.);
149  G4Box* solidCDET = new G4Box("CDET",fXCDET/2.,fYZLength,fYZLength);
150  G4LogicalVolume* logicCDET = new G4LogicalVolume(solidCDET,air,"Cdet",0,0,0);
151  // G4VPhysicalVolume* physiCDET =
152  new G4PVPlacement(0, // no rotation
153  positionCdet, // at (x,y,z)
154  "CDET", // its name
155  logicCDET, // its logical volume
156  physiWorld, // its mother volume
157  false, // no boolean operations
158  0); // no particular field
159 
160  //------------------------------
161  // ECAL
162  //------------------------------
163  G4ThreeVector positionECAL = G4ThreeVector(fXBEAM + fXCDET + fXECAL/2., 0., 0.);
164  G4Box* solidECAL = new G4Box("ECAL",fXECAL/2.,fYZLength,fYZLength);
165  G4LogicalVolume* logicECAL = new G4LogicalVolume(solidECAL,cu,"ECAL",0,0,0);
166  G4VPhysicalVolume* physiECAL
167  = new G4PVPlacement(0, // no rotation
168  positionECAL, // at (x,y,z)
169  "ECAL", // its name
170  logicECAL, // its logical volume
171  physiWorld, // its mother volume
172  false, // no boolean operations
173  0); // no particular field
174  //--------- Divide it
175  G4Box* solidECALdiv = new G4Box("ECAL",fXECAL/2./fNdivECAL,fYZLength,fYZLength);
176  G4LogicalVolume* logicECALdiv = new G4LogicalVolume(solidECALdiv,cu,"ECALdiv",0,0,0);
177  new G4PVReplica("DVEC", logicECALdiv, physiECAL,
178  kXAxis, G4int(fNdivECAL), fXECAL/fNdivECAL);
179 
180 
181  //------------------------------
182  // SOLN
183  //------------------------------
184  G4ThreeVector positionSOLN = G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN/2., 0., 0.);
185  G4Box* solidSOLN = new G4Box("SOLN",fXSOLN/2.,fYZLength,fYZLength);
186  G4LogicalVolume* logicSOLN = new G4LogicalVolume(solidSOLN,al,"SOLN",0,0,0);
187  new G4PVPlacement(0, // no rotation
188  positionSOLN, // at (x,y,z)
189  "SOLN", // its name
190  logicSOLN, // its logical volume
191  physiWorld, // its mother volume
192  false, // no boolean operations
193  0); // no particular field
194 
195  //------------------------------
196  // HCAL
197  //------------------------------
198  G4ThreeVector positionHCAL = G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL/2., 0., 0.);
199  G4Box* solidHCAL = new G4Box("HCAL",fXHCAL/2.,fYZLength,fYZLength);
200  G4LogicalVolume* logicHCAL = new G4LogicalVolume(solidHCAL,fe,"HCAL",0,0,0);
201  G4VPhysicalVolume* physiHCAL
202  = new G4PVPlacement(0, // no rotation
203  positionHCAL, // at (x,y,z)
204  "HCAL", // its name
205  logicHCAL, // its logical volume
206  physiWorld, // its mother volume
207  false, // no boolean operations
208  0); // no particular field
209  //--------- Divide it
210  G4Box* solidHCALdiv = new G4Box("HCAL",fXHCAL/2./fNdivHCAL,fYZLength,fYZLength);
211  G4LogicalVolume* logicHCALdiv = new G4LogicalVolume(solidHCALdiv,fe,"HCALdiv",0,0,0);
212  new G4PVReplica("DVEH", logicHCALdiv, physiHCAL,
213  kXAxis, G4int(fNdivHCAL), fXHCAL/fNdivHCAL);
214 
215  //------------------------------
216  // MUON
217  //------------------------------
218  G4ThreeVector positionMUON = G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL + fXMUON/2., 0., 0.);
219  G4Box* solidMUON = new G4Box("MUON",fXMUON/2.,fYZLength,fYZLength);
220  G4LogicalVolume* logicMUON = new G4LogicalVolume(solidMUON,air,"MUON",0,0,0);
221  new G4PVPlacement(0, // no rotation
222  positionMUON, // at (x,y,z)
223  "MUON", // its name
224  logicMUON, // its logical volume
225  physiWorld, // its mother volume
226  false, // no boolean operations
227  0); // no particular field
228 
229 
230  G4VisAttributes* worldVisAtt = new G4VisAttributes(0);
231  logicWorld->SetVisAttributes( worldVisAtt);
232  return physiWorld;
233 }
234 
235 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
237 {
238  fMagField->SetFieldValue(fieldValue);
239 }
240