// // ******************************************************************** // * 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 B1DetectorConstruction.cc /// \brief Implementation of the B1DetectorConstruction class #include "B1DetectorConstruction.hh" #include "G4RunManager.hh" #include "G4NistManager.hh" #include "G4Box.hh" #include "G4Tubs.hh" #include "G4Cons.hh" #include "G4Orb.hh" #include "G4Sphere.hh" #include "G4Trd.hh" #include "G4SubtractionSolid.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4SystemOfUnits.hh" #include "G4SDManager.hh" #include "G4Step.hh" #include "G4Event.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B1DetectorConstruction::B1DetectorConstruction() : G4VUserDetectorConstruction(), fScoringVolume(0),physWorld(nullptr) { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B1DetectorConstruction::~B1DetectorConstruction() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* B1DetectorConstruction::Construct() { // Get nist material manager G4NistManager* nist = G4NistManager::Instance(); // Envelope parameters // G4double tKap = .05*mm, tCu = .005*mm, tDet = 3*mm ; G4double env_sizeZ, zSrcDisk; env_sizeZ = 32*mm+(tKap+tCu)+tDet; G4double env_sizeXY = 10*cm; G4double z0, zElec, zCub, zDet; z0=-.5*env_sizeZ; zElec =z0+16*mm+tKap/2; zCub=zElec+(tCu+tKap)/2; zDet=zCub+(tCu+tDet)/2; G4Material* env_mat = nist->FindOrBuildMaterial("G4_AIR"); // Option to switch on/off checking of volumes overlaps // G4bool checkOverlaps = true; // // World // G4double world_sizeXY = 1.2*env_sizeXY; G4double world_sizeZ = 1.2*env_sizeZ; G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR"); G4Box* solidWorld = new G4Box("World", //its name 0.5*world_sizeXY, 0.5*world_sizeXY, 0.5*world_sizeZ); //its size G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, //its solid world_mat, //its material "World"); //its name //G4VPhysicalVolume* physWorld = physWorld = new G4PVPlacement(0, //no rotation G4ThreeVector(), //at (0,0,0) logicWorld, //its logical volume "World", //its name 0, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking // // Envelope // G4Box* solidEnv = new G4Box("Envelope", //its name 0.5*env_sizeXY, 0.5*env_sizeXY, 0.5*env_sizeZ); //its size G4LogicalVolume* logicEnv = new G4LogicalVolume(solidEnv, //its solid env_mat, //its material "Envelope"); //its name new G4PVPlacement(0, //no rotation G4ThreeVector(), //at (0,0,0) logicEnv, //its logical volume "Envelope", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking G4double density = .001716*g/cm3; G4double fractionmass; G4int ncomponents; G4Material* elAr = nist->FindOrBuildMaterial("G4_Ar"); G4Material* co2gas = nist->FindOrBuildMaterial("G4_CARBON_DIOXIDE"); G4Material* gemgas = new G4Material("Gemgas",density,ncomponents=2); gemgas->AddMaterial(co2gas,fractionmass=30.*perCent); gemgas->AddMaterial(elAr,fractionmass=70*perCent); // // Shape 1 (detector) // //G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_AIR"); G4Material* shape1_mat = gemgas; G4ThreeVector pos1 = G4ThreeVector(0*cm, 0*cm,zDet ); G4Box* solidShape1 = new G4Box("Shape1",0.5*env_sizeXY, 0.5*env_sizeXY,.5*tDet ); G4LogicalVolume* logicShape1 = new G4LogicalVolume(solidShape1, //its solid shape1_mat, //its material "Shape1"); //its name new G4PVPlacement(0, //no rotation pos1, //at position logicShape1, //its logical volume "Shape1", //its name logicEnv, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking // // // // Shape 3 (drift foil kapton) // G4Material* shape3_mat = nist->FindOrBuildMaterial("G4_KAPTON"); //G4Material* shape3_mat = nist->FindOrBuildMaterial("G4_AIR"); G4ThreeVector pos3 = G4ThreeVector(0*cm, 0*cm, zElec); G4Box* solidShape3 = new G4Box("Shape3",0.5*env_sizeXY, 0.5*env_sizeXY, tKap/2 ); G4LogicalVolume* logicShape3 = new G4LogicalVolume(solidShape3, //its solid shape3_mat, //its material "Shape3"); //its name new G4PVPlacement(0, //no rotation pos3, //at position logicShape3, //its logical volume "Shape3", //its name logicEnv, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking // // Shape 4 (aluminum on drift foil) // //G4Material* shape4_mat = nist->FindOrBuildMaterial("G4_Al"); //G4Material* shape4_mat = nist->FindOrBuildMaterial("G4_AIR"); G4Material* shape4_mat = nist->FindOrBuildMaterial("G4_Cu"); G4ThreeVector pos4 = G4ThreeVector(0*cm, 0*cm, zCub); G4Box* solidShape4 = new G4Box("Shape4",0.5*env_sizeXY, 0.5*env_sizeXY,tCu/2 ); G4LogicalVolume* logicShape4 = new G4LogicalVolume(solidShape4, //its solid shape4_mat, //its material "Shape4"); //its name new G4PVPlacement(0, //no rotation pos4, //at position logicShape4, //its logical volume "Shape4", //its name logicEnv, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking fScoringVolume = logicShape1; // //always return the physical World // return physWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......