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/DetectorBarr90.cc 27 /// \brief Implementation of the DetectorBarr9 27 /// \brief Implementation of the DetectorBarr90 class 28 // 28 // 29 // 29 // >> 30 // $Id: DetectorBarr90.cc 72517 2013-07-24 23:01:29Z gum $ 30 // 31 // 31 // 32 // 32 33 33 #include "DetectorBarr90.hh" 34 #include "DetectorBarr90.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 DetectorBarr90::DetectorBarr90() : fRadiatorDe << 55 DetectorBarr90::DetectorBarr90() >> 56 : fRadiatorDescription(0) >> 57 {} 54 58 55 //....oooOO0OOooo........oooOO0OOooo........oo 59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 56 60 57 DetectorBarr90::~DetectorBarr90() 61 DetectorBarr90::~DetectorBarr90() 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* DetectorBarr90::Construct() 69 G4VPhysicalVolume* DetectorBarr90::Construct() 66 { 70 { 67 // Geometry parameters 71 // Geometry parameters 68 // 72 // 69 73 70 G4cout << "DetectorBarr90 setup" << G4endl; 74 G4cout << "DetectorBarr90 setup" << G4endl; 71 75 72 G4double worldSizeZ = 400. * cm; << 76 G4double worldSizeZ = 400.*cm; 73 G4double worldSizeR = 20. * cm; << 77 G4double worldSizeR = 20.*cm; 74 78 75 // Radiator and detector parameters 79 // Radiator and detector parameters 76 80 77 G4double radThickness = 0.019 * mm; << 81 G4double radThickness = 0.019*mm; 78 G4double gasGap = 0.6 * mm; << 82 G4double gasGap = 0.6*mm; 79 G4double foilGasRatio = radThickness / (radT << 83 G4double foilGasRatio = radThickness/(radThickness+gasGap); 80 G4double foilNumber = 350; << 84 G4double foilNumber = 350; 81 << 85 82 G4double absorberThickness = 50.0 * mm; << 86 G4double absorberThickness = 50.0*mm; 83 G4double absorberRadius = 100. * mm; << 87 G4double absorberRadius = 100.*mm; 84 << 88 85 G4double electrodeThick = 10.0 * micrometer; << 89 G4double electrodeThick = 10.0*micrometer; 86 G4double windowThick = 51.0 * micrometer; << 90 G4double windowThick = 51.0*micrometer; 87 G4double gapThick = 10.0 * cm; << 91 G4double gapThick = 10.0*cm; 88 G4double detGap = 0.01 * mm; << 92 G4double detGap = 0.01*mm; 89 << 90 G4double startZ = 100.0 * mm; << 91 93 >> 94 G4double startZ = 100.0*mm; >> 95 92 // Materials 96 // Materials 93 // 97 // 94 98 95 // Change to create materials using NIST 99 // Change to create materials using NIST 96 G4Material* air = Materials::GetInstance()-> 100 G4Material* air = Materials::GetInstance()->GetMaterial("Air"); 97 G4Material* ch2 = Materials::GetInstance()-> 101 G4Material* ch2 = Materials::GetInstance()->GetMaterial("CH2"); 98 G4Material* co2 = Materials::GetInstance()-> 102 G4Material* co2 = Materials::GetInstance()->GetMaterial("CO2"); 99 G4Material* xe55he15ch4 = Materials::GetInst 103 G4Material* xe55he15ch4 = Materials::GetInstance()->GetMaterial("Xe55He15CH4"); 100 104 101 G4double foilDensity = ch2->GetDensity(); 105 G4double foilDensity = ch2->GetDensity(); 102 G4double gasDensity = co2->GetDensity(); << 106 G4double gasDensity = co2->GetDensity(); 103 G4double totDensity = foilDensity * foilGasR << 107 G4double totDensity = foilDensity*foilGasRatio >> 108 + gasDensity*(1.0-foilGasRatio); 104 109 105 G4double fractionFoil = foilDensity * foilGa << 110 G4double fractionFoil = foilDensity*foilGasRatio/totDensity; 106 G4double fractionGas = gasDensity * (1.0 - f << 111 G4double fractionGas = gasDensity*(1.0-foilGasRatio)/totDensity; 107 G4Material* radiatorMat = new G4Material("ra 112 G4Material* radiatorMat = new G4Material("radiatorMat", totDensity, 2); 108 radiatorMat->AddMaterial(ch2, fractionFoil); 113 radiatorMat->AddMaterial(ch2, fractionFoil); 109 radiatorMat->AddMaterial(co2, fractionGas); 114 radiatorMat->AddMaterial(co2, fractionGas); 110 115 111 // Radiator description 116 // Radiator description 112 fRadiatorDescription = new RadiatorDescripti 117 fRadiatorDescription = new RadiatorDescription; 113 fRadiatorDescription->fFoilMaterial = ch2; << 118 fRadiatorDescription->fFoilMaterial = ch2; // CH2; // Kapton; // Mylar ; // Li ; // CH2 ; 114 fRadiatorDescription->fGasMaterial = co2; / << 119 fRadiatorDescription->fGasMaterial = co2; // CO2; // He; // 115 fRadiatorDescription->fFoilThickness = radTh 120 fRadiatorDescription->fFoilThickness = radThickness; 116 fRadiatorDescription->fGasThickness = gasGap << 121 fRadiatorDescription->fGasThickness = gasGap; 117 fRadiatorDescription->fFoilNumber = foilNumb 122 fRadiatorDescription->fFoilNumber = foilNumber; 118 123 119 G4Material* worldMaterial = air; // CO2; << 124 G4Material* worldMaterial = air; // CO2; 120 G4Material* absorberMaterial = xe55he15ch4; 125 G4Material* absorberMaterial = xe55he15ch4; 121 126 122 // Volumes 127 // Volumes 123 // 128 // >> 129 >> 130 G4VSolid* solidWorld >> 131 = new G4Box("World", worldSizeR, worldSizeR, worldSizeZ/2.); >> 132 >> 133 G4LogicalVolume* logicWorld >> 134 = new G4LogicalVolume(solidWorld, worldMaterial, "World"); 124 135 125 G4VSolid* solidWorld = new G4Box("World", wo << 136 G4VPhysicalVolume* physicsWorld 126 << 137 = new G4PVPlacement(0, G4ThreeVector(), "World", logicWorld, 0, false, 0); 127 G4LogicalVolume* logicWorld = new G4LogicalV << 128 << 129 G4VPhysicalVolume* physicsWorld = << 130 new G4PVPlacement(0, G4ThreeVector(), "Wor << 131 138 132 // TR radiator envelope 139 // TR radiator envelope 133 140 134 G4double radThick = foilNumber * (radThickne << 141 G4double radThick = foilNumber*(radThickness + gasGap) - gasGap + detGap; 135 G4double radZ = startZ + 0.5 * radThick; << 142 G4double radZ = startZ + 0.5*radThick; 136 143 137 G4VSolid* solidRadiator = << 144 G4VSolid* solidRadiator 138 new G4Box("Radiator", 1.1 * absorberRadius << 145 = new G4Box("Radiator", 1.1*absorberRadius, 1.1*absorberRadius, 0.5*radThick); 139 146 140 G4LogicalVolume* logicRadiator = new G4Logic << 147 G4LogicalVolume* logicRadiator 141 << 148 = new G4LogicalVolume(solidRadiator, radiatorMat, "Radiator"); 142 new G4PVPlacement(0, G4ThreeVector(0, 0, rad << 149 143 0); << 150 new G4PVPlacement(0, G4ThreeVector(0, 0, radZ), >> 151 "Radiator", logicRadiator, physicsWorld, false, 0 ); 144 152 145 fRadiatorDescription->fLogicalVolume = logic 153 fRadiatorDescription->fLogicalVolume = logicRadiator; 146 154 147 // create region for radiator 155 // create region for radiator 148 156 149 G4Region* radRegion = new G4Region("XTRradia 157 G4Region* radRegion = new G4Region("XTRradiator"); 150 radRegion->AddRootLogicalVolume(logicRadiato 158 radRegion->AddRootLogicalVolume(logicRadiator); 151 159 152 G4double windowZ = startZ + radThick + windo << 160 G4double windowZ = startZ + radThick + windowThick/2. + 15.0*mm; 153 161 154 G4double gapZ = windowZ + windowThick / 2. + << 162 G4double gapZ = windowZ + windowThick/2. + gapThick/2. + 0.01*mm; 155 163 156 G4double electrodeZ = gapZ + gapThick / 2. + << 164 G4double electrodeZ = gapZ + gapThick/2. + electrodeThick/2. + 0.01*mm; 157 165 158 // Absorber 166 // Absorber 159 167 160 G4double absorberZ = electrodeZ + electrodeT << 168 G4double absorberZ = electrodeZ + electrodeThick/2. + >> 169 + absorberThickness/2. + 0.01*mm; 161 170 162 G4VSolid* solidAbsorber = << 171 G4VSolid* solidAbsorber 163 new G4Box("Absorber", absorberRadius, abso << 172 = new G4Box("Absorber", absorberRadius, absorberRadius, absorberThickness/2.); 164 173 165 G4LogicalVolume* logicAbsorber = new G4Logic << 174 G4LogicalVolume* logicAbsorber >> 175 = new G4LogicalVolume(solidAbsorber, absorberMaterial, "Absorber"); 166 176 167 new G4PVPlacement(0, G4ThreeVector(0., 0., a << 177 new G4PVPlacement(0, G4ThreeVector(0., 0., absorberZ), 168 false, 0); << 178 "Absorber", logicAbsorber, physicsWorld, false, 0); 169 179 170 G4Region* regGasDet = new G4Region("XTRdEdxD 180 G4Region* regGasDet = new G4Region("XTRdEdxDetector"); 171 regGasDet->AddRootLogicalVolume(logicAbsorbe 181 regGasDet->AddRootLogicalVolume(logicAbsorber); 172 182 173 // Sensitive Detectors: Absorber 183 // Sensitive Detectors: Absorber 174 184 175 SensitiveDetector* sd = new SensitiveDetecto 185 SensitiveDetector* sd = new SensitiveDetector("AbsorberSD"); 176 G4SDManager::GetSDMpointer()->AddNewDetector << 186 G4SDManager::GetSDMpointer()->AddNewDetector(sd ); 177 logicAbsorber->SetSensitiveDetector(sd); 187 logicAbsorber->SetSensitiveDetector(sd); 178 188 179 // Print geometry parameters 189 // Print geometry parameters 180 190 181 G4cout << "\n The WORLD is made of " << w << 191 G4cout << "\n The WORLD is made of " 182 << worldMaterial->GetName(); << 192 << worldSizeZ/mm << "mm of " << worldMaterial->GetName(); 183 G4cout << ", the transverse size (R) of the << 193 G4cout << ", the transverse size (R) of the world is " 184 G4cout << " The ABSORBER is made of " << abs << 194 << worldSizeR/mm << " mm. " << G4endl; 185 << absorberMaterial->GetName(); << 195 G4cout << " The ABSORBER is made of " 186 G4cout << ", the transverse size (R) is " << << 196 << absorberThickness/mm << "mm of " << absorberMaterial->GetName(); 187 G4cout << " Z position of the (middle of the << 197 G4cout << ", the transverse size (R) is " >> 198 << absorberRadius/mm << " mm. " << G4endl; >> 199 G4cout << " Z position of the (middle of the) absorber " >> 200 << absorberZ/mm << " mm." << G4endl; 188 201 189 G4cout << "radZ = " << radZ / mm << " mm" << << 202 G4cout << "radZ = " << radZ/mm << " mm" << G4endl; 190 G4cout << "startZ = " << startZ / mm << " mm << 203 G4cout << "startZ = " << startZ/mm<< " mm" << G4endl; 191 204 192 G4cout << "fRadThick = " << radThick / mm << << 205 G4cout << "fRadThick = " << radThick/mm << " mm"<<G4endl; 193 G4cout << "fFoilNumber = " << foilNumber << 206 G4cout << "fFoilNumber = " << foilNumber << G4endl; 194 G4cout << "fRadiatorMat = " << radiatorMat-> 207 G4cout << "fRadiatorMat = " << radiatorMat->GetName() << G4endl; 195 G4cout << "WorldMaterial = " << worldMateria 208 G4cout << "WorldMaterial = " << worldMaterial->GetName() << G4endl; 196 G4cout << G4endl; 209 G4cout << G4endl; 197 210 198 return physicsWorld; 211 return physicsWorld; 199 } 212 } 200 213 201 //....oooOO0OOooo........oooOO0OOooo........oo 214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 215 202 216