Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4_Target.C
Go to the documentation of this file.
1 using namespace std;
2 
4  PHG4Reco *g4Reco,
5  const int use_g4steps,
6  const double target_l,
7  const double target_z
8 ) {
9 
10  const double target_coil_pos_z = -130;
11  const double collimator_pos_z = target_coil_pos_z - 302.36;
12 
13  //gSystem->Load("libfun4all.so");
14  //gSystem->Load("libg4detectors");
15  //gSystem->Load("libg4testbench");
16 
17  //Fun4AllServer *se = Fun4AllServer::instance();
18  //PHG4Reco *g4Reco = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
19 
20  PHG4CollimatorSubsystem* collimator = new PHG4CollimatorSubsystem("Collimator",0);
21  collimator->SuperDetector("Collimator");
22  collimator->set_double_param("place_z", collimator_pos_z);//-302.36 cm
23  collimator->set_double_param("size_z",121.92);
24  collimator->SetActive(1);
25  g4Reco->registerSubsystem(collimator);
26 
27  PHG4TargetCoilSubsystem* coil_0 = new PHG4TargetCoilSubsystem("Coil", 0);
28  coil_0->SuperDetector("Coil");
29  coil_0->set_double_param("rot_x", 90.);
30  coil_0->set_double_param("rot_y", 0.);
31  coil_0->set_double_param("rot_z", 0.);
32  coil_0->set_double_param("place_x", 0.);
33  coil_0->set_double_param("place_y", (22.7+4.)/2);
34  coil_0->set_double_param("place_z", target_coil_pos_z);
35  coil_0->set_int_param("use_g4steps", use_g4steps);
36  coil_0->SetActive(1); // it is an active volume - save G4Hits
37  g4Reco->registerSubsystem(coil_0);
38 
39  PHG4TargetCoilSubsystem* coil_1 = new PHG4TargetCoilSubsystem("Coil", 1);
40  coil_1->SuperDetector("Coil");
41  coil_1->set_double_param("rot_x", -90.);
42  coil_1->set_double_param("rot_y", 0.);
43  coil_1->set_double_param("rot_z", 0.);
44  coil_1->set_double_param("place_x", 0.);
45  coil_1->set_double_param("place_y", -(22.7+4.)/2);
46  coil_1->set_double_param("place_z", target_coil_pos_z);
47  coil_1->set_int_param("use_g4steps", use_g4steps);
48  coil_1->SetActive(1); // it is an active volume - save G4Hits
49  g4Reco->registerSubsystem(coil_1);
50 
51  PHG4CylinderSubsystem* target = new PHG4CylinderSubsystem("Target", 0);
52  target->SuperDetector("Target");
53  target->set_double_param("length", target_l);
54  target->set_double_param("rot_x", 0.);
55  target->set_double_param("rot_y", 0.);
56  target->set_double_param("rot_z", 0.);
57  target->set_double_param("place_x", 0.);
58  target->set_double_param("place_y", 0.);
59  target->set_double_param("place_z", target_coil_pos_z + target_z);
60  target->set_double_param("radius", 0.);
61  target->set_double_param("thickness", (2.)/2);
62  target->set_string_param("material", "Target"); // material of target
63  target->set_int_param("lengthviarapidity", 0);
64  target->set_int_param("use_g4steps", use_g4steps);
65  target->SetActive(1); // it is an active volume - save G4Hits
66  g4Reco->registerSubsystem(target);
67 
68  return;
69 }
70 
Runs G4 as a subsystem.
Definition: PHG4Reco.h:38
void set_int_param(const std::string &name, const int ival)
void SuperDetector(const std::string &name)
void set_double_param(const std::string &name, const double dval)
void SetupTarget(PHG4Reco *g4Reco, const double target_coil_pos_z=-300, const double target_l=7.9, const double target_z=0., const int use_g4steps=1, const int register_hits=0)
Definition: G4_Target.C:10
void set_string_param(const std::string &name, const std::string &sval)
void SetActive(const int i=1)
void registerSubsystem(PHG4Subsystem *subsystem)
register subsystem
Definition: PHG4Reco.h:65