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 electromagnetic/TestEm10/src/Detecto 26 /// \file electromagnetic/TestEm10/src/DetectorBari05.cc 27 /// \brief Implementation of the DetectorBari0 27 /// \brief Implementation of the DetectorBari05 class 28 // 28 // 29 // 29 // >> 30 // $Id: DetectorBari05.cc 72517 2013-07-24 23:01:29Z gum $ 30 // 31 // 31 // 32 // 32 33 33 #include "DetectorBari05.hh" 34 #include "DetectorBari05.hh" 34 << 35 #include "Materials.hh" << 36 #include "SensitiveDetector.hh" 35 #include "SensitiveDetector.hh" >> 36 #include "Materials.hh" 37 37 >> 38 #include "G4Material.hh" 38 #include "G4Box.hh" 39 #include "G4Box.hh" 39 #include "G4FieldManager.hh" << 40 #include "G4LogicalVolume.hh" 40 #include "G4LogicalVolume.hh" 41 #include "G4Material.hh" << 42 #include "G4PVPlacement.hh" 41 #include "G4PVPlacement.hh" 43 #include "G4Region.hh" << 44 #include "G4SDManager.hh" << 45 #include "G4SystemOfUnits.hh" << 46 #include "G4TransportationManager.hh" << 47 #include "G4UniformMagField.hh" 42 #include "G4UniformMagField.hh" >> 43 #include "G4FieldManager.hh" >> 44 #include "G4TransportationManager.hh" >> 45 #include "G4SDManager.hh" >> 46 >> 47 #include "G4Region.hh" >> 48 48 #include "G4UnitsTable.hh" 49 #include "G4UnitsTable.hh" >> 50 #include "G4SystemOfUnits.hh" 49 #include "G4ios.hh" 51 #include "G4ios.hh" 50 52 51 //....oooOO0OOooo........oooOO0OOooo........oo 53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 52 54 53 DetectorBari05::DetectorBari05() : fRadiatorDe << 55 DetectorBari05::DetectorBari05() >> 56 : fRadiatorDescription(0) >> 57 {} 54 58 55 //....oooOO0OOooo........oooOO0OOooo........oo 59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 56 60 57 DetectorBari05::~DetectorBari05() 61 DetectorBari05::~DetectorBari05() 58 { 62 { 59 // delete fRadiatorDescription; 63 // delete fRadiatorDescription; 60 // the description is deleted in detector co << 64 // the description is deleted in detector construction 61 } 65 } 62 66 63 //....oooOO0OOooo........oooOO0OOooo........oo 67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 64 68 65 G4VPhysicalVolume* DetectorBari05::Construct() 69 G4VPhysicalVolume* DetectorBari05::Construct() 66 { 70 { 67 // Geometry parameters 71 // Geometry parameters 68 // 72 // 69 73 70 G4cout << "DetectorBari05 setup" << G4endl; 74 G4cout << "DetectorBari05 setup" << G4endl; 71 75 72 G4double worldSizeZ = 600. * cm; << 76 G4double worldSizeZ = 600.*cm; 73 G4double worldSizeR = 22. * cm; << 77 G4double worldSizeR = 22.*cm; 74 78 75 // Radiator and detector parameters 79 // Radiator and detector parameters 76 80 77 G4double radThickness = 0.0055 * mm; // Reg << 81 G4double radThickness = 0.0055*mm; // Reg2 78 G4double gasGap = 0.23 * mm; // Reg2 << 82 G4double gasGap = 0.23*mm; // Reg2 79 G4double foilGasRatio = radThickness / (radT << 83 G4double foilGasRatio = radThickness/(radThickness+gasGap); 80 G4double foilNumber = 191; // Reg2 << 84 G4double foilNumber = 191; // Reg2 81 << 85 82 G4double absorberThickness = 0.4 * mm; << 86 G4double absorberThickness = 0.4*mm; 83 G4double absorberRadius = 100. * mm; << 87 G4double absorberRadius = 100.*mm; 84 << 88 85 G4double electrodeThick = 100.0 * micrometer << 89 G4double electrodeThick = 100.0*micrometer; 86 G4double pipeLength = 50.0 * cm; << 90 G4double pipeLength = 50.0*cm; 87 G4double mylarThick = 20.0 * micrometer; << 91 G4double mylarThick = 20.0*micrometer; 88 G4double detGap = 0.01 * mm; << 92 G4double detGap = 0.01*mm; 89 93 90 G4double startZ = 100.0 * mm; << 94 G4double startZ = 100.0*mm; 91 95 92 // Preparation of mixed radiator material 96 // Preparation of mixed radiator material 93 97 >> 98 94 // Materials 99 // Materials 95 // 100 // 96 101 97 // Change to create materials using NIST 102 // Change to create materials using NIST 98 G4Material* air = Materials::GetInstance()-> << 103 G4Material* air = Materials::GetInstance()->GetMaterial("Air"); 99 G4Material* ch2 = Materials::GetInstance()-> << 104 G4Material* ch2 = Materials::GetInstance()->GetMaterial("CH2"); 100 G4Material* he = Materials::GetInstance()->G << 105 G4Material* he = Materials::GetInstance()->GetMaterial("He"); 101 G4Material* si = Materials::GetInstance()->G << 106 G4Material* si = Materials::GetInstance()->GetMaterial("Si"); 102 << 107 103 G4double foilDensity = ch2->GetDensity(); << 108 G4double foilDensity = ch2->GetDensity(); 104 G4double gasDensity = air->GetDensity(); << 109 G4double gasDensity = air->GetDensity(); 105 G4double totDensity = foilDensity * foilGasR << 110 G4double totDensity = foilDensity*foilGasRatio >> 111 + gasDensity*(1.0-foilGasRatio); 106 112 107 G4double fractionFoil = foilDensity * foilGa << 113 G4double fractionFoil = foilDensity*foilGasRatio/totDensity; 108 G4double fractionGas = gasDensity * (1.0 - f << 114 G4double fractionGas = gasDensity*(1.0-foilGasRatio)/totDensity; 109 G4Material* radiatorMat = new G4Material("ra 115 G4Material* radiatorMat = new G4Material("radiatorMat", totDensity, 2); 110 radiatorMat->AddMaterial(ch2, fractionFoil); 116 radiatorMat->AddMaterial(ch2, fractionFoil); 111 radiatorMat->AddMaterial(air, fractionGas); 117 radiatorMat->AddMaterial(air, fractionGas); 112 118 113 // Radiator description 119 // Radiator description 114 fRadiatorDescription = new RadiatorDescripti 120 fRadiatorDescription = new RadiatorDescription; 115 fRadiatorDescription->fFoilMaterial = ch2; << 121 fRadiatorDescription->fFoilMaterial = ch2; // CH2; // Kapton; // Mylar ; // Li ; // CH2 ; 116 fRadiatorDescription->fGasMaterial = air; / << 122 fRadiatorDescription->fGasMaterial = air; // CO2; // He; // 117 fRadiatorDescription->fFoilThickness = radTh 123 fRadiatorDescription->fFoilThickness = radThickness; 118 fRadiatorDescription->fGasThickness = gasGap << 124 fRadiatorDescription->fGasThickness = gasGap; 119 fRadiatorDescription->fFoilNumber = foilNumb 125 fRadiatorDescription->fFoilNumber = foilNumber; 120 126 121 // pipe material is assumed to be He + small 127 // pipe material is assumed to be He + small admixture of air 122 foilGasRatio = 0.99999; 128 foilGasRatio = 0.99999; 123 foilDensity = 1.2928 * mg / cm3; // Air << 129 foilDensity = 1.2928*mg/cm3; // Air 124 gasDensity = 0.178 * mg / cm3; // He << 130 gasDensity = 0.178*mg/cm3; // He 125 totDensity = foilDensity * foilGasRatio + ga << 131 totDensity = foilDensity*foilGasRatio + gasDensity*(1.0-foilGasRatio); 126 132 127 fractionFoil = foilDensity * foilGasRatio / << 133 fractionFoil = foilDensity*foilGasRatio/totDensity; 128 fractionGas = gasDensity * (1.0 - foilGasRat << 134 fractionGas = gasDensity*(1.0-foilGasRatio)/totDensity; 129 135 130 G4Material* pipeMat = new G4Material("pipeMa 136 G4Material* pipeMat = new G4Material("pipeMat", totDensity, 2); 131 pipeMat->AddMaterial(air, fractionFoil); 137 pipeMat->AddMaterial(air, fractionFoil); 132 pipeMat->AddMaterial(he, fractionGas); 138 pipeMat->AddMaterial(he, fractionGas); 133 139 134 G4Material* worldMaterial = air; // CO2; << 140 >> 141 G4Material* worldMaterial = air; // CO2; 135 G4Material* absorberMaterial = si; 142 G4Material* absorberMaterial = si; 136 143 137 // Volumes 144 // Volumes 138 // 145 // >> 146 >> 147 G4VSolid* solidWorld >> 148 = new G4Box("World", worldSizeR, worldSizeR, worldSizeZ/2.); >> 149 >> 150 G4LogicalVolume* logicWorld >> 151 = new G4LogicalVolume(solidWorld, worldMaterial, "World"); 139 152 140 G4VSolid* solidWorld = new G4Box("World", wo << 153 G4VPhysicalVolume* physicsWorld 141 << 154 = new G4PVPlacement(0, G4ThreeVector(), "World", logicWorld, 0, false, 0); 142 G4LogicalVolume* logicWorld = new G4LogicalV << 143 << 144 G4VPhysicalVolume* physicsWorld = << 145 new G4PVPlacement(0, G4ThreeVector(), "Wor << 146 155 147 // TR radiator envelope 156 // TR radiator envelope 148 157 149 G4double radThick = foilNumber * (radThickne << 158 G4double radThick = foilNumber*(radThickness + gasGap) - gasGap + detGap; 150 G4double radZ = startZ + 0.5 * radThick; << 159 G4double radZ = startZ + 0.5*radThick; 151 160 152 G4VSolid* solidRadiator = << 161 G4VSolid* solidRadiator 153 new G4Box("Radiator", 1.1 * absorberRadius << 162 = new G4Box("Radiator", 1.1*absorberRadius, 1.1*absorberRadius, 0.5*radThick); 154 163 155 G4LogicalVolume* logicRadiator = new G4Logic << 164 G4LogicalVolume* logicRadiator 156 << 165 = new G4LogicalVolume(solidRadiator, radiatorMat, "Radiator"); 157 new G4PVPlacement(0, G4ThreeVector(0, 0, rad << 166 158 0); << 167 new G4PVPlacement(0, G4ThreeVector(0, 0, radZ), >> 168 "Radiator", logicRadiator, physicsWorld, false, 0 ); 159 169 160 fRadiatorDescription->fLogicalVolume = logic 170 fRadiatorDescription->fLogicalVolume = logicRadiator; 161 171 162 // create region for window inside windowR f 172 // create region for window inside windowR for 163 173 164 G4Region* radRegion = new G4Region("XTRradia 174 G4Region* radRegion = new G4Region("XTRradiator"); 165 radRegion->AddRootLogicalVolume(logicRadiato 175 radRegion->AddRootLogicalVolume(logicRadiator); 166 176 167 // Drift Electrode on both sides of Radiator 177 // Drift Electrode on both sides of Radiator: 168 // (not placed) 178 // (not placed) 169 179 170 G4double zElectrode1 = radZ - radThick / 2. << 180 G4double zElectrode1 = radZ - radThick/2. - electrodeThick/2.; 171 G4double zElectrode2 = radZ + radThick / 2. << 181 G4double zElectrode2 = radZ + radThick/2. + electrodeThick/2.; 172 182 173 G4cout << "zElectrode1 = " << zElectrode1 / << 183 G4cout << "zElectrode1 = " << zElectrode1/mm << " mm" << G4endl; 174 G4cout << "zElectrode2 = " << zElectrode2 / << 184 G4cout << "zElectrode2 = " << zElectrode2/mm << " mm" << G4endl; 175 G4cout << "electrodeThick = " << electrodeTh << 185 G4cout << "electrodeThick = " << electrodeThick/mm << " mm" << G4endl << G4endl; 176 186 177 // Helium Pipe 187 // Helium Pipe 178 // (not placed) 188 // (not placed) 179 189 180 G4double pipeDist = 1. * cm; // Distance be << 190 G4double pipeDist = 1.*cm; //Distance between pipe and radiator / absorber 181 G4double zPipe = zElectrode2 + electrodeThic << 191 G4double zPipe = zElectrode2 + electrodeThick/2. + pipeLength/2. + pipeDist/2.; 182 192 183 G4cout << "zPipe = " << zPipe / mm << " mm" << 193 G4cout << "zPipe = " << zPipe/mm << " mm" << G4endl; 184 G4cout << "pipeLength = " << pipeLength / mm << 194 G4cout << "pipeLength = " << pipeLength/mm << " mm" << G4endl << G4endl; 185 195 186 // Mylar Foil on both sides of helium pipe 196 // Mylar Foil on both sides of helium pipe 187 // (not placed) 197 // (not placed) 188 198 189 G4double zMylar1 = zPipe - pipeLength / 2. - << 199 G4double zMylar1 = zPipe - pipeLength/2. - mylarThick/2 - 0.01*mm; 190 G4double zMylar2 = zPipe + pipeLength / 2. + << 200 G4double zMylar2 = zPipe + pipeLength/2. + mylarThick/2 + 0.01*mm; 191 << 192 G4cout << "zMylar1 = " << zMylar1 / mm << " << 193 G4cout << "zMylar2 = " << zMylar2 / mm << " << 194 G4cout << "fMylarThick = " << mylarThick / m << 195 201 >> 202 G4cout << "zMylar1 = " << zMylar1/mm << " mm" << G4endl; >> 203 G4cout << "zMylar2 = " << zMylar2/mm << " mm" << G4endl; >> 204 G4cout << "fMylarThick = " << mylarThick/mm << " mm" << G4endl << G4endl; >> 205 196 // Mylar Foil on Chamber 206 // Mylar Foil on Chamber 197 // (not placed) 207 // (not placed) 198 208 199 G4double zMylar = zElectrode2 + electrodeThi << 209 G4double zMylar = zElectrode2 + electrodeThick/2. + mylarThick/2. + 1.0*mm; 200 zMylar += (pipeLength + pipeDist); << 210 zMylar += ( pipeLength + pipeDist ); 201 << 211 202 G4cout << "zMylar = " << zMylar / mm << " mm << 212 G4cout << "zMylar = " << zMylar/mm <<" mm" <<G4endl; 203 G4cout << "mylarThick = " << mylarThick / mm << 213 G4cout << "mylarThick = " << mylarThick/mm << " mm" << G4endl << G4endl; 204 214 205 // Absorber 215 // Absorber 206 216 207 G4double absorberZ = zMylar + mylarThick / 2 << 217 G4double absorberZ = zMylar + mylarThick/2. + absorberThickness/2.; 208 218 209 G4VSolid* solidAbsorber = new G4Box("Absorbe << 219 G4VSolid* solidAbsorber >> 220 = new G4Box("Absorber", 10.*mm, 10.*mm, absorberThickness/2.); 210 221 211 G4LogicalVolume* logicAbsorber = new G4Logic << 222 G4LogicalVolume* logicAbsorber >> 223 = new G4LogicalVolume(solidAbsorber, absorberMaterial, "Absorber"); 212 224 213 new G4PVPlacement(0, G4ThreeVector(0., 0., a << 225 new G4PVPlacement(0, G4ThreeVector(0., 0., absorberZ), 214 false, 0); << 226 "Absorber", logicAbsorber, physicsWorld, false, 0); 215 227 216 // Create region for radiator 228 // Create region for radiator 217 229 218 G4Region* regGasDet = new G4Region("XTRdEdxD 230 G4Region* regGasDet = new G4Region("XTRdEdxDetector"); 219 regGasDet->AddRootLogicalVolume(logicAbsorbe 231 regGasDet->AddRootLogicalVolume(logicAbsorber); 220 232 221 // Sensitive Detectors: Absorber 233 // Sensitive Detectors: Absorber 222 234 223 SensitiveDetector* sd = new SensitiveDetecto 235 SensitiveDetector* sd = new SensitiveDetector("AbsorberSD"); 224 G4SDManager::GetSDMpointer()->AddNewDetector << 236 G4SDManager::GetSDMpointer()->AddNewDetector(sd ); 225 logicAbsorber->SetSensitiveDetector(sd); 237 logicAbsorber->SetSensitiveDetector(sd); 226 238 227 // Print geometry parameters 239 // Print geometry parameters 228 240 229 G4cout << "\n The WORLD is made of " << w << 241 G4cout << "\n The WORLD is made of " 230 << worldMaterial->GetName(); << 242 << worldSizeZ/mm << "mm of " << worldMaterial->GetName(); 231 G4cout << ", the transverse size (R) of the << 243 G4cout << ", the transverse size (R) of the world is " 232 G4cout << " The ABSORBER is made of " << abs << 244 << worldSizeR/mm << " mm. " << G4endl; 233 << absorberMaterial->GetName(); << 245 G4cout << " The ABSORBER is made of " 234 G4cout << ", the transverse size (R) is " << << 246 << absorberThickness/mm << "mm of " << absorberMaterial->GetName(); 235 G4cout << " Z position of the (middle of the << 247 G4cout << ", the transverse size (R) is " >> 248 << absorberRadius/mm << " mm. " << G4endl; >> 249 G4cout << " Z position of the (middle of the) absorber " >> 250 << absorberZ/mm << " mm." << G4endl; 236 251 237 G4cout << "radZ = " << radZ / mm << " mm" << << 252 G4cout << "radZ = " << radZ/mm << " mm" << G4endl; 238 G4cout << "startZ = " << startZ / mm << " mm << 253 G4cout << "startZ = " << startZ/mm<< " mm" << G4endl; 239 254 240 G4cout << "fRadThick = " << radThick / mm << << 255 G4cout << "fRadThick = " << radThick/mm << " mm"<<G4endl; 241 G4cout << "fFoilNumber = " << foilNumber << 256 G4cout << "fFoilNumber = " << foilNumber << G4endl; 242 G4cout << "fRadiatorMat = " << radiatorMat-> 257 G4cout << "fRadiatorMat = " << radiatorMat->GetName() << G4endl; 243 G4cout << "WorldMaterial = " << worldMateria 258 G4cout << "WorldMaterial = " << worldMaterial->GetName() << G4endl; 244 G4cout << G4endl; 259 G4cout << G4endl; 245 260 246 return physicsWorld; 261 return physicsWorld; 247 } 262 } 248 263 249 //....oooOO0OOooo........oooOO0OOooo........oo 264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 250 265