4 #include <phparameter/PHParameters.h>
12 #include <Geant4/G4Box.hh>
13 #include <Geant4/G4Cons.hh>
14 #include <Geant4/G4LogicalVolume.hh>
15 #include <Geant4/G4Material.hh>
16 #include <Geant4/G4PVPlacement.hh>
17 #include <Geant4/G4RotationMatrix.hh>
18 #include <Geant4/G4SystemOfUnits.hh>
19 #include <Geant4/G4ThreeVector.hh>
20 #include <Geant4/G4Transform3D.hh>
21 #include <Geant4/G4Types.hh>
22 #include <Geant4/G4VPhysicalVolume.hh>
42 , m_Params(parameters)
43 , m_ActiveFlag(m_Params->get_int_param(
"active"))
44 , m_AbsorberActiveFlag(m_Params->get_int_param(
"absorberactive"))
45 , m_TowerLogicNamePrefix(
"hHcalTower")
46 , m_SuperDetector(
"NONE")
76 std::cout <<
"PHG4BackwardHcalDetector: Begin Construction" << std::endl;
81 cout <<
"ERROR in PHG4BackwardHcalDetector: No mapping file specified. Abort detector construction." << endl;
82 cout <<
"Please run set_string_param(\"mapping_file\", std::string filename ) first." << endl;
117 hcal_envelope_log, name_envelope, logicWorld, 0,
false,
OverlapCheck());
134 std::cout <<
"PHG4BackwardHcalDetector: Build logical volume for single tower..." << std::endl;
145 G4VSolid* single_tower_solid =
new G4Box(
"single_tower_solid",
152 "single_tower_logic",
159 G4int nlayers = TowerDz / (thickness_absorber + thickness_scintillator);
161 G4VSolid* solid_absorber =
new G4Box(
"single_plate_absorber_solid",
162 (TowerDx - WlsDw) / 2.0,
163 (TowerDy - SupportDw) / 2.0,
164 thickness_absorber / 2.0);
166 G4VSolid* solid_scintillator =
new G4Box(
"single_plate_scintillator",
167 (TowerDx - WlsDw) / 2.0,
168 (TowerDy - SupportDw) / 2.0,
169 thickness_scintillator / 2.0);
173 (TowerDy - SupportDw) / 2.0,
176 G4VSolid* solid_support_plate =
new G4Box(
"single_plate_support",
189 "single_plate_absorber_logic",
195 material_scintillator,
196 "hHcal_scintillator_plate_logic",
202 "hHcal_wls_plate_logic",
208 "hHcal_support_plate_logic",
220 G4double zpos_i = (-1 * TowerDz / 2.0) + thickness_absorber / 2.0;
230 for (
int i = 1; i <= nlayers; i++)
238 zpos_i += (thickness_absorber / 2. + thickness_scintillator / 2.);
246 zpos_i += (thickness_absorber / 2. + thickness_scintillator / 2.);
263 std::cout <<
"PHG4BackwardHcalDetector: Building logical volume for single tower done." << std::endl;
266 return single_tower_logic;
276 std::cout <<
"PHG4BackwardHcalDetector: Place tower " << iterator->first
277 <<
" idx_j = " << iterator->second.idx_j <<
", idx_k = " << iterator->second.idx_k
278 <<
" at x = " << iterator->second.x <<
" , y = " << iterator->second.y <<
" , z = " << iterator->second.z << std::endl;
281 int copyno = (iterator->second.idx_j << 16) + iterator->second.idx_k;
295 ifstream istream_mapping;
297 if (!istream_mapping.is_open())
299 std::cout <<
"ERROR in PHG4BackwardHcalDetector: Failed to open mapping file " <<
m_Params->
get_string_param(
"mapping_file") << std::endl;
305 while (getline(istream_mapping, line_mapping))
308 if (line_mapping.find(
"#") != string::npos)
312 std::cout <<
"PHG4BackwardHcalDetector: SKIPPING line in mapping file: " << line_mapping << std::endl;
317 istringstream iss(line_mapping);
320 if (line_mapping.find(
"Tower ") != string::npos)
322 unsigned idx_j, idx_k, idx_l;
330 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))
332 cout <<
"ERROR in PHG4BackwardHcalDetector: Failed to read line in mapping file " <<
m_Params->
get_string_param(
"mapping_file") << std::endl;
338 ostringstream towername;
352 tower_new.
idx_j = idx_j;
353 tower_new.
idx_k = idx_k;
363 if (!(iss >> parname >> parval))
365 cout <<
"ERROR in PHG4BackwardHcalDetector: Failed to read line in mapping file " <<
m_Params->
get_string_param(
"mapping_file") << std::endl;
374 std::map<string, G4double>::iterator parit;