Geant4 Cross Reference |
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 // 26 /// \file electromagnetic/TestEm10/src/DetectorHarris73.cc 27 /// \brief Implementation of the DetectorHarris73 class 28 // 29 // 30 // 31 // 32 33 #include "DetectorHarris73.hh" 34 35 #include "Materials.hh" 36 #include "SensitiveDetector.hh" 37 38 #include "G4Box.hh" 39 #include "G4FieldManager.hh" 40 #include "G4LogicalVolume.hh" 41 #include "G4Material.hh" 42 #include "G4PVPlacement.hh" 43 #include "G4Region.hh" 44 #include "G4SDManager.hh" 45 #include "G4SystemOfUnits.hh" 46 #include "G4TransportationManager.hh" 47 #include "G4UniformMagField.hh" 48 #include "G4UnitsTable.hh" 49 #include "G4ios.hh" 50 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 52 53 DetectorHarris73::DetectorHarris73() : fRadiatorDescription(0) {} 54 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 56 57 DetectorHarris73::~DetectorHarris73() 58 { 59 // delete fRadiatorDescription; 60 // the description is deleted in detector construction 61 } 62 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 64 65 G4VPhysicalVolume* DetectorHarris73::Construct() 66 { 67 // Geometry parameters 68 // 69 70 G4cout << "DetectorHarris73 setup" << G4endl; 71 72 G4double worldSizeZ = 400. * cm; 73 G4double worldSizeR = 20. * cm; 74 75 // Radiator and detector parameters 76 77 G4double radThickness = 0.0127 * mm; 78 G4double gasGap = 0.762 * mm; 79 G4double foilGasRatio = radThickness / (radThickness + gasGap); 80 G4double foilNumber = 100; 81 82 G4double absorberThickness = 15.0 * mm; 83 G4double absorberRadius = 100. * mm; 84 85 G4double windowThick = 51.0 * micrometer; 86 G4double electrodeThick = 10.0 * micrometer; 87 G4double gapThick = 10.0 * cm; 88 G4double detGap = 0.01 * mm; 89 90 G4double startZ = 100.0 * mm; 91 92 // Materials 93 // 94 95 // Change to create materials using NIST 96 G4Material* air = Materials::GetInstance()->GetMaterial("Air"); 97 G4Material* mylar = Materials::GetInstance()->GetMaterial("Mylar"); 98 G4Material* kr7ch4 = Materials::GetInstance()->GetMaterial("Kr7CH4"); 99 100 // Preparation of mixed radiator material 101 102 G4double foilDensity = mylar->GetDensity(); 103 G4double gasDensity = air->GetDensity(); 104 G4double totDensity = foilDensity * foilGasRatio + gasDensity * (1.0 - foilGasRatio); 105 106 G4double fractionFoil = foilDensity * foilGasRatio / totDensity; 107 G4double fractionGas = gasDensity * (1.0 - foilGasRatio) / totDensity; 108 G4Material* radiatorMat = new G4Material("radiatorMat", totDensity, 2); 109 radiatorMat->AddMaterial(mylar, fractionFoil); 110 radiatorMat->AddMaterial(air, fractionGas); 111 112 // Radiator description 113 fRadiatorDescription = new RadiatorDescription; 114 fRadiatorDescription->fFoilMaterial = mylar; // CH2; // Kapton; // Mylar ; // Li ; // CH2 ; 115 fRadiatorDescription->fGasMaterial = air; // CO2; // He; // 116 fRadiatorDescription->fFoilThickness = radThickness; 117 fRadiatorDescription->fGasThickness = gasGap; 118 fRadiatorDescription->fFoilNumber = foilNumber; 119 120 G4Material* worldMaterial = air; // CO2; 121 G4Material* absorberMaterial = kr7ch4; 122 123 // Volumes 124 // 125 126 G4VSolid* solidWorld = new G4Box("World", worldSizeR, worldSizeR, worldSizeZ / 2.); 127 128 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, worldMaterial, "World"); 129 130 G4VPhysicalVolume* physicsWorld = 131 new G4PVPlacement(0, G4ThreeVector(), "World", logicWorld, 0, false, 0); 132 133 // TR radiator envelope 134 135 G4double radThick = foilNumber * (radThickness + gasGap) - gasGap + detGap; 136 G4double radZ = startZ + 0.5 * radThick; 137 138 G4VSolid* solidRadiator = 139 new G4Box("Radiator", 1.1 * absorberRadius, 1.1 * absorberRadius, 0.5 * radThick); 140 141 G4LogicalVolume* logicRadiator = new G4LogicalVolume(solidRadiator, radiatorMat, "Radiator"); 142 143 fRadiatorDescription->fLogicalVolume = logicRadiator; 144 145 new G4PVPlacement(0, G4ThreeVector(0, 0, radZ), "Radiator", logicRadiator, physicsWorld, false, 146 0); 147 148 // create region for radiator 149 150 G4Region* radRegion = new G4Region("XTRradiator"); 151 radRegion->AddRootLogicalVolume(logicRadiator); 152 153 G4double windowZ = startZ + radThick + windowThick / 2. + 15.0 * mm; 154 155 G4double gapZ = windowZ + windowThick / 2. + gapThick / 2. + 0.01 * mm; 156 157 G4double electrodeZ = gapZ + gapThick / 2. + electrodeThick / 2. + 0.01 * mm; 158 159 // Absorber 160 161 G4double absorberZ = electrodeZ + electrodeThick / 2. + absorberThickness / 2. + 0.01 * mm; 162 163 G4VSolid* solidAbsorber = 164 new G4Box("Absorber", absorberRadius, absorberRadius, absorberThickness / 2.); 165 166 G4LogicalVolume* logicAbsorber = new G4LogicalVolume(solidAbsorber, absorberMaterial, "Absorber"); 167 168 new G4PVPlacement(0, G4ThreeVector(0., 0., absorberZ), "Absorber", logicAbsorber, physicsWorld, 169 false, 0); 170 171 G4Region* regGasDet = new G4Region("XTRdEdxDetector"); 172 regGasDet->AddRootLogicalVolume(logicAbsorber); 173 174 // Sensitive Detectors: Absorber 175 176 SensitiveDetector* sd = new SensitiveDetector("AbsorberSD"); 177 G4SDManager::GetSDMpointer()->AddNewDetector(sd); 178 logicAbsorber->SetSensitiveDetector(sd); 179 180 // Print geometry parameters 181 182 G4cout << "\n The WORLD is made of " << worldSizeZ / mm << "mm of " 183 << worldMaterial->GetName(); 184 G4cout << ", the transverse size (R) of the world is " << worldSizeR / mm << " mm. " << G4endl; 185 G4cout << " The ABSORBER is made of " << absorberThickness / mm << "mm of " 186 << absorberMaterial->GetName(); 187 G4cout << ", the transverse size (R) is " << absorberRadius / mm << " mm. " << G4endl; 188 G4cout << " Z position of the (middle of the) absorber " << absorberZ / mm << " mm." << G4endl; 189 190 G4cout << "radZ = " << radZ / mm << " mm" << G4endl; 191 G4cout << "startZ = " << startZ / mm << " mm" << G4endl; 192 193 G4cout << "fRadThick = " << radThick / mm << " mm" << G4endl; 194 G4cout << "fFoilNumber = " << foilNumber << G4endl; 195 G4cout << "fRadiatorMat = " << radiatorMat->GetName() << G4endl; 196 G4cout << "WorldMaterial = " << worldMaterial->GetName() << G4endl; 197 G4cout << G4endl; 198 199 return physicsWorld; 200 } 201 202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 203