Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_FGEM_fsPHENIX.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_FGEM_fsPHENIX.C
1 // $Id: G4_FGEM_fsPHENIX.C,v 1.2 2014/01/22 01:44:13 jinhuang Exp $
2 
11 using namespace std;
12 
13 void
15 {
16 
17 }
18 
19 void
20 FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, //
21  const double min_eta = 1.45 //
22  )
23 {
24 
25  const double tilt = .1;
26 
27  string name;
28  double etamax;
29  double etamin;
30  double zpos;
32 
33  make_GEM_station("FGEM_0", g4Reco, 17, 1.01, 2.7, N_Sector);
34  make_GEM_station("FGEM_1", g4Reco, 62, 2.15, 4.0, N_Sector);
35 
37 
38  name = "FGEM_2";
39  etamax = 4;
40  etamin = min_eta;
41  zpos = 1.2e2;
42 
43  gem = new PHG4SectorSubsystem(name.c_str());
44 
54  gem->get_geometry().set_material("G4_METHANE");
55  gem->get_geometry().set_N_Sector(N_Sector);
59  g4Reco->registerSubsystem(gem);
60 
62 
63  name = "FGEM_3";
64  etamax = 4;
65  etamin = min_eta;
66  zpos = 1.6e2;
67  gem = new PHG4SectorSubsystem(name.c_str());
68 
69  gem->SuperDetector(name);
79  gem->get_geometry().set_material("G4_METHANE");
80  gem->get_geometry().set_N_Sector(N_Sector);
84  g4Reco->registerSubsystem(gem);
85 
86  gem = new PHG4SectorSubsystem(name + "_LowerEta");
87  gem->SuperDetector(name);
88 
89  zpos = zpos
90  - (zpos * sin(tilt)
91  + zpos * cos(tilt)
93  * sin(tilt);
94 
105  gem->get_geometry().set_material("G4_METHANE");
106  gem->get_geometry().set_N_Sector(N_Sector);
109 
113  g4Reco->registerSubsystem(gem);
114 
116 
117  name = "FGEM_4";
118  etamax = 4;
119  etamin = min_eta;
120  zpos = 2.75e2;
121  gem = new PHG4SectorSubsystem(name.c_str());
122 
123  gem->SuperDetector(name);
133  gem->get_geometry().set_material("G4_METHANE");
134  gem->get_geometry().set_N_Sector(N_Sector);
138  g4Reco->registerSubsystem(gem);
139 
140  zpos = zpos
141  - (zpos * sin(tilt)
142  + zpos * cos(tilt)
144  * sin(tilt);
145 
146  gem = new PHG4SectorSubsystem(name + "_LowerEta");
147  gem->SuperDetector(name);
148 
159  gem->get_geometry().set_material("G4_METHANE");
160  gem->get_geometry().set_N_Sector(N_Sector);
163 
167  g4Reco->registerSubsystem(gem);
168 
170 
171 }
172 
174 void
176 {
177  assert(gem);
178 
179  const double cm = PHG4Sector::Sector_Geometry::Unit_cm();
180  const double mm = .1 * cm;
181  const double um = 1e-3 * mm;
182 
183 // const int N_Layers = 70; // used for mini-drift TPC timing digitalization
184  const int N_Layers = 1; // simplified setup
185  const double thickness = 2 * cm;
186 
187  gem->get_geometry().AddLayer("EntranceWindow", "G4_MYLAR", 25 * um, false,
188  100);
189  gem->get_geometry().AddLayer("Cathode", "G4_GRAPHITE", 10 * um, false, 100);
190 
191  for (int d = 1; d <= N_Layers; d++)
192  {
193  stringstream s;
194  s << "DriftLayer_";
195  s << d;
196 
197  gem->get_geometry().AddLayer(s.str(), "G4_METHANE", thickness / N_Layers,
198  true);
199 
200  }
201 }
202 
203 int
204 make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin,
205  double etamax, const int N_Sector = 8)
206 {
207 
208 // cout
209 // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of "
210 // << name << endl;
211 
212  double polar_angle = 0;
213 
214  if (zpos < 0)
215  {
216  zpos = -zpos;
217  polar_angle = TMath::Pi();
218 
219  }
220  if (etamax < etamin)
221  {
222  double t = etamax;
223  etamax = etamin;
224  etamin = t;
225  }
226 
227  PHG4SectorSubsystem *gem;
228  gem = new PHG4SectorSubsystem(name.c_str());
229 
230  gem->SuperDetector(name);
231 
232  gem->get_geometry().set_normal_polar_angle(polar_angle);
243  gem->get_geometry().set_N_Sector(N_Sector);
244  gem->get_geometry().set_material("G4_METHANE");
246 
249  g4Reco->registerSubsystem(gem);
250 
251 }
252 
254 
255  //---------------
256  // Load libraries
257  //---------------
258 
259  gSystem->Load("libfun4all.so");
260  gSystem->Load("libg4hough.so");
261 
262  //---------------
263  // Fun4All server
264  //---------------
265 
267 
268  PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim");
269  kalman->Verbosity(0);
270 
271  kalman->set_use_vertex_in_fitting(true);
272  kalman->set_vertex_xy_resolution(50E-4);
273  kalman->set_vertex_z_resolution(50E-4);
274 
275  kalman->set_detector_type(PHG4TrackFastSim::Vertical_Plane); // Vertical_Plane, Cylinder
276  kalman->set_phi_resolution(50E-4);
277  kalman->set_r_resolution(1.);
278 
279  // now automatic loading magnetic field. See https://github.com/sPHENIX-Collaboration/coresoftware/pull/349
280 // kalman->set_mag_field_file_name("/phenix/upgrades/decadal/fieldmaps/fsPHENIX.2d.root");
281 // kalman->set_mag_field_re_scaling_factor(1.);
282 
283  kalman->set_pat_rec_hit_finding_eff(1.);
284  kalman->set_pat_rec_noise_prob(0.);
285 
286  std::string phg4hits_names[] = {"G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"};
287  kalman->set_phg4hits_names(phg4hits_names, 5);
288  kalman->set_sub_top_node_name("SVTX");
289  kalman->set_trackmap_out_name("SvtxTrackMap");
290 
291  // Saved track states (projections)
292  std::string state_names[] = {"FEMC","FHCAL"};
293  kalman->set_state_names(state_names, 2);
294 
295  kalman->set_fit_alg_name("KalmanFitterRefTrack");//
296  kalman->set_primary_assumption_pid(13);
297  kalman->set_do_evt_display(false);
298 
299  se->registerSubsystem(kalman);
300 
301 }
302