Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_Magnet.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_Magnet.C
1 
2 void MagnetInit() {}
3 
4 double Magnet(PHG4Reco* g4Reco,
5  double radius,
6  const int crossings = 0,
7  const int absorberactive = 0,
8  int verbosity = 0) {
9 
10  double magnet_inner_cryostat_wall_radius = 142;
11  double magnet_inner_cryostat_wall_thickness = 1;
12  double magnet_outer_cryostat_wall_radius = 174.5;
14  double magnet_coil_radius = 150.8;
15  double magnet_coil_thickness = 9.38;
16  double magnet_length = 379.;
17  double coil_length = 361.5;
18  if (radius > magnet_inner_cryostat_wall_radius) {
19  cout << "inconsistency: radius: " << radius
20  << " larger than Magnet inner radius: " << magnet_inner_cryostat_wall_radius << endl;
21  gSystem->Exit(-1);
22  }
23 
24  gSystem->Load("libg4detectors.so");
25  gSystem->Load("libg4testbench.so");
26 
27  radius = magnet_inner_cryostat_wall_radius;
28  PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("MAGNET", 0);
29  cyl->set_double_param("radius",magnet_inner_cryostat_wall_radius);
30  cyl->set_int_param("lengthviarapidity",0);
31  cyl->set_double_param("length",magnet_length);
32  cyl->set_double_param("thickness",magnet_inner_cryostat_wall_thickness);
33  cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness
34  cyl->SuperDetector("MAGNET");
35  if (absorberactive) cyl->SetActive();
36  g4Reco->registerSubsystem( cyl );
37 
38  cyl = new PHG4CylinderSubsystem("MAGNET", 1);
39  cyl->set_double_param("radius",magnet_coil_radius);
40  cyl->set_int_param("lengthviarapidity",0);
41  cyl->set_double_param("length",coil_length);
42  cyl->set_double_param("thickness",magnet_coil_thickness);
43  cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness
44  cyl->SuperDetector("MAGNET");
45  if (absorberactive) cyl->SetActive();
46  g4Reco->registerSubsystem( cyl );
47 
48  cyl = new PHG4CylinderSubsystem("MAGNET", 2);
49  cyl->set_double_param("radius",magnet_outer_cryostat_wall_radius);
50  cyl->set_int_param("lengthviarapidity",0);
51  cyl->set_double_param("length",magnet_length);
52  cyl->set_double_param("thickness",magnet_outer_cryostat_wall_thickness);
53  cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness
54  cyl->SuperDetector("MAGNET");
55  if (absorberactive) cyl->SetActive();
56  g4Reco->registerSubsystem( cyl );
57 
58  radius = magnet_outer_cryostat_wall_radius + magnet_outer_cryostat_wall_thickness; // outside of magnet
59 
60  if (verbosity > 0) {
61  cout << "========================= G4_Magnet.C::Magnet() ===========================" << endl;
62  cout << " MAGNET Material Description:" << endl;
63  cout << " inner radius = " << magnet_inner_cryostat_wall_radius << " cm" << endl;
64  cout << " outer radius = " << magnet_outer_cryostat_wall_radius + magnet_outer_cryostat_wall_thickness << " cm" << endl;
65  cout << " length = " << magnet_length << " cm" << endl;
66  cout << "===========================================================================" << endl;
67  }
68 
69  radius += no_overlapp;
70 
71  return radius;
72 }