Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4BeamlineMagnetSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4BeamlineMagnetSubsystem.cc
3 
4 #include <phparameter/PHParameters.h>
5 
6 #include <cmath> // for NAN
7 #include <iostream> // for operator<<, endl, basic_ostream
8 
9 class PHCompositeNode;
10 class PHG4Detector;
11 
12 using namespace std;
13 
14 //_______________________________________________________________________
16  : PHG4DetectorSubsystem(na, lyr)
17  , detector_(nullptr)
18 {
20 }
21 
22 //_______________________________________________________________________
24 {
25  /* create magnet */
26  detector_ = new PHG4BeamlineMagnetDetector(this, topNode, GetParams(), Name(), GetLayer());
27 
28  return 0;
29 }
30 
31 //_______________________________________________________________________
33 {
34  return 0;
35 }
36 
37 //_______________________________________________________________________
39 {
40  return detector_;
41 }
42 
44 {
45  set_default_string_param("magtype", "");
46 
47  set_default_double_param("field_y", NAN);
48  set_default_double_param("fieldgradient", NAN);
49 
50  set_default_double_param("length", 100);
51  set_default_double_param("place_x", 0.);
52  set_default_double_param("place_y", 0.);
53  set_default_double_param("place_z", 0.);
54  set_default_double_param("rot_x", 0.);
55  set_default_double_param("rot_y", 0.);
56  set_default_double_param("rot_z", 0.);
57  set_default_double_param("radius", 100);
58  set_default_double_param("thickness", 100);
59  set_default_double_param("tmin", NAN);
60  set_default_double_param("tmax", NAN);
61 
62  set_default_int_param("lengthviarapidity", 1);
63 
64  set_default_string_param("material", "G4_Galactic");
65 }
66 
67 void PHG4BeamlineMagnetSubsystem::Print(const string& /*what*/) const
68 {
69  cout << Name() << " Parameters: " << endl;
70  if (!BeginRunExecuted())
71  {
72  cout << "Need to execute BeginRun() before parameter printout is meaningful" << endl;
73  cout << "To do so either run one or more events or on the command line execute: " << endl;
74  cout << "Fun4AllServer *se = Fun4AllServer::instance();" << endl;
75  cout << "PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");" << endl;
76  cout << "g4->InitRun(se->topNode());" << endl;
77  cout << "PHG4BeamlineMagnetSubsystem *cyl = (PHG4BeamlineMagnetSubsystem *) g4->getSubsystem(\"" << Name() << "\");" << endl;
78  cout << "cyl->Print()" << endl;
79  return;
80  }
81  GetParams()->Print();
82  return;
83 }