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