#include "GN1DetectorConstruction.hh" #include "GN1DetectorMessenger.hh" #include "GN1CalorimeterSD.hh" #include "G4Material.hh" #include "G4Box.hh" //#include "G4Tubs.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" //#include "G4PVReplica.hh" #include "G4TransportationManager.hh" #include "G4SDManager.hh" #include "G4RunManager.hh" #include "G4VisAttributes.hh" #include "G4Colour.hh" #include "G4ios.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... GN1DetectorConstruction::GN1DetectorConstruction() { // default parameter values of the calorimeter WorldSizeX = 200.*cm; WorldSizeY = 200.*cm; WorldSizeZ = 200.*cm; NbOfRows1 = 12; Block1SizeX = 5.*cm; Block1SizeY = 15.*cm; Block1SizeZ = 170.*cm; NbOfRows2 = 12; Block2SizeX = 5.*cm; Block2SizeY = 15.*cm; Block2SizeZ = 170.*cm; NbOfRows3 = 12; Block3SizeX = 5.*cm; Block3SizeY = 15.*cm; Block3SizeZ = 170.*cm; NbOfRows4 = 12; Block4SizeX = 5.*cm; Block4SizeY = 15.*cm; Block4SizeZ = 170.*cm; NbOfRows5 = 18; Block5SizeX = 10.*cm; Block5SizeY = 10.*cm; Block5SizeZ = 170.*cm; NbOfRows6 = 18; Block6SizeX = 10.*cm; Block6SizeY = 10.*cm; Block6SizeZ = 170.*cm; NbOfRows7 = 18; Block7SizeX = 10.*cm; Block7SizeY = 10.*cm; Block7SizeZ = 170.*cm; // create commands for interactive definition of the calorimeter detectorMessenger = new GN1DetectorMessenger(this); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... GN1DetectorConstruction::~GN1DetectorConstruction() { delete detectorMessenger;} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* GN1DetectorConstruction::Construct() { DefineMaterials(); return ConstructCalorimeter(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void GN1DetectorConstruction::DefineMaterials() { //This function illustrates the possible ways to define materials G4String name, symbol; //a=mass of a mole; G4double a, z, density; //z=mean number of protons; // n=number of nucleons in an isotope; G4int ncomponents, natoms; G4double fractionmass; // // define Elements // a = 1.01*g/mole; G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); a = 12.01*g/mole; G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a); a = 14.01*g/mole; G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a); a = 16.00*g/mole; G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); // // define simple materials // //a = 63.55*g/mole; density = 8.96*g/cm3; //G4Material* Cu = new G4Material(name="Copper" , z= 29., a, density); a = 55.85*g/mole; density = 7.87*g/cm3; G4Material* Fe = new G4Material(name="Iron" , z= 26., a, density); a = 207.2*g/mole; density = 11.35*g/cm3; G4Material* Pb = new G4Material(name="Lead" , z= 82., a, density); a = 26.98*g/mole; density = 2.70*g/cm3; G4Material* Al = new G4Material(name="Alum" , z= 13., a, density); // // define a material from elements. case 1: chemical molecule // density = 1.032*g/cm3; G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2); Sci->AddElement(C, natoms=9); Sci->AddElement(H, natoms=10); // // define a material from elements. case 2: mixture by fractional mass // density = 1.290*mg/cm3; G4Material* Air = new G4Material(name="Air" , density, ncomponents=2); Air->AddElement(N, fractionmass=0.7); Air->AddElement(O, fractionmass=0.3); // // define a material from elements and/or others materials (mixture of mixtures) // //if(session) G4cout << *(G4Material::GetMaterialTable()) << G4endl; //default materials of the calorimeter CalorMaterial = Sci; // defaultMaterial = Vacuum; defaultMaterial = Air; PlateMaterial= Fe; LeadMaterial= Pb; Alplate=Al; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* GN1DetectorConstruction::ConstructCalorimeter() { // // World // solidWorld = new G4Box("World", //its name WorldSizeX/2,WorldSizeY/2,WorldSizeZ/2); //its size logicWorld = new G4LogicalVolume(solidWorld, //its solid defaultMaterial, //its material "World"); //its name physiWorld = new G4PVPlacement(0, //no rotation G4ThreeVector(), //at (0,0,0) "World", //its name logicWorld, //its logical volume 0, //its mother volume false, //no boolean operation 0); //copy number // // N-Detector // // // Blocks // solidBlock1 = new G4Box("Block1", //its name Block1SizeX/2,Block1SizeY/2,Block1SizeZ/2); //size logicBlock1 = new G4LogicalVolume(solidBlock1, //its solid CalorMaterial, //its material "Block1"); //its name solidBlock2 = new G4Box("Block2", //its name Block2SizeX/2,Block2SizeY/2,Block2SizeZ/2); //size logicBlock2 = new G4LogicalVolume(solidBlock2, //its solid CalorMaterial, //its material "Block2"); //its name solidBlock3 = new G4Box("Block3", //its name Block3SizeX/2,Block3SizeY/2,Block3SizeZ/2); //size logicBlock3 = new G4LogicalVolume(solidBlock3, //its solid CalorMaterial, //its material "Block3"); //its name solidBlock4 = new G4Box("Block4", //its name Block4SizeX/2,Block4SizeY/2,Block4SizeZ/2); //size logicBlock4 = new G4LogicalVolume(solidBlock4, //its solid CalorMaterial, //its material "Block4"); //its name solidBlock5 = new G4Box("Block5", //its name Block5SizeX/2,Block5SizeY/2,Block5SizeZ/2); //size logicBlock5 = new G4LogicalVolume(solidBlock5, //its solid CalorMaterial, //its material "Block5"); //its name solidBlock6 = new G4Box("Block6", //its name Block6SizeX/2,Block6SizeY/2,Block6SizeZ/2); //size logicBlock6 = new G4LogicalVolume(solidBlock6, //its solid CalorMaterial, //its material "Block6"); //its name solidBlock7 = new G4Box("Block7", //its name Block7SizeX/2,Block7SizeY/2,Block7SizeZ/2); //size logicBlock7 = new G4LogicalVolume(solidBlock7, //its solid CalorMaterial, //its material "Block7"); //its name G4double x_pos, y_pos; G4double x_size; G4int k; G4VPhysicalVolume* physiFe = 0; G4double x_size_iron=1.0*inch; G4double y_size_iron=NbOfRows1*Block1SizeY+10*cm; G4double z_size_iron=Block1SizeZ+10*cm; G4Box* solidFe = new G4Box("Fe",x_size_iron/2.,y_size_iron/2.,z_size_iron/2.); G4LogicalVolume* logicFe = new G4LogicalVolume(solidFe, PlateMaterial, "Fe"); G4double x_base = 0.*cm; x_pos = x_base; // x_pos += 1.*cm; //--------------------------------- 1st layer -------------------------------- x_pos += x_size_iron/2.; physiFe = new G4PVPlacement(0, G4ThreeVector(x_pos,0.,0.), "Fe1",logicFe,physiWorld,false,0); x_pos += x_size_iron/2.+ 1.0*mm; x_pos += Block1SizeX/2.; G4double y_step=Block1SizeY*1.04; G4double y_base=-y_step*NbOfRows1*0.5; DetectorBottom=y_base-Block1SizeY*0.5; DetectorTop=DetectorBottom+NbOfRows1*y_step; for(k=0; kAddNewDetector( calorimeterSD ); } logicVeto ->SetSensitiveDetector(calorimeterSD); logicBlock1 ->SetSensitiveDetector(calorimeterSD); logicBlock2 ->SetSensitiveDetector(calorimeterSD); logicBlock3 ->SetSensitiveDetector(calorimeterSD); logicBlock4 ->SetSensitiveDetector(calorimeterSD); logicBlock5 ->SetSensitiveDetector(calorimeterSD); logicBlock6 ->SetSensitiveDetector(calorimeterSD); logicBlock7 ->SetSensitiveDetector(calorimeterSD); // // Visualization attributes // logicWorld->SetVisAttributes (G4VisAttributes::Invisible); G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,0.0)); simpleBoxVisAtt->SetVisibility(true); logicBlock1->SetVisAttributes(simpleBoxVisAtt); logicBlock2->SetVisAttributes(simpleBoxVisAtt); logicBlock3->SetVisAttributes(simpleBoxVisAtt); logicBlock4->SetVisAttributes(simpleBoxVisAtt); logicBlock5->SetVisAttributes(simpleBoxVisAtt); logicBlock6->SetVisAttributes(simpleBoxVisAtt); logicBlock7->SetVisAttributes(simpleBoxVisAtt); //---------------------------------------------------- G4VisAttributes* vetoBoxVisAtt= new G4VisAttributes(G4Colour(1.0,0.0,0.0)); vetoBoxVisAtt->SetVisibility(true); logicVeto->SetVisAttributes(vetoBoxVisAtt); //------------------------------------------------- G4VisAttributes* feBoxVisAtt= new G4VisAttributes(G4Colour(.5,1.0,.5)); feBoxVisAtt->SetVisibility(true); logicFe->SetVisAttributes(feBoxVisAtt); logicFeT->SetVisAttributes(feBoxVisAtt); logicFeV->SetVisAttributes(feBoxVisAtt); logicVFe->SetVisAttributes(feBoxVisAtt); logicFeL->SetVisAttributes(feBoxVisAtt); logicFeP->SetVisAttributes(feBoxVisAtt); // //always return the physical World // PrintCalorParameters(); return physiWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void GN1DetectorConstruction::PrintCalorParameters() { G4cout << "\n------------------------------------------------------------" << "\n--- "<< NbOfRows1 << " , " << NbOfRows2 << " , " << NbOfRows3 << " , " << NbOfRows4 << " , " << NbOfRows5 << " , " << NbOfRows6 << " and " << NbOfRows7 << " Rows ---\n"; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void GN1DetectorConstruction::UpdateGeometry() { G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter()); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......