6 #include <phparameter/PHParameters.h>
8 #include <Geant4/G4Box.hh>
9 #include <Geant4/G4Cons.hh>
10 #include <Geant4/G4LogicalVolume.hh>
11 #include <Geant4/G4Material.hh>
12 #include <Geant4/G4PVPlacement.hh>
13 #include <Geant4/G4RotationMatrix.hh>
14 #include <Geant4/G4String.hh>
15 #include <Geant4/G4SystemOfUnits.hh>
16 #include <Geant4/G4ThreeVector.hh>
17 #include <Geant4/G4Transform3D.hh>
18 #include <Geant4/G4Types.hh>
38 , _tower_dz(170.0 *
mm)
39 , _materialScintillator(
"G4_POLYSTYRENE")
40 , _materialAbsorber(
"G4_Pb")
49 cout <<
"PHG4EICForwardEcalDetector: Begin Construction" << endl;
76 ostringstream name_envelope;
77 name_envelope.str(
"");
81 ecal_envelope_log, name_envelope.str().c_str(), logicWorld, 0,
false,
OverlapCheck());
98 cout <<
"PHG4EICForwardEcalDetector: Build logical volume for single tower..." << endl;
111 "single_tower_logic",
117 G4double thickness_absorber = thickness_layer / 3.0 * 2.0;
118 G4double thickness_scintillator = thickness_layer / 3.0 * 1.0;
128 thickness_absorber / 2.0);
133 thickness_scintillator / 2.0);
141 "single_plate_absorber_logic",
145 material_scintillator,
146 "hEcal_scintillator_plate_logic",
158 ostringstream name_absorber;
159 name_absorber.str(
"");
162 ostringstream name_scintillator;
163 name_scintillator.str(
"");
166 for (
int i = 1; i <= nlayers; i++)
170 name_absorber.str().c_str(),
174 zpos_i += (thickness_absorber / 2. + thickness_scintillator / 2.);
178 name_scintillator.str().c_str(),
182 zpos_i += (thickness_absorber / 2. + thickness_scintillator / 2.);
189 cout <<
"PHG4EICForwardEcalDetector: Building logical volume for single tower done." << endl;
192 return single_tower_logic;
198 typedef std::map<std::string, towerposition>::iterator it_type;
204 cout <<
"PHG4EICForwardEcalDetector: Place tower " << iterator->first
205 <<
" at x = " << iterator->second.x <<
" , y = " << iterator->second.y <<
" , z = " << iterator->second.z << endl;
210 iterator->first.c_str(),
221 ifstream istream_mapping;
222 istream_mapping.open(
GetParams()->get_string_param(
"mapping_file"));
223 if (!istream_mapping.is_open())
225 cout <<
"ERROR in PHG4EICForwardEcalDetector: Failed to open mapping file " <<
GetParams()->
get_string_param(
"mapping_file") << endl;
231 while (getline(istream_mapping, line_mapping))
234 if (line_mapping.find(
"#") != string::npos)
238 cout <<
"PHG4EICForwardEcalDetector: SKIPPING line in mapping file: " << line_mapping << endl;
243 istringstream iss(line_mapping);
246 if (line_mapping.find(
"Tower ") != string::npos)
248 unsigned idx_j, idx_k, idx_l;
256 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))
258 cerr <<
"ERROR in PHG4EICForwardEcalDetector: Failed to read line in mapping file " <<
GetParams()->
get_string_param(
"mapping_file") << endl;
264 ostringstream towername;
278 _map_tower.insert(make_pair(towername.str(), tower_new));
287 if (!(iss >> parname >> parval))
289 cerr <<
"ERROR in PHG4EICForwardEcalDetector: Failed to read line in mapping file " <<
GetParams()->
get_string_param(
"mapping_file") << endl;
297 std::map<string, double>::const_iterator parit;
312 for (
int i = 0; i < 2; i++)
316 rad <<
"Gr" << index <<
"_inner";
323 rad <<
"Gr" << index <<
"_outer";