diff --git a/src/musrDetectorConstruction.cc b/src/musrDetectorConstruction.cc index 3b2be1c..d2cedf3 100644 --- a/src/musrDetectorConstruction.cc +++ b/src/musrDetectorConstruction.cc @@ -477,6 +477,70 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() { G4Tubs* solidOuterDetTube = new G4Tubs("SolidOuterDetTube",0.*mm,x2*mm,x3*mm,x4*deg,x5*deg); solid = new G4SubtractionSolid(solidName, solidOuterDetTube, solidInnerDetBox); } + else if (strcmp(tmpString2,"GPSforward")==0){ + // Create a box, from which a cone is cut out: + // x1, x2, x3 = box half-widths; + // x4, x5 = radii of the cone (at the two faces of the box) that will be cut out + sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %s %lf %lf %lf %s %s", + name,&x1,&x2,&x3,&x4,&x5,material,&posx,&posy,&posz,mothersName,rotMatrix); + sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d %s",sensitiveDet,&volumeID,actualFieldName); + solidName+=name; + G4double roundingErr=0.01*mm; // to avoid some displaying problems of the subtracted volumes + G4Box* GPS_SolidDetBox = new G4Box("GPS_SolidDetBox",x1*mm,x2*mm,x3*mm); + G4Cons* GPS_SolidDetCons = new G4Cons("GPS_SolidDetCons",0.,x4*mm,0.,x5*mm,x3*mm+roundingErr,0.,360.); + solid = new G4SubtractionSolid(solidName, GPS_SolidDetBox, GPS_SolidDetCons); + } + else if (strcmp(tmpString2,"GPSbackward")==0){ + // Create a box, from which a trapezoid (with dx=dy) is cut out: + // x1, x2, x3 = box half-widths; + // x4, x5 = dx1=dy1 and dx2=dy2 of the trapezoid + sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %s %lf %lf %lf %s %s", + name,&x1,&x2,&x3,&x4,&x5,material,&posx,&posy,&posz,mothersName,rotMatrix); + sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d %s",sensitiveDet,&volumeID,actualFieldName); + solidName+=name; + G4double roundingErr=0.01*mm; // to avoid some displaying problems of the subtracted volumes + G4Box* GPS_SolidDetBox2 = new G4Box("GPS_SolidDetBox2",x1*mm,x2*mm,x3*mm); + G4Trd* GPS_SolidDetTrd2 = new G4Trd("GPS_SolidDetTrd2",x4*mm,x5*mm,x4*mm,x5*mm,x3*mm+roundingErr); + solid = new G4SubtractionSolid(solidName, GPS_SolidDetBox2, GPS_SolidDetTrd2); + } + else if (strcmp(tmpString2,"GPSbackwardVeto")==0){ + // Create a trapezoid, from which a trapezoid is cut out: + // x1, x2, x3, x4, x5 = half-dimensions of the outer trapezoid; + // x6, x7, x8, x9 = half-dimensions of the inner trapezoid (it is expected that dz=x5 is the same for both trapezoids) + sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %lf %lf %lf %lf %s", + name,&x1,&x2,&x3,&x4,&x5,&x6,&x7,&x8,&x9,material); + sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*g %*g %*g %*g %*s %lf %lf %lf %s %s %s %d %s", + &posx,&posy,&posz,mothersName,rotMatrix,sensitiveDet,&volumeID,actualFieldName); + solidName+=name; + G4double roundingErr=0.01*mm; // to avoid some displaying problems of the subtracted volumes + G4Trd* GPS_OuterTrd = new G4Trd("GPS_OuterTrd",x1*mm,x2*mm,x3*mm,x4*mm,x5*mm); + G4Trd* GPS_InnerTrd = new G4Trd("GPS_InnerTrd",x6*mm,x7*mm,x8*mm,x9*mm,x5*mm+roundingErr); + solid = new G4SubtractionSolid(solidName,GPS_OuterTrd,GPS_InnerTrd); + } + else if (strcmp(tmpString2,"tubeWithWindows")==0){ + // x1 ... inner radius of the tube + // x2 ... outer radius of the tube + // x3 ... half-length of the tube + // x4 ... radius of the backward window + // x5 ... distance between the center of the backward window and the end of the shield + // x6 ... radius of the forward window + // x7 ... distance between the center of the forward window and the end of the shield + // + sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %lf %lf %s", + name,&x1,&x2,&x3,&x4,&x5,&x6,&x7,material); + sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*g %*g %*s %lf %lf %lf %s %s %s %d %s", + &posx,&posy,&posz,mothersName,rotMatrix,sensitiveDet,&volumeID,actualFieldName); + solidName+=name; + G4double roundingErr=0.01*mm; // to avoid some displaying problems of the subtracted volumes + G4Tubs* solidShield = new G4Tubs("SolidShield",x1*mm,x2*mm,x3*mm,0.,360.); + G4Tubs* solidWindF = new G4Tubs("SolidWindF",0.,x4*mm,x2*mm,0.,360.); + G4Tubs* solidWindB = new G4Tubs("SolidWindB",0.,x6*mm,x2*mm,0.,360.); + G4RotationMatrix* rot = new G4RotationMatrix(0,90*deg,0); + G4ThreeVector zTransF(0.,x2*mm+roundingErr,(x5-x3)*mm); + G4ThreeVector zTransB(0.,-x2*mm+roundingErr,(x7-x3)*mm); + G4SubtractionSolid* solidF1 = new G4SubtractionSolid("solidF1", solidShield, solidWindF, rot, zTransF); + solid = new G4SubtractionSolid(solidName, solidF1, solidWindB, rot, zTransB); + } else if (strcmp(tmpString2,"GPDcollimator")==0){ // Create a box, from which a box is cut out. x1, x2, x3 = box half-widths; // x4,x5,x6,x7 define the tube, x8, x9 and x10 are the distances between the tube and box centres.