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 bool do_collimator = true,
6  const bool do_target = true,
7  const double target_coil_pos_z = -130,
8  const double target_l = 7.9,
9  const double target_z = 0.,
10  const int use_g4steps = 1
11 ) {
12 
13  const double collimator_pos_z = target_coil_pos_z - 302.36;
14 
15  //gSystem->Load("libfun4all.so");
16  //gSystem->Load("libg4detectors");
17  //gSystem->Load("libg4testbench");
18 
19  //Fun4AllServer *se = Fun4AllServer::instance();
20  //PHG4Reco *g4Reco = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
21 
22  if(do_collimator) {
23  PHG4CollimatorSubsystem* collimator = new PHG4CollimatorSubsystem("Collimator",0);
24  collimator->SuperDetector("Collimator");
25  collimator->set_double_param("place_z", collimator_pos_z);//-302.36 cm
26  collimator->set_double_param("size_z",121.92);
27  collimator->SetActive(1);
28  g4Reco->registerSubsystem(collimator);
29  }
30 
31  if(do_target) {
32  PHG4TargetCoilSubsystem* coil_0 = new PHG4TargetCoilSubsystem("Coil", 0);
33  coil_0->SuperDetector("Coil");
34  coil_0->set_double_param("rot_x", 90.);
35  coil_0->set_double_param("rot_y", 0.);
36  coil_0->set_double_param("rot_z", 0.);
37  coil_0->set_double_param("place_x", 0.);
38  coil_0->set_double_param("place_y", (22.7+4.)/2);
39  coil_0->set_double_param("place_z", target_coil_pos_z);
40  coil_0->set_int_param("use_g4steps", use_g4steps);
41  coil_0->SetActive(1); // it is an active volume - save G4Hits
42  g4Reco->registerSubsystem(coil_0);
43 
44  PHG4TargetCoilSubsystem* coil_1 = new PHG4TargetCoilSubsystem("Coil", 1);
45  coil_1->SuperDetector("Coil");
46  coil_1->set_double_param("rot_x", -90.);
47  coil_1->set_double_param("rot_y", 0.);
48  coil_1->set_double_param("rot_z", 0.);
49  coil_1->set_double_param("place_x", 0.);
50  coil_1->set_double_param("place_y", -(22.7+4.)/2);
51  coil_1->set_double_param("place_z", target_coil_pos_z);
52  coil_1->set_int_param("use_g4steps", use_g4steps);
53  coil_1->SetActive(1); // it is an active volume - save G4Hits
54  g4Reco->registerSubsystem(coil_1);
55 
56  PHG4CylinderSubsystem* target = new PHG4CylinderSubsystem("Target", 0);
57  target->SuperDetector("Target");
58  target->set_double_param("length", target_l);
59  target->set_double_param("rot_x", 0.);
60  target->set_double_param("rot_y", 0.);
61  target->set_double_param("rot_z", 0.);
62  target->set_double_param("place_x", 0.);
63  target->set_double_param("place_y", 0.);
64  target->set_double_param("place_z", target_coil_pos_z + target_z);
65  target->set_double_param("radius", 0.);
66  target->set_double_param("thickness", (2.)/2);
67  target->set_string_param("material", "Target"); // material of target
68  target->set_int_param("lengthviarapidity", 0);
69  target->set_int_param("use_g4steps", use_g4steps);
70  target->SetActive(1); // it is an active volume - save G4Hits
71  g4Reco->registerSubsystem(target);
72  }
73 
74  return;
75 }
76 
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