I added two files, the version that works and the one that does not.
In the one that does not I simply changed the mother volume from the world
to the Telescope.
Thanks
Rick
The code that works:
********************
//-----------------------------------------------------------------------
// File Name: CraterDetectorConstruction.cc
// Purpose: Defines the physical makeup of the a simplified telescope
// Author: Rick Foster, MIT
//
// Rev 0.1 Initial revision
//-----------------------------------------------------------------------
#include "CraterDetectorConstruction.hh"
#include "CraterDetectorMessenger.hh"
#include "CraterTrackerSD.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "G4SDManager.hh"
#include "globals.hh"
#include "G4NistManager.hh"
#include "G4Isotope.hh"
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4UnitsTable.hh"
#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
CraterDetectorConstruction::CraterDetectorConstruction()
:solidWorld(0), logicWorld(0), physiWorld(0),
solidTelescope(0),logicTelescope(0),physiTelescope(0),
solidTep1(0), logicTep1(0), physiTep1(0),
solidTep2(0), logicTep2(0), physiTep2(0),
solidD1(0), logicD1(0), physiD1(0),
solidD2(0), logicD2(0), physiD2(0),
solidD3(0), logicD3(0), physiD3(0),
solidD4(0), logicD4(0), physiD4(0),
solidD5(0), logicD5(0), physiD5(0),
solidD6(0), logicD6(0), physiD6(0),
solidS1(0), logicS1(0), physiS1(0),
solidS2(0), logicS2(0), physiS2(0),
solidSource(0), logicSource(0), physiSource(0),
fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.)
{
detectorMessenger = new CraterDetectorMessenger(this);
}
CraterDetectorConstruction::~CraterDetectorConstruction()
{
delete detectorMessenger;
}
G4VPhysicalVolume* CraterDetectorConstruction::Construct()
{
//--------- Material definition ---------
G4NistManager* man = G4NistManager::Instance();
man->SetVerbose(0);
// define pure NIST materials
G4Material* Al = man->FindOrBuildMaterial("G4_Al");
// define pure NIST materials
G4Material* Si = man->FindOrBuildMaterial("G4_Si");
// define NIST materials
G4Material* TEP = man->FindOrBuildMaterial("G4_A-150_TISSUE");
// HEP materials
G4Material* vac = man->FindOrBuildMaterial("G4_Galactic");
// Print all the materials defined.
//G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
//G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
//------------------------------
// World
//------------------------------
G4double HalfWorldLength = 0.5*20.0*cm;
G4double HalfWorldHeight = 0.5*20.0*cm;
G4double HalfWorldDepth = 0.5*20.0*cm;
solidWorld= new G4Box("world",HalfWorldLength,HalfWorldHeight,HalfWorldDepth);
logicWorld= new G4LogicalVolume( solidWorld,vac, "World", 0, 0, 0);
// Must place the World Physical volume unrotated at (0,0,0).
physiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
logicWorld, // its logical volume
"World", // its name
0, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Telescope Shell
//------------------------------
G4ThreeVector positionTelescope = G4ThreeVector(0,0,0);
solidTelescope = new G4Tubs("telescope", //Name
1.8476*cm, //Inside radius
2.0*cm, //Outside radius
5.8262*cm, //Height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicTelescope = new G4LogicalVolume(solidTelescope,Al,"telescope",0,0,0);
physiTelescope = new G4PVPlacement(0, // no rotation
positionTelescope, // at (x,y,z)
logicTelescope, // its logical volume
"telescope", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// TEP1
//------------------------------
G4ThreeVector positionTep1 = G4ThreeVector(0,0,-1.9*cm);
solidTep1 = new G4Tubs("tep1", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
27.0*mm, //Height Note the is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicTep1 = new G4LogicalVolume(solidTep1,TEP,"TEP1",0,0,0);
physiTep1 = new G4PVPlacement(0, // no rotation
positionTep1, // at (x,y,z)
logicTep1, // its logical volume
"TEP1", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// TEP2
//------------------------------
G4ThreeVector positionTep2 = G4ThreeVector(0,0,3.15*cm);
solidTep2 = new G4Tubs("tep2", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
13.5*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicTep2 = new G4LogicalVolume(solidTep2,TEP,"TEP2",0,0,0);
physiTep2 = new G4PVPlacement(0, // no rotation
positionTep2, // at (x,y,z)
logicTep2, // its logical volume
"TEP2", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector6
//------------------------------
G4ThreeVector positionD6 = G4ThreeVector(0,0,4.95*cm);
solidD6 = new G4Tubs("detector6", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.5*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD6 = new G4LogicalVolume(solidD6,Si,"D6",0,0,0);
physiD6 = new G4PVPlacement(0, // no rotation
positionD6, // at (x,y,z)
logicD6, // its logical volume
"D6", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector5
//------------------------------
G4ThreeVector positionD5 = G4ThreeVector(0,0,4.75*cm);
solidD5 = new G4Tubs("detector5", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.07*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD5 = new G4LogicalVolume(solidD5,Si,"D5",0,0,0);
physiD5 = new G4PVPlacement(0, // no rotation
positionD5, // at (x,y,z)
logicD5, // its logical volume
"D5", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector4
//------------------------------
G4ThreeVector positionD4 = G4ThreeVector(0,0,1.45*cm);
solidD4 = new G4Tubs("detector4", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.5*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD4 = new G4LogicalVolume(solidD4,Si,"D4",0,0,0);
physiD4 = new G4PVPlacement(0, // no rotation
positionD4, // at (x,y,z)
logicD4, // its logical volume
"D4", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector3
//------------------------------
G4ThreeVector positionD3 = G4ThreeVector(0,0,1.25*cm);
solidD3 = new G4Tubs("detector3", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.07*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD3 = new G4LogicalVolume(solidD3,Si,"D3",0,0,0);
physiD3 = new G4PVPlacement(0, // no rotation
positionD3, // at (x,y,z)
logicD3, // its logical volume
"D3", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector2
//------------------------------
G4ThreeVector positionD2 = G4ThreeVector(0,0,-4.85*cm);
solidD2 = new G4Tubs("detector2", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.5*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD2 = new G4LogicalVolume(solidD2,Si,"D2",0,0,0);
physiD2 = new G4PVPlacement(0, // no rotation
positionD2, // at (x,y,z)
logicD2, // its logical volume
"D2", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector1
//------------------------------
G4ThreeVector positionD1 = G4ThreeVector(0,0,-5.05*cm);
solidD1 = new G4Tubs("detector1", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.07*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD1 = new G4LogicalVolume(solidD1,Si,"D1",0,0,0);
physiD1 = new G4PVPlacement(0, // no rotation
positionD1, // at (x,y,z)
logicD1, // its logical volume
"D1", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Shield1
//------------------------------
G4ThreeVector positionS1 = G4ThreeVector(0,0,-5.75*cm);
solidS1 = new G4Tubs("shield1", //Name
0.0*cm, //Inside radius
1.8476*cm, //Outside radius
0.762*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicS1 = new G4LogicalVolume(solidS1,Al,"S1",0,0,0);
physiS1 = new G4PVPlacement(0, // no rotation
positionS1, // at (x,y,z)
logicS1, // its logical volume
"S1", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Shield2
//------------------------------
G4ThreeVector positionS2 = G4ThreeVector(0,0,5.75*cm);
solidS2 = new G4Tubs("shield2", //Name
0.0*cm, //Inside radius
1.8476*cm, //Outside radius
0.762*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicS2 = new G4LogicalVolume(solidS2,Al,"S2",0,0,0);
physiS2 = new G4PVPlacement(0, // no rotation
positionS2, // at (x,y,z)
logicS2, // its logical volume
"S2", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------------------------
// Sensitive detectors
//------------------------------------------------
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String SDname;
CraterTracker1SD* detec1= new CraterTracker1SD(SDname="detector1");
SDman->AddNewDetector(detec1);
logicD1->SetSensitiveDetector(detec1);
CraterTracker2SD* detec2= new CraterTracker2SD(SDname="detector2");
SDman->AddNewDetector(detec2);
logicD2->SetSensitiveDetector(detec2);
CraterTracker3SD* detec3= new CraterTracker3SD(SDname="detector3");
SDman->AddNewDetector(detec3);
logicD3->SetSensitiveDetector(detec3);
CraterTracker4SD* detec4= new CraterTracker4SD(SDname="detector4");
SDman->AddNewDetector(detec4);
logicD4->SetSensitiveDetector(detec4);
CraterTracker5SD* detec5= new CraterTracker5SD(SDname="detector5");
SDman->AddNewDetector(detec5);
logicD5->SetSensitiveDetector(detec5);
CraterTracker6SD* detec6= new CraterTracker6SD(SDname="detector6");
SDman->AddNewDetector(detec6);
logicD6->SetSensitiveDetector(detec6);
//--------- Visualization attributes -------------------------------
G4VisAttributes* TelVisAtt= new G4VisAttributes(G4Colour(0.0,0.4,0.0,0.1));
TelVisAtt->SetForceSolid(true);
logicTelescope->SetVisAttributes(TelVisAtt);
TelVisAtt->SetVisibility(false);
G4VisAttributes* TEPVisAtt= new G4VisAttributes(G4Colour(0.4,0.4,0.4,0.6));
TEPVisAtt->SetForceSolid(true);
logicTep1 ->SetVisAttributes(TEPVisAtt);
logicTep2 ->SetVisAttributes(TEPVisAtt);
G4VisAttributes* DetThinVisAtt= new G4VisAttributes(G4Colour(1,1,0));
DetThinVisAtt->SetForceSolid(true);
logicD1 ->SetVisAttributes(DetThinVisAtt);
logicD3 ->SetVisAttributes(DetThinVisAtt);
logicD5 ->SetVisAttributes(DetThinVisAtt);
G4VisAttributes* DetThickVisAtt= new G4VisAttributes(G4Colour(0,0,1));
DetThickVisAtt->SetForceSolid(true);
logicD2 ->SetVisAttributes(DetThickVisAtt);
logicD4 ->SetVisAttributes(DetThickVisAtt);
logicD6 ->SetVisAttributes(DetThickVisAtt);
G4VisAttributes* ShieldVisAtt= new G4VisAttributes(G4Colour(0.0,0.4,0.0,0.3));
ShieldVisAtt->SetForceSolid(true);
logicS1 ->SetVisAttributes(ShieldVisAtt);
logicS2 ->SetVisAttributes(ShieldVisAtt);
G4VisAttributes* WorldVisAtt = new G4VisAttributes(G4Colour(.9,.9,.9,0.01));
logicWorld->SetVisAttributes(WorldVisAtt);
WorldVisAtt->SetVisibility(false);
return physiWorld;
}
The Code that Does not Work
(Particles pass right thru)
***************************
//-----------------------------------------------------------------------
// File Name: CraterDetectorConstruction.cc
// Purpose: Defines the physical makeup of the a simplified telescope
// Author: Rick Foster, MIT
//
// Rev 0.1 Initial revision
//-----------------------------------------------------------------------
#include "CraterDetectorConstruction.hh"
#include "CraterDetectorMessenger.hh"
#include "CraterTrackerSD.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "G4SDManager.hh"
#include "globals.hh"
#include "G4NistManager.hh"
#include "G4Isotope.hh"
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4UnitsTable.hh"
#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
CraterDetectorConstruction::CraterDetectorConstruction()
:solidWorld(0), logicWorld(0), physiWorld(0),
solidTelescope(0),logicTelescope(0),physiTelescope(0),
solidTep1(0), logicTep1(0), physiTep1(0),
solidTep2(0), logicTep2(0), physiTep2(0),
solidD1(0), logicD1(0), physiD1(0),
solidD2(0), logicD2(0), physiD2(0),
solidD3(0), logicD3(0), physiD3(0),
solidD4(0), logicD4(0), physiD4(0),
solidD5(0), logicD5(0), physiD5(0),
solidD6(0), logicD6(0), physiD6(0),
solidS1(0), logicS1(0), physiS1(0),
solidS2(0), logicS2(0), physiS2(0),
solidSource(0), logicSource(0), physiSource(0),
fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.)
{
detectorMessenger = new CraterDetectorMessenger(this);
}
CraterDetectorConstruction::~CraterDetectorConstruction()
{
delete detectorMessenger;
}
G4VPhysicalVolume* CraterDetectorConstruction::Construct()
{
//--------- Material definition ---------
G4NistManager* man = G4NistManager::Instance();
man->SetVerbose(0);
// define pure NIST materials
G4Material* Al = man->FindOrBuildMaterial("G4_Al");
// define pure NIST materials
G4Material* Si = man->FindOrBuildMaterial("G4_Si");
// define NIST materials
G4Material* TEP = man->FindOrBuildMaterial("G4_A-150_TISSUE");
// HEP materials
G4Material* vac = man->FindOrBuildMaterial("G4_Galactic");
// Print all the materials defined.
//G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
//G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
//------------------------------
// World
//------------------------------
G4double HalfWorldLength = 0.5*20.0*cm;
G4double HalfWorldHeight = 0.5*20.0*cm;
G4double HalfWorldDepth = 0.5*20.0*cm;
solidWorld= new G4Box("world",HalfWorldLength,HalfWorldHeight,HalfWorldDepth);
logicWorld= new G4LogicalVolume( solidWorld,vac, "World", 0, 0, 0);
// Must place the World Physical volume unrotated at (0,0,0).
physiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
logicWorld, // its logical volume
"World", // its name
0, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Telescope Shell
//------------------------------
G4ThreeVector positionTelescope = G4ThreeVector(0,0,0);
solidTelescope = new G4Tubs("telescope", //Name
1.8476*cm, //Inside radius
2.0*cm, //Outside radius
5.8262*cm, //Height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicTelescope = new G4LogicalVolume(solidTelescope,Al,"telescope",0,0,0);
physiTelescope = new G4PVPlacement(0, // no rotation
positionTelescope, // at (x,y,z)
logicTelescope, // its logical volume
"telescope", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// TEP1
//------------------------------
G4ThreeVector positionTep1 = G4ThreeVector(0,0,-1.9*cm);
solidTep1 = new G4Tubs("tep1", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
27.0*mm, //Height Note the is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicTep1 = new G4LogicalVolume(solidTep1,TEP,"TEP1",0,0,0);
physiTep1 = new G4PVPlacement(0, // no rotation
positionTep1, // at (x,y,z)
logicTep1, // its logical volume
"TEP1", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// TEP2
//------------------------------
G4ThreeVector positionTep2 = G4ThreeVector(0,0,3.15*cm);
solidTep2 = new G4Tubs("tep2", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
13.5*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicTep2 = new G4LogicalVolume(solidTep2,TEP,"TEP2",0,0,0);
physiTep2 = new G4PVPlacement(0, // no rotation
positionTep2, // at (x,y,z)
logicTep2, // its logical volume
"TEP2", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector6
//------------------------------
G4ThreeVector positionD6 = G4ThreeVector(0,0,4.95*cm);
solidD6 = new G4Tubs("detector6", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.5*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD6 = new G4LogicalVolume(solidD6,Si,"D6",0,0,0);
physiD6 = new G4PVPlacement(0, // no rotation
positionD6, // at (x,y,z)
logicD6, // its logical volume
"D6", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector5
//------------------------------
G4ThreeVector positionD5 = G4ThreeVector(0,0,4.75*cm);
solidD5 = new G4Tubs("detector5", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.07*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD5 = new G4LogicalVolume(solidD5,Si,"D5",0,0,0);
physiD5 = new G4PVPlacement(0, // no rotation
positionD5, // at (x,y,z)
logicD5, // its logical volume
"D5", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector4
//------------------------------
G4ThreeVector positionD4 = G4ThreeVector(0,0,1.45*cm);
solidD4 = new G4Tubs("detector4", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.5*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD4 = new G4LogicalVolume(solidD4,Si,"D4",0,0,0);
physiD4 = new G4PVPlacement(0, // no rotation
positionD4, // at (x,y,z)
logicD4, // its logical volume
"D4", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector3
//------------------------------
G4ThreeVector positionD3 = G4ThreeVector(0,0,1.25*cm);
solidD3 = new G4Tubs("detector3", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.07*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD3 = new G4LogicalVolume(solidD3,Si,"D3",0,0,0);
physiD3 = new G4PVPlacement(0, // no rotation
positionD3, // at (x,y,z)
logicD3, // its logical volume
"D3", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector2
//------------------------------
G4ThreeVector positionD2 = G4ThreeVector(0,0,-4.85*cm);
solidD2 = new G4Tubs("detector2", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.5*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD2 = new G4LogicalVolume(solidD2,Si,"D2",0,0,0);
physiD2 = new G4PVPlacement(0, // no rotation
positionD2, // at (x,y,z)
logicD2, // its logical volume
"D2", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Detector1
//------------------------------
G4ThreeVector positionD1 = G4ThreeVector(0,0,-5.05*cm);
solidD1 = new G4Tubs("detector1", //Name
0.0*cm, //Inside radius
1.75*cm, //Outside radius
0.07*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicD1 = new G4LogicalVolume(solidD1,Si,"D1",0,0,0);
physiD1 = new G4PVPlacement(0, // no rotation
positionD1, // at (x,y,z)
logicD1, // its logical volume
"D1", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Shield1
//------------------------------
G4ThreeVector positionS1 = G4ThreeVector(0,0,-5.75*cm);
solidS1 = new G4Tubs("shield1", //Name
0.0*cm, //Inside radius
1.8476*cm, //Outside radius
0.762*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicS1 = new G4LogicalVolume(solidS1,Al,"S1",0,0,0);
physiS1 = new G4PVPlacement(0, // no rotation
positionS1, // at (x,y,z)
logicS1, // its logical volume
"S1", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Shield2
//------------------------------
G4ThreeVector positionS2 = G4ThreeVector(0,0,5.75*cm);
solidS2 = new G4Tubs("shield2", //Name
0.0*cm, //Inside radius
1.8476*cm, //Outside radius
0.762*mm, //Height note this is 1/2 total height
0.0*deg, //Start Angle
360.0*deg); //Spanning Angle
logicS2 = new G4LogicalVolume(solidS2,Al,"S2",0,0,0);
physiS2 = new G4PVPlacement(0, // no rotation
positionS2, // at (x,y,z)
logicS2, // its logical volume
"S2", // its name
logicTelescope, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------------------------
// Sensitive detectors
//------------------------------------------------
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String SDname;
CraterTracker1SD* detec1= new CraterTracker1SD(SDname="detector1");
SDman->AddNewDetector(detec1);
logicD1->SetSensitiveDetector(detec1);
CraterTracker2SD* detec2= new CraterTracker2SD(SDname="detector2");
SDman->AddNewDetector(detec2);
logicD2->SetSensitiveDetector(detec2);
CraterTracker3SD* detec3= new CraterTracker3SD(SDname="detector3");
SDman->AddNewDetector(detec3);
logicD3->SetSensitiveDetector(detec3);
CraterTracker4SD* detec4= new CraterTracker4SD(SDname="detector4");
SDman->AddNewDetector(detec4);
logicD4->SetSensitiveDetector(detec4);
CraterTracker5SD* detec5= new CraterTracker5SD(SDname="detector5");
SDman->AddNewDetector(detec5);
logicD5->SetSensitiveDetector(detec5);
CraterTracker6SD* detec6= new CraterTracker6SD(SDname="detector6");
SDman->AddNewDetector(detec6);
logicD6->SetSensitiveDetector(detec6);
//--------- Visualization attributes -------------------------------
G4VisAttributes* TelVisAtt= new G4VisAttributes(G4Colour(0.0,0.4,0.0,0.1));
TelVisAtt->SetForceSolid(true);
logicTelescope->SetVisAttributes(TelVisAtt);
TelVisAtt->SetVisibility(false);
G4VisAttributes* TEPVisAtt= new G4VisAttributes(G4Colour(0.4,0.4,0.4,0.6));
TEPVisAtt->SetForceSolid(true);
logicTep1 ->SetVisAttributes(TEPVisAtt);
logicTep2 ->SetVisAttributes(TEPVisAtt);
G4VisAttributes* DetThinVisAtt= new G4VisAttributes(G4Colour(1,1,0));
DetThinVisAtt->SetForceSolid(true);
logicD1 ->SetVisAttributes(DetThinVisAtt);
logicD3 ->SetVisAttributes(DetThinVisAtt);
logicD5 ->SetVisAttributes(DetThinVisAtt);
G4VisAttributes* DetThickVisAtt= new G4VisAttributes(G4Colour(0,0,1));
DetThickVisAtt->SetForceSolid(true);
logicD2 ->SetVisAttributes(DetThickVisAtt);
logicD4 ->SetVisAttributes(DetThickVisAtt);
logicD6 ->SetVisAttributes(DetThickVisAtt);
G4VisAttributes* ShieldVisAtt= new G4VisAttributes(G4Colour(0.0,0.4,0.0,0.3));
ShieldVisAtt->SetForceSolid(true);
logicS1 ->SetVisAttributes(ShieldVisAtt);
logicS2 ->SetVisAttributes(ShieldVisAtt);
G4VisAttributes* WorldVisAtt = new G4VisAttributes(G4Colour(.9,.9,.9,0.01));
logicWorld->SetVisAttributes(WorldVisAtt);
WorldVisAtt->SetVisibility(false);
return physiWorld;
}
|