3#include "G4ThreeVector.hh"
4#include "G4PVPlacement.hh"
5#include "G4LogicalVolume.hh"
6#include "G4VPhysicalVolume.hh"
9#include "G4ReflectionFactory.hh"
19#include "G4IrregBox.hh"
21#include "G4Transform3D.hh"
25#include "G4UnionSolid.hh"
26#include "G4SubtractionSolid.hh"
27#include "G4Polyhedra.hh"
30#include "G4Material.hh"
32#include "G4PVParameterised.hh"
33#include "G4PVReplica.hh"
35#include "G4UniformMagField.hh"
36#include "G4FieldManager.hh"
37#include "G4TransportationManager.hh"
38#include "G4SDManager.hh"
39#include "G4RunManager.hh"
40#include "G4VisAttributes.hh"
46#include "G4SystemOfUnits.hh"
53 solidEMC(0),logicEMC(0),physiEMC(0),
54 solidBSCPhi(0),logicBSCPhi(0),physiBSCPhi(0),
55 solidBSCTheta(0),logicBSCTheta(0),physiBSCTheta(0),
56 solidBSCCrystal(0),logicBSCCrystal(0),physiBSCCrystal(0),
57 magField(0),detectorMessenger(0),
58 besEMCSD(0),crystalParam(0)
60 if(!fBesEmcConstruction) fBesEmcConstruction=
this;
71 if(crystalParam)
delete crystalParam;
72 if(besEMCGeometry)
delete besEMCGeometry;
73 if(emcEnd)
delete emcEnd;
100 if(logicEMC) physiEMC =
new G4PVPlacement(0,G4ThreeVector(0.0 ,0.0 ,0.0),logicEMC,
"physicalEMC",logicBes,
false, 0);
852void ExtBesEmcConstruction::DefineMaterials()
854 G4String name, symbol;
855 G4double a, z, density;
859 G4int ncomponents, natoms;
860 G4double fractionmass;
869 G4Element*
H=G4Element::GetElement(
"Hydrogen");
873 H =
new G4Element(name=
"Hydrogen",symbol=
"H" , z= 1., a);
875 G4Element*
C=G4Element::GetElement(
"Carbon");
879 C =
new G4Element(name=
"Carbon" ,symbol=
"C" , z= 6., a);
881 G4Element* O=G4Element::GetElement(
"Oxygen");
885 O =
new G4Element(name=
"Oxygen" ,symbol=
"O" , z= 8., a);
888 density = 0.344*g/cm3;
889 G4Material* Tyvek =
new G4Material(name=
"Polyethylene", density, ncomponents=2);
890 Tyvek->AddElement(
C, natoms=1);
891 Tyvek->AddElement(
H, natoms=2);
893 density = 1.39*g/cm3;
894 G4Material* Mylar =
new G4Material(name=
"PolyethyleneTerephthlate", density, ncomponents=3);
895 Mylar->AddElement(
C, natoms=5);
896 Mylar->AddElement(
H, natoms=4);
897 Mylar->AddElement(O, natoms=2);
899 density = 1.18*g/cm3;
900 organicGlass =
new G4Material(name=
"OrganicGlass", density, ncomponents=3);
901 organicGlass->AddElement(
C, natoms=5);
902 organicGlass->AddElement(
H, natoms=7);
903 organicGlass->AddElement(O, natoms=2);
905 G4Material *Fe =
new G4Material(name=
"Iron", z=26., a=55.85*g/mole, density=7.87*g/cm3);
906 G4Material *Cr =
new G4Material(name=
"Chromium", z=24., a=52.00*g/mole, density=8.72*g/cm3);
907 G4Material *Ni =
new G4Material(name=
"Nickel", z=28., a=58.69*g/mole, density=8.72*g/cm3);
909 stainlessSteel =
new G4Material(name=
"0Cr18Ni9", density=7.85*g/cm3, ncomponents=3);
910 stainlessSteel->AddMaterial(Fe, fractionmass=73.*perCent);
911 stainlessSteel->AddMaterial(Cr, fractionmass=18.*perCent);
912 stainlessSteel->AddMaterial(Ni, fractionmass=9.*perCent);
914 G4Material *H2O = G4Material::GetMaterial(
"Water");
915 G4Material *Cu = G4Material::GetMaterial(
"Copper");
916 G4double dWater = 1.*g/cm3;
917 G4double dCopper = 8.96*g/cm3;
918 G4double aWater = ((*besEMCGeometry).waterPipeDr-(*besEMCGeometry).waterPipeThickness)
919 *((*besEMCGeometry).waterPipeDr-(*besEMCGeometry).waterPipeThickness);
920 G4double aCopper = (*besEMCGeometry).waterPipeDr*(*besEMCGeometry).waterPipeDr-aWater;
921 density = (dWater*aWater+dCopper*aCopper)/(aWater+aCopper);
923 waterPipe =
new G4Material(name=
"WaterPipe", density, ncomponents=2);
924 fractionmass = dWater*aWater/(dWater*aWater+dCopper*aCopper);
925 waterPipe->AddMaterial(H2O, fractionmass);
926 fractionmass = dCopper*aCopper/(dWater*aWater+dCopper*aCopper);
927 waterPipe->AddMaterial(Cu, fractionmass);
929 cable =
new G4Material(name=
"Cable", density=4.*g/cm3, ncomponents=1);
930 cable->AddMaterial(Cu,1);
938 G4Material* Al=G4Material::GetMaterial(
"Aluminium");
941 Al =
new G4Material(name=
"Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3);
944 G4Material *Si=G4Material::GetMaterial(
"Silicon");
947 Si =
new G4Material(name=
"Silicon", z=14., a=28.0855*g/mole, density=2.33*g/cm3);
951 G4double totalThickness=(*besEMCGeometry).fTyvekThickness
952 +(*besEMCGeometry).fAlThickness+(*besEMCGeometry).fMylarThickness;
953 density = (Tyvek->GetDensity()*(*besEMCGeometry).fTyvekThickness+
954 Al->GetDensity()*(*besEMCGeometry).fAlThickness+
955 Mylar->GetDensity()*(*besEMCGeometry).fMylarThickness)
957 G4Material* Casing =
new G4Material(name=
"Casing", density, ncomponents=3);
960 fractionmass=Tyvek->GetDensity()/density
961 *(*besEMCGeometry).fTyvekThickness
965 fractionmass=Al->GetDensity()/density
966 *(*besEMCGeometry).fAlThickness
970 fractionmass=Mylar->GetDensity()/density
971 *(*besEMCGeometry).fMylarThickness
973 fCasingMaterial = Casing;
974 rearCasingMaterial = Tyvek;
977 fCrystalMaterial = G4Material::GetMaterial(
"Cesiumiodide");
983 G4Material* fCrystalMaterial = G4Material::GetMaterial(
"Cesiumiodide");
991 solidEnd =
new G4Cons(
"EndWorld",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,(*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,
992 (*emcEnd).WorldDz/2,0.*deg,360.*deg);
993 logicEnd =
new G4LogicalVolume(solidEnd, G4Material::GetMaterial(
"Air"),
"EndWorld", 0, 0, 0);
994 physiEnd =
new G4PVPlacement(0,
995 G4ThreeVector(0,0,(*emcEnd).WorldZPosition),
1006 G4RotationMatrix *rotateEnd =
new G4RotationMatrix();
1007 rotateEnd->rotateY(180.*deg);
1008 physiEnd =
new G4PVPlacement(rotateEnd,
1009 G4ThreeVector(0,0,-(*emcEnd).WorldZPosition),
1041 solidEndPhi =
new G4Cons(
"EndPhi",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,(*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,
1042 (*emcEnd).WorldDz/2,0*deg,22.5*deg);
1043 logicEndPhi =
new G4LogicalVolume(solidEndPhi, G4Material::GetMaterial(
"Air"),
"EndPhi", 0, 0, 0);
1044 for(G4int i=0;i<14;i++)
1048 G4RotationMatrix *rotatePhi =
new G4RotationMatrix();
1049 rotatePhi->rotateZ(-i*22.5*deg+67.5*deg);
1050 physiEndPhi =
new G4PVPlacement(rotatePhi,G4ThreeVector(0,0,0),logicEndPhi,
"EndPhi",logicEnd,
false,i,
false);
1056 for(G4int i=0;i<35;i++)
1060 solidEndCasing =
new G4IrregBox(
"EndCasing",(*emcEnd).fPnt[i]);
1061 logicEndCasing =
new G4LogicalVolume(solidEndCasing,fCasingMaterial,
"EndCasing");
1062 physiEndCasing =
new G4PVPlacement(0,G4ThreeVector(0,0,0),logicEndCasing,
"EndCasing",logicEndPhi,
false,copyNb,
false);
1065 solidEndCrystal =
new G4IrregBox(
"EndCrystal",(*emcEnd).cryPoint);
1066 logicEndCrystal =
new G4LogicalVolume(solidEndCrystal,fCrystalMaterial,
"EndCrystal");
1067 physiEndCrystal =
new G4PVPlacement(0,G4ThreeVector(0,0,0),logicEndCrystal,
"EndCrystal",logicEndCasing,
false,copyNb,
false);
1077 solidEndPhi =
new G4Cons(
"EndPhi",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,(*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,
1078 (*emcEnd).WorldDz/2,67.5*deg,22.5*deg);
1079 logicEndPhi =
new G4LogicalVolume(solidEndPhi, G4Material::GetMaterial(
"Air"),
"EndPhi", 0, 0, 0);
1080 for(G4int i=0;i<2;i++)
1082 G4RotationMatrix *rotatePhi =
new G4RotationMatrix();
1083 rotatePhi->rotateZ(-i*180.*deg);
1084 physiEndPhi =
new G4PVPlacement(rotatePhi,G4ThreeVector(0,0,0),logicEndPhi,
"EndPhi",logicEnd,
false,i*8+6,
false);
1089 for(G4int i=0;i<35;i++)
1092 solidEndCasing =
new G4IrregBox(
"EndCasing",(*emcEnd).fPnt1[i]);
1093 logicEndCasing =
new G4LogicalVolume(solidEndCasing,fCasingMaterial,
"EndCasing");
1094 physiEndCasing =
new G4PVPlacement(0,G4ThreeVector(0,0,0),logicEndCasing,
"EndCasing",logicEndPhi,
false,copyNb,
false);
1097 solidEndCrystal =
new G4IrregBox(
"EndCrystal",(*emcEnd).cryPoint);
1098 logicEndCrystal =
new G4LogicalVolume(solidEndCrystal,fCrystalMaterial,
"EndCrystal");
1099 physiEndCrystal =
new G4PVPlacement(0,G4ThreeVector(0,0,0),logicEndCrystal,
"EndCrystal",logicEndCasing,
false,copyNb,
false);
1106 (*emcEnd).ReflectX();
1109 for(G4int i=0;i<35;i++)
1110 for (G4int j=0;j<8;j++)
1111 (*emcEnd).fPnt1[i][j].rotateZ(-90.*deg);
1113 solidEndPhi =
new G4Cons(
"EndPhi",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,(*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,
1114 (*emcEnd).WorldDz/2,0*deg,22.5*deg);
1115 logicEndPhi =
new G4LogicalVolume(solidEndPhi, G4Material::GetMaterial(
"Air"),
"EndPhi", 0, 0, 0);
1116 for(G4int i=0;i<2;i++)
1118 G4RotationMatrix *rotatePhi =
new G4RotationMatrix();
1119 rotatePhi->rotateZ(-i*180.*deg-90.*deg);
1120 physiEndPhi =
new G4PVPlacement(rotatePhi,G4ThreeVector(0,0,0),logicEndPhi,
"EndPhi",logicEnd,
false,i*8+7,
false);
1125 for(G4int i=0;i<35;i++)
1128 solidEndCasing =
new G4IrregBox(
"EndCasing",(*emcEnd).fPnt1[i]);
1129 logicEndCasing =
new G4LogicalVolume(solidEndCasing,fCrystalMaterial,
"EndCasing");
1130 physiEndCasing =
new G4PVPlacement(0,G4ThreeVector(0,0,0),logicEndCasing,
"EndCasing",logicEndPhi,
false,copyNb,
false);
1133 solidEndCrystal =
new G4IrregBox(
"EndCrystal",(*emcEnd).cryPoint);
1134 logicEndCrystal =
new G4LogicalVolume(solidEndCrystal,fCrystalMaterial,
"EndCrystal");
1135 physiEndCrystal =
new G4PVPlacement(0,G4ThreeVector(0,0,0),logicEndCrystal,
"EndCrystal",logicEndCasing,
false,copyNb,
false);
1149 solidSupportBar =
new G4Tubs(
"SupportBar",
1150 (*besEMCGeometry).BSCRmax+(*besEMCGeometry).SPBarThickness1,
1151 (*besEMCGeometry).BSCRmax+(*besEMCGeometry).SPBarThickness+(*besEMCGeometry).SPBarThickness1,
1152 (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz,
1156 logicSupportBar =
new G4LogicalVolume(solidSupportBar,stainlessSteel,
"SupportBar");
1158 physiSupportBar =
new G4PVPlacement(0,G4ThreeVector(0,0,0),logicSupportBar,
"SupportBar",logicEMC,
false,0,
false);
1160 solidSupportBar1 =
new G4Tubs(
"SupportBar1",
1161 (*besEMCGeometry).BSCRmax,
1162 (*besEMCGeometry).BSCRmax+(*besEMCGeometry).SPBarThickness1,
1163 (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3,
1164 (*besEMCGeometry).BSCPhiDphi-(*besEMCGeometry).SPBarDphi/2,
1165 (*besEMCGeometry).SPBarDphi);
1167 logicSupportBar1 =
new G4LogicalVolume(solidSupportBar1,stainlessSteel,
"SupportBar1");
1169 for(G4int i=0;i<(*besEMCGeometry).BSCNbPhi/2;i++)
1171 G4RotationMatrix *rotateSPBar =
new G4RotationMatrix();
1172 rotateSPBar->rotateZ((*besEMCGeometry).BSCPhiDphi-i*2*(*besEMCGeometry).BSCPhiDphi);
1173 physiSupportBar1 =
new G4PVPlacement(rotateSPBar,G4ThreeVector(0,0,0),logicSupportBar1,
"SupportBar1",logicEMC,
false,0,
false);
1177 solidEndRing =
new G4Tubs(
"EndRing",
1178 (*besEMCGeometry).EndRingRmin,
1179 (*besEMCGeometry).EndRingRmin+(*besEMCGeometry).EndRingDr/2,
1180 (*besEMCGeometry).EndRingDz/2,
1184 solidGear =
new G4Tubs(
"Gear",
1185 (*besEMCGeometry).EndRingRmin+(*besEMCGeometry).EndRingDr/2,
1186 (*besEMCGeometry).EndRingRmin+(*besEMCGeometry).EndRingDr,
1187 (*besEMCGeometry).EndRingDz/2,
1189 (*besEMCGeometry).BSCPhiDphi);
1192 solidTaperRing1 =
new G4Tubs(
"TaperRing1",
1193 (*besEMCGeometry).TaperRingRmin1,
1194 (*besEMCGeometry).TaperRingRmin1+(*besEMCGeometry).TaperRingThickness1,
1195 (*besEMCGeometry).TaperRingInnerLength/2,
1199 solidTaperRing2 =
new G4Cons(
"TaperRing2",
1200 (*besEMCGeometry).TaperRingRmin1,
1201 (*besEMCGeometry).TaperRingRmin1+(*besEMCGeometry).TaperRingDr,
1202 (*besEMCGeometry).TaperRingRmin2,
1203 (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr,
1204 (*besEMCGeometry).TaperRingDz/2,
1208 solidTaperRing3 =
new G4Cons(
"TaperRing3",
1209 (*besEMCGeometry).BSCRmax2,
1210 (*besEMCGeometry).BSCRmax2+(*besEMCGeometry).TaperRingOuterLength1,
1211 (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr,
1212 (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr+(*besEMCGeometry).TaperRingOuterLength,
1213 (*besEMCGeometry).TaperRingThickness3/2,
1217 logicEndRing =
new G4LogicalVolume(solidEndRing,stainlessSteel,
"EmcEndRing");
1218 logicGear =
new G4LogicalVolume(solidGear,stainlessSteel,
"Gear");
1219 logicTaperRing1 =
new G4LogicalVolume(solidTaperRing1,stainlessSteel,
"TaperRing1");
1220 logicTaperRing2 =
new G4LogicalVolume(solidTaperRing2,stainlessSteel,
"TaperRing2");
1221 logicTaperRing3 =
new G4LogicalVolume(solidTaperRing3,stainlessSteel,
"TaperRing3");
1223 for(G4int i=0;i<2;i++)
1225 G4RotationMatrix *rotateSPRing =
new G4RotationMatrix();
1226 G4double zEndRing,z1,z2,z3;
1229 zEndRing = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz/2;
1230 z1 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3
1231 -(*besEMCGeometry).TaperRingDz-(*besEMCGeometry).TaperRingInnerLength/2;
1232 z2 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3-(*besEMCGeometry).TaperRingDz/2;
1233 z3 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3/2;
1237 rotateSPRing->rotateY(180.*deg);
1238 zEndRing = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz/2);
1239 z1 = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3
1240 -(*besEMCGeometry).TaperRingDz-(*besEMCGeometry).TaperRingInnerLength/2);
1241 z2 = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3-(*besEMCGeometry).TaperRingDz/2);
1242 z3 = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3/2);
1245 physiEndRing =
new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,zEndRing),
1246 logicEndRing,
"EndRing",logicEMC,
false,0);
1248 for(G4int j=0;j<(*besEMCGeometry).BSCNbPhi/2;j++)
1250 G4RotationMatrix *rotateGear =
new G4RotationMatrix();
1251 rotateGear->rotateZ((*besEMCGeometry).BSCPhiDphi/2-j*2*(*besEMCGeometry).BSCPhiDphi);
1252 physiGear =
new G4PVPlacement(rotateGear,G4ThreeVector(0,0,zEndRing),
1253 logicGear,
"Gear",logicEMC,
false,0);
1256 physiTaperRing1 =
new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,z1),
1257 logicTaperRing1,
"TaperRing1",logicEMC,
false,0);
1259 physiTaperRing2 =
new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,z2),
1260 logicTaperRing2,
"TaperRing2",logicEMC,
false,0);
1262 physiTaperRing3 =
new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,z3),
1263 logicTaperRing3,
"TaperRing3",logicEMC,
false,0);
1305 G4cout <<
"-------------------------------------------------------"<< G4endl
1306 <<
"---> There are "
1307 << phiNbCrystals <<
"(max=" << (*besEMCGeometry).BSCNbPhi
1308 <<
") crystals along phi direction and "
1309 << thetaNbCrystals <<
"(max=" << (*besEMCGeometry).BSCNbTheta
1310 <<
") crystals along theta direction."<< G4endl
1311 <<
"The crystals have sizes of "
1312 << (*besEMCGeometry).BSCCryLength/cm <<
"cm(L) and "
1313 << (*besEMCGeometry).BSCYFront/cm <<
"cm(Y) with "
1314 << fCrystalMaterial->GetName() <<
"."<< G4endl
1315 <<
"The casing is layer of "
1316 << (*besEMCGeometry).fTyvekThickness/mm <<
"mm tyvek,"
1317 << (*besEMCGeometry).fAlThickness/mm <<
"mm aluminum and"
1318 << (*besEMCGeometry).fMylarThickness/mm <<
"mm mylar."<< G4endl
1319 <<
"-------------------------------------------------------"<< G4endl;
1320 G4cout << G4Material::GetMaterial(
"PolyethyleneTerephthlate") << G4endl
1321 << G4Material::GetMaterial(
"Casing") << G4endl
1322 << G4Material::GetMaterial(
"Polyethylene") << G4endl
1323 <<
"-------------------------------------------------------"<< G4endl;
1331 G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
1333 {fCrystalMaterial = pttoMaterial;
1334 logicBSCCrystal->SetMaterial(pttoMaterial);
1343 G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
1345 {fCasingMaterial = pttoMaterial;
1346 logicBSCTheta->SetMaterial(pttoMaterial);
1356 (*besEMCGeometry).fTyvekThickness = val(
'X');
1357 (*besEMCGeometry).fAlThickness = val(
'Y');
1358 (*besEMCGeometry).fMylarThickness = val(
'Z');
1365 (*besEMCGeometry).BSCRmin = val;
1372 (*besEMCGeometry).BSCNbPhi = val;
1379 (*besEMCGeometry).BSCNbTheta = val;
1392 (*besEMCGeometry).BSCCryLength = val;
1399 (*besEMCGeometry).BSCYFront0 = val;
1407 (*besEMCGeometry).BSCYFront = val;
1414 (*besEMCGeometry).BSCPosition0 = val;
1421 (*besEMCGeometry).BSCPosition1 = val;
1429 G4FieldManager* fieldMgr
1430 = G4TransportationManager::GetTransportationManager()->GetFieldManager();
1432 if(magField)
delete magField;
1435 { magField =
new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
1436 fieldMgr->SetDetectorField(magField);
1437 fieldMgr->CreateChordFinder(magField);
1438 fmagField=fieldValue;
1441 fieldMgr->SetDetectorField(magField);
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations C
static EmcG4Geo * Instance()
Get a pointer to the single instance of EmcG4Geo.
void PrintEMCParameters()
void SetBSCRmin(G4double)
void SetBSCPosition0(G4double)
void ConstructEndGeometry(G4LogicalVolume *)
void SetStartIDTheta(G4int)
void SetBSCPosition1(G4double)
void SetCasingThickness(G4ThreeVector)
G4int ComputeEndCopyNb(G4int)
void SetMagField(G4double)
void SetBSCCrystalLength(G4double)
void SetBSCYFront0(G4double)
void SetCrystalMaterial(G4String)
void SetCasingMaterial(G4String)
void Construct(G4LogicalVolume *)
void SetBSCNbTheta(G4int)
void SetBSCYFront(G4double)
void ConstructSPFrame(G4LogicalVolume *, ExtBesEmcGeometry *)
void ModifyForCasing(G4ThreeVector pos[8], G4int CryNb)
G4LogicalVolume * GetTopVolume()
Get the top(world) volume;.