//Contruction of Yaguar Reactor
//
//Defines the materials, constructs the reactor, and defines a volume as a sensitive detector. 
//

#include "ReactorConstruction.hh"
#include "ReactorDetector.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "globals.hh"
#include "G4Cons.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4PSCellFlux.hh"
#include "G4SDManager.hh"
#include "G4PSDoseDeposit.hh"
#include "G4VPrimitiveScorer.hh"
#include "G4PSEnergyDeposit.hh"
#include "G4PSNofSecondary.hh"
#include "G4PSTrackLength.hh"
#include "G4PSNofStep.hh"
#include "G4PSMinKinEAtGeneration.hh"
#include "G4VSDFilter.hh"
#include "G4SDParticleFilter.hh"
#include "G4SDChargedFilter.hh"
#include "G4PSFlatSurfaceCurrent.hh"
#include "G4PSPassageCellCurrent.hh"
#include "G4PSFlatSurfaceFlux.hh"
#include "G4SDParticleWithEnergyFilter.hh"
#include "G4PSCylinderSurfaceCurrent.hh"

#include "G4ios.hh"
#include "G4GeometryTolerance.hh"
#include "G4GeometryManager.hh"

ReactorConstruction::ReactorConstruction()
 :  world_log(0),nn_cavity_log(0),al_tube_log(0),air_beneath_log(0),ch2_convertor_log(0),
	al_tube_log2(0),
	air_above_log(0),control_rod_1_log(0),air_left_LIH_log(0),control_rod_2_log(0),air_up_LIH_log(0),
	FE_vessel_1_log(0),FE_vessel_2_log(0),active_core_con_log(0),active_core_cyl_log(0),air_buffer_1_log(0),FE_vessel_3_log(0),
	hole_in_FE_log(0),FE_vessel_4_log(0),air_buffer_upper_log(0),FE_vessel_5_log(0),FE_vessel_6_log(0),
	air_buffer_2_log(0),ch_bottom_log(0),ch_upper_log(0),FE_1_log(0),FE_2_log(0),lead_sheilding_log(0),
	FE_cover_PB_log(0),conical_region_in_core_log(0),not_sure_1_log(0),not_sure_2_log(0),FE_vessel_7_log(0),
    world_phys(0), cavity_phys(0), al_tube_phys(0), air_beneath_phys(0), ch2_convertor_phys(0), 
	al_tube_phys2(0),
	air_above_phys(0), control_rod_1_phys(0), air_left_LIH_phys(0), control_rod_2_phys(0), 
	air_up_LIH_phys(0), FE_vessel_1_phys(0), FE_vessel_2_phys(0),active_core_con_phys(0),active_core_cyl_phys(0), 
	air_buffer_1_phys(0), FE_vessel_3_phys(0), hole_in_FE_phys(0), FE_vessel_4_phys(0), 
	air_buffer_upper_phys(0), FE_vessel_5_phys(0), FE_vessel_6_phys(0), air_buffer_2_phys(0), 
	ch_bottom_phys(0), ch_upper_phys(0), FE_1_phys(0), FE_2_phys(0), 
	lead_sheilding_phys(0), FE_cover_PB_phys(0), conical_region_in_core_phys(0), not_sure_1_phys(0), 
	not_sure_2_phys(0),FE_vessel_7_phys(0), GamDet_phys(0), GamDet_log(0)
{;}

ReactorConstruction::~ReactorConstruction()
{
}

G4VPhysicalVolume* ReactorConstruction::Construct()
{



//****************************************************Define Materials Used*******************************************************

//Vacuum

G4double a;
G4double fractionmass;
 G4int natoms;
G4double density;

a = 14.01*g/mole;
  G4Element* elN  = new G4Element("Nitrogen ","N", 7., a);

a = 16.00*g/mole;
  G4Element* elO  = new G4Element("Oxygen "  ,"O" ,8., a);

  //density = 0.1569*mg/cm3;
  density = 0.000001569*mg/cm3;
  G4Material* Vacuum = new G4Material("Vacuum ",density,2);
  Vacuum->AddElement(elN, fractionmass=80*perCent);
  Vacuum->AddElement(elO, fractionmass=20*perCent);

  
//Air
  density = 1.290*mg/cm3;
 // density = 0.000001569*mg/cm3;
  G4Material* Air = new G4Material("Air ",density,2);
  Air->AddElement(elN, fractionmass=80*perCent);
  Air->AddElement(elO, fractionmass=20*perCent);

//Al
G4Material* Al = 
  new G4Material("Aluminum", 13., 26.98*g/mole, 2.7*g/cm3);
  
//CH2    -----Density .96 Hydrogen 14.3716%, Carbon 12 85.6284g/cm3
a=1.00794*g/mole;
	G4Element* elH = new G4Element("Hydrogen ","H", 1.,a);
a=12.01*g/mole;
	G4Element* elC = new G4Element("Carbon ","C",6,a);
	
//density = 0.000001569*mg/cm3;//930.*mg/cm3; 
density = 930.*mg/cm3; 

G4Material* CH2 = new G4Material("CH2 ",density,2);
CH2->AddElement(elH, fractionmass=14.3716*perCent);
CH2->AddElement(elC, fractionmass=85.6284*perCent);

//B4C(Boron Carbide)        ------Density 2.52g/cm3
a=10.811*g/mole;
	G4Element* elB =new G4Element("Boron ","B",5.,a);

density = 2520*mg/cm3; 
//density = 0.000001569*mg/cm3;
G4Material* B4C = new G4Material("Boron Carbide ",density,2);
B4C->AddElement(elB, natoms=4);
B4C->AddElement(elC, natoms=1);	

//LiH    ------Density .9g/cm3
a=6.941*g/mole;
	G4Element* elLi =new G4Element("Lithium ","Li",3.,a);

density = 900*mg/cm3; 
//density = 0.000001569*mg/cm3;
G4Material* LiH = new G4Material("LiH ",density, 2);
LiH->AddElement(elH, natoms=1);
LiH->AddElement(elLi, natoms=1);	

//Fe  --------Density 7.9g/cm3
G4Material* Fe = 
  new G4Material("Iron", 26., 55.845*g/mole,7.9*g/cm3);
  
//Pb -----------Density 11g/cm3
G4Material* Pb = 
  new G4Material("Lead", 82., 207.2*g/mole,11.*g/cm3);

//H20 -------------Density .9982g/cm3
density = 998.2*mg/cm3;
//density = 0.000001569*mg/cm3;
  G4Material* H2O = new G4Material("Water ",density,2);
  H2O->AddElement(elH, natoms=2);
  H2O->AddElement(elO, natoms=1);
 
 
//*************************************************************Geometry*******************************************************************



//Cleanout old Geometry

G4GeometryManager::GetInstance()->OpenGeometry();
  G4PhysicalVolumeStore::GetInstance()->Clean();
  G4LogicalVolumeStore::GetInstance()->Clean();
  G4SolidStore::GetInstance()->Clean();

//Each geometry is broken down into three parts.  
	
	//A Solid which is the shape and volume of the the geometry
	
	//A Logical which is the material of the geometry
	
	//A Physical which is the rotation and placement of the geometry

  
//WORLD VOLUME 
  G4double world_x = 3.0*m;
  G4double world_y = 3.0*m;
  G4double world_z = 10.0*m;
  G4Box* world_box
    = new G4Box("world_box",world_x,world_y,world_z);
  world_log = new G4LogicalVolume(world_box,
                                             Vacuum,"world_log",0,0,0);
  world_phys = new G4PVPlacement(0,G4ThreeVector(),
                                      world_log,"expHall",0,false,0);


//NN-CAVITY
G4double innerRadiusCavity = 0.*cm;
G4double outerRadiusCavity = 2.5*cm;
//G4double heightOfTheCavity = 20.5*cm;
G4double heightOfTheCavity = 18.26*cm;
G4double startAngleOfCavity = 0.*deg;
G4double spanningAngleOfCavity = 360.*deg;
G4Tubs* nn_cavity 
	=new G4Tubs("nn_cavity",
        innerRadiusCavity,
        outerRadiusCavity,
		heightOfTheCavity,
		startAngleOfCavity,
		spanningAngleOfCavity);
		
G4LogicalVolume* nn_cavity_log
		= new G4LogicalVolume(nn_cavity,Vacuum,"nn_cavity_log");

G4double cavityPos_x = 0.*cm;
G4double cavityPos_y = 0.0*cm;
//G4double cavityPos_z = 20.5*cm;
G4double cavityPos_z = 34.76*cm;
G4VPhysicalVolume* cavity_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(cavityPos_x,cavityPos_y,cavityPos_z),// translation position
		nn_cavity_log, // its logical volume
		"nn_cavity", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number

//Vacuum inside Al tube gamma detector

G4double innerRadiusGamDet = 2.6*cm;
G4double outerRadiusGamDet = 2.7*cm;
//G4double heightOfTheGamDet = 20.5*cm;
G4double heightOfTheGamDet = 18.26*cm;
//G4double heightOfTheGamDet = 20.*cm;
G4double startAngleOfGamDet = 0.*deg;
G4double spanningAngleOfGamDet = 360.*deg;
G4Tubs* GamDet
	=new G4Tubs("GamDet",
        innerRadiusGamDet,
        outerRadiusGamDet,
		heightOfTheGamDet,
		startAngleOfGamDet,
		spanningAngleOfGamDet);
		
G4LogicalVolume* GamDet_log
		= new G4LogicalVolume(GamDet,Vacuum,"GamDet_log");
		
G4double GamDetPos_x = 0.*cm;
G4double GamDetPos_y = 0.0*cm;
//G4double GamDetPos_z = 20.5*cm;
G4double GamDetPos_z = 34.74*cm;
//G4double GamDetPos_z = 20.0*cm;
G4VPhysicalVolume* GamDet_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(GamDetPos_x,GamDetPos_y,GamDetPos_z),// translation position
		GamDet_log, // its logical volume
		"GamDet", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//AL TUBE 2MM- 1 micrometer

G4double innerRadiusAl_Tube = 2.8001*cm;
G4double outerRadiusAl_Tube = 3.0*cm;
G4double heightOfTheAl_Tube = 53.*cm;
G4double startAngleOfAl_Tube = 0.*deg;
G4double spanningAngleOfAl_Tube = 360.*deg;
G4Tubs* al_tube 
	=new G4Tubs("al_tube",
        innerRadiusAl_Tube,
        outerRadiusAl_Tube,
		heightOfTheAl_Tube,
		startAngleOfAl_Tube,
		spanningAngleOfAl_Tube);
		
G4LogicalVolume* al_tube_log
		= new G4LogicalVolume(al_tube,Al,"al_tube_log");
		
G4double al_tubePos_x = 0.*cm;
G4double al_tubePos_y = 0.0*cm;
G4double al_tubePos_z = 53.*cm;
G4VPhysicalVolume* al_tube_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(al_tubePos_x,al_tubePos_y,al_tubePos_z),// translation position
		al_tube_log, // its logical volume
		"al_tube", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number		

//AL TUBE 1 micrometer

G4double innerRadiusAl_Tube2 = 2.8*cm;
G4double outerRadiusAl_Tube2 = 2.8001*cm;
G4double heightOfTheAl_Tube2 = 53.*cm;
G4double startAngleOfAl_Tube2 = 0.*deg;
G4double spanningAngleOfAl_Tube2 = 360.*deg;
G4Tubs* al_tube2 
	=new G4Tubs("al_tube2",
        innerRadiusAl_Tube2,
        outerRadiusAl_Tube2,
		heightOfTheAl_Tube2,
		startAngleOfAl_Tube2,
		spanningAngleOfAl_Tube2);
		
G4LogicalVolume* al_tube_log2
		= new G4LogicalVolume(al_tube2,Al,"al_tube_log2");
		
G4double al_tubePos_x2 = 0.*cm;
G4double al_tubePos_y2 = 0.0*cm;
G4double al_tubePos_z2 = 53.*cm;
G4VPhysicalVolume* al_tube_phys2
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(al_tubePos_x2,al_tubePos_y2,al_tubePos_z2),// translation position
		al_tube_log2, // its logical volume
		"al_tube2", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number		

	
//AIR BENEATH CH2. 6, -1.3E-3   -----------------------------------------------------MCNPX has it as a different material
G4double innerRadiusAir_Beneath = 3.*cm;
G4double outerRadiusAir_Beneath = 6.*cm;
G4double heightOfTheAir_Beneath = 10.*cm;
G4double startAngleOfAir_Beneath = 0.*deg;
G4double spanningAngleOfAir_Beneath = 360.*deg;
G4Tubs* air_beneath 
	=new G4Tubs("air_beneath",
        innerRadiusAir_Beneath,
        outerRadiusAir_Beneath,
		heightOfTheAir_Beneath,
		startAngleOfAir_Beneath,
		spanningAngleOfAir_Beneath);
		
G4LogicalVolume* air_beneath_log
		= new G4LogicalVolume(air_beneath,Air,"air_beneath_log");
		
G4double air_beneathPos_x = 0.*cm;
G4double air_beneathPos_y = 0.0*cm;
G4double air_beneathPos_z = 2.*cm;
G4VPhysicalVolume* air_beneath_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(air_beneathPos_x,air_beneathPos_y,air_beneathPos_z),// translation position
		air_beneath_log, // its logical volume
		"air_beneath", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number		


//CH2 CONVERTOR  
G4double innerRadiusCH2_Convertor = 3.0*cm;
G4double outerRadiusCH2_Convertor = 6.0*cm;
G4double heightOfTheCH2_Convertor = 18.26*cm;
G4double startAngleOfCH2_Convertor = 0.0*deg;
G4double spanningAngleOfCH2_Convertor = 360.0*deg;
G4Tubs* ch2_convertor 
	=new G4Tubs("ch2_convertor",
        innerRadiusCH2_Convertor,
        outerRadiusCH2_Convertor,
		heightOfTheCH2_Convertor,
		startAngleOfCH2_Convertor,
		spanningAngleOfCH2_Convertor);
		
G4LogicalVolume* ch2_convertor_log
		= new G4LogicalVolume(ch2_convertor,CH2,"ch2_convertor_log");
		
G4double ch2_convertorPos_x = 0.*cm;
G4double ch2_convertorPos_y = 0.0*cm;
G4double ch2_convertorPos_z = 34.74*cm;
G4VPhysicalVolume* ch2_convertor_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(ch2_convertorPos_x,ch2_convertorPos_y,ch2_convertorPos_z),// translation position
		ch2_convertor_log, // its logical volume
		"ch2_convertor", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number		
		
//AIR ABOVE CH2
G4double innerRadiusAir_Above = 3.*cm;
G4double outerRadiusAir_Above = 6.*cm;
G4double heightOfTheAir_Above = 22.5*cm;
G4double startAngleOfAir_Above = 0.*deg;
G4double spanningAngleOfAir_Above = 360.*deg;
G4Tubs* air_above 
	=new G4Tubs("air_above",
        innerRadiusAir_Above,
        outerRadiusAir_Above,
		heightOfTheAir_Above,
		startAngleOfAir_Above,
		spanningAngleOfAir_Above);
		
G4LogicalVolume* air_above_log
		= new G4LogicalVolume(air_above,Air,"air_above_log");
		
G4double air_abovePos_x = 0.*cm;
G4double air_abovePos_y = 0.0*cm;
G4double air_abovePos_z = 75.5*cm;
G4VPhysicalVolume* air_above_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(air_abovePos_x,air_abovePos_y,air_abovePos_z),// translation position
		air_above_log, // its logical volume
		"air_above", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//CONTROL ROD NO.1. 3, -0.9
G4double innerRadiusControl_Rod_1 = 6.*cm;
G4double outerRadiusControl_Rod_1 = 7.*cm;
G4double heightOfTheControl_Rod_1 = 10.*cm;
G4double startAngleOfControl_Rod_1 = 0.*deg;
G4double spanningAngleOfControl_Rod_1 = 360.*deg;
G4Tubs* control_rod_1
	=new G4Tubs("control_rod_1",
        innerRadiusControl_Rod_1,
        outerRadiusControl_Rod_1,
		heightOfTheControl_Rod_1,
		startAngleOfControl_Rod_1,
		spanningAngleOfControl_Rod_1);
		
G4LogicalVolume* control_rod_1_log
		= new G4LogicalVolume(control_rod_1,B4C,"control_rod_1_log");
		
G4double control_rod_1Pos_x = 0.*cm;
G4double control_rod_1Pos_y = 0.0*cm;
G4double control_rod_1Pos_z = 2.*cm;
G4VPhysicalVolume* control_rod_1_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(control_rod_1Pos_x,control_rod_1Pos_y,control_rod_1Pos_z),// translation position
		control_rod_1_log, // its logical volume
		"control_rod_1", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number		

//AIR LEFT BY LiH
G4double innerRadiusAir_Left_LIH = 6.*cm;
G4double outerRadiusAir_Left_LIH = 7.*cm;
G4double heightOfTheAir_Left_LIH = 21.5*cm;
G4double startAngleOfAir_Left_LIH = 0.*deg;
G4double spanningAngleOfAir_Left_LIH = 360.*deg;
G4Tubs* air_left_LIH
	=new G4Tubs("air_left_LIH",
        innerRadiusAir_Left_LIH,
        outerRadiusAir_Left_LIH,
		heightOfTheAir_Left_LIH,
		startAngleOfAir_Left_LIH,
		spanningAngleOfAir_Left_LIH);
		
G4LogicalVolume* air_left_LIH_log
		= new G4LogicalVolume(air_left_LIH,Air,"air_left_LIH_log");
		
G4double air_left_LIHPos_x = 0.*cm;
G4double air_left_LIHPos_y = 0.0*cm;
G4double air_left_LIHPos_z = 33.5*cm;
G4VPhysicalVolume* air_left_LIH_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(air_left_LIHPos_x,air_left_LIHPos_y,air_left_LIHPos_z),// translation position
		air_left_LIH_log, // its logical volume
		"air_left_LIH", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number		
//CONTROL ROD NO.2
G4double innerRadiusControl_Rod_2 = 6.*cm;
G4double outerRadiusControl_Rod_2 = 7.*cm;
G4double heightOfTheControl_Rod_2 = 10.*cm;
G4double startAngleOfControl_Rod_2 = 0.*deg;
G4double spanningAngleOfControl_Rod_2 = 360.*deg;
G4Tubs* control_rod_2
	=new G4Tubs("control_rod_2",
        innerRadiusControl_Rod_2,
        outerRadiusControl_Rod_2,
		heightOfTheControl_Rod_2,
		startAngleOfControl_Rod_2,
		spanningAngleOfControl_Rod_2);
		
G4LogicalVolume* control_rod_2_log
		= new G4LogicalVolume(control_rod_2,LiH,"control_rod_2_log");
		
G4double control_rod_2Pos_x = 0.*cm;
G4double control_rod_2Pos_y = 0.0*cm;
G4double control_rod_2Pos_z = 65.*cm;
G4VPhysicalVolume* control_rod_2_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(control_rod_2Pos_x,control_rod_2Pos_y,control_rod_2Pos_z),// translation position
		control_rod_2_log, // its logical volume
		"control_rod_2", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number		
//AIR UP LiH
G4double innerRadiusAir_Up_LIH = 6.*cm;
G4double outerRadiusAir_Up_LIH = 7.*cm;
G4double heightOfTheAir_Up_LIH = 11.5*cm;
G4double startAngleOfAir_Up_LIH = 0.*deg;
G4double spanningAngleOfAir_Up_LIH = 360.*deg;
G4Tubs* air_up_LIH
	=new G4Tubs("air_up_LIH",
        innerRadiusAir_Up_LIH,
        outerRadiusAir_Up_LIH,
		heightOfTheAir_Up_LIH,
		startAngleOfAir_Up_LIH,
		spanningAngleOfAir_Up_LIH);
		
G4LogicalVolume* air_up_LIH_log
		= new G4LogicalVolume(air_up_LIH,Air,"air_up_LIH_log");
		
G4double air_up_LIHPos_x = 0.*cm;
G4double air_up_LIHPos_y = 0.0*cm;
G4double air_up_LIHPos_z = 86.5*cm;
G4VPhysicalVolume* air_up_LIH_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(air_up_LIHPos_x,air_up_LIHPos_y,air_up_LIHPos_z),// translation position
		air_up_LIH_log, // its logical volume
		"air_up_LIH", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
//FE VESSEL#1
G4double innerRadiusFE_Vessel_1 = 7.*cm;
G4double outerRadiusFE_Vessel_1 = 30.9*cm;
G4double heightOfTheFE_Vessel_1 = 6.*cm;
G4double startAngleOfFE_Vessel_1 = 0.*deg;
G4double spanningAngleOfFE_Vessel_1 = 360.*deg;
G4Tubs* FE_vessel_1
	=new G4Tubs("FE_vessel_1",
        innerRadiusFE_Vessel_1,
        outerRadiusFE_Vessel_1,
		heightOfTheFE_Vessel_1,
		startAngleOfFE_Vessel_1,
		spanningAngleOfFE_Vessel_1);
		
G4LogicalVolume* FE_vessel_1_log
		= new G4LogicalVolume(FE_vessel_1,Fe,"FE_vessel_1_log");
		
G4double FE_vessel_1Pos_x = 0.*cm;
G4double FE_vessel_1Pos_y = 0.0*cm;
G4double FE_vessel_1Pos_z = 6.*cm;
G4VPhysicalVolume* FE_vessel_1_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_vessel_1Pos_x,FE_vessel_1Pos_y,FE_vessel_1Pos_z),// translation position
		FE_vessel_1_log, // its logical volume
		"FE_vessel_1", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	

//FE VESSEL#2
G4double innerRadiusFE_Vessel_2 = 7.*cm;
G4double outerRadiusFE_Vessel_2 = 8.55*cm;
G4double heightOfTheFE_Vessel_2 = 21.5*cm;
G4double startAngleOfFE_Vessel_2 = 0.*deg;
G4double spanningAngleOfFE_Vessel_2 = 360.*deg;
G4Tubs* FE_vessel_2
	=new G4Tubs("FE_vessel_2",
        innerRadiusFE_Vessel_2,
        outerRadiusFE_Vessel_2,
		heightOfTheFE_Vessel_2,
		startAngleOfFE_Vessel_2,
		spanningAngleOfFE_Vessel_2);
		
G4LogicalVolume* FE_vessel_2_log
		= new G4LogicalVolume(FE_vessel_2,Fe,"FE_vessel_2_log");
		
G4double FE_vessel_2Pos_x = 0.*cm;
G4double FE_vessel_2Pos_y = 0.0*cm;
G4double FE_vessel_2Pos_z = 36.5*cm;
G4VPhysicalVolume* FE_vessel_2_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_vessel_2Pos_x,FE_vessel_2Pos_y,FE_vessel_2Pos_z),// translation position
		FE_vessel_2_log, // its logical volume
		"FE_vessel_2", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	

//ACTIVE CORE CYLINDRICAL REGION
G4double innerRadiusActive_Core_Cyl= 8.55*cm;
G4double outerRadiusActive_Core_Cyl = 19.5*cm;
G4double heightOfTheActive_Core_Cyl = 18.26*cm;
G4double startAngleOfActive_Core_Cyl = 0.*deg;
G4double spanningAngleOfActive_Core_Cyl = 360.*deg;
G4Tubs* active_core_cyl
	=new G4Tubs("active_core_cyl",
        innerRadiusActive_Core_Cyl,
        outerRadiusActive_Core_Cyl,
		heightOfTheActive_Core_Cyl,
		startAngleOfActive_Core_Cyl,
		spanningAngleOfActive_Core_Cyl);
		
G4LogicalVolume* active_core_cyl_log
		= new G4LogicalVolume(active_core_cyl,H2O,"active_core_cyl_log");
		
G4double active_core_cylPos_x = 0.*cm;
G4double active_core_cylPos_y = 0.0*cm;
G4double active_core_cylPos_z = 34.74*cm;
G4VPhysicalVolume* active_core_cyl_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(active_core_cylPos_x,active_core_cylPos_y,active_core_cylPos_z),// translation position
		active_core_cyl_log, // its logical volume
		"active_core_cyl", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	

		
//ACTIVE CORE CONICAL REGION
G4double innerRadiusMinusZOfActive_Core_Con = 19.5*cm;
G4double outerRadiusMinusZOfActive_Core_Con = 19.50001*cm;
G4double outerRadiusPlusZOfActive_Core_Con = 19.5*cm;
G4double innerRadiusPlusZOfActive_Core_Con = 8.55*cm;
G4double zHalfLengthOfActive_Core_Con = 2.24*cm;
G4double startPhiAngleOfActive_Core_Con = 0.*deg;
G4double deltaPhiAngleOfActive_Core_Con = 360*deg;
G4Cons* active_core_con
	=new G4Cons("active_core_con",
       innerRadiusMinusZOfActive_Core_Con,
	   outerRadiusMinusZOfActive_Core_Con,
       innerRadiusPlusZOfActive_Core_Con,
	   outerRadiusPlusZOfActive_Core_Con,
       zHalfLengthOfActive_Core_Con,
       startPhiAngleOfActive_Core_Con,
	   deltaPhiAngleOfActive_Core_Con);
		
G4LogicalVolume* active_core_con_log
		= new G4LogicalVolume(active_core_con,H2O,"active_core_con_log");
		
G4double active_core_conPos_x = 0.*cm;
G4double active_core_conPos_y = 0.0*cm;
G4double active_core_conPos_z = 14.24*cm;
G4VPhysicalVolume* active_core_con_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(active_core_conPos_x,active_core_conPos_y,active_core_conPos_z),// translation position
		active_core_con_log, // its logical volume
		"active_core_con", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
	
//AIR BUFFER
G4double innerRadiusAir_Buffer_1 = 8.55*cm;
G4double outerRadiusAir_Buffer_1 = 21.5*cm;
G4double heightOfTheAir_Buffer_1 = 1.*cm;
G4double startAngleOfAir_Buffer_1 = 0.*deg;
G4double spanningAngleOfAir_Buffer_1 = 360.*deg;
G4Tubs* air_buffer_1
	=new G4Tubs("air_buffer_1",
        innerRadiusAir_Buffer_1,
        outerRadiusAir_Buffer_1,
		heightOfTheAir_Buffer_1,
		startAngleOfAir_Buffer_1,
		spanningAngleOfAir_Buffer_1);
		
G4LogicalVolume* air_buffer_1_log
		= new G4LogicalVolume(air_buffer_1,Air,"air_buffer_1_log");
		
G4double air_buffer_1Pos_x = 0.*cm;
G4double air_buffer_1Pos_y = 0.0*cm;
G4double air_buffer_1Pos_z = 54.*cm;
G4VPhysicalVolume* air_buffer_1_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(air_buffer_1Pos_x,air_buffer_1Pos_y,air_buffer_1Pos_z),// translation position
		air_buffer_1_log, // its logical volume
		"air_buffer_1", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//FE VESSEL#3
G4double innerRadiusFE_Vessel_3 = 21.5*cm;
G4double outerRadiusFE_Vessel_3 = 25.85*cm;
G4double heightOfTheFE_Vessel_3 = 21.5*cm;
G4double startAngleOfFE_Vessel_3 = 0.*deg;
G4double spanningAngleOfFE_Vessel_3 = 360.*deg;
G4Tubs* FE_vessel_3
	=new G4Tubs("FE_vessel_3",
        innerRadiusFE_Vessel_3,
        outerRadiusFE_Vessel_3,
		heightOfTheFE_Vessel_3,
		startAngleOfFE_Vessel_3,
		spanningAngleOfFE_Vessel_3);
		
G4LogicalVolume* FE_vessel_3_log
		= new G4LogicalVolume(FE_vessel_3,Fe,"FE_vessel_3_log");
		
G4double FE_vessel_3Pos_x = 0.*cm;
G4double FE_vessel_3Pos_y = 0.0*cm;
G4double FE_vessel_3Pos_z = 33.5*cm;
G4VPhysicalVolume* FE_vessel_3_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_vessel_3Pos_x,FE_vessel_3Pos_y,FE_vessel_3Pos_z),// translation position
		FE_vessel_3_log, // its logical volume
		"FE_vessel_3", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
		
//HOLE IN FE
G4double innerRadiusHole_In_FE = 14.*cm;
G4double outerRadiusHole_In_FE = 16.*cm;
G4double heightOfTheHole_In_FE = 1.5*cm;
G4double startAngleOfHole_In_FE = 0.*deg;
G4double spanningAngleOfHole_In_FE = 360.*deg;
G4Tubs* hole_in_FE
	=new G4Tubs("hole_in_FE",
        innerRadiusHole_In_FE,
        outerRadiusHole_In_FE,
		heightOfTheHole_In_FE,
		startAngleOfHole_In_FE,
		spanningAngleOfHole_In_FE);
		
G4LogicalVolume* hole_in_FE_log
		= new G4LogicalVolume(hole_in_FE,Air,"hole_in_FE_log");
		
G4double hole_in_FEPos_x = 0.*cm;
G4double hole_in_FEPos_y = 0.0*cm;
G4double hole_in_FEPos_z = 56.5*cm;
G4VPhysicalVolume* hole_in_FE_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(hole_in_FEPos_x,hole_in_FEPos_y,hole_in_FEPos_z),// translation position
		hole_in_FE_log, // its logical volume
		"hole_in_FE", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//FE VESSEL#4
G4double innerRadiusFE_Vessel_4 = 7.*cm;
G4double outerRadiusFE_Vessel_4 = 8.55*cm;
G4double heightOfTheFE_Vessel_4 = 17.5*cm;
G4double startAngleOfFE_Vessel_4 = 0.*deg;
G4double spanningAngleOfFE_Vessel_4 = 360.*deg;
G4Tubs* FE_vessel_4
	=new G4Tubs("FE_vessel_4",
        innerRadiusFE_Vessel_4,
        outerRadiusFE_Vessel_4,
		heightOfTheFE_Vessel_4,
		startAngleOfFE_Vessel_4,
		spanningAngleOfFE_Vessel_4);
		
G4LogicalVolume* FE_vessel_4_log
		= new G4LogicalVolume(FE_vessel_4,Fe,"FE_vessel_4_log");
		
G4double FE_vessel_4Pos_x = 0.*cm;
G4double FE_vessel_4Pos_y = 0.0*cm;
G4double FE_vessel_4Pos_z = 75.5*cm;
G4VPhysicalVolume* FE_vessel_4_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_vessel_4Pos_x,FE_vessel_4Pos_y,FE_vessel_4Pos_z),// translation position
		FE_vessel_4_log, // its logical volume
		"FE_vessel_4", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//AIR BUFFER,UPPER
G4double innerRadiusAir_Buffer_Upper = 8.55*cm;
G4double outerRadiusAir_Buffer_Upper = 21.5*cm;
G4double heightOfTheAir_Buffer_Upper = 17.5*cm;
G4double startAngleOfAir_Buffer_Upper = 0.*deg;
G4double spanningAngleOfAir_Buffer_Upper  = 360.*deg;
G4Tubs* air_buffer_upper
	=new G4Tubs("air_buffer_upper",
        innerRadiusAir_Buffer_Upper,
        outerRadiusAir_Buffer_Upper,
		heightOfTheAir_Buffer_Upper,
		startAngleOfAir_Buffer_Upper,
		spanningAngleOfAir_Buffer_Upper);
		
G4LogicalVolume* air_buffer_upper_log
		= new G4LogicalVolume(air_buffer_upper,Air,"air_buffer_upper_log");
		
G4double air_buffer_upperPos_x = 0.*cm;
G4double air_buffer_upperPos_y = 0.0*cm;
G4double air_buffer_upperPos_z = 75.5*cm;
G4VPhysicalVolume* air_buffer_upper_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(air_buffer_upperPos_x,air_buffer_upperPos_y,air_buffer_upperPos_z),// translation position
		air_buffer_upper_log, // its logical volume
		"air_buffer_upper", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
//FE VESSEL#5
G4double innerRadiusFE_Vessel_5 = 21.5*cm;
G4double outerRadiusFE_Vessel_5 = 27.7*cm;
G4double heightOfTheFE_Vessel_5 = 17.5*cm;
G4double startAngleOfFE_Vessel_5 = 0.*deg;
G4double spanningAngleOfFE_Vessel_5 = 360.*deg;
G4Tubs* FE_vessel_5
	=new G4Tubs("FE_vessel_5",
        innerRadiusFE_Vessel_5,
        outerRadiusFE_Vessel_5,
		heightOfTheFE_Vessel_5,
		startAngleOfFE_Vessel_5,
		spanningAngleOfFE_Vessel_5);
		
G4LogicalVolume* FE_vessel_5_log
		= new G4LogicalVolume(FE_vessel_5,Fe,"FE_vessel_5_log");
		
G4double FE_vessel_5Pos_x = 0.*cm;
G4double FE_vessel_5Pos_y = 0.0*cm;
G4double FE_vessel_5Pos_z = 75.5*cm;
G4VPhysicalVolume* FE_vessel_5_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_vessel_5Pos_x,FE_vessel_5Pos_y,FE_vessel_5Pos_z),// translation position
		FE_vessel_5_log, // its logical volume
		"FE_vessel_5", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//FE VESSEL#6
G4double innerRadiusFE_Vessel_6 = 7.*cm;
G4double outerRadiusFE_Vessel_6 = 27.7*cm;
G4double heightOfTheFE_Vessel_6 = 2.5*cm;
G4double startAngleOfFE_Vessel_6 = 0.*deg;
G4double spanningAngleOfFE_Vessel_6 = 360.*deg;
G4Tubs* FE_vessel_6
	=new G4Tubs("FE_vessel_6",
        innerRadiusFE_Vessel_6,
        outerRadiusFE_Vessel_6,
		heightOfTheFE_Vessel_6,
		startAngleOfFE_Vessel_6,
		spanningAngleOfFE_Vessel_6);
		
G4LogicalVolume* FE_vessel_6_log
		= new G4LogicalVolume(FE_vessel_6,Fe,"FE_vessel_6_log");
		
G4double FE_vessel_6Pos_x = 0.*cm;
G4double FE_vessel_6Pos_y = 0.0*cm;
G4double FE_vessel_6Pos_z = 95.5*cm;
G4VPhysicalVolume* FE_vessel_6_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_vessel_6Pos_x,FE_vessel_6Pos_y,FE_vessel_6Pos_z),// translation position
		FE_vessel_6_log, // its logical volume
		"FE_vessel_6", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//AIR BUFFER
G4double innerRadiusAir_Buffer_2 = 19.5*cm;
G4double outerRadiusAir_Buffer_2 = 21.5*cm;
G4double heightOfTheAir_Buffer_2 = 20.5*cm;
G4double startAngleOfAir_Buffer_2 = 0.*deg;
G4double spanningAngleOfAir_Buffer_2 = 360.*deg;
G4Tubs* air_buffer_2
	=new G4Tubs("air_buffer_2",
        innerRadiusAir_Buffer_2,
        outerRadiusAir_Buffer_2,
		heightOfTheAir_Buffer_2,
		startAngleOfAir_Buffer_2,
		spanningAngleOfAir_Buffer_2);
		
G4LogicalVolume* air_buffer_2_log
		= new G4LogicalVolume(air_buffer_2,Air,"air_buffer_2_log");
		
G4double air_buffer_2Pos_x = 0.*cm;
G4double air_buffer_2Pos_y = 0.0*cm;
G4double air_buffer_2Pos_z = 32.5*cm;
G4VPhysicalVolume* air_buffer_2_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(air_buffer_2Pos_x,air_buffer_2Pos_y,air_buffer_2Pos_z),// translation position
		air_buffer_2_log, // its logical volume
		"air_buffer_2", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//CHANNEL PARTITION,BOTTOM. 0
G4double innerRadiusCh_Bottom = 0.*cm;
G4double outerRadiusCh_Bottom = 2.8*cm;
G4double heightOfTheCh_Bottom = 10.*cm;
G4double startAngleOfCh_Bottom = 0.*deg;
G4double spanningAngleOfCh_Bottom = 360.*deg;
G4Tubs* ch_bottom
	=new G4Tubs("ch_bottom",
        innerRadiusCh_Bottom,
        outerRadiusCh_Bottom,
		heightOfTheCh_Bottom,
		startAngleOfCh_Bottom,
		spanningAngleOfCh_Bottom);
		
G4LogicalVolume* ch_bottom_log
		= new G4LogicalVolume(ch_bottom,B4C,"ch_bottom_log");
		
G4double ch_bottomPos_x = 0.*cm;
G4double ch_bottomPos_y = 0.0*cm;
G4double ch_bottomPos_z = 2.*cm;
G4VPhysicalVolume* ch_bottom_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(ch_bottomPos_x,ch_bottomPos_y,ch_bottomPos_z),// translation position
		ch_bottom_log, // its logical volume
		"ch_bottom", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//CHANNEL PARTITION,UPPER
G4double innerRadiusCh_Upper = 0.*cm;
G4double outerRadiusCh_Upper = 2.8*cm;
G4double heightOfTheCh_Upper = 22.5*cm;
G4double startAngleOfCh_Upper = 0.*deg;
G4double spanningAngleOfCh_Upper = 360.*deg;
G4Tubs* ch_upper
	=new G4Tubs("ch_upper",
        innerRadiusCh_Upper,
        outerRadiusCh_Upper,
		heightOfTheCh_Upper,
		startAngleOfCh_Upper,
		spanningAngleOfCh_Upper);
		
G4LogicalVolume* ch_upper_log
		= new G4LogicalVolume(ch_upper,Vacuum,"ch_upper_log");
		
G4double ch_upperPos_x = 0.*cm;
G4double ch_upperPos_y = 0.0*cm;
G4double ch_upperPos_z = 75.5*cm;
G4VPhysicalVolume* ch_upper_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(ch_upperPos_x,ch_upperPos_y,ch_upperPos_z),// translation position
		ch_upper_log, // its logical volume
		"ch_upper", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	

//FE#1
G4double innerRadiusFE_1 = 7.*cm;
G4double outerRadiusFE_1 = 14.*cm;
G4double heightOfTheFE_1 = 1.5*cm;
G4double startAngleOfFE_1 = 0.*deg;
G4double spanningAngleOfFE_1 = 360.*deg;
G4Tubs* FE_1
	=new G4Tubs("FE_1",
        innerRadiusFE_1,
        outerRadiusFE_1,
		heightOfTheFE_1,
		startAngleOfFE_1,
		spanningAngleOfFE_1);
		
G4LogicalVolume* FE_1_log
		= new G4LogicalVolume(FE_1,Fe,"FE_1_log");
		
G4double FE_1Pos_x = 0.*cm;
G4double FE_1Pos_y = 0.0*cm;
G4double FE_1Pos_z = 56.5*cm;
G4VPhysicalVolume* FE_1_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_1Pos_x,FE_1Pos_y,FE_1Pos_z),// translation position
		FE_1_log, // its logical volume
		"FE_1", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	

//FE#2
G4double innerRadiusFE_2 = 16.*cm;
G4double outerRadiusFE_2 = 30.2*cm;
G4double heightOfTheFE_2 = 1.5*cm;
G4double startAngleOfFE_2 = 0.*deg;
G4double spanningAngleOfFE_2 = 360.*deg;
G4Tubs* FE_2
	=new G4Tubs("FE_2",
        innerRadiusFE_2,
        outerRadiusFE_2,
		heightOfTheFE_2,
		startAngleOfFE_2,
		spanningAngleOfFE_2);
		
G4LogicalVolume* FE_2_log
		= new G4LogicalVolume(FE_2,Fe,"FE_2_log");
		
G4double FE_2Pos_x = 0.*cm;
G4double FE_2Pos_y = 0.0*cm;
G4double FE_2Pos_z = 56.5*cm;
G4VPhysicalVolume* FE_2_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_2Pos_x,FE_2Pos_y,FE_2Pos_z),// translation position
		FE_2_log, // its logical volume
		"FE_2", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number
		
//LEAD SHEILDING
G4double innerRadiusLead_Sheilding = 25.85*cm;
G4double outerRadiusLead_Sheilding = 30.2*cm;
G4double heightOfTheLead_Sheilding = 21.5*cm;
G4double startAngleOfLead_Sheilding = 0.*deg;
G4double spanningAngleOfLead_Sheilding = 360.*deg;
G4Tubs* lead_sheilding
	=new G4Tubs("lead_sheilding",
        innerRadiusLead_Sheilding,
        outerRadiusLead_Sheilding,
		heightOfTheLead_Sheilding,
		startAngleOfLead_Sheilding,
		spanningAngleOfLead_Sheilding);
		
G4LogicalVolume* lead_sheilding_log
		= new G4LogicalVolume(lead_sheilding,Pb,"lead_sheilding_log");
		
G4double lead_sheildingPos_x = 0.*cm;
G4double lead_sheildingPos_y = 0.0*cm;
G4double lead_sheildingPos_z = 33.5*cm;
G4VPhysicalVolume* lead_sheilding_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(lead_sheildingPos_x,lead_sheildingPos_y,lead_sheildingPos_z),// translation position
		lead_sheilding_log, // its logical volume
		"lead_sheilding", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//FE COVER OVER PB SHEILDING
G4double innerRadiusFE_Cover_PB = 30.2*cm;
G4double outerRadiusFE_Cover_PB = 30.9*cm;
G4double heightOfTheFE_Cover_PB = 23.*cm;
G4double startAngleOfFE_Cover_PB = 0.*deg;
G4double spanningAngleOfFE_Cover_PB = 360.*deg;
G4Tubs* FE_cover_PB
	=new G4Tubs("FE_cover_PB",
        innerRadiusFE_Cover_PB,
        outerRadiusFE_Cover_PB,
		heightOfTheFE_Cover_PB,
		startAngleOfFE_Cover_PB,
		spanningAngleOfFE_Cover_PB);
		
G4LogicalVolume* FE_cover_PB_log
		= new G4LogicalVolume(FE_cover_PB,Fe,"FE_cover_PB_log");
		
G4double FE_cover_PBPos_x = 0.*cm;
G4double FE_cover_PBPos_y = 0.0*cm;
G4double FE_cover_PBPos_z = 35*cm;
G4VPhysicalVolume* FE_cover_PB_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_cover_PBPos_x,FE_cover_PBPos_y,FE_cover_PBPos_z),// translation position
		FE_cover_PB_log, // its logical volume
		"FE_cover_PB", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number
		
//CONICAL REGION IN CORE-----------------------------------------------------------------------------------------------------------------------SKIPPED
G4double    innerRadiusMinusZOfConical_Region_In_Core = 0.*cm;
G4double    outerRadiusMinusZOfConical_Region_In_Core = 19.5*cm;
G4double    innerRadiusPlusZOfConical_Region_In_Core = 0.*cm;
G4double    outerRadiusPlusZOfConical_Region_In_Core = 8.55*cm;
G4double    zHalfLengthOfConical_Region_In_Core = 2.24*cm;
G4double    startPhiAngleOfConical_Region_In_Core = 0.*deg;
G4double    deltaPhiAngleOfConical_Region_In_Core = 360*deg;
G4Cons* conical_region_in_core
	=new G4Cons("conical_region_in_core",
       innerRadiusMinusZOfConical_Region_In_Core,
	   outerRadiusMinusZOfConical_Region_In_Core,
       innerRadiusPlusZOfConical_Region_In_Core,
	   outerRadiusPlusZOfConical_Region_In_Core,
       zHalfLengthOfConical_Region_In_Core,
       startPhiAngleOfConical_Region_In_Core,
	   deltaPhiAngleOfConical_Region_In_Core);
   
G4LogicalVolume* conical_region_in_core_log
		= new G4LogicalVolume(conical_region_in_core,CH2,"conical_region_in_core_log");

G4double conical_region_in_corePos_x = 0.*cm;
G4double conical_region_in_corePos_y = 0.0*cm;
G4double conical_region_in_corePos_z = 14.24*cm;
G4VPhysicalVolume* conical_region_in_core_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(conical_region_in_corePos_x,conical_region_in_corePos_y,conical_region_in_corePos_z),// translation position
		conical_region_in_core_log, // its logical volume
		"conical_region_in_core_1", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	



//NOT SURE#1 ------------------------------------------------------------------------ASK ABOUT THIS!!!!!
G4double innerRadiusNot_Sure_1 = 7.*cm;
G4double outerRadiusNot_Sure_1 = 19.*cm;
G4double heightOfTheNot_Sure_1 = 1.5*cm;
G4double startAngleOfNot_Sure_1 = 0.*deg;
G4double spanningAngleOfNot_Sure_1 = 360.*deg;
G4Tubs* not_sure_1
	=new G4Tubs("not_sure_1",
        innerRadiusNot_Sure_1,
        outerRadiusNot_Sure_1,
		heightOfTheNot_Sure_1,
		startAngleOfNot_Sure_1,
		spanningAngleOfNot_Sure_1);
		
G4LogicalVolume* not_sure_1_log
		= new G4LogicalVolume(not_sure_1,Pb,"not_sure_1_log");
		
G4double not_sure_1Pos_x = 0.*cm;
G4double not_sure_1Pos_y = 0.0*cm;
G4double not_sure_1Pos_z = -1.5*cm;
G4VPhysicalVolume* not_sure_1_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(not_sure_1Pos_x,not_sure_1Pos_y,not_sure_1Pos_z),// translation position
		not_sure_1_log, // its logical volume
		"not_sure_1", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		
//NOT SURE#2
G4double innerRadiusNot_Sure_2 = 19.*cm;
G4double outerRadiusNot_Sure_2 = 30.9*cm;
G4double heightOfTheNot_Sure_2 = 1.5*cm;
G4double startAngleOfNot_Sure_2 = 0.*deg;
G4double spanningAngleOfNot_Sure_2 = 360.*deg;
G4Tubs* not_sure_2
	=new G4Tubs("not_sure_2",
        innerRadiusNot_Sure_2,
        outerRadiusNot_Sure_2,
		heightOfTheNot_Sure_2,
		startAngleOfNot_Sure_2,
		spanningAngleOfNot_Sure_2);
		
G4LogicalVolume* not_sure_2_log
		= new G4LogicalVolume(not_sure_2,Pb,"not_sure_2_log");
		
G4double not_sure_2Pos_x = 0.*cm;
G4double not_sure_2Pos_y = 0.0*cm;
G4double not_sure_2Pos_z = -1.5*cm;
G4VPhysicalVolume* not_sure_2_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(not_sure_2Pos_x,not_sure_2Pos_y,not_sure_2Pos_z),// translation position
		not_sure_2_log, // its logical volume
		"not_sure_2", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
//FE VESSEL#7
G4double innerRadiusFE_Vessel_7 = 7.*cm;
G4double outerRadiusFE_Vessel_7 = 7.5*cm;
G4double heightOfTheFE_Vessel_7 = 4.*cm;
G4double startAngleOfFE_Vessel_7 = 0.*deg;
G4double spanningAngleOfFE_Vessel_7 = 360.*deg;
G4Tubs* FE_vessel_7
	=new G4Tubs("FE_vessel_7",
        innerRadiusFE_Vessel_7,
        outerRadiusFE_Vessel_7,
		heightOfTheFE_Vessel_7,
		startAngleOfFE_Vessel_7,
		spanningAngleOfFE_Vessel_7);
		
G4LogicalVolume* FE_vessel_7_log
		= new G4LogicalVolume(FE_vessel_7,Fe,"FE_vessel_7_log");
		
G4double FE_vessel_7Pos_x = 0.*cm;
G4double FE_vessel_7Pos_y = 0.0*cm;
G4double FE_vessel_7Pos_z = -4.*cm;
G4VPhysicalVolume* FE_vessel_7_phys
	= new G4PVPlacement(0, // no rotation
		G4ThreeVector(FE_vessel_7Pos_x,FE_vessel_7Pos_y,FE_vessel_7Pos_z),// translation position
		FE_vessel_7_log, // its logical volume
		"FE_vessel_7", // its name
		world_log, // its mother (logical) volume
		false, // no boolean operations
		0); // its copy number	
		


//*******************************************************SENSITIVE DETECTOR***********************************************************

  
  //Defined filters for the detector
  G4SDParticleFilter* gammaFilter = 
    new G4SDParticleFilter("gammaFilter","gamma");
  G4SDParticleFilter* electronFilter = 
    new G4SDParticleFilter("electronFilter","e-");
  G4SDParticleFilter* positronFilter = 
    new G4SDParticleFilter("positronFilter","e+");
  /*G4SDParticleFilter* epFilter = new G4SDParticleFilter(filterName="epFilter");
  epFilter->add(particleName="e-");
  epFilter->add(particleName="e+");
  
  G4MultiFunctionalDetector* reactorDetector = new G4MultiFunctionalDetector("/reactorDetector");
  
  G4VPrimitiveScorer* primitive;
    primitive = new G4PSEnergyDeposit("eDep",1);
    reactorDetector->RegisterPrimitive(primitive);
    primitive = new G4PSNofSecondary("nGamma",1);
    primitive->SetFilter(gammaFilter);
    reactorDetector->RegisterPrimitive(primitive);
    primitive = new G4PSNofSecondary("nElectron",1);
    primitive->SetFilter(electronFilter);
    reactorDetector->RegisterPrimitive(primitive);
    primitive = new G4PSNofSecondary("nPositron",1);
    primitive->SetFilter(positronFilter);
    reactorDetector->RegisterPrimitive(primitive);
    primitive = new G4PSMinKinEAtGeneration("minEkinGamma",1);
    primitive->SetFilter(gammaFilter);
    reactorDetector->RegisterPrimitive(primitive);
    primitive = new G4PSMinKinEAtGeneration("minEkinElectron",1);
    primitive->SetFilter(electronFilter);
    reactorDetector->RegisterPrimitive(primitive);
    primitive = new G4PSMinKinEAtGeneration("minEkinPositron",1);
    primitive->SetFilter(positronFilter);
    reactorDetector->RegisterPrimitive(primitive);
    primitive = new G4PSTrackLength("trackLength",1);
    primitive->SetFilter(epFilter);
    reactorDetector->RegisterPrimitive(primitive);
    primitive = new G4PSNofStep("nStep",1);
    primitive->SetFilter(epFilter); 
    reactorDetector->RegisterPrimitive(primitive);
  */
  
//Manager for the detector  
G4SDManager* SDman = G4SDManager::GetSDMpointer();

//Define a sensitive detector object
G4VSensitiveDetector* reactorDetector;

//Define sensitive detecotor name
G4String SDname;
//Define the sensitive detector as the our defined class ReactorDetector
reactorDetector = new ReactorDetector(SDname="/reactorDetector");
//Set Filter for detector
//reactorDetector->SetFilter(gammaFilter);
//Add Detector to SD Manager
SDman->AddNewDetector(reactorDetector);
//Set logical as the sensitive detector. 
//al_tube_log->SetSensitiveDetector(reactorDetector);

/*G4String trackerSDname = "reactor/TrackerSD";
ReactorTrackerSD* aTrackerSD = new ReactorTrackerSD( trackerSDname );
SDman->AddNewDetector( aTrackerSD );
al_tube_log->SetSensitiveDetector( aTrackerSD );
*/

//  Sensitive detector for gammas entering nn-cavity (surface current across GamDet volume)

    G4String fltName,particleName;
  	G4String psName;

// Al slab, get energy depsited from gammas -- Note tube is longer than nn-cavity  53cm vs 20.5cm
	G4MultiFunctionalDetector* MFDet1 = new G4MultiFunctionalDetector("Al-SD");
   	
		G4PSEnergyDeposit*  energy1 = new G4PSEnergyDeposit(psName="totalEDep",0);
//********Gammas************	  
		energy1->SetFilter(gammaFilter);
//********Electrons************	  
//		energy1->SetFilter(electronFilter);
//***************************	  
		MFDet1->RegisterPrimitive(energy1);
 	
		SDman->AddNewDetector(MFDet1);  
			
			// Register SD to SDManager.
		al_tube_log2->SetSensitiveDetector(MFDet1);  // Assign SD to the logical volume.

// Poly slab, get energy depsited from gammas -- Note tube is longer than nn-cavity  53cm vs 20.5cm
	G4MultiFunctionalDetector* MFDet3 = new G4MultiFunctionalDetector("Poly-SD");
   	
		G4PSEnergyDeposit*  energy3 = new G4PSEnergyDeposit(psName="totalEDep",0);
//********Gammas************	  
		energy3->SetFilter(gammaFilter);
//********Electrons************	  
//		energy3->SetFilter(electronFilter);
//***************************	  
		MFDet3->RegisterPrimitive(energy3);
 		
		SDman->AddNewDetector(MFDet3);                 // Register SD to SDManager.
		ch2_convertor_log->SetSensitiveDetector(MFDet3);  // Assign SD to the logical volume.
		
//********  GamDet volume -- inside Al tube in nn-cavity to get all forward-angle gammas -- histogram on gamma energy
    G4MultiFunctionalDetector* MFDet2 = new G4MultiFunctionalDetector("GammaSD");
		SDman->AddNewDetector(MFDet2);                 // Register SD to SDManager.
		GamDet_log->SetSensitiveDetector(MFDet2);  // Assign SD to the logical volume.  //
		
		
// below sets up Energy filter
	//--- Surface Current for gamma with energy bin.
  // This example creates four primitive scorers.
  //  4 bins with energy   ---   Primitive Scorer Name
  //    0.1.     to  1 KeV,        gammaSurfCurr000
  //   1 keV  to 10 KeV,        gammaSurfCurr001
  //  10 keV  to   100 KeV,        gammaSurfCurr002
  //    100 KeV  to  1 MeV.        gammaSurfCurr003
  //
//	char tmpname[16];
	G4int numbin = 101;

	G4String psgName("asdf");
	G4double kmin=0.0;
	G4double kmax=0.0;
  for ( G4int i = 0; i < numbin; i++){
//      std::sprintf(tmpname,"gammaSurfCurr%03d",i);
//     G4String psgName = static_cast<G4String>(tmpname);
//	G4String psgName(tmpname);
//	G4cout << psgName << G4endl;
		
	    if(i==0) psgName = "gammaSurfCurr000";
	    if (i==1) psgName = "gammaSurfCurr001";	  
	    if (i==2) psgName = "gammaSurfCurr002";	  
	    if (i==3) psgName = "gammaSurfCurr003";	  
	    if (i==4) psgName = "gammaSurfCurr004";	  
	    if (i==5) psgName = "gammaSurfCurr005";	  
	    if (i==6) psgName = "gammaSurfCurr006";	  
	    if (i==7) psgName = "gammaSurfCurr007";	  
	   if (i==8) psgName = "gammaSurfCurr008";	  
	   if (i==9) psgName = "gammaSurfCurr009";	  
	   if (i==10) psgName = "gammaSurfCurr010";	  
	   if (i==11) psgName = "gammaSurfCurr011";	  
	   if (i==12) psgName = "gammaSurfCurr012";	  
	   if (i==13) psgName = "gammaSurfCurr013";	  
	   if (i==14) psgName = "gammaSurfCurr014";	  
	   if (i==15) psgName = "gammaSurfCurr015";	  
	   if (i==16) psgName = "gammaSurfCurr016";	  	 
	   if (i==17) psgName = "gammaSurfCurr017";	  
	   if (i==18) psgName = "gammaSurfCurr018";	  
	   if (i==19) psgName = "gammaSurfCurr019";	  
	   if (i==20) psgName = "gammaSurfCurr020";
	   if (i==21) psgName = "gammaSurfCurr021";	  
	   if (i==22) psgName = "gammaSurfCurr022";	  
	   if (i==23) psgName = "gammaSurfCurr023";	  
	   if (i==24) psgName = "gammaSurfCurr024";	  
	   if (i==25) psgName = "gammaSurfCurr025";	  
	   if (i==26) psgName = "gammaSurfCurr026";	  
	   if (i==27) psgName = "gammaSurfCurr027";	  
	   if (i==28) psgName = "gammaSurfCurr028";	  
	   if (i==29) psgName = "gammaSurfCurr029";	  
	   if (i==30) psgName = "gammaSurfCurr030";	  
	   if (i==31) psgName = "gammaSurfCurr031";	  
	   if (i==32) psgName = "gammaSurfCurr032";	  
	   if (i==33) psgName = "gammaSurfCurr033";	  
	   if (i==34) psgName = "gammaSurfCurr034";	  
	   if (i==35) psgName = "gammaSurfCurr035";	  
	   if (i==36) psgName = "gammaSurfCurr036";	  	 
	   if (i==37) psgName = "gammaSurfCurr037";	  
	   if (i==38) psgName = "gammaSurfCurr038";	  
	   if (i==39) psgName = "gammaSurfCurr039";	  
	   if (i==40) psgName = "gammaSurfCurr040";
	   if (i==41) psgName = "gammaSurfCurr041";	  
	   if (i==42) psgName = "gammaSurfCurr042";	  
	   if (i==43) psgName = "gammaSurfCurr043";	  
	   if (i==44) psgName = "gammaSurfCurr044";	  
	  if (i==45) psgName = "gammaSurfCurr045";	  
	  if (i==46) psgName = "gammaSurfCurr046";	  
	   if (i==47) psgName = "gammaSurfCurr047";	  
	   if (i==48) psgName = "gammaSurfCurr048";	  
	   if (i==49) psgName = "gammaSurfCurr049";	  
	   if (i==50) psgName = "gammaSurfCurr050";	  
	   if (i==51) psgName = "gammaSurfCurr051";	  
	   if (i==52) psgName = "gammaSurfCurr052";	  
	   if (i==53) psgName = "gammaSurfCurr053";	  
	   if (i==54) psgName = "gammaSurfCurr054";	  
	   if (i==55) psgName = "gammaSurfCurr055";	  
	   if (i==56) psgName = "gammaSurfCurr056";	  	 
	   if (i==57) psgName = "gammaSurfCurr057";	  
	   if (i==58) psgName = "gammaSurfCurr058";	  
	   if (i==59) psgName = "gammaSurfCurr059";	  
	   if (i==60) psgName = "gammaSurfCurr060";
	   if (i==61) psgName = "gammaSurfCurr061";	  
	   if (i==62) psgName = "gammaSurfCurr062";	  
	   if (i==63) psgName = "gammaSurfCurr063";	  
	   if (i==64) psgName = "gammaSurfCurr064";	  
	   if (i==65) psgName = "gammaSurfCurr065";	  
	   if (i==66) psgName = "gammaSurfCurr066";	  
	   if (i==67) psgName = "gammaSurfCurr067";	  
	   if (i==68) psgName = "gammaSurfCurr068";	  
	   if (i==69) psgName = "gammaSurfCurr069";	  
	   if (i==70) psgName = "gammaSurfCurr070";	  
	   if (i==71) psgName = "gammaSurfCurr071";	  
	   if (i==72) psgName = "gammaSurfCurr072";	  
	   if (i==73) psgName = "gammaSurfCurr073";	  
	   if (i==74) psgName = "gammaSurfCurr074";	  
	   if (i==75) psgName = "gammaSurfCurr075";	  
	   if (i==76) psgName = "gammaSurfCurr076";	  	 
	   if (i==77) psgName = "gammaSurfCurr077";	  
	   if (i==78) psgName = "gammaSurfCurr078";	  
	   if (i==79) psgName = "gammaSurfCurr079";
	   if (i==80) psgName = "gammaSurfCurr080";
	   if (i==81) psgName = "gammaSurfCurr081";	  
	   if (i==82) psgName = "gammaSurfCurr082";	  
	   if (i==83) psgName = "gammaSurfCurr083";	  
	   if (i==84) psgName = "gammaSurfCurr084";	  
	   if (i==85) psgName = "gammaSurfCurr085";	  
	   if (i==86) psgName = "gammaSurfCurr086";	  
	   if (i==87) psgName = "gammaSurfCurr087";	  
	   if (i==88) psgName = "gammaSurfCurr088";	  
	   if (i==89) psgName = "gammaSurfCurr089";	  
	   if (i==90) psgName = "gammaSurfCurr090";	  
	   if (i==91) psgName = "gammaSurfCurr091";	  
	   if (i==92) psgName = "gammaSurfCurr092";	  
	   if (i==93) psgName = "gammaSurfCurr093";	  
	   if (i==94) psgName = "gammaSurfCurr094";	  
	   if (i==95) psgName = "gammaSurfCurr095";	  
	   if (i==96) psgName = "gammaSurfCurr096";	  	 
	  if (i==97) psgName = "gammaSurfCurr097";	  
	   if (i==98) psgName = "gammaSurfCurr098";	  
	   if (i==99) psgName = "gammaSurfCurr099";	  
	   if (i==100) psgName = "gammaSurfCurr100";
		if (i==101) psgName = "gammaSurfCurr101";
//	  G4double kmin = std::pow(10.,(G4double)(i-1))*keV;
//     G4double kmax = std::pow(10.,(G4double)i)*keV;

 	/*G4double index1 = std::fmod((G4double)(i),4.);
 	 G4double kmin = ( std::pow(2.,index1) * std::pow(10.,(G4double)(i/4-1.)) )*keV;
	G4double index2 = std::fmod((G4double)(i+1),4.);
      G4double kmax = ( std::pow(2.,index2) * std::pow(10.,(G4double)((i+1)/4-1.)) )*keV;
*///	G4cout << " kmin  " << kmin << "         kmax  " << kmax << "  psgName  " << psgName << G4endl;

//	 G4double kmin = std::pow(10.,(G4int)(i/9))*(i % 9+1)*0.1*keV;  /// i % 9 is i modulus 9
//     G4double kmax = std::pow(10.,(G4int)(i/9))*(i % 9+2)*0.1*keV;
	 G4double kmin = std::pow(10.,(G4int)(i/50)*3)*(i % 50+1)*1000/50*eV;  /// i % 9 is i modulus 9
     G4double kmax = std::pow(10.,(G4int)(i/50)*3)*(i % 50+2)*1000/50*eV;

/*	if(i ==0)
		{
			 kmin = 0.0 *keV;
			 kmax = 0.2 *keV;
			 G4cout<< "kmin: " << kmin << " kmax: " << kmax <<G4endl;
		}
	else{
	kmin=kmax;
	  kmax=(G4double)((i+1)*0.1)*keV;
	G4cout<< "kmin: " << kmin << " kmax: " << kmax <<G4endl;
	 }//	G4double kstart = 29.0;
//	G4double kend = 30.000001;
//	G4double step = (kend-kstart)/numbin;
//      G4double kmin = (kstart+i*step)*keV;
//      G4double kmax = (kstart+(i+1)*step)*keV;
*/ 

 //-- Particle with kinetic energy filter.
//********Gammas************	  
      G4SDParticleWithEnergyFilter* pkinEFilter =
	new G4SDParticleWithEnergyFilter(fltName="gammaE filter",kmin,kmax);
	G4cout<< "1" <<G4endl;
     pkinEFilter->add("gamma");  // Accept only gamma.
	
	//  pkinEFilter->add("neutron");  // Accept only neutron.
      pkinEFilter->show();        // Show accepting condition to stdout.
//********Electrons************	  
//      G4SDParticleWithEnergyFilter* pkinEFilter =
// 	  new G4SDParticleWithEnergyFilter(fltName="elecE filter",kmin,kmax);
//      pkinEFilter->add("e-");  // Accept only electrons
//      pkinEFilter->show();        // Show accepting condition to stdout.
//***********Vacuum cyl in nn-cavity****************
      //-- Surface Current Scorer which scores  number of tracks in unit area.
//      G4PSFlatSurfaceCurrent* scorer =
//	  new RE02PSFlatSurfaceCurrent(psgName,fCurrent_InOut,fNx,fNy,fNz);

/*PassageCell Currents
	G4PSPassageCellCurrent* Pgcurrent = new G4PSPassageCellCurrent(psgName,0);
	  Pgcurrent->SetFilter(pkinEFilter);    // Assign filter.
      MFDet3->RegisterPrimitive(Pgcurrent);  // Register it to MultiFunctionalDetector.
	G4PSPassageCellCurrent* Agcurrent = new G4PSPassageCellCurrent(psgName,0);
	  Agcurrent->SetFilter(pkinEFilter);    // Assign filter.
      MFDet1->RegisterPrimitive(Agcurrent);  // Register it to MultiFunctionalDetector.
	G4PSPassageCellCurrent* gcurrent = new G4PSPassageCellCurrent(psgName,0);
	  gcurrent->SetFilter(pkinEFilter);    // Assign filter.
      MFDet2->RegisterPrimitive(gcurrent);  // Register it to MultiFunctionalDetector.
 */
 /*
  G4PSCylinderSurfaceCurrent* CylSurcurrent = new G4PSCylinderSurfaceCurrent(psgName,2,0);
 
 
	CylSurcurrent->DivideByArea(false);   //Makes it so particles aren't normalized by the area
	CylSurcurrent->SetFilter(pkinEFilter);    // Assign filter.
      MFDet3->RegisterPrimitive(CylSurcurrent);  // Register it to MultiFunctionalDetector.
	G4PSCylinderSurfaceCurrent* Agcurrent = new G4PSCylinderSurfaceCurrent(psgName,2,0);
	Agcurrent->DivideByArea(false);   //Makes it so particles aren't normalized by the area
	  Agcurrent->SetFilter(pkinEFilter);    // Assign filter.
      MFDet1->RegisterPrimitive(Agcurrent);  // Register it to MultiFunctionalDetector.
	*/
	G4PSCylinderSurfaceCurrent* gcurrent = new G4PSCylinderSurfaceCurrent(psgName,2,0);
	gcurrent->DivideByArea(false);   //Makes it so particles aren't normalized by the area
	  gcurrent->SetFilter(pkinEFilter);    // Assign filter.
      MFDet2->RegisterPrimitive(gcurrent);  // Register it to MultiFunctionalDetector.
	  
	//  G4PSCylinderSurfaceCurrent* AirCylSurcurrent = new G4PSCylinderSurfaceCurrent(psgName,2,0);
	//AirCylSurcurrent->DivideByArea(false);   //Makes it so particles aren't normalized by the area
	//AirCylSurcurrent->SetFilter(pkinEFilter); 
	//MFDet4->RegisterPrimitive(AirCylSurcurrent);  // Register it to MultiFunctionalDetector.
//	G4cout<< "2" <<G4endl;
 }
//**********************		
//***********Poly Moderator****************
      //-- Surface Current Scorer which scores  number of tracks in unit area.
//      G4PSFlatSurfaceCurrent* scorer =
//	  new RE02PSFlatSurfaceCurrent(psgName,fCurrent_InOut,fNx,fNy,fNz);
//	G4PSPassageCellCurrent* Pgcurrent = new G4PSPassageCellCurrent(psgName,0);
//	  Pgcurrent->SetFilter(pkinEFilter);    // Assign filter.
//      MFDet3->RegisterPrimitive(Pgcurrent);  // Register it to MultiFunctionalDetector.

//**********************		

	G4SDManager::GetSDMpointer()->SetVerboseLevel(0);



  //Return the world geometry which has all other geometries in it. 
  return world_phys;
  
}