Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ********************************************************************
- // * License and Disclaimer *
- // * *
- // * The Geant4 software is copyright of the Copyright Holders of *
- // * the Geant4 Collaboration. It is provided under the terms and *
- // * conditions of the Geant4 Software License, included in the file *
- // * LICENSE and available at http://cern.ch/geant4/license . These *
- // * include a list of copyright holders. *
- // * *
- // * Neither the authors of this software system, nor their employing *
- // * institutes,nor the agencies providing financial support for this *
- // * work make any representation or warranty, express or implied, *
- // * regarding this software system or assume any liability for its *
- // * use. Please see the license in the file LICENSE and URL above *
- // * for the full disclaimer and the limitation of liability. *
- // * *
- // * This code implementation is the result of the scientific and *
- // * technical work of the GEANT4 collaboration. *
- // * By using, copying, modifying or distributing the software (or *
- // * any work based on the software) you agree to acknowledge its *
- // * use in resulting scientific publications, and indicate your *
- // * acceptance of all terms of the Geant4 Software license. *
- // ********************************************************************
- //
- /// \file electromagnetic/TestEm5/src/DetectorConstruction.cc
- /// \brief Implementation of the DetectorConstruction class
- //
- // $Id: DetectorConstruction.cc 77600 2013-11-26 17:07:41Z gcosmo $
- //
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- #include "DetectorConstruction.hh"
- #include "DetectorSD.hh"
- #include "DetectorMessenger.hh"
- #include "G4Material.hh"
- #include "G4Box.hh"
- #include "G4LogicalVolume.hh"
- #include "G4PVPlacement.hh"
- #include "G4UniformMagField.hh"
- #include "G4GeometryManager.hh"
- #include "G4PhysicalVolumeStore.hh"
- #include "G4LogicalVolumeStore.hh"
- #include "G4SolidStore.hh"
- #include "G4UnitsTable.hh"
- #include "G4NistManager.hh"
- #include "G4SDManager.hh"
- #include "G4RunManager.hh"
- #include "G4Transform3D.hh"
- #include "G4RotationMatrix.hh"
- #include "G4UserLimits.hh"
- #include "G4VisAttributes.hh"
- #include "G4Colour.hh"
- #include "G4PhysicalConstants.hh"
- #include "G4SystemOfUnits.hh"
- #include "G4GlobalMagFieldMessenger.hh"
- #include "G4AutoDelete.hh"
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- DetectorConstruction::DetectorConstruction()
- :G4VUserDetectorConstruction(),
- fSubstratoMaterial(0),fWorldMaterial(0),fDefaultWorld(true),
- fSolidWorld(0),fLogicWorld(0),fPhysiWorld(0),
- solidDetector(0),logicDetector(0),physiDetector(0),
- solidLayerA(0),logicLayerA(0),physiLayerA(0),
- solidSubstrato(0),logicSubstrato(0), physiSubstrato(0),
- solidBe(0), logicBe(0) , physiBe (0),
- fDetectorMessenger(0)
- {
- // default parameter values of the calorimeter
- fSubstratoThickness = 1.*cm;
- fSubstratoSizeYZ = 2.*cm;
- // fXposAbs = 0.*cm;
- // ComputeCalorParameters();
- // materials
- DefineMaterials();
- SetWorldMaterial ("AirNist"); /// definicao do material do mundo
- //SetWorldMaterial ("Galactic"); /// definicao do material do mundo
- SetDetectorMaterial("Silicon"); /// material do detector
- // create commands for interactive definition of the calorimeter
- fDetectorMessenger = new DetectorMessenger(this);
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- DetectorConstruction::~DetectorConstruction()
- {
- delete fDetectorMessenger;
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- G4VPhysicalVolume* DetectorConstruction::Construct()
- {
- return ConstructCalorimeter();
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- void DetectorConstruction::DefineMaterials()
- {
- //This function illustrates the possible ways to define materials
- G4String symbol; //a=mass of a mole;
- G4double a, z, density; //z=mean number of protons;
- G4int ncomponents, natoms;
- G4double fractionmass;
- G4double temperature, pressure;
- //
- // define Elements
- //
- G4Element* H = new G4Element("Hydrogen",symbol="H", z= 1, a= 1.01*g/mole);
- G4Element* C = new G4Element("Carbon", symbol="C", z= 6, a= 12.01*g/mole);
- G4Element* N = new G4Element("Nitrogen",symbol="N", z= 7, a= 14.01*g/mole);
- G4Element* O = new G4Element("Oxygen", symbol="O", z= 8, a= 16.00*g/mole);
- G4Element* Na = new G4Element("Sodium", symbol="Na", z=11, a= 22.99*g/mole);
- G4Element* Ar = new G4Element("Argon", symbol="Ar", z=18, a= 39.95*g/mole);
- G4Element* I = new G4Element("Iodine", symbol="I" , z=53, a= 126.90*g/mole);
- G4Element* Xe = new G4Element("Xenon", symbol="Xe", z=54, a= 131.29*g/mole);
- G4Element* Si2 = new G4Element("Silicon2", symbol="Si" , z= 14, a = 28.08*g/mole);
- G4Element* Be = new G4Element("Beryllium", symbol="Be" , z= 4, a = 9.012182*g/mole);
- G4Element* Zn = new G4Element("Zinc", symbol="Zn" , z= 30, a = 65.38*g/mole);
- G4Element* Ni = new G4Element("Nickel", symbol="Ni" , z= 28, a = 58.6934*g/mole);
- //
- // define simple materials
- //
- new G4Material("H2Liq" , z= 1, a= 1.01*g/mole, density= 70.8*mg/cm3);
- new G4Material("Beryllium", z= 4, a= 9.01*g/mole, density= 1.848*g/cm3);
- new G4Material("Aluminium", z=13, a=26.98*g/mole, density= 2.700*g/cm3);
- new G4Material("Silicon" , z=14, a=28.08*g/mole, density= 2.330*g/cm3);
- G4Material* lAr =
- new G4Material("liquidArgon", density= 1.390*g/cm3, ncomponents=1);
- lAr->AddElement(Ar, natoms=1);
- new G4Material("Iron", z=26, a= 55.85*g/mole, density= 7.870*g/cm3);
- new G4Material("Copper", z=29, a= 63.55*g/mole, density= 8.960*g/cm3);
- new G4Material("Germanium",z=32, a= 72.61*g/mole, density= 5.323*g/cm3);
- new G4Material("Silver", z=47, a=107.87*g/mole, density= 10.50*g/cm3);
- new G4Material("Tungsten", z=74, a=183.85*g/mole, density= 19.30*g/cm3);
- new G4Material("Gold", z=79, a=196.97*g/mole, density= 19.32*g/cm3);
- new G4Material("Lead", z=82, a=207.19*g/mole, density= 11.35*g/cm3);
- density = 2.33*g/cm3;
- G4Material* Silicon2 = new G4Material("Silicon2", density, ncomponents=1); //SILICON
- Silicon2->AddElement(Si2, natoms=1);
- density = 1.848*g/cm3;
- G4Material* Berilio = new G4Material("Berilio", density, ncomponents=1); //SILICON
- Berilio->AddElement(Be, natoms=1);
- //G4Material* Zn = man->FindOrBuildMaterial("G4_Zn");
- //G4Material* Cr = man->FindOrBuildMaterial("G4_Cr");
- //G4Material* Ni = man->FindOrBuildMaterial("G4_Ni");
- G4Material* Al =
- new G4Material("Aluminum", z= 13., a= 26.98*g/mole, density= 2.6989*g/cm3);
- //
- // define a material from elements. case 1: chemical molecule
- //
- G4Material* H2O = new G4Material("Water",density= 1.000*g/cm3,ncomponents=2);
- H2O->AddElement(H, natoms=2);
- H2O->AddElement(O, natoms=1);
- H2O->GetIonisation()->SetMeanExcitationEnergy(78*eV);
- G4Material* CH = new G4Material("Plastic",density= 1.04*g/cm3,ncomponents=2);
- CH->AddElement(C, natoms=1);
- CH->AddElement(H, natoms=1);
- G4Material* NaI = new G4Material("NaI", density= 3.67*g/cm3, ncomponents=2);
- NaI->AddElement(Na, natoms=1);
- NaI->AddElement(I , natoms=1);
- NaI->GetIonisation()->SetMeanExcitationEnergy(452*eV);
- //
- // define a material from elements. case 2: mixture by fractional mass
- //
- G4Material* Air = new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
- Air->AddElement(N, fractionmass=0.7);
- Air->AddElement(O, fractionmass=0.3);
- G4Material* Air20 =
- new G4Material("Air20", density= 1.205*mg/cm3, ncomponents=2,
- kStateGas, 293.*kelvin, 1.*atmosphere);
- Air20->AddElement(N, fractionmass=0.7);
- Air20->AddElement(O, fractionmass=0.3);
- pressure = 1*atmosphere; ///
- temperature = 293.15*kelvin; /// 20 graus celsius
- G4Material* AirNist =
- new G4Material("AirNist", density= 1.20479*mg/cm3, ncomponents=4,kStateGas,temperature,pressure);
- AirNist->AddElement(C, fractionmass=0.000124);
- AirNist->AddElement(N, fractionmass=0.755267);
- AirNist->AddElement(O, fractionmass=0.231781);
- AirNist->AddElement(Ar, fractionmass=0.012827);
- //Graphite
- //
- G4Material* Graphite =
- new G4Material("Graphite", density= 1.7*g/cm3, ncomponents=1);
- Graphite->AddElement(C, fractionmass=1.);
- //Havar
- //
- G4Element* Cr = new G4Element("Chrome", "Cr", z=25, a= 51.996*g/mole);
- G4Element* Fe = new G4Element("Iron" , "Fe", z=26, a= 55.845*g/mole);
- G4Element* Co = new G4Element("Cobalt", "Co", z=27, a= 58.933*g/mole);
- // G4Element* Ni = new G4Element("Nickel", "Ni", z=28, a= 58.693*g/mole);
- G4Element* W = new G4Element("Tungsten","W", z=74, a= 183.850*g/mole);
- G4Element* Mn = new G4Element("Mang","Mn" , z=25, a= 54.938044*g/mole);
- G4Element* Au = new G4Element("Gold","Au" , z= 79,a = 196.967*g/mole);
- G4Element* Cu = new G4Element("Cobre","Cu", z=29, a= 63.55*g/mole);
- G4Element* S = new G4Element("Sulfur","S", z=16, a= 32.065*g/mole);
- G4Element* P = new G4Element("Phosphorus","P", z=15, a= 30.973761*g/mole);
- G4Material* Havar =
- new G4Material("Havar", density= 8.3*g/cm3, ncomponents=5);
- Havar->AddElement(Cr, fractionmass=0.1785);
- Havar->AddElement(Fe, fractionmass=0.1822);
- Havar->AddElement(Co, fractionmass=0.4452);
- Havar->AddElement(Ni, fractionmass=0.1310);
- Havar->AddElement(W , fractionmass=0.0631);
- //
- // examples of gas
- //
- new G4Material("ArgonGas", z=18, a=39.948*g/mole, density= 1.782*mg/cm3,
- kStateGas, 273.15*kelvin, 1*atmosphere);
- new G4Material("XenonGas", z=54, a=131.29*g/mole, density= 5.458*mg/cm3,
- kStateGas, 293.15*kelvin, 1*atmosphere);
- G4Material* CO2 =
- new G4Material("CarbonicGas", density= 1.977*mg/cm3, ncomponents=2);
- CO2->AddElement(C, natoms=1);
- CO2->AddElement(O, natoms=2);
- G4Material* ArCO2 =
- new G4Material("ArgonCO2", density= 1.8223*mg/cm3, ncomponents=2);
- ArCO2->AddElement (Ar, fractionmass=0.7844);
- ArCO2->AddMaterial(CO2, fractionmass=0.2156);
- //another way to define mixture of gas per volume
- G4Material* NewArCO2 =
- new G4Material("NewArgonCO2", density= 1.8223*mg/cm3, ncomponents=3);
- NewArCO2->AddElement (Ar, natoms=8);
- NewArCO2->AddElement (C, natoms=2);
- NewArCO2->AddElement (O, natoms=4);
- G4Material* ArCH4 =
- new G4Material("ArgonCH4", density= 1.709*mg/cm3, ncomponents=3);
- ArCH4->AddElement (Ar, natoms=93);
- ArCH4->AddElement (C, natoms=7);
- ArCH4->AddElement (H, natoms=28);
- G4Material* XeCH =
- new G4Material("XenonMethanePropane", density= 4.9196*mg/cm3, ncomponents=3,
- kStateGas, 293.15*kelvin, 1*atmosphere);
- XeCH->AddElement (Xe, natoms=875);
- XeCH->AddElement (C, natoms=225);
- XeCH->AddElement (H, natoms=700);
- G4Material* steam =
- new G4Material("WaterSteam", density= 1.0*mg/cm3, ncomponents=1);
- steam->AddMaterial(H2O, fractionmass=1.);
- steam->GetIonisation()->SetMeanExcitationEnergy(71.6*eV);
- // PMMA C5H8O2 ( Acrylic )
- // -------------
- density = 1.19*g/cm3;
- G4Material* Acrilico = new G4Material("Acrilico", density, ncomponents=3);
- Acrilico->AddElement(C, 5);
- Acrilico->AddElement(H, 8);
- Acrilico->AddElement(O, 2);
- //
- // example of vacuum
- //
- density = universe_mean_density; //from PhysicalConstants.h
- pressure = 3.e-18*pascal;
- temperature = 298.15*kelvin;
- new G4Material("Galactic", z=1, a=1.01*g/mole,density,
- kStateGas,temperature,pressure);
- density = 7.788*g/cm3; // 2% Mn
- G4Material* FeMn = new G4Material("FeMn", density, ncomponents=2); //
- FeMn->AddElement(Fe, fractionmass=98*perCent);
- FeMn->AddElement(Mn, fractionmass=2*perCent);
- density = 7.872*g/cm3; // 2% Mn
- G4Material* Aco1020 = new G4Material("Aco1020", density, ncomponents=5); //
- Aco1020->AddElement(C, fractionmass=0.20*perCent);
- Aco1020->AddElement(Mn, fractionmass=0.4*perCent);
- Aco1020->AddElement(P, fractionmass=0.04*perCent);
- Aco1020->AddElement(S, fractionmass=0.05*perCent);
- Aco1020->AddElement(Fe, fractionmass=99.31*perCent);
- density = 7.874*g/cm3; // 2% Mn
- G4Material* FePuro = new G4Material("FePuro", density, ncomponents=1); //
- FePuro->AddElement(Fe, fractionmass=100*perCent);
- density = 19.30*g/cm3; // 2% Mn
- G4Material* OuroPuro = new G4Material("OuroPuro", density, ncomponents=1); //
- OuroPuro->AddElement(Au, fractionmass=100*perCent);
- density = 8.960*g/cm3; // 2% Mn
- G4Material* CobrePuro = new G4Material("CobrePuro", density, ncomponents=1); //
- CobrePuro->AddElement(Cu, fractionmass=100*perCent);
- density = 8.902*g/cm3; // nicekl
- G4Material* Nickel = new G4Material("Niquel", density, ncomponents=1); //
- Nickel->AddElement(Ni, fractionmass=100*perCent);
- density = 7.133*g/cm3; // zinco
- G4Material* Zinco = new G4Material("Zinco", density, ncomponents=1); //
- Zinco->AddElement(Zn, fractionmass=100*perCent);
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- void DetectorConstruction::ComputeCalorParameters()
- {
- // Compute derived parameters of the calorimeter
- // fXstartAbs = fXposAbs-0.5*fAbsorberThickness;
- // fXendAbs = fXposAbs+0.5*fAbsorberThickness;
- // if (fDefaultWorld) {
- // fWorldSizeX = 1.5*fAbsorberThickness; fWorldSizeYZ= 1.2*fAbsorberSizeYZ;
- // }
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
- {
- // Cleanup old geometry
- //
- G4GeometryManager::GetInstance()->OpenGeometry();
- G4PhysicalVolumeStore::GetInstance()->Clean();
- G4LogicalVolumeStore::GetInstance()->Clean();
- G4SolidStore::GetInstance()->Clean();
- //===== DEFINITIONS OF ROTAITION MATRIXES =====================================
- G4double csi = 90. *deg; // Matrix definition for a 90 deg rotation
- G4RotationMatrix rm;
- rm.rotateY(csi);
- // Z -
- // X -
- // Y -
- //
- G4double psi = 0. *deg; // Matrix definition for a 0 deg rotation
- G4RotationMatrix rmz;
- rmz.rotateX(psi);
- // World
- //
- G4double ExperimentalHall_x = 25.0*cm;
- G4double ExperimentalHall_y = 25.0*cm;
- G4double ExperimentalHall_z = 25.0*cm;
- fSolidWorld = new G4Box("World", //its name
- ExperimentalHall_x,
- ExperimentalHall_y,
- ExperimentalHall_z);
- fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
- fWorldMaterial, //its material
- "World"); //its name
- fPhysiWorld = new G4PVPlacement(0, //no rotation
- G4ThreeVector(), //at (0,0,0)
- fLogicWorld, //its logical volume
- "World", //its name
- 0, //its mother volume
- false, //no boolean operation
- 0); //copy number
- G4double LayerAPosition_x = 0.0 ; /// nao comentar
- //----------------------------------------------------------------------------
- // Layer A Descomentar para adicionar uma camada a simulação
- // Zinc sheet
- // with thickness (along X):
- // 5 * nm = 0.000005 ( 1/2 = 0.0000025) * mm
- // 10 * nm = 0.00001 ( 1/2 = 0.000005) * mm
- // 0,005 mm = > 1/2 = 0.0025 * mm
- // 0,01 mm => 1/2 = 0.005 * mm
- // 0.05*mm; 0.1*mm
- //
- // Fiz a camada A de Niquel
- //----------------------------------------------------------------------------
- G4double LayerA_x = fLayerThickness; // <--------- espessura 5 microns d
- G4double LayerA_y = 5*mm; //
- G4double LayerA_z = 5*mm; //
- LayerAPosition_x = -1.0 * LayerA_x ;
- G4double LayerAPosition_y = 0.0*mm;
- G4double LayerAPosition_z = 0.0*mm; //
- solidLayerA = new G4Box("LayerA",
- LayerA_x,
- LayerA_y,
- LayerA_z);
- logicLayerA = new G4LogicalVolume(solidLayerA, fLayerMaterial, "LayerA"); // Ni
- physiLayerA = new G4PVPlacement(G4Transform3D(rmz,
- G4ThreeVector(LayerAPosition_x,
- LayerAPosition_y,
- LayerAPosition_z)),
- "LayerA",
- logicLayerA,
- fPhysiWorld,
- false,
- 0);
- // Substrato /// camada inicia no 0, 0
- //
- G4double Sample_x = fSubstratoThickness; // <--------- espessura
- G4double Sample_y = 5 *mm; //
- G4double Sample_z = 5 *mm; //
- G4double SamplePosition_x = LayerAPosition_x + (-1.0) * Sample_x; /// com layer
- G4double SamplePosition_y = 0.0*cm; ///
- G4double SamplePosition_z = 0.0*cm; //
- solidSubstrato = new G4Box("Amostra",
- Sample_x,
- Sample_y,
- Sample_z);
- logicSubstrato = new G4LogicalVolume(solidSubstrato, //its solid
- fSubstratoMaterial, //its material
- "Amostra"); //its name
- physiSubstrato = new G4PVPlacement(G4Transform3D(rmz,
- G4ThreeVector(SamplePosition_x,
- SamplePosition_y,
- SamplePosition_z)),
- "Amostra",
- logicSubstrato,
- fPhysiWorld,
- false,
- 0);
- //PrintCalorParameters();
- // **************
- // Cut per Region
- // **************
- // A smaller cut is fixed in the phantom to calculate the energy deposit with the
- // required accuracy
- //G4Region* cRegion = new G4Region("LayerALog");
- //logicLayerA -> SetRegion(cRegion);
- //cRegion -> AddRootLogicalVolume(logicLayerA);
- /// Janela de berílio
- //----------------------------------------------------------------------------
- // Be Window
- // X position =
- //
- //----------------------------------------------------------------------------
- G4Material* pttoMaterial =
- G4NistManager::Instance()->FindOrBuildMaterial("Beryllium");
- BeMaterial = pttoMaterial;
- G4double BePosition_x = 1.0 *cm; // -5.<--- window position
- G4double BePosition_y = (0.4124) *cm;
- G4double BePosition_z = 0.0 *cm;
- G4double Be_x = 5* mm ; //
- G4double Be_y = 5 *mm; //
- G4double Be_z = 12.5 *micrometer; // espessura
- //G4double Be_z = 12.5* micrometer; //<--------- espessura 12,5 micrometros
- solidBe = new G4Box("BeWindow",
- Be_x,
- Be_y,
- Be_z);
- logicBe = new G4LogicalVolume(solidBe,
- BeMaterial,
- "BeWindow");
- physiBe = new G4PVPlacement(G4Transform3D(rm,
- G4ThreeVector(BePosition_x,
- BePosition_y,
- BePosition_z)),
- "BeWindow",
- logicBe,
- fPhysiWorld,
- false,
- 0);
- //----------------------------------------------------------------------------
- // Si Detector
- // X position = 40 mm + 1/2 Al phantom thickness
- //
- //----------------------------------------------------------------------------
- G4double Detector_x = 5 * mm;
- G4double Detector_y = 5 * mm;
- G4double Detector_z = 500 * micrometer; // 500 micrometros espessura
- G4double DetectorPosition_x = BePosition_x + Be_z + Detector_z; // -5.<--- Detector position
- G4double DetectorPosition_y = (0.4142) *cm;
- G4double DetectorPosition_z = 0.0 *cm;
- solidDetector = new G4Box("Detector",
- Detector_x,
- Detector_y,
- Detector_z);
- logicDetector = new G4LogicalVolume(solidDetector,
- DetectorMaterial,
- "Detector");
- physiDetector = new G4PVPlacement(G4Transform3D(rm,
- G4ThreeVector(DetectorPosition_x,
- DetectorPosition_y,
- DetectorPosition_z)),
- "Detector",
- logicDetector,
- fPhysiWorld,
- false,
- 0);
- // ======== Colours definition ===============================================
- G4VisAttributes * yellow = new G4VisAttributes( G4Colour(1., 1., 0. ));
- yellow-> SetVisibility(true);
- yellow-> SetForceSolid(true);
- G4VisAttributes * grey = new G4VisAttributes( G4Colour(0.45, 0.45, 0.45 ));
- grey-> SetVisibility(true);
- grey-> SetForceSolid(true);
- G4VisAttributes * red = new G4VisAttributes( G4Colour(1. ,0. ,0.));
- red-> SetVisibility(true);
- red-> SetForceSolid(true);
- G4VisAttributes * blue = new G4VisAttributes( G4Colour(0. ,0. ,0.85));
- blue -> SetVisibility(true);
- blue -> SetForceSolid(true);
- G4VisAttributes * green = new G4VisAttributes( G4Colour(0. ,1. ,0.));
- green -> SetVisibility(true);
- green -> SetForceSolid(true);
- G4VisAttributes * white = new G4VisAttributes( G4Colour());
- white -> SetVisibility(true);
- white -> SetForceSolid(true);
- G4VisAttributes * brown = new G4VisAttributes( G4Colour(0.8, 0.5, 0.35));
- brown -> SetVisibility(true);
- brown -> SetForceSolid(true);
- // magenta
- G4VisAttributes * magenta = new G4VisAttributes( G4Colour(1.0, 0.0, 1.0));
- magenta -> SetVisibility(true);
- magenta -> SetForceSolid(true);
- // ======== Visualization attributes =========================================
- fLogicWorld -> SetVisAttributes(G4VisAttributes::Invisible); // nao
- logicSubstrato -> SetVisAttributes(brown); /// Ferro + Manganes Azul
- //logicAnodo -> SetVisAttributes(yellow); /// nao aparece por causa da espessura muito fina , o geant nao desenha
- //logicLayerA -> SetVisAttributes(magenta); /// Niquel
- //logicLayerB -> SetVisAttributes(yellow); /// Ar
- ///logicSourcePoint -> SetVisAttributes(magenta); /// Fonte
- logicDetector -> SetVisAttributes(blue); /// Detector
- logicBe -> SetVisAttributes(yellow); /// Detector
- //always return the physical World
- //
- return fPhysiWorld;
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- void DetectorConstruction::PrintCalorParameters()
- {
- // G4cout << "aaaaaaaaaaaa" << G4endl;
- /*
- G4cout << "\n" << fWorldMaterial << G4endl;
- G4cout << "\n" << fAbsorberMaterial << G4endl;
- G4cout << "\n The WORLD is made of " << G4BestUnit(fWorldSizeX,"Length")
- << " of " << fWorldMaterial->GetName();
- G4cout << ". The transverse size (YZ) of the world is "
- << G4BestUnit(fWorldSizeYZ,"Length") << G4endl;
- G4cout << " The ABSORBER is made of "
- <<G4BestUnit(fAbsorberThickness,"Length")
- << " of " << fAbsorberMaterial->GetName();
- G4cout << ". The transverse size (YZ) is "
- << G4BestUnit(fAbsorberSizeYZ,"Length") << G4endl;
- G4cout << " X position of the middle of the absorber "
- << G4BestUnit(fXposAbs,"Length");
- G4cout << G4endl;
- * */
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- void DetectorConstruction::SetDetectorMaterial(G4String materialChoice)
- {
- // search the material by its name
- G4Material* pttoMaterial =
- G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
- if (pttoMaterial && DetectorMaterial != pttoMaterial)
- {
- DetectorMaterial = pttoMaterial;
- if(logicDetector) logicDetector->SetMaterial(DetectorMaterial);
- G4RunManager::GetRunManager()->PhysicsHasBeenModified();
- G4cout << " Detector feito de " << materialChoice << G4endl;
- }
- }
- void DetectorConstruction::SetSubstratoMaterial(G4String materialChoice)
- {
- G4cout<< "Aqui2" << G4endl ;
- // search the material by its name
- G4Material* pttoSubstrato =
- G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
- if (pttoSubstrato && fSubstratoMaterial != pttoSubstrato)
- {
- fSubstratoMaterial = pttoSubstrato;
- if(logicSubstrato)
- {
- logicSubstrato->SetMaterial(fSubstratoMaterial);
- G4cout<< "Aqui3" << G4endl ;
- G4RunManager::GetRunManager()->PhysicsHasBeenModified();
- }
- G4cout << " Substrato feito de " << materialChoice << G4endl;
- }
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- void DetectorConstruction::SetLayerMaterial(G4String materialChoice)
- {
- G4Material* pttoLayer =
- G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
- if (pttoLayer && fLayerMaterial != pttoLayer)
- {
- fLayerMaterial = pttoLayer;
- if(logicLayerA) logicLayerA->SetMaterial(fLayerMaterial);
- G4RunManager::GetRunManager()->PhysicsHasBeenModified();
- G4cout << " Camada feita de " << materialChoice << G4endl;
- }
- }
- void DetectorConstruction::SetWorldMaterial(G4String materialChoice)
- {
- // search the material by its name
- G4Material* pttoMaterial =
- G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
- if (pttoMaterial && fWorldMaterial != pttoMaterial)
- {
- fWorldMaterial = pttoMaterial;
- if(fLogicWorld) fLogicWorld->SetMaterial(fWorldMaterial);
- G4RunManager::GetRunManager()->PhysicsHasBeenModified();
- G4cout << " Material do Mundo feito de " << materialChoice << G4endl;
- }
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- void DetectorConstruction::SetSubstratoThickness(G4double val)
- {
- fSubstratoThickness = val;
- G4cout << " Espessura do substrato (em um) " << fSubstratoThickness / millimeter << G4endl;
- //ComputeCalorParameters();
- G4RunManager::GetRunManager()->ReinitializeGeometry();
- }
- void DetectorConstruction::SetLayerThickness(G4double val )
- {
- fLayerThickness = val;
- G4cout << " Espessura da camanda (em um) " << fLayerThickness / millimeter << G4endl;
- //ComputeCalorParameters();
- G4RunManager::GetRunManager()->ReinitializeGeometry();
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- ///void DetectorConstruction::SetAbsorberSizeYZ(G4double val)
- //{
- //fAbsorberSizeYZ = val;
- //ComputeCalorParameters();
- //G4RunManager::GetRunManager()->ReinitializeGeometry();
- //}
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- void DetectorConstruction::SetWorldSizeX(G4double val)
- {
- fWorldSizeX = val;
- fDefaultWorld = false;
- //ComputeCalorParameters();
- G4RunManager::GetRunManager()->ReinitializeGeometry();
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- void DetectorConstruction::SetWorldSizeYZ(G4double val)
- {
- fWorldSizeYZ = val;
- fDefaultWorld = false;
- //ComputeCalorParameters();
- G4RunManager::GetRunManager()->ReinitializeGeometry();
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
- //void DetectorConstruction::SetAbsorberXpos(G4double val)
- //{
- // fXposAbs = val;
- //ComputeCalorParameters();
- // G4RunManager::GetRunManager()->ReinitializeGeometry();
- //}
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
- void DetectorConstruction::ConstructSDandField()
- {
- if ( fFieldMessenger.Get() == 0 ) {
- // Create global magnetic field messenger.
- // Uniform magnetic field is then created automatically if
- // the field value is not zero.
- G4ThreeVector fieldValue = G4ThreeVector();
- G4GlobalMagFieldMessenger* msg =
- new G4GlobalMagFieldMessenger(fieldValue);
- //msg->SetVerboseLevel(1);
- G4AutoDelete::Register(msg);
- fFieldMessenger.Put( msg );
- }
- /// adicionando o detetor
- G4SDManager* SDmanAl = G4SDManager::GetSDMpointer();
- G4String detectorChamberSDname = "SD";
- DetectorSD* aDetectorSD = new DetectorSD( detectorChamberSDname );
- SDmanAl->AddNewDetector( aDetectorSD );
- logicDetector->SetSensitiveDetector( aDetectorSD );
- }
- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement