ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_hFarBwdBeamLine_EIC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_hFarBwdBeamLine_EIC.C
1 #ifndef MACRO_G4HFARBWDBEAMLINE_EIC_C
2 #define MACRO_G4HFARBWDBEAMLINE_EIC_C
3 
4 #include <GlobalVariables.C>
5 
10 
11 #include <eicg4zdc/EICG4ZDCHitTree.h>
12 #include <eicg4zdc/EICG4ZDCNtuple.h>
13 #include <eicg4zdc/EICG4ZDCSubsystem.h>
14 
15 #include <eicg4lumi/EICG4LumiSubsystem.h>
16 #include <g4main/PHG4Reco.h>
17 
18 #include <TSystem.h>
19 
20 R__LOAD_LIBRARY(libg4detectors.so)
21 
22 // This creates the Enable Flag to be used in the main steering macro
23 namespace Enable
24 {
25  bool HFARBWD_MAGNETS = false;
27 
28  bool HFARBWD_PIPE = false;
29  bool HFARBWD_OVERLAPCHECK = false;
31 
32  //enabled automatically in hFarBwdBeamLineInit(), unless overridden by user
33  bool HFARBWD_MAGNETS_IP6 = false;
34  bool HFARBWD_MAGNETS_IP8 = false;
35 
36  //enabled automatically in hFarBwdBeamLineInit(), unless overridden by user
39 
40 } // namespace Enable
41 
42 namespace hFarBwdBeamLine
43 {
44  double starting_z = -463; //cm clear the backward beam chamber
45  double enclosure_z_max = NAN;
46  double enclosure_r_max = NAN;
47  double enclosure_center = NAN;
48 
50 
52 } // namespace hFarBwdBeamLine
53 
55 {
58 
61 
63  {
64  cout << "You cannot have magnets for both IP6 and IP8 ON at the same time" << endl;
65  gSystem->Exit(1);
66  }
67 
69  {
71 // BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, hFarBwdBeamLine::starting_z);
74  }
75 
77  {
79 // BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, hFarBwdBeamLine::starting_z);
82  }
83 
85 
86 // BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, hFarBwdBeamLine::enclosure_z_max);
88 
90 }
91 
93 {
94 
95 // cout << " HERE ???? " << endl;
96 // gSystem->Exit(1);
97 // exit(0);
98 
101 
102  hFarBwdBeamLine::hFarBwdBeamLineEnclosure = new PHG4CylinderSubsystem("hFarBwdBeamLineEnclosure");
103 // hFarBwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("place_z", -2450);
106  hFarBwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("thickness", hFarBwdBeamLine::enclosure_r_max); // This is intentionally made large 25cm radius
107 // hFarBwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("length", 4000);
113  if (verbosity)
116 
117  string magFile;
119  magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/ip6_h_farBwdBeamLineMagnets.dat";
120  }
121  else if (Enable::HFARFWD_MAGNETS_IP8) {
122  magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/ip8_35mrad_h_farBwdBeamLineMagnets.dat";
123  }
124  else
125  {
126  cout << " You have to enable either the IP6 or IP8 Magnet configuration to define magnets! " << endl;
127  gSystem->Exit(1);
128  }
129 
130  // make magnet active volume if you want to study the hits
131  // bool magnet_active = false;
132  bool magnet_active = true;
133 
134  int absorberactive = 0;
135 
136  // if you insert numbers it only displays those magnets, do not comment out the set declaration
137  set<int> magnetlist;
138  //magnetlist.insert(7);
139 
140  BeamLineMagnetSubsystem *bl = nullptr;
141  std::ifstream infile(magFile);
142  if (infile.is_open())
143  {
144  double biggest_z = 0.;
145  int imagnet = 0;
146  std::string line;
147  while (std::getline(infile, line))
148  {
149  if (!line.compare(0, 3, "eDB") ||
150  !line.compare(0, 2, "eQ") ||
151  !line.compare(0, 2, "eS"))
152  {
153  std::istringstream iss(line);
154  string magname;
155  double x;
156  double y;
157  double z;
158  double inner_radius_zin;
159  double inner_radius_zout;
160  double outer_magnet_diameter;
161  double length;
162  double angle;
163  double dipole_field_x;
164  double fieldgradient;
165  if (!(iss >> magname >> x >> y >> z >> inner_radius_zin >> inner_radius_zout >> outer_magnet_diameter >> length >> angle >> dipole_field_x >> fieldgradient))
166  {
167  cout << "coud not decode " << line << endl;
168  gSystem->Exit(1);
169  }
170  else
171  {
172  //------------------------
173  //Select only the magnet component in the far backward region
174  if (z > 0.0)
175  continue;
176 
177  string magtype;
178  if (inner_radius_zin != inner_radius_zout)
179  {
180  cout << "inner radius at front of magnet " << inner_radius_zin
181  << " not equal radius at back of magnet " << inner_radius_zout
182  << " needs change in code (replace tube by cone for beamline)" << endl;
183  gSystem->Exit(1);
184  }
185  if (verbosity > 0)
186  {
187  cout << endl
188  << endl
189  << "\tID number " << imagnet << endl;
190  cout << "magname: " << magname << endl;
191  cout << "x: " << x << endl;
192  cout << "y: " << y << endl;
193  cout << "z: " << z << endl;
194  cout << "inner_radius_zin: " << inner_radius_zin << endl;
195  cout << "inner_radius_zout: " << inner_radius_zout << endl;
196  cout << "outer_magnet_diameter: " << outer_magnet_diameter << endl;
197  cout << "length: " << length << endl;
198  cout << "angle: " << angle << endl;
199  cout << "dipole_field_x: " << dipole_field_x << endl;
200  cout << "fieldgradient: " << fieldgradient << endl;
201  }
202  if (!magname.compare(0, 3, "eDB"))
203  {
204  magtype = "DIPOLE";
205  }
206  else if (!magname.compare(0, 2, "eQ"))
207  {
208  magtype = "QUADRUPOLE";
209  }
210  else if (!magname.compare(0, 2, "eS"))
211  {
212  magtype = "SEXTUPOLE";
213  }
214  else
215  {
216  cout << "cannot decode magnet name " << magname << endl;
217  gSystem->Exit(1);
218  }
219  // convert to our units (cm, deg)
220  x *= 100.;
221  y *= 100.;
222  z *= 100.;
223  length *= 100.;
224  inner_radius_zin *= 100.;
225  outer_magnet_diameter *= 100.;
226  angle = (angle / TMath::Pi() * 180.) / 1000.; // given in mrad
227 
228  //------------------------
229  // Linearly scaling down the magnetic field for lower energy proton
230  if( Enable::HFARBWD_E_ENERGY != 18 ) {
231  float scaleFactor = Enable::HFARBWD_E_ENERGY / 18. ;
232  dipole_field_x = dipole_field_x*scaleFactor;
233  fieldgradient = fieldgradient * scaleFactor;
234  }
235 
236  if (magnetlist.empty() || magnetlist.find(imagnet) != magnetlist.end())
237  {
238  bl = new BeamLineMagnetSubsystem("BWDBEAMLINEMAGNET", imagnet);
239  bl->set_double_param("field_y", dipole_field_x);
240  bl->set_double_param("fieldgradient", fieldgradient);
241  bl->set_string_param("magtype", magtype);
242  bl->set_double_param("length", length);
243  bl->set_double_param("place_x", x);// relative position to mother vol.
244  bl->set_double_param("place_y", y);// relative position to mother vol.
245  bl->set_double_param("place_z", z - hFarBwdBeamLine::enclosure_center);// relative position to mother vol.
246  bl->set_double_param("rot_y", angle);
247 
248  bl->set_double_param("field_global_position_x", x);// abs. position to world for field manager
249  bl->set_double_param("field_global_position_y", y);// abs. position to world for field manager
250  bl->set_double_param("field_global_position_z", z);// abs. position to world for field manager
251  bl->set_double_param("field_global_rot_y", angle);// abs. rotation to world for field manager
252  bl->set_double_param("inner_radius", inner_radius_zin);
253  bl->set_double_param("outer_radius", outer_magnet_diameter / 2.);
254  bl->SetActive(magnet_active);
255  bl->BlackHole();
257  if (absorberactive)
258  {
259  bl->SetAbsorberActive();
260  }
261  bl->OverlapCheck(overlapCheck);
262  bl->SuperDetector("BWDBEAMLINEMAGNET");
263  if (verbosity)
264  bl->Verbosity(verbosity);
265  g4Reco->registerSubsystem(bl);
266 
267  // rag the B0 magnet
268  if (imagnet == 0)
270  }
271  imagnet++;
272  if (fabs(z) + length > biggest_z)
273  {
274  biggest_z = fabs(z) + length;
275  }
276  }
277  }
278  }
279  infile.close();
280  }
281 
282 }
283 
285 {
286 
287 // bool overlapCheck = Enable::OVERLAPCHECK || Enable::HFARBWD_OVERLAPCHECK;
288 // if (Enable::HFARBWD_VIRTUAL_DETECTORS_IP6 && Enable::HFARBWD_VIRTUAL_DETECTORS_IP8)
289 // {
290 // cout << "You cannot have detectors enabled for both IP6 and IP8 ON at the same time" << endl;
291 // gSystem->Exit(1);
292 // }
293 //
294 // int verbosity = std::max(Enable::VERBOSITY, Enable::HFARBWD_VERBOSITY);
295 //
296 // auto *detBackward = new PHG4CylinderSubsystem("detBackward");
297 // detBackward->SuperDetector("backTruth");
298 // detBackward->set_double_param("place_x", 0);
299 // detBackward->set_double_param("place_y", 0);
301 // detBackward->set_double_param("place_z", -500 - hFarBwdBeamLine::enclosure_center);
302 // detBackward->set_double_param("rot_y", 0);
303 // detBackward->set_double_param("radius", 0);
304 // detBackward->set_double_param("thickness", 30); // This is intentionally made large 25cm radius
305 // detBackward->set_double_param("length", 0.03);
306 // detBackward->set_string_param("material", "G4_Si");
307 //
308 // detBackward->SetMotherSubsystem(hFarBwdBeamLine::hFarBwdBeamLineEnclosure);
309 //
310 //
311 // detBackward->SetActive();
312 // detBackward->OverlapCheck(overlapCheck);
313 // detBackward->set_color(1, 0, 0, 0.5);
314 //
315 // detBackward->BlackHole();
316 // if (verbosity) detBackward->Verbosity(verbosity);
317 // g4Reco->registerSubsystem(detBackward);
318 //
320 
321  // **********************************************
322  // Luminosity monitor
323 
324  bool overlapCheck = Enable::OVERLAPCHECK || Enable::HFARBWD_OVERLAPCHECK;
326  {
327  cout << "You cannot have detectors enabled for both IP6 and IP8 ON at the same time" << endl;
328  gSystem->Exit(1);
329  }
330 
332 
333 // auto *detLumi = new PHG4CylinderSubsystem("detLumi");
334 // detLumi->SuperDetector("backLumi");
335 // detLumi->set_double_param("place_x", 0);
336 // detLumi->set_double_param("place_y", 0);
337 // detLumi->set_double_param("place_z", -3400 - hFarBwdBeamLine::enclosure_center);
338 // detLumi->set_double_param("rot_y", 0);
339 // detLumi->set_double_param("radius", 0);
340 // detLumi->set_double_param("thickness", 20); // This is intentionally made large 25cm radius
341 // detLumi->set_double_param("length", 0.03);
342 // detLumi->set_string_param("material", "G4_Si");
343 // detLumi->SetMotherSubsystem(hFarBwdBeamLine::hFarBwdBeamLineEnclosure);
344 
345 // detLumi->SetActive();
346 // detLumi->OverlapCheck(overlapCheck);
347 // detLumi->set_color(0, 1, 0, 0.5);
348 
349 // detLumi->BlackHole();
350 // if (verbosity) detLumi->Verbosity(verbosity);
351 // g4Reco->registerSubsystem(detLumi);
352 
353  // **********************************************
354  // Low Q2 Tagger
355  // There are two set of Q2 taggers: 1st at 24m; 2nd at 37m.
356  //
357  // 1st Set of Low Q2 tagger, z location 24m
358 
359 // auto *detLowQ2Tag_1 = new PHG4CylinderSubsystem("detLowQ2Tag_1");
360 
361 // auto *detLowQ2Tag_1= new PHG4BlockSubsystem("detLowQ2Tag_1");
362 
363 // detLowQ2Tag_1->SuperDetector("backLowQ2Tag_1");
364 // detLowQ2Tag_1->set_double_param("place_x", -50);
365 // detLowQ2Tag_1->set_double_param("place_y", 0);
366 // detLowQ2Tag_1->set_double_param("place_z", -2400 - hFarBwdBeamLine::enclosure_center);
367 // detLowQ2Tag_1->set_double_param("rot_y", 0);
368 // detLowQ2Tag_1->set_double_param("radius", 0);
369 // detLowQ2Tag_1->set_double_param("thickness", 30); // This is intentionally made large 25cm radius
370 // detLowQ2Tag_1->set_double_param("size_x", 50); // This is intentionally made large 25cm radius
371 // detLowQ2Tag_1->set_double_param("size_y", 35); // This is intentionally made large 25cm radius
372 // detLowQ2Tag_1->set_double_param("size_z", 0.03); // This is intentionally made large 25cm radius
373 // detLowQ2Tag_1->set_double_param("length", 0.03);
374 // detLowQ2Tag_1->set_string_param("material", "G4_Si");
375 // detLowQ2Tag_1->SetMotherSubsystem(hFarBwdBeamLine::hFarBwdBeamLineEnclosure);
376 
377 // detLowQ2Tag_1->SetActive();
378 // detLowQ2Tag_1->OverlapCheck(overlapCheck);
379 // detLowQ2Tag_1->set_color(1, 0, 0, 0.5);
380 
381 // detLowQ2Tag_1->BlackHole();
382 // if (verbosity) detLowQ2Tag_1->Verbosity(verbosity);
383 // g4Reco->registerSubsystem(detLowQ2Tag_1);
384 
385 
386  // 2nd Set of Low Q2 tagger, z location 37m
387 
388 // auto *detLowQ2Tag_2 = new PHG4CylinderSubsystem("detLowQ2Tag_2");
389 // auto *detLowQ2Tag_2 = new PHG4BlockSubsystem("detLowQ2Tag_2");
390 // detLowQ2Tag_2->SuperDetector("backLowQ2Tag_2");
391 // detLowQ2Tag_2->set_double_param("place_x", -80);
392 // detLowQ2Tag_2->set_double_param("place_y", 0);
393 // detLowQ2Tag_2->set_double_param("place_z", -3700 - hFarBwdBeamLine::enclosure_center);
394 // detLowQ2Tag_2->set_double_param("rot_y", 0);
395 // detLowQ2Tag_2->set_double_param("radius", 0);
396 // detLowQ2Tag_2->set_double_param("thickness", 30); // This is intentionally made large 25cm radius
397 // detLowQ2Tag_2->set_double_param("size_x", 50); // This is intentionally made large 25cm radius
398 // detLowQ2Tag_2->set_double_param("size_y", 35); // This is intentionally made large 25cm radius
399 // detLowQ2Tag_2->set_double_param("size_z", 0.03); // This is intentionally made large 25cm radius
400 // detLowQ2Tag_2->set_double_param("length", 0.03);
401 // detLowQ2Tag_2->set_string_param("material", "G4_Si");
402 // detLowQ2Tag_2->SetMotherSubsystem(hFarBwdBeamLine::hFarBwdBeamLineEnclosure);
403 
404 // detLowQ2Tag_2->SetActive();
405 // detLowQ2Tag_2->OverlapCheck(overlapCheck);
406 // detLowQ2Tag_2->set_color(1, 0, 0, 0.5);
407 
408 // detLowQ2Tag_2->BlackHole();
409 // if (verbosity) detLowQ2Tag_2->Verbosity(verbosity);
410 // g4Reco->registerSubsystem(detLowQ2Tag_2);
411 
412  if (Enable::BWD) {
413 
414  //-----------------------------------------------------------------------
415  // New Luminosity detector design with input from Jaroslav and Bill Schmidke
416 
417  string paramFileLumi = string(getenv("CALIBRATIONROOT")) + "/LumiMonAndTaggers/LumiMon.dat";
418 
419  auto *LumiDet = new EICG4LumiSubsystem("Lumi");
420  LumiDet->SetParametersFromFile( paramFileLumi );
421  LumiDet->OverlapCheck( overlapCheck );
422  LumiDet->set_double_param("FBenclosure_center", hFarBwdBeamLine::enclosure_center );
423  LumiDet->SetMotherSubsystem( hFarBwdBeamLine::hFarBwdBeamLineEnclosure );
424  LumiDet->SetActive( true );
425  if( verbosity ) { LumiDet->Verbosity( verbosity ); }
426  g4Reco->registerSubsystem( LumiDet );
427 
428  //-----------------------------------------------------------------------
429 
430  /*
431  int DetNr = 5; //number of Backward Detectors
432  string bwddetname[5]={" is the first Q2 tagger", " is the second Q2 tagger", " is Lumi 0"," is Lumi +"," is Lumi -"};
433 // string mapname[5]={"BWD_mapping_v1.txt","BWD_mapping_v2.txt","BWD_mapping_v3.txt","BWD_mapping_v3.txt","BWD_mapping_v3.txt"};
434  float placex[5] = {-50,-80,0,0,0};
435  //float placex[5] = {0,0,0,0,0};
436  float placey[5] = {0,0,0,30,-30};
437  float placez[5] = {-118.5, - 818.5, -818.5,-718.5,-718.5};
438  float length = 20;
439  float Si_length = .1;
440  float Cu_length = .2;
441  float C_length = 40;
442  float width[5] = {40.5, 30, 16,16,16};
443  float height[5] = {40.5, 21, 16,8,8};
444  int deti=0;
445  for (int i = 0; i < DetNr; i ++){
446  if (!Enable::BWDN[i])continue;
447  cout <<"Detector "<<i<<bwddetname[i]<<endl;
448  ostringstream mapping_bwd;
449  mapping_bwd << getenv("CALIBRATIONROOT") << "/BWD/mapping/"<<G4BWD::mapname[i];
450  //mapping_bwd << G4BWD::mapname[i]; // Specify the mapping file for B0 ECal Towers here
451  auto *Bwd = new EICG4BwdSubsystem("BWD");
452  Bwd->SetTowerMappingFile(mapping_bwd.str());
453  Bwd->SuperDetector(Form("BWD_%d", i));
454  Bwd->set_double_param("place_x", placex[i]);
455  Bwd->set_double_param("place_y", placey[i]);
456  Bwd->set_double_param("place_z", placez[i]-length/2);
457  Bwd->set_double_param("length", length);
458  Bwd->set_double_param("width", width[i]);
459  Bwd->set_double_param("height", height[i]);
460  Bwd->set_string_param("material", "G4_PbWO4");
461  Bwd->set_double_param("detid",deti);
462  Bwd->set_double_param("global_x", placex[i]);
463  Bwd->set_double_param("global_y", placey[i]);
464  Bwd->set_double_param("global_z", placez[i]-length/2 + hFarBwdBeamLine::enclosure_center);
465  Bwd->set_int_param("lightyield",1); //Note additional parameter for storing Light Yield in B0 Ecal
466  Bwd->SetActive(true);
467  if (verbosity)
468  Bwd->Verbosity(verbosity);
469  Bwd->OverlapCheck(overlapCheck);
470  Bwd->SetMotherSubsystem(hFarBwdBeamLine::hFarBwdBeamLineEnclosure);
471  g4Reco->registerSubsystem(Bwd);
472  deti++;
473  if (i != 2){
474  auto *Bwdt = new EICG4BwdSubsystem("BWD");
475  Bwdt->SuperDetector(Form("BWDt_%d", i));
476  Bwdt->set_double_param("place_x", placex[i]);
477  Bwdt->set_double_param("place_y", placey[i]);
478  Bwdt->set_double_param("place_z", placez[i]+Si_length/2+Cu_length/2+1);
479  Bwdt->set_double_param("length", Si_length);
480  Bwdt->set_double_param("width", width[i]);
481  Bwdt->set_double_param("height", height[i]);
482  Bwdt->set_string_param("material", "G4_Si");
483  Bwdt->set_double_param("detid",deti);
484  Bwdt->set_double_param("global_x", placex[i]);
485  Bwdt->set_double_param("global_y", placey[i]);
486  Bwdt->set_double_param("global_z", placez[i]+Si_length/2 +Cu_length/2+1+ hFarBwdBeamLine::enclosure_center);
487  Bwdt->set_int_param("lightyield",0); //Note additional parameter for storing Light Yield in B0 Ecal
488  Bwdt->SetActive(true);
489  if (verbosity)
490  Bwdt->Verbosity(verbosity);
491  Bwdt->OverlapCheck(overlapCheck);
492  Bwdt->SetMotherSubsystem(hFarBwdBeamLine::hFarBwdBeamLineEnclosure);
493  g4Reco->registerSubsystem(Bwdt);
494  deti++;
495  auto *Bwdd = new EICG4BwdSubsystem("BWD");
496  Bwdd->SuperDetector(Form("BWDd_%d", i));
497  Bwdd->set_double_param("place_x", placex[i]);
498  Bwdd->set_double_param("place_y", placey[i]);
499  Bwdd->set_double_param("place_z", placez[i]+Cu_length/2+1);
500  Bwdd->set_double_param("length", Cu_length);
501  Bwdd->set_double_param("width", width[i]);
502  Bwdd->set_double_param("height", height[i]);
503  Bwdd->set_string_param("material", "G4_Cu");
504  Bwdd->set_double_param("detid",deti);
505  Bwdd->set_double_param("global_x", placex[i]);
506  Bwdd->set_double_param("global_y", placey[i]);
507  Bwdd->set_double_param("global_z", placez[i]+Cu_length/2 +1+ hFarBwdBeamLine::enclosure_center);
508  Bwdd->set_int_param("lightyield",0); //Note additional parameter for storing Light Yield in B0 Ecal
509  Bwdd->SetActive(false);
510  if (verbosity)
511  Bwdd->Verbosity(verbosity);
512  Bwdd->OverlapCheck(overlapCheck);
513  Bwdd->SetMotherSubsystem(hFarBwdBeamLine::hFarBwdBeamLineEnclosure);
514  g4Reco->registerSubsystem(Bwdd);
515  deti++;
516  }
517  else{
518  auto *Bwdd = new EICG4BwdSubsystem("BWD");
519  Bwdd->SuperDetector(Form("BWDd_%d", i));
520  Bwdd->set_double_param("place_x", placex[i]);
521  Bwdd->set_double_param("place_y", placey[i]);
522  Bwdd->set_double_param("place_z", placez[i]+C_length/2+1);
523  Bwdd->set_double_param("length", C_length);
524  Bwdd->set_double_param("width", width[i]);
525  Bwdd->set_double_param("height", height[i]);
526  Bwdd->set_string_param("material", "G4_C");
527  Bwdd->set_double_param("detid",deti);
528  Bwdd->set_double_param("global_x", placex[i]);
529  Bwdd->set_double_param("global_y", placey[i]);
530  Bwdd->set_double_param("global_z", placez[i]+C_length/2 +1+ hFarBwdBeamLine::enclosure_center);
531  Bwdd->set_int_param("lightyield",0); //Note additional parameter for storing Light Yield in B0 Ecal
532  Bwdd->SetActive(false);
533  if (verbosity)
534  Bwdd->Verbosity(verbosity);
535  Bwdd->OverlapCheck(overlapCheck);
536  Bwdd->SetMotherSubsystem(hFarBwdBeamLine::hFarBwdBeamLineEnclosure);
537  g4Reco->registerSubsystem(Bwdd);
538  deti++;
539 
540  }
541  }
542  */
543  }
544 // int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY);
545 
546 }
547 
549 {
550 // cout << __PRETTY_FUNCTION__ << " : IP8 setup is not yet validated!" << endl;
551 // gSystem->Exit(1);
552 
553  bool overlapCheck = Enable::OVERLAPCHECK || Enable::HFARBWD_OVERLAPCHECK;
555  {
556  cout << "You cannot have detectors enabled for both IP6 and IP8 ON at the same time" << endl;
557  gSystem->Exit(1);
558  }
559 
561 
562  auto *detBackward = new PHG4CylinderSubsystem("detBackward");
563  detBackward->SuperDetector("backTruth");
564  detBackward->set_double_param("place_x", 0);
565  detBackward->set_double_param("place_y", 0);
566 // detBackward->set_double_param("place_z", -500);
567  detBackward->set_double_param("place_z", -500 - hFarBwdBeamLine::enclosure_center);
568  detBackward->set_double_param("rot_y", 0);
569  detBackward->set_double_param("radius", 0);
570  detBackward->set_double_param("thickness", 30); // This is intentionally made large 25cm radius
571  detBackward->set_double_param("length", 0.03);
572  detBackward->set_string_param("material", "G4_Si");
573 
574  detBackward->SetMotherSubsystem(hFarBwdBeamLine::hFarBwdBeamLineEnclosure);
575 
576  detBackward->SetActive();
577  detBackward->OverlapCheck(overlapCheck);
578  detBackward->set_color(1, 0, 0, 0.5);
579 
580  detBackward->BlackHole();
581  if (verbosity) detBackward->Verbosity(verbosity);
582  g4Reco->registerSubsystem(detBackward);
583 
584 // int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY);
585 
586 }
587 
589 {
590 // int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY);
591 }
592 
593 
594 
595 
596 
597 #endif