10 #include <phparameter/PHParameters.h>
11 #include <phparameter/PHParametersContainer.h>
24 #include <Geant4/G4AssemblyVolume.hh>
25 #include <Geant4/G4GDMLParser.hh>
26 #include <Geant4/G4GDMLReadStructure.hh>
27 #include <Geant4/G4LogicalVolume.hh>
28 #include <Geant4/G4Material.hh>
29 #include <Geant4/G4RotationMatrix.hh>
30 #include <Geant4/G4String.hh>
31 #include <Geant4/G4SystemOfUnits.hh>
32 #include <Geant4/G4ThreeVector.hh>
33 #include <Geant4/G4Transform3D.hh>
34 #include <Geant4/G4Types.hh>
35 #include <Geant4/G4VPhysicalVolume.hh>
50 , m_ParamsContainer(_paramsContainer)
51 , m_StaveGeometryFile(_paramsContainer->GetParameters(PHG4MvtxDefs::
GLOBAL)->get_string_param(
"stave_geometry_file"))
56 cout <<
"PHG4EICMvtxDetector constructor called" << endl;
59 cout <<
" cm " <<
cm <<
" mm " <<
mm << endl;
60 for (
int ilayer = 0; ilayer <
n_Layers; ++ilayer)
79 cout <<
"PHG4EICMvtxDetector constructor: making Mvtx detector. " << endl;
93 cout <<
" -- PHG4MvtxTDetector::IsSensor --" << endl;
94 cout <<
" volume Name : " << volume->
GetName() << endl;
95 cout <<
" -----------------------------------------" << endl;
111 tie(layer, stave) = iter->second;
114 cout <<
" -- PHG4EICMvtxDetector::IsInMvtx --" << endl;
115 cout <<
" layer: " << layer << endl;
116 cout <<
" stave: " << stave << endl;
117 cout <<
" volume Name : " << volume->
GetName() << endl;
118 cout <<
" stave Name : " << iter->
first->GetName() << endl;
119 cout <<
" -----------------------------------------" << endl;
159 <<
"PHG4EICMvtxDetector::Construct called for Mvtx " << endl;
174 cout <<
" PHG4EICMvtxDetector::ConstructMvtx:" << endl;
187 char assemblyname[500];
188 sprintf(assemblyname,
"MVTXStave");
192 cout <<
"Geting the stave assembly named " << assemblyname << endl;
196 for (
unsigned short ilayer = 0; ilayer <
n_Layers; ++ilayer)
203 cout <<
" Constructing Layer " << ilayer << endl;
230 double arcstep = 12.25;
231 double numstaves = 2.0 *
M_PI * layer_nominal_radius / arcstep;
232 N_staves =
int(2.0 *
M_PI * layer_nominal_radius / arcstep);
237 cout <<
" Calculated N_staves for layer "
238 <<
" layer_nominal_radius " << layer_nominal_radius
239 <<
" ITS arcstep " << arcstep
240 <<
" circumference divided by arcstep " << numstaves
241 <<
" N_staves " << N_staves
243 cout <<
"A radius for this layer of " << (double) N_staves * arcstep / (2.0 *
M_PI) + 0.01 <<
" or "
244 << (double) (N_staves + 1) * arcstep / (2.0 *
M_PI) + 0.01 <<
" would produce perfect stave spacing" << endl;
249 double z_location = 0.0;
254 <<
" layer_nominal_radius " << layer_nominal_radius
255 <<
" N_staves " << N_staves
256 <<
" phistep " << phistep
257 <<
" phitilt " << phitilt
265 double phi_offset =
M_PI / 2.0;
267 for (
int iphi = 0; iphi <
N_staves; iphi++)
272 G4double phi_rotation = phi0 + (double) iphi * phistep;
279 cout <<
"phi_offset = " << phi_offset <<
" iphi " << iphi <<
" phi_rotation = " << phi_rotation <<
" phitilt " << phitilt << endl;
284 Ra.
rotateZ(phi_rotation + phi_offset + phitilt);
287 Ta.
setX(layer_nominal_radius * cos(phi_rotation));
288 Ta.
setY(layer_nominal_radius * sin(phi_rotation));
293 cout <<
" iphi " << iphi <<
" phi_rotation " << phi_rotation
294 <<
" x " << layer_nominal_radius * cos(phi_rotation)
295 <<
" y " << layer_nominal_radius * sin(phi_rotation)
296 <<
" z " << z_location
306 cout <<
"This layer has a total of " << N_staves <<
" staves" << endl;
319 for (
int i = 0; i < nDaughters; ++i, ++
it)
335 cout <<
"SetDisplayProperty - LV " << lv->
GetName() <<
" built with "
336 << material_name << endl;
338 vector<string> matname = {
"SI",
"KAPTON",
"ALUMINUM",
"Carbon",
"M60J3K",
"WATER"};
340 for (
string nam : matname)
342 if (material_name.find(nam) != std::string::npos)
347 cout <<
"SetDisplayProperty - LV " << lv->
GetName() <<
" display with " << nam << endl;
358 for (
int i = 0; i < nDaughters; ++i)
378 ostringstream geonode;
391 for (
unsigned short ilayer = 0; ilayer <
n_Layers; ++ilayer)
413 cout <<
"-- FillPVArray --" << endl;
418 for (
int i = 0; i < nDaughters; ++i, ++
it)
424 if (pv->
GetName().find(
"MVTXHalfStave_pv") != string::npos)
429 m_StavePV.insert(make_pair(pv, make_tuple(layer, stave)));
433 cout <<
"Mvtx layer id " << layer << endl;
434 cout <<
"Stave in layer id " << stave << endl;
435 cout <<
"Mvtx stave count " <<
m_StavePV.size() << endl;
436 cout <<
"FillPVArray - AV[" << i <<
"] = " << (*it)->GetName() << endl;
437 cout <<
" LV[" << i <<
"] = " << worldLogical->
GetName() << endl;
446 cout <<
"FillPVArray - AV[" << i <<
"] = " << (*it)->GetName() << endl;
447 cout <<
" LV[" << i <<
"] = " << worldLogical->
GetName() << endl;
456 for (
int i = 0; i < nDaughters; ++i)
461 cout <<
" PV[" << i <<
"]: " << pv->
GetName() << endl;
463 if (pv->
GetName().find(
"MVTXSensor_") != string::npos)
469 cout <<
" Adding Sensor Vol <" << pv->
GetName() <<
" (" <<
m_SensorPV.size() <<
")>" << endl;
477 cout <<
" LV[" << i <<
"]: " << worldLogical->
GetName() << endl;