// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * 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. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // // // $Id: ExN02DetectorConstruction.cc,v 1.17 2005/05/30 16:51:43 maire Exp $ // GEANT4 tag $Name: geant4-08-00-patch-01 $ // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "ExN02DetectorConstruction.hh" #include "ExN02DetectorMessenger.hh" #include "ExN02ChamberParameterisation.hh" #include "ExN02MagneticField.hh" #include "ExN02TrackerSD.hh" #include "G4Material.hh" #include "G4Box.hh" #include "G4Tubs.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4PVParameterised.hh" #include "G4SDManager.hh" #include "G4UserLimits.hh" #include "G4VisAttributes.hh" #include "G4Colour.hh" #include "G4ios.hh" #include "G4RotationMatrix.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... ExN02DetectorConstruction::ExN02DetectorConstruction() :solidWorld(0), logicWorld(0), physiWorld(0), solidTarget(0), logicTarget(0), physiTarget(0), solidTracker(0),logicTracker(0),physiTracker(0), solidChamber(0),logicChamber(0),physiChamber(0), TargetMater(0), ChamberMater(0),fpMagField(0), fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.), NbOfChambers(0) , ChamberWidth(0.), ChamberSpacing(0.) { fpMagField = new ExN02MagneticField(); detectorMessenger = new ExN02DetectorMessenger(this); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... ExN02DetectorConstruction::~ExN02DetectorConstruction() { delete fpMagField; delete detectorMessenger; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* ExN02DetectorConstruction::Construct() { //--------- Material definition --------- G4double a, z; G4double density, temperature, pressure; G4int nel; // Vaccum density=universe_mean_density; temperature=0.1*kelvin; pressure=1.e-19*pascal; G4Material* BadVacuum = new G4Material("Galactic", z=1.,a=1.01*g/mole, density, kStateGas,temperature, pressure); //Air G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole); G4Element* O = new G4Element("Oxygen" , "O", z=8., a= 16.00*g/mole); G4Material* Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2); Air->AddElement(N, 70*perCent); Air->AddElement(O, 30*perCent); //=================Old Cement============================================= //Old Cement /* G4Element* Ca = new G4Element("Calcium", "Ca", z=20., a= 40.078*g/mole); G4Element* Si = new G4Element("Silicon", "Si", z=14., a= 28.08553*g/mole); G4Element* Fe = new G4Element("Iron", "Fe", z=26., a=55.8452 *g/mole); G4Element* Al = new G4Element("Aluminum", "Al", z=13., a=26.981539 *g/mole); G4Material* Cement = new G4Material("Cement", density= 2.4*mg/cm3, nel=5); Cement->AddElement(O, 60); Cement->AddElement(Ca, 6); Cement->AddElement(Si, 16); Cement->AddElement(Al, 10); Cement->AddElement(Fe, 1); */ //=================Old Cement============================================= //=================Cement============================================= //Cement G4Element* H = new G4Element("Hydrogen", "H", z=1., a= 1.01*g/mole); G4Element* Ca = new G4Element("Calcium", "Ca", z=20., a= 40.078*g/mole); G4Element* Si = new G4Element("Silicon", "Si", z=14., a= 28.08553*g/mole); G4Element* Fe = new G4Element("Iron", "Fe", z=26., a=55.8452 *g/mole); G4Element* Al = new G4Element("Aluminum", "Al", z=13., a=26.981539 *g/mole); G4Material* Cement = new G4Material("Cement", density= 2.7*mg/cm3, nel=6); Cement->AddElement(H, 0.4*perCent); Cement->AddElement(O, 50.9*perCent); Cement->AddElement(Ca, 7.0*perCent); Cement->AddElement(Si, 34.5*perCent); Cement->AddElement(Al, 3.4*perCent); Cement->AddElement(Fe, 3.8*perCent); //Cement->AddElement(H, fractionmass=0.4*perCent); //Cement->AddElement(O, fractionmass=50.9*perCent); //Cement->AddElement(Ca, fractionmass=7.0*perCent); //Cement->AddElement(Si, fractionmass=34.5*perCent); //Cement->AddElement(Al, fractionmass=3.4*perCent); //Cement->AddElement(Fe, fractionmass=3.8*perCent); //=================Cement============================================= //Heavy water G4Element* D = new G4Element("Deuerium", "D", z=1., a=2.01*g/mole); density = 1.0177*g/cm3; G4Material* D2O = new G4Material("HeavyWater",density,/*ncomponents=*/2); D2O->AddElement(D, 2); D2O->AddElement(O, 1); G4Material* H2O = new G4Material("Water", density= 1.000*g/cm3, /*ncomponents=*/2); H2O->AddElement(H, 2); H2O->AddElement(O, 1); // overwrite computed meanExcitationEnergy with ICRU recommended value H2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV); //Lead:Pb, Uranium:U92, Carbon:C12, Tantalum:Tnt, Copper:Cu, Lanthium:La, Aluminum: Al, Nickel:Ni //Lead G4Material* Pb = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3); //Uranium G4Element* U = new G4Element("Uranium", "U",z=92., a= 238.0289*g/mole); G4Material* U238 = new G4Material("Uranium238", z=92., a= 238.0289*g/mole, density= 19.1*g/cm3); // new G4Element("Uranium", "U",z=92., a= 239.01*g/mole, density= 18.975*g/cm3); G4Material* DU = new G4Material("DU", density= 1.*g/cm3, nel=2); DU->AddElement(U, 5*perCent); DU->AddElement(O, 95*perCent); //Carbon G4Material* C12 = new G4Material("Carbon", z=6., a= 12.*g/mole, density= 1.7*g/cm3); //Tantalum G4Material* Tnt = new G4Material("Tantalum", z=73., a= 180.9479*g/mole, density= 16.654*g/cm3); //Copper G4Material* Cu = new G4Material("Copper", z=29., a= 63.546*g/mole, density= 8.962*g/cm3); //Lanthium G4Material* La = new G4Material("Lanthium", z=57., a= 138.9055*g/mole, density= 6.7*g/cm3); //Aluminum G4Material* Aluminum = new G4Material("Aluminum", z=13., a= 26.981539*g/mole, density= 2.702*g/cm3); //Nickel G4Material* Ni = new G4Material("Nickel", z=28., a= 58.69342*g/mole, density= 8.908*g/cm3); //Tungsten G4Material* W = new G4Material("Tungsten", z=74., a= 183.84*g/mole, density= 19.25*g/cm3); G4Material* O16Targ = new G4Material("Oxygen", z=8,a=16*g/mole, density= 1.01*g/cm3); //Liquid Hydrogen Target G4Material* LH2 = // new G4Material("Hydrogen", z=1., a= 1.01*g/mole, density= 1.0*g/cm3); // new G4Material("Hydrogen", z=1., a= 1.01*g/mole, density= 0.07*g/cm3); new G4Material("Hydrogen", z=1., a= 1.01*g/mole, density= 0.07*g/cm3, kStateGas,3*kelvin,1.7e5*pascal); //Xenon gas G4Material* Xenon = new G4Material("XenonGas", z=54., a=131.29*g/mole, density= 5.458*mg/cm3, kStateGas, temperature= 293.15*kelvin, pressure= 1*atmosphere); //Argon gas G4Material* ArgonGas = new G4Material("ArgonGas", z=18., a=39.948*g/mole, density= 1.784*mg/cm3, kStateGas, temperature= 293.15*kelvin, pressure= 1*atmosphere); //Argon gas // G4Material* ArgonGas = // new G4Material("ArgonGas", z=13., a=26.981*g/mole, density= 2700*kg/m3); // NIST say: // 18K edge is 84400 barns/atom // Macmaster says: //K edge at 3.202 keV LI at 287 ev // 91718 barns/atom // Print all the materials defined. // G4cout << G4endl << "The materials defined are : " << G4endl << G4endl; G4cout << *(G4Material::GetMaterialTable()) << G4endl; //--------- Sizes of the principal geometrical components (solids) --------- //T NbOfChambers = 5; NbOfChambers = 1; ChamberWidth = 1*cm; //was 20 ChamberSpacing = 1*cm;//was 80 ChamberMater = BadVacuum; //fTrackerLength = (NbOfChambers+1)*ChamberSpacing; // Full length of Tracker fTrackerLength = (NbOfChambers+1)*ChamberSpacing; // Full length of Tracker G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker //--------- Definitions of Solids, Logical Volumes, Physical Volumes --------- //======================================================================================== //***************************************************************************************** //------------------------------ // World //------------------------------ //00000000000000000000000000000000000000000000000000000000000000000 //Parameter control //fWorldLength= 1.2 *(fTargetLength+fTrackerLength); fWorldLength= 15 * m; G4double HalfWorldLength = 0.5*fWorldLength; //00000000000000000000000000000000000000000000000000000000000000000 solidWorld= new G4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength); // logicWorld= new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0); // Do experiemnt in vaccum below //logicWorld= new G4LogicalVolume( solidWorld, BadVacuum, "World", 0, 0, 0); logicWorld= new G4LogicalVolume( solidWorld, Air, "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 //======================================================================================== //***************************************************************************************** //------------------------------------------------------------------------------------------ // Target //red //------------------------------------------------------------------------------------------ TargetMater = W; //W: tangsten, D2O: heavy water. //^^^^^^^^^^^^^^^^^^^^ Original Position ^^^^^^^^^^^^^^^^^^^^ //G4ThreeVector positionTarget = G4ThreeVector(380*cm,101.6*cm, -(93.68+10)*cm );//e- source originalposition 292.07 101.6 0 cm //solidTarget = new G4Box("target",0.5*cm,0.5*cm,1*cm); //2 cm thick now, in real experiment should be 1 mm thick //_____________________________________________________________ //^^^^^^^^^^^^^^^^^^^^ New Position ^^^^^^^^^^^^^^^^^^^^ G4ThreeVector positionTarget = G4ThreeVector(167.09*cm,101.6*cm,93.93*cm );//e- source originalposition 292.07 101.6 0 cm solidTarget = new G4Box("target",1*cm,0.5*cm,0.5*cm); //2 cm thick now, in real experiment should be 1 mm thick //_____________________________________________________________ //solidTarget = new G4Box("target",0.5*cm,0.5*cm,1*mm); //2 mm thick logicTarget = new G4LogicalVolume(solidTarget,TargetMater,"Target",0,0,0); physiTarget = new G4PVPlacement(0, // no rotation positionTarget, // at (x,y,z) logicTarget, // its logical volume "Target", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //================================================================================================================ //================================================================================================================ //================================================================================================================ // Wall consist of few parts. //------------------------------ // Wall1 //------------------------------ Wall1Matter=Cement; G4double Wall1x = 0.9144 *m; G4double Wall1y = 3.6322 *m; G4double Wall1z = 2.3368 *m; G4double Wall1hx = 0.5*Wall1x; G4double Wall1hy = 0.5*Wall1y; G4double Wall1hz = 0.5*Wall1z; G4ThreeVector positionWall1 = G4ThreeVector(-Wall1hx,Wall1hy,- Wall1hz) ; // G4Box* solidWall1 = new G4Box( "Wall1" , Wall1hx, Wall1hy, Wall1hz); //100by363.2by234 //G4Box* solidWall1 = new G4Box( "Wall1" , 1*cm, 2*cm, 5*cm); // logicWall1 = new G4LogicalVolume(solidWall1,Wall1Matter ,"Wall1",0,0,0); physiWall1 = new G4PVPlacement(0, // no rotation positionWall1, // at (x,y,z) logicWall1, // its logical volume "Wall1", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Wall2 //------------------------------ Wall2Matter=Cement; G4double Wall2x = 5.8 *m; G4double Wall2y = 3.6322 *m; G4double Wall2z = 0.9652*m; G4double Wall2hx = 0.5*Wall2x; G4double Wall2hy = 0.5*Wall2y; G4double Wall2hz = 0.5*Wall2z; G4ThreeVector positionWall2 = G4ThreeVector((Wall2hx-Wall1x), 181.6*cm,-(Wall1z+Wall2hz)) ; // G4Box* solidWall2 = new G4Box( "Wall2" , Wall2hx, Wall2hy, Wall2hz); //G4Box* solidWall2 = new G4Box( "Wall2" , 5*cm, 1*cm, 5*cm); // logicWall2 = new G4LogicalVolume(solidWall2,Wall2Matter ,"Wall2",0,0,0); physiWall2 = new G4PVPlacement(0, // no rotation positionWall2, // at (x,y,z) logicWall2, // its logical volume "Wall2", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Wall3 //------------------------------ Wall3Matter=Cement; G4double Wall4z = 0.3048 *m; G4double d14 = 1.8796*m; //distance from wall 1 to wall 4 = 74 inches. G4double Wall3x = 0.3084 *m; G4double Wall3y = 3.6322 *m; G4double Wall3z = Wall1z+Wall2z+d14+Wall4z; G4double Wall3hx = 0.5*Wall3x; G4double Wall3hy = 0.5*Wall3y; G4double Wall3hz = 0.5*Wall3z; G4ThreeVector positionWall3 = G4ThreeVector((Wall2x-Wall1x+Wall3hx), Wall3hy,-(Wall3hz-d14-Wall4z)) ; // //G4ThreeVector positionWall3 = G4ThreeVector((Wall2x-Wall1x+Wall3hx), 181.6*cm,-(Wall1z+Wall2z-Wall3hz)) ; // G4Box* solidWall3 = new G4Box( "Wall3" , Wall3hx, Wall3hy, Wall3hz); logicWall3 = new G4LogicalVolume(solidWall3,Wall3Matter ,"Wall3",0,0,0); physiWall3 = new G4PVPlacement(0, // no rotation positionWall3, // at (x,y,z) logicWall3, // its logical volume "Wall3", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Wall4 //------------------------------ Wall4Matter=Cement; G4double d15 = 1.2192 * m; //distance from wall 1 to wall 5 = 4 feet. G4double Wall4x = ( Wall2x + d15); G4double Wall4y = 3.6322 *m; G4double Wall4hx = 0.5*Wall4x; G4double Wall4hy = 0.5*Wall4y; G4double Wall4hz = 0.5*Wall4z; G4ThreeVector positionWall4 = G4ThreeVector((Wall4hx-d15-Wall1x), Wall4hy, (d14+Wall4hz)) ; // G4Box* solidWall4 = new G4Box( "Wall4" , Wall4hx, Wall4hy, Wall4hz); // logicWall4 = new G4LogicalVolume(solidWall4,Wall4Matter ,"Wall1",0,0,0); physiWall4 = new G4PVPlacement(0, // no rotation positionWall4, // at (x,y,z) logicWall4, // its logical volume "Wall4", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Wall5up //------------------------------ Wall5upMatter=Cement; G4double Wall5dwy = 2.15 *m; G4double Wall5upx = 0.3048 *m; G4double Wall5upy = 3.946 *m; G4double Wall5upz = 10.9728*m; G4double Wall5uphx = 0.5*Wall5upx; G4double Wall5uphy = 0.5*Wall5upy; G4double Wall5uphz = 0.5*Wall5upz; G4ThreeVector positionWall5up = G4ThreeVector(-(Wall1x+d15+Wall5uphx), (Wall5uphy+Wall5dwy), -(Wall5uphz-Wall4z-d14)) ; // G4Box* solidWall5up = new G4Box( "Wall5up" , Wall5uphx, Wall5uphy, Wall5uphz); // //G4ThreeVector positionWall5up = G4ThreeVector(-228.6*cm, (0.5*394.6+215)*cm, 0*cm) ; // //G4Box* solidWall5up = new G4Box( "Wall5up" , 15.24*cm, 0.5*394.6*cm, 500*cm); // logicWall5up = new G4LogicalVolume(solidWall5up,Wall5upMatter ,"Wall5up",0,0,0); physiWall5up = new G4PVPlacement(0, // no rotation positionWall5up, // at (x,y,z) logicWall5up, // its logical volume "Wall5up", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Wall5down //------------------------------ Wall5dwMatter=Cement; G4double Wall5dwx = Wall5upx; //G4double Wall5dwy = 2.15 *m; G4double Wall5dwz = Wall5upz; G4double Wall5dwhx = 0.5*Wall5dwx; G4double Wall5dwhy = 0.5*Wall5dwy; G4double Wall5dwhz = 0.5*Wall5dwz; G4ThreeVector positionWall5dw = G4ThreeVector(-(Wall1x+d15+Wall5dwhx), Wall5dwhy, -(Wall5dwhz-Wall4z-d14)) ; // G4Box* solidWall5dw = new G4Box( "Wall5dw" , Wall5dwhx, Wall5dwhy, Wall5dwhz); // //G4ThreeVector positionWall5down = G4ThreeVector(-228.6*cm, 0.5*215*cm, 0*cm) ; // //G4Box* solidWall5down = new G4Box( "Wall5down" , 15.24*cm, 0.5*215*cm, 500*cm); // logicWall5dw = new G4LogicalVolume(solidWall5dw,Wall5dwMatter ,"Wall5dw",0,0,0); physiWall5dw = new G4PVPlacement(0, // no rotation positionWall5dw, // at (x,y,z) logicWall5dw, // its logical volume "Wall5dw", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Wall6 //------------------------------ Wall6Matter=Cement; G4double d16x = 0.2413 *m; G4double d16z = 1.6002 *m; G4double Wall6x = 0.9779 *m; G4double Wall6y = 3.6322 *m; G4double Wall6z = 0.2794 *m; G4double Wall6hx = 0.5*Wall6x; G4double Wall6hy = 0.5*Wall6y; G4double Wall6hz = 0.5*Wall6z; G4ThreeVector positionWall6 = G4ThreeVector(-(Wall1x+d16x+Wall6hx), Wall6hy,(d16z+Wall6hz)) ; // G4Box* solidWall6 = new G4Box( "Wall6" , Wall6hx, Wall6hy, Wall6hz); logicWall6 = new G4LogicalVolume(solidWall6,Wall6Matter ,"Wall1",0,0,0); physiWall6 = new G4PVPlacement(0, // no rotation positionWall6, // at (x,y,z) logicWall6, // its logical volume "Wall6", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Wall7 //------------------------------ Wall7Matter=Cement; G4double d27 = 0.4826 *m; G4double Wall7x = 0.23876 *m; G4double Wall7y = 3.6322 *m; G4double Wall7z = 1.4224 *m; G4double Wall7hx = 0.5*Wall7x; G4double Wall7hy = 0.5*Wall7y; G4double Wall7hz = 0.5*Wall7z; G4ThreeVector positionWall7 = G4ThreeVector((Wall2x-Wall1x-Wall7hx), Wall7hy,-(Wall1z-d27-Wall7hz)) ; // G4Box* solidWall7 = new G4Box( "Wall7" , Wall7hx, Wall7hy, Wall7hz); logicWall7 = new G4LogicalVolume(solidWall7,Wall7Matter ,"Wall1",0,0,0); physiWall7 = new G4PVPlacement(0, // no rotation positionWall7, // at (x,y,z) logicWall7, // its logical volume "Wall7", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Floor //------------------------------ FloorMater=Cement; G4double Floorx = d15+Wall2x+Wall3x; G4double Floory = 2 *m; G4double Floorz = Wall3z; //G4double Floorz = Wall1z+Wall2z+d14+Wall4z; G4double Floorhx = 0.5*Floorx; G4double Floorhy = 0.5*Floory; G4double Floorhz = 0.5*Floorz; G4ThreeVector positionFloor = G4ThreeVector( (Floorhx-d15-Wall1x),-Floorhy , -(Wall3hz-d14-Wall4z)) ; // G4Box* solidFloor = new G4Box( "Floor", Floorhx ,Floorhy , Floorhz ); // logicFloor = new G4LogicalVolume(solidFloor,FloorMater ,"Floor",0,0,0); physiFloor = new G4PVPlacement(0, // no rotation positionFloor, // at (x,y,z) logicFloor, // its logical volume "Floor", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Ceiling //------------------------------ CeilMater=Cement; G4double Ceilx = d15+Wall2x+Wall3x; G4double Ceily = 1.524 *m; G4double Ceilz = Wall3z; //G4double Floorz = Wall1z+Wall2z+d14+Wall4z; G4double Ceilhx = 0.5*Ceilx; G4double Ceilhy = 0.5*Ceily; G4double Ceilhz = 0.5*Ceilz; G4ThreeVector positionCeil = G4ThreeVector( (Ceilhx-d15-Wall1x),(Ceilhy+Wall6y) , -(Wall3hz-d14-Wall4z)) ; // G4Box* solidCeil = new G4Box( "Ceil", Ceilhx ,Ceilhy , Ceilhz ); // logicCeil = new G4LogicalVolume(solidCeil,CeilMater ,"Ceil",0,0,0); physiCeil = new G4PVPlacement(0, // no rotation positionCeil, // at (x,y,z) logicCeil, // its logical volume "Ceil", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Ceiling2 //------------------------------ //Ceil2Mater=Cement; //G4ThreeVector positionCeil2 = G4ThreeVector(1.3716*m,(2*1.816+0.5*1.524)*m,-15.0*cm) ; // //G4Box* solidCeil2 = new G4Box( "Ceiling" , 0.5*7.62*m, 0.5*1.524*m, 0.5*7.0104*m); // //logicCeil2 = new G4LogicalVolume(solidCeil2,Ceil2Mater ,"Floor",0,0,0); //physiCeil2 = new G4PVPlacement(0, // no rotation //positionCeil2, // at (x,y,z) // logicCeil2, // its logical volume //"Floor", // its name //logicWorld, // its mother volume //false, // no boolean operations //0); // copy number //================================================================================== //================================================================================================================ //================================================================================================================ //================================================================================================================ /* Geant4 uses the rotation matrix implementation which comes with CLHEP (HepRotation, typedef’d into G4RotationMatrix) #include “G4RotationMatrix.hh” …. G4RotationMatrix *rm = new G4RotationMatrix; You can then rotate about the coordinate axes: rm->rotateX(45*deg); // rotation about X and combine several rotations into a 3D one: rm->rotateX(30*deg); rm->rotateY(20*deg); You can rotate about a specified vector rm->rotate(45*deg,Hep3Vector(1.,1.,.3)); or specify the direction of the three cartesian axes after the rotation rm->rotateAxes( Hep3Vector(-sin(a),0,cos(a)), Hep3Vector(cos(a),0,sin(a)), Hep3Vector(0,1,0)); a rotation matrix can be inverted by using the invert method rm->invert(); The angles made by the rotated axes against the original axes can be obtained with the set of functions: phiX(),phiY(),phiZ(),thetaX(),thetaY(),thetaZ() …or one can get the rotation angle and the rotation axis (awkward) G4double angle; G4ThreeVector axis; rm->getAngleAxis(angle,axis); to reset a rotation matrix use the default constructor *rm=G4RotationMatrix(); documentation at: $CLHEP_BASE_DIR/include/CLHEP/Vector/Rotation.h wwwinfo.cern.ch/asd/lhc++/clhep/manual/RefGuide/Vector/HepRotation.html */ //================================================================================== //------------------------------ // Tracker //------------------------------ G4ThreeVector positionTracker = G4ThreeVector(400*cm,400*cm,400*cm); // G4ThreeVector positionTracker = G4ThreeVector(0,0,-(targetSize+trackerSize)); solidTracker = new G4Box("tracker",trackerSize,trackerSize,trackerSize); logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0); physiTracker = new G4PVPlacement(0, // no rotation positionTracker, // at (x,y,z) logicTracker, // its logical volume "Tracker", // its name logicWorld, // its mother volume false, // no boolean operations 0); // copy number //------------------------------ // Tracker segments //------------------------------ // // An example of Parameterised volumes // dummy values for G4Box -- modified by parameterised volume solidChamber = new G4Box("chamber", 0.1*cm, 0.1*cm, 0.1*cm); //solidChamber = new G4Box("chamber", 0*cm, 0*cm, 0*cm); logicChamber = new G4LogicalVolume(solidChamber,ChamberMater,"Chamber",0,0,0); G4double firstPosition = -trackerSize +0.5* ChamberWidth; G4double firstLength = fTrackerLength/10; G4double lastLength = fTrackerLength; G4VPVParameterisation* chamberParam = new ExN02ChamberParameterisation( NbOfChambers, // NoChambers firstPosition, // Z of center of first ChamberSpacing, // Z spacing of centers ChamberWidth, // Width Chamber firstLength, // lengthInitial lastLength); // lengthFinal // dummy value : kZAxis -- modified by parameterised volume // physiChamber = new G4PVParameterised( "Chamber", // their name logicChamber, // their logical volume logicTracker, // Mother logical volume kZAxis, // Are placed along this axis NbOfChambers, // Number of chambers chamberParam); // The parametrisation G4cout << "There are " << NbOfChambers << " chambers in the tracker region. " << "The chambers are " << ChamberWidth/mm << " mm of " << ChamberMater->GetName() << "\n The distance between chamber is " << ChamberSpacing/cm << " cm" << G4endl; //------------------------------------------------ // Sensitive detectors //------------------------------------------------ G4SDManager* SDman = G4SDManager::GetSDMpointer(); G4String trackerChamberSDname = "ExN02/TrackerChamberSD"; ExN02TrackerSD* aTrackerSD = new ExN02TrackerSD( trackerChamberSDname ); SDman->AddNewDetector( aTrackerSD ); logicChamber->SetSensitiveDetector( aTrackerSD ); //--------- Visualization attributes ------------------------------- //100:red, 010:green, 001:blue,110:yellow, 011:blue-green, 101:pink,111:white. G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1,1,1)); //white logicWorld ->SetVisAttributes(BoxVisAtt); logicTarget ->SetVisAttributes(BoxVisAtt); logicTracker->SetVisAttributes(BoxVisAtt); G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1,1,0)); logicChamber->SetVisAttributes(ChamberVisAtt); //yellow G4VisAttributes* LogTargetVisAtt= new G4VisAttributes(G4Colour(1,0,0)); logicTarget ->SetVisAttributes(LogTargetVisAtt); //red G4VisAttributes* LogWall1VisAtt= new G4VisAttributes(G4Colour(0,1,1)); logicWall1 ->SetVisAttributes(LogWall1VisAtt); //green G4VisAttributes* LogWall2VisAtt= new G4VisAttributes(G4Colour(0,1,1)); logicWall2 ->SetVisAttributes(LogWall2VisAtt); // blue G4VisAttributes* LogWall3VisAtt= new G4VisAttributes(G4Colour(0,1,1)); logicWall3 ->SetVisAttributes(LogWall3VisAtt); // blue-green G4VisAttributes* LogWall4VisAtt= new G4VisAttributes(G4Colour(0,1,1)); logicWall4 ->SetVisAttributes(LogWall4VisAtt); // blue-green G4VisAttributes* LogWall5upVisAtt= new G4VisAttributes(G4Colour(0,1,1)); logicWall5up ->SetVisAttributes(LogWall5upVisAtt); // blue-green G4VisAttributes* LogWall5dwVisAtt= new G4VisAttributes(G4Colour(0,1,1)); logicWall5dw ->SetVisAttributes(LogWall5dwVisAtt); // blue-green //100:red, 010:green, 001:blue,110:yellow, 011:blue-green, 101:pink,111:white. G4VisAttributes* LogWall6VisAtt= new G4VisAttributes(G4Colour(0,1,1)); logicWall6 ->SetVisAttributes(LogWall6VisAtt); // blue-green G4VisAttributes* LogWall7VisAtt= new G4VisAttributes(G4Colour(0,1,1)); logicWall7 ->SetVisAttributes(LogWall7VisAtt); // blue-green G4VisAttributes* LogCeilVisAtt= new G4VisAttributes(G4Colour(0,0,1)); logicCeil ->SetVisAttributes(LogCeilVisAtt); // blue G4VisAttributes* LogFloorVisAtt= new G4VisAttributes(G4Colour(0,0,1)); logicFloor ->SetVisAttributes(LogFloorVisAtt); // blue //G4VisAttributes* LogCollimatorVisAtt= new G4VisAttributes(G4Colour(1,0,1)); //logicCollimator ->SetVisAttributes(LogCollimatorVisAtt); //pink //G4VisAttributes* LogCyDetVisAtt= new G4VisAttributes(G4Colour(0,1,0)); //logicCyDet ->SetVisAttributes(LogCyDetVisAtt); //green //G4VisAttributes* LogWall1VisAtt= new G4VisAttributes(G4Colour(0,1,0)); //logicWall1 ->SetVisAttributes(LogWall1VisAtt); //green //G4VisAttributes* LogWall2aVisAtt= new G4VisAttributes(G4Colour(0,1,1)); //logicWall2a ->SetVisAttributes(LogWall2aVisAtt); // blue-green //G4VisAttributes* LogWall2bVisAtt= new G4VisAttributes(G4Colour(0,1,1)); //logicWall2b ->SetVisAttributes(LogWall2bVisAtt); // blue-green //G4VisAttributes* LogWall2cVisAtt= new G4VisAttributes(G4Colour(0,1,1)); //logicWall2c ->SetVisAttributes(LogWall2cVisAtt); // blue-green //G4VisAttributes* LogWall2dVisAtt= new G4VisAttributes(G4Colour(0,1,1)); //logicWall2d ->SetVisAttributes(LogWall2dVisAtt); // blue-green //G4VisAttributes* LogTarget2VisAtt= new G4VisAttributes(G4Colour(1.0,0,1.0)); //logicTarget2 ->SetVisAttributes(LogTarget2VisAtt); //pink //--------- example of User Limits ------------------------------- // below is an example of how to set tracking constraints in a given // logical volume(see also in N02PhysicsList how to setup the processes // G4StepLimiter or G4UserSpecialCuts). // Sets a max Step length in the tracker region, with G4StepLimiter // G4double maxStep = 0.5*ChamberWidth; logicTracker->SetUserLimits(new G4UserLimits(maxStep)); // Set additional contraints on the track, with G4UserSpecialCuts // // G4double maxLength = 2*fTrackerLength, maxTime = 0.1*ns, minEkin = 10*MeV; // logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime, // minEkin)); return physiWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void ExN02DetectorConstruction::setTargetMaterial(G4String materialName) { // search the material by its name G4Material* pttoMaterial = G4Material::GetMaterial(materialName); if (pttoMaterial) {TargetMater = pttoMaterial; logicTarget->SetMaterial(pttoMaterial); G4cout << "\n----> The target is " << fTargetLength/cm << " cm of " << materialName << G4endl; } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void ExN02DetectorConstruction::setChamberMaterial(G4String materialName) { // search the material by its name G4Material* pttoMaterial = G4Material::GetMaterial(materialName); if (pttoMaterial) {ChamberMater = pttoMaterial; logicChamber->SetMaterial(pttoMaterial); G4cout << "\n----> The chambers are " << ChamberWidth/cm << " cm of " << materialName << G4endl; } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void ExN02DetectorConstruction::SetMagField(G4double fieldValue) { fpMagField->SetFieldValue(fieldValue); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......4