ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DetectorConstruction.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 
29 #include "DetectorConstruction.hh"
30 #include "G4SystemOfUnits.hh"
31 #include "G4Region.hh"
32 #include "G4ProductionCuts.hh"
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 
37 :fPhysiWorld(NULL), fLogicWorld(NULL), fSolidWorld(NULL)
38 {}
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41 
43 {}
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46 
48 
49 {
51  return ConstructDetector();
52 }
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
55 
57 {
58 
59  // Silicon is defined from NIST material database
61  G4Material * Si = man->FindOrBuildMaterial("G4_Si");
62 
63  // Default materials in setup.
64  fSiMaterial = Si;
65 
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
70 {
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
73 
74  // WORLD VOLUME
75 
76  fWorldSizeX = 1*um;
77  fWorldSizeY = 1*um;
78  fWorldSizeZ = 1*um;
79 
80  fSolidWorld = new G4Box("World", //its name
81  fWorldSizeX/2,fWorldSizeY/2,fWorldSizeZ/2); //its size
82 
83 
84  fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
85  fSiMaterial, //its material
86  "World"); //its name
87 
88  fPhysiWorld = new G4PVPlacement(0, //no rotation
89  G4ThreeVector(), //at (0,0,0)
90  "World", //its name
91  fLogicWorld, //its logical volume
92  0, //its mother volume
93  false, //no boolean operation
94  0); //copy number
95 
96  G4double TargetSizeZ = 0.2*um;
97 
98  G4Box* targetSolid = new G4Box("Target", //its name
99  fWorldSizeX/2,fWorldSizeY/2,TargetSizeZ/2); //its size
100 
101 
102  G4LogicalVolume* logicTarget = new G4LogicalVolume(targetSolid, //its solid
103  fSiMaterial, //its material
104  "Target"); //its name
105 
106  new G4PVPlacement(0, //no rotation
107  G4ThreeVector(), //at (0,0,0)
108  "Target", //its name
109  logicTarget, //its logical volume
110  fPhysiWorld, //its mother volume
111  false, //no boolean operation
112  0); //copy number
113 
114  // Visualization attributes
115  G4VisAttributes* worldVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); //White
116  worldVisAtt->SetVisibility(true);
117  fLogicWorld->SetVisAttributes(worldVisAtt);
118 
119  G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
120  worldVisAtt1->SetVisibility(true);
121  logicTarget->SetVisAttributes(worldVisAtt1);
122 
123  // Create Target G4Region and add logical volume
124 
125  fRegion = new G4Region("Target");
126 
127  G4ProductionCuts* cuts = new G4ProductionCuts();
128 
129  G4double defCut = 1*nanometer;
130  cuts->SetProductionCut(defCut,"gamma");
131  cuts->SetProductionCut(defCut,"e-");
132  cuts->SetProductionCut(defCut,"e+");
133  cuts->SetProductionCut(defCut,"proton");
134 
135  fRegion->SetProductionCuts(cuts);
136  fRegion->AddRootLogicalVolume(logicTarget);
137 
138  return fPhysiWorld;
139 }