Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file RE06/src/RE06DetectorConstruction.cc 26 /// \file RE06/src/RE06DetectorConstruction.cc 27 /// \brief Implementation of the RE06DetectorC 27 /// \brief Implementation of the RE06DetectorConstruction class 28 // 28 // 29 // << 29 // $Id: RE06DetectorConstruction.cc 83381 2014-08-21 14:18:13Z gcosmo $ >> 30 // 30 31 31 #include "RE06DetectorConstruction.hh" 32 #include "RE06DetectorConstruction.hh" 32 33 33 #include "RE06DetectorMessenger.hh" << 34 #include "G4RunManager.hh" 34 #include "RE06ParallelWorld.hh" << 35 #include "RE06PrimaryGeneratorAction.hh" << 36 35 >> 36 #include "G4Material.hh" 37 #include "G4Box.hh" 37 #include "G4Box.hh" 38 #include "G4Colour.hh" << 39 #include "G4LogicalVolume.hh" 38 #include "G4LogicalVolume.hh" 40 #include "G4Material.hh" << 41 #include "G4MultiFunctionalDetector.hh" << 42 #include "G4PSEnergyDeposit.hh" << 43 #include "G4PSMinKinEAtGeneration.hh" << 44 #include "G4PSNofSecondary.hh" << 45 #include "G4PSNofStep.hh" << 46 #include "G4PSTrackLength.hh" << 47 #include "G4PVPlacement.hh" 39 #include "G4PVPlacement.hh" 48 #include "G4PVReplica.hh" 40 #include "G4PVReplica.hh" 49 #include "G4PhysicalConstants.hh" << 41 50 #include "G4RunManager.hh" << 42 #include "G4VisAttributes.hh" >> 43 #include "G4Colour.hh" >> 44 51 #include "G4SDManager.hh" 45 #include "G4SDManager.hh" 52 #include "G4SDParticleFilter.hh" << 46 #include "G4MultiFunctionalDetector.hh" 53 #include "G4SystemOfUnits.hh" << 54 #include "G4VPrimitiveScorer.hh" 47 #include "G4VPrimitiveScorer.hh" >> 48 #include "G4PSEnergyDeposit.hh" >> 49 #include "G4PSNofSecondary.hh" >> 50 #include "G4PSTrackLength.hh" >> 51 #include "G4PSNofStep.hh" >> 52 #include "G4PSMinKinEAtGeneration.hh" 55 #include "G4VSDFilter.hh" 53 #include "G4VSDFilter.hh" 56 #include "G4VisAttributes.hh" << 54 #include "G4SDParticleFilter.hh" 57 #include "G4ios.hh" 55 #include "G4ios.hh" 58 56 >> 57 #include "RE06DetectorMessenger.hh" >> 58 #include "RE06PrimaryGeneratorAction.hh" >> 59 #include "RE06ParallelWorld.hh" >> 60 >> 61 #include "G4PhysicalConstants.hh" >> 62 #include "G4SystemOfUnits.hh" >> 63 59 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 60 65 61 G4ThreadLocal G4bool RE06DetectorConstruction: 66 G4ThreadLocal G4bool RE06DetectorConstruction::fConstructedSDandField = false; 62 67 63 RE06DetectorConstruction::RE06DetectorConstruc 68 RE06DetectorConstruction::RE06DetectorConstruction() 64 : G4VUserDetectorConstruction(), << 69 : G4VUserDetectorConstruction(), 65 fNumberOfLayers(40), << 70 fNumberOfLayers(40), 66 fTotalThickness(2.0 * m), << 71 fTotalThickness (2.0*m), 67 fLayerThickness(0.), << 72 fLayerThickness(0.), 68 fConstructed(false), << 73 fConstructed(false), 69 fWorldMaterial(0), << 74 fWorldMaterial(0), 70 fAbsorberMaterial(0), << 75 fAbsorberMaterial(0), 71 fGapMaterial(0), << 76 fGapMaterial(0), 72 fLayerSolid(0), << 77 fLayerSolid(0), 73 fGapSolid(0), << 78 fGapSolid(0), 74 fWorldLogical(0), << 79 fWorldLogical(0), 75 fWorldPhysical(0), << 80 fWorldPhysical(0), 76 fSerial(false), << 81 fSerial(false), 77 fDetectorMessenger(0), << 82 fDetectorMessenger(0), 78 fVerboseLevel(1) << 83 fVerboseLevel(1) 79 { 84 { 80 fLayerThickness = fTotalThickness / fNumberO 85 fLayerThickness = fTotalThickness / fNumberOfLayers; 81 86 82 for (size_t i = 0; i < 3; i++) { << 87 for(size_t i=0;i<3;i++) >> 88 { 83 fCalorLogical[i] = 0; 89 fCalorLogical[i] = 0; 84 fLayerLogical[i] = 0; 90 fLayerLogical[i] = 0; 85 fGapLogical[i] = 0; 91 fGapLogical[i] = 0; 86 fCalorPhysical[i] = 0; 92 fCalorPhysical[i] = 0; 87 fLayerPhysical[i] = 0; 93 fLayerPhysical[i] = 0; 88 fGapPhysical[i] = 0; 94 fGapPhysical[i] = 0; 89 } 95 } 90 96 91 fCalName[0] = "Calor-A"; 97 fCalName[0] = "Calor-A"; 92 fCalName[1] = "Calor-B"; 98 fCalName[1] = "Calor-B"; 93 fCalName[2] = "Calor-C"; 99 fCalName[2] = "Calor-C"; 94 100 95 fDetectorMessenger = new RE06DetectorMesseng 101 fDetectorMessenger = new RE06DetectorMessenger(this); 96 } 102 } 97 103 98 //....oooOO0OOooo........oooOO0OOooo........oo 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 99 105 100 RE06DetectorConstruction::~RE06DetectorConstru 106 RE06DetectorConstruction::~RE06DetectorConstruction() 101 { << 107 { delete fDetectorMessenger;} 102 delete fDetectorMessenger; << 103 } << 104 108 105 G4VPhysicalVolume* RE06DetectorConstruction::C 109 G4VPhysicalVolume* RE06DetectorConstruction::Construct() 106 { 110 { 107 if (!fConstructed) { << 111 if(!fConstructed) >> 112 { 108 fConstructed = true; 113 fConstructed = true; 109 DefineMaterials(); 114 DefineMaterials(); 110 SetupGeometry(); 115 SetupGeometry(); 111 } 116 } 112 if (GetVerboseLevel() > 0) { << 117 if (GetVerboseLevel()>0) { 113 PrintCalorParameters(); 118 PrintCalorParameters(); 114 } 119 } 115 return fWorldPhysical; 120 return fWorldPhysical; 116 } 121 } 117 122 118 void RE06DetectorConstruction::ConstructSDandF << 123 void RE06DetectorConstruction::ConstructSDandField() 119 { 124 { 120 if (!fConstructedSDandField) { << 125 if(!fConstructedSDandField) >> 126 { 121 fConstructedSDandField = true; 127 fConstructedSDandField = true; 122 SetupDetectors(); 128 SetupDetectors(); 123 } 129 } 124 } 130 } 125 131 126 //....oooOO0OOooo........oooOO0OOooo........oo 132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 127 133 128 void RE06DetectorConstruction::DefineMaterials 134 void RE06DetectorConstruction::DefineMaterials() 129 { << 135 { 130 G4String name, symbol; // a=mass of a mole; << 136 G4String name, symbol; //a=mass of a mole; 131 G4double a, z, density; // z=mean number of << 137 G4double a, z, density; //z=mean number of protons; 132 G4int iz; // iz=number of protons in an is << 138 G4int iz; //iz=number of protons in an isotope; 133 G4int n; // n=number of nucleons in an isot << 139 G4int n; // n=number of nucleons in an isotope; 134 140 135 G4int ncomponents, natoms; 141 G4int ncomponents, natoms; 136 G4double abundance, fractionmass; 142 G4double abundance, fractionmass; 137 G4double temperature, pressure; 143 G4double temperature, pressure; 138 144 139 // 145 // 140 // define Elements 146 // define Elements 141 // 147 // 142 148 143 a = 1.01 * g / mole; << 149 a = 1.01*g/mole; 144 G4Element* H = new G4Element(name = "Hydroge << 150 G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); 145 151 146 a = 12.01 * g / mole; << 152 a = 12.01*g/mole; 147 G4Element* C = new G4Element(name = "Carbon" << 153 G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a); 148 154 149 a = 14.01 * g / mole; << 155 a = 14.01*g/mole; 150 G4Element* N = new G4Element(name = "Nitroge << 156 G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a); 151 157 152 a = 16.00 * g / mole; << 158 a = 16.00*g/mole; 153 G4Element* O = new G4Element(name = "Oxygen" << 159 G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); 154 160 155 // 161 // 156 // define an Element from isotopes, by relat << 162 // define an Element from isotopes, by relative abundance 157 // 163 // 158 164 159 G4Isotope* U5 = new G4Isotope(name = "U235", << 165 G4Isotope* U5 = new G4Isotope(name="U235", iz=92, n=235, a=235.01*g/mole); 160 G4Isotope* U8 = new G4Isotope(name = "U238", << 166 G4Isotope* U8 = new G4Isotope(name="U238", iz=92, n=238, a=238.03*g/mole); 161 167 162 G4Element* U = new G4Element(name = "enriche << 168 G4Element* U = new G4Element(name="enriched Uranium",symbol="U",ncomponents=2); 163 U->AddIsotope(U5, abundance = 90. * perCent) << 169 U->AddIsotope(U5, abundance= 90.*perCent); 164 U->AddIsotope(U8, abundance = 10. * perCent) << 170 U->AddIsotope(U8, abundance= 10.*perCent); 165 171 166 // 172 // 167 // define simple materials 173 // define simple materials 168 // 174 // 169 175 170 new G4Material(name = "Aluminium", z = 13., << 176 new G4Material(name="Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3); 171 new G4Material(name = "Silicon", z = 14., a << 177 new G4Material(name="Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3); 172 new G4Material(name = "Iron", z = 26., a = 5 << 178 new G4Material(name="Iron", z=26., a=55.85*g/mole, density=7.87*g/cm3); 173 new G4Material(name = "ArgonGas", z = 18., a << 179 new G4Material(name="ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3); 174 new G4Material(name = "He", z = 2., a = 4.0 << 180 new G4Material(name="He", z=2., a=4.0*g/mole, density=0.1786e-03*g/cm3); 175 << 181 176 density = 1.390 * g / cm3; << 182 density = 1.390*g/cm3; 177 a = 39.95 * g / mole; << 183 a = 39.95*g/mole; 178 G4Material* lAr = new G4Material(name = "liq << 184 G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density); 179 << 185 180 density = 11.35 * g / cm3; << 186 density = 11.35*g/cm3; 181 a = 207.19 * g / mole; << 187 a = 207.19*g/mole; 182 G4Material* Pb = new G4Material(name = "Lead << 188 G4Material* Pb = new G4Material(name="Lead" , z=82., a, density); 183 189 184 // 190 // 185 // define a material from elements. case 1 191 // define a material from elements. case 1: chemical molecule 186 // 192 // 187 << 193 188 density = 1.000 * g / cm3; << 194 density = 1.000*g/cm3; 189 G4Material* H2O = new G4Material(name = "Wat << 195 G4Material* H2O = new G4Material(name="Water", density, ncomponents=2); 190 H2O->AddElement(H, natoms = 2); << 196 H2O->AddElement(H, natoms=2); 191 H2O->AddElement(O, natoms = 1); << 197 H2O->AddElement(O, natoms=1); 192 << 198 193 density = 1.032 * g / cm3; << 199 density = 1.032*g/cm3; 194 G4Material* Sci = new G4Material(name = "Sci << 200 G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2); 195 Sci->AddElement(C, natoms = 9); << 201 Sci->AddElement(C, natoms=9); 196 Sci->AddElement(H, natoms = 10); << 202 Sci->AddElement(H, natoms=10); 197 203 198 // 204 // 199 // define a material from elements. case 2 205 // define a material from elements. case 2: mixture by fractional mass 200 // 206 // 201 207 202 density = 1.290 * mg / cm3; << 208 density = 1.290*mg/cm3; 203 G4Material* Air = new G4Material(name = "Air << 209 G4Material* Air = new G4Material(name="Air" , density, ncomponents=2); 204 Air->AddElement(N, fractionmass = 0.7); << 210 Air->AddElement(N, fractionmass=0.7); 205 Air->AddElement(O, fractionmass = 0.3); << 211 Air->AddElement(O, fractionmass=0.3); 206 212 207 // 213 // 208 // examples of vacuum 214 // examples of vacuum 209 // 215 // 210 216 211 density = universe_mean_density; << 217 density = universe_mean_density; 212 pressure = 3.e-18 * pascal; << 218 pressure = 3.e-18*pascal; 213 temperature = 2.73 * kelvin; << 219 temperature = 2.73*kelvin; 214 G4Material* Vacuum = new G4Material(name = " << 220 G4Material* Vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole, 215 kStateGa << 221 density,kStateGas,temperature,pressure); 216 222 217 if (GetVerboseLevel() > 1) { << 223 if (GetVerboseLevel()>1) { 218 G4cout << *(G4Material::GetMaterialTable() 224 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 219 } 225 } 220 226 221 // default materials of the calorimeter << 227 //default materials of the calorimeter 222 fWorldMaterial = Vacuum; << 228 fWorldMaterial = Vacuum; 223 fAbsorberMaterial = Pb; 229 fAbsorberMaterial = Pb; 224 fGapMaterial = lAr; << 230 fGapMaterial = lAr; 225 } 231 } 226 232 227 //....oooOO0OOooo........oooOO0OOooo........oo 233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 228 234 229 void RE06DetectorConstruction::SetupGeometry() 235 void RE06DetectorConstruction::SetupGeometry() 230 { 236 { 231 // << 237 // 232 // World 238 // World 233 // 239 // 234 G4VSolid* worldSolid = new G4Box("World", 2. << 240 G4VSolid* worldSolid = new G4Box("World",2.*m,2.*m,fTotalThickness*2.); 235 fWorldLogical = new G4LogicalVolume(worldSol << 241 fWorldLogical = new G4LogicalVolume(worldSolid,fWorldMaterial,"World"); 236 fWorldPhysical = new G4PVPlacement(0, G4Thre << 242 fWorldPhysical = new G4PVPlacement(0,G4ThreeVector(),fWorldLogical,"World", 237 << 243 0,false,0); 238 // << 244 >> 245 // 239 // Calorimeter 246 // Calorimeter 240 // << 247 // 241 G4VSolid* calorSolid = new G4Box("Calor", 0. << 248 G4VSolid* calorSolid = new G4Box("Calor",0.5*m,0.5*m,fTotalThickness/2.); 242 G4int i; 249 G4int i; 243 for (i = 0; i < 3; i++) { << 250 for(i=0;i<3;i++) 244 fCalorLogical[i] = new G4LogicalVolume(cal << 251 { 245 if (fSerial) { << 252 fCalorLogical[i] 246 fCalorPhysical[i] = << 253 = new G4LogicalVolume(calorSolid,fAbsorberMaterial,fCalName[i]); 247 new G4PVPlacement(0, G4ThreeVector(0., << 254 if(fSerial) 248 fCalorLogical[i], fC << 255 { >> 256 fCalorPhysical[i] = new G4PVPlacement(0, >> 257 G4ThreeVector(0.,0.,G4double(i-1)*fTotalThickness), >> 258 fCalorLogical[i],fCalName[i],fWorldLogical,false,i); 249 } 259 } 250 else { << 260 else 251 fCalorPhysical[i] = new G4PVPlacement(0, << 261 { 252 fC << 262 fCalorPhysical[i] = new G4PVPlacement(0, >> 263 G4ThreeVector(0.,G4double(i-1)*m,0.), >> 264 fCalorLogical[i],fCalName[i],fWorldLogical,false,i); 253 } 265 } 254 } 266 } 255 << 267 256 // << 268 // 257 // Layers --- as absorbers 269 // Layers --- as absorbers 258 // 270 // 259 fLayerSolid = new G4Box("Layer", 0.5 * m, 0. << 271 fLayerSolid = new G4Box("Layer",0.5*m,0.5*m,fLayerThickness/2.); 260 for (i = 0; i < 3; i++) { << 272 for(i=0;i<3;i++) 261 fLayerLogical[i] = << 273 { 262 new G4LogicalVolume(fLayerSolid, fAbsorb << 274 fLayerLogical[i] 263 fLayerPhysical[i] = new G4PVReplica(fCalNa << 275 = new G4LogicalVolume(fLayerSolid,fAbsorberMaterial,fCalName[i]+"_LayerLog"); 264 kZAxis << 276 fLayerPhysical[i] >> 277 = new G4PVReplica(fCalName[i]+"_Layer",fLayerLogical[i],fCalorLogical[i], >> 278 kZAxis,fNumberOfLayers,fLayerThickness); 265 } 279 } 266 << 280 267 // 281 // 268 // Gap 282 // Gap 269 // 283 // 270 fGapSolid = new G4Box("Gap", 0.5 * m, 0.5 * << 284 fGapSolid = new G4Box("Gap",0.5*m,0.5*m,fLayerThickness/4.); 271 for (i = 0; i < 3; i++) { << 285 for(i=0;i<3;i++) 272 fGapLogical[i] = new G4LogicalVolume(fGapS << 286 { 273 fGapPhysical[i] = << 287 fGapLogical[i] = new G4LogicalVolume(fGapSolid,fGapMaterial,fCalName[i]+"_Gap"); 274 new G4PVPlacement(0, G4ThreeVector(0., 0 << 288 fGapPhysical[i] = new G4PVPlacement(0,G4ThreeVector(0.,0.,fLayerThickness/4.), 275 fCalName[i] + "_gap", << 289 fGapLogical[i],fCalName[i]+"_gap",fLayerLogical[i],false,0); 276 } 290 } 277 291 278 // 292 // 279 // Regions 293 // Regions 280 // 294 // 281 for (i = 0; i < 3; i++) { << 295 for(i=0;i<3;i++) >> 296 { 282 G4Region* aRegion = new G4Region(fCalName[ 297 G4Region* aRegion = new G4Region(fCalName[i]); 283 fCalorLogical[i]->SetRegion(aRegion); 298 fCalorLogical[i]->SetRegion(aRegion); 284 aRegion->AddRootLogicalVolume(fCalorLogica 299 aRegion->AddRootLogicalVolume(fCalorLogical[i]); 285 } 300 } 286 301 287 // << 302 // 288 // Visualization attributes 303 // Visualization attributes 289 // 304 // 290 fWorldLogical->SetVisAttributes(G4VisAttribu << 305 fWorldLogical->SetVisAttributes(G4VisAttributes::Invisible); 291 G4VisAttributes* simpleBoxVisAtt = new G4Vis << 306 G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); 292 simpleBoxVisAtt->SetVisibility(true); 307 simpleBoxVisAtt->SetVisibility(true); 293 for (i = 0; i < 3; i++) { << 308 for(i=0;i<3;i++) >> 309 { 294 fCalorLogical[i]->SetVisAttributes(simpleB 310 fCalorLogical[i]->SetVisAttributes(simpleBoxVisAtt); 295 fLayerLogical[i]->SetVisAttributes(simpleB 311 fLayerLogical[i]->SetVisAttributes(simpleBoxVisAtt); 296 fGapLogical[i]->SetVisAttributes(simpleBox 312 fGapLogical[i]->SetVisAttributes(simpleBoxVisAtt); 297 } 313 } >> 314 298 } 315 } 299 316 300 //....oooOO0OOooo........oooOO0OOooo........oo 317 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 301 318 302 void RE06DetectorConstruction::SetupDetectors( 319 void RE06DetectorConstruction::SetupDetectors() 303 { 320 { 304 G4SDManager::GetSDMpointer()->SetVerboseLeve 321 G4SDManager::GetSDMpointer()->SetVerboseLevel(1); 305 G4String filterName, particleName; 322 G4String filterName, particleName; 306 323 307 G4SDParticleFilter* gammaFilter = << 324 G4SDParticleFilter* gammaFilter 308 new G4SDParticleFilter(filterName = "gamma << 325 = new G4SDParticleFilter(filterName="gammaFilter",particleName="gamma"); 309 G4SDParticleFilter* electronFilter = << 326 G4SDParticleFilter* electronFilter 310 new G4SDParticleFilter(filterName = "elect << 327 = new G4SDParticleFilter(filterName="electronFilter",particleName="e-"); 311 G4SDParticleFilter* positronFilter = << 328 G4SDParticleFilter* positronFilter 312 new G4SDParticleFilter(filterName = "posit << 329 = new G4SDParticleFilter(filterName="positronFilter",particleName="e+"); 313 G4SDParticleFilter* epFilter = new G4SDParti << 330 G4SDParticleFilter* epFilter 314 epFilter->add(particleName = "e-"); << 331 = new G4SDParticleFilter(filterName="epFilter"); 315 epFilter->add(particleName = "e+"); << 332 epFilter->add(particleName="e-"); 316 << 333 epFilter->add(particleName="e+"); 317 for (G4int i = 0; i < 3; i++) { << 334 318 for (G4int j = 0; j < 2; j++) { << 335 319 // Loop counter j = 0 : absorber << 336 for(G4int i=0;i<3;i++) 320 // = 1 : gap << 337 { 321 G4String detName = fCalName[i]; << 338 for(G4int j=0;j<2;j++) 322 if (j == 0) { << 339 { 323 detName += "_abs"; << 340 // Loop counter j = 0 : absorber 324 } << 341 // = 1 : gap 325 else { << 342 G4String detName = fCalName[i]; 326 detName += "_gap"; << 343 if(j==0) 327 } << 344 { detName += "_abs"; } 328 G4MultiFunctionalDetector* det = new G4M << 345 else 329 G4SDManager::GetSDMpointer()->AddNewDete << 346 { detName += "_gap"; } 330 << 347 G4MultiFunctionalDetector* det = new G4MultiFunctionalDetector(detName); 331 // The second argument in each primitive << 348 332 // hierarchy, the copy number of that le << 349 // The second argument in each primitive means the "level" of geometrical 333 // G4THitsMap. << 350 // hierarchy, the copy number of that level is used as the key of the 334 // For absorber (j = 0), the copy number << 351 // G4THitsMap. 335 // For gap (j = 1), the copy number of i << 352 // For absorber (j = 0), the copy number of its own physical volume is used. 336 // since there is only one physical volu << 353 // For gap (j = 1), the copy number of its mother physical volume is used, 337 // to its mother. << 354 // since there is only one physical volume of gap is placed with respect 338 G4VPrimitiveScorer* primitive; << 355 // to its mother. 339 primitive = new G4PSEnergyDeposit("eDep" << 356 G4VPrimitiveScorer* primitive; 340 det->RegisterPrimitive(primitive); << 357 primitive = new G4PSEnergyDeposit("eDep",j); 341 primitive = new G4PSNofSecondary("nGamma << 358 det->RegisterPrimitive(primitive); 342 primitive->SetFilter(gammaFilter); << 359 primitive = new G4PSNofSecondary("nGamma",j); 343 det->RegisterPrimitive(primitive); << 360 primitive->SetFilter(gammaFilter); 344 primitive = new G4PSNofSecondary("nElect << 361 det->RegisterPrimitive(primitive); 345 primitive->SetFilter(electronFilter); << 362 primitive = new G4PSNofSecondary("nElectron",j); 346 det->RegisterPrimitive(primitive); << 363 primitive->SetFilter(electronFilter); 347 primitive = new G4PSNofSecondary("nPosit << 364 det->RegisterPrimitive(primitive); 348 primitive->SetFilter(positronFilter); << 365 primitive = new G4PSNofSecondary("nPositron",j); 349 det->RegisterPrimitive(primitive); << 366 primitive->SetFilter(positronFilter); 350 primitive = new G4PSMinKinEAtGeneration( << 367 det->RegisterPrimitive(primitive); 351 primitive->SetFilter(gammaFilter); << 368 primitive = new G4PSMinKinEAtGeneration("minEkinGamma",j); 352 det->RegisterPrimitive(primitive); << 369 primitive->SetFilter(gammaFilter); 353 primitive = new G4PSMinKinEAtGeneration( << 370 det->RegisterPrimitive(primitive); 354 primitive->SetFilter(electronFilter); << 371 primitive = new G4PSMinKinEAtGeneration("minEkinElectron",j); 355 det->RegisterPrimitive(primitive); << 372 primitive->SetFilter(electronFilter); 356 primitive = new G4PSMinKinEAtGeneration( << 373 det->RegisterPrimitive(primitive); 357 primitive->SetFilter(positronFilter); << 374 primitive = new G4PSMinKinEAtGeneration("minEkinPositron",j); 358 det->RegisterPrimitive(primitive); << 375 primitive->SetFilter(positronFilter); 359 primitive = new G4PSTrackLength("trackLe << 376 det->RegisterPrimitive(primitive); 360 primitive->SetFilter(epFilter); << 377 primitive = new G4PSTrackLength("trackLength",j); 361 det->RegisterPrimitive(primitive); << 378 primitive->SetFilter(epFilter); 362 primitive = new G4PSNofStep("nStep", j); << 379 det->RegisterPrimitive(primitive); 363 primitive->SetFilter(epFilter); << 380 primitive = new G4PSNofStep("nStep",j); 364 det->RegisterPrimitive(primitive); << 381 primitive->SetFilter(epFilter); 365 << 382 det->RegisterPrimitive(primitive); 366 if (j == 0) { << 383 367 SetSensitiveDetector(fLayerLogical[i], << 384 if(j==0) 368 } << 385 { SetSensitiveDetector(fLayerLogical[i], det); } 369 else { << 386 else 370 SetSensitiveDetector(fGapLogical[i], d << 387 { SetSensitiveDetector(fGapLogical[i], det);} 371 } << 388 } 372 } << 373 } 389 } 374 G4SDManager::GetSDMpointer()->SetVerboseLeve 390 G4SDManager::GetSDMpointer()->SetVerboseLevel(0); 375 } 391 } 376 392 377 void RE06DetectorConstruction::PrintCalorParam 393 void RE06DetectorConstruction::PrintCalorParameters() const 378 { 394 { 379 G4cout << "--------------------------------- << 395 G4cout 380 if (fSerial) { << 396 << "--------------------------------------------------------" << G4endl; 381 G4cout << " Calorimeters are placed in ser << 397 if(fSerial) 382 } << 398 { G4cout << " Calorimeters are placed in serial." << G4endl; } 383 else { << 399 else 384 G4cout << " Calorimeters are placed in par << 400 { G4cout << " Calorimeters are placed in parallel." << G4endl; } 385 } << 401 G4cout 386 G4cout << " Absorber is made of " << fAbsorb << 402 << " Absorber is made of " << fAbsorberMaterial->GetName() << G4endl 387 << fGapMaterial->GetName() << G4endl << 403 << " Gap is made of " << fGapMaterial->GetName() << G4endl 388 << "--------------------------------- << 404 << "--------------------------------------------------------" << G4endl; 389 } 405 } 390 406 391 //....oooOO0OOooo........oooOO0OOooo........oo 407 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 392 408 393 void RE06DetectorConstruction::SetAbsorberMate 409 void RE06DetectorConstruction::SetAbsorberMaterial(G4String materialChoice) 394 { 410 { 395 // search the material by its name << 411 // search the material by its name 396 G4Material* pttoMaterial = G4Material::GetMa << 412 G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice); 397 if (pttoMaterial) { << 413 if(pttoMaterial) >> 414 { 398 fAbsorberMaterial = pttoMaterial; 415 fAbsorberMaterial = pttoMaterial; 399 if (fConstructed) << 416 if(fConstructed) for(size_t i=0;i<3;i++) 400 for (size_t i = 0; i < 3; i++) { << 417 { 401 fCalorLogical[i]->SetMaterial(fAbsorbe << 418 fCalorLogical[i]->SetMaterial(fAbsorberMaterial); 402 fLayerLogical[i]->SetMaterial(fAbsorbe << 419 fLayerLogical[i]->SetMaterial(fAbsorberMaterial); 403 } << 420 } 404 G4RunManager::GetRunManager()->GeometryHas 421 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 405 if (GetVerboseLevel() > 1) { << 422 if (GetVerboseLevel()>1) { 406 PrintCalorParameters(); 423 PrintCalorParameters(); 407 } 424 } 408 } 425 } 409 else { << 426 else 410 G4cerr << materialChoice << " is not defin << 427 { >> 428 G4cerr >> 429 << materialChoice << " is not defined. - Command is ignored." << G4endl; 411 } 430 } 412 } 431 } 413 432 414 //....oooOO0OOooo........oooOO0OOooo........oo 433 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 415 434 416 G4String RE06DetectorConstruction::GetAbsorber 435 G4String RE06DetectorConstruction::GetAbsorberMaterial() const 417 { << 436 { return fAbsorberMaterial->GetName(); } 418 return fAbsorberMaterial->GetName(); << 419 } << 420 437 421 //....oooOO0OOooo........oooOO0OOooo........oo 438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 422 439 423 void RE06DetectorConstruction::SetGapMaterial( 440 void RE06DetectorConstruction::SetGapMaterial(G4String materialChoice) 424 { 441 { 425 // search the material by its name << 442 // search the material by its name 426 G4Material* pttoMaterial = G4Material::GetMa << 443 G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice); 427 if (pttoMaterial) { << 444 if(pttoMaterial) >> 445 { 428 fGapMaterial = pttoMaterial; 446 fGapMaterial = pttoMaterial; 429 if (fConstructed) << 447 if(fConstructed) for(size_t i=0;i<3;i++) 430 for (size_t i = 0; i < 3; i++) { << 448 { fGapLogical[i]->SetMaterial(fGapMaterial); } 431 fGapLogical[i]->SetMaterial(fGapMateri << 432 } << 433 G4RunManager::GetRunManager()->GeometryHas 449 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 434 if (GetVerboseLevel() > 1) { << 450 if (GetVerboseLevel()>1) { 435 PrintCalorParameters(); 451 PrintCalorParameters(); 436 } 452 } 437 } << 453 } 438 else { << 454 else 439 G4cerr << materialChoice << " is not defin << 455 { >> 456 G4cerr >> 457 << materialChoice << " is not defined. - Command is ignored." << G4endl; 440 } 458 } 441 } 459 } 442 460 443 G4String RE06DetectorConstruction::GetGapMater 461 G4String RE06DetectorConstruction::GetGapMaterial() const 444 { << 462 { return fGapMaterial->GetName(); } 445 return fGapMaterial->GetName(); << 446 } << 447 463 448 //....oooOO0OOooo........oooOO0OOooo........oo 464 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 449 465 450 void RE06DetectorConstruction::SetSerialGeomet 466 void RE06DetectorConstruction::SetSerialGeometry(G4bool serial) 451 { 467 { 452 if (fSerial == serial) return; << 468 if(fSerial==serial) return; 453 fSerial = serial; << 469 fSerial=serial; 454 RE06PrimaryGeneratorAction* gen = << 470 RE06PrimaryGeneratorAction* gen = (RE06PrimaryGeneratorAction*) 455 (RE06PrimaryGeneratorAction*)(G4RunManager << 471 (G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction()); 456 if (gen) gen->SetSerial(fSerial); << 472 if(gen) gen->SetSerial(fSerial); 457 if (!fConstructed) return; << 473 if(!fConstructed) return; 458 for (G4int i = 0; i < 3; i++) { << 474 for(G4int i=0;i<3;i++) 459 if (fSerial) { << 475 { 460 fCalorPhysical[i]->SetTranslation(G4Thre << 476 if(fSerial) >> 477 { >> 478 fCalorPhysical[i] >> 479 ->SetTranslation(G4ThreeVector(0.,0.,G4double(i-1)*2.*m)); 461 } 480 } 462 else { << 481 else 463 fCalorPhysical[i]->SetTranslation(G4Thre << 482 { >> 483 fCalorPhysical[i] >> 484 ->SetTranslation(G4ThreeVector(0.,G4double(i-1)*m,0.)); 464 } 485 } 465 } 486 } 466 ((RE06ParallelWorld*)GetParallelWorld(0))->S 487 ((RE06ParallelWorld*)GetParallelWorld(0))->SetSerialGeometry(serial); 467 G4RunManager::GetRunManager()->GeometryHasBe 488 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 468 } 489 } 469 490 470 //....oooOO0OOooo........oooOO0OOooo........oo 491 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 471 492 472 void RE06DetectorConstruction::SetNumberOfLaye 493 void RE06DetectorConstruction::SetNumberOfLayers(G4int nl) 473 { 494 { 474 fNumberOfLayers = nl; 495 fNumberOfLayers = nl; 475 fLayerThickness = fTotalThickness / fNumberO << 496 fLayerThickness = fTotalThickness/fNumberOfLayers; 476 if (!fConstructed) return; << 497 if(!fConstructed) return; 477 498 478 fLayerSolid->SetZHalfLength(fLayerThickness << 499 fLayerSolid->SetZHalfLength(fLayerThickness/2.); 479 fGapSolid->SetZHalfLength(fLayerThickness / << 500 fGapSolid->SetZHalfLength(fLayerThickness/4.); 480 for (size_t i = 0; i < 3; i++) { << 501 for(size_t i=0;i<3;i++) >> 502 { 481 fCalorLogical[i]->RemoveDaughter(fLayerPhy 503 fCalorLogical[i]->RemoveDaughter(fLayerPhysical[i]); 482 delete fLayerPhysical[i]; 504 delete fLayerPhysical[i]; 483 fLayerPhysical[i] = new G4PVReplica(fCalNa << 505 fLayerPhysical[i] 484 kZAxis << 506 = new G4PVReplica(fCalName[i]+"_Layer",fLayerLogical[i],fCalorLogical[i], 485 fGapPhysical[i]->SetTranslation(G4ThreeVec << 507 kZAxis,fNumberOfLayers,fLayerThickness); >> 508 fGapPhysical[i]->SetTranslation(G4ThreeVector(0.,0.,fLayerThickness/4.)); 486 } 509 } 487 G4RunManager::GetRunManager()->GeometryHasBe 510 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 488 } 511 } 489 512 490 //....oooOO0OOooo........oooOO0OOooo........oo 513 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 491 514 492 void RE06DetectorConstruction::AddMaterial() << 515 void RE06DetectorConstruction::AddMaterial() 493 { 516 { 494 static G4bool isAdded = false; << 517 static G4bool isAdded = false; 495 518 496 if (isAdded) return; << 519 if( isAdded ) return; 497 520 498 G4String name, symbol; // a=mass of a mole; << 521 G4String name, symbol; //a=mass of a mole; 499 G4double a, z, density; // z=mean number of << 522 G4double a, z, density; //z=mean number of protons; 500 523 501 G4int ncomponents, natoms; 524 G4int ncomponents, natoms; 502 525 503 // 526 // 504 // define simple materials 527 // define simple materials 505 // 528 // 506 529 507 new G4Material(name = "Copper", z = 29., a = << 530 new G4Material(name="Copper", z=29., a=63.546*g/mole, density=8.96*g/cm3); 508 new G4Material(name = "Tungsten", z = 74., a << 531 new G4Material(name="Tungsten", z=74., a=183.84*g/mole, density=19.3*g/cm3); 509 532 510 G4Element* C = G4Element::GetElement("Carbon 533 G4Element* C = G4Element::GetElement("Carbon"); 511 G4Element* O = G4Element::GetElement("Oxygen 534 G4Element* O = G4Element::GetElement("Oxygen"); >> 535 512 536 513 G4Material* CO2 = new G4Material("CarbonicGa << 537 G4Material* CO2 = 514 kStateGas, << 538 new G4Material("CarbonicGas", density= 27.*mg/cm3, ncomponents=2, 515 CO2->AddElement(C, natoms = 1); << 539 kStateGas, 325.*kelvin, 50.*atmosphere); 516 CO2->AddElement(O, natoms = 2); << 540 CO2->AddElement(C, natoms=1); >> 541 CO2->AddElement(O, natoms=2); 517 542 518 isAdded = true; 543 isAdded = true; >> 544 519 } 545 } 520 546 521 //....oooOO0OOooo........oooOO0OOooo........oo 547 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 522 548