diff --git a/.CloverDetectorConstruction.cc.swo b/.CloverDetectorConstruction.cc.swo deleted file mode 100644 index e983359..0000000 Binary files a/.CloverDetectorConstruction.cc.swo and /dev/null differ diff --git a/.Detector_Parameters.hh.swp b/.Detector_Parameters.hh.swp deleted file mode 100644 index b1b499d..0000000 Binary files a/.Detector_Parameters.hh.swp and /dev/null differ diff --git a/CloverDetectorConstruction.cc b/CloverDetectorConstruction.cc index 0449219..811d110 100644 --- a/CloverDetectorConstruction.cc +++ b/CloverDetectorConstruction.cc @@ -9,6 +9,7 @@ #include "G4Box.hh" #include "G4Tubs.hh" #include "G4Sphere.hh" +#include "G4Trd.hh" #include "G4IntersectionSolid.hh" #include "G4SubtractionSolid.hh" @@ -120,9 +121,19 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() //Clover casing G4double caseXYInner = 2*(cutXY + 1.0) * mm; - G4double caseZInner = crystalLength/2 + 4 * mm + crystalLength + 15*mm; + G4double caseZInner = crystalLength/2 + crystalLength + 10*mm; G4double caseXYWallThickness = 3.0 * mm; G4double caseZWallThickness = 3.0 * mm; + + + //BGO Detector + + G4double bgoXYInner = 10*mm + 2*(cutXY + 1.0) * mm; + G4double bgoZInner = crystalLength/2 + 4 * mm + crystalLength + 15*mm; + G4double bgoXYWallThickness = 103.5 * mm; //from schematic + G4double bgoanglecut = 53 * mm; + + // Get materials auto backgroundMaterial = G4Material::GetMaterial("G4_AIR"); @@ -154,10 +165,6 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() G4RotationMatrix * rotX = new G4RotationMatrix(); rotX->rotateX(90*degree); G4RotationMatrix * rotY = new G4RotationMatrix(); rotY->rotateY(90*degree); - //G4SubtractionSolid * pipe1 = new G4SubtractionSolid("Pipe1", pipe, pipe0, rotY, G4ThreeVector()); - - // G4LogicalVolume * pipe1LV = new G4LogicalVolume( pipe1, G4Material::GetMaterial("G4_Fe"), "Pipe"); - // G4LogicalVolume * pipe2LV = new G4LogicalVolume( pipe, G4Material::GetMaterial("G4_Fe"), "Pipe2"); G4LogicalVolume * chamberLV = new G4LogicalVolume(chamber, G4Material::GetMaterial("G4_Fe"),"targetchamber"); new G4PVPlacement( 0, // no rotation @@ -168,19 +175,8 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() false, // no boolean operation 0, // copy number fCheckOverlaps); // checking overlaps - /* - new G4PVPlacement( rotY, // no rotation - G4ThreeVector(0, 0, pipeZPos), // at (0,0,0) - pipe2LV, // its logical volume - "Pipe2", // its name - worldLV, // its mother volume - false, // no boolean operation - 0, // copy number - fCheckOverlaps); // checking overlaps - */ - // pipe1LV->SetVisAttributes(new G4VisAttributes(G4Colour(1.0,1.0,1.0))); - // pipe2LV->SetVisAttributes(new G4VisAttributes(G4Colour(1.0,1.0,1.0))); - chamberLV->SetVisAttributes(new G4VisAttributes(G4Colour(1.0,1.0,1.0))); + + chamberLV->SetVisAttributes(new G4VisAttributes(G4Colour(1.0,1.0,1.0))); // Crystals @@ -197,8 +193,18 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() G4Box* case2 = new G4Box("case2", (caseXYInner + caseXYWallThickness)/2. , (caseXYInner + caseXYWallThickness)/2., caseZInner + caseZWallThickness*2.); G4SubtractionSolid * casing = new G4SubtractionSolid("casing", case2, case1); + G4Box* bgo1 = new G4Box("bgo1", bgoXYInner/2., bgoXYInner/2., bgoZInner +10*mm); + + G4Trd* bgo2 = new G4Trd("bgo2", (bgoXYInner+ bgoXYWallThickness)/2. - bgoanglecut ,(bgoXYInner+ bgoXYWallThickness)/2. + , (bgoXYInner + bgoXYWallThickness)/2. - bgoanglecut, (bgoXYInner + bgoXYWallThickness)/2., bgoZInner); + //G4Box* bgo2 = new G4Box("bgo2", (bgoXYInner+ bgoXYWallThickness)/2., (bgoXYInner + bgoXYWallThickness)/2., bgoZInner + bgoZWallThickness*2.); + + G4SubtractionSolid * bgo = new G4SubtractionSolid("bgo", bgo2, bgo1); + + // creating the subtraction solid that will form the actual bgo sheild. - + + double dTheta,dPsi,zmod; for( G4int i = 0 ; i < fNumOfCrystal ; i++){ @@ -216,7 +222,7 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() auto caseLV = new G4LogicalVolume * [fNumOfCrystal/4]; - // auto caseLV = new G4LogicalVolume(casing, G4Material::GetMaterial("G4_Al"), "Case")[i/4+1]; + auto bgoLV = new G4LogicalVolume * [fNumOfCrystal/4]; fLogicCrystal[i]->SetVisAttributes(crystalVisAtt); @@ -237,10 +243,13 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() // if(iClover != DetNum){return 0;} - G4ThreeVector case_pos = G4ThreeVector(0,0,100*mm+crystalZPos + zmod); //The crystalZpos is the radius of the detectors. - + G4ThreeVector case_pos = G4ThreeVector(0,0,60*mm+crystalZPos + zmod); //The crystalZpos is the radius of the detector, + //bgo uses the same position vector and rotation matrix as the case + G4ThreeVector bgo_pos = G4ThreeVector(0,0,60*mm+crystalZPos + zmod); + //Set rotation matrix settings for clovers. + G4RotationMatrix * bgomat = new G4RotationMatrix(); G4RotationMatrix * rotmat = new G4RotationMatrix(); G4RotationMatrix * crystalmat= new G4RotationMatrix(); @@ -249,26 +258,30 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() for(int j = 0; j <= iClover;j++){ if(j == iClover){ - // rotmat->rotateY(yangc *degree); - + + // rotation matrix must undo the operations you perform with the position vector. + + bgomat->rotateZ(-dPsi*degree); + bgomat->rotateX(-dTheta*degree); + rotmat->rotateZ(-dPsi*degree); rotmat->rotateX(-dTheta*degree); - // crystalmat->rotateY(yang*degree); crystalmat->rotateZ(-dPsi*degree); crystalmat->rotateX(-dTheta*degree); //rotate position vector based on iClover. - // pos.rotateY(dPhi*degree); pos.rotateX(dTheta*degree); pos.rotateZ(dPsi *degree); //set rotation for the detector case vector; - // case_pos.rotateY(dPhi*degree); case_pos.rotateX(dTheta *degree); case_pos.rotateZ(dPsi*degree); + + bgo_pos.rotateX(dTheta *degree); + bgo_pos.rotateZ(dPsi*degree); } } new G4PVPlacement( crystalmat, // orientation matrix @@ -283,7 +296,9 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() if( jCrystal == 0 ) { caseLV[iClover] = new G4LogicalVolume(casing, G4Material::GetMaterial("G4_Al"), "Case"); - new G4PVPlacement( rotmat , // case orientation + bgoLV[iClover] = new G4LogicalVolume(bgo , G4Material::GetMaterial("G4_Al"), "BGO "); + + new G4PVPlacement( rotmat , // case orientation case_pos, // case location caseLV[i/4], // its logical volume "Casing", // its name @@ -292,7 +307,16 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() iClover, // copy number fCheckOverlaps); // checking overlaps + new G4PVPlacement( bgomat , // bgo orientation + bgo_pos, // bgo location + bgoLV[i/4], // its logical volume + "Bgo", // its name + worldLV, // its mother volume + false, // no boolean operation + iClover, // copy number + fCheckOverlaps); // checking overlaps caseLV[iClover]->SetVisAttributes(new G4VisAttributes(G4Colour(1.0,1.0,0.0))); + bgoLV[iClover]->SetVisAttributes(new G4VisAttributes(G4Colour(0.,1.0,0.0))); } //Set a i+1%4 for each // diff --git a/Detector_Parameters.hh b/Detector_Parameters.hh index 851a2aa..295f129 100644 --- a/Detector_Parameters.hh +++ b/Detector_Parameters.hh @@ -9,33 +9,33 @@ #include #include - //location data array for each clover needs to be set here; - // clover number , theta, phi, relative z-distance to the Radius - // - - const double Clover_Location[16][4] = {{0,131.75,326.96,0.}, - {1,150.,243.57,0.}, - {2,90.0,257.14,0.}, - {3,90.0,205.71,0.}, - {4,48.25,326.68,0.}, - {5,48.25,252.64,0.}, - {6,131.75,33.31,0.}, - {7,150.,116.42,0.}, - {8,90.,102.85,0.}, - {9,90.,154.28,0.}, - {10,48.25,33.31,0.}, - {11,90.,308.57,0.}, - {12,90.,51.42,0.}, - {13,48.25,180.,0.}, - {14,129.,180.,0.}, - {15,48.25,107.35,0.}};//, - +const int Crystal_Num = 64; // has to be divisible by 4. + +const double Radius = 200.; //Z POSITION -- radius away from target, in milimeters. + //location data array for each clover needs to be set here; + // clover number , theta, phi, relative z-distance to the Radius + // + +const double Clover_Location[Crystal_Num/4][4] = {{0,131.75,326.96,0.}, + {1,150.,243.57,0.}, + {2,90.0,257.14,0.}, + {3,90.0,205.71,0.}, + {4,48.25,326.68,0.}, + {5,48.25,252.64,0.}, + {6,131.75,33.31,0.}, + {7,150.,116.42,0.}, + {8,90.,102.85,0.}, + {9,90.,154.28,0.}, + {10,48.25,33.31,0.}, + {11,90.,308.57,0.}, + {12,90.,51.42,0.}, + {13,48.25,180.,0.}, + {14,129.,180.,0.}, + {15,48.25,107.35,0.}};//, + - const int Crystal_Num = 64; // has to be divisible by 4. - - const double Radius = 200.; //Z POSITION -- radius away from target, in milimeters.