diff --git a/Configure/padme_init_grid.sh b/Configure/padme_init_cvmfs.sh similarity index 100% rename from Configure/padme_init_grid.sh rename to Configure/padme_init_cvmfs.sh diff --git a/PadmeMC/Beam/src/BeamParameters.cc b/PadmeMC/Beam/src/BeamParameters.cc index 1bb9b8b0..89fc277e 100644 --- a/PadmeMC/Beam/src/BeamParameters.cc +++ b/PadmeMC/Beam/src/BeamParameters.cc @@ -60,8 +60,8 @@ BeamParameters::BeamParameters() fNThreePhotonDecaysPerBunch = 0; fThreePhotonDecaysFilename = "ThreePhotonDecays.list"; - // Generic beam position at t=0 - fBeamOriginPosZ = -70.*cm; + // Generic beam position at t=0. Will be modified according to detector geometry + fBeamOriginPosZ = -100.*cm; } diff --git a/PadmeMC/Chamber/include/ChamberGeometry.hh b/PadmeMC/Chamber/include/ChamberGeometry.hh index dfd5eea2..95ed5554 100644 --- a/PadmeMC/Chamber/include/ChamberGeometry.hh +++ b/PadmeMC/Chamber/include/ChamberGeometry.hh @@ -8,22 +8,11 @@ #ifndef ChamberGeometry_H #define ChamberGeometry_H 1 -#define CHAMBERGEOMETRY_VCINMAGWALL_NVERTICES 14 -#define CHAMBERGEOMETRY_VCINMAGPLATE_NVERTICES 6 -#define CHAMBERGEOMETRY_VCOUTMAGWALL_NVERTICES 6 - -#define CHAMBERGEOMETRY_VC_NSECTIONS 12 -#define CHAMBERGEOMETRY_VC_REFSECTION 1 - -#define CHAMBERGEOMETRY_VC_NFACETS 41 - #include "globals.hh" -#include "G4TwoVector.hh" #include "G4ThreeVector.hh" #include "G4SystemOfUnits.hh" -class G4UnionSolid; -class G4VSolid; +#define CHAMBERGEOMETRY_N_PORTHOLES 8 class ChamberGeometry { @@ -43,173 +32,117 @@ protected: public: - // These are the maximum X/Z coordinates reached by the whole VC structure - // Needed to define the main magnetic volume - G4double GetVCMostExternalX() { return fVCMostExternalX; } - G4double GetVCMostAdvancedZ() { return fEWBackFacePosZ+fEWF1Thick; } - - G4double GetVCInMagThick() { return fVCInMagThick; } - - G4double GetVCInMagWallSizeY() { return fVCInMagWallSizeY; } - G4int GetVCInMagWallNVertices() { return CHAMBERGEOMETRY_VCINMAGWALL_NVERTICES; } - G4TwoVector GetVCInMagWallVertex(G4int p) { return fVCInMagWallVertex[p]; } + // Info on the back face of the chamber + // Needed to correctly position exit hole, HEPVeto and TimePix + G4double GetVCBackFacePosZ() { return fVCBackFacePosZ; } + G4double GetVCBackFaceAngle() { return fVCBackFaceAngle; } + G4double GetVCBackFaceThickness() { return fVCBackFaceThick; } + G4ThreeVector GetVCBackFaceCorner() { return G4ThreeVector(fVCBackFaceCornerX,0.,fVCBackFaceCornerZ); } - G4double GetVCInMagWallHoleRadius() { return fVCInMagWallHoleRadius; } - G4double GetVCInMagWallHolePosZ() { return fVCInMagWallHolePosZ; } + // Info on section of the vacuum chamber inside magnet + // Used to define the magnetic volume + G4double GetVCInnerSizeX() { return fVCInnerSizeX; } + G4double GetVCInnerSizeY() { return fVCInnerSizeY; } + G4double GetVCInnerFacePosZ() { return fVCInnerFacePosZ; } - G4int GetVCInMagPlateNVertices() { return CHAMBERGEOMETRY_VCINMAGPLATE_NVERTICES; } - G4TwoVector GetVCInMagPlateVertex(G4int p) { return fVCInMagPlateVertex[p]; } + // Properties of aluminum|carbon thin window and its flange - G4double GetVCOutMagWallSizeY() { return fVCInMagWallSizeY; } - G4int GetVCOutMagWallNVertices() { return CHAMBERGEOMETRY_VCOUTMAGWALL_NVERTICES; } - G4TwoVector GetVCOutMagWallVertex(G4int p) { return fVCOutMagWallVertex[p]; } + G4double GetEWAlThick() { return fEWAlThick; } + G4double GetEWAlConvexity() { return fEWAlConvexity; } + G4double GetEWAlRadius() { return fEWAlFlangeRIn; } - // Get internal size of chamber in the magnet region - // Needed to create the internal magnetic volume - G4double GetVCInnerX() { return fVCIntVtx[0][3].x(); } - G4double GetVCInnerY() { return fVCIntVtx[0][3].y(); } - G4double GetVCInnerZ() { return fVCIntVtx[0][3].z(); } + G4double GetEWCarbonThick() { return fEWCarbonThick; } + G4double GetEWCarbonConvexity() { return fEWCarbonConvexity; } + G4double GetEWCarbonRadius() { return fEWAlFlangeRIn; } - // Info on the back face of the chamber - // Needed to correctly position exit hole, HEPVeto and TimePix - G4double GetVCBackFacePosZ() { return fVCBackFacePosZ; } - G4double GetVCBackFaceAngle(); - G4double GetVCBackFaceThickness(); - G4ThreeVector GetVCBackFaceCorner(); - - // Properties of the big vacuum chamber - - // Vertices of the chamber sections - G4int GetVCNSections() { return CHAMBERGEOMETRY_VC_NSECTIONS; } - //G4int GetVCNSections() { return 7; } - G4int GetVCRefSection() { return CHAMBERGEOMETRY_VC_REFSECTION; } - G4ThreeVector GetVCExtVtx(G4int s, G4int v) { return fVCExtVtx[s][v]; } - G4ThreeVector GetVCIntVtx(G4int s, G4int v) { return fVCIntVtx[s][v]; } - - // Facets of the chamber main structure - G4int GetVCNFacets() { return CHAMBERGEOMETRY_VC_NFACETS; } - G4int GetVCFacetVtx(G4int f, G4int v) { return fVCFacetVtx[f][v]; } - - // Flange to connect ECal thin window - G4double GetVCCFPosZ() { return fVCBackFacePosZ-0.5*fVCCFThick; } - G4double GetVCCFThick() { return fVCCFThick; } - G4double GetVCCFRIn() { return fEWF3RIn; } - G4double GetVCCFROut() { return fEWF2ROut; } - - // Big cylinder - G4double GetVCCPosZ() { return 0.5*(fVCCFrontFacePosZ+(fVCBackFacePosZ-fVCCFThick)); } - G4double GetVCCLength() { return (fVCBackFacePosZ-fVCCFThick)-fVCCFrontFacePosZ; } - G4double GetVCCThick() { return fVCCThick; } - G4double GetVCCRIn() { return fVCCRIn; } - G4double GetVCCROut() { return fVCCRIn+fVCCThick; } - - // Beam entrance hole - G4double GetVCInHoleRadius() { return fVCInHoleRadius; } - G4double GetVCInHoleThick() { return fVCInHoleThick; } - G4double GetVCInHolePosZ() { return fVCInHolePosZ; } - - // Beam exit hole - G4double GetVCOutHoleRadius() { return fVCOutHoleRadius; } - G4double GetVCOutHoleLength() { return fVCOutHoleLength; } - G4double GetVCOutHoleThick() { return fVCOutHoleThick; } - G4double GetVCOutHoleDistToEdge() { return fVCOutHoleDistToEdge; } - - // Properties of thin window - - G4double GetEWBackFacePosZ() { return fEWBackFacePosZ; } - G4double GetEWRadius() { return fEWRadius; } - G4double GetEWConvexity() { return fEWConvexity; } - G4double GetEWFrontMylarThick() { return fEWFrontMylarThick; } - G4double GetEWKevlarThick() { return fEWKevlarThick; } - G4double GetEWBackMylarThick() { return fEWBackMylarThick; } - - // Properties of thin window flange - - G4double GetEWF1PosZ() { return fEWBackFacePosZ+0.5*fEWF1Thick; } - G4double GetEWF1Thick() { return fEWF1Thick; } - G4double GetEWF1RIn() { return fEWRadius; } - G4double GetEWF1ROut() { return fEWF1ROut; } - - G4double GetEWF2PosZ() { return fEWBackFacePosZ-fEWFrontMylarThick-fEWKevlarThick-fEWBackMylarThick-0.5*fEWF2Thick; } - G4double GetEWF2Thick() { return fEWF2Thick; } - G4double GetEWF2RIn() { return fEWRadius; } - G4double GetEWF2ROut() { return fEWF2ROut; } - - G4double GetEWF3PosZ() { return fEWBackFacePosZ-fEWFrontMylarThick-fEWKevlarThick-fEWBackMylarThick-fEWF2Thick-0.5*fEWF3Thick; } - G4double GetEWF3Thick() { return fEWF3Thick; } - G4double GetEWF3RIn() { return fEWF3RIn; } - G4double GetEWF3ROut() { return fEWF2ROut; } + G4double GetEWAlFlangeRIn() { return fEWAlFlangeRIn; } + G4double GetEWAlFlangeROut() { return fEWAlFlangeROut; } + G4double GetEWAlFlangeThick() { return fEWAlFlangeThick; } + G4double GetEWAlFrontFacePosZ() { return fEWAlFrontFacePosZ; } // Properties of crossed pipes at target position + G4double GetCPZRIn() { return fCPZRIn; } G4double GetCPZROut() { return fCPZRIn+fCPZThick; } G4double GetCPZThick() { return fCPZThick; } G4double GetCPZLength() { return fCPZLength; } G4double GetCPZPosZ() { return fCPZPosZ; } + G4double GetCPZFlangeRIn() { return GetCPZROut(); } + G4double GetCPZFlangeROut() { return fCPZFlangeR; } + G4double GetCPZFlangeThick() { return fCPZFlangeThick; } G4double GetCPXRIn() { return fCPXRIn; } G4double GetCPXROut() { return fCPXRIn+fCPXThick; } G4double GetCPXThick() { return fCPXThick; } G4double GetCPXLength() { return fCPXLength; } G4double GetCPXPosZ() { return fCPXPosZ; } + G4double GetCPXFlangeRIn() { return GetCPXROut(); } + G4double GetCPXFlangeROut() { return fCPXFlangeR; } + G4double GetCPXFlangeThick() { return fCPXFlangeThick; } -private: - - G4double fVCInMagThick; - - G4double fVCInMagWallSizeY; - G4TwoVector fVCInMagWallVertex[CHAMBERGEOMETRY_VCINMAGWALL_NVERTICES]; - G4double fVCInMagWallHoleRadius; - G4double fVCInMagWallHolePosZ; + // Properties of junction pipe between cross and chamber - G4TwoVector fVCInMagPlateVertex[CHAMBERGEOMETRY_VCINMAGPLATE_NVERTICES]; + G4double GetJunRIn() { return fJunRIn; } + G4double GetJunROut() { return fJunRIn+fJunThick; } + G4double GetJunThick() { return fJunThick; } + G4double GetJunLength() { return fJunLength; } + G4double GetJunPosZ() { return fJunPosZ; } + G4double GetJunFlangeRIn() { return GetJunROut(); } + G4double GetJunFlangeROut() { return fJunFlangeR; } + G4double GetJunFlangeThick() { return fJunFlangeThick; } - G4TwoVector fVCOutMagWallVertex[CHAMBERGEOMETRY_VCOUTMAGWALL_NVERTICES]; + // Properties of porthole caps - G4double fVCMostExternalX; // Absolute value of largest X coordinate of the chamber + G4int GetPHCapNumber() { return CHAMBERGEOMETRY_N_PORTHOLES; } + G4double GetPHCapRadius(G4int c) { return fPHCapRadius[c]; } + G4double GetPHCapThick(G4int c) { return fPHCapThick[c]; } + G4double GetPHCapFlangeThick(G4int c) { return fPHCapFlangeThick[c]; } + G4ThreeVector GetPHCapPos(G4int c) { return fPHCapPos[c]; } - G4double fVCCFThick; // Thickness of the VC flange toward thin window flange + // Properties of large TPix porthole - G4double fVCCThick; // Thickness of the big cylinder - G4double fVCCRIn; // Inner radius of the big cylinder - //G4double fVCCLength; // Length of the big cylinder - G4double fVCCFrontFacePosZ; // Z position of front face of big cylinder + G4double GetTPPHCapThick() { return fTPPHCapThick; } + G4double GetTPPHCapWidth() { return fTPPHCapWidth; } + G4double GetTPPHCapHeight() { return fTPPHCapHeight; } - G4double fVCBackFacePosZ; // Z position of the VC flange face towards the thin window + G4double GetTPPHHoleRadius() { return fTPPHHoleRadius; } + G4double GetTPPHHoleDist() { return fTPPHHoleDist; } - // Beam entrance hole characteristics - G4double fVCInHoleRadius; - G4double fVCInHoleThick; - G4double fVCInHolePosZ; + G4double GetTPPHCircRadius() { return fTPPHCircRadius; } + G4double GetTPPHCircThick() { return fTPPHCircThick; } - // Beam exit Hole characteristics - G4double fVCOutHoleRadius; - G4double fVCOutHoleLength; - G4double fVCOutHoleThick; - G4double fVCOutHoleDistToEdge; + G4double GetTPPHWindRadius() { return fTPPHWindRadius; } + G4double GetTPPHWindWidth() { return fTPPHWindWidth; } + G4double GetTPPHWindThick() { return fTPPHWindThick; } - //G4double fVCEWGap; // Gap for o-ring between main VC body and thin window flange + G4double GetTPPHStopRadius() { return fTPPHStopRadius; } + G4double GetTPPHStopWidth() { return fTPPHStopWidth; } + G4double GetTPPHStopThick() { return fTPPHStopThick; } - // Thin window in front of ECal (EW) +private: - G4double fEWBackFacePosZ; // Z position of the external thin window face + G4double fVCBackFacePosZ; // Z position of the VC flange face towards the thin window + G4double fVCBackFaceAngle; // Angle of TPix/HEPVeto face of chamber + G4double fVCBackFaceThick; // Thickness of back faces + G4double fVCBackFaceCornerX; // X coordinate of the corner at the back face + G4double fVCBackFaceCornerZ; // Z coordinate of the corner at the back face - G4double fEWRadius; // Radius of window - G4double fEWConvexity; // Convexity of window at its center + G4double fVCInnerSizeX; // Internal size along X of the rectangular section inside the magnet + G4double fVCInnerSizeY; // Internal size along Y of the rectangular section inside the magnet + G4double fVCInnerFacePosZ; // Position along Z of the internal face of the rectangular section inside the magnet - G4double fEWFrontMylarThick; // Thickness of mylar layer inside VC - G4double fEWKevlarThick; // Thickness of kevlar layer between mylar layers - G4double fEWBackMylarThick; // Thickness of mylar layer outside VC + // Aluminum|Carbon thin window and aluminum flange - // Steel flange around thin window (three steel rings) + G4double fEWAlThick; + G4double fEWAlConvexity; - G4double fEWF1Thick; - G4double fEWF2Thick; - G4double fEWF3Thick; + G4double fEWCarbonThick; + G4double fEWCarbonConvexity; - G4double fEWF1ROut; - G4double fEWF2ROut; - G4double fEWF3RIn; + G4double fEWAlFlangeRIn; + G4double fEWAlFlangeROut; + G4double fEWAlFlangeThick; + G4double fEWAlFrontFacePosZ; // Crossed pipes (one parallel to Z, one parallel to X) at target position @@ -217,18 +150,53 @@ private: G4double fCPZThick; G4double fCPZLength; G4double fCPZPosZ; + G4double fCPZFlangeR; + G4double fCPZFlangeThick; G4double fCPXRIn; G4double fCPXThick; G4double fCPXLength; G4double fCPXPosZ; + G4double fCPXFlangeR; + G4double fCPXFlangeThick; + + // Junction pipe + + G4double fJunRIn; + G4double fJunThick; + G4double fJunFrontFacePosZ; + G4double fJunBackFacePosZ; + G4double fJunLength; + G4double fJunPosZ; + G4double fJunFlangeR; + G4double fJunFlangeThick; + + // Porthole caps + + G4double fPHCapRadius[CHAMBERGEOMETRY_N_PORTHOLES]; + G4double fPHCapThick[CHAMBERGEOMETRY_N_PORTHOLES]; + G4double fPHCapFlangeThick[CHAMBERGEOMETRY_N_PORTHOLES]; + G4ThreeVector fPHCapPos[CHAMBERGEOMETRY_N_PORTHOLES]; + + // TPix porthole cap + + G4double fTPPHCapThick; // Thickness of rectangular porthole cap + G4double fTPPHCapWidth; // Width of rectangular porthole cap + G4double fTPPHCapHeight; // Height of rectangular porthole cap + + G4double fTPPHHoleRadius; // Radius of TPix hole in cap + G4double fTPPHHoleDist; // Distance of center of hole from border of cap + + G4double fTPPHCircRadius; // Radius of circular cap in front of hole + G4double fTPPHCircThick; // Thickness of circular cap in front of hole - // Vectors to hold coordinates of the vertices of all sections of the chamber - G4ThreeVector fVCExtVtx[CHAMBERGEOMETRY_VC_NSECTIONS][4]; - G4ThreeVector fVCIntVtx[CHAMBERGEOMETRY_VC_NSECTIONS][4]; + G4double fTPPHWindRadius; // Radius of Mylar window + G4double fTPPHWindWidth; // Width of Mylar window + G4double fTPPHWindThick; // Thickness of Mylar window - // Vectors to hold vertices of all facets of the chamber - G4int fVCFacetVtx[CHAMBERGEOMETRY_VC_NFACETS][4]; + G4double fTPPHStopRadius; // Radius of stop flange for Mylar window + G4double fTPPHStopWidth; // Width of stop flange for Mylar window + G4double fTPPHStopThick; // Thickness of stop flange for Mylar window }; diff --git a/PadmeMC/Chamber/include/ChamberStructure.hh b/PadmeMC/Chamber/include/ChamberStructure.hh index 5a8c90e8..5d5785be 100644 --- a/PadmeMC/Chamber/include/ChamberStructure.hh +++ b/PadmeMC/Chamber/include/ChamberStructure.hh @@ -49,8 +49,12 @@ private: G4UnionSolid* CreateVCFacetExternalSolid(); G4UnionSolid* CreateVCFacetInternalSolid(); - void CreateECalThinWindow(); + void CreateECalAlThinWindow(); + void CreateECalCarbonThinWindow(); void CreateTargetPipes(); + void CreateJunctionPipe(); + void CreatePortholeCaps(); + void CreateTPixPortholeCap(); G4LogicalVolume* fMotherVolume; G4LogicalVolume* fGlobalLogicalVolume; diff --git a/PadmeMC/Chamber/src/ChamberGeometry.cc b/PadmeMC/Chamber/src/ChamberGeometry.cc index 0052c75a..6cdca1a5 100644 --- a/PadmeMC/Chamber/src/ChamberGeometry.cc +++ b/PadmeMC/Chamber/src/ChamberGeometry.cc @@ -20,514 +20,126 @@ ChamberGeometry* ChamberGeometry::GetInstance() ChamberGeometry::ChamberGeometry() { - fVCInMagThick = 1.*cm; - - fVCInMagWallSizeY = 23.*cm-2.*fVCInMagThick; - //fVCInMagWallVertex[ 0] = G4TwoVector(-54.4*cm, 52.4*cm); - fVCInMagWallVertex[ 0] = G4TwoVector(-54.4*cm, 51.6*cm); - fVCInMagWallVertex[ 1] = G4TwoVector(-54.4*cm, 37.3*cm); - fVCInMagWallVertex[ 2] = G4TwoVector(-24.2*cm, 5.2*cm); - fVCInMagWallVertex[ 3] = G4TwoVector(-24.2*cm,-56.2*cm); - fVCInMagWallVertex[ 4] = G4TwoVector( 24.2*cm,-56.2*cm); - fVCInMagWallVertex[ 5] = G4TwoVector( 24.2*cm, 52.0*cm); - fVCInMagWallVertex[ 6] = G4TwoVector( 23.4*cm, 52.0*cm); - fVCInMagWallVertex[ 7] = G4TwoVector( 23.4*cm,-55.4*cm); - fVCInMagWallVertex[ 8] = G4TwoVector(-23.4*cm,-55.4*cm); - fVCInMagWallVertex[ 9] = G4TwoVector(-23.4*cm, 5.5*cm); - fVCInMagWallVertex[10] = G4TwoVector(-53.6*cm, 37.6*cm); - fVCInMagWallVertex[11] = G4TwoVector(-53.6*cm, 52.4*cm); - fVCInMagWallVertex[12] = G4TwoVector(-56.0*cm, 52.4*cm); - fVCInMagWallVertex[13] = G4TwoVector(-56.0*cm, 51.6*cm); - - fVCInMagWallHoleRadius = 5.*cm; - fVCInMagWallHolePosZ = 0.5*(fVCInMagWallVertex[3].y()+fVCInMagWallVertex[8].y()); - - fVCInMagPlateVertex[0] = G4TwoVector(-54.4*cm, 52.0*cm); - fVCInMagPlateVertex[1] = G4TwoVector(-54.4*cm, 37.3*cm); - fVCInMagPlateVertex[2] = G4TwoVector(-24.2*cm, 5.2*cm); - fVCInMagPlateVertex[3] = G4TwoVector(-24.2*cm,-56.2*cm); - fVCInMagPlateVertex[4] = G4TwoVector( 24.2*cm,-56.2*cm); - fVCInMagPlateVertex[5] = G4TwoVector( 24.2*cm, 52.0*cm); - - fVCOutMagWallVertex[ 0] = G4TwoVector( -56.0*cm, 51.6*cm); - fVCOutMagWallVertex[ 1] = G4TwoVector( -68.2*cm, 51.6*cm); - fVCOutMagWallVertex[ 2] = G4TwoVector(-156.6*cm,143.1*cm); - fVCOutMagWallVertex[ 3] = G4TwoVector(-156.0*cm,143.6*cm); - fVCOutMagWallVertex[ 4] = G4TwoVector( -67.9*cm, 52.4*cm); - fVCOutMagWallVertex[ 5] = G4TwoVector( -56.0*cm, 52.4*cm); - - //fVCEWGap = 5.9*mm; // Gap for o-ring between main VC body and thin window flange - - fVCCFThick = 20.*mm; // Thickness of VC flange toward thin window flange - - fVCCThick = 10.*mm; // Thickness of big cylinder - fVCCRIn = 335.*mm; // Inner radius of big cylinder - //fVCCLength = 140.*cm; // Length of big cylinder - fVCCFrontFacePosZ = 89.1*cm; // Z position of front face of big cylinder - - fVCBackFacePosZ = 224.9*cm; // Z position of back face of VC flange towards thin window - - // Thin window in front of ECal (EW) - - fEWBackFacePosZ = 227.5*cm; // Z position of window: 2.5cm before front face of ECal - - fEWRadius = 310.*mm; // Radius of window - fEWConvexity = 30.*mm; // Convexity of window at its center - - fEWFrontMylarThick = 0.1*mm; // Thickness of mylar layer inside VC - fEWKevlarThick = 0.6*mm; // Thickness of kevlar layer between mylar layers - fEWBackMylarThick = 0.1*mm; // Thickness of mylar layer outside VC - - // Steel flange around thin window (three steel rings) - - fEWF1Thick = 15.*mm; - fEWF2Thick = 15.*mm; - fEWF3Thick = 9.*mm; - - fEWF1ROut = 360.*mm; - fEWF2ROut = 390.*mm; - fEWF3RIn = 325.5*mm; - - // Vertex coordinates of all sections of the chamber (external shape of the steel shell) - // A section is a rectangular shape with fixed Z - // Vertices must be ordered as v[0]=(+x,-y); v[1]=(-x,-y);v[2]=(-x,+y);v[3]=(+x,+y) - // This corresponds to an anti-clockwise order when looking at the section from -z (i.e. as seen from the incoming beam) - // N.B. section 1 was used in an old model of the chamber and is not needed anymore - - fVCExtVtx[0][0] = G4ThreeVector( 234.00*mm,-112.5*mm,-555.*mm); - fVCExtVtx[0][1] = G4ThreeVector(-234.00*mm,-112.5*mm,-555.*mm); - fVCExtVtx[0][2] = G4ThreeVector(-234.00*mm, 112.5*mm,-555.*mm); - fVCExtVtx[0][3] = G4ThreeVector( 234.00*mm, 112.5*mm,-555.*mm); - - fVCExtVtx[1][0] = G4ThreeVector( 234.00*mm,-112.5*mm, -52.38*mm); - fVCExtVtx[1][1] = G4ThreeVector(-234.00*mm,-112.5*mm, -52.38*mm); - fVCExtVtx[1][2] = G4ThreeVector(-234.00*mm, 112.5*mm, -52.38*mm); - fVCExtVtx[1][3] = G4ThreeVector( 234.00*mm, 112.5*mm, -52.38*mm); - - fVCExtVtx[2][0] = G4ThreeVector( 234.00*mm,-112.5*mm, 52.38*mm); - fVCExtVtx[2][1] = G4ThreeVector(-234.00*mm,-112.5*mm, 52.38*mm); - fVCExtVtx[2][2] = G4ThreeVector(-234.00*mm, 112.5*mm, 52.38*mm); - fVCExtVtx[2][3] = G4ThreeVector( 234.00*mm, 112.5*mm, 52.38*mm); - - fVCExtVtx[3][0] = G4ThreeVector( 234.00*mm,-112.5*mm, 369.26*mm); - fVCExtVtx[3][1] = G4ThreeVector(-540.00*mm,-112.5*mm, 369.26*mm); - fVCExtVtx[3][2] = G4ThreeVector(-540.00*mm, 112.5*mm, 369.26*mm); - fVCExtVtx[3][3] = G4ThreeVector( 234.00*mm, 112.5*mm, 369.26*mm); - - fVCExtVtx[4][0] = G4ThreeVector( 234.00*mm,-112.5*mm, 509.*mm); - fVCExtVtx[4][1] = G4ThreeVector(-540.00*mm,-112.5*mm, 509.*mm); - fVCExtVtx[4][2] = G4ThreeVector(-540.00*mm, 112.5*mm, 509.*mm); - fVCExtVtx[4][3] = G4ThreeVector( 234.00*mm, 112.5*mm, 509.*mm); - - fVCExtVtx[5][0] = G4ThreeVector( 234.00*mm,-112.5*mm, 509.*mm); - fVCExtVtx[5][1] = G4ThreeVector(-663.83*mm,-112.5*mm, 509.*mm); - fVCExtVtx[5][2] = G4ThreeVector(-663.83*mm, 112.5*mm, 509.*mm); - fVCExtVtx[5][3] = G4ThreeVector( 234.00*mm, 112.5*mm, 509.*mm); - - fVCExtVtx[6][0] = G4ThreeVector( 234.00*mm,-137.5*mm, 552.*mm); - fVCExtVtx[6][1] = G4ThreeVector(-706.09*mm,-137.5*mm, 552.*mm); - fVCExtVtx[6][2] = G4ThreeVector(-706.09*mm, 137.5*mm, 552.*mm); - fVCExtVtx[6][3] = G4ThreeVector( 234.00*mm, 137.5*mm, 552.*mm); - - fVCExtVtx[7][0] = G4ThreeVector( 234.00*mm,-137.5*mm, 799.*mm); - fVCExtVtx[7][1] = G4ThreeVector(-948.83*mm,-137.5*mm, 799.*mm); - fVCExtVtx[7][2] = G4ThreeVector(-948.83*mm, 137.5*mm, 799.*mm); - fVCExtVtx[7][3] = G4ThreeVector( 234.00*mm, 137.5*mm, 799.*mm); - - fVCExtVtx[8][0] = G4ThreeVector( 234.00*mm,-175.*mm, 864.*mm); - fVCExtVtx[8][1] = G4ThreeVector(-1012.71*mm,-175.*mm, 864.*mm); - fVCExtVtx[8][2] = G4ThreeVector(-1012.71*mm, 175.*mm, 864.*mm); - fVCExtVtx[8][3] = G4ThreeVector( 234.00*mm, 175.*mm, 864.*mm); - - fVCExtVtx[9][0] = G4ThreeVector( 234.00*mm,-175.*mm,1160.4*mm); - fVCExtVtx[9][1] = G4ThreeVector(-1304.00*mm,-175.*mm,1160.4*mm); - fVCExtVtx[9][2] = G4ThreeVector(-1304.00*mm, 175.*mm,1160.4*mm); - fVCExtVtx[9][3] = G4ThreeVector( 234.00*mm, 175.*mm,1160.4*mm); - - fVCExtVtx[10][0] = G4ThreeVector( 234.00*mm,-175.*mm,1947.53*mm); - fVCExtVtx[10][1] = G4ThreeVector(-1304.00*mm,-175.*mm,1947.53*mm); - fVCExtVtx[10][2] = G4ThreeVector(-1304.00*mm, 175.*mm,1947.53*mm); - fVCExtVtx[10][3] = G4ThreeVector( 234.00*mm, 175.*mm,1947.53*mm); - - fVCExtVtx[11][0] = G4ThreeVector( 234.00*mm,-175.*mm,2249.*mm); - fVCExtVtx[11][1] = G4ThreeVector(-422.77*mm,-175.*mm,2249.*mm); - fVCExtVtx[11][2] = G4ThreeVector(-422.77*mm, 175.*mm,2249.*mm); - fVCExtVtx[11][3] = G4ThreeVector( 234.00*mm, 175.*mm,2249.*mm); - - // Vertex coordinates of all sections of the chamber (internal shape of the steel shell) - - fVCIntVtx[0][0] = G4ThreeVector( 224.00*mm,-102.5*mm,-545.*mm); // Z ok - fVCIntVtx[0][1] = G4ThreeVector(-224.00*mm,-102.5*mm,-545.*mm); // X ok - fVCIntVtx[0][2] = G4ThreeVector(-224.00*mm, 102.5*mm,-545.*mm); // Y ok - fVCIntVtx[0][3] = G4ThreeVector( 224.00*mm, 102.5*mm,-545.*mm); - - fVCIntVtx[1][0] = G4ThreeVector( 224.00*mm,-102.5*mm, -56.42*mm); // X ok - fVCIntVtx[1][1] = G4ThreeVector(-224.00*mm,-102.5*mm, -56.42*mm); // Y ok - fVCIntVtx[1][2] = G4ThreeVector(-224.00*mm, 102.5*mm, -56.42*mm); // Z ok - fVCIntVtx[1][3] = G4ThreeVector( 224.00*mm, 102.5*mm, -56.42*mm); - - fVCIntVtx[2][0] = G4ThreeVector( 224.00*mm,-102.5*mm, 56.42*mm); // X ok - fVCIntVtx[2][1] = G4ThreeVector(-224.00*mm,-102.5*mm, 56.42*mm); // Y ok - fVCIntVtx[2][2] = G4ThreeVector(-224.00*mm, 102.5*mm, 56.42*mm); // Z ok - fVCIntVtx[2][3] = G4ThreeVector( 224.00*mm, 102.5*mm, 56.42*mm); - - fVCIntVtx[3][0] = G4ThreeVector( 224.00*mm,-102.5*mm, 373.30*mm); // Y ok - fVCIntVtx[3][1] = G4ThreeVector(-530.00*mm,-102.5*mm, 373.30*mm); // X ok - fVCIntVtx[3][2] = G4ThreeVector(-530.00*mm, 102.5*mm, 373.30*mm); // Z ok - fVCIntVtx[3][3] = G4ThreeVector( 224.00*mm, 102.5*mm, 373.30*mm); - - fVCIntVtx[4][0] = G4ThreeVector( 224.00*mm,-102.5*mm, 519.*mm); // Z ok - fVCIntVtx[4][1] = G4ThreeVector(-530.00*mm,-102.5*mm, 519.*mm); // Y ok - fVCIntVtx[4][2] = G4ThreeVector(-530.00*mm, 102.5*mm, 519.*mm); // X ok - fVCIntVtx[4][3] = G4ThreeVector( 224.00*mm, 102.5*mm, 519.*mm); - - fVCIntVtx[5][0] = G4ThreeVector( 224.00*mm,-102.5*mm, 519.*mm); // Z ok - fVCIntVtx[5][1] = G4ThreeVector(-659.79*mm,-102.5*mm, 519.*mm); // Y ok - fVCIntVtx[5][2] = G4ThreeVector(-659.79*mm, 102.5*mm, 519.*mm); // X ok - fVCIntVtx[5][3] = G4ThreeVector( 224.00*mm, 102.5*mm, 519.*mm); - - fVCIntVtx[6][0] = G4ThreeVector( 224.00*mm,-127.5*mm, 552.*mm); // Z ok ? - fVCIntVtx[6][1] = G4ThreeVector(-692.22*mm,-127.5*mm, 552.*mm); // Y ok - fVCIntVtx[6][2] = G4ThreeVector(-692.22*mm, 127.5*mm, 552.*mm); // X ok ? - fVCIntVtx[6][3] = G4ThreeVector( 224.00*mm, 127.5*mm, 552.*mm); - - fVCIntVtx[7][0] = G4ThreeVector( 224.00*mm,-127.5*mm, 799.*mm); - fVCIntVtx[7][1] = G4ThreeVector(-934.92*mm,-127.5*mm, 799.*mm); // Z ok ? - fVCIntVtx[7][2] = G4ThreeVector(-934.92*mm, 127.5*mm, 799.*mm); // Y ok - fVCIntVtx[7][3] = G4ThreeVector( 224.00*mm, 127.5*mm, 799.*mm); // X ok ? - - fVCIntVtx[8][0] = G4ThreeVector( 224.00*mm,-165.*mm, 864.*mm); // Z ok ? - fVCIntVtx[8][1] = G4ThreeVector(-998.79*mm,-165.*mm, 864.*mm); // Y ok - fVCIntVtx[8][2] = G4ThreeVector(-998.79*mm, 165.*mm, 864.*mm); // X ok ? - fVCIntVtx[8][3] = G4ThreeVector( 224.00*mm, 165.*mm, 864.*mm); - - fVCIntVtx[9][0] = G4ThreeVector( 224.00*mm,-165.*mm,1164.44*mm); // Y ok - fVCIntVtx[9][1] = G4ThreeVector(-1294.00*mm,-165.*mm,1164.44*mm); // X ok - fVCIntVtx[9][2] = G4ThreeVector(-1294.00*mm, 165.*mm,1164.44*mm); // Z ok - fVCIntVtx[9][3] = G4ThreeVector( 224.00*mm, 165.*mm,1164.44*mm); - - fVCIntVtx[10][0] = G4ThreeVector( 224.00*mm,-165.*mm,1940.382*mm); // X ok - fVCIntVtx[10][1] = G4ThreeVector(-1294.00*mm,-165.*mm,1940.382*mm); // Y ok - fVCIntVtx[10][2] = G4ThreeVector(-1294.00*mm, 165.*mm,1940.382*mm); // Z ok - fVCIntVtx[10][3] = G4ThreeVector( 224.00*mm, 165.*mm,1940.382*mm); - - fVCIntVtx[11][0] = G4ThreeVector( 224.000*mm,-165.*mm,2239.*mm); // Z ok - fVCIntVtx[11][1] = G4ThreeVector(-421.107*mm,-165.*mm,2239.*mm); // Y ok - fVCIntVtx[11][2] = G4ThreeVector(-421.107*mm, 165.*mm,2239.*mm); // X ok - fVCIntVtx[11][3] = G4ThreeVector( 224.000*mm, 165.*mm,2239.*mm); - - // Define facets used to create the chamber as a tesselated solid - // Each facet is defined by 3 or 4 (see below) vertices encoded as an integer number in the form ssv - // where ss is the section (0-11) and v is the section's vertex (0-3) taken from - // one of the two lists above - // Vertices must follow an anti-clockwise order when the facet is seen from outside the solid - // If v[3] >= 0 then the facet is quadrangular - // If v[3] = -1 then the facet is triangular and v[3] is not used - // Note that each side of a facet must be shared with exactly one single side - // of another facet: if this is not the case then the facet must be split. - // - // +-----------+ +-----------+ - // | | |\ | - // | | | \ | - // | | ----> | \ | - // +---+-------+ +---+-------+ - // | | | | | | - // +---+-------+ +---+-------+ - // WRONG CORRECT - - // S 0 -Z - fVCFacetVtx[0][0] = 0; - fVCFacetVtx[0][1] = 1; - fVCFacetVtx[0][2] = 2; - fVCFacetVtx[0][3] = 3; - - // S 0-2 +X - fVCFacetVtx[1][0] = 0; - fVCFacetVtx[1][1] = 3; - fVCFacetVtx[1][2] = 23; - fVCFacetVtx[1][3] = 20; - - // S 0-2 +Y - fVCFacetVtx[2][0] = 3; - fVCFacetVtx[2][1] = 2; - fVCFacetVtx[2][2] = 22; - fVCFacetVtx[2][3] = 23; - - // S 0-2 -X - fVCFacetVtx[3][0] = 2; - fVCFacetVtx[3][1] = 1; - fVCFacetVtx[3][2] = 21; - fVCFacetVtx[3][3] = 22; - - // S 0-2 -Y - fVCFacetVtx[4][0] = 1; - fVCFacetVtx[4][1] = 0; - fVCFacetVtx[4][2] = 20; - fVCFacetVtx[4][3] = 21; - - // S 2-3 +X - fVCFacetVtx[5][0] = 20; - fVCFacetVtx[5][1] = 23; - fVCFacetVtx[5][2] = 33; - fVCFacetVtx[5][3] = 30; - - // S 2-3 +Y - fVCFacetVtx[6][0] = 23; - fVCFacetVtx[6][1] = 22; - fVCFacetVtx[6][2] = 32; - fVCFacetVtx[6][3] = 33; - - // S 2-3 -X - fVCFacetVtx[7][0] = 22; - fVCFacetVtx[7][1] = 21; - fVCFacetVtx[7][2] = 31; - fVCFacetVtx[7][3] = 32; - - // S 2-3 -Y - fVCFacetVtx[8][0] = 21; - fVCFacetVtx[8][1] = 20; - fVCFacetVtx[8][2] = 30; - fVCFacetVtx[8][3] = 31; - - // S 3-4 +X - fVCFacetVtx[9][0] = 30; - fVCFacetVtx[9][1] = 33; - fVCFacetVtx[9][2] = 43; - fVCFacetVtx[9][3] = 40; - - // S 3-4 +Y - fVCFacetVtx[10][0] = 33; - fVCFacetVtx[10][1] = 32; - fVCFacetVtx[10][2] = 42; - fVCFacetVtx[10][3] = 43; - - // S 3-4 -X - fVCFacetVtx[11][0] = 32; - fVCFacetVtx[11][1] = 31; - fVCFacetVtx[11][2] = 41; - fVCFacetVtx[11][3] = 42; - - // S 3-4 -Y - fVCFacetVtx[12][0] = 31; - fVCFacetVtx[12][1] = 30; - fVCFacetVtx[12][2] = 40; - fVCFacetVtx[12][3] = 41; - - // S 4-5, -Z - fVCFacetVtx[13][0] = 42; - fVCFacetVtx[13][1] = 41; - fVCFacetVtx[13][2] = 51; - fVCFacetVtx[13][3] = 52; - - // S 4-6 +X - fVCFacetVtx[14][0] = 40; - fVCFacetVtx[14][1] = 43; - fVCFacetVtx[14][2] = 63; - fVCFacetVtx[14][3] = 60; - - // S 4-6 +Y - fVCFacetVtx[15][0] = 43; - fVCFacetVtx[15][1] = 42; - fVCFacetVtx[15][2] = 62; - fVCFacetVtx[15][3] = 63; - - // S 5-6 -X - fVCFacetVtx[16][0] = 52; - fVCFacetVtx[16][1] = 51; - fVCFacetVtx[16][2] = 61; - fVCFacetVtx[16][3] = 62; - - // S 4-6 -Y - fVCFacetVtx[17][0] = 41; - fVCFacetVtx[17][1] = 40; - fVCFacetVtx[17][2] = 60; - fVCFacetVtx[17][3] = 61; - - // S 6-7 +X - fVCFacetVtx[18][0] = 60; - fVCFacetVtx[18][1] = 63; - fVCFacetVtx[18][2] = 73; - fVCFacetVtx[18][3] = 70; - - // S 6-7 +Y - fVCFacetVtx[19][0] = 63; - fVCFacetVtx[19][1] = 62; - fVCFacetVtx[19][2] = 72; - fVCFacetVtx[19][3] = 73; - - // S 6-7 -X - fVCFacetVtx[20][0] = 62; - fVCFacetVtx[20][1] = 61; - fVCFacetVtx[20][2] = 71; - fVCFacetVtx[20][3] = 72; - - // S 6-7 -Y - fVCFacetVtx[21][0] = 61; - fVCFacetVtx[21][1] = 60; - fVCFacetVtx[21][2] = 70; - fVCFacetVtx[21][3] = 71; - - // S 7-8 +X - fVCFacetVtx[22][0] = 70; - fVCFacetVtx[22][1] = 73; - fVCFacetVtx[22][2] = 83; - fVCFacetVtx[22][3] = 80; - - // S 7-8 +Y - fVCFacetVtx[23][0] = 73; - fVCFacetVtx[23][1] = 72; - fVCFacetVtx[23][2] = 82; - fVCFacetVtx[23][3] = 83; - - // S 7-8 -X - fVCFacetVtx[24][0] = 72; - fVCFacetVtx[24][1] = 71; - fVCFacetVtx[24][2] = 81; - fVCFacetVtx[24][3] = 82; - - // S 7-8 -Y - fVCFacetVtx[25][0] = 71; - fVCFacetVtx[25][1] = 70; - fVCFacetVtx[25][2] = 80; - fVCFacetVtx[25][3] = 81; - - // S 8-9 +X - fVCFacetVtx[26][0] = 80; - fVCFacetVtx[26][1] = 83; - fVCFacetVtx[26][2] = 93; - fVCFacetVtx[26][3] = 90; - - // S 8-9 +Y - fVCFacetVtx[27][0] = 83; - fVCFacetVtx[27][1] = 82; - fVCFacetVtx[27][2] = 92; - fVCFacetVtx[27][3] = 93; - - // S 8-9 -X - fVCFacetVtx[28][0] = 82; - fVCFacetVtx[28][1] = 81; - fVCFacetVtx[28][2] = 91; - fVCFacetVtx[28][3] = 92; - - // S 8-9 -Y - fVCFacetVtx[29][0] = 81; - fVCFacetVtx[29][1] = 80; - fVCFacetVtx[29][2] = 90; - fVCFacetVtx[29][3] = 91; - - // S 9-10 +X - fVCFacetVtx[30][0] = 90; - fVCFacetVtx[30][1] = 93; - fVCFacetVtx[30][2] = 103; - fVCFacetVtx[30][3] = 100; - - // S 9-10 +Y - fVCFacetVtx[31][0] = 93; - fVCFacetVtx[31][1] = 92; - fVCFacetVtx[31][2] = 102; - fVCFacetVtx[31][3] = 103; - - // S 9-10 -X - fVCFacetVtx[32][0] = 92; - fVCFacetVtx[32][1] = 91; - fVCFacetVtx[32][2] = 101; - fVCFacetVtx[32][3] = 102; - - // S 9-10 -Y - fVCFacetVtx[33][0] = 91; - fVCFacetVtx[33][1] = 90; - fVCFacetVtx[33][2] = 100; - fVCFacetVtx[33][3] = 101; - - // S 10-11 +X - fVCFacetVtx[34][0] = 100; - fVCFacetVtx[34][1] = 103; - fVCFacetVtx[34][2] = 113; - fVCFacetVtx[34][3] = 110; - - // S 10-11 +Y - fVCFacetVtx[35][0] = 103; - fVCFacetVtx[35][1] = 102; - fVCFacetVtx[35][2] = 112; - fVCFacetVtx[35][3] = 113; - - // S 10-11 -X - fVCFacetVtx[36][0] = 102; - fVCFacetVtx[36][1] = 101; - fVCFacetVtx[36][2] = 111; - fVCFacetVtx[36][3] = 112; - - // S 10-11 -Y - fVCFacetVtx[37][0] = 101; - fVCFacetVtx[37][1] = 100; - fVCFacetVtx[37][2] = 110; - fVCFacetVtx[37][3] = 111; - - // S 11 +Z - fVCFacetVtx[38][0] = 113; - fVCFacetVtx[38][1] = 112; - fVCFacetVtx[38][2] = 111; - fVCFacetVtx[38][3] = 110; - - // S 4-(5)-6 +Y - fVCFacetVtx[39][0] = 42; - fVCFacetVtx[39][1] = 52; - fVCFacetVtx[39][2] = 62; - fVCFacetVtx[39][3] = -1; - - // S 4-(5)-6 -Y - fVCFacetVtx[40][0] = 51; - fVCFacetVtx[40][1] = 41; - fVCFacetVtx[40][2] = 61; - fVCFacetVtx[40][3] = -1; - - //printf("In geo %f %f %f\n",fVCExtVtx[1][0].x(),fVCExtVtx[1][0].y(),fVCExtVtx[1][0].z()); - - // Quantities derived from the vertices positions - fVCMostExternalX = -fVCExtVtx[9][1].x(); // Absolute value of largest X coordinate of the chamber - - // Properties of the beam entrance hole - fVCInHoleRadius = 5.*cm; - fVCInHoleThick = fVCIntVtx[0][0].z()-fVCExtVtx[0][0].z(); - fVCInHolePosZ = 0.5*(fVCExtVtx[0][0].z()+fVCIntVtx[0][0].z()); - - // Properties of the beam exit hole - fVCOutHoleRadius = 25.*mm; // Radius of the two circles - fVCOutHoleLength = 100.*mm; // Distance between circle centers - fVCOutHoleThick = 10.*mm; // Should be computed from distance between chamber faces - // Distance of center of hole from edge on the VC back face - fVCOutHoleDistToEdge = 35.*cm; // To verify with Cesidio + // Some basic chamber quantities from Cesidio's CAD drawings + + fVCBackFacePosZ = 2300.0*mm; // Z position of back face of VC flange towards thin window + //fVCBackFaceAngle = atan2( (2269.8-1981.85) , (1290.0-403.78) ); // Angle of TPix/HEPVeto face of chamber + fVCBackFaceAngle = 18.*deg; // Angle of TPix/HEPVeto face of chamber + //printf("Chamber angle %f\n",fVCBackFaceAngle); + fVCBackFaceThick = fVCBackFacePosZ-2269.8*mm; // Thickness of back faces + fVCBackFaceCornerX = 403.78*mm; + fVCBackFaceCornerZ = fVCBackFacePosZ; + + fVCInnerSizeX = 435.0*mm; // Internal size along X of the rectangular section inside the magnet + fVCInnerSizeY = 205.0*mm; // Internal size along Y of the rectangular section inside the magnet + fVCInnerFacePosZ = -490.0*mm; // Position along Z of the internal face of the rectangular section inside the magnet + + // Parameters for the aluminum|carbon thin window + + fEWAlThick = 4.*mm; // Thickness of aluminum window + fEWAlConvexity = 29.*mm; // Convexity of aluminum window at its center + + fEWCarbonThick = 2.*mm; // Thickness of carbon window + fEWCarbonConvexity = 29.*mm; // Convexity of carbon window at its center + + fEWAlFlangeRIn = 326.*mm; // Inner radius of flange (also radius of window) + fEWAlFlangeROut = 375.*mm; // Outer radius of flange + fEWAlFlangeThick = 23.*mm; // Thickness of flange + fEWAlFrontFacePosZ = fVCBackFacePosZ; // Front face of flange holding aluminum thin window // Properties of crossed pipes at target position + fCPZRIn = 5.*cm; fCPZThick = 1.*cm; fCPZLength = 29.*cm; - fCPZPosZ = fVCExtVtx[0][0].z()-0.5*fCPZLength; + fCPZPosZ = -1.*m; + fCPZFlangeR = 76.*mm; + fCPZFlangeThick = 20.*mm; + fCPXRIn = 5.*cm; fCPXThick = 1.*cm; fCPXLength = 25.*cm; - fCPXPosZ = fVCExtVtx[0][0].z()-0.5*fCPZLength; + fCPXPosZ = -1.*m; + fCPXFlangeR = 76.*mm; + fCPXFlangeThick = 20.*mm; + + // Properties of junction pipe between cross and chamber + + fJunRIn = 5.*cm; + fJunThick = 1.*cm; + fJunFrontFacePosZ = fCPZPosZ+0.5*fCPZLength; + fJunBackFacePosZ = -56.2*cm; // From vacuum chamber technical drawing + fJunLength = fJunBackFacePosZ-fJunFrontFacePosZ; + fJunPosZ = 0.5*(fJunBackFacePosZ+fJunFrontFacePosZ); + fJunFlangeR = 76.*mm; + fJunFlangeThick = 20.*mm; + + // Properties of porthole caps + + fPHCapRadius[0] = 112.5*mm; + fPHCapThick[0] = 16.0*mm; + fPHCapFlangeThick[0] = 29.0*mm; + fPHCapPos[0] = G4ThreeVector(-0.5*fVCInnerSizeX-fPHCapFlangeThick[0]-0.5*fPHCapThick[0],0.,-350.*mm); + + fPHCapRadius[1] = 112.5*mm; + fPHCapThick[1] = 16.0*mm; + fPHCapFlangeThick[1] = 29.0*mm; + fPHCapPos[1] = G4ThreeVector(-0.5*fVCInnerSizeX-fPHCapFlangeThick[1]-0.5*fPHCapThick[1],0.,350.*mm); + + fPHCapRadius[2] = 112.5*mm; + fPHCapThick[2] = 16.0*mm; + fPHCapFlangeThick[2] = 29.0*mm; + fPHCapPos[2] = G4ThreeVector(0.5*fVCInnerSizeX+fPHCapFlangeThick[2]+0.5*fPHCapThick[2],0.,-350.*mm); + + fPHCapRadius[3] = 112.5*mm; + fPHCapThick[3] = 16.0*mm; + fPHCapFlangeThick[3] = 29.0*mm; + fPHCapPos[3] = G4ThreeVector(0.5*fVCInnerSizeX+fPHCapFlangeThick[3]+0.5*fPHCapThick[3],0.,30.*mm); + + fPHCapRadius[4] = 112.5*mm; + fPHCapThick[4] = 16.0*mm; + fPHCapFlangeThick[4] = 25.1*mm; + fPHCapPos[4] = G4ThreeVector(-375.07*mm-fPHCapFlangeThick[4]-0.5*fPHCapThick[4],0.,790.*mm); + + fPHCapRadius[5] = 112.5*mm; + fPHCapThick[5] = 16.0*mm; + fPHCapFlangeThick[5] = 25.1*mm; + fPHCapPos[5] = G4ThreeVector(1020.0*mm+fPHCapFlangeThick[5]+0.5*fPHCapThick[5],0.,790.*mm); + + fPHCapRadius[6] = 142.5*mm; + fPHCapThick[6] = 16.0*mm; + fPHCapFlangeThick[6] = 75.17*mm; + fPHCapPos[6] = G4ThreeVector(-324.83*mm-fPHCapFlangeThick[6]-0.5*fPHCapThick[6],0.,1400.*mm); + + fPHCapRadius[7] = 167.5*mm; + fPHCapThick[7] = 16.0*mm; + fPHCapFlangeThick[7] = 35.0*mm; + fPHCapPos[7] = G4ThreeVector(1290.0*mm+fPHCapFlangeThick[7]+0.5*fPHCapThick[7],0.,1750.*mm); + + // Properties of large TPix porthole + + fTPPHCapThick = 25.*mm; + fTPPHCapWidth = 996.*mm; + fTPPHCapHeight = 600.*mm; + + fTPPHHoleRadius = 106.5*mm; + // From Cesidio's drawings for 1GeV/.8Tesla configuration + //fTPPHHoleDist = (624.38*mm-fVCBackFaceCornerX)/cos(fVCBackFaceAngle); + fTPPHHoleDist = 400.*mm; // Will be changed to final position + + fTPPHCircRadius = 142.5*mm; + fTPPHCircThick = 12.0*mm; + + fTPPHWindRadius = 25.0*mm; + fTPPHWindWidth = 100.0*mm; + fTPPHWindThick = 100.0*um; + + fTPPHStopRadius = 55.0*mm; + fTPPHStopWidth = fTPPHWindWidth; + fTPPHStopThick = 12.0*mm; } ChamberGeometry::~ChamberGeometry() {} - -G4double ChamberGeometry::GetVCBackFaceAngle() -{ - G4double angle = atan2(fVCExtVtx[11][1].z()-fVCExtVtx[10][1].z(), - fVCExtVtx[11][1].x()-fVCExtVtx[10][1].x()); - return angle; -} - -G4ThreeVector ChamberGeometry::GetVCBackFaceCorner() -{ - return G4ThreeVector(fVCExtVtx[11][1].x(),0.,fVCExtVtx[11][1].z()); -} - -G4double ChamberGeometry::GetVCBackFaceThickness() -{ - G4double thick = fVCExtVtx[11][0].z()-fVCIntVtx[11][0].z(); - return thick; -} diff --git a/PadmeMC/Chamber/src/ChamberStructure.cc b/PadmeMC/Chamber/src/ChamberStructure.cc index 0c1466a4..a4487bfe 100644 --- a/PadmeMC/Chamber/src/ChamberStructure.cc +++ b/PadmeMC/Chamber/src/ChamberStructure.cc @@ -47,144 +47,123 @@ ChamberStructure::~ChamberStructure() void ChamberStructure::CreateGeometry() { - ChamberGeometry* geo = ChamberGeometry::GetInstance(); - - ///////////////////////// - // Main vacuum chamber // - ///////////////////////// - - printf("Creating global VC volume\n"); - G4UnionSolid* solidGlobVC = CreateVCFacetGlobalSolid(); - fGlobalLogicalVolume = new G4LogicalVolume(solidGlobVC,G4Material::GetMaterial("Vacuum"),"ChamberGlobal",0,0,0); - if ( fChamberIsVisible && ! fChamberExists ) { // Used for vacuum chamber visual debug - fGlobalLogicalVolume->SetVisAttributes(G4VisAttributes(G4Colour::White())); - } else { - fGlobalLogicalVolume->SetVisAttributes(G4VisAttributes::Invisible); - } - new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),fGlobalLogicalVolume,"VacuumChamber",fMotherVolume,false,0); - - if ( ! fChamberExists ) return; - - printf("Creating external VC volume\n"); - G4UnionSolid* solidExtVC = CreateVCFacetExternalSolid(); - //externalLogicalVolume = new G4LogicalVolume(solidExtVC,G4Material::GetMaterial("G4_STAINLESS-STEEL"), - // "VCExternal",0,0,0); - //externalLogicalVolume->SetVisAttributes(G4VisAttributes(G4Colour::Grey())); - //new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),externalLogicalVolume,"ChamberExternal",fGlobalLogicalVolume,false,0); - - printf("Creating internal VC volume\n"); - G4UnionSolid* solidIntVC = CreateVCFacetInternalSolid(); - //G4LogicalVolume* internalLogicalVolume = new G4LogicalVolume(solidIntVC,G4Material::GetMaterial("Vacuum"), "VCInternal",0,0,0); - //internalLogicalVolume->SetVisAttributes(G4VisAttributes::Invisible); - //internalLogicalVolume->SetVisAttributes(G4VisAttributes(G4Colour::White())); - //new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),internalLogicalVolume,"ChamberInternal",fMotherVolume,false,0); - - G4SubtractionSolid* solidSteelShell = new G4SubtractionSolid("ChamberSteelShell",solidExtVC,solidIntVC,0,G4ThreeVector(0.,0.,0.)); - G4LogicalVolume* logicalSteelShell = new G4LogicalVolume(solidSteelShell,G4Material::GetMaterial("G4_STAINLESS-STEEL"),"ChamberShell",0,0,0); - if ( fChamberIsVisible ) { - //logicalSteelShell->SetVisAttributes(G4VisAttributes(G4Colour::Blue())); - logicalSteelShell->SetVisAttributes(G4VisAttributes(G4Colour::Grey())); - } else { - logicalSteelShell->SetVisAttributes(G4VisAttributes::Invisible); - } - new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),logicalSteelShell,"ChamberShell",fGlobalLogicalVolume,false,0); + // The main parts of the Vacuum Chamber are imported in DetectorConstruction.cc from GDML files + // Here we only define flanges, portholes and other components of the chamber // Create the thin window membrane in front of ECal with its flange - CreateECalThinWindow(); + //CreateECalAlThinWindow(); + CreateECalCarbonThinWindow(); // Create crossed pipes in the target area CreateTargetPipes(); + // Create junction pipe between cross and vacuum chamber + CreateJunctionPipe(); + + // Create porthole caps for both section of the chamber + CreatePortholeCaps(); + + // Create cap for large porthole iin front of TimePix + // Includes round cap with thin Mylar window + CreateTPixPortholeCap(); + } -void ChamberStructure::CreateECalThinWindow() +void ChamberStructure::CreateECalAlThinWindow() { ///////////////////////////////////////// - // Thin window flange in front of ECal // + // Thin Al window flange in front of ECal // ///////////////////////////////////////// ChamberGeometry* geo = ChamberGeometry::GetInstance(); - G4double ewR = geo->GetEWRadius(); // Radius of the membrane - G4double ewC = geo->GetEWConvexity(); // Convexity at membrane center + // Get properties of thin window + G4double ewR = geo->GetEWAlRadius(); // Radius of window + G4double ewT = geo->GetEWAlThick(); // Thickness of window + G4double ewC = geo->GetEWAlConvexity(); // Convexity at window center - G4double ewd1 = geo->GetEWBackMylarThick(); // Thickness of mylar (layer 1) on external face of chamber - G4double ewd2 = geo->GetEWKevlarThick(); // Thickness of kevlar (layer 2) between mylar layers - G4double ewd3 = geo->GetEWFrontMylarThick(); // Thickness of mylar (layer 3) on internal face of chamber + // Get properties of flange + G4double ewFRIn = geo->GetEWAlFlangeRIn(); + G4double ewFROut = geo->GetEWAlFlangeROut(); + G4double ewFThick = geo->GetEWAlFlangeThick(); - //printf("Vacuum chamber window\n"); - //printf("ewR %f ewC %f ewd1 %f ewd2 %f ewd3 %f\n",ewR,ewC,ewd1,ewd2,ewd3); + // Get Z coordinate of front and back face of flange + G4double efFFrontZ = geo->GetEWAlFrontFacePosZ(); + //G4double efFBackZ = geo->GetEWAlBackFacePosZ(); - //G4VisAttributes steelVisAttr = G4VisAttributes(G4Colour::Blue()); - G4VisAttributes steelVisAttr = G4VisAttributes(G4Colour::Grey()); - G4VisAttributes membraneVisAttr = G4VisAttributes(G4Colour::Green()); - if ( ! fChamberIsVisible ) { - steelVisAttr = G4VisAttributes::Invisible; - membraneVisAttr = G4VisAttributes::Invisible; - } - // External mylar membrane + G4VisAttributes alVisAttr = G4VisAttributes(G4Colour::Blue()); + if ( ! fChamberIsVisible ) alVisAttr = G4VisAttributes::Invisible; + + // Compute thin window sphere's radius and z position of center G4double ewr1 = (ewR*ewR+ewC*ewC)/(2.*ewC); - G4double ewz1 = geo->GetEWBackFacePosZ()+(ewr1-ewC); + //G4double ewz1 = efFBackZ+(ewr1-ewC); G4double ewth1 = asin(ewR/ewr1); - //printf("ewr1 %f ewz1 %f ewth1 %11.9f pi-ewth1 %11.9f\n",ewr1,ewz1,ewth1,180.*deg-ewth1); - G4Sphere* solidEWSphere1 = new G4Sphere("EWSphere1",ewr1,ewr1+ewd1,0.*deg,360.*deg,180.*deg-ewth1,ewth1); - G4Tubs* solidEWRing1 = new G4Tubs("EWRing1",ewR-10.*um,ewR+10.*mm,0.7*ewd1,0.*deg,360.*deg); - G4ThreeVector ring1Pos = G4ThreeVector(0.,0.,-sqrt(ewr1*ewr1-ewR*ewR)-0.5*ewd1); - G4SubtractionSolid* solidEWLayer1 = new G4SubtractionSolid("EWMylarExt",solidEWSphere1,solidEWRing1,0,ring1Pos); - G4LogicalVolume* logicalEWLayer1 = new G4LogicalVolume(solidEWLayer1,G4Material::GetMaterial("G4_MYLAR"), "EWMylarExt",0,0,0); - //logicalEWLayer1->SetVisAttributes(G4VisAttributes(G4Colour::Green())); - logicalEWLayer1->SetVisAttributes(membraneVisAttr); - new G4PVPlacement(0,G4ThreeVector(0.,0.,ewz1),logicalEWLayer1,"EWMylarExt",fGlobalLogicalVolume,false,0); - - // Central kevlar membrane - G4double ewr2 = ewr1+ewd1; - G4double ewz2 = ewz1; - G4double ewth2 = asin(ewR/ewr2); - //printf("ewr2 %f ewz2 %f ewth2 %11.9f\n",ewr2,ewz2,ewth2); - G4Sphere* solidEWSphere2 = new G4Sphere("EWSphere2",ewr2,ewr2+ewd2,0.*deg,360.*deg,180.*deg-ewth2,ewth2); - G4Tubs* solidEWRing2 = new G4Tubs("EWRing2",ewR-10.*um,ewR+10.*mm,0.7*ewd2,0.*deg,360.*deg); - G4ThreeVector ring2Pos = G4ThreeVector(0.,0.,-sqrt(ewr2*ewr2-ewR*ewR)-0.5*ewd2); - G4SubtractionSolid* solidEWLayer2 = new G4SubtractionSolid("EWKevlar",solidEWSphere2,solidEWRing2,0,ring2Pos); - G4LogicalVolume* logicalEWLayer2 = new G4LogicalVolume(solidEWLayer2,G4Material::GetMaterial("Kevlar"), "EWKevlar",0,0,0); - //logicalEWLayer2->SetVisAttributes(G4VisAttributes(G4Colour::Green())); - logicalEWLayer2->SetVisAttributes(membraneVisAttr); - new G4PVPlacement(0,G4ThreeVector(0.,0.,ewz2),logicalEWLayer2,"EWKevlar",fGlobalLogicalVolume,false,0); - - // Internal mylar membrane - G4double ewr3 = ewr2+ewd2; - G4double ewz3 = ewz1; - G4double ewth3 = asin(ewR/ewr3); - //printf("ewr3 %f ewz3 %f ewth3 %11.9f\n",ewr3,ewz3,ewth3); - G4Sphere* solidEWSphere3 = new G4Sphere("EWSphere3",ewr3,ewr3+ewd3,0.*deg,360.*deg,180.*deg-ewth3,ewth3); - G4Tubs* solidEWRing3 = new G4Tubs("EWRing3",ewR-10.*um,ewR+10.*mm,0.7*ewd3,0.*deg,360.*deg); - G4ThreeVector ring3Pos = G4ThreeVector(0.,0.,-sqrt(ewr3*ewr3-ewR*ewR)-0.5*ewd3); - G4SubtractionSolid* solidEWLayer3 = new G4SubtractionSolid("EWMylarInt",solidEWSphere3,solidEWRing3,0,ring3Pos); - G4LogicalVolume* logicalEWLayer3 = new G4LogicalVolume(solidEWLayer3,G4Material::GetMaterial("G4_MYLAR"), "EWMylarInt",0,0,0); - //logicalEWLayer3->SetVisAttributes(G4VisAttributes(G4Colour::Green())); - logicalEWLayer3->SetVisAttributes(membraneVisAttr); - new G4PVPlacement(0,G4ThreeVector(0.,0.,ewz3),logicalEWLayer3,"EWMylarInt",fGlobalLogicalVolume,false,0); - - // First steel ring (outer) - G4Tubs* solidEWIronRing1 = new G4Tubs("EWIronRing1",geo->GetEWF1RIn(),geo->GetEWF1ROut(),0.5*geo->GetEWF1Thick(),0.*deg,360.*deg); - G4LogicalVolume* logicalEWIronRing1 = new G4LogicalVolume(solidEWIronRing1,G4Material::GetMaterial("G4_STAINLESS-STEEL"), "EWIronRing1",0,0,0); - //logicalEWIronRing1->SetVisAttributes(G4VisAttributes(G4Colour::Blue())); - logicalEWIronRing1->SetVisAttributes(steelVisAttr); - new G4PVPlacement(0,G4ThreeVector(0.,0.,geo->GetEWF1PosZ()),logicalEWIronRing1,"EWIronRing1",fGlobalLogicalVolume,false,0); - - // Second steel ring - G4Tubs* solidEWIronRing2 = new G4Tubs("EWIronRing2",geo->GetEWF2RIn(),geo->GetEWF2ROut(),0.5*geo->GetEWF2Thick(),0.*deg,360.*deg); - G4LogicalVolume* logicalEWIronRing2 = new G4LogicalVolume(solidEWIronRing2,G4Material::GetMaterial("G4_STAINLESS-STEEL"), "EWIronRing2",0,0,0); - //logicalEWIronRing2->SetVisAttributes(G4VisAttributes(G4Colour::Blue())); - logicalEWIronRing2->SetVisAttributes(steelVisAttr); - new G4PVPlacement(0,G4ThreeVector(0.,0.,geo->GetEWF2PosZ()),logicalEWIronRing2,"EWIronRing2",fGlobalLogicalVolume,false,0); - - // Third steel ring - G4Tubs* solidEWIronRing3 = new G4Tubs("EWIronRing3",geo->GetEWF3RIn(),geo->GetEWF3ROut(),0.5*geo->GetEWF3Thick(),0.*deg,360.*deg); - G4LogicalVolume* logicalEWIronRing3 = new G4LogicalVolume(solidEWIronRing3,G4Material::GetMaterial("G4_STAINLESS-STEEL"), "EWIronRing3",0,0,0); - //logicalEWIronRing3->SetVisAttributes(G4VisAttributes(G4Colour::Blue())); - logicalEWIronRing3->SetVisAttributes(steelVisAttr); - new G4PVPlacement(0,G4ThreeVector(0.,0.,geo->GetEWF3PosZ()),logicalEWIronRing3,"EWIronRing3",fGlobalLogicalVolume,false,0); + + // Create flange around thin window + G4Tubs* solidEWFlange = new G4Tubs("EWFlange",ewFRIn,ewFROut,0.5*ewFThick,0.*deg,360.*deg); + + // Create the thin window spherical cap + G4Sphere* solidEWSphere = new G4Sphere("EWSphere",ewr1,ewr1+ewT,0.*deg,360.*deg,180.*deg-ewth1,ewth1); + + // Cretae the final structure by joining the two volumes + //G4ThreeVector ewspherePos = G4ThreeVector(0.,0.,-sqrt(ewr1*ewr1-ewR*ewR)-0.5*ewT); + //G4UnionSolid* solidEWindow = new G4UnionSolid("EAlWindow",solidEWSphere,solidEWFlange,0,flangePos); + G4ThreeVector spherePos = G4ThreeVector(0.,0.,0.5*ewFThick+ewr1-ewC); + G4UnionSolid* solidEWindow = new G4UnionSolid("ChamberAlWindow",solidEWFlange,solidEWSphere,0,spherePos); + G4LogicalVolume* logicalEWindow = new G4LogicalVolume(solidEWindow,G4Material::GetMaterial("G4_Al"), "ChamberAlWindow",0,0,0); + logicalEWindow->SetVisAttributes(alVisAttr); + //new G4PVPlacement(0,G4ThreeVector(0.,0.,ewz1),logicalEWindow,"ChamberAlWindow",fMotherVolume,false,0,true); + new G4PVPlacement(0,G4ThreeVector(0.,0.,efFFrontZ+0.5*ewFThick),logicalEWindow,"ChamberAlWindow",fMotherVolume,false,0,true); + +} + +void ChamberStructure::CreateECalCarbonThinWindow() +{ + + /////////////////////////////////////////////////////// + // Thin Carbon window and Al flange in front of ECal // + /////////////////////////////////////////////////////// + + ChamberGeometry* geo = ChamberGeometry::GetInstance(); + + // Get properties of thin window + G4double ewR = geo->GetEWCarbonRadius(); // Radius of window + G4double ewT = geo->GetEWCarbonThick(); // Thickness of window + G4double ewC = geo->GetEWCarbonConvexity(); // Convexity at window center + + // Get properties of flange + G4double ewFRIn = geo->GetEWAlFlangeRIn(); + G4double ewFROut = geo->GetEWAlFlangeROut(); + G4double ewFThick = geo->GetEWAlFlangeThick(); + + // Get Z coordinate of front face of flange + G4double efFFrontZ = geo->GetEWAlFrontFacePosZ(); + + G4VisAttributes alVisAttr = G4VisAttributes(G4Colour::Blue()); + //if ( ! fChamberIsVisible ) alVisAttr = G4VisAttributes::Invisible; + + G4VisAttributes cVisAttr = G4VisAttributes(G4Colour::Yellow()); + //if ( ! fChamberIsVisible ) cVisAttr = G4VisAttributes::Invisible; + + // Compute thin window sphere's radius and z position of center + G4double ewr1 = (ewR*ewR+ewC*ewC)/(2.*ewC); + //G4double ewz1 = efFBackZ+(ewr1-ewC); + G4double ewth1 = asin(ewR/ewr1); + + // Create flange around thin window + G4Tubs* solidEWFlange = new G4Tubs("EWFlange",ewFRIn,ewFROut,0.5*ewFThick,0.*deg,360.*deg); + G4LogicalVolume* logicalEWFlange = new G4LogicalVolume(solidEWFlange,G4Material::GetMaterial("G4_Al"), "ChamberECalWindowFlange",0,0,0); + logicalEWFlange->SetVisAttributes(alVisAttr); + new G4PVPlacement(0,G4ThreeVector(0.,0.,efFFrontZ+0.5*ewFThick),logicalEWFlange,"ChamberECalWindowFlange",fMotherVolume,false,0,true); + + // Create the thin window spherical cap and subtract flange to smooth its edge + G4Sphere* solidEWSphere = new G4Sphere("EWSphere",ewr1,ewr1+ewT,0.*deg,360.*deg,180.*deg-ewth1,ewth1); + G4ThreeVector spherePos = G4ThreeVector(0.,0.,0.5*ewFThick+ewr1-ewC); + G4SubtractionSolid* solidEWindow = new G4SubtractionSolid("ChamberECalWindow",solidEWSphere,solidEWFlange,0,G4ThreeVector(0.,0.,-0.5*ewFThick-ewr1+ewC)); + G4LogicalVolume* logicalEWindow = new G4LogicalVolume(solidEWindow,G4Material::GetMaterial("G4_C"), "ChamberECalWindow",0,0,0); + logicalEWindow->SetVisAttributes(cVisAttr); + new G4PVPlacement(0,G4ThreeVector(0.,0.,efFFrontZ+ewFThick+ewr1-ewC),logicalEWindow,"ChamberECalWindow",fMotherVolume,false,0,true); } @@ -200,13 +179,16 @@ void ChamberStructure::CreateTargetPipes() G4double cpzRIn = geo->GetCPZRIn(); G4double cpzROut = geo->GetCPZROut(); G4double cpzLen = geo->GetCPZLength(); - G4Tubs* solidCPZe = new G4Tubs("CPZe",0.,cpzROut-1.*um,0.5*cpzLen-1.*um,0.*deg,360.*deg); + G4double cpzPosZ = geo->GetCPZPosZ(); + + G4Tubs* solidCPZe = new G4Tubs("CPZe",0.,cpzROut,0.5*cpzLen,0.*deg,360.*deg); G4Tubs* solidCPZi = new G4Tubs("CPZi",0.,cpzRIn,0.5*cpzLen+1.*mm,0.*deg,360.*deg); G4double cpxRIn = geo->GetCPXRIn(); G4double cpxROut = geo->GetCPXROut(); G4double cpxLen = geo->GetCPXLength(); - G4Tubs* solidCPXe = new G4Tubs("CPXe",0.,cpxROut-1.*um,0.5*cpxLen-1.*um,0.*deg,360.*deg); + + G4Tubs* solidCPXe = new G4Tubs("CPXe",0.,cpxROut,0.5*cpxLen,0.*deg,360.*deg); G4Tubs* solidCPXi = new G4Tubs("CPXi",0.,cpxRIn,0.5*cpxLen+1.*mm,0.*deg,360.*deg); G4RotationMatrix* rotCPX = new G4RotationMatrix; @@ -217,343 +199,228 @@ void ChamberStructure::CreateTargetPipes() G4SubtractionSolid* solidCP3 = new G4SubtractionSolid("VCCP3",solidCP2,solidCPXi,rotCPX,G4ThreeVector(0.,0.,0.)); G4LogicalVolume* logicalCP = new G4LogicalVolume(solidCP3,G4Material::GetMaterial("G4_STAINLESS-STEEL"),"VCCP",0,0,0); logicalCP->SetVisAttributes(steelVisAttr); - new G4PVPlacement(0,G4ThreeVector(0.,0.,geo->GetCPZPosZ()),logicalCP,"CrossPipeSteel",fGlobalLogicalVolume,false,0); - -} -/* -G4double ChamberStructure::GetChamberMostExternalX() -{ - return ChamberGeometry::GetInstance()->GetVCMostExternalX(); -} + new G4PVPlacement(0,G4ThreeVector(0.,0.,cpzPosZ),logicalCP,"CrossPipeSteel",fMotherVolume,false,0,true); + + + // Create flanges for crossed pipe + + G4double flangezRIn = geo->GetCPZFlangeRIn(); + G4double flangezROut = geo->GetCPZFlangeROut(); + G4double flangezThick = geo->GetCPZFlangeThick(); + G4Tubs* solidFlangeZ = new G4Tubs("JunFlangeZ",flangezRIn,flangezROut,0.5*flangezThick,0.*deg,360.*deg); + G4LogicalVolume* logicalFlangeZ = new G4LogicalVolume(solidFlangeZ,G4Material::GetMaterial("G4_STAINLESS-STEEL"),"JunFlangeZ",0,0,0); + logicalFlangeZ->SetVisAttributes(steelVisAttr); + G4double flangez0PosZ = cpzPosZ-0.5*cpzLen+0.5*flangezThick; + new G4PVPlacement(0,G4ThreeVector(0.,0.,flangez0PosZ),logicalFlangeZ,"CPZFlange",fMotherVolume,false,0,true); + G4double flangez1PosZ = cpzPosZ+0.5*cpzLen-0.5*flangezThick; + new G4PVPlacement(0,G4ThreeVector(0.,0.,flangez1PosZ),logicalFlangeZ,"CPZFlange",fMotherVolume,false,1,true); + + G4double flangexRIn = geo->GetCPXFlangeRIn(); + G4double flangexROut = geo->GetCPXFlangeROut(); + G4double flangexThick = geo->GetCPXFlangeThick(); + G4Tubs* solidFlangeX = new G4Tubs("JunFlangeX",flangexRIn,flangexROut,0.5*flangexThick,0.*deg,360.*deg); + G4LogicalVolume* logicalFlangeX = new G4LogicalVolume(solidFlangeX,G4Material::GetMaterial("G4_STAINLESS-STEEL"),"JunFlangeX",0,0,0); + logicalFlangeX->SetVisAttributes(steelVisAttr); + G4double flangex0PosX = -0.5*cpxLen+0.5*flangexThick; + G4double flangex0PosZ = cpzPosZ; + new G4PVPlacement(rotCPX,G4ThreeVector(flangex0PosX,0.,flangex0PosZ),logicalFlangeX,"CPXFlange",fMotherVolume,false,0,true); + G4double flangex1PosX = +0.5*cpxLen-0.5*flangexThick; + G4double flangex1PosZ = cpzPosZ; + new G4PVPlacement(rotCPX,G4ThreeVector(flangex1PosX,0.,flangex1PosZ),logicalFlangeX,"CPXFlange",fMotherVolume,false,1,true); -G4double ChamberStructure::GetChamberMostAdvancedZ() -{ - return ChamberGeometry::GetInstance()->GetVCMostAdvancedZ(); } -G4ThreeVector ChamberStructure::GetChamberBackFaceCorner() +void ChamberStructure::CreateJunctionPipe() { - return ChamberGeometry::GetInstance()->GetVCBackFaceCorner(); -} - -G4double ChamberStructure::GetChamberBackFaceAngle() -{ - return ChamberGeometry::GetInstance()->GetVCBackFaceAngle(); -} - -G4double ChamberStructure::GetChamberBackFaceThickness() -{ - return ChamberGeometry::GetInstance()->GetVCBackFaceThickness(); -} - -G4double ChamberStructure::GetChamberInnerX() -{ - return ChamberGeometry::GetInstance()->GetVCInnerX(); -} - -G4double ChamberStructure::GetChamberInnerY() -{ - return ChamberGeometry::GetInstance()->GetVCInnerY(); -} - -G4double ChamberStructure::GetChamberInnerZ() -{ - return ChamberGeometry::GetInstance()->GetVCInnerZ(); -} -*/ -G4UnionSolid* ChamberStructure::CreateVCFacetGlobalSolid() -{ - - // Create the main volume of the vacuum chamber ChamberGeometry* geo = ChamberGeometry::GetInstance(); - // Create main VC volume as a tessellated solid - G4TessellatedSolid* solidMain = new G4TessellatedSolid("VCGlobMain"); - - G4int nFacets = geo->GetVCNFacets(); - for(G4int f=0; fGetVCFacetVtx(f,v); - if (ivtx != -1) { - G4int is = ivtx/10; // Section id (0-11) - G4int iv = ivtx%10; // Vertex id (0-3) - vtx[v] = geo->GetVCExtVtx(is,iv); - } else { - quadFacet = 0; - } - } - if (quadFacet) { - G4QuadrangularFacet* facet = new G4QuadrangularFacet(vtx[0],vtx[1],vtx[2],vtx[3],ABSOLUTE); - solidMain->AddFacet((G4VFacet*)facet); - } else { - G4TriangularFacet* facet = new G4TriangularFacet(vtx[0],vtx[1],vtx[2],ABSOLUTE); - solidMain->AddFacet((G4VFacet*)facet); - } - } - solidMain->SetSolidClosed(true); - - // In depth debug of tesselated solid - //G4cout << "Dump of solid:\n" << solidMain << G4endl; - //G4Polyhedron* polyhedron = solidMain->GetPolyhedron(); - //G4cout << "\nLocal polyhedron coordinates:\n" << *polyhedron << G4endl; - - //G4LogicalVolume* logicalMain = new G4LogicalVolume(solidMain,G4Material::GetMaterial("Vacuum"),"VCGlobMain",0,0,0); - //new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),logicalMain,"VCGlobMain",fMotherVolume,false,0); + G4VisAttributes steelVisAttr = G4VisAttributes(G4Colour::Grey()); + if ( ! fChamberIsVisible ) steelVisAttr = G4VisAttributes::Invisible; - // Big cylinder - G4double cyLen = geo->GetVCCLength(); - G4double cyROut = geo->GetVCCROut(); - G4double cyPosZ = geo->GetVCCPosZ(); - //printf("Cylinder %f %f %f %f %f\n",cyLen,cyThick,cyRIn,cyROut,cyPosZ); - G4Tubs* solidCyl = new G4Tubs("VCCylGlob",0.,cyROut,0.5*cyLen,0.*deg,360.*deg); + // Junction pipe - // Flange towards ECal thin window (includes thin window and its flange) - G4double flaLen = geo->GetVCMostAdvancedZ()-(cyPosZ+0.5*cyLen); - G4double flaROut = geo->GetVCCFROut(); - G4double flaPosZ = cyPosZ+0.5*cyLen+0.5*flaLen; - G4Tubs* solidFla = new G4Tubs("VCFlaGlob",0.,flaROut,0.5*flaLen,0.*deg,360.*deg); + G4double junRIn = geo->GetJunRIn(); + G4double junROut = geo->GetJunROut(); + G4double junLen = geo->GetJunLength(); + G4double junPosZ = geo->GetJunPosZ(); - // Crossed pipes at target position - G4double cpzR = geo->GetCPZROut(); - G4double cpzLen = geo->GetCPZLength(); - G4double cpzPosZ = geo->GetCPZPosZ(); - G4Tubs* solidCPZ = new G4Tubs("CPZGlob",0.,cpzR,0.5*cpzLen,0.*deg,360.*deg); - G4ThreeVector posCPZ = G4ThreeVector(0.,0.,cpzPosZ); - - G4double cpxR = geo->GetCPXROut(); - G4double cpxLen = geo->GetCPXLength(); - G4double cpxPosZ = geo->GetCPXPosZ(); - G4Tubs* solidCPX = new G4Tubs("CPXGlob",0.,cpxR,0.5*cpxLen,0.*deg,360.*deg); - G4ThreeVector posCPX = G4ThreeVector(0.,0.,cpxPosZ); - G4RotationMatrix* rotCPX = new G4RotationMatrix; - rotCPX->rotateY(90.*deg); + G4Tubs* solidJun = new G4Tubs("JunPipe",junRIn,junROut,0.5*junLen,0.*deg,360.*deg); + G4LogicalVolume* logicalJun = new G4LogicalVolume(solidJun,G4Material::GetMaterial("G4_STAINLESS-STEEL"),"JunPipe",0,0,0); + logicalJun->SetVisAttributes(steelVisAttr); + new G4PVPlacement(0,G4ThreeVector(0.,0.,junPosZ),logicalJun,"JunctionPipe",fMotherVolume,false,0,true); - // Attach cylinder, flange, and pipes to vacuum chamber - G4UnionSolid* solid0 = new G4UnionSolid("VCGlobal0",solidMain,solidCyl,0,G4ThreeVector(0.,0.,cyPosZ)); - G4UnionSolid* solid1 = new G4UnionSolid("VCGlobal1",solid0,solidFla,0,G4ThreeVector(0.,0.,flaPosZ)); - G4UnionSolid* solid2 = new G4UnionSolid("VCGlobal2",solid1,solidCPZ,0,posCPZ); - G4UnionSolid* solid3 = new G4UnionSolid("ChamberGlobal",solid2,solidCPX,rotCPX,posCPX); + printf("Junction pipe RIn %.1fmm Rout %.1fmm Zlen %.3fmm Zpos %.3fmm\n",junRIn/mm,junROut/mm,junLen/mm,junPosZ/mm); - return solid3; + // Add flanges + G4double flangeRIn = geo->GetJunFlangeRIn(); + G4double flangeROut = geo->GetJunFlangeROut(); + G4double flangeThick = geo->GetJunFlangeThick(); + G4Tubs* solidFlange = new G4Tubs("JunFlange",flangeRIn,flangeROut,0.5*flangeThick,0.*deg,360.*deg); + G4LogicalVolume* logicalFlange = new G4LogicalVolume(solidFlange,G4Material::GetMaterial("G4_STAINLESS-STEEL"),"JunFlange",0,0,0); + logicalFlange->SetVisAttributes(steelVisAttr); + G4double flange0PosZ = junPosZ-0.5*junLen+0.5*flangeThick; + new G4PVPlacement(0,G4ThreeVector(0.,0.,flange0PosZ),logicalFlange,"JunctionFlange",fMotherVolume,false,0,true); + G4double flange1PosZ = junPosZ+0.5*junLen-0.5*flangeThick; + new G4PVPlacement(0,G4ThreeVector(0.,0.,flange1PosZ),logicalFlange,"JunctionFlange",fMotherVolume,false,1,true); } -G4UnionSolid* ChamberStructure::CreateVCFacetExternalSolid() +void ChamberStructure::CreatePortholeCaps() { - // Create the main volume of the vacuum chamber - ChamberGeometry* geo = ChamberGeometry::GetInstance(); - // Shrinking factor - G4ThreeVector vShrink[4]; - vShrink[0] = G4ThreeVector(-1.*um, 1.*um,0.); - vShrink[1] = G4ThreeVector( 1.*um, 1.*um,0.); - vShrink[2] = G4ThreeVector( 1.*um,-1.*um,0.); - vShrink[3] = G4ThreeVector(-1.*um,-1.*um,0.); - - // Create main VC volume as a tassellated solid - G4TessellatedSolid* solidMain = new G4TessellatedSolid("VCExtMain"); - - G4int nFacets = geo->GetVCNFacets(); - for(G4int f=0; fGetVCFacetVtx(f,v); - if (ivtx != -1) { - G4int is = ivtx/10; // Section id - G4int iv = ivtx%10; // Vertex id - // Shrink the whole structure by 1um to avoid syrface overlap with VC global container - vtx[v] = geo->GetVCExtVtx(is,iv)+vShrink[iv]; - if (is==0 || is == 4 || is == 5) { vtx[v] += G4ThreeVector(0.,0.,1.*um); } - if (is==11) { vtx[v] += G4ThreeVector(0.,0.,-1.*um); } - } else { - vtx[v] = G4ThreeVector(0.,0.,0.); // The vacuum chamber structure cannot go through the origin - } - } - if ( (vtx[3].x() == 0.) && (vtx[3].x() == 0.) && (vtx[3].x() == 0.) ) { - G4TriangularFacet* facet = new G4TriangularFacet(vtx[0],vtx[1],vtx[2],ABSOLUTE); - solidMain->AddFacet((G4VFacet*)facet); - } else { - G4QuadrangularFacet* facet = new G4QuadrangularFacet(vtx[0],vtx[1],vtx[2],vtx[3],ABSOLUTE); - solidMain->AddFacet((G4VFacet*)facet); - } - } - solidMain->SetSolidClosed(true); - - //G4cout << "Dump of solid:\n" << solidMain << G4endl; - //G4Polyhedron* polyhedron = solidMain->GetPolyhedron(); - //G4cout << "\nLocal polyhedron coordinates:\n" << *polyhedron << G4endl; - - //G4LogicalVolume* logicalMain = new G4LogicalVolume(solidMain,G4Material::GetMaterial("Vacuum"),"VCGlobMain",0,0,0); - //new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),logicalMain,"VCGlobMain",fMotherVolume,false,0); - - // Big cylinder - G4double cyLen = geo->GetVCCLength(); - //G4double cyThick = geo->GetVCCThick(); - //G4double cyRIn = geo->GetVCCRIn(); - G4double cyROut = geo->GetVCCROut()-1.*um; - G4double cyPosZ = geo->GetVCCPosZ()+1.*um; - //printf("Cylinder %f %f %f %f %f\n",cyLen,cyThick,cyRIn,cyROut,cyPosZ); - G4Tubs* solidCyl = new G4Tubs("VCCylExt",0.,cyROut,0.5*cyLen,0.*deg,360.*deg); - - //G4LogicalVolume* logicalCyl = new G4LogicalVolume(solidCyl,G4Material::GetMaterial("Vacuum"),"Cyl",0,0,0); - //new G4PVPlacement(0,G4ThreeVector(0.,0.,cyPosZ),logicalCyl,"Cyl",fMotherVolume,false,0); - - // Flange towards ECal thin window - G4double flaLen = geo->GetVCCFThick()-2.*um; - //G4double flaRIn = geo->GetVCCFRIn(); - G4double flaROut = geo->GetVCCFROut()-1.*um; - //G4double flaPosZ = geo->GetVCCFPosZ(); - G4double flaPosZ = geo->GetVCCFPosZ(); - G4Tubs* solidFla = new G4Tubs("VCFlaExt",0.,flaROut,0.5*flaLen,0.*deg,360.*deg); - - /* - // Crossed pipes at target position - G4double cpzR = geo->GetCPZROut(); - G4double cpzLen = geo->GetCPZLength(); - G4double cpzPosZ = geo->GetCPZPosZ(); - G4Tubs* solidCPZ = new G4Tubs("CPZExt",0.,cpzR-1.*um,0.5*cpzLen-1.*um,0.*deg,360.*deg); - G4ThreeVector posCPZ = G4ThreeVector(0.,0.,cpzPosZ); + G4VisAttributes steelVisAttr = G4VisAttributes(G4Colour(0.4,0.4,0.4)); // Dark gray + if ( ! fChamberIsVisible ) steelVisAttr = G4VisAttributes::Invisible; - G4double cpxR = geo->GetCPXROut(); - G4double cpxLen = geo->GetCPXLength(); - G4double cpxPosZ = geo->GetCPXPosZ(); - G4Tubs* solidCPX = new G4Tubs("CPXExt",0.,cpxR-1.*um,0.5*cpxLen-1.*um,0.*deg,360.*deg); - G4ThreeVector posCPX = G4ThreeVector(0.,0.,cpxPosZ); - G4RotationMatrix* rotCPX = new G4RotationMatrix; - rotCPX->rotateY(90.*deg); - */ + G4int nPH = geo->GetPHCapNumber(); + for (G4int iPH=0; iPHGetPHCapRadius(iPH); + G4double phcT = geo->GetPHCapThick(iPH); + G4Tubs* solidPHC = new G4Tubs(phcN,0.,phcR,0.5*phcT,0.*deg,360.*deg); + G4LogicalVolume* logicalPHC = new G4LogicalVolume(solidPHC,G4Material::GetMaterial("G4_STAINLESS-STEEL"),phcN,0,0,0); + logicalPHC->SetVisAttributes(steelVisAttr); - // Attach cylinder and flange to vacuum chamber - G4UnionSolid* solid0 = new G4UnionSolid("VCExt0",solidMain,solidCyl,0,G4ThreeVector(0.,0.,cyPosZ)); - G4UnionSolid* solid1 = new G4UnionSolid("VCExt1",solid0,solidFla,0,G4ThreeVector(0.,0.,flaPosZ)); - //G4UnionSolid* solid2 = new G4UnionSolid("VCExt2",solid1,solidCPZ,0,posCPZ); - //G4UnionSolid* solid3 = new G4UnionSolid("ChamberExternal",solid2,solidCPX,rotCPX,posCPX); + G4ThreeVector posPHC = geo->GetPHCapPos(iPH); + G4RotationMatrix* rotPHC = new G4RotationMatrix; + rotPHC->rotateY(90.*deg); + new G4PVPlacement(rotPHC,posPHC,logicalPHC,phcN,fMotherVolume,false,0,true); - return solid1; - //return solid3; + printf("Porthole cap %d (%s) radius %f thick %f position %f %f %f\n",iPH,phcN,phcR,phcT,posPHC.x(),posPHC.y(),posPHC.z()); -} + } -G4UnionSolid* ChamberStructure::CreateVCFacetInternalSolid() +} +void ChamberStructure::CreateTPixPortholeCap() { - // Create the main volume of the vacuum chamber - ChamberGeometry* geo = ChamberGeometry::GetInstance(); - // Create main VC volume as a tassellated solid - G4TessellatedSolid* solidMain = new G4TessellatedSolid("VCIntMain"); - - G4int nFacets = geo->GetVCNFacets(); - for(G4int f=0; fGetVCFacetVtx(f,v); - if (ivtx != -1) { - G4int is = ivtx/10; // Section id - G4int iv = ivtx%10; // Vertex id - vtx[v] = geo->GetVCIntVtx(is,iv); - } else { - vtx[v] = G4ThreeVector(0.,0.,0.); // The vacuum chamber structure cannot go through the origin - } - } - if ( (vtx[3].x() == 0.) && (vtx[3].x() == 0.) && (vtx[3].x() == 0.) ) { - G4TriangularFacet* facet = new G4TriangularFacet(vtx[0],vtx[1],vtx[2],ABSOLUTE); - solidMain->AddFacet((G4VFacet*)facet); - } else { - G4QuadrangularFacet* facet = new G4QuadrangularFacet(vtx[0],vtx[1],vtx[2],vtx[3],ABSOLUTE); - solidMain->AddFacet((G4VFacet*)facet); - } - } - solidMain->SetSolidClosed(true); - - //G4cout << "Dump of solid:\n" << solidMain << G4endl; - //G4Polyhedron* polyhedron = solidMain->GetPolyhedron(); - //G4cout << "\nLocal polyhedron coordinates:\n" << *polyhedron << G4endl; - - //G4LogicalVolume* logicalMain = new G4LogicalVolume(solidMain,G4Material::GetMaterial("Vacuum"),"VCGlobMain",0,0,0); - //new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),logicalMain,"VCGlobMain",fMotherVolume,false,0); - - // Big cylinder - G4double cyLen = geo->GetVCCLength()-geo->GetVCCThick(); - //G4double cyThick = geo->GetVCCThick(); - //G4double cyRIn = geo->GetVCCRIn(); - G4double cyROut = geo->GetVCCROut()-geo->GetVCCThick(); - G4double cyPosZ = geo->GetVCCPosZ()+0.5*geo->GetVCCThick(); - //printf("Cylinder %f %f %f %f %f\n",cyLen,cyThick,cyRIn,cyROut,cyPosZ); - G4Tubs* solidCyl = new G4Tubs("VCCylExt",0.,cyROut,0.5*cyLen,0.*deg,360.*deg); - - //G4LogicalVolume* logicalCyl = new G4LogicalVolume(solidCyl,G4Material::GetMaterial("Vacuum"),"Cyl",0,0,0); - //new G4PVPlacement(0,G4ThreeVector(0.,0.,cyPosZ),logicalCyl,"Cyl",fMotherVolume,false,0); - - // Flange towards ECal thin window - G4double flaLen = geo->GetVCCFThick()+1.*cm; - //G4double flaThick = geo->GetVCCFThick(); - G4double flaRIn = geo->GetVCCFRIn(); - //G4double flaROut = geo->GetVCCFROut(); - G4double flaPosZ = geo->GetVCCFPosZ(); - //G4Tubs* solidFla = new G4Tubs("VCFlaGlob",0.,flaROut,0.5*flaThick,0.*deg,360.*deg); - G4Tubs* solidFla = new G4Tubs("VCFlaGlob",0.,flaRIn,0.5*flaLen,0.*deg,360.*deg); - printf("Flange hole %f %f %f\n",flaLen,flaRIn,flaPosZ); - - // Create hole at beam entrance (will need flange to connect to target structure) - G4double holeThick = geo->GetVCInHoleThick()+1.*mm; - G4double holeRadius = geo->GetVCInHoleRadius(); - G4double holePosZ = geo->GetVCInHolePosZ(); - G4Tubs* solidInHole = new G4Tubs("VCInHole",0.,holeRadius,0.5*holeThick,0.*deg,360.*deg); - - // Create hole at beam exit (will need flange to connect to thin TPix window) - // Add some O(1mm) tolerances to avoid boolean solids bugs in GEANT4 - G4double hoT = geo->GetVCOutHoleThick(); - G4double hoR = geo->GetVCOutHoleRadius(); - G4double hoL = geo->GetVCOutHoleLength(); - G4double hoD = geo->GetVCOutHoleDistToEdge(); - G4double hoA = geo->GetVCBackFaceAngle(); - G4Box* solidHO0 = new G4Box("VCHOut0",0.5*hoL,hoR,0.5*hoT+1.*mm); - G4Tubs* solidHO1 = new G4Tubs("VCHOut1",0.,hoR,0.5*hoT+1.*mm,0.*deg,360.*deg); - G4UnionSolid* solidHO2 = new G4UnionSolid("VCHOut2",solidHO0,solidHO1,0,G4ThreeVector(-0.5*hoL-0.5*mm,0.,0.)); - G4UnionSolid* solidOutHole = new G4UnionSolid("VCHOut3",solidHO2,solidHO1,0,G4ThreeVector(0.5*hoL+0.5*mm,0.,0.)); - G4RotationMatrix* rotHOut = new G4RotationMatrix; - rotHOut->rotateY(hoA); - G4ThreeVector hoEdge = geo->GetVCExtVtx(11,1); - G4double hoCX = hoEdge.x()-hoD*cos(hoA)+0.5*hoT*sin(hoA); - G4double hoCZ = hoEdge.z()-hoD*sin(hoA)-0.5*hoT*cos(hoA); - G4ThreeVector posHOut = G4ThreeVector(hoCX,0.,hoCZ); - printf("Exit hole %f %f %f %f %f %f %f\n",hoT,hoR,hoL,hoD,hoA,hoCX,hoCZ); - - /* - // Crossed pipes at target position - G4double cpzR = geo->GetCPZRIn(); - G4double cpzLen = geo->GetCPZLength(); - G4double cpzPosZ = geo->GetCPZPosZ(); - G4Tubs* solidCPZ = new G4Tubs("CPZGlob",0.,cpzR,0.5*cpzLen+2.*cm,0.*deg,360.*deg); - G4ThreeVector posCPZ = G4ThreeVector(0.,0.,cpzPosZ); + G4VisAttributes steelVisAttr = G4VisAttributes(G4Colour(0.4,0.4,0.4)); // Dark gray + if ( ! fChamberIsVisible ) steelVisAttr = G4VisAttributes::Invisible; - G4double cpxR = geo->GetCPXRIn(); - G4double cpxLen = geo->GetCPXLength(); - G4double cpxPosZ = geo->GetCPXPosZ(); - G4Tubs* solidCPX = new G4Tubs("CPXGlob",0.,cpxR,0.5*cpxLen+1.*cm,0.*deg,360.*deg); - G4ThreeVector posCPX = G4ThreeVector(0.,0.,cpxPosZ); - G4RotationMatrix* rotCPX = new G4RotationMatrix; - rotCPX->rotateY(90.*deg); - */ - - // Attach cylinder, flange, hole, and pipes to vacuum chamber - G4UnionSolid* solid0 = new G4UnionSolid("VCInt0",solidMain,solidCyl,0,G4ThreeVector(0.,0.,cyPosZ)); - G4UnionSolid* solid1 = new G4UnionSolid("VCInt1",solid0,solidFla,0,G4ThreeVector(0.,0.,flaPosZ)); - G4UnionSolid* solid2 = new G4UnionSolid("VCInt2",solid1,solidInHole,0,G4ThreeVector(0.,0.,holePosZ)); - G4UnionSolid* solid3 = new G4UnionSolid("VCInt3",solid2,solidOutHole,rotHOut,posHOut); - //G4UnionSolid* solid3 = new G4UnionSolid("VCInt3",solid2,solidHO0,rotHOut,posHOut); - //G4UnionSolid* solid4 = new G4UnionSolid("VCInt4",solid3,solidCPZ,0,posCPZ); - //G4UnionSolid* solid5 = new G4UnionSolid("ChamberInternal",solid4,solidCPX,rotCPX,posCPX); - - return solid3; - //return solid4; // Use this for visualization - //return solid5; // Use this for simulation + // Create rectangular cap + G4double phcW = geo->GetTPPHCapWidth(); + G4double phcH = geo->GetTPPHCapHeight(); + G4double phcT = geo->GetTPPHCapThick(); + G4Box* solidPHB = new G4Box("TPPHBox",0.5*phcW,0.5*phcH,0.5*phcT); + printf("Rectangular flange size %f x %f mm2 thick %f mm\n",phcW/mm,phcH/mm,phcT/mm); + + // Carve hole in cap + G4double phhR = geo->GetTPPHHoleRadius(); + G4double phhD = geo->GetTPPHHoleDist(); + G4Tubs* solidPHH = new G4Tubs("TPPHHole",0.,phhR,0.5*phcT+1.*mm,0.*deg,360.*deg); + G4ThreeVector posPHH = G4ThreeVector(-0.5*phcW+phhD,0.,0.); + G4SubtractionSolid* solidPHC = new G4SubtractionSolid("TPPHCap",solidPHB,solidPHH,0,posPHH); + printf("Center of beam exit (TPix) porthole cap at %f mm from flange border\n",phhD/mm); + + G4LogicalVolume* logicalPHC = new G4LogicalVolume(solidPHC,G4Material::GetMaterial("G4_STAINLESS-STEEL"),"TPPHCap",0,0,0); + logicalPHC->SetVisAttributes(steelVisAttr); + + G4ThreeVector corner = geo->GetVCBackFaceCorner(); + G4double angle = geo->GetVCBackFaceAngle(); + + G4double phcPosX = corner.x()+0.5*phcW*cos(angle)+(0.5*phcT+1.5*mm)*sin(angle); + G4double phcPosY = 0.; + G4double phcPosZ = corner.z()-0.5*phcW*sin(angle)+(0.5*phcT+1.5*mm)*cos(angle); + G4ThreeVector posPHC = G4ThreeVector(phcPosX,phcPosY,phcPosZ); + + G4RotationMatrix* rotPHC = new G4RotationMatrix; + rotPHC->rotateY(-angle); + + new G4PVPlacement(rotPHC,posPHC,logicalPHC,"TPPHCap",fMotherVolume,false,0,true); + + // Create circular cap + G4double circR = geo->GetTPPHCircRadius(); + G4double circT = geo->GetTPPHCircThick(); + G4Tubs* solidCirc = new G4Tubs("TPPHCirc",0.,circR,0.5*circT,0.*deg,360.*deg); + + // Carve hole for Mylar window in circular cap + G4double windR = geo->GetTPPHWindRadius(); + G4double windW = geo->GetTPPHWindWidth(); + G4Tubs* solidWindT = new G4Tubs("WindT",0.,windR,0.5*circT+1.*mm,0.*deg,360.*deg); + G4Box* solidWindB = new G4Box("WindB",0.5*windW,windR,0.5*circT+1.*mm); + G4ThreeVector posWindT1 = G4ThreeVector(-0.5*windW,0.,0.); + G4ThreeVector posWindT2 = G4ThreeVector(+0.5*windW,0.,0.); + G4ThreeVector posWindB = G4ThreeVector(0.,0.,0.); + G4SubtractionSolid* solidCirc1 = new G4SubtractionSolid("TPPHCirc1",solidCirc,solidWindT,0,posWindT1); + G4SubtractionSolid* solidCirc2 = new G4SubtractionSolid("TPPHCirc2",solidCirc1,solidWindT,0,posWindT2); + G4SubtractionSolid* solidCirc3 = new G4SubtractionSolid("TPPHCirc3",solidCirc2,solidWindB,0,posWindB); + + G4LogicalVolume* logicalCirc = new G4LogicalVolume(solidCirc3,G4Material::GetMaterial("G4_STAINLESS-STEEL"),"TPPHCirc",0,0,0); + logicalCirc->SetVisAttributes(G4VisAttributes(G4Colour::Blue())); + + G4double circPosX = corner.x()+phhD*cos(angle)+(1.5*mm+phcT+0.5*circT)*sin(angle); + G4double circPosY = 0.; + G4double circPosZ = corner.z()-phhD*sin(angle)+(1.5*mm+phcT+0.5*circT)*cos(angle); + G4ThreeVector posCirc = G4ThreeVector(circPosX,circPosY,circPosZ); + + G4RotationMatrix* rotCirc = new G4RotationMatrix; + rotCirc->rotateY(-angle); + + new G4PVPlacement(rotCirc,posCirc,logicalCirc,"TPPHCirc",fMotherVolume,false,0,true); + + // Create Mylar window + G4double windT = geo->GetTPPHWindThick(); + G4Box* solidMylarB = new G4Box("MylarB",0.5*windW,windR,0.5*windT); + G4Tubs* solidMylarT1 = new G4Tubs("MylarT1",0.,windR,0.5*windT, 90.*deg,180.*deg); + G4Tubs* solidMylarT2 = new G4Tubs("MylarT2",0.,windR,0.5*windT,-90.*deg,180.*deg); + //G4ThreeVector posMylarT1 = G4ThreeVector(-0.5*windW-1.*mm,0.,0.); + //G4ThreeVector posMylarT2 = G4ThreeVector(+0.5*windW+1.*mm,0.,0.); + G4ThreeVector posMylarT1 = G4ThreeVector(-0.5*windW,0.,0.); + G4ThreeVector posMylarT2 = G4ThreeVector(+0.5*windW,0.,0.); + G4UnionSolid* solidMylar1 = new G4UnionSolid("Mylar1",solidMylarB,solidMylarT1,0,posMylarT1); + G4UnionSolid* solidMylar2 = new G4UnionSolid("Mylar2",solidMylar1,solidMylarT2,0,posMylarT2); + + G4LogicalVolume* logicalMylar = new G4LogicalVolume(solidMylar2,G4Material::GetMaterial("G4_MYLAR"),"TPPHMylar",0,0,0); + logicalMylar->SetVisAttributes(G4VisAttributes(G4Colour::Yellow())); + + G4double mylarPosX = corner.x()+phhD*cos(angle)+(1.5*mm+phcT+circT+0.5*windT)*sin(angle); + G4double mylarPosY = 0.; + G4double mylarPosZ = corner.z()-phhD*sin(angle)+(1.5*mm+phcT+circT+0.5*windT)*cos(angle); + G4ThreeVector posMylar = G4ThreeVector(mylarPosX,mylarPosY,mylarPosZ); + + G4RotationMatrix* rotMylar = new G4RotationMatrix; + rotMylar->rotateY(-angle); + + new G4PVPlacement(rotMylar,posMylar,logicalMylar,"TPPHMylar",fMotherVolume,false,0,true); + + // Create stop flange for Mylar window + G4double stopR = geo->GetTPPHStopRadius(); + G4double stopW = geo->GetTPPHStopWidth(); + G4double stopT = geo->GetTPPHStopThick(); + + G4ThreeVector posStopT1 = G4ThreeVector(-0.5*stopW,0.,0.); + G4ThreeVector posStopT2 = G4ThreeVector(+0.5*stopW,0.,0.); + + G4Box* solidStopBL = new G4Box("StopBL",0.5*stopW,stopR,0.5*stopT); + G4Tubs* solidStopTL1 = new G4Tubs("StopTL1",0.,stopR,0.5*stopT, 90.*deg,180.*deg); + G4Tubs* solidStopTL2 = new G4Tubs("StopTL2",0.,stopR,0.5*stopT,-90.*deg,180.*deg); + G4UnionSolid* solidStopL1 = new G4UnionSolid("StopL1",solidStopBL,solidStopTL1,0,posStopT1); + G4UnionSolid* solidStopL2 = new G4UnionSolid("StopL2",solidStopL1,solidStopTL2,0,posStopT2); + + G4Box* solidStopBS = new G4Box("StopBS",0.5*stopW,windR,0.5*stopT+1.*mm); + G4Tubs* solidStopTS1 = new G4Tubs("StopTS1",0.,windR,0.5*stopT+1.*mm, 89.*deg,182.*deg); + G4Tubs* solidStopTS2 = new G4Tubs("StopTS2",0.,windR,0.5*stopT+1.*mm,-91.*deg,182.*deg); + G4UnionSolid* solidStopS1 = new G4UnionSolid("StopS1",solidStopBS,solidStopTS1,0,posStopT1); + G4UnionSolid* solidStopS2 = new G4UnionSolid("StopS2",solidStopS1,solidStopTS2,0,posStopT2); + + G4SubtractionSolid* solidStop = new G4SubtractionSolid("TPPHStopFlange",solidStopL2,solidStopS2,0,G4ThreeVector(0.,0.,0.)); + + G4LogicalVolume* logicalStop = new G4LogicalVolume(solidStop,G4Material::GetMaterial("G4_STAINLESS-STEEL"),"TPPHStopFlange",0,0,0); + logicalStop->SetVisAttributes(G4VisAttributes(G4Colour::Green())); + + G4double stopPosX = corner.x()+phhD*cos(angle)+(1.5*mm+phcT+circT+windT+0.5*stopT)*sin(angle); + G4double stopPosY = 0.; + G4double stopPosZ = corner.z()-phhD*sin(angle)+(1.5*mm+phcT+circT+windT+0.5*stopT)*cos(angle); + G4ThreeVector posStop = G4ThreeVector(stopPosX,stopPosY,stopPosZ); + + G4RotationMatrix* rotStop = new G4RotationMatrix; + rotStop->rotateY(-angle); + + new G4PVPlacement(rotStop,posStop,logicalStop,"TPPHStopFlange",fMotherVolume,false,0,true); } diff --git a/PadmeMC/ECal/src/ECalDetector.cc b/PadmeMC/ECal/src/ECalDetector.cc index 33ea840e..b2353a90 100644 --- a/PadmeMC/ECal/src/ECalDetector.cc +++ b/PadmeMC/ECal/src/ECalDetector.cc @@ -49,7 +49,7 @@ void ECalDetector::CreateGeometry() G4Box* solidEcal = new G4Box("ECal",0.5*ecalSizeX,0.5*ecalSizeY,0.5*ecalSizeZ); fECalVolume = new G4LogicalVolume(solidEcal,G4Material::GetMaterial("Vacuum"),"ECal",0,0,0); fECalVolume->SetVisAttributes(G4VisAttributes::Invisible); - new G4PVPlacement(0,ecalPos,fECalVolume,"ECal",fMotherVolume,false,0,false); + new G4PVPlacement(0,ecalPos,fECalVolume,"ECal",fMotherVolume,false,0,true); // Show size of gap between crystals printf("Gap between crystals is %f\n",geo->GetCrystalGap()); diff --git a/PadmeMC/ECal/src/ECalDigitizer.cc b/PadmeMC/ECal/src/ECalDigitizer.cc index 3873fe46..01056f5d 100644 --- a/PadmeMC/ECal/src/ECalDigitizer.cc +++ b/PadmeMC/ECal/src/ECalDigitizer.cc @@ -46,7 +46,7 @@ ECalDigitizer::ECalDigitizer(G4String name) G4cout << "Contribution of 1 p.e. to integral ADC signal: " << fPEtoSConversion << G4endl; G4cout << "Collection probability along Z: " << fCollMapNBins << " bins of " << G4BestUnit(fCollMapBinLen,"Length") << " - Map:"; - for(G4int i=0;i0 - for (G4int i=0; i < fDChannel.size(); i++) { + for (G4int i=0; i < (G4int)fDChannel.size(); i++) { if (fDSignal[i]>0.) { ECalDigi* digi = new ECalDigi(); digi->SetChannelId(fDChannel[i]); diff --git a/PadmeMC/ECal/src/ECalGeometry.cc b/PadmeMC/ECal/src/ECalGeometry.cc index 0faf10cf..fa32bce3 100644 --- a/PadmeMC/ECal/src/ECalGeometry.cc +++ b/PadmeMC/ECal/src/ECalGeometry.cc @@ -31,11 +31,12 @@ ECalGeometry::ECalGeometry() fCrystalCoating = 100.*um; - fECalFrontFacePosZ = 230.*cm; // From center of magnet yoke, i.e. 3m to target + //fECalFrontFacePosZ = 230.*cm; // From center of magnet yoke, i.e. 3m to target + fECalFrontFacePosZ = 233.*cm; // From center of magnet yoke, i.e. 3.33m to target fTedlarThickness = 50.*um; // Thickness of Tedlar slips - // Geometry parameters for plastic panel in front of ECal + // Geometry parameters for plastic panel in front of ECal (not used) fECalPanelEnable = false; fECalPanelThickness = 0.5*cm; fECalPanelSizeX = 62.*cm; // Slightly larger than ECal (61.625cm) @@ -394,7 +395,7 @@ std::vector ECalGeometry::GetHashTable() buffer.str(""); buffer << "fDigiPECollectionMap"; - for(G4int i=0;iSetGuidance("UI commands to control Magnet geometry"); + fSetMagnetVisibleCmd = new G4UIcmdWithoutParameter("/Detector/Magnet/SetMagnetVisible",this); + fSetMagnetVisibleCmd->SetGuidance("Show magnet structure."); + fSetMagnetVisibleCmd->AvailableForStates(G4State_PreInit,G4State_Idle); + + fSetMagnetInvisibleCmd = new G4UIcmdWithoutParameter("/Detector/Magnet/SetMagnetInvisible",this); + fSetMagnetInvisibleCmd->SetGuidance("Hide magnet structure."); + fSetMagnetInvisibleCmd->AvailableForStates(G4State_PreInit,G4State_Idle); + //fEnableMagneticFieldCmd = new G4UIcmdWithoutParameter("/Detector/Magnet/EnableMagneticField",this); //fEnableMagneticFieldCmd->SetGuidance("Enable magnetic field."); //fEnableMagneticFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle); @@ -63,6 +71,9 @@ MagnetMessenger::~MagnetMessenger() delete fMagnetDetectorDir; + delete fSetMagnetVisibleCmd; + delete fSetMagnetInvisibleCmd; + //delete fEnableMagneticFieldCmd; //delete fDisableMagneticFieldCmd; @@ -78,6 +89,16 @@ MagnetMessenger::~MagnetMessenger() void MagnetMessenger::SetNewValue(G4UIcommand* cmd, G4String par) { + if ( cmd == fSetMagnetVisibleCmd ) { + printf("Magnet is Visible\n"); + fMagnetStructure->SetMagnetVisible(); + } + + if ( cmd == fSetMagnetInvisibleCmd ) { + printf("Magnet is Invisible\n"); + fMagnetStructure->SetMagnetInvisible(); + } + //if ( cmd == fEnableMagneticFieldCmd ) { // printf("Enabling Magnetic Field\n"); // fMagnetStructure->EnableMagneticField(); diff --git a/PadmeMC/Magnet/src/MagnetStructure.cc b/PadmeMC/Magnet/src/MagnetStructure.cc index 7e5b9811..f9b0575f 100644 --- a/PadmeMC/Magnet/src/MagnetStructure.cc +++ b/PadmeMC/Magnet/src/MagnetStructure.cc @@ -34,6 +34,9 @@ MagnetStructure::MagnetStructure(G4LogicalVolume* motherVolume) // Magnetic volume is invisible by default //fMagneticVolumeIsVisible = 0; + // Magnet is visible by default + fMagnetIsVisible = true; + } MagnetStructure::~MagnetStructure() @@ -51,6 +54,12 @@ void MagnetStructure::CreateGeometry() G4VisAttributes coilVisAttr = G4VisAttributes(G4Colour::Red()); G4VisAttributes slabVisAttr = G4VisAttributes(G4Colour::Green()); G4VisAttributes neopreneVisAttr = G4VisAttributes(G4Colour::White()); + if (!fMagnetIsVisible) { + yokeVisAttr = G4VisAttributes::Invisible; + coilVisAttr = G4VisAttributes::Invisible; + slabVisAttr = G4VisAttributes::Invisible; + neopreneVisAttr = G4VisAttributes::Invisible; + } // Small gap between magnet yoke's sections G4double magGap = geo->GetMagnetGap(); diff --git a/PadmeMC/MagneticField/src/MagneticFieldMap.cc b/PadmeMC/MagneticField/src/MagneticFieldMap.cc index 5b2ae000..c563c69e 100644 --- a/PadmeMC/MagneticField/src/MagneticFieldMap.cc +++ b/PadmeMC/MagneticField/src/MagneticFieldMap.cc @@ -8,7 +8,7 @@ MagneticFieldMap::MagneticFieldMap() { // Default value: can be changed with set method - fConstantMagneticField = -0.55*tesla; + fConstantMagneticField = 0.55*tesla; //fConstantMagneticField = 0.; fConstantMagneticFieldXmin = -26.0*cm; diff --git a/PadmeMC/PVeto/src/PVetoGeometry.cc b/PadmeMC/PVeto/src/PVetoGeometry.cc index 45ada5ca..a59a30fd 100644 --- a/PadmeMC/PVeto/src/PVetoGeometry.cc +++ b/PadmeMC/PVeto/src/PVetoGeometry.cc @@ -30,7 +30,7 @@ PVetoGeometry::PVetoGeometry() fFingerNominalSizeZ = 1.0*cm; //fFingerRotX = 0.*deg; - fFingerRotY = 10.*deg; + fFingerRotY = -10.*deg; //fFingerRotZ = 0.*deg; fSupportGap = 0.1*mm; @@ -39,9 +39,9 @@ PVetoGeometry::PVetoGeometry() fSupportNominalSizeY = 0.5*cm; fSupportNominalSizeZ = 100.0*cm; - fPVetoInnerFacePosX = -20.*cm; + fPVetoInnerFacePosX = 20.*cm; - fPVetoFrontFacePosZ = -50.*cm; // Start at front face of yoke + fPVetoFrontFacePosZ = -49.*cm; // Start at inner face of vacuum chamber fPVetoSensitiveDetectorName = "PVetoSD"; diff --git a/PadmeMC/SAC/src/SACDetector.cc b/PadmeMC/SAC/src/SACDetector.cc index 6ef41160..82c2a77d 100644 --- a/PadmeMC/SAC/src/SACDetector.cc +++ b/PadmeMC/SAC/src/SACDetector.cc @@ -56,14 +56,15 @@ void SACDetector::CreateGeometry() // Show thickness of coating around crystals printf("Coating around SAC crystals is %f\n",geo->GetCrystalCoating()); - // Create standard SF57 crystal + // Create standard PbF2 crystal G4double crySizeX = geo->GetCrystalSizeX(); G4double crySizeY = geo->GetCrystalSizeY(); G4double crySizeZ = geo->GetCrystalSizeZ(); printf("SAC Crystal size is %f %f %f\n",crySizeX,crySizeY,crySizeZ); G4Box* solidCry = new G4Box("SACCry",0.5*crySizeX,0.5*crySizeY,0.5*crySizeZ); - // fCrystalVolume = new G4LogicalVolume(solidCry,G4Material::GetMaterial("G4_BARIUM_FLUORIDE"),"SACCry",0,0,0); - fCrystalVolume = new G4LogicalVolume(solidCry,G4Material::GetMaterial("PbGl_SF57"),"SACCry",0,0,0); + //fCrystalVolume = new G4LogicalVolume(solidCry,G4Material::GetMaterial("G4_BARIUM_FLUORIDE"),"SACCry",0,0,0); + //fCrystalVolume = new G4LogicalVolume(solidCry,G4Material::GetMaterial("PbGl_SF57"),"SACCry",0,0,0); + fCrystalVolume = new G4LogicalVolume(solidCry,G4Material::GetMaterial("PbF2"),"SACCry",0,0,0); fCrystalVolume->SetVisAttributes(G4VisAttributes(G4Colour::Magenta())); // Make crystal a sensitive detector @@ -74,7 +75,7 @@ void SACDetector::CreateGeometry() sdMan->AddNewDetector(sacSD); fCrystalVolume->SetSensitiveDetector(sacSD); - // Create ECal cell (BGO crystal+coating) + // Create SAC cell (PbF2 crystal+coating) G4double cellSizeX = geo->GetCellSizeX(); G4double cellSizeY = geo->GetCellSizeY(); G4double cellSizeZ = geo->GetCellSizeZ(); diff --git a/PadmeMC/SAC/src/SACDigitizer.cc b/PadmeMC/SAC/src/SACDigitizer.cc index 9210ccba..1bfdf7c9 100644 --- a/PadmeMC/SAC/src/SACDigitizer.cc +++ b/PadmeMC/SAC/src/SACDigitizer.cc @@ -49,7 +49,7 @@ SACDigitizer::SACDigitizer(G4String name) G4cout << "Contribution of 1 p.e. to integral ADC signal: " << fPEtoSConversion << G4endl; G4cout << "Collection probability along Z: " << fCollMapNBins << " bins of " << G4BestUnit(fCollMapBinLen,"Length") << " - Map:"; - for(G4int i=0;i SACGeometry::GetHashTable() buffer.str(""); buffer << "fDigiPECollectionMap"; - for(G4int i=0;iGetTotalEnergyDeposit(); if (edep == 0.) return false; G4StepPoint* preStepPoint = aStep->GetPreStepPoint(); - G4StepPoint* postStepPoint = aStep->GetPostStepPoint(); + //G4StepPoint* postStepPoint = aStep->GetPostStepPoint(); G4TouchableHandle touchHPre = aStep->GetPreStepPoint()->GetTouchableHandle(); SACHit* newHit = new SACHit(); diff --git a/PadmeMC/TPix/src/TPixDigitizer.cc b/PadmeMC/TPix/src/TPixDigitizer.cc index 7930e753..7ac69dd9 100644 --- a/PadmeMC/TPix/src/TPixDigitizer.cc +++ b/PadmeMC/TPix/src/TPixDigitizer.cc @@ -58,7 +58,7 @@ void TPixDigitizer::Digitize() // Loop over used channels G4int found = 0; - for (G4int i=0; i < dChannel.size(); i++) { + for (G4int i=0; i < (G4int)dChannel.size(); i++) { if (dChannel[i] == hChannel) { dEnergy[i] += hEnergy; if (hTime < dTime[i]) dTime[i] = hTime; @@ -75,7 +75,7 @@ void TPixDigitizer::Digitize() } // Create digis for active channels - for (G4int i=0; i < dChannel.size(); i++) { + for (G4int i=0; i < (G4int)dChannel.size(); i++) { TPixDigi* digi = new TPixDigi(); digi->SetChannelId(dChannel[i]); digi->SetTime(dTime[i]); diff --git a/PadmeMC/TPix/src/TPixGeometry.cc b/PadmeMC/TPix/src/TPixGeometry.cc index 20ae81c3..06aea400 100644 --- a/PadmeMC/TPix/src/TPixGeometry.cc +++ b/PadmeMC/TPix/src/TPixGeometry.cc @@ -21,7 +21,7 @@ TPixGeometry::TPixGeometry() // Inizialize default parameters fTPixNRows = 2; - fTPixNCols = 8; + fTPixNCols = 6; fChipSizeX = 14.08*mm; // 256 pixels of 55um each fChipSizeY = 14.08*mm; // 256 pixels of 55um each @@ -33,18 +33,20 @@ TPixGeometry::TPixGeometry() // the projection of the center of the external side of the TPix on the // external surface of the diagonal wall of the vacuum chamber. // Tune this to move TPix along the diagonal wall of the vacuum chamber - fTPixDistanceToCorner = 30.*cm; + fTPixDistanceToCorner = 35.8*cm; // Thickness of the support structure between HEPVeto and diagonal wall of the vacuum chamber - fTPixSupportThickness = 1.*cm; // Check with final design + fTPixSupportThickness = 6.*cm; // Check with final design // Angle of vacuum chamber wall behind HEPVeto wrt X axis // This value will be modified by main program according to actual chamber measures - fTPixChamberWallAngle = 0.32962*rad; + //fTPixChamberWallAngle = 0.32962*rad; + fTPixChamberWallAngle = 0.; // Coordinates of the corner on the back face of the vacuum chamber // These values will be modified by main program according to actual chamber measures - fTPixChamberWallCorner = G4ThreeVector(-422.77*mm,0.,2249.*mm); + //fTPixChamberWallCorner = G4ThreeVector(-422.77*mm,0.,2249.*mm); + fTPixChamberWallCorner = G4ThreeVector(0.,0.,0.); fTPixSensitiveDetectorName = "TPixSD"; @@ -64,16 +66,24 @@ void TPixGeometry::UpdateDerivedMeasures() fTPixSizeZ = fChipSizeZ+1.*um; // Small tolerance to avoid surface overlaps // Angle of the rotation of TPix around the Y axis - fTPixRotY = fTPixChamberWallAngle; + fTPixRotY = -fTPixChamberWallAngle; // Position of center of TPix box - fTPixPosX = fTPixChamberWallCorner.x()-fTPixDistanceToCorner*cos(fTPixChamberWallAngle) - -(fTPixSupportThickness+0.5*fTPixSizeZ)*sin(fTPixChamberWallAngle) - -0.5*fTPixSizeX*cos(fTPixChamberWallAngle); + //fTPixPosX = fTPixChamberWallCorner.x()-fTPixDistanceToCorner*cos(fTPixChamberWallAngle) + // -(fTPixSupportThickness+0.5*fTPixSizeZ)*sin(fTPixChamberWallAngle) + // -0.5*fTPixSizeX*cos(fTPixChamberWallAngle); + fTPixPosX = fTPixChamberWallCorner.x() + +(fTPixDistanceToCorner+0.5*fTPixSizeX)*cos(fTPixChamberWallAngle) + +(fTPixSupportThickness+0.5*fTPixSizeZ)*sin(fTPixChamberWallAngle); fTPixPosY = 0.; - fTPixPosZ = fTPixChamberWallCorner.z()-fTPixDistanceToCorner*sin(fTPixChamberWallAngle) - +(fTPixSupportThickness+0.5*fTPixSizeZ)*cos(fTPixChamberWallAngle) - -0.5*fTPixSizeX*sin(fTPixChamberWallAngle); + fTPixPosZ = fTPixChamberWallCorner.z() + -(fTPixDistanceToCorner+0.5*fTPixSizeX)*sin(fTPixChamberWallAngle) + +(fTPixSupportThickness+0.5*fTPixSizeZ)*cos(fTPixChamberWallAngle); + + printf("TPix size %f %f %f\n",fTPixSizeX,fTPixSizeY,fTPixSizeZ); + printf("TPix corner %f %f %f\n",fTPixChamberWallCorner.x(),fTPixChamberWallCorner.y(),fTPixChamberWallCorner.z()); + printf("TPix angle %f\n",fTPixChamberWallAngle); + printf("TPix distance %f support %f\n",fTPixDistanceToCorner,fTPixSupportThickness); } diff --git a/PadmeMC/TPix/src/TPixMessenger.cc b/PadmeMC/TPix/src/TPixMessenger.cc index 0a5fa340..bf653282 100644 --- a/PadmeMC/TPix/src/TPixMessenger.cc +++ b/PadmeMC/TPix/src/TPixMessenger.cc @@ -24,12 +24,19 @@ TPixMessenger::TPixMessenger(TPixDetector* det) fTPixDetectorDir = new G4UIdirectory("/Detector/TPix/"); fTPixDetectorDir->SetGuidance("UI commands to control TPix detector geometry"); - fSetNColumnsCmd = new G4UIcmdWithAnInteger("/Detector/TPix/Columns",this); + fSetNColumnsCmd = new G4UIcmdWithAnInteger("/Detector/TPix/NColumns",this); fSetNColumnsCmd->SetGuidance("Set number of TPix columns."); fSetNColumnsCmd->SetParameterName("NC",false); fSetNColumnsCmd->SetRange("NF >= 1 && NF <= 10"); fSetNColumnsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); + fSetDistToCornerCmd = new G4UIcmdWithADoubleAndUnit("/Detector/TPix/DistanceToCorner",this); + fSetDistToCornerCmd->SetGuidance("Set distance of TPix to corner of vacuum chamber back wall."); + fSetDistToCornerCmd->SetParameterName("DTC",false); + fSetDistToCornerCmd->SetDefaultUnit("cm"); + fSetDistToCornerCmd->SetRange("DTC > 0. && DTC <= 100."); + fSetDistToCornerCmd->AvailableForStates(G4State_PreInit,G4State_Idle); + } TPixMessenger::~TPixMessenger() diff --git a/PadmeMC/Target/src/TargetDetector.cc b/PadmeMC/Target/src/TargetDetector.cc index c3775b03..7f697378 100644 --- a/PadmeMC/Target/src/TargetDetector.cc +++ b/PadmeMC/Target/src/TargetDetector.cc @@ -17,6 +17,9 @@ #include "G4Element.hh" #include "G4Material.hh" +#include "G4VisAttributes.hh" +#include "G4Colour.hh" + #include "TargetGeometry.hh" #include "TargetSD.hh" @@ -54,6 +57,7 @@ void TargetDetector::CreateGeometry() // Do not forget to take into account mother volume Z displacement G4Box* solidTarget = new G4Box("Target",targetSizeX*0.5,targetSizeY*0.5,targetSizeZ*0.5); fTargetVolume = new G4LogicalVolume(solidTarget,G4Material::GetMaterial("Diamond"),"Target",0,0,0); + fTargetVolume->SetVisAttributes(G4VisAttributes(G4Colour::Red())); new G4PVPlacement(0,targetPos-G4ThreeVector(0.,0.,fTargetDisplacePosZ),fTargetVolume,"Target",fMotherVolume,false,0,false); // The whole target is a sensitive detector diff --git a/PadmeMC/Target/src/TargetDigitizer.cc b/PadmeMC/Target/src/TargetDigitizer.cc index c038e348..c1554098 100644 --- a/PadmeMC/Target/src/TargetDigitizer.cc +++ b/PadmeMC/Target/src/TargetDigitizer.cc @@ -59,7 +59,7 @@ void TargetDigitizer::Digitize() // Loop over used channels G4int found = 0; - for (G4int i=0; i < dChannel.size(); i++) { + for (G4int i=0; i < (G4int)dChannel.size(); i++) { if (dChannel[i] == hChannel) { dEnergy[i] += hEnergy; if (hTime < dTime[i]) dTime[i] = hTime; @@ -76,7 +76,7 @@ void TargetDigitizer::Digitize() } // Create digis for active channels - for (G4int i=0; i < dChannel.size(); i++) { + for (G4int i=0; i < (G4int)dChannel.size(); i++) { TargetDigi* digi = new TargetDigi(); digi->SetChannelId(dChannel[i]); digi->SetTime(dTime[i]); diff --git a/PadmeMC/Target/src/TargetGeometry.cc b/PadmeMC/Target/src/TargetGeometry.cc index f557aad9..bac08bd5 100644 --- a/PadmeMC/Target/src/TargetGeometry.cc +++ b/PadmeMC/Target/src/TargetGeometry.cc @@ -24,7 +24,8 @@ TargetGeometry::TargetGeometry() fTargetSizeY = 2.*cm; fTargetSizeZ = 100.*um; - fTargetFrontFacePosZ = -70.*cm; // Relative to center of magnet + //fTargetFrontFacePosZ = -70.*cm; // Relative to center of magnet + fTargetFrontFacePosZ = -100.*cm; // Relative to center of magnet fTargetFastDigitization = true; // Use fast digitization diff --git a/PadmeMC/Tungsten/GNUmakefile b/PadmeMC/Tungsten/GNUmakefile new file mode 100644 index 00000000..850a6bfe --- /dev/null +++ b/PadmeMC/Tungsten/GNUmakefile @@ -0,0 +1,19 @@ +# -------------------------------------------------------------- +# GNUmakefile for Tungsten library +# -------------------------------------------------------------- +# -------------------------------------------------------------- +# History: +# +# Created by Emanuele Leonardi (emanuele.leonardi@roma1.infn.it) 2015-12-14 +# +# -------------------------------------------------------------- + +name := Tungsten +G4TARGET := PADMEMC +G4EXLIB := true + +ifndef PADMEMC + PADMEMC = ../ +endif + +include $(PADMEMC)/config/SubDetector.gmk diff --git a/PadmeMC/Tungsten/include/TungstenDetector.hh b/PadmeMC/Tungsten/include/TungstenDetector.hh new file mode 100644 index 00000000..1a791544 --- /dev/null +++ b/PadmeMC/Tungsten/include/TungstenDetector.hh @@ -0,0 +1,45 @@ +// TungstenDetector.hh +// -------------------------------------------------------------- +// History: +// +// 2017-10-03 Created by Emanuele Leonardi (emanuele.leonardi@roma1.infn.it) 2105-12-11 +// -------------------------------------------------------------- + +#ifndef TungstenDetector_H +#define TungstenDetector_H 1 + +#include "globals.hh" +#include "G4LogicalVolume.hh" + +#include "TungstenGeometry.hh" + +class TungstenMessenger; + +class TungstenDetector +{ + +public: + + ~TungstenDetector(); + TungstenDetector(G4LogicalVolume*); + + void SetMotherVolume(G4LogicalVolume* v) { fMotherVolume = v; } + void CreateGeometry(); + + G4double GetTungstenFrontFaceZ() { return TungstenGeometry::GetInstance()->GetTungstenFrontFacePosZ(); } + G4double GetTungstenLength() { return TungstenGeometry::GetInstance()->GetTungstenSizeZ(); } + + // Define displacement of Tungsten along Z due to position of magnetic volume + void SetTungstenDisplacePosZ(G4double z) { fTungstenDisplacePosZ = z; } + +private: + + G4LogicalVolume* fMotherVolume; + + TungstenMessenger* fTungstenMessenger; + + G4double fTungstenDisplacePosZ; // Displacement of Tungsten along Z due to positioning inside magnetic volume + +}; + +#endif diff --git a/PadmeMC/Tungsten/include/TungstenGeometry.hh b/PadmeMC/Tungsten/include/TungstenGeometry.hh new file mode 100644 index 00000000..a3d44523 --- /dev/null +++ b/PadmeMC/Tungsten/include/TungstenGeometry.hh @@ -0,0 +1,57 @@ +// TungstenGeometry.hh +// -------------------------------------------------------------- +// History: +// +// 2107-10-03 Created by Emanuele Leonardi (emanuele.leonardi@roma1.infn.it) +// -------------------------------------------------------------- + +#ifndef TungstenGeometry_H +#define TungstenGeometry_H 1 + +#include "globals.hh" + +class G4LogicalVolume; + +class TungstenGeometry +{ + +public: + + ~TungstenGeometry(); + static TungstenGeometry* GetInstance(); + std::vector GetHashTable(); + +private: + + static TungstenGeometry* fInstance; + +protected: + + TungstenGeometry(); + +public: + + // Position of center of Tungsten cylinder + G4double GetTungstenPosX() { return 0.; } + G4double GetTungstenPosY() { return 0.; } + G4double GetTungstenPosZ() { return fTungstenFrontFacePosZ+fTungstenSizeZ*0.5; } + + // Size of Tungsten cylinder + G4double GetTungstenRadius() { return fTungstenRadius; } + G4double GetTungstenSizeZ() { return fTungstenSizeZ; } + void SetTungstenSizeZ(G4double s) { fTungstenSizeZ = s; } + + // Set position along Z of Tungsten front face + G4double GetTungstenFrontFacePosZ() { return fTungstenFrontFacePosZ; } + void SetTungstenFrontFacePosZ(G4double z) { fTungstenFrontFacePosZ = z; } + +private: + + G4double fTungstenRadius; + G4double fTungstenSizeZ; + + G4double fTungstenFrontFacePosZ; // Position along Z axis of Tungsten front face + +}; + +#endif diff --git a/PadmeMC/Tungsten/include/TungstenMessenger.hh b/PadmeMC/Tungsten/include/TungstenMessenger.hh new file mode 100644 index 00000000..6ad834d3 --- /dev/null +++ b/PadmeMC/Tungsten/include/TungstenMessenger.hh @@ -0,0 +1,42 @@ +// TungstenMessenger.hh +// -------------------------------------------------------------- +// History: +// +// 2017-10-03 Created by Emanuele Leonardi (emanuele.leonardi@roma1.infn.it) +// +// -------------------------------------------------------------- + +#ifndef TungstenMessenger_h +#define TungstenMessenger_h 1 + +#include "globals.hh" +#include "G4UImessenger.hh" + +class TungstenDetector; +class TungstenGeometry; + +class G4UIdirectory; +class G4UIcmdWithADoubleAndUnit; +class G4UIcmdWithoutParameter; + +class TungstenMessenger: public G4UImessenger +{ +public: + + TungstenMessenger(TungstenDetector* ); + ~TungstenMessenger(); + + void SetNewValue(G4UIcommand*, G4String); + +private: + + TungstenDetector* fTungstenDetector; + TungstenGeometry* fTungstenGeometry; + + G4UIdirectory* fTungstenDetectorDir; + + G4UIcmdWithADoubleAndUnit* fSetTungstenFrontFaceZCmd; + G4UIcmdWithADoubleAndUnit* fSetTungstenLengthCmd; + +}; +#endif diff --git a/PadmeMC/Tungsten/src/TungstenDetector.cc b/PadmeMC/Tungsten/src/TungstenDetector.cc new file mode 100644 index 00000000..c97bffde --- /dev/null +++ b/PadmeMC/Tungsten/src/TungstenDetector.cc @@ -0,0 +1,61 @@ +// TungstenDetector.cc +// -------------------------------------------------------------- +// History: +// +// Created by Emanuele Leonardi (emanuele.leonardi@roma1.infn.it) 2105-12-11 +// -------------------------------------------------------------- + +#include "TungstenDetector.hh" + +#include "G4PVPlacement.hh" +#include "G4ThreeVector.hh" +#include "G4Tubs.hh" + +#include "G4Element.hh" +#include "G4Material.hh" + +#include "G4VisAttributes.hh" +#include "G4Colour.hh" + +#include "G4SystemOfUnits.hh" + +#include "TungstenGeometry.hh" +#include "TungstenMessenger.hh" + +TungstenDetector::TungstenDetector(G4LogicalVolume* motherVolume):fMotherVolume(motherVolume) +{ + + // Connect to TungstenDetectorMessenger to enable datacard configuration + fTungstenMessenger = new TungstenMessenger(this); + + fTungstenDisplacePosZ = 0.; // No default displacement + +} + +TungstenDetector::~TungstenDetector() +{ + delete fTungstenMessenger; +} + +void TungstenDetector::CreateGeometry() +{ + + TungstenGeometry* geo = TungstenGeometry::GetInstance(); + + // Get Tungsten target dump position and dimensions + + G4ThreeVector tungPos = G4ThreeVector(geo->GetTungstenPosX(),geo->GetTungstenPosY(),geo->GetTungstenPosZ()); + printf("Tungsten will be placed at %.3fmm %.3fmm %.3fmm\n",tungPos.x()/mm,tungPos.y()/mm,tungPos.z()/mm); + + G4double tungLength = geo->GetTungstenSizeZ(); + G4double tungRadius = geo->GetTungstenRadius(); + printf("Tungsten length %.3fmm radius %.3fmm\n",tungLength/mm,tungRadius/mm); + + // Create main Tungsten cylinder and position it + // Do not forget to take into account mother volume Z displacement + G4Tubs* tungSolid = new G4Tubs("Tungsten",0.,tungRadius,0.5*tungLength,0.*deg,360.*deg); + G4LogicalVolume* tungLogical = new G4LogicalVolume(tungSolid,G4Material::GetMaterial("G4_W"),"Tungsten",0,0,0); + tungLogical->SetVisAttributes(G4VisAttributes(G4Colour::Red())); + new G4PVPlacement(0,tungPos-G4ThreeVector(0.,0.,fTungstenDisplacePosZ),tungLogical,"Tungsten",fMotherVolume,false,0,true); + +} diff --git a/PadmeMC/Tungsten/src/TungstenGeometry.cc b/PadmeMC/Tungsten/src/TungstenGeometry.cc new file mode 100644 index 00000000..3160ffd2 --- /dev/null +++ b/PadmeMC/Tungsten/src/TungstenGeometry.cc @@ -0,0 +1,55 @@ +// TungstenGeometry.cc +// -------------------------------------------------------------- +// History: +// +// 2017-10-03 Created by Emanuele Leonardi (emanuele.leonardi@roma1.infn.it) +// -------------------------------------------------------------- + +#include "TungstenGeometry.hh" + +#include "G4SystemOfUnits.hh" + +TungstenGeometry* TungstenGeometry::fInstance = 0; + +TungstenGeometry* TungstenGeometry::GetInstance() +{ + if ( fInstance == 0 ) { fInstance = new TungstenGeometry(); } + return fInstance; +} + +TungstenGeometry::TungstenGeometry() +{ + + // Inizialize default parameters + + fTungstenRadius = 5.*cm-2.*um; // Fill junction pipe taking into account magnetic volume tolerances + fTungstenSizeZ = 10.*cm; + + fTungstenFrontFacePosZ = -80.*cm; // Relative to center of magnet + +} + +TungstenGeometry::~TungstenGeometry() +{} + +std::vector TungstenGeometry::GetHashTable() +{ + + std::vector hash; + std::ostringstream buffer; + + buffer << "fTungstenRadius " << fTungstenRadius; + hash.push_back(buffer.str()); + buffer.str(""); + + buffer << "fTungstenSizeZ " << fTungstenSizeZ; + hash.push_back(buffer.str()); + buffer.str(""); + + buffer << "fTungstenFrontFacePosZ " << fTungstenFrontFacePosZ; + hash.push_back(buffer.str()); + buffer.str(""); + + return hash; + +} diff --git a/PadmeMC/Tungsten/src/TungstenMessenger.cc b/PadmeMC/Tungsten/src/TungstenMessenger.cc new file mode 100644 index 00000000..3e9a6167 --- /dev/null +++ b/PadmeMC/Tungsten/src/TungstenMessenger.cc @@ -0,0 +1,62 @@ +// TungstenMessenger.cc +// -------------------------------------------------------------- +// History: +// +// 2017-10-03 Created by Emanuele Leonardi (emanuele.leonardi@roma1.infn.it) +// +// -------------------------------------------------------------- + +#include "TungstenMessenger.hh" + +#include "G4UIdirectory.hh" +#include "G4UIcmdWithADoubleAndUnit.hh" + +#include "TungstenDetector.hh" +#include "TungstenGeometry.hh" + +TungstenMessenger::TungstenMessenger(TungstenDetector* det) +:fTungstenDetector(det) +{ + + fTungstenGeometry = TungstenGeometry::GetInstance(); + + fTungstenDetectorDir = new G4UIdirectory("/Detector/Tungsten/"); + fTungstenDetectorDir->SetGuidance("UI commands to control Tungsten target dump geometry"); + + fSetTungstenLengthCmd = new G4UIcmdWithADoubleAndUnit("/Detector/Tungsten/Lenght",this); + fSetTungstenLengthCmd->SetGuidance("Set length of Tungsten target dump."); + fSetTungstenLengthCmd->SetParameterName("Len",false); + fSetTungstenLengthCmd->SetDefaultUnit("cm"); + fSetTungstenLengthCmd->SetRange("Len > 0. && Len <= 20."); + fSetTungstenLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle); + + fSetTungstenFrontFaceZCmd = new G4UIcmdWithADoubleAndUnit("/Detector/Tungsten/FrontFaceZ",this); + fSetTungstenFrontFaceZCmd->SetGuidance("Set position along Z of Tungsten target dump front face."); + fSetTungstenFrontFaceZCmd->SetGuidance("Reference: center of magnet."); + fSetTungstenFrontFaceZCmd->SetParameterName("PosZ",false); + fSetTungstenFrontFaceZCmd->SetDefaultUnit("cm"); + fSetTungstenFrontFaceZCmd->SetRange("PosZ >= -85.5 && PosZ <= -57."); + fSetTungstenFrontFaceZCmd->AvailableForStates(G4State_PreInit,G4State_Idle); + +} + +TungstenMessenger::~TungstenMessenger() +{ + + delete fTungstenDetectorDir; + + delete fSetTungstenLengthCmd; + delete fSetTungstenFrontFaceZCmd; + +} + +void TungstenMessenger::SetNewValue(G4UIcommand* cmd, G4String par) +{ + + if ( cmd == fSetTungstenLengthCmd ) + fTungstenGeometry->SetTungstenSizeZ(fSetTungstenLengthCmd->GetNewDoubleValue(par)); + + if ( cmd == fSetTungstenFrontFaceZCmd ) + fTungstenGeometry->SetTungstenFrontFacePosZ(fSetTungstenFrontFaceZCmd->GetNewDoubleValue(par)); + +} diff --git a/PadmeMC/gdml/Chamber.gdml b/PadmeMC/gdml/Chamber.gdml new file mode 100644 index 00000000..6c6eb058 --- /dev/null +++ b/PadmeMC/gdml/Chamber.gdml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PadmeMC/gdml/ChamberExternal.gdml b/PadmeMC/gdml/ChamberExternal.gdml new file mode 100644 index 00000000..597fd7d5 --- /dev/null +++ b/PadmeMC/gdml/ChamberExternal.gdml @@ -0,0 +1,9755 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PadmeMC/gdml/ChamberInternal.gdml b/PadmeMC/gdml/ChamberInternal.gdml new file mode 100644 index 00000000..e93e2723 --- /dev/null +++ b/PadmeMC/gdml/ChamberInternal.gdml @@ -0,0 +1,7332 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PadmeMC/include/DetectorConstruction.hh b/PadmeMC/include/DetectorConstruction.hh index 8de3b284..42a71267 100644 --- a/PadmeMC/include/DetectorConstruction.hh +++ b/PadmeMC/include/DetectorConstruction.hh @@ -6,6 +6,7 @@ #include "G4SubtractionSolid.hh" #include "CLHEP/Units/PhysicalConstants.h" #include "G4PhysicalConstants.hh" +#include "G4GDMLParser.hh" class G4Box; class G4Tubs; @@ -26,6 +27,7 @@ class EVetoDetector; class HEPVetoDetector; class TDumpDetector; class TPixDetector; +class TungstenDetector; class MagnetStructure; class ChamberStructure; class HallStructure; @@ -63,7 +65,7 @@ public: void MagneticVolumeIsVisible(); void MagneticVolumeIsInvisible(); - void SetMagFieldValue(G4double v); + void SetMagFieldValue(G4double); G4double GetMagFieldValue(); void ChamberIsVisible(); @@ -80,19 +82,25 @@ public: G4double GetTargetFrontFaceZ(); G4double GetTargetThickness(); + // Recursive method to check full geometry + void CheckDaughters(G4LogicalVolume*,G4int); + private: void DefineMaterials(); - ECalDetector* fECalDetector; - TargetDetector* fTargetDetector; - SACDetector* fSACDetector; - PVetoDetector* fPVetoDetector; - EVetoDetector* fEVetoDetector; - HEPVetoDetector* fHEPVetoDetector; - TDumpDetector* fTDumpDetector; - TPixDetector* fTPixDetector; - LAVDetector* fLAVDetector; + G4GDMLParser fParser; + + ECalDetector* fECalDetector; + TargetDetector* fTargetDetector; + SACDetector* fSACDetector; + PVetoDetector* fPVetoDetector; + EVetoDetector* fEVetoDetector; + HEPVetoDetector* fHEPVetoDetector; + TDumpDetector* fTDumpDetector; + TPixDetector* fTPixDetector; + LAVDetector* fLAVDetector; + TungstenDetector* fTungstenDetector; MagnetStructure* fMagnetStructure; ChamberStructure* fChamberStructure; @@ -109,6 +117,7 @@ private: G4int fEnableHEPVeto; G4int fEnableTDump; G4int fEnableTPix; + G4int fEnableTungsten; G4int fEnableWall; G4int fEnableChamber; diff --git a/PadmeMC/src/DetectorConstruction.cc b/PadmeMC/src/DetectorConstruction.cc index 8db4752e..8d4a9241 100644 --- a/PadmeMC/src/DetectorConstruction.cc +++ b/PadmeMC/src/DetectorConstruction.cc @@ -14,6 +14,7 @@ #include "TDumpDetector.hh" #include "TPixDetector.hh" #include "LAVDetector.hh" +#include "TungstenDetector.hh" #include "MagnetStructure.hh" #include "ChamberStructure.hh" @@ -73,31 +74,32 @@ DetectorConstruction::DetectorConstruction() fDetectorMessenger = new DetectorMessenger(this); - fECalDetector = new ECalDetector(0); - fTargetDetector = new TargetDetector(0); - fSACDetector = new SACDetector(0); - fLAVDetector = new LAVDetector(0); - fPVetoDetector = new PVetoDetector(0); - fEVetoDetector = new EVetoDetector(0); - fHEPVetoDetector = new HEPVetoDetector(0); - fTDumpDetector = new TDumpDetector(0); - fTPixDetector = new TPixDetector(0); - + fECalDetector = new ECalDetector(0); + fTargetDetector = new TargetDetector(0); + fSACDetector = new SACDetector(0); + fLAVDetector = new LAVDetector(0); + fPVetoDetector = new PVetoDetector(0); + fEVetoDetector = new EVetoDetector(0); + fHEPVetoDetector = new HEPVetoDetector(0); + fTDumpDetector = new TDumpDetector(0); + fTPixDetector = new TPixDetector(0); + fTungstenDetector = new TungstenDetector(0); fMagnetStructure = new MagnetStructure(0); fChamberStructure = new ChamberStructure(0); fHallStructure = new HallStructure(0); fMagneticFieldManager = new MagneticFieldSetup(); - fEnableECal = 1; - fEnableTarget = 1; - fEnableSAC = 1; - fEnableLAV = 1; - fEnablePVeto = 1; - fEnableEVeto = 1; - fEnableHEPVeto = 1; - fEnableTDump = 0; - fEnableTPix = 1; + fEnableECal = 1; + fEnableTarget = 1; + fEnableSAC = 1; + fEnableLAV = 1; + fEnablePVeto = 1; + fEnableEVeto = 1; + fEnableHEPVeto = 1; + fEnableTDump = 0; + fEnableTPix = 1; + fEnableTungsten = 0; fEnableWall = 0; fEnableMagnet = 1; @@ -132,6 +134,7 @@ DetectorConstruction::~DetectorConstruction() delete fHEPVetoDetector; delete fTDumpDetector; delete fTPixDetector; + delete fTungstenDetector; delete fMagnetStructure; delete fChamberStructure; delete fHallStructure; @@ -149,50 +152,56 @@ G4VPhysicalVolume* DetectorConstruction::Construct() //------------------------------ // World Volume - //------------------------------ - G4Box* solidWorld = new G4Box("World",0.5*fWorldLength,0.5*fWorldLength,0.5*fWorldLength); - G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld,G4Material::GetMaterial("G4_AIR"),"World",0,0,0); - if (! fWorldIsFilledWithAir) logicWorld->SetMaterial(G4Material::GetMaterial("Vacuum")); - logicWorld->SetVisAttributes(G4VisAttributes::Invisible); - G4PVPlacement* physicWorld = new G4PVPlacement(0,G4ThreeVector(),logicWorld,"World",0,false,0); + //------------------------------ - /* - // Create large magnetic volume which includes target, vacuum chamber, magnet, vetoes and timepix - // but excludes calorimeters - G4double magVolMinX = -fChamberStructure->GetChamberMostExternalX()-1.*cm; - G4double magVolMaxX = fChamberStructure->GetChamberMostExternalX()+1.*cm; + G4VPhysicalVolume* physicWorld = 0; + G4LogicalVolume* logicWorld = 0; - G4double magVolMinY = -100.*cm; - G4double magVolMaxY = 100.*cm; + if (fEnableChamber) { - G4double magVolMinZ = -fChamberStructure->GetChamberMostAdvancedZ()-0.1*mm; - G4double magVolMaxZ = fChamberStructure->GetChamberMostAdvancedZ()+0.1*mm; // Right after the thin window flange + // The world volume is defined inside the GDML file which also contains the geometry + // of the Vacuum Chamber internal and external shells. + fParser.Read("gdml/Chamber.gdml"); + physicWorld = fParser.GetWorldVolume(); // Recover physical world volume + logicWorld = physicWorld->GetLogicalVolume(); // Recover logical world volume + + // Set world characteristics + logicWorld->SetVisAttributes(G4VisAttributes::Invisible); + //logicWorld->SetVisAttributes(G4VisAttributes(G4Colour::White())); + logicWorld->SetMaterial(G4Material::GetMaterial("Vacuum")); + printf("World %s %s\n",logicWorld->GetName().data(),logicWorld->GetMaterial()->GetName().data()); + + // Set color and material of the Vacuum Chamber shells + G4int nD = logicWorld->GetNoDaughters(); + for(G4int iD = 0; iDGetDaughter(iD); + G4LogicalVolume* Dlog = D->GetLogicalVolume(); + if (fChamberIsVisible) { + Dlog->SetVisAttributes(G4VisAttributes(G4Colour::Grey())); + } else { + Dlog->SetVisAttributes(G4VisAttributes::Invisible); + } + Dlog->SetMaterial(G4Material::GetMaterial("G4_STAINLESS-STEEL")); + if (D->CheckOverlaps()) { + printf("DetectorConstruction - WARNING - overlaps found in %s\n",Dlog->GetName().data()); + } + printf("Vacuum Chamber %s %s\n",Dlog->GetName().data(),Dlog->GetMaterial()->GetName().data()); + } - G4double magVolPosX = 0.5*(magVolMinX+magVolMaxX); - G4double magVolPosY = 0.5*(magVolMinY+magVolMaxY); - G4double magVolPosZ = 0.5*(magVolMinZ+magVolMaxZ); - G4ThreeVector magVolPos = G4ThreeVector(magVolPosX,magVolPosY,magVolPosZ); - - G4double magVolHLX = 0.5*(magVolMaxX-magVolMinX); - G4double magVolHLY = 0.5*(magVolMaxY-magVolMinY); - G4double magVolHLZ = 0.5*(magVolMaxZ-magVolMinZ); + } else { - //printf ("--- Magnetic Volume ---\n"); - //printf ("%f %f %f %f %f %f\n",magVolMinX,magVolMaxX,magVolMinY,magVolMaxY,magVolMinZ,magVolMaxZ); - //printf ("%f %f %f\n",magVolPosX,magVolPosY,magVolPosZ); - //printf ("%f %f %f\n",magVolHLX,magVolHLY,magVolHLZ); + // When the vacuum chamber is not required, just create the standard World volume + G4Box* solidWorld = new G4Box("World",0.5*fWorldLength,0.5*fWorldLength,0.5*fWorldLength); + logicWorld = new G4LogicalVolume(solidWorld,G4Material::GetMaterial("G4_AIR"),"World",0,0,0); + if (! fWorldIsFilledWithAir) logicWorld->SetMaterial(G4Material::GetMaterial("Vacuum")); + logicWorld->SetVisAttributes(G4VisAttributes::Invisible); + //logicWorld->SetVisAttributes(G4VisAttributes(G4Colour::White())); + physicWorld = new G4PVPlacement(0,G4ThreeVector(),logicWorld,"World",0,false,0); - G4Box* solidMagneticVolume = new G4Box("MagneticVolume",magVolHLX,magVolHLY,magVolHLZ); - G4LogicalVolume* logicMagneticVolume = - new G4LogicalVolume(solidMagneticVolume,G4Material::GetMaterial("G4_AIR"),"MagneticVolume",0,0,0); - if (! fWorldIsFilledWithAir) logicMagneticVolume->SetMaterial(G4Material::GetMaterial("Vacuum")); - if (! fMagneticVolumeIsVisible) logicMagneticVolume->SetVisAttributes(G4VisAttributes::Invisible); - new G4PVPlacement(0,magVolPos,logicMagneticVolume,"MagneticVolume",logicWorld,false,0,false); - */ + } // Vacuum chamber structure - // Note: vacuum volume is always created, only the physical structure is switched on/off if (fEnableChamber) { fChamberStructure->EnableChamber(); } else { @@ -203,19 +212,18 @@ G4VPhysicalVolume* DetectorConstruction::Construct() } else { fChamberStructure->SetChamberInvisible(); } - //fChamberStructure->SetMotherVolume(logicMagneticVolume); fChamberStructure->SetMotherVolume(logicWorld); fChamberStructure->CreateGeometry(); // Create magnetic volume inside vacuum chamber - G4double magVolMinX = -geoChamber->GetVCInnerX()+1.*um; - G4double magVolMinY = -geoChamber->GetVCInnerY()+1.*um; - G4double magVolMinZ = geoChamber->GetVCInnerZ()+1.*um; + G4double magVolMinX = -0.5*geoChamber->GetVCInnerSizeX()+1.*um; + G4double magVolMinY = -0.5*geoChamber->GetVCInnerSizeY()+1.*um; + G4double magVolMinZ = geoChamber->GetVCInnerFacePosZ(); - G4double magVolMaxX = geoChamber->GetVCInnerX()-1.*um; - G4double magVolMaxY = geoChamber->GetVCInnerY()-1.*um; - G4double magVolMaxZ = 100.*cm; // from field map definition + G4double magVolMaxX = 0.5*geoChamber->GetVCInnerSizeX()-1.*um; + G4double magVolMaxY = 0.5*geoChamber->GetVCInnerSizeY()-1.*um; + G4double magVolMaxZ = 1000.0*mm; // Magnetic field map extends up to +/-1m from magnet center G4double magVolPosX = 0.5*(magVolMinX+magVolMaxX); G4double magVolPosY = 0.5*(magVolMinY+magVolMaxY); @@ -236,28 +244,19 @@ G4VPhysicalVolume* DetectorConstruction::Construct() G4LogicalVolume* logicMagneticVolumeVC = new G4LogicalVolume(solidMagneticVolume,G4Material::GetMaterial("Vacuum"),"MagneticVolumeVC",0,0,0); if (! fMagneticVolumeIsVisible) logicMagneticVolumeVC->SetVisAttributes(G4VisAttributes::Invisible); - new G4PVPlacement(0,magVolPos,logicMagneticVolumeVC,"MagneticVolumeVC",fChamberStructure->GetChamberLogicalVolume(),false,0); + //new G4PVPlacement(0,magVolPos,logicMagneticVolumeVC,"MagneticVolumeVC",fChamberStructure->GetChamberLogicalVolume(),false,0); + new G4PVPlacement(0,magVolPos,logicMagneticVolumeVC,"MagneticVolumeVC",logicWorld,false,0,true); - // Create magnetic volume inside crossed pipes at target + // Create magnetic volume inside beam entrance pipe G4double cpzRIn = geoChamber->GetCPZRIn(); - G4double cpzLen = geoChamber->GetCPZLength()+geoChamber->GetVCInHoleThick(); - G4Tubs* solidCPZ = new G4Tubs("CPZ",0.,cpzRIn-1.*um,0.5*cpzLen,0.*deg,360.*deg); - G4ThreeVector posCPZ(0.,0.,geoChamber->GetCPZPosZ()+0.5*geoChamber->GetVCInHoleThick()); - - G4double cpxRIn = geoChamber->GetCPXRIn(); - G4double cpxLen = geoChamber->GetCPXLength(); - G4Tubs* solidCPX = new G4Tubs("CPX",0.,cpxRIn-1.*um,0.5*cpxLen,0.*deg,360.*deg); - - G4ThreeVector posCPX(0.,0.,-0.5*geoChamber->GetVCInHoleThick()); - G4RotationMatrix* rotCPX = new G4RotationMatrix; - rotCPX->rotateY(90.*deg); - G4UnionSolid* solidCP = new G4UnionSolid("MVCP",solidCPZ,solidCPX,rotCPX,posCPX); - + G4double cpzLen = 46.*cm; // Length is set to not include the instrumented section of the target + G4Tubs* cpzSolid = new G4Tubs("CPZ",0.,cpzRIn-1.*um,0.5*cpzLen,0.*deg,360.*deg); + G4ThreeVector cpzPos(0.,0.,geoChamber->GetVCInnerFacePosZ()-0.5*cpzLen); G4LogicalVolume* logicMagneticVolumeCP = - new G4LogicalVolume(solidCP,G4Material::GetMaterial("Vacuum"),"MagneticVolumeCP",0,0,0); + new G4LogicalVolume(cpzSolid,G4Material::GetMaterial("Vacuum"),"MagneticVolumeCP",0,0,0); if (! fMagneticVolumeIsVisible) logicMagneticVolumeCP->SetVisAttributes(G4VisAttributes::Invisible); - new G4PVPlacement(0,posCPZ,logicMagneticVolumeCP,"MagneticVolumeCP",fChamberStructure->GetChamberLogicalVolume(),false,0); + new G4PVPlacement(0,cpzPos,logicMagneticVolumeCP,"MagneticVolumeCP",logicWorld,false,0,true); // Add magnetic field to volumes if (fEnableMagneticField) { @@ -266,6 +265,13 @@ G4VPhysicalVolume* DetectorConstruction::Construct() logicMagneticVolumeCP->SetFieldManager(fMagneticFieldManager->GetLocalFieldManager(),true); } + // Tungsten target dump + if (fEnableTungsten) { + fTungstenDetector->SetMotherVolume(logicMagneticVolumeCP); + fTungstenDetector->SetTungstenDisplacePosZ(cpzPos.z()); // Take into account magnetic volume displacement + fTungstenDetector->CreateGeometry(); + } + // Concrete wall at large Z if (fEnableWall) { fHallStructure->SetMotherVolume(logicWorld); @@ -279,28 +285,16 @@ G4VPhysicalVolume* DetectorConstruction::Construct() fMagnetStructure->CreateGeometry(); } - /* - // Vacuum chamber structure - // Note: vacuum volume is always created, only the physical structure is switched on/off - if (fEnableChamber) { - fChamberStructure->EnableChamber(); - } else { - fChamberStructure->DisableChamber(); - } - if (fChamberIsVisible) { - fChamberStructure->SetChamberVisible(); - } else { - fChamberStructure->SetChamberInvisible(); - } - fChamberStructure->SetMotherVolume(logicMagneticVolume); - fChamberStructure->CreateGeometry(); - */ - // Target if (fEnableTarget) { - //fTargetDetector->SetMotherVolume(fChamberStructure->GetChamberLogicalVolume()); - fTargetDetector->SetMotherVolume(logicMagneticVolumeCP); - fTargetDetector->SetTargetDisplacePosZ(posCPZ.z()); + + // Should target be included in the magnetic volume, do not forget to take into account its displacement + //fTargetDetector->SetMotherVolume(logicMagneticVolumeCP); + //fTargetDetector->SetTargetDisplacePosZ(cpzPos.z()); + + fTargetDetector->SetMotherVolume(logicWorld); + fTargetDetector->SetTargetDisplacePosZ(0.); + fTargetDetector->CreateGeometry(); } @@ -310,10 +304,10 @@ G4VPhysicalVolume* DetectorConstruction::Construct() fSACDetector->CreateGeometry(); } - if (fEnableLAV) { - fLAVDetector->SetMotherVolume(logicWorld); - fLAVDetector->CreateGeometry(); - } + //if (fEnableLAV) { + // fLAVDetector->SetMotherVolume(logicWorld); + // fLAVDetector->CreateGeometry(); + //} // TDump if (fEnableTDump) { @@ -323,7 +317,6 @@ G4VPhysicalVolume* DetectorConstruction::Construct() // TPix if (fEnableTPix) { - //fTPixDetector->SetMotherVolume(logicMagneticVolume); fTPixDetector->SetMotherVolume(logicWorld); // Position of TPix depends on shape of vacuum chamber geoTPix->SetTPixChamberWallAngle(geoChamber->GetVCBackFaceAngle()); @@ -341,7 +334,6 @@ G4VPhysicalVolume* DetectorConstruction::Construct() if (fEnablePVeto) { fPVetoDetector->SetMotherVolume(logicMagneticVolumeVC); fPVetoDetector->SetPVetoDisplacePosZ(magVolPosZ); - //fPVetoDetector->SetMotherVolume(fChamberStructure->GetChamberLogicalVolume()); fPVetoDetector->CreateGeometry(); } @@ -349,13 +341,12 @@ G4VPhysicalVolume* DetectorConstruction::Construct() if (fEnableEVeto) { fEVetoDetector->SetMotherVolume(logicMagneticVolumeVC); fEVetoDetector->SetEVetoDisplacePosZ(magVolPosZ); - //fEVetoDetector->SetMotherVolume(fChamberStructure->GetChamberLogicalVolume()); fEVetoDetector->CreateGeometry(); } // HEPVeto if (fEnableHEPVeto) { - fHEPVetoDetector->SetMotherVolume(fChamberStructure->GetChamberLogicalVolume()); + fHEPVetoDetector->SetMotherVolume(logicWorld); // Position of HEPVeto depends on shape of vacuum chamber geoHEPVeto->SetHEPVetoChamberWallThickness(geoChamber->GetVCBackFaceThickness()); geoHEPVeto->SetHEPVetoChamberWallAngle(geoChamber->GetVCBackFaceAngle()); @@ -363,6 +354,10 @@ G4VPhysicalVolume* DetectorConstruction::Construct() fHEPVetoDetector->CreateGeometry(); } + // This code makes a full debug dump of the geometry, looking for overlaps + // HUGE amount of output: enable at your own risk ;) + //CheckDaughters(logicWorld,0); + return physicWorld; } @@ -375,6 +370,59 @@ void DetectorConstruction::SetupDetectors() void DetectorConstruction::DefineMaterials() { + // Use NIST database to create all needed materials + G4NistManager* man = G4NistManager::Instance(); + man->SetVerbose(1); + + // Define materials already in the NIST database + man->FindOrBuildMaterial("G4_C"); // Carbon (Chamber) + man->FindOrBuildMaterial("G4_W"); // Tungsten (Chamber) + man->FindOrBuildMaterial("G4_Al"); // Aluminum (Chamber, Veto) + man->FindOrBuildMaterial("G4_Fe"); // Iron (Magnet) + man->FindOrBuildMaterial("G4_Cu"); // Copper (Magnet) + man->FindOrBuildMaterial("G4_Si"); // Silicon (TPix) + man->FindOrBuildMaterial("G4_AIR"); // Air (World) + man->FindOrBuildMaterial("G4_BGO"); // BGO (ECal) + man->FindOrBuildMaterial("G4_CONCRETE"); // Concrete (Hall) + man->FindOrBuildMaterial("G4_MYLAR"); // Mylar (Chamber) + man->FindOrBuildMaterial("G4_STAINLESS-STEEL"); // Stainless steel (Chamber) + man->FindOrBuildMaterial("G4_POLYVINYLIDENE_FLUORIDE"); // Tedlar (ECal) + man->FindOrBuildMaterial("G4_NEOPRENE"); // Neoprene (Magnet) + man->FindOrBuildMaterial("G4_PLEXIGLASS"); // Plexiglass (ECal) + man->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE"); // Plastic scintillator (Veto) + + // Define all elements needed to define materials not in the NIST DB + man->FindOrBuildElement("H"); // Hydrogen + man->FindOrBuildElement("O"); // Oxygen + man->FindOrBuildElement("N"); // Nitrogen + man->FindOrBuildElement("C"); // Carbon + man->FindOrBuildElement("F"); // Fluoride + man->FindOrBuildElement("Pb"); // Lead + man->FindOrBuildElement("Al"); // Aluminum + man->FindOrBuildElement("Ti"); // Titanium + + // Vacuum: leave some residual air with low density (Chamber, World) + G4Material* Vacuum = new G4Material("Vacuum",(1.290*0.000001)*mg/cm3,2); // 1mbar + Vacuum->AddElement(G4Element::GetElement("N"),70.*perCent); + Vacuum->AddElement(G4Element::GetElement("O"),30.*perCent); + + // Diamond (Target) + G4Material* Diamond = new G4Material("Diamond",3.515*g/cm3,1); + Diamond->AddElement(G4Element::GetElement("C"),1); + + // Lead fluoride PbF2 (SAC) + G4Material* PbF2 = new G4Material("PbF2",7.77*g/cm3,2); + PbF2->AddElement(G4Element::GetElement("Pb"),1); + PbF2->AddElement(G4Element::GetElement("F"),2); + + // EJ510 reflective paint (ECal, SAC) + G4Material* EJ510Paint = new G4Material("EJ510Paint",1.182*g/cm3,4); + EJ510Paint->AddElement(G4Element::GetElement("Ti"),41.053*perCent); + EJ510Paint->AddElement(G4Element::GetElement("C"),17.194*perCent); + EJ510Paint->AddElement(G4Element::GetElement("H"),2.899*perCent); + EJ510Paint->AddElement(G4Element::GetElement("O"),38.854*perCent); + + /* //--------- Materials definition --------- G4double a, z, density; G4int ncomponents, natoms; @@ -459,6 +507,13 @@ void DetectorConstruction::DefineMaterials() K2OEl[1] = "O"; K2ONA[1] = 1; man->ConstructNewMaterial("K2O",K2OEl,K2ONA,2.32,true); + // Lead fluoride PbF2 + man->FindOrBuildElement("Pb"); + man->FindOrBuildElement("F"); + G4Material* PbF2 = new G4Material("PbF2",7.77*g/cm3,2); + PbF2->AddElement(G4Element::GetElement("Pb"),84.5*perCent); + PbF2->AddElement(G4Element::GetElement("F"), 15.5*perCent); + // Lead Glass (PbGl) G4Material* PbGl = new G4Material("PbGl_SF57",5.57*g/cm3,4); PbGl->AddMaterial(G4Material::GetMaterial("SAC_SiO2"), 24.0*perCent); // 22-26% @@ -501,11 +556,13 @@ void DetectorConstruction::DefineMaterials() EJ510Paint->AddElement(G4Element::GetElement("H"), 2.88*perCent); EJ510Paint->AddElement(G4Element::GetElement("O"), 38.86*perCent); + */ + //Print all the materials defined. - //G4cout << G4endl << "The elements defined are : " << G4endl << G4endl; - //G4cout << *(G4Element::GetElementTable()) << G4endl; - //G4cout << G4endl << "The materials defined are : " << G4endl << G4endl; - //G4cout << *(G4Material::GetMaterialTable()) << G4endl; + G4cout << G4endl << "The elements defined are : " << G4endl << G4endl; + G4cout << *(G4Element::GetElementTable()) << G4endl; + G4cout << G4endl << "The materials defined are : " << G4endl << G4endl; + G4cout << *(G4Material::GetMaterialTable()) << G4endl; } @@ -543,8 +600,8 @@ G4double DetectorConstruction::GetTargetFrontFaceZ() { if (fEnableTarget) return fTargetDetector->GetTargetFrontFaceZ(); - // Target is disabled (?): return a position 20cm before the front face of the magnet yoke - return -70.*cm; + // Target is disabled (?): return a position 50cm before the front face of the magnet yoke + return -100.*cm; } G4double DetectorConstruction::GetTargetThickness() @@ -567,6 +624,7 @@ void DetectorConstruction::EnableSubDetector(G4String det) else if (det=="HEPVeto") { fEnableHEPVeto = 1; } else if (det=="TDump") { fEnableTDump = 1; } else if (det=="TPix") { fEnableTPix = 1; } + else if (det=="Tungsten"){ fEnableTungsten= 1; } else { printf("WARNING: request to enable unknown subdetector %s\n",det.data()); } } @@ -582,24 +640,25 @@ void DetectorConstruction::DisableSubDetector(G4String det) else if (det=="HEPVeto") { fEnableHEPVeto = 0; } else if (det=="TDump") { fEnableTDump = 0; } else if (det=="TPix") { fEnableTPix = 0; } + else if (det=="Tungsten"){ fEnableTungsten= 0; } else { printf("WARNING: request to disable unknown subdetector %s\n",det.data()); } } void DetectorConstruction::EnableStructure(G4String str) { printf("Enabling structure %s\n",str.data()); - if (str=="Wall") { fEnableWall = 1; } + if (str=="Wall") { fEnableWall = 1; } else if (str=="Chamber") { fEnableChamber = 1; } - else if (str=="Magnet") { fEnableMagnet = 1; } + else if (str=="Magnet") { fEnableMagnet = 1; } else { printf("WARNING: request to enable unknown structure %s\n",str.data()); } } void DetectorConstruction::DisableStructure(G4String str) { printf("Disabling structure %s\n",str.data()); - if (str=="Wall") { fEnableWall = 0; } + if (str=="Wall") { fEnableWall = 0; } else if (str=="Chamber") { fEnableChamber = 0; } - else if (str=="Magnet") { fEnableMagnet = 0; } + else if (str=="Magnet") { fEnableMagnet = 0; } else { printf("WARNING: request to disable unknown structure %s\n",str.data()); } } @@ -656,3 +715,25 @@ void DetectorConstruction::WorldIsVacuum() printf("World and magnetic volume are filled with vacuum (low pressure air)\n"); fWorldIsFilledWithAir = 0; } + +void DetectorConstruction::CheckDaughters(G4LogicalVolume* mother,G4int lvl) +{ + + // This code makes a full debug of the geometry, looking for overlaps + + G4String indent = ""; + for(G4int l=0;lGetNoDaughters(); + for(G4int iD = 0; iDGetDaughter(iD); + G4LogicalVolume* daughter_log = daughter->GetLogicalVolume(); + printf("%s%s %s\n",indent.data(),daughter_log->GetName().data(),daughter_log->GetMaterial()->GetName().data()); + if (daughter->CheckOverlaps(1000,0.,false)) { + printf("%s - WARNING - overlaps found in %s\n",indent.data(),daughter_log->GetName().data()); + } + CheckDaughters(daughter_log,lvl); + } + +} diff --git a/PadmeMC/src/EventAction.cc b/PadmeMC/src/EventAction.cc index 1728d0e2..dd4e5561 100644 --- a/PadmeMC/src/EventAction.cc +++ b/PadmeMC/src/EventAction.cc @@ -181,13 +181,13 @@ void EventAction::EndOfEventAction(const G4Event* evt) AddLAVHits((LAVHitsCollection*)(LHC->GetHC(iHC))); } } - int Ncells=0; + //int Ncells=0; //Retrieve beam Infos! G4double BeamE = myStepping->GetPositronE(); G4double BeamX = myStepping->GetPositronX(); G4double BeamY = myStepping->GetPositronY(); - G4double BeamZ = myStepping->GetPositronZ(); + //G4double BeamZ = myStepping->GetPositronZ(); G4double PrimE = myStepping->GetPrimE(); @@ -203,7 +203,7 @@ void EventAction::EndOfEventAction(const G4Event* evt) ProcID = myStepping->GetPhysProc(); fHistoManager->FillHisto(1,ETotCal); fHistoManager->FillHisto(14,ProcID); - // fHistoManager->FillHisto(15,BeamZ); + //fHistoManager->FillHisto(15,BeamZ); fHistoManager->FillHisto2(30,myStepping->GetGammaEnergy(),myStepping->GetGammaAngle(),1.); @@ -363,7 +363,7 @@ void EventAction::EndOfEventAction(const G4Event* evt) void EventAction::AddECryHits(ECalHitsCollection* hcont) { - G4double ETotEvt=0; + //G4double ETotEvt=0; G4int nHits = hcont->entries(); G4double NRows= Egeom->GetECalNRows(); // righe sulla y @@ -543,7 +543,7 @@ void EventAction::AddTargetHits(TargetHitsCollection* hcont) //Target readout m void EventAction::AddHEPVetoHits(HEPVetoHitsCollection* hcont) { - G4double ETotHEPVetoEvt=0.; + //G4double ETotHEPVetoEvt=0.; G4int LastID=-1; for(G4int jj=0;jjentries(); for (G4int h=0; hGetHitE(); //old style variable deprected. - puppo= hit->GetEdep(); + //puppo= hit->GetEdep(); if(hit->GetTrackID()!=0 && hit->GetTrackID()!=LastID && NPVetoTracks < MaxTracks && hit->GetTrackEnergy() > 0.1*MeV) { PVetoTrackCh[NPVetoTracks] = hit->GetPVetoNb(); //bugs gives crazy numbers PVetoEtrack[NPVetoTracks] = hit->GetTrackEnergy(); @@ -689,7 +689,7 @@ void EventAction::AddPVetoHits(PVetoHitsCollection* hcont){ void EventAction::AddEVetoHits(EVetoHitsCollection* hcont){ // G4cout<<"vaffanculo "<1MeV +/vis/filtering/trajectories/create/attributeFilter +/vis/filtering/trajectories/attributeFilter-0/setAttribute IMag +/vis/filtering/trajectories/attributeFilter-0/addInterval 1. MeV 1000. MeV + #/run/beamOn 1