4 #include <phparameter/PHParameters.h>
12 #include <Geant4/G4Box.hh>
13 #include <Geant4/G4Cons.hh>
14 #include <Geant4/G4Element.hh>
15 #include <Geant4/G4LogicalBorderSurface.hh>
16 #include <Geant4/G4LogicalSkinSurface.hh>
17 #include <Geant4/G4LogicalVolume.hh>
18 #include <Geant4/G4Material.hh>
19 #include <Geant4/G4MaterialPropertiesTable.hh>
20 #include <Geant4/G4OpticalSurface.hh>
21 #include <Geant4/G4PVPlacement.hh>
22 #include <Geant4/G4Polyhedra.hh>
23 #include <Geant4/G4RotationMatrix.hh>
24 #include <Geant4/G4String.hh>
25 #include <Geant4/G4SubtractionSolid.hh>
26 #include <Geant4/G4SystemOfUnits.hh>
27 #include <Geant4/G4ThreeVector.hh>
28 #include <Geant4/G4Transform3D.hh>
29 #include <Geant4/G4Types.hh>
30 #include <Geant4/G4UnionSolid.hh>
31 #include <Geant4/G4VisAttributes.hh>
49 , m_SuperDetector(
"NONE")
50 , m_Params(parameters)
52 , _towerlogicnameprefix(
"HybridHomogeneousCalorimeterTower")
53 , m_IsActive(m_Params->get_int_param(
"active"))
54 , m_AbsorberActive(m_Params->get_int_param(
"absorberactive"))
55 , m_doLightProp(
false)
84 cout <<
"PHG4HybridHomogeneousCalorimeterDetector: Begin Construction" << endl;
89 cout <<
"ERROR in PHG4HybridHomogeneousCalorimeterDetector: No tower mapping file specified. Abort detector construction." << endl;
90 cout <<
"Please run set_string_param(\"mappingtower\", std::string filename ) first." << endl;
117 const G4int nZSlices = 4;
118 G4double zPosSlice[nZSlices] = {0, 0.001, frame_dz - 0.001, frame_dz};
119 G4double rinPosSlice[nZSlices] = {frame_r_in, frame_r_in, frame_r_in, frame_r_in};
120 G4double routPosSlice[nZSlices] = {frame_r_out, frame_r_out, frame_r_out, frame_r_out};
141 return frame_full_logic;
149 cout <<
"PHG4HybridHomogeneousCalorimeterDetector: Build logical volume for single tower..." << endl;
162 bool doWrapping =
false;
163 if (reflective_foil_thickness > 0 || tedlar_thickness > 0) doWrapping =
true;
168 bool doSensors =
false;
169 if (sensor_dimension > 0 && sensor_count > 0 && sensor_thickness > 0) doSensors =
true;
171 G4double tower_dx = crystal_dx + 2 * (carbon_thickness + airgap_crystal_carbon + reflective_foil_thickness + tedlar_thickness);
172 G4double tower_dy = crystal_dy + 2 * (carbon_thickness + airgap_crystal_carbon + reflective_foil_thickness + tedlar_thickness);
173 G4double tower_dz = crystal_dz + 2 * (carbon_thickness);
174 if (doSensors) tower_dz = crystal_dz + 2 * (carbon_thickness) + sensor_thickness;
185 G4VSolid* single_tower_solid =
new G4Box(
G4String(
"single_tower_solid"), tower_dx / 2.0, tower_dy / 2.0, tower_dz / 2.0);
195 if (carbon_frame_style == 0 && carbon_thickness > 0)
201 ((tower_dz / 2.0) - 1 *
mm));
203 G4VSolid* cutout_solid =
new G4Box(
G4String(
"lead_solid"), crystal_dx / 2.0, crystal_dy / 2.0, crystal_dz);
222 else if (carbon_frame_style == 1)
229 (carbon_frame_depth / 2.0));
230 G4VSolid* cutout_solid =
new G4Box(
G4String(
"cutout_solid"), (tower_dx - 2 * (carbon_thickness)) / 2.0, (tower_dy - 2 * (carbon_thickness)) / 2.0, crystal_dz);
251 (carbon_thickness / 2.0));
252 G4VSolid* cutout_solid_face =
new G4Box(
G4String(
"cutout_solid_face"), (tower_dx - 2.0 * carbon_face_lip) / 2.0, (tower_dy - 2.0 * carbon_face_lip) / 2.0, (tower_dz));
255 Carbon_hunk_solid_face,
272 (crystal_dx + 2 * reflective_foil_thickness) / 2.0,
273 (crystal_dy + 2 * reflective_foil_thickness) / 2.0,
274 ((crystal_dz / 2.0) - 1 *
mm));
276 G4VSolid* cutout_solid_VM2000 =
new G4Box(
G4String(
"cutout_solid_VM2000"), crystal_dx / 2.0, crystal_dy / 2.0, crystal_dz);
293 (crystal_dx + 2 * reflective_foil_thickness + 2 * tedlar_thickness) / 2.0,
294 (crystal_dy + 2 * reflective_foil_thickness + 2 * tedlar_thickness) / 2.0,
295 ((crystal_dz / 2.0) - 1 *
mm));
297 G4VSolid* cutout_solid_Tedlar =
new G4Box(
G4String(
"cutout_solid_Tedlar"), (crystal_dx + 2 * reflective_foil_thickness) / 2.0, (crystal_dy + 2 * reflective_foil_thickness) / 2.0, crystal_dz);
340 G4VSolid* single_sensor_solid =
new G4Box(
"single_sensor_solid", sensor_dimension / 2., sensor_dimension / 2., sensor_thickness / 2.);
356 cout <<
"PHG4HybridHomogeneousCalorimeterDetector: Building logical volume for single tower done." << endl;
358 return single_tower_logic;
364 typedef std::map<std::string, towerposition>::iterator it_type;
369 cout <<
"PHG4HybridHomogeneousCalorimeterDetector: Place tower " << iterator->first
370 <<
" idx_j = " << iterator->second.idx_j <<
", idx_k = " << iterator->second.idx_k
371 <<
" at x = " << iterator->second.x <<
" , y = " << iterator->second.y <<
" , z = " << iterator->second.z << endl;
373 int copyno = (iterator->second.idx_j << 16) + iterator->second.idx_k;
399 if ((setting > 0.) && (setting < 1.))
403 if (
Verbosity()) cout <<
"Set G4_PbWO4..." << endl;
405 else if ((setting > 1.) && (setting < 2.))
408 if (
Verbosity()) cout <<
"Set G4_GLASS_LEAD..." << endl;
410 else if ((setting > 2.) && (setting < 3.))
413 if (
Verbosity()) cout <<
"Set G4_BARIUM_SULFATE..." << endl;
415 else if ((setting > 3.) && (setting < 4.))
418 if (
Verbosity()) cout <<
"Set G4_CESIUM_IODIDE..." << endl;
420 else if ((setting > 4.) && (setting < 5.))
422 material_Scin =
new G4Material(
"material_Scin", 4.5 *
g /
cm3, 5);
429 if (
Verbosity()) cout <<
"Set Sciglass..." << endl;
431 else if ((setting > 5.) && (setting < 6.))
433 material_Scin =
new G4Material(
"material_Scin", 9.0 *
g /
cm3, 5);
440 if (
Verbosity()) cout <<
"Set heavier Sciglass..." << endl;
442 else if ((setting > 6.) && (setting < 7.))
444 material_Scin =
new G4Material(
"material_Scin", 4.5 *
g /
cm3, 3);
449 if (
Verbosity()) cout <<
"Set Sciglass contained lead..." << endl;
451 else if ((setting > 7.) && (setting < 8.))
453 material_Scin =
new G4Material(
"material_Scin", 4.22 *
g /
cm3, 4);
459 if (
Verbosity()) cout <<
"Set Sciglass from Nathaly" << endl;
461 else if ((setting > 8.) && (setting < 9.))
463 material_Scin =
new G4Material(
"material_Scin", 3.8 *
g /
cm3, 3);
468 if (
Verbosity()) cout <<
"Set Sciglass from g4e" << endl;
471 return material_Scin;
484 const G4int ntab = 2;
490 tab->
AddProperty(
"FASTCOMPONENT", scin_en, scin_fast, ntab);
500 tab->
AddProperty(
"ABSLENGTH", opt_en, opt_abs, ntab);
516 const G4int ntab = 2;
518 G4double reflectivity[] = {0.8, 0.8};
521 surfmat->
AddProperty(
"REFLECTIVITY", opt_en, reflectivity, ntab);
522 surfmat->
AddProperty(
"EFFICIENCY", opt_en, efficiency, ntab);
543 const G4int ntab = 2;
546 G4double reflectivity[] = {0.1, 0.1};
552 surfmat->
AddProperty(
"REFLECTIVITY", opt_en, reflectivity, ntab);
553 surfmat->
AddProperty(
"EFFICIENCY", opt_en, efficiency, ntab);
560 static string matname =
"HybridHomogeneousTedlar";
565 tedlar =
new G4Material(matname, density_tedlar, 3);
575 static string matname =
"HybridHomogeneousVM2000";
580 VM2000 =
new G4Material(matname, density_VM2000, 3);
586 const G4int nEntriesVM2000 = 31;
588 G4double photonE_VM2000[nEntriesVM2000] =
589 {1.37760 *
eV, 1.45864 *
eV, 1.54980 *
eV, 1.65312 *
eV, 1.71013 *
eV, 1.77120 *
eV, 1.83680 *
eV, 1.90745 *
eV, 1.98375 *
eV, 2.06640 *
eV, 2.10143 *
eV, 2.13766 *
eV, 2.17516 *
eV, 2.21400 *
eV, 2.25426 *
eV, 2.29600 *
eV, 2.33932 *
eV, 2.38431 *
eV, 2.43106 *
eV, 2.47968 *
eV, 2.53029 *
eV, 2.58300 *
eV, 2.63796 *
eV, 2.69531 *
eV, 2.75520 *
eV, 2.81782 *
eV, 2.88335 *
eV, 2.95200 *
eV, 3.09960 *
eV, 3.54241 *
eV, 4.13281 *
eV};
590 G4double refractiveIndex_VM2000[nEntriesVM2000] =
591 {1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42};
592 mptVM2000->
AddProperty(
"RINDEX", photonE_VM2000, refractiveIndex_VM2000, nEntriesVM2000);
608 if (!istream_mapping.is_open())
610 cout <<
"ERROR in PHG4HybridHomogeneousCalorimeterDetector: Failed to open mapping file " <<
m_Params->
get_string_param(
"mappingtower") << endl;
616 while (getline(istream_mapping, line_mapping))
619 if (line_mapping.find(
"#") != string::npos)
623 cout <<
"PHG4HybridHomogeneousCalorimeterDetector: SKIPPING line in mapping file: " << line_mapping << endl;
628 istringstream iss(line_mapping);
631 if (line_mapping.find(
"Tower ") != string::npos)
633 unsigned idx_j, idx_k, idx_l;
641 if (!(iss >> dummys >> dummy >> idx_j >> idx_k >> idx_l >> pos_x >> pos_y >> pos_z >> size_x >> size_y >> size_z >> rot_x >> rot_y >> rot_z))
643 cout <<
"ERROR in PHG4HybridHomogeneousCalorimeterDetector: Failed to read line in mapping file " <<
m_Params->
get_string_param(
"mappingtower") << endl;
649 ostringstream towername;
663 tower_new.
idx_j = idx_j;
664 tower_new.
idx_k = idx_k;
665 _map_tower.insert(make_pair(towername.str(), tower_new));
674 if (!(iss >> parname >> parval))
676 cout <<
"ERROR in PHG4HybridHomogeneousCalorimeterDetector: Failed to read line in mapping file " <<
m_Params->
get_string_param(
"mappingtower") << endl;
685 std::map<string, G4double>::iterator parit;
852 static string matname =
"HybridHomogeneousCarbonFiber";
857 carbonfiber =
new G4Material(matname, density_carbon_fiber, 1);