11 #include <Geant4/G4LogicalVolume.hh>
12 #include <Geant4/G4VPhysicalVolume.hh>
13 #include <Geant4/G4PVPlacement.hh>
14 #include <Geant4/G4PVReplica.hh>
15 #include <Geant4/G4Box.hh>
16 #include <Geant4/G4NistManager.hh>
17 #include <Geant4/G4VisAttributes.hh>
18 #include <Geant4/G4Color.hh>
38 std::set<G4LogicalVolume *> &AbsorberLogicalVolumesSet){
48 std::map<G4LogicalVolume *, int> &AbsorberLogicalVolumeInfoMap){
58 double End_X,
double End_Y,
double End_Z,
62 double Center_X = (Start_X + End_X)/2.;
63 double Center_Y = (Start_Y + End_Y)/2.;
64 double Width_X = End_X - Start_X;
65 double Width_Y = End_Y - Start_Y;
73 G4Box *PIXPlane =
new G4Box(
"CPIXPlane", Width_X/2.0, Width_Y/2.0,
PIX_Z/2.0);
127 for(
int ilayer=0; ilayer<
nCTowerZ+1; ilayer++){
128 G4double position_Z_PIX_Silicon = Start_Z + offsetZ +
PIX_Z/2.;
138 std::string ss_PIX_Glue2 =
"PhysVol_CGlue2_" +
std::to_string(ilayer);
139 std::string ss_PIX_FPC =
"PhysVol_CFPC_" +
std::to_string(ilayer);
141 new G4PVPlacement(0, threeVect_PIX_Silicon, ss_PIX_Plane, lV_PIXPlane, motherPhy,
false, ilayer);
142 new G4PVPlacement(0, threeVect_PIX_Glue2, ss_PIX_Glue2, lV_PIX_Glue2, motherPhy,
false, ilayer);
143 new G4PVPlacement(0, threeVect_PIX_FPC, ss_PIX_FPC, lV_PIX_FPC, motherPhy,
false, ilayer);
152 for (
int ilayer =0; ilayer<
nCTowerZ; ilayer++){
156 std::string ss_Crystal =
"PhysVol_Crystal_L"+
std::to_string(LayerID);
158 new G4PVPlacement(0, threeVect_Crystal, ss_Crystal, lV_CrysBox, motherPhy,
false, ilayer);
172 double End_X,
double End_Y,
double End_Z,
177 double Center_X = (Start_X + End_X)/2.;
178 double Center_Y = (Start_Y + End_Y)/2.;
179 double Width_X = End_X - Start_X;
180 double Width_Y = End_Y - Start_Y;
192 G4Box *PAD_Plane =
new G4Box(
"PAD_Plane", Width_X/2.0, Width_Y/2.0,
PAD_Z/2.0);
195 G4Box *PADonlyBox =
new G4Box(
"PADonlyBox", Width_X/2.0, Width_Y/2.0, PadOnlyThickness/2.0);
203 G4Box *PIX_Plane =
new G4Box(
"PIX_Plane", Width_X/2.0, Width_Y/2.0,
PIX_Z/2.0);
254 std::pair<G4LogicalVolume*, int> pair_PAD_Si = std::make_pair(lV_PAD_Silicon, infoval);
256 std::pair<G4LogicalVolume*, int> pair_PIX_Si = std::make_pair(lV_PIX_Silicon, infoval);
260 std::pair<G4LogicalVolume*, int> pair_PAD_W = std::make_pair(lV_PAD_W, infoval);
261 std::pair<G4LogicalVolume*, int> pair_PIX_W = std::make_pair(lV_PIX_W, infoval);
263 std::pair<G4LogicalVolume*, int> pair_PAD_Glue1 = std::make_pair(lV_PAD_Glue1, infoval);
264 std::pair<G4LogicalVolume*, int> pair_PIX_Glue1 = std::make_pair(lV_PIX_Glue1, infoval);
265 std::pair<G4LogicalVolume*, int> pair_PAD_Glue2 = std::make_pair(lV_PAD_Glue2, infoval);
266 std::pair<G4LogicalVolume*, int> pair_PIX_Glue2 = std::make_pair(lV_PIX_Glue2, infoval);
267 std::pair<G4LogicalVolume*, int> pair_PAD_FPC = std::make_pair(lV_PAD_FPC, infoval);
268 std::pair<G4LogicalVolume*, int> pair_PIX_FPC = std::make_pair(lV_PIX_FPC, infoval);
309 new G4PVPlacement(0, threeVect_PAD_W, lV_PAD_W,
"PV_PAD_W", lV_PADLayer,
false,0);
310 new G4PVPlacement(0, threeVect_PAD_Glue1, lV_PAD_Glue1,
"PV_PAD_Glue1", lV_PADLayer,
false,0);
311 new G4PVPlacement(0, threeVect_PAD_Silicon, lV_PADPlane,
"PV_PAD_Plane", lV_PADLayer,
false,0);
312 new G4PVPlacement(0, threeVect_PAD_Glue2, lV_PAD_Glue2,
"PV_PAD_Glue2", lV_PADLayer,
false,0);
313 new G4PVPlacement(0, threeVect_PAD_FPC, lV_PAD_FPC,
"PV_PAD_FPC", lV_PADLayer,
false,0);
327 new G4PVPlacement(0, threeVect_PIX_W, lV_PIX_W,
"PV_PIX_W", lV_PIXLayer,
false,0);
328 new G4PVPlacement(0, threeVect_PIX_Glue1, lV_PIX_Glue1,
"PV_PIX_Glue1", lV_PIXLayer,
false,0);
329 new G4PVPlacement(0, threeVect_PIX_Silicon, lV_PIXPlane,
"PV_PIX_Plane", lV_PIXLayer,
false,0);
330 new G4PVPlacement(0, threeVect_PIX_Glue2, lV_PIX_Glue2,
"PV_PIX_Glue2", lV_PIXLayer,
false,0);
331 new G4PVPlacement(0, threeVect_PIX_FPC, lV_PIX_FPC,
"PV_PIX_FPC", lV_PIXLayer,
false,0);
343 G4double posZ_PAD_Box = Start_Z + TotalLayerThickness + 0.5*PadOnlyThickness;
346 new G4PVPlacement(0,threeVect_PAD_Box, ss_PADBox, lV_PADonlyBox, motherPhy,
false, ilayer);
347 TotalLayerThickness += PadOnlyThickness;
352 new G4PVPlacement(0, threeVect_PIX_Layer,ss_PIX, lV_PIXLayer, motherPhy,
false, (NPadOnlyLayers+1) * (ilayer+1) -1);
357 if(
NumberPAD > NPadOnlyLayers * NumberPIX){
359 for(
G4int ilayer =0; ilayer<NPadtoAdd; ilayer++){
363 new G4PVPlacement(0, threeVect_PAD_Layer,ss_PAD, lV_PADLayer, motherPhy,
false, ilayer);
376 double End_X,
double End_Y,
double End_Z,
380 double Center_X = (Start_X + End_X)/2.;
381 double Center_Y = (Start_Y + End_Y)/2.;
382 double Width_X = End_X - Start_X;
383 double Width_Y = End_Y - Start_Y;
392 G4Box *PAD_Plane =
new G4Box(
"HPAD_Plane", Width_X/2.0, Width_Y/2.0,
PAD_Z/2.0);
394 G4Box *HC_Si_Box =
new G4Box(
"HC_Si_Box", Width_X/2., Width_Y/2., TotalLayerThickness/2.);
418 std::pair<G4LogicalVolume*, int> pair_PAD= std::make_pair(lV_PAD_Silicon, infoval);
421 std::pair<G4LogicalVolume*, int> pair_Pb = std::make_pair(lV_HCal_Absorber,infoval);
423 std::pair<G4LogicalVolume*, int> pair_Glue1 = std::make_pair(lV_PAD_Glue1,infoval);
424 std::pair<G4LogicalVolume*, int> pair_Glue2 = std::make_pair(lV_PAD_Glue2,infoval);
425 std::pair<G4LogicalVolume*, int> pair_FPC = std::make_pair(lV_PAD_FPC,infoval);
454 new G4PVPlacement(0, threeVect_HC_Absorber, lV_HCal_Absorber,
"PV_PAD_W", lV_HCal_Layer,
false,0);
455 new G4PVPlacement(0, threeVect_HC_Glue1, lV_PAD_Glue1,
"PV_PAD_Glue1", lV_HCal_Layer,
false,0);
456 new G4PVPlacement(0, threeVect_HC_Silicon, lV_PADPlane,
"PV_PAD_Plane", lV_HCal_Layer,
false,0);
457 new G4PVPlacement(0, threeVect_HC_Glue2, lV_PAD_Glue2,
"PV_PAD_Glue2", lV_HCal_Layer,
false,0);
458 new G4PVPlacement(0, threeVect_HC_FPC, lV_PAD_FPC,
"PV_PAD_FPC", lV_HCal_Layer,
false,0);
464 new G4PVPlacement(0, threeVect_HC_Si_Box,
"PV_HC_Si_Box", lV_HC_Si_Box, motherPhy,
false, 0);
474 double End_X,
double End_Y,
double End_Z,
479 double Center_X = (Start_X + End_X)/2.;
480 double Center_Y = (Start_Y + End_Y)/2.;
481 double Width_X = End_X - Start_X;
482 double Width_Y = End_Y - Start_Y;
492 G4Box* HCal_Box =
new G4Box(
"HCal_Box", Width_X/2.0, Width_Y/2.0, TotalTowerThickness/2.);
513 std::pair<G4LogicalVolume*, int> pair_Scint= std::make_pair(lV_HCal_Scintillator, infoval);
516 std::pair<G4LogicalVolume*, int> pair_Abs = std::make_pair(lV_HCal_Absorber, infoval);
532 new G4PVPlacement(0, threeVect_LogV_HCal_Scintillator, lV_HCal_SciPlane,
"PV_HCal_Sci", lV_HCal_Layer,
false,0);
533 new G4PVPlacement(0, threeVect_LogV_HCal_Absorber, lV_HCal_Absorber,
"PV_HCal_Abs", lV_HCal_Layer,
false,0);
534 new G4PVPlacement(0, threeVect_LogV_HCal_Gap, lV_HCal_Gap,
"PV_HCal_Gap", lV_HCal_Layer,
false,0);
538 double TotalThicknessCreated = 0;
540 G4double posZ_HCal_Box = Start_Z + TotalThicknessCreated + TotalTowerThickness * 0.5;
543 new G4PVPlacement(0, threeVect_LogV_HCal_Box, ss_HCAL_Box, lV_HCal_Box,motherPhy,
false,ibox);
545 TotalThicknessCreated += TotalTowerThickness;
551 _z_HCSci[1] = Start_Z+TotalThicknessCreated;
601 std::cout<<
"This is EICG4ZDCStructure"<<std::endl;
629 std::ofstream map_file;
630 std::string
filename =
"ZDC_"+d+
"_mapping.txt";
631 map_file.open(filename,std::ios::out);
633 map_file<<
"# ZDC_"<<d<<std::endl;
634 map_file<<
"Gx0 "<<
"\t"<<
"-962.4"<<std::endl;
635 map_file<<
"Gy0 "<<
"\t"<<
"0."<<std::endl;
636 map_file<<
"Gz0 "<<
"\t"<<
"37000."<<std::endl;
637 map_file<<
"Grot_x "<<
"\t"<<
"0."<<std::endl;
638 map_file<<
"Grot_y "<<
"\t"<<
"-0.025"<<std::endl;
639 map_file<<
"Grot_z "<<
"\t"<<
"0."<<std::endl;
646 map_file<<
"#Tower ID <-> Layer ID"<<std::endl;
648 map_file<<
"iT_iL "<<iL<<
"\t"<<2*iL+1<<std::endl;
650 map_file<<
"#Tower "<<
"\t"<<
"iLayer "<<
"\t"<<
"iX "<<
"\t"<<
"iY "<<
"\t"
651 <<
"x_cnt " <<
"\t"<<
"y_cnt " <<
"\t"<<
"z_cnt "<<
"\t"
652 <<
"size_x "<<
"\t"<<
"size_y "<<
"\t"<<
"size_z"<<std::endl;
656 double z_cnt = offsetZ +
CTower_Z/2;
658 for(
int ix = 0; ix <
nCTowerX; ix++){
661 for(
int iy = 0; iy <
nCTowerY; iy++){
664 map_file<<
"Tower "<<iL<<
"\t"<<ix<<
"\t"<<iy<<
"\t"
665 <<x_cnt<<
"\t"<<y_cnt<<
"\t"<<z_cnt<<
"\t"
674 }
else if (d==
"SiPixel"){
679 map_file<<
"#Tower ID <-> Layer ID"<<std::endl;
680 for(
int iL=0; iL<nPixLayer; iL++){
682 map_file<<
"iT_iL "<<iL<<
"\t"<<2*iL<<std::endl;
684 map_file<<
"iT_iL "<<iL<<
"\t"
688 map_file<<
"#Tower "<<
"\t"<<
"iLayer "<<
"\t"<<
"iX "<<
"\t"<<
"iY "<<
"\t"
689 <<
"x_cnt " <<
"\t"<<
"y_cnt " <<
"\t"<<
"z_cnt "<<
"\t"
690 <<
"size_x "<<
"\t"<<
"size_y "<<
"\t"<<
"size_z"<<std::endl;
692 for(
int iL=0; iL < nPixLayer; iL++){
696 double z_cnt = offsetZ +
PIX_Z/2;
704 for(
int ix = 0; ix <
NpixX; ix++){
705 double x_cnt = (ix - NpixX/2) *
PIX_X +
PIX_X/2.;
707 for(
int iy = 0; iy <
NpixY; iy++){
708 double y_cnt = (iy - NpixY/2) *
PIX_Y +
PIX_Y/2.;
710 map_file<<
"Tower "<<iL<<
"\t"<<ix<<
"\t"<<iy<<
"\t"
711 <<x_cnt<<
"\t"<<y_cnt<<
"\t"<<z_cnt<<
"\t"
718 }
else if(d==
"SiPad"){
723 map_file<<
"#Tower ID <-> Layer ID"<<std::endl;
726 map_file<<
"iT_iL "<<iTower<<
"\t"
727 <<2*
nCTowerZ + iB*(NPadOnlyLayers+1)+iL+1<<std::endl;
732 map_file<<
"iT_iL "<<iTower<<
"\t"
738 map_file<<
"#Tower "<<
"\t"<<
"iLayer "<<
"\t"<<
"iX "<<
"\t"<<
"iY "<<
"\t"
739 <<
"x_cnt " <<
"\t"<<
"y_cnt " <<
"\t"<<
"z_cnt "<<
"\t"
740 <<
"size_x "<<
"\t"<<
"size_y "<<
"\t"<<
"size_z"<<std::endl;
749 double z_cnt = offsetZ +
PAD_Z/2;
752 for(
int ix = 0; ix <
NpadX; ix++){
753 double x_cnt = (ix - NpadX/2) *
PAD_X +
PAD_X/2.;
755 for(
int iy = 0; iy <
NpadY; iy++){
756 double y_cnt = (iy - NpadY/2) *
PAD_Y +
PAD_Y/2.;
758 map_file<<
"Tower "<<iTower<<
"\t"<<ix<<
"\t"<<iy<<
"\t"
759 <<x_cnt<<
"\t"<<y_cnt<<
"\t"<<z_cnt<<
"\t"
775 double z_cnt = offsetZ +
PAD_Z/2;
778 for(
int ix = 0; ix <
NpadX; ix++){
779 double x_cnt = (ix - NpadX/2) *
PAD_X +
PAD_X/2.;
781 for(
int iy = 0; iy <
NpadY; iy++){
782 double y_cnt = (iy - NpadY/2) *
PAD_Y +
PAD_Y/2.;
784 map_file<<
"Tower "<<iTower<<
"\t"<<ix<<
"\t"<<iy<<
"\t"
785 <<x_cnt<<
"\t"<<y_cnt<<
"\t"<<z_cnt<<
"\t"
798 map_file<<
"#Tower ID <-> Layer ID"<<std::endl;
800 map_file<<
"iT_iL "<<iB<<
"\t"
805 map_file<<
"#Tower "<<
"\t"<<
"iLayer "<<
"\t"<<
"iX "<<
"\t"<<
"iY "<<
"\t"
806 <<
"x_cnt " <<
"\t"<<
"y_cnt " <<
"\t"<<
"z_cnt "<<
"\t"
807 <<
"size_x "<<
"\t"<<
"size_y "<<
"\t"<<
"size_z"<<std::endl;
810 std::cout<<
"HC mapping: "<<offsetZ<<
" "<<HCTower_Z<<std::endl;
814 double z_cnt = offsetZ + HCTower_Z/2.;
815 offsetZ += HCTower_Z;
823 map_file<<
"Tower "<<iB<<
"\t"<<ix<<
"\t"<<iy<<
"\t"
824 <<x_cnt<<
"\t"<<y_cnt<<
"\t"<<z_cnt<<
"\t"