Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExGflashDetectorConstruction.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 // Created by Joanna Weng 26.11.2004
30 #include <iostream>
31 // G4 Classes
32 #include "globals.hh"
33 #include "G4ThreeVector.hh"
34 #include "G4PVPlacement.hh"
35 #include "G4VPhysicalVolume.hh"
36 #include "G4LogicalVolume.hh"
37 #include "G4VisAttributes.hh"
38 #include "G4Box.hh"
39 #include "G4SDManager.hh"
40 #include "G4Material.hh"
41 #include "G4GeometryManager.hh"
42 #include "G4PhysicalVolumeStore.hh"
43 #include "G4LogicalVolumeStore.hh"
44 #include "G4SolidStore.hh"
45 #include "G4Colour.hh"
46 #include "G4SystemOfUnits.hh"
47 
48 // User Classes
52 //fast simulation
55 #include "GFlashShowerModel.hh"
56 #include "GFlashHitMaker.hh"
57 #include "GFlashParticleBounds.hh"
58 
59 using namespace std;
60 
62 :m_experimentalHall_log(0),
63 m_calo_log(0),
64 m_experimentalHall_phys(0),
65 m_calo_phys(0)
66 {
67  G4cout<<"ExGflashDetectorConstruction::Detector constructor"<<G4endl;
68 
69  // Simplified `CMS-like` PbWO4 crystal calorimeter
70  m_calo_xside=31*cm;
71  m_calo_yside=31*cm;
72  m_calo_zside=24*cm;
73 
74  // GlashStuff
75  m_theParticleBounds = new GFlashParticleBounds(); // Energy Cuts to kill particles
76  m_theHMaker = new GFlashHitMaker(); // Makes the EnergieSpots
77 }
78 
79 
81 {
82 //@@@ ExGflashDetectorConstruction::Soll ich alles dlete
83  delete m_theParameterisation;
84  delete m_theParticleBounds;
85  delete m_theHMaker;
86  delete m_theFastShowerModel;
87 }
88 
89 
91 {
92  //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
93  G4String mat= "PbWO4";
94  G4cout<<"Defining the materials"<<G4endl;
96 
97  /*******************************
98  * The Experimental Hall *
99  *******************************/
100  m_experimentalHall_x=1000.*cm;
101  m_experimentalHall_y=1000.*cm;
102  m_experimentalHall_z=1000.*cm;
103 
104  m_experimentalHall_box = new G4Box("expHall_box", // World Volume
105  m_experimentalHall_x, // x size
106  m_experimentalHall_y, // y size
107  m_experimentalHall_z); // z size
108 
109  m_experimentalHall_log = new G4LogicalVolume(m_experimentalHall_box, //its solid
110  matManager->getMaterial("Air"), //its material
111  "expHall_log", // its name
112  0, //opt: fieldManager
113  0, //opt: SensitiveDetector
114  0); //opt: UserLimits
115  m_experimentalHall_phys = new G4PVPlacement(0, //no rotation
116  G4ThreeVector(), //at (0,0,0)
117  "expHall", //its name
118  m_experimentalHall_log, //its logical volume
119  0, //its mother volume
120  false, //no boolean operation
121  0); //copy number
122 
123 
124  //------------------------------
125  // Calorimeter segments
126  //------------------------------
127  // Simplified `CMS-like` PbWO4 crystal calorimeter
128 
129  m_NbOfCrystals = 10; // this are the crystals PER ROW in this example
130  // cube of 10 x 10 crystals
131  // don't change it @the moment, since
132  // the readout in event action assumes this
133  // dimensions and is not automatically adapted
134  // in this version of the example :-(
135  m_CrystalWidht = 3*cm;
136  m_CrystalLenght= 24*cm;
137  m_calo_xside=(m_CrystalWidht*m_NbOfCrystals)+1*cm;
138  m_calo_yside=(m_CrystalWidht*m_NbOfCrystals)+1*cm;;
139  m_calo_zside=m_CrystalLenght;
140 
141  G4Box *calo_box= new G4Box("CMS calorimeter", //its name
142  m_calo_xside/2., //size
143  m_calo_yside/2.,
144  m_calo_zside/2.);
145  m_calo_log = new G4LogicalVolume(calo_box, //its solid
146  matManager->getMaterial("Air"), //its material
147  "calo log", //its name
148  0, //opt: fieldManager
149  0, //opt: SensitiveDetector
150  0); //opt: UserLimit
151 
152  G4double Xpos = 0.0;
153  G4double Ypos = 0.0;
154  G4double Zpos = 100.0*cm;
155 
156  m_calo_phys = new G4PVPlacement(0, //no rotation
157  G4ThreeVector(Xpos,Ypos,Zpos), //at (0,0,0)
158  m_calo_log, //its logical volume
159  "calorimeter", //its name
160  m_experimentalHall_log, //its mother volume
161  false, //no boolean operation
162  1);
163  //Visibility
164  for (int i=0; i<m_NbOfCrystals;i++)
165  {
166 
167  for (int j=0; j<m_NbOfCrystals;j++)
168  {
169  int n = i*10+j;
170  m_crystal[n]= new G4Box("Crystal", //its name
171  m_CrystalWidht/2,m_CrystalWidht/2,m_CrystalLenght/2); //size
172  m_crystal_log[n] = new G4LogicalVolume(m_crystal[n], //its solid
173  matManager->getMaterial(mat), //its material
174  "Crystal_log"); //its name
175 
176  m_crystal_phys[n] = new G4PVPlacement(0, //no rotation
177  G4ThreeVector((i*m_CrystalWidht)-135,(j*m_CrystalWidht)-135,0 ), //at (0,0,0)
178  m_crystal_log[n], //its logical volume
179  "crystal", //its name
180  m_calo_log, //its mother volume
181  false, //no boolean operation
182  1); //Visibility
183  }
184  }
185  G4cout << "There are " << m_NbOfCrystals << " crystals per row in the calorimeter, so in total "<<
186  m_NbOfCrystals*m_NbOfCrystals << " crystals" << G4endl;
187  G4cout << "The have widthof " << m_CrystalWidht /cm << " cm and a lenght of " << m_CrystalLenght /cm
188  <<" cm. The Material is "<< matManager->getMaterial(mat) << G4endl;
189 
190  // Sensitive Detector part
193  new ExGflashSensitiveDetector("Calorimeter",this);
194  SDman->AddNewDetector(CaloSD);
195 
196  m_experimentalHall_log->SetVisAttributes(G4VisAttributes::Invisible);
197  G4VisAttributes* CaloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
198  G4VisAttributes* CrystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
199  m_calo_log->SetVisAttributes(CaloVisAtt);
200  for (int i=0; i<100;i++)
201  {
202  m_crystal_log[i]->SetVisAttributes(CrystalVisAtt);
203  m_crystal_log[i]->SetSensitiveDetector(CaloSD);
204  }
205  // define the parameterisation region
206  aRegion = new G4Region("crystals");
207  m_calo_log->SetRegion(aRegion);
208  aRegion->AddRootLogicalVolume(m_calo_log);
209 
210 
211  /**********************************************
212  * Initializing shower modell
213  ***********************************************/
214  G4cout<<"Shower parameterization"<<G4endl;
215  m_theFastShowerModel = new GFlashShowerModel("fastShowerModel",aRegion);
216  m_theParameterisation = new GFlashHomoShowerParameterisation(matManager->getMaterial(mat));
217  m_theFastShowerModel->SetParameterisation(*m_theParameterisation);
218  m_theFastShowerModel->SetParticleBounds(*m_theParticleBounds) ;
219  m_theFastShowerModel->SetHitMaker(*m_theHMaker);
220  G4cout<<"end shower parameterization"<<G4endl;
221  /**********************************************/
222 
223  return m_experimentalHall_phys;
224 }
225 
226 
227 
228 
229 
230 
231 
232 
233 
234 
235 
236 
237 
238