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,
59 G4VPhysicalVolume *motherPhy) {
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;
67 G4Box* PIX_Silicon =
new G4Box(
"CPIX_Silicon",
PIX_X/2.0,
PIX_Y/2.0,
PIX_Z/2.0);
68 G4Box* PIX_Glue2 =
new G4Box(
"CPIX_Glue2", Width_X/2.0, Width_Y/2.0,
PIX_Glue2_Z/2.0);
69 G4Box* PIX_FPC =
new G4Box(
"CPIX_FPC", Width_X/2.0, Width_Y/2.0,
PIX_FPC_Z/2.0);
71 G4Box *CrysEnvelope=
new G4Box(
"CrysEnvelope",
CTower_X*0.5 ,Width_Y*0.5,
CTower_Z*0.5);
72 G4Box *CrysBox =
new G4Box(
"CrysBox", Width_X*0.5 ,Width_Y*0.5,
CTower_Z*0.5);
73 G4Box *PIXPlane =
new G4Box(
"CPIXPlane", Width_X/2.0, Width_Y/2.0,
PIX_Z/2.0);
74 G4Box *PIXEnvelope =
new G4Box(
"CPIXEnvelope",
PIX_X/2.0, Width_Y/2.0,
PIX_Z/2.0);
76 G4LogicalVolume* lV_PIX_Silicon =
new G4LogicalVolume( PIX_Silicon,
fmat_Si,
"lV_Crystal_PIX_Silicon" );
77 G4LogicalVolume* lV_PIX_Glue2 =
new G4LogicalVolume( PIX_Glue2,
fmat_PET,
"lV_Crystal_PIX_Glue2");
78 G4LogicalVolume* lV_PIX_FPC =
new G4LogicalVolume( PIX_FPC,
fmat_PET,
"lV_Crystal_PIX_FPC");
79 G4LogicalVolume* lV_Crystal =
new G4LogicalVolume( Crystal,
fmat_Crystal,
"lV_Crystal");
80 G4LogicalVolume* lV_CrysEnvelope=
new G4LogicalVolume( CrysEnvelope,
fmat_World,
"lV_CrysEnvelope");
81 G4LogicalVolume* lV_CrysBox =
new G4LogicalVolume( CrysBox,
fmat_World,
"lV_CrysBox");
82 G4LogicalVolume* lV_PIXPlane =
new G4LogicalVolume( PIXPlane,
fmat_World,
"lV_CPIXPlane");
83 G4LogicalVolume* lV_PIXEnvelope =
new G4LogicalVolume( PIXEnvelope,
fmat_World,
"lV_CPIXEnvelope");
86 lV_PIX_Silicon->SetVisAttributes(
fvisPIX);
87 lV_PIX_Glue2->SetVisAttributes(
fvisDM);
88 lV_PIX_FPC->SetVisAttributes(
fvisDM);
90 lV_CrysBox->SetVisAttributes(G4VisAttributes::Invisible);
91 lV_CrysEnvelope->SetVisAttributes(G4VisAttributes::Invisible);
92 lV_PIXPlane->SetVisAttributes(G4VisAttributes::Invisible);
93 lV_PIXEnvelope->SetVisAttributes(G4VisAttributes::Invisible);
111 int NdivX = (int)(Width_X/
PIX_X);
112 new G4PVReplica(
"PV_CPIXEnvelope", lV_PIXEnvelope, lV_PIXPlane, kXAxis, NdivX,
PIX_X,0);
113 int NdivY = (int)(Width_Y/
PIX_Y);
114 new G4PVReplica(
"PV_CPIX", lV_PIX_Silicon, lV_PIXEnvelope, kYAxis, NdivY,
PIX_Y,0);
117 new G4PVReplica(
"PV_CrysEnvelope", lV_CrysEnvelope, lV_CrysBox, kXAxis,
nCTowerX,
CTower_X,0);
118 new G4PVReplica(
"PV_Crystal", lV_Crystal, lV_CrysEnvelope, kYAxis,
nCTowerY,
CTower_Y,0);
127 for(
int ilayer=0; ilayer<
nCTowerZ+1; ilayer++){
128 G4double position_Z_PIX_Silicon = Start_Z + offsetZ +
PIX_Z/2.;
133 G4ThreeVector threeVect_PIX_Silicon = G4ThreeVector(Center_X, Center_Y, position_Z_PIX_Silicon);
134 G4ThreeVector threeVect_PIX_Glue2 = G4ThreeVector(Center_X, Center_Y, position_Z_PIX_Glue2);
135 G4ThreeVector threeVect_PIX_FPC = G4ThreeVector(Center_X, Center_Y, position_Z_PIX_FPC);
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++){
153 G4double position_Z_Crystal = Start_Z + offsetZ +
CTower_Z/2.;
155 G4ThreeVector threeVect_Crystal = G4ThreeVector(Center_X, Center_Y, position_Z_Crystal);
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,
173 G4VPhysicalVolume *motherPhy) {
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;
187 G4Box* PAD_W =
new G4Box(
"PPAD_W", Width_X/2.0, Width_Y/2.0,
PAD_Absorber_Z/2.0);
188 G4Box* PAD_Glue1 =
new G4Box(
"PPAD_Glue1", Width_X/2.0, Width_Y/2.0,
PAD_Glue1_Z/2.0);
189 G4Box* PAD_Silicon =
new G4Box(
"PPAD_Silicon",
PAD_X/2.0,
PAD_Y/2.0,
PAD_Z/2.0);
190 G4Box* PAD_Glue2 =
new G4Box(
"PPAD_Glue2", Width_X/2.0, Width_Y/2.0,
PAD_Glue2_Z/2.0);
191 G4Box* PAD_FPC =
new G4Box(
"PPAD_FPC", Width_X/2.0, Width_Y/2.0,
PAD_FPC_Z/2.0);
192 G4Box *PAD_Plane =
new G4Box(
"PAD_Plane", Width_X/2.0, Width_Y/2.0,
PAD_Z/2.0);
193 G4Box *PAD_Envelope =
new G4Box(
"PAD_Envelope",
PAD_X/2.0, Width_Y/2.0,
PAD_Z/2.0);
194 G4Box *PAD_Layer =
new G4Box(
"PAD_Layer", Width_X/2.0, Width_Y/2.0,
PAD_Layer_Thickness/2.0);
195 G4Box *PADonlyBox =
new G4Box(
"PADonlyBox", Width_X/2.0, Width_Y/2.0, PadOnlyThickness/2.0);
198 G4Box* PIX_W =
new G4Box(
"PPIX_W", Width_X/2.0, Width_Y/2.0,
PIX_Absorber_Z/2.0);
199 G4Box* PIX_Glue1 =
new G4Box(
"PPIX_Glue1", Width_X/2.0, Width_Y/2.0,
PIX_Glue1_Z/2.0);
200 G4Box* PIX_Silicon =
new G4Box(
"PPIX_Silicon",
PIX_X/2.0,
PIX_Y/2.0,
PIX_Z/2.0);
201 G4Box* PIX_Glue2 =
new G4Box(
"PPIX_Glue2", Width_X/2.0, Width_Y/2.0,
PIX_Glue2_Z/2.0);
202 G4Box* PIX_FPC =
new G4Box(
"PPIX_FPC", Width_X/2.0, Width_Y/2.0,
PIX_FPC_Z/2.0);
203 G4Box *PIX_Plane =
new G4Box(
"PIX_Plane", Width_X/2.0, Width_Y/2.0,
PIX_Z/2.0);
204 G4Box *PIX_Envelope =
new G4Box(
"PIX_Envelope",
PIX_X/2.0, Width_Y/2.0,
PIX_Z/2.0);
205 G4Box *PIX_Layer =
new G4Box(
"PIX_Layer", Width_X/2.0, Width_Y/2.0,
PIX_Layer_Thickness/2.0);
211 G4LogicalVolume* lV_PAD_W =
new G4LogicalVolume( PAD_W,
fmat_W,
"lV_PAD_W");
212 G4LogicalVolume* lV_PAD_Glue1 =
new G4LogicalVolume( PAD_Glue1,
fmat_PET,
"lV_PAD_Glue1" );
213 G4LogicalVolume* lV_PAD_Silicon =
new G4LogicalVolume( PAD_Silicon,
fmat_Si,
"lV_PAD_Silicon" );
214 G4LogicalVolume* lV_PAD_Glue2 =
new G4LogicalVolume( PAD_Glue2,
fmat_PET,
"lV_PAD_Glue2");
215 G4LogicalVolume* lV_PAD_FPC =
new G4LogicalVolume( PAD_FPC,
fmat_PET,
"lV_PAD_FPC");
216 G4LogicalVolume* lV_PADPlane =
new G4LogicalVolume( PAD_Plane,
fmat_World,
"lV_PADPlane");
217 G4LogicalVolume* lV_PADEnvelope =
new G4LogicalVolume( PAD_Envelope,
fmat_World,
"lV_PADEnvelope");
218 G4LogicalVolume* lV_PADLayer =
new G4LogicalVolume( PAD_Layer,
fmat_World,
"lV_PADLayer");
219 G4LogicalVolume* lV_PADonlyBox =
new G4LogicalVolume( PADonlyBox,
fmat_World,
"lV_PADonlyBox");
222 G4LogicalVolume* lV_PIX_W =
new G4LogicalVolume( PIX_W,
fmat_W,
"lV_PIX_W");
223 G4LogicalVolume* lV_PIX_Glue1 =
new G4LogicalVolume( PIX_Glue1,
fmat_PET,
"lV_PIX_Glue1");
224 G4LogicalVolume* lV_PIX_Silicon =
new G4LogicalVolume( PIX_Silicon,
fmat_Si,
"lV_PIX_Silicon" );
225 G4LogicalVolume* lV_PIX_Glue2 =
new G4LogicalVolume( PIX_Glue2,
fmat_PET,
"lV_PIX_Glue2" );
226 G4LogicalVolume* lV_PIX_FPC =
new G4LogicalVolume( PIX_FPC,
fmat_PET,
"lV_PIX_FPC");
227 G4LogicalVolume* lV_PIXPlane =
new G4LogicalVolume( PIX_Plane,
fmat_World,
"lV_PIXPlane");
228 G4LogicalVolume* lV_PIXEnvelope =
new G4LogicalVolume( PIX_Envelope,
fmat_World,
"lV_PIXEnvelope");
229 G4LogicalVolume* lV_PIXLayer =
new G4LogicalVolume( PIX_Layer,
fmat_World,
"lV_PIXLayer");
231 lV_PAD_W->SetVisAttributes(
fvisW);
232 lV_PIX_W->SetVisAttributes(
fvisW);
234 lV_PAD_Silicon->SetVisAttributes(
fvisPAD);
235 lV_PIX_Silicon->SetVisAttributes(
fvisPIX);
237 lV_PAD_Glue1->SetVisAttributes(
fvisDM);
238 lV_PAD_Glue2->SetVisAttributes(
fvisDM);
239 lV_PAD_FPC->SetVisAttributes(
fvisDM);
240 lV_PIX_Glue1->SetVisAttributes(
fvisDM);
241 lV_PIX_Glue2->SetVisAttributes(
fvisDM);
242 lV_PIX_FPC->SetVisAttributes(
fvisDM);
244 lV_PADPlane->SetVisAttributes(G4VisAttributes::Invisible);
245 lV_PADEnvelope->SetVisAttributes(G4VisAttributes::Invisible);
246 lV_PADLayer->SetVisAttributes(G4VisAttributes::Invisible);
247 lV_PADonlyBox->SetVisAttributes(G4VisAttributes::Invisible);
248 lV_PIXPlane->SetVisAttributes(G4VisAttributes::Invisible);
249 lV_PIXEnvelope->SetVisAttributes(G4VisAttributes::Invisible);
250 lV_PIXLayer->SetVisAttributes(G4VisAttributes::Invisible);
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);
290 new G4PVReplica(
"PV_PADEnvelope", lV_PADEnvelope, lV_PADPlane, kXAxis,
NpadX,
PAD_X,0);
291 new G4PVReplica(
"PV_PAD", lV_PAD_Silicon, lV_PADEnvelope, kYAxis,
NpadY,
PAD_Y,0);
293 new G4PVReplica(
"PV_PIXEnvelope", lV_PIXEnvelope, lV_PIXPlane, kXAxis,
NpixX,
PIX_X,0);
294 new G4PVReplica(
"PV_PIX", lV_PIX_Silicon, lV_PIXEnvelope, kYAxis,
NpixY,
PIX_Y,0);
303 G4ThreeVector threeVect_PAD_Silicon = G4ThreeVector(0, 0, posZ_PAD_Silicon);
304 G4ThreeVector threeVect_PAD_W = G4ThreeVector(0, 0, posZ_PAD_Absorber);
305 G4ThreeVector threeVect_PAD_Glue1 = G4ThreeVector(0, 0, posZ_PAD_Glue1);
306 G4ThreeVector threeVect_PAD_Glue2 = G4ThreeVector(0, 0, posZ_PAD_Glue2);
307 G4ThreeVector threeVect_PAD_FPC = G4ThreeVector(0, 0, posZ_PAD_FPC);
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);
321 G4ThreeVector threeVect_PIX_Silicon = G4ThreeVector(0, 0, posZ_PIX_Silicon);
322 G4ThreeVector threeVect_PIX_W = G4ThreeVector(0, 0, posZ_PIX_Absorber);
323 G4ThreeVector threeVect_PIX_Glue1 = G4ThreeVector(0, 0, posZ_PIX_Glue1);
324 G4ThreeVector threeVect_PIX_Glue2 = G4ThreeVector(0, 0, posZ_PIX_Glue2);
325 G4ThreeVector threeVect_PIX_FPC = G4ThreeVector(0, 0, posZ_PIX_FPC);
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);
334 new G4PVReplica(
"PV_PADLayers", lV_PADLayer, lV_PADonlyBox, kZAxis, NPadOnlyLayers,
PAD_Layer_Thickness,0);
339 G4double TotalLayerThickness = 0;
341 for(G4int ilayer=0; ilayer<
NumberPIX; ilayer++){
343 G4double posZ_PAD_Box = Start_Z + TotalLayerThickness + 0.5*PadOnlyThickness;
344 G4ThreeVector threeVect_PAD_Box = G4ThreeVector(Center_X, Center_Y, posZ_PAD_Box);
346 new G4PVPlacement(0,threeVect_PAD_Box, ss_PADBox, lV_PADonlyBox, motherPhy,
false, ilayer);
347 TotalLayerThickness += PadOnlyThickness;
350 G4ThreeVector threeVect_PIX_Layer = G4ThreeVector(Center_X, Center_Y, posZ_PIX_Layer);
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++){
361 G4ThreeVector threeVect_PAD_Layer = G4ThreeVector(Center_X, Center_Y, posZ_PAD_Layer);
363 new G4PVPlacement(0, threeVect_PAD_Layer,ss_PAD, lV_PADLayer, motherPhy,
false, ilayer);
376 double End_X,
double End_Y,
double End_Z,
377 G4VPhysicalVolume *motherPhy) {
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;
386 G4Box* HCal_Absorber =
new G4Box(
"HCal_SiAbsorber", Width_X/2.0, Width_Y/2.0,
HCAL_Z_Absorber/2.0);
388 G4Box* PAD_Glue1 =
new G4Box(
"HPAD_Glue1", Width_X/2.0, Width_Y/2.0,
PAD_Glue1_Z/2.0);
389 G4Box* PAD_Silicon =
new G4Box(
"HPAD_Silicon",
PAD_X/2.0,
PAD_Y/2.0,
PAD_Z/2.0);
390 G4Box* PAD_Glue2 =
new G4Box(
"HPAD_Glue2", Width_X/2.0, Width_Y/2.0,
PAD_Glue2_Z/2.0);
391 G4Box* PAD_FPC =
new G4Box(
"HPAD_FPC", Width_X/2.0, Width_Y/2.0,
PAD_FPC_Z/2.0);
392 G4Box *PAD_Plane =
new G4Box(
"HPAD_Plane", Width_X/2.0, Width_Y/2.0,
PAD_Z/2.0);
393 G4Box *PAD_Envelope =
new G4Box(
"HPAD_Envelope",
PAD_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.);
396 G4LogicalVolume* lV_HCal_Absorber=
new G4LogicalVolume( HCal_Absorber,
fmat_Pb,
"lV_HCal_SiAbsorber");
397 G4LogicalVolume* lV_HCal_Layer =
new G4LogicalVolume( HCal_Layer,
fmat_World,
"lV_HCal_SiLayer");
398 G4LogicalVolume* lV_PAD_Glue1 =
new G4LogicalVolume( PAD_Glue1,
fmat_PET,
"lV_HCal_PAD_Glue1" );
399 G4LogicalVolume* lV_PAD_Silicon =
new G4LogicalVolume( PAD_Silicon,
fmat_Si,
"lV_HCal_PAD_Silicon" );
400 G4LogicalVolume* lV_PAD_Glue2 =
new G4LogicalVolume( PAD_Glue2,
fmat_PET,
"lV_HCal_PAD_Glue2");
401 G4LogicalVolume* lV_PAD_FPC =
new G4LogicalVolume( PAD_FPC,
fmat_PET,
"lV_HCal_PAD_FPC");
402 G4LogicalVolume* lV_PADPlane =
new G4LogicalVolume( PAD_Plane,
fmat_World,
"lV_HPADPlane");
403 G4LogicalVolume* lV_PADEnvelope =
new G4LogicalVolume( PAD_Envelope,
fmat_World,
"lV_HPADEnvelope");
404 G4LogicalVolume* lV_HC_Si_Box =
new G4LogicalVolume( HC_Si_Box,
fmat_World,
"lV_HC_Si_Box");
406 lV_HCal_Absorber->SetVisAttributes(
fvisPb);
407 lV_PAD_Silicon->SetVisAttributes(
fvisPAD);
408 lV_PAD_Glue1->SetVisAttributes(
fvisDM);
409 lV_PAD_Glue2->SetVisAttributes(
fvisDM);
410 lV_PAD_FPC->SetVisAttributes(
fvisDM);
412 lV_PADPlane->SetVisAttributes(G4VisAttributes::Invisible);
413 lV_PADEnvelope->SetVisAttributes(G4VisAttributes::Invisible);
414 lV_HCal_Layer->SetVisAttributes(G4VisAttributes::Invisible);
415 lV_HC_Si_Box->SetVisAttributes(G4VisAttributes::Invisible);
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);
438 new G4PVReplica(
"PV_PADEnvelope", lV_PADEnvelope, lV_PADPlane, kXAxis,
NpadX,
PAD_X,0);
439 new G4PVReplica(
"PV_PAD", lV_PAD_Silicon, lV_PADEnvelope, kYAxis,
NpadY,
PAD_Y,0);
448 G4ThreeVector threeVect_HC_Absorber = G4ThreeVector(0, 0, posZ_HC_Absorber);
449 G4ThreeVector threeVect_HC_Glue1 = G4ThreeVector(0, 0, posZ_HC_Glue1);
450 G4ThreeVector threeVect_HC_Silicon = G4ThreeVector(0, 0, posZ_HC_Silicon);
451 G4ThreeVector threeVect_HC_Glue2 = G4ThreeVector(0, 0, posZ_HC_Glue2);
452 G4ThreeVector threeVect_HC_FPC = G4ThreeVector(0, 0, posZ_HC_FPC);
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);
461 new G4PVReplica(
"HC_Layers", lV_HCal_Layer, lV_HC_Si_Box,kZAxis, HCALSiNumberOfLayers,
HCal_Si_Layer_Thickness,0);
463 G4ThreeVector threeVect_HC_Si_Box = G4ThreeVector(Center_X, Center_Y, Start_Z + TotalLayerThickness *0.5);
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,
475 G4VPhysicalVolume *motherPhy) {
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;
486 G4Box* HCal_Absorber =
new G4Box(
"HCal_Absorber", Width_X/2.0, Width_Y/2.0,
HCAL_Z_Absorber/2.0);
488 G4Box* HCal_Gap =
new G4Box(
"HCal_Gap", Width_X/2.0, Width_Y/2.0,
HCAL_Z_Gap/2.0);
489 G4Box* HCal_Layer =
new G4Box(
"HCal_Layer", Width_X/2.0, Width_Y/2.0,
HCal_Layer_Thickness/2.0);
490 G4Box* HCal_SciPlane =
new G4Box(
"HCal_SciPlane", Width_X/2.0, Width_Y/2.0,
HCAL_Z_Scintillator/2.0);
492 G4Box* HCal_Box =
new G4Box(
"HCal_Box", Width_X/2.0, Width_Y/2.0, TotalTowerThickness/2.);
495 G4LogicalVolume* lV_HCal_Absorber =
new G4LogicalVolume( HCal_Absorber,
fmat_Pb,
"lV_HCal_Absorber");
496 G4LogicalVolume* lV_HCal_Scintillator =
new G4LogicalVolume( HCal_Scintillator,
fmat_Sci,
"lV_HCal_Scintillator");
497 G4LogicalVolume* lV_HCal_Gap =
new G4LogicalVolume( HCal_Gap,
fmat_World,
"lV_HCal_Gap");
498 G4LogicalVolume* lV_HCal_Layer =
new G4LogicalVolume(HCal_Layer,
fmat_World,
"lV_HCal_Layer");
499 G4LogicalVolume* lV_HCal_SciPlane =
new G4LogicalVolume(HCal_SciPlane,
fmat_World,
"lV_HCal_SciPlane");
500 G4LogicalVolume* lV_HCal_SciEnvelope =
new G4LogicalVolume(HCal_SciEnvelope,
fmat_World,
"lV_HCal_SciEnvelope");
501 G4LogicalVolume* lV_HCal_Box =
new G4LogicalVolume(HCal_Box,
fmat_World,
"lV_HCal_Box");
503 lV_HCal_Absorber->SetVisAttributes(
fvisPb);
504 lV_HCal_Scintillator->SetVisAttributes(
fvisSci);
506 lV_HCal_Gap->SetVisAttributes(G4VisAttributes::Invisible);
507 lV_HCal_Layer->SetVisAttributes(G4VisAttributes::Invisible);
508 lV_HCal_SciPlane->SetVisAttributes(G4VisAttributes::Invisible);
509 lV_HCal_SciEnvelope->SetVisAttributes(G4VisAttributes::Invisible);
510 lV_HCal_Box->SetVisAttributes(G4VisAttributes::Invisible);
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);
529 G4ThreeVector threeVect_LogV_HCal_Absorber = G4ThreeVector(0, 0, posZ_HCal_Absorber);
530 G4ThreeVector threeVect_LogV_HCal_Scintillator = G4ThreeVector(0, 0, posZ_HCal_Scintillator);
531 G4ThreeVector threeVect_LogV_HCal_Gap = G4ThreeVector(0, 0, posZ_HCal_Gap);
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);
536 new G4PVReplica(
"PV_HCal_Layers",lV_HCal_Layer, lV_HCal_Box, kZAxis, NLayersHCALTower,
HCal_Layer_Thickness,0);
538 double TotalThicknessCreated = 0;
540 G4double posZ_HCal_Box = Start_Z + TotalThicknessCreated + TotalTowerThickness * 0.5;
541 G4ThreeVector threeVect_LogV_HCal_Box = G4ThreeVector(Center_X, Center_Y, posZ_HCal_Box);
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;
560 G4NistManager* material_Man = G4NistManager::Instance();
562 fmat_World = material_Man->FindOrBuildMaterial(
"G4_AIR");
564 fmat_Crystal = material_Man->FindOrBuildMaterial(
"G4_PbWO4");
567 fmat_W =
new G4Material(
"tungsten",18.73 *
g/
cm3,3);
569 G4Element* W = material_Man->FindOrBuildElement(74);
570 G4Element* Ni = material_Man->FindOrBuildElement(28);
571 G4Element* Cu = material_Man->FindOrBuildElement(29);
572 fmat_W->AddElement(W,94.3 *perCent);
573 fmat_W->AddElement(Ni,3.77 *perCent);
574 fmat_W->AddElement(Cu,1.89 *perCent);
578 G4Element*
O = material_Man->FindOrBuildElement(8);
579 G4Element* elH =
new G4Element(
"Hydrogen",
"H", 1, 1.00794 *
g/mole);
580 G4Element* elC =
new G4Element(
"Carbon",
"C", 6, 12.011 *
g/mole);
586 G4double density= 1.032 *
g/
cm3;
587 fmat_Sci =
new G4Material(
"Scintillator",density,2);
592 fmat_Si = material_Man->FindOrBuildMaterial(
"G4_Si");
593 fmat_Pb = material_Man->FindOrBuildMaterial(
"G4_Pb");
594 fmat_Cu = material_Man->FindOrBuildMaterial(
"G4_Cu");
595 fmat_Fe = material_Man->FindOrBuildMaterial(
"G4_Fe");
601 std::cout<<
"This is EICG4ZDCStructure"<<std::endl;
607 fvisCrystal =
new G4VisAttributes(G4Color(G4Colour::Yellow()));
608 fvisPIX =
new G4VisAttributes(G4Color(G4Colour::Magenta()));
609 fvisPAD =
new G4VisAttributes(G4Color(G4Colour::Cyan()));
610 fvisDM =
new G4VisAttributes(G4Color(G4Colour::Grey()));
611 fvisW =
new G4VisAttributes(G4Color(0.5,0.5,0.8,0.6));
612 fvisPb =
new G4VisAttributes(G4Color(.3,.3,.3,0.6));
613 fvisSci =
new G4VisAttributes(G4Color(G4Colour::Green()));
618 fvisDM->SetForceSolid(
true);
619 fvisW->SetForceSolid(
true);
620 fvisPb->SetForceSolid(
true);
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"