Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4_InsensitiveVolumes.C
Go to the documentation of this file.
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
6 class SubsysReco;
7 R__LOAD_LIBRARY(libg4detectors)
8 #endif
9 
10 /*
11 This macro implements the all the volumes that are not sensitive - i.e. do not need to generate G4Hits
12 The insensitive volumes implemented here are:
13  1. concrete shielding in front of FMag
14  2. FMag/beam dump
15  3. KMag
16  4. Muon absorber between station-3 and -4
17 */
18 
20  PHG4Reco* g4Reco,
21  const bool toggle_shielding = true,
22  const bool toggle_fmag = true,
23  const bool toggle_kmag = true,
24  const bool toggle_absorber = true,
25  const int enable_fmag_filter = 0, /*should set this to 1 after being extensively tested*/
26  const double filter_max_slope = 0.25,
27  const double filter_min_energy = 5.)
28 {
29  if(toggle_shielding) {
30  const double inch = 2.54;
31  PHG4SquareTubeSubsystem* shielding = nullptr;
32 
33  shielding = new PHG4SquareTubeSubsystem("Shielding1", 0);
34  shielding->set_string_param("hole_type", "circle");
35  shielding->set_double_param("place_x", 0);
36  shielding->set_double_param("place_y", 0);
37  shielding->set_double_param("place_z", (-18.*inch/2.-(2.15+11.38+36.)*inch)); // I have added all the z length and put the z into the center of mass of the block.
38  shielding->set_double_param("size_x", 250.*inch); //the info is not given?
39  shielding->set_double_param("size_y", 200.*inch); //the info is not given?
40  shielding->set_double_param("size_z", (18.-0.001)*inch);
41  shielding->set_double_param("inner_diameter", 4.*inch);
42  shielding->set_string_param("material", "G4_CONCRETE");
43  g4Reco->registerSubsystem(shielding);
44 
45  shielding = new PHG4SquareTubeSubsystem("Shielding2", 0);
46  shielding->set_string_param("hole_type", "circle");
47  shielding->set_double_param("place_x", 0.);
48  shielding->set_double_param("place_y", 0.);
49  shielding->set_double_param("place_z", (-36.*inch/2.-(2.15+11.38)*inch)); // I have added all the z length and put the z into the center of mass of the block.
50  shielding->set_double_param("size_x", 250.*inch); //the info is not given?
51  shielding->set_double_param("size_y", 200.*inch); //the info is not given?
52  shielding->set_double_param("size_z", 36.*inch);
53  shielding->set_double_param("inner_diameter", 6.*inch);
54  shielding->set_string_param("material", "G4_CONCRETE");
55  g4Reco->registerSubsystem(shielding);
56 
57  shielding = new PHG4SquareTubeSubsystem("Shielding3", 0);
58  shielding->set_double_param("place_x", 0.);
59  shielding->set_double_param("place_y", 0.);
60  shielding->set_double_param("place_z", -11.38*inch/2.);
61  shielding->set_double_param("size_x", 50.*inch);
62  shielding->set_double_param("size_y", 50.*inch);
63  shielding->set_double_param("size_z", (11.38-0.001)*inch);
64  shielding->set_double_param("inner_size_x", 6.*inch);
65  shielding->set_double_param("inner_size_y", 6.*inch);
66  shielding->set_string_param("material", "G4_CONCRETE");
67  g4Reco->registerSubsystem(shielding);
68  }
69 
70  if(toggle_fmag) {
72  fmag->set_string_param("geomdb", "$E1039_RESOURCE/geometry/magnetic_fields/magnet_geom.db");
73  fmag->set_string_param("magname", "fmag");
74  fmag->set_double_param("place_x", 0.0);
75  fmag->set_double_param("place_y", 0.0);
76  fmag->set_double_param("place_z", 251.46);
77  if(enable_fmag_filter == 1) {
78  fmag->set_int_param("enable_track_filter", 1);
79  fmag->set_double_param("filter_max_slope", filter_max_slope);
80  fmag->set_double_param("filter_min_energy", filter_min_energy);
81  }
82 
83  g4Reco->registerSubsystem(fmag);
84  }
85 
86  if(toggle_kmag) {
88  kmag->set_string_param("geomdb", "$E1039_RESOURCE/geometry/magnetic_fields/magnet_geom.db");
89  kmag->set_string_param("magname", "kmag");
90  kmag->set_double_param("place_x", -1.34493);
91  kmag->set_double_param("place_y", -1.0414);
92  kmag->set_double_param("place_z", 1042.01722);
93 
94  g4Reco->registerSubsystem(kmag);
95  }
96 
97  if(toggle_absorber) {
98  PHG4BlockSubsystem* absorber = new PHG4BlockSubsystem("MUID_absorber", 0);
99  absorber->SuperDetector("MUID_absorber");
100  absorber->set_double_param("size_x", 320.04);
101  absorber->set_double_param("size_y", 345.44);
102  absorber->set_double_param("size_z", 99.568);
103  absorber->set_double_param("place_x", 0.);
104  absorber->set_double_param("place_y", 0.);
105  absorber->set_double_param("place_z", 2028.19);
106  absorber->set_double_param("rot_x", 0.);
107  absorber->set_double_param("rot_y", 0.);
108  absorber->set_double_param("rot_z", 0.);
109  absorber->set_string_param("material", "G4_Fe");
110  absorber->SetActive(0);
111 
112  g4Reco->registerSubsystem(absorber);
113  }
114 
115  return;
116 }
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 SetupInsensitiveVolumes(PHG4Reco *g4Reco, const bool toggle_shielding=true, const bool toggle_fmag=true, const bool toggle_kmag=true, const bool toggle_absorber=true, const int enable_fmag_filter=0, const double filter_max_slope=0.25, const double filter_min_energy=5.)
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