4 #include <phparameter/PHParameters.h>
12 #include <Geant4/G4Box.hh>
13 #include <Geant4/G4Cons.hh>
14 #include <Geant4/G4Element.hh>
15 #include <Geant4/G4LogicalVolume.hh>
16 #include <Geant4/G4Material.hh>
17 #include <Geant4/G4PVPlacement.hh>
18 #include <Geant4/G4RotationMatrix.hh>
19 #include <Geant4/G4String.hh>
20 #include <Geant4/G4SubtractionSolid.hh>
21 #include <Geant4/G4SystemOfUnits.hh>
22 #include <Geant4/G4ThreeVector.hh>
23 #include <Geant4/G4Transform3D.hh>
24 #include <Geant4/G4Types.hh>
42 , m_SuperDetector(
"NONE")
43 , m_Params(parameters)
45 , _towerlogicnameprefix(
"CrystalCalorimeterTower")
46 , m_IsActive(m_Params->get_int_param(
"active"))
47 , m_AbsorberActive(m_Params->get_int_param(
"absorberactive"))
76 cout <<
"PHG4CrystalCalorimeterDetector: Begin Construction" << endl;
81 cout <<
"ERROR in PHG4CrystalCalorimeterDetector: No tower mapping file specified. Abort detector construction." << endl;
82 cout <<
"Please run set_string_param(\"mappingtower\", std::string filename ) first." << endl;
114 eemc_envelope_log, name_envelope, logicWorld, 0,
false,
OverlapCheck());
131 cout <<
"PHG4CrystalCalorimeterDetector: Build logical volume for single tower..." << endl;
153 "single_tower_logic",
166 ((tower_dz / 2.0) - 1 *
mm));
168 G4double lead_dx = tower_dx - 2.0 * carbon_thickness;
169 G4double lead_dy = tower_dy - 2.0 * carbon_thickness;
187 "single_crystal_logic",
205 "single_absorber_logic",
232 cout <<
"PHG4CrystalCalorimeterDetector: Building logical volume for single tower done." << endl;
235 return single_tower_logic;
241 typedef std::map<std::string, towerposition>::iterator it_type;
247 cout <<
"PHG4CrystalCalorimeterDetector: Place tower " << iterator->first
248 <<
" idx_j = " << iterator->second.idx_j <<
", idx_k = " << iterator->second.idx_k
249 <<
" at x = " << iterator->second.x <<
" , y = " << iterator->second.y <<
" , z = " << iterator->second.z << endl;
251 int copyno = (iterator->second.idx_j << 16) + iterator->second.idx_k;
266 if (!istream_mapping.is_open())
268 cout <<
"ERROR in PHG4CrystalCalorimeterDetector: Failed to open mapping file " <<
m_Params->
get_string_param(
"mappingtower") << endl;
274 while (getline(istream_mapping, line_mapping))
277 if (line_mapping.find(
"#") != string::npos)
281 cout <<
"PHG4CrystalCalorimeterDetector: SKIPPING line in mapping file: " << line_mapping << endl;
286 istringstream iss(line_mapping);
289 if (line_mapping.find(
"Tower ") != string::npos)
291 unsigned idx_j, idx_k, idx_l;
299 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))
301 cout <<
"ERROR in PHG4CrystalCalorimeterDetector: Failed to read line in mapping file " <<
m_Params->
get_string_param(
"mappingtower") << endl;
307 ostringstream towername;
321 tower_new.
idx_j = idx_j;
322 tower_new.
idx_k = idx_k;
323 _map_tower.insert(make_pair(towername.str(), tower_new));
332 if (!(iss >> parname >> parval))
334 cout <<
"ERROR in PHG4CrystalCalorimeterDetector: Failed to read line in mapping file " <<
m_Params->
get_string_param(
"mappingtower") << endl;
343 std::map<string, G4double>::iterator parit;
432 static string matname =
"CrystalCarbonFiber";
437 carbonfiber =
new G4Material(matname, density_carbon_fiber, 1);