ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eRositaDetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file eRositaDetectorConstruction.cc
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 //
27 //
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 
32 #include "eRositaTrackerSD.hh"
33 
34 #include "G4PhysicalConstants.hh"
35 #include "G4SystemOfUnits.hh"
36 #include "G4Material.hh"
37 #include "G4Box.hh"
38 #include "G4LogicalVolume.hh"
39 #include "G4PVPlacement.hh"
40 #include "G4PVParameterised.hh"
41 #include "G4SDManager.hh"
42 #include "G4GeometryTolerance.hh"
43 #include "G4GeometryManager.hh"
44 
45 #include "G4UserLimits.hh"
46 
47 #include "G4VisAttributes.hh"
48 #include "G4Colour.hh"
49 
50 #include "G4ios.hh"
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55 
56 {
57 
58 }
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
63 {
64 
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70 {
71 //--------- Material definition ---------
72 
73  G4double a, z;
74  G4double density;
75 // G4int nel;
76 
77 // //Air
78 // G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
79 // G4Element* O = new G4Element("Oxygen" , "O", z=8., a= 16.00*g/mole);
80 
81 // G4Material* Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
82 // Air->AddElement(N, 70*perCent);
83 // Air->AddElement(O, 30*perCent);
84 
85  //Copper
86  G4Material* Cu =
87  new G4Material("Copper", z=29., a= 63.55*g/mole, density= 8.92*g/cm3);
88 
89 // //Aluminium for testing
90 // G4Material* Cu =
91 // new G4Material("Aluminium", z=13., a= 26.98*g/mole, density= 2.7*g/cm3);
92 
93  //Silicon
94  G4Material* Si =
95  new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
96 
97  // Vacuum
98  density = universe_mean_density; //from PhysicalConstants.h
99  G4double pressure = 3.e-18*pascal;
100  G4double temperature = 2.73*kelvin;
101  a = 1.01*g/mole;
102  z = 1;
103  vacuum = new G4Material("Galactic", z, a,
104  density, kStateGas, temperature, pressure);
105 
106  // Print all the materials defined.
107  //
108  G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
109  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
110 
111 //--------- Sizes of the principal geometrical components (solids) ---------
112 
113  // world volume
114  hWorldLength = 50.0*mm;
115 
116  // target
117  hTargetLength = 2.5*mm;
118  hTargetDepth = 15.0*mm;
119 
120  // CCD
121  hTrackerLength = 20.0*mm;
122  hTrackerDepth = 0.225*mm;
123 
124 //--------- positions of the principal geometrical components --------
125 
126  // target
127  xPosTarget = 0.0*cm;
128  yPosTarget = 0.0*cm;
129  zPosTarget = 0.0*cm;
130 
131  // tracker
132  xPosTracker = 0.0*cm;
133  yPosTracker = 2.0*cm;
134  zPosTracker = 0.0*cm;
135 
136 //--------- material names of the principal geometrical components --------
137 
138 // WorldMater = Air;
139  WorldMater = vacuum;
140  TargetMater = Cu;
141  TrackerMater = Si;
142 
143 //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
144 
145 
146  //------------------------------
147  // World
148  //------------------------------
149 
150  solidWorld= new G4Box("world",hWorldLength,hWorldLength,hWorldLength);
151  logicWorld= new G4LogicalVolume(solidWorld,WorldMater,"World",0,0,0);
152 
153  // Must place the World Physical volume unrotated at (0,0,0).
154  //
155  physiWorld = new G4PVPlacement(0, // no rotation
156  G4ThreeVector(), // at (0,0,0)
157  logicWorld, // its logical volume
158  "World", // its name
159  0, // its mother volume
160  false, // no boolean operations
161  0); // copy number
162 
163 
164  //------------------------------
165  // Target
166  //------------------------------
167 
168  G4ThreeVector positionTarget =
170 
172  logicTarget = new G4LogicalVolume(solidTarget,TargetMater,"Target",0,0,0);
173  physiTarget = new G4PVPlacement(0, // no rotation
174  positionTarget, // at (x,y,z)
175  logicTarget, // its logical volume
176  "Target", // its name
177  logicWorld, // its mother volume
178  false, // no boolean operations
179  0); // copy number
180 
181 
182  //------------------------------
183  // Tracker
184  //------------------------------
185 
186  G4ThreeVector positionTracker =
188 
189  solidTracker =
191  logicTracker =
192  new G4LogicalVolume(solidTracker,TrackerMater,"Tracker",0,0,0);
193  physiTracker = new G4PVPlacement(0, // no rotation
194  positionTracker, // at (x,y,z)
195  logicTracker, // its logical volume
196  "Tracker", // its name
197  logicWorld, // its mother volume
198  false, // no boolean operations
199  0); // copy number
200 
201 
202 
203 
204  //------------------------------------------------
205  // Sensitive detectors
206  //------------------------------------------------
207 
209 
210  G4String trackerChamberSDname = "eRosita/TrackerChamberSD";
211  eRositaTrackerSD* aTrackerSD = new eRositaTrackerSD( trackerChamberSDname );
212  SDman->AddNewDetector( aTrackerSD );
213  logicTracker->SetSensitiveDetector( aTrackerSD );
214 
215 
216 //--------- Visualization attributes -------------------------------
217 
218  // use this to make world volume invisible
219  visWorld = new G4VisAttributes();
220  visWorld->SetVisibility(false);
222 
223  // render target in redish color
224  visTarget = new G4VisAttributes();
225 // visTarget->SetColor(G4Color(1.0,0.3,0.3)); // redish
226  visTarget->SetColor(G4Color(1.0,1.0,1.0)); // black
228 
229  // render tracker in blueish color
230  visTracker = new G4VisAttributes();
231 // visTracker->SetColor(G4Color(0.3,0.3,1.0)); // blueish
232  visTracker->SetColor(G4Color(1.0,1.0,1.0)); // black
234 
235 
236 
237  return physiWorld;
238 }
239 
240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
241 /*
242 void eRositaDetectorConstruction::setTargetMaterial(G4String materialName)
243 {
244  // search the material by its name
245  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
246  if (pttoMaterial)
247  {TargetMater = pttoMaterial;
248  logicTarget->SetMaterial(pttoMaterial);
249  G4cout << "\n----> The target is " << fTargetLength/cm << " cm of "
250  << materialName << G4endl;
251  }
252 }
253 */
254