Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:49

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file electromagnetic/TestEm10/src/DetectorBari05.cc
0027 /// \brief Implementation of the DetectorBari05 class
0028 //
0029 //
0030 //
0031 //
0032 
0033 #include "DetectorBari05.hh"
0034 
0035 #include "Materials.hh"
0036 #include "SensitiveDetector.hh"
0037 
0038 #include "G4Box.hh"
0039 #include "G4FieldManager.hh"
0040 #include "G4LogicalVolume.hh"
0041 #include "G4Material.hh"
0042 #include "G4PVPlacement.hh"
0043 #include "G4Region.hh"
0044 #include "G4SDManager.hh"
0045 #include "G4SystemOfUnits.hh"
0046 #include "G4TransportationManager.hh"
0047 #include "G4UniformMagField.hh"
0048 #include "G4UnitsTable.hh"
0049 #include "G4ios.hh"
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0052 
0053 DetectorBari05::DetectorBari05() : fRadiatorDescription(0) {}
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 DetectorBari05::~DetectorBari05()
0058 {
0059   // delete fRadiatorDescription;
0060   // the description is deleted in detector construction
0061 }
0062 
0063 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0064 
0065 G4VPhysicalVolume* DetectorBari05::Construct()
0066 {
0067   // Geometry parameters
0068   //
0069 
0070   G4cout << "DetectorBari05 setup" << G4endl;
0071 
0072   G4double worldSizeZ = 600. * cm;
0073   G4double worldSizeR = 22. * cm;
0074 
0075   // Radiator and detector parameters
0076 
0077   G4double radThickness = 0.0055 * mm;  // Reg2
0078   G4double gasGap = 0.23 * mm;  // Reg2
0079   G4double foilGasRatio = radThickness / (radThickness + gasGap);
0080   G4double foilNumber = 191;  // Reg2
0081 
0082   G4double absorberThickness = 0.4 * mm;
0083   G4double absorberRadius = 100. * mm;
0084 
0085   G4double electrodeThick = 100.0 * micrometer;
0086   G4double pipeLength = 50.0 * cm;
0087   G4double mylarThick = 20.0 * micrometer;
0088   G4double detGap = 0.01 * mm;
0089 
0090   G4double startZ = 100.0 * mm;
0091 
0092   // Preparation of mixed radiator material
0093 
0094   // Materials
0095   //
0096 
0097   // Change to create materials using NIST
0098   G4Material* air = Materials::GetInstance()->GetMaterial("Air");
0099   G4Material* ch2 = Materials::GetInstance()->GetMaterial("CH2");
0100   G4Material* he = Materials::GetInstance()->GetMaterial("He");
0101   G4Material* si = Materials::GetInstance()->GetMaterial("Si");
0102 
0103   G4double foilDensity = ch2->GetDensity();
0104   G4double gasDensity = air->GetDensity();
0105   G4double totDensity = foilDensity * foilGasRatio + gasDensity * (1.0 - foilGasRatio);
0106 
0107   G4double fractionFoil = foilDensity * foilGasRatio / totDensity;
0108   G4double fractionGas = gasDensity * (1.0 - foilGasRatio) / totDensity;
0109   G4Material* radiatorMat = new G4Material("radiatorMat", totDensity, 2);
0110   radiatorMat->AddMaterial(ch2, fractionFoil);
0111   radiatorMat->AddMaterial(air, fractionGas);
0112 
0113   // Radiator description
0114   fRadiatorDescription = new RadiatorDescription;
0115   fRadiatorDescription->fFoilMaterial = ch2;  // CH2; // Kapton; // Mylar ; // Li ; // CH2 ;
0116   fRadiatorDescription->fGasMaterial = air;  // CO2; // He; //
0117   fRadiatorDescription->fFoilThickness = radThickness;
0118   fRadiatorDescription->fGasThickness = gasGap;
0119   fRadiatorDescription->fFoilNumber = foilNumber;
0120 
0121   // pipe material is assumed to be He + small admixture of air
0122   foilGasRatio = 0.99999;
0123   foilDensity = 1.2928 * mg / cm3;  // Air
0124   gasDensity = 0.178 * mg / cm3;  // He
0125   totDensity = foilDensity * foilGasRatio + gasDensity * (1.0 - foilGasRatio);
0126 
0127   fractionFoil = foilDensity * foilGasRatio / totDensity;
0128   fractionGas = gasDensity * (1.0 - foilGasRatio) / totDensity;
0129 
0130   G4Material* pipeMat = new G4Material("pipeMat", totDensity, 2);
0131   pipeMat->AddMaterial(air, fractionFoil);
0132   pipeMat->AddMaterial(he, fractionGas);
0133 
0134   G4Material* worldMaterial = air;  // CO2;
0135   G4Material* absorberMaterial = si;
0136 
0137   // Volumes
0138   //
0139 
0140   G4VSolid* solidWorld = new G4Box("World", worldSizeR, worldSizeR, worldSizeZ / 2.);
0141 
0142   G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, worldMaterial, "World");
0143 
0144   G4VPhysicalVolume* physicsWorld =
0145     new G4PVPlacement(0, G4ThreeVector(), "World", logicWorld, 0, false, 0);
0146 
0147   // TR radiator envelope
0148 
0149   G4double radThick = foilNumber * (radThickness + gasGap) - gasGap + detGap;
0150   G4double radZ = startZ + 0.5 * radThick;
0151 
0152   G4VSolid* solidRadiator =
0153     new G4Box("Radiator", 1.1 * absorberRadius, 1.1 * absorberRadius, 0.5 * radThick);
0154 
0155   G4LogicalVolume* logicRadiator = new G4LogicalVolume(solidRadiator, radiatorMat, "Radiator");
0156 
0157   new G4PVPlacement(0, G4ThreeVector(0, 0, radZ), "Radiator", logicRadiator, physicsWorld, false,
0158                     0);
0159 
0160   fRadiatorDescription->fLogicalVolume = logicRadiator;
0161 
0162   // create region for window inside windowR for
0163 
0164   G4Region* radRegion = new G4Region("XTRradiator");
0165   radRegion->AddRootLogicalVolume(logicRadiator);
0166 
0167   // Drift Electrode on both sides of Radiator:
0168   // (not placed)
0169 
0170   G4double zElectrode1 = radZ - radThick / 2. - electrodeThick / 2.;
0171   G4double zElectrode2 = radZ + radThick / 2. + electrodeThick / 2.;
0172 
0173   G4cout << "zElectrode1 = " << zElectrode1 / mm << " mm" << G4endl;
0174   G4cout << "zElectrode2 = " << zElectrode2 / mm << " mm" << G4endl;
0175   G4cout << "electrodeThick = " << electrodeThick / mm << " mm" << G4endl << G4endl;
0176 
0177   // Helium Pipe
0178   // (not placed)
0179 
0180   G4double pipeDist = 1. * cm;  // Distance between pipe and radiator / absorber
0181   G4double zPipe = zElectrode2 + electrodeThick / 2. + pipeLength / 2. + pipeDist / 2.;
0182 
0183   G4cout << "zPipe = " << zPipe / mm << " mm" << G4endl;
0184   G4cout << "pipeLength = " << pipeLength / mm << " mm" << G4endl << G4endl;
0185 
0186   // Mylar Foil on both sides of helium pipe
0187   // (not placed)
0188 
0189   G4double zMylar1 = zPipe - pipeLength / 2. - mylarThick / 2 - 0.01 * mm;
0190   G4double zMylar2 = zPipe + pipeLength / 2. + mylarThick / 2 + 0.01 * mm;
0191 
0192   G4cout << "zMylar1 = " << zMylar1 / mm << " mm" << G4endl;
0193   G4cout << "zMylar2 = " << zMylar2 / mm << " mm" << G4endl;
0194   G4cout << "fMylarThick = " << mylarThick / mm << " mm" << G4endl << G4endl;
0195 
0196   // Mylar Foil on Chamber
0197   // (not placed)
0198 
0199   G4double zMylar = zElectrode2 + electrodeThick / 2. + mylarThick / 2. + 1.0 * mm;
0200   zMylar += (pipeLength + pipeDist);
0201 
0202   G4cout << "zMylar = " << zMylar / mm << " mm" << G4endl;
0203   G4cout << "mylarThick = " << mylarThick / mm << " mm" << G4endl << G4endl;
0204 
0205   // Absorber
0206 
0207   G4double absorberZ = zMylar + mylarThick / 2. + absorberThickness / 2.;
0208 
0209   G4VSolid* solidAbsorber = new G4Box("Absorber", 10. * mm, 10. * mm, absorberThickness / 2.);
0210 
0211   G4LogicalVolume* logicAbsorber = new G4LogicalVolume(solidAbsorber, absorberMaterial, "Absorber");
0212 
0213   new G4PVPlacement(0, G4ThreeVector(0., 0., absorberZ), "Absorber", logicAbsorber, physicsWorld,
0214                     false, 0);
0215 
0216   // Create region for radiator
0217 
0218   G4Region* regGasDet = new G4Region("XTRdEdxDetector");
0219   regGasDet->AddRootLogicalVolume(logicAbsorber);
0220 
0221   // Sensitive Detectors: Absorber
0222 
0223   SensitiveDetector* sd = new SensitiveDetector("AbsorberSD");
0224   G4SDManager::GetSDMpointer()->AddNewDetector(sd);
0225   logicAbsorber->SetSensitiveDetector(sd);
0226 
0227   // Print geometry parameters
0228 
0229   G4cout << "\n The  WORLD   is made of " << worldSizeZ / mm << "mm of "
0230          << worldMaterial->GetName();
0231   G4cout << ", the transverse size (R) of the world is " << worldSizeR / mm << " mm. " << G4endl;
0232   G4cout << " The ABSORBER is made of " << absorberThickness / mm << "mm of "
0233          << absorberMaterial->GetName();
0234   G4cout << ", the transverse size (R) is " << absorberRadius / mm << " mm. " << G4endl;
0235   G4cout << " Z position of the (middle of the) absorber " << absorberZ / mm << "  mm." << G4endl;
0236 
0237   G4cout << "radZ = " << radZ / mm << " mm" << G4endl;
0238   G4cout << "startZ = " << startZ / mm << " mm" << G4endl;
0239 
0240   G4cout << "fRadThick = " << radThick / mm << " mm" << G4endl;
0241   G4cout << "fFoilNumber = " << foilNumber << G4endl;
0242   G4cout << "fRadiatorMat = " << radiatorMat->GetName() << G4endl;
0243   G4cout << "WorldMaterial = " << worldMaterial->GetName() << G4endl;
0244   G4cout << G4endl;
0245 
0246   return physicsWorld;
0247 }
0248 
0249 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......