Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PHG4Reco.cc
Go to the documentation of this file.
1 #include "PHG4Reco.h"
2 
4 #include "PHG4InEvent.h"
5 #include "PHG4PhenixDetector.h"
10 #include "PHG4Subsystem.h"
11 #include "PHG4TrackingAction.h"
12 #include "PHG4UIsession.h"
13 #include "PHG4Utils.h"
14 
15 #include <g4decayer/EDecayType.hh>
17 
18 #include <phgeom/PHGeomUtility.h>
19 
21 
22 #include <phfield/PHFieldUtility.h>
23 #include <phfield/PHFieldConfig_v1.h>
24 #include <phfield/PHFieldConfig_v2.h>
25 #include <phfield/PHFieldConfig_v3.h>
26 
28 
29 #include <phool/PHCompositeNode.h>
30 #include <phool/PHRandomSeed.h>
31 #include <phool/getClass.h>
32 #include <phool/recoConsts.h>
33 
34 #include <phparameter/PHParameters.h>
35 
36 #include <TThread.h>
37 
38 #include <CLHEP/Random/Random.h>
39 
40 #include <Geant4/G4RunManager.hh>
41 
42 #include <Geant4/G4Material.hh>
43 #include <Geant4/G4NistManager.hh>
44 #include <Geant4/G4OpenGLImmediateX.hh>
45 #include <Geant4/G4Region.hh>
46 #include <Geant4/G4RegionStore.hh>
47 #include <Geant4/G4StepLimiterPhysics.hh>
48 #include <Geant4/G4UIExecutive.hh>
49 #include <Geant4/G4UImanager.hh>
50 #include <Geant4/G4VisExecutive.hh>
51 #include <Geant4/G4Cerenkov.hh>
52 #include <Geant4/G4EmProcessOptions.hh>
53 #include <Geant4/G4EmSaturation.hh>
54 #include <Geant4/G4FastSimulationManager.hh>
55 #include <Geant4/G4HadronicProcessStore.hh>
56 #include <Geant4/G4LossTableManager.hh>
57 #include <Geant4/G4OpAbsorption.hh>
58 #include <Geant4/G4OpBoundaryProcess.hh>
59 #include <Geant4/G4OpMieHG.hh>
60 #include <Geant4/G4OpRayleigh.hh>
61 #include <Geant4/G4OpWLS.hh>
62 #include <Geant4/G4OpticalPhoton.hh>
63 #include <Geant4/G4OpticalPhysics.hh>
64 #include <Geant4/G4PAIModel.hh>
65 #include <Geant4/G4PEEffectFluoModel.hh>
66 #include <Geant4/G4EmProcessOptions.hh>
67 #include <Geant4/G4HadronicProcessStore.hh>
68 #include <Geant4/G4StepLimiterPhysics.hh>
69 #include <Geant4/G4ParticleDefinition.hh>
70 #include <Geant4/G4ParticleTable.hh>
71 #include <Geant4/G4ParticleTypes.hh>
72 #include <Geant4/G4ProcessManager.hh>
73 #include <Geant4/G4Scintillation.hh>
74 #include <Geant4/G4SystemOfUnits.hh>
75 #include <Geant4/G4Version.hh>
76 #include <Geant4/globals.hh>
77 
78 // physics lists
79 #include <Geant4/FTFP_BERT.hh>
80 #include <Geant4/LBE.hh>
81 #include <Geant4/QGSP_BERT.hh>
82 #include <Geant4/QGSP_BIC.hh>
83 #include <Geant4/QGSP_BIC_HP.hh>
84 
85 #if G4VERSION_NUMBER <= 951
86 #define HAVE_LHEP
87 #include <Geant4/LHEP.hh>
88 #endif
89 
90 #if G4VERSION_NUMBER >= 1001
91 #define HAVE_FTFP_BERT_HP
92 #define HAVE_QGSP_BERT_HP
93 #include <Geant4/FTFP_BERT_HP.hh>
94 #include <Geant4/QGSP_BERT_HP.hh>
95 #endif
96 
97 //#include <boost/filesystem.hpp>
98 //#include <boost/foreach.hpp>
99 
100 #include <memory>
101 #include <cassert>
102 #include <cstdlib>
103 #include <cstring>
104 #include <sstream>
105 #include <iterator>
106 
107 using namespace std;
108 
109 static TThread *gui_thread = nullptr;
110 
111 // for the G4 cmd line interface
112 G4UImanager *UImanager = nullptr;
113 
114 // the gui thread
115 void g4guithread(void *ptr);
116 
117 //_________________________________________________________________
118 PHG4Reco::PHG4Reco(const string &name)
119  : SubsysReco(name)
120  , magfield(0.)
121  , magfield_rescale(1.0)
122  , field_(nullptr)
123  , runManager_(nullptr)
124  , uisession_(nullptr)
125  , detector_(nullptr)
126  , eventAction_(nullptr)
127  , steppingAction_(nullptr)
128  , trackingAction_(nullptr)
129  , generatorAction_(nullptr)
130  , visManager(nullptr)
131  , _eta_coverage(1.0)
132  , mapdim(PHFieldConfig::kFieldUniform)
133  , fieldmapfile("")
134  , worldshape("G4Tubs")
135  , worldmaterial("G4_AIR")
136 #if G4VERSION_NUMBER >= 1033
137  , physicslist("FTFP_BERT")
138 #else
139  , physicslist("QGSP_BERT")
140 #endif
141  , active_decayer_(true)
142  , active_force_decay_(false)
143  , force_decay_type_(kAll)
144  , save_DST_geometry_(true)
145  , optical_photon_(false)
146  , energy_threshold_(0.0005)
147  , zero_field_line_(99999.)
148  , _timer(PHTimeServer::get()->insert_new(name))
149 {
150  for (int i = 0; i < 3; i++)
151  {
152  WorldSize[i] = 1000.;
153  }
154  return;
155 }
156 
157 //_________________________________________________________________
159 {
160  // one can delete null pointer (it results in a nop), so checking if
161  // they are non zero is not needed
162  delete gui_thread;
163  delete field_;
164  delete runManager_;
165  delete uisession_;
166  delete visManager;
167  while (subsystems_.begin() != subsystems_.end())
168  {
169  delete subsystems_.back();
170  subsystems_.pop_back();
171  }
172 }
173 
174 //_________________________________________________________________
176 {
177  if (verbosity > 0)
178  {
179  cout << "========================= PHG4Reco::Init() ================================" << endl;
180  }
181  unsigned int iseed = PHRandomSeed();
182  G4Seed(iseed); // fixed seed handled in PHRandomSeed()
183 
184  // create GEANT run manager
185  if (verbosity > 1) cout << "PHG4Reco::Init - create run manager" << endl;
186 
187  // redirect GEANT verbosity to nowhere
188 // if (verbosity < 1)
189  if (0)
190  {
191  G4UImanager *uimanager = G4UImanager::GetUIpointer();
192  uisession_ = new PHG4UIsession();
193  uimanager->SetSession(uisession_);
194  uimanager->SetCoutDestination(uisession_);
195  }
196 
197  runManager_ = new G4RunManager();
198 
199  DefineMaterials();
200  // create physics processes
201  G4VModularPhysicsList *myphysicslist = nullptr;
202  if (physicslist == "FTFP_BERT")
203  {
204  myphysicslist = new FTFP_BERT(verbosity);
205  }
206  else if (physicslist == "QGSP_BERT")
207  {
208  myphysicslist = new QGSP_BERT(verbosity);
209  }
210  else if (physicslist == "QGSP_BIC")
211  {
212  myphysicslist = new QGSP_BIC(verbosity);
213  }
214  else if (physicslist == "QGSP_BIC_HP")
215  {
216  setenv("AllowForHeavyElements", "1", 1);
217  myphysicslist = new QGSP_BIC_HP(verbosity);
218  }
219 #ifdef HAVE_LHEP
220  else if (physicslist == "LHEP")
221  {
222  myphysicslist = new LHEP(verbosity);
223  }
224 #endif
225 #ifdef HAVE_FTFP_BERT_HP
226  else if (physicslist == "FTFP_BERT_HP")
227  {
228  setenv("AllowForHeavyElements", "1", 1);
229  myphysicslist = new FTFP_BERT_HP(verbosity);
230  }
231 #endif
232 #ifdef HAVE_QGSP_BERT_HP
233  else if (physicslist == "QGSP_BERT_HP")
234  {
235  setenv("AllowForHeavyElements", "1", 1);
236  myphysicslist = new QGSP_BERT_HP(verbosity);
237  }
238 #endif
239  else
240  {
241  cout << "Physics List " << physicslist << " not implemented" << endl;
242  gSystem->Exit(1);
243  }
244 
245  if (active_decayer_)
246  {
249  myphysicslist->RegisterPhysics(decayer);
250  }
251  myphysicslist->RegisterPhysics(new G4StepLimiterPhysics());
252 // initialize cuts so we can ask the world region for it's default
253 // cuts to propagate them to other regions in DefineRegions()
254  myphysicslist->SetCutsWithDefault();
255  runManager_->SetUserInitialization(myphysicslist);
256 
257  DefineRegions();
258 #if G4VERSION_NUMBER >= 1033
259  G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
260  if (! emSaturation)
261  {
262  cout << PHWHERE << "Could not initialize EmSaturation, Birks constants will fail" << endl;
263  }
264 #endif
265  // initialize registered subsystems
266  //BOOST_FOREACH (SubsysReco *reco, subsystems_)
267  for (SubsysReco *reco : subsystems_)
268  {
269  reco->Init(topNode);
270  }
271 
272  if (verbosity > 0)
273  {
274  cout << "===========================================================================" << endl;
275  }
276  return 0;
277 }
278 
280 {
281  if (verbosity > 1) cout << "PHG4Reco::InitField - create magnetic field setup" << endl;
282 
283  unique_ptr<PHFieldConfig> default_field_cfg(nullptr);
284 
285  std::istringstream ssfieldmapfile(fieldmapfile);
286  std::vector<std::string> fieldmapfiles(std::istream_iterator<std::string>{ssfieldmapfile},
287  std::istream_iterator<std::string>());
288 
289  if (fieldmapfiles.size() == 1)
290  {
291  default_field_cfg.reset(new PHFieldConfig_v1(mapdim, fieldmapfile, magfield_rescale));
292  }
293  else if (fieldmapfiles.size() == 0)
294  {
295  default_field_cfg.reset(new PHFieldConfig_v2(0, magfield * magfield_rescale, 0));
296  }
297  else if (fieldmapfiles.size() == 2)
298  {
299  default_field_cfg.reset(new PHFieldConfig_v3(
300  fieldmapfiles[0], fieldmapfiles[1], 1.0, 1.0, 5.0
301  ));
302  }
303  else if (fieldmapfiles.size() == 5)
304  {
305  default_field_cfg.reset(new PHFieldConfig_v3(
306  fieldmapfiles[0], fieldmapfiles[1], std::stod(fieldmapfiles[2]), std::stod(fieldmapfiles[3]), std::stod(fieldmapfiles[4])
307  ));
308  }
309 
310  if (verbosity > 1) cout << "PHG4Reco::InitField - create magnetic field setup" << endl;
311 
312  PHField * phfield = PHFieldUtility::GetFieldMapNode(default_field_cfg.get(), topNode, Verbosity()+1);
313  assert(phfield);
314 
315  field_ = new G4TBMagneticFieldSetup(phfield);
316 
318 }
319 
321 {
322  // this is a dumb protection against executing this twice.
323  // we have cases (currently detector display or material scan) where
324  // we need the detector bu have not run any events (who wants to wait
325  // for processing an event if you just want a detector display?).
326  // Then the InitRun is executed from a macro. But if you decide to run events
327  // afterwards, the InitRun is executed by the framework together with all
328  // other modules. This prevents the PHG4Reco::InitRun() to be executed
329  // again in this case
330  static int InitRunDone = 0;
331  if (InitRunDone)
332  {
334  }
335  InitRunDone = 1;
336  if (verbosity > 0)
337  {
338  cout << "========================= PHG4Reco::InitRun() ================================" << endl;
339  }
340 
342 
343  //setup the constant field
344  const int field_ret = InitField(topNode);
345  if (field_ret!=Fun4AllReturnCodes::EVENT_OK)
346  {
347  cout <<"PHG4Reco::InitRun- Error - Failed field init with status = "<<field_ret<<endl;
348  return field_ret;
349  }
350 
351  // initialize registered subsystems
352  //BOOST_FOREACH (SubsysReco *reco, subsystems_)
353  for (SubsysReco *reco : subsystems_)
354  {
355  reco->InitRun(topNode);
356  }
357 
358  // create phenix detector, add subsystems, and register to GEANT
359  if (verbosity > 1) cout << "PHG4Reco::Init - create detector" << endl;
369 
370  rc->set_FloatFlag("WorldSizex", WorldSize[0]);
371  rc->set_FloatFlag("WorldSizey", WorldSize[1]);
372  rc->set_FloatFlag("WorldSizez", WorldSize[2]);
373 
374  double z_offset = 0.;
375  if(fabs(zero_field_line_) < 0.5*WorldSize[2])
376  {
377  z_offset = 0.5*(zero_field_line_ + 0.5*WorldSize[2]); //unit cm
378  cout << "Will update the z-positions of the downstream volumes by zOffset = " << z_offset << "cm." << endl;
379  }
380 
381  //BOOST_FOREACH (PHG4Subsystem *g4sub, subsystems_)
382  for (PHG4Subsystem *g4sub : subsystems_)
383  {
384  //re-calculate the place_z for some of the volumes in the non-field-zone
385  if(fabs(zero_field_line_) < 0.5*WorldSize[2] && g4sub->GetParams() != nullptr) //only true for class inherited from PHG4DetectorSubsystem
386  {
387  double z_in_world = g4sub->GetParams()->get_double_param("place_z");
388  if(z_in_world > zero_field_line_)
389  {
390  g4sub->GetParams()->set_double_param("place_z", z_in_world - z_offset);
391  detector_->AddDetector(g4sub->GetDetector(), 1);
392  }
393  else
394  {
395  detector_->AddDetector(g4sub->GetDetector(), 0);
396  }
397  }
398  else
399  {
400  detector_->AddDetector(g4sub->GetDetector(), 0);
401  }
402  }
403  runManager_->SetUserInitialization(detector_);
404 
405  setupInputEventNodeReader(topNode);
406  // create main event action, add subsystemts and register to GEANT
408 
409  //BOOST_FOREACH (PHG4Subsystem *g4sub, subsystems_)
410  for (PHG4Subsystem *g4sub : subsystems_)
411  {
412  PHG4EventAction *evtact = g4sub->GetEventAction();
413  if (evtact)
414  {
415  eventAction_->AddAction(evtact);
416  }
417  }
418  runManager_->SetUserAction(eventAction_);
419 
420  // create main stepping action, add subsystems and register to GEANT
423  //BOOST_FOREACH (PHG4Subsystem *g4sub, subsystems_)
424  for (PHG4Subsystem *g4sub : subsystems_)
425  {
426  PHG4SteppingAction *action = g4sub->GetSteppingAction();
427  if (action)
428  {
429  if (verbosity > 1)
430  {
431  cout << "Adding steppingaction for " << g4sub->Name() << endl;
432  }
433  steppingAction_->AddAction(g4sub->GetSteppingAction());
434  }
435  }
436  runManager_->SetUserAction(steppingAction_);
437 
438  // create main tracking action, add subsystems and register to GEANT
440  //BOOST_FOREACH (PHG4Subsystem *g4sub, subsystems_)
441  for (PHG4Subsystem *g4sub : subsystems_)
442  {
443  trackingAction_->AddAction(g4sub->GetTrackingAction());
444 
445  // not all subsystems define a user tracking action
446  if (g4sub->GetTrackingAction())
447  {
448  // make tracking manager accessible within user tracking action if defined
449  if (G4TrackingManager *trackingManager = G4EventManager::GetEventManager()->GetTrackingManager())
450  {
451  g4sub->GetTrackingAction()->SetTrackingManagerPointer(trackingManager);
452  }
453  }
454  }
455 
456  runManager_->SetUserAction(trackingAction_);
457 
458  // initialize
459  runManager_->Initialize();
460 
461  if(optical_photon_)
462  {
463  // add cerenkov and optical photon processes
464  // cout << endl << "Ignore the next message - we implemented this correctly" << endl;
465  G4Cerenkov *theCerenkovProcess = new G4Cerenkov("Cerenkov");
466  // cout << "End of bogus warning message" << endl << endl;
467  // G4Scintillation* theScintillationProcess = new G4Scintillation("Scintillation");
468 
469 
470  // if (verbosity > 0)
471  // {
472  // // This segfaults
473  // theCerenkovProcess->DumpPhysicsTable();
474  // }
475 
476  theCerenkovProcess->SetMaxNumPhotonsPerStep(100);
477  theCerenkovProcess->SetMaxBetaChangePerStep(10.0);
478  theCerenkovProcess->SetTrackSecondariesFirst(true);
479 
480  // theScintillationProcess->SetScintillationYieldFactor(1.);
481  // theScintillationProcess->SetTrackSecondariesFirst(true);
482 
483  // Use Birks Correction in the Scintillation process
484 
485  // G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
486  // theScintillationProcess->AddSaturation(emSaturation);
487 
488  G4ParticleTable *theParticleTable = G4ParticleTable::GetParticleTable();
489  G4ParticleTable::G4PTblDicIterator *_theParticleIterator;
490  _theParticleIterator = theParticleTable->GetIterator();
491  _theParticleIterator->reset();
492  while ((*_theParticleIterator)())
493  {
494  G4ParticleDefinition *particle = _theParticleIterator->value();
495  G4String particleName = particle->GetParticleName();
496  G4ProcessManager *pmanager = particle->GetProcessManager();
497  if (theCerenkovProcess->IsApplicable(*particle))
498  {
499  pmanager->AddProcess(theCerenkovProcess);
500  pmanager->SetProcessOrdering(theCerenkovProcess, idxPostStep);
501  }
502  // if (theScintillationProcess->IsApplicable(*particle))
503  // {
504  // pmanager->AddProcess(theScintillationProcess);
505  // pmanager->SetProcessOrderingToLast(theScintillationProcess, idxAtRest);
506  // pmanager->SetProcessOrderingToLast(theScintillationProcess, idxPostStep);
507  // }
508  }
509  G4ProcessManager *pmanager = G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
510  // G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
511  pmanager->AddDiscreteProcess(new G4OpAbsorption());
512  pmanager->AddDiscreteProcess(new G4OpRayleigh());
513  pmanager->AddDiscreteProcess(new G4OpMieHG());
514  pmanager->AddDiscreteProcess(new G4OpBoundaryProcess());
515  pmanager->AddDiscreteProcess(new G4OpWLS());
516  pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
517  // pmanager->DumpInfo();
518 
519  // needs large amount of memory which kills central hijing events
520  // store generated trajectories
521  //if( G4TrackingManager* trackingManager = G4EventManager::GetEventManager()->GetTrackingManager() ){
522  // trackingManager->SetStoreTrajectory( true );
523  //}
524  }
525 
526  // quiet some G4 print-outs (EM and Hadronic settings during first event)
527  G4HadronicProcessStore::Instance()->SetVerbose(0);
528  G4LossTableManager::Instance()->SetVerbose(1);
529 
530  if ((verbosity < 1) && (uisession_))
531  {
532  uisession_->Verbosity(1); // let messages after setup come through
533  }
534 
535  // Geometry export to DST
536  if (save_DST_geometry_)
537  {
538  const string filename =
541  cout << "PHG4Reco::InitRun - export geometry to DST via tmp file " << filename << endl;
542 
543  Dump_GDML(filename);
544 
545  PHGeomUtility::ImportGeomFile(topNode, filename);
546 
548  }
549 
550  if (verbosity > 0)
551  {
552  cout << "===========================================================================" << endl;
553  }
554 
555  return 0;
556 }
557 
558 //________________________________________________________________
559 //Dump TGeo File
560 void PHG4Reco::Dump_GDML(const std::string &filename)
561 {
563 }
564 
565 //_________________________________________________________________
566 int PHG4Reco::ApplyCommand(const std::string &cmd)
567 {
568  InitUImanager();
569  int iret = UImanager->ApplyCommand(cmd.c_str());
570  return iret;
571 }
572 //_________________________________________________________________
573 
575 {
576  if (!gui_thread)
577  {
578  InitUImanager();
579  gui_thread = new TThread("G4Gui", g4guithread);
580  gui_thread->Run();
581  return 0;
582  }
583  return 1;
584 }
585 
587 {
588  if (!UImanager)
589  {
590  // Get the pointer to the User Interface manager
591  // Initialize visualization
592  visManager = new G4VisExecutive;
593  visManager->Initialize();
594  UImanager = G4UImanager::GetUIpointer();
595  }
596  return 0;
597 }
598 
599 //_________________________________________________________________
601 {
602  TThread::Lock();
603  // make sure Actions and subsystems have the relevant pointers set
604  PHG4InEvent *ineve = findNode::getClass<PHG4InEvent>(topNode, "PHG4INEVENT");
606 
607  //BOOST_FOREACH (SubsysReco *reco, subsystems_)
608  for (SubsysReco *reco : subsystems_)
609  {
610  if (Verbosity() >= 2)
611  cout << "PHG4Reco::process_event - " << reco->Name() << "->process_event" << endl;
612 
613  try
614  {
615  reco->process_event(topNode);
616  }
617  catch (const exception &e)
618  {
619  cout << PHWHERE << " caught exception thrown during process_event from "
620  << reco->Name() << endl;
621  cout << "error: " << e.what() << endl;
622  TThread::UnLock();
624  }
625  }
626 
627  _timer.get()->restart();
628 
629  // run one event
630  if (Verbosity() >= 2)
631  {
632  cout << " PHG4Reco::process_event - "
633  << "run one event :" << endl;
634  ineve->identify();
635  }
636  runManager_->BeamOn(1);
637  _timer.get()->stop();
638 
639  //BOOST_FOREACH (PHG4Subsystem *g4sub, subsystems_)
640  for (PHG4Subsystem *g4sub : subsystems_)
641  {
642  if (Verbosity() >= 2)
643  cout << " PHG4Reco::process_event - " << g4sub->Name() << "->process_after_geant" << endl;
644  try
645  {
646  g4sub->process_after_geant(topNode);
647  }
648  catch (const exception &e)
649  {
650  cout << PHWHERE << " caught exception thrown during process_after_geant from "
651  << g4sub->Name() << endl;
652  cout << "error: " << e.what() << endl;
653  TThread::UnLock();
655  }
656  }
657  TThread::UnLock();
658  return 0;
659 }
660 
662 {
663  //BOOST_FOREACH (SubsysReco *reco, subsystems_)
664  for (SubsysReco *reco : subsystems_)
665  {
666  reco->ResetEvent(topNode);
667  }
668  return 0;
669 }
670 
671 //_________________________________________________________________
673 {
674  return 0;
675 }
676 
677 void PHG4Reco::Print(const std::string &what) const
678 {
679  //BOOST_FOREACH (SubsysReco *reco, subsystems_)
680  for (SubsysReco *reco : subsystems_)
681  {
682  if (what.empty() || what == "ALL" || (reco->Name()).find(what) != string::npos)
683  {
684  cout << "Printing " << reco->Name() << endl;
685  reco->Print(what);
686  cout << "---------------------------" << endl;
687  }
688  }
689  return;
690 }
691 
693 {
694  PHG4InEvent *ineve = findNode::getClass<PHG4InEvent>(topNode, "PHG4INEVENT");
695  if (!ineve)
696  {
697  PHNodeIterator iter(topNode);
698  PHCompositeNode *dstNode;
699  dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
700 
701  ineve = new PHG4InEvent();
702  PHDataNode<PHObject> *newNode = new PHDataNode<PHObject>(ineve, "PHG4INEVENT", "PHObject");
703  dstNode->addNode(newNode);
704  }
706  runManager_->SetUserAction(generatorAction_);
707  return 0;
708 }
709 
710 void PHG4Reco::setGeneratorAction(G4VUserPrimaryGeneratorAction *action)
711 {
712  if (runManager_)
713  {
714  runManager_->SetUserAction(action);
715  }
716  return;
717 }
718 
719 void PHG4Reco::set_rapidity_coverage(const double eta)
720 {
721  _eta_coverage = eta;
723 }
724 
725 void PHG4Reco::G4Seed(const unsigned int i)
726 {
727  CLHEP::HepRandom::setTheSeed(i);
728  return;
729 }
730 
731 void g4guithread(void *ptr)
732 {
733  TThread::Lock();
734  G4UIExecutive *ui = new G4UIExecutive(0, nullptr, "Xm");
735  //FIXME test file exist
736  //if (ui->IsGUI() && boost::filesystem::exists("gui.mac"))
737  if (ui->IsGUI() && true)
738  {
739  UImanager->ApplyCommand("/control/execute gui.mac");
740  }
741  TThread::UnLock();
742  ui->SessionStart();
743  TThread::Lock();
744  delete ui;
745  TThread::UnLock();
746  gui_thread = nullptr;
747  return;
748 }
749 
750 //____________________________________________________________________________
752 {
753  G4String symbol; //a=mass of a mole;
754  G4double density; //z=mean number of protons;
755  G4double fractionmass;
756 
757  G4int ncomponents, natoms;
758  // this is for FTFP_BERT_HP where the neutron code barfs
759  // if the z difference to the last known element (U) is too large
760  set<G4String> ignoremat;
761  ignoremat.insert("G4_Cf");
762 
763  //load all Materials from the nist database
764  G4NistManager *nist = G4NistManager::Instance();
765  vector<G4String> matnames = nist->GetNistMaterialNames();
766  while (matnames.begin() != matnames.end())
767  {
768  G4String mat = matnames.back();
769  if (ignoremat.find(mat) == ignoremat.end())
770  {
771  nist->FindOrBuildMaterial(mat);
772  }
773  matnames.pop_back();
774  }
775  // home made compounds
776  // making quartz
777  G4Material *quartz = new G4Material("Quartz", density = 2.200 * g / cm3, ncomponents = 2);
778  quartz->AddElement(G4Element::GetElement("Si"), 1);
779  quartz->AddElement(G4Element::GetElement("O"), 2);
780 
781  // gas mixture for the MuID in fsPHENIX. CLS 02-25-14
782  G4Material *IsoButane = new G4Material("Isobutane", 0.00265 * g / cm3, 2);
783  IsoButane->AddElement(G4Element::GetElement("C"), 4);
784  IsoButane->AddElement(G4Element::GetElement("H"), 10);
785 
786  G4Material *MuIDgas = new G4Material("MuIDgas", density = (1.977e-3 * 0.92 + 0.00265 * 0.08) * g / cm3, ncomponents = 2);
787  MuIDgas->AddMaterial(IsoButane, fractionmass = 0.08);
788  MuIDgas->AddMaterial(G4Material::GetMaterial("G4_CARBON_DIOXIDE"), fractionmass = 0.92);
789 
790  // that seems to be the composition of 304 Stainless steel
791  G4Material *StainlessSteel =
792  new G4Material("SS304", density = 7.9 * g / cm3, ncomponents = 8);
793  StainlessSteel->AddElement(G4Element::GetElement("Fe"), 0.70105);
794  StainlessSteel->AddElement(G4Element::GetElement("Cr"), 0.18);
795  StainlessSteel->AddElement(G4Element::GetElement("Ni"), 0.09);
796  StainlessSteel->AddElement(G4Element::GetElement("Mn"), 0.02);
797  StainlessSteel->AddElement(G4Element::GetElement("C"), 0.0007);
798  StainlessSteel->AddElement(G4Element::GetElement("S"), 0.0003);
799  StainlessSteel->AddElement(G4Element::GetElement("Si"), 0.0075);
800  StainlessSteel->AddElement(G4Element::GetElement("P"), 0.00045);
801 
802  G4Material *SS310 =
803  new G4Material("SS310", density = 8.0 * g / cm3, ncomponents = 8);
804  SS310->AddElement(G4Element::GetElement("Fe"), 0.50455);
805  SS310->AddElement(G4Element::GetElement("Cr"), 0.25);
806  SS310->AddElement(G4Element::GetElement("Ni"), 0.20);
807  SS310->AddElement(G4Element::GetElement("Mn"), 0.02);
808  SS310->AddElement(G4Element::GetElement("C"), 0.0025);
809  SS310->AddElement(G4Element::GetElement("S"), 0.015);
810  SS310->AddElement(G4Element::GetElement("Si"), 0.0075);
811  SS310->AddElement(G4Element::GetElement("P"), 0.00045);
812 
813  G4Material *Steel =
814  new G4Material("Steel", density = 7.86 * g / cm3, ncomponents = 5);
815  Steel->AddElement(G4Element::GetElement("Fe"), 0.9834);
816  Steel->AddElement(G4Element::GetElement("Mn"), 0.014);
817  Steel->AddElement(G4Element::GetElement("C"), 0.0017);
818  Steel->AddElement(G4Element::GetElement("S"), 0.00045);
819  Steel->AddElement(G4Element::GetElement("P"), 0.00045);
820 
821  // a36 steel from http://www.matweb.com
822  G4Material *a36 = new G4Material("Steel_A36", density = 7.85 * g / cm3, ncomponents = 5);
823  a36->AddElement(G4Element::GetElement("Fe"), 0.9824);
824  a36->AddElement(G4Element::GetElement("Cu"), 0.002);
825  a36->AddElement(G4Element::GetElement("C"), 0.0025);
826  a36->AddElement(G4Element::GetElement("Mn"), 0.0103);
827  a36->AddElement(G4Element::GetElement("Si"), 0.0028);
828 
829  // 1006 steel from http://www.matweb.com
830  G4Material *steel_1006 = new G4Material("Steel_1006", density = 7.872 * g / cm3, ncomponents = 2);
831  steel_1006->AddElement(G4Element::GetElement("Fe"), 0.996);
832  steel_1006->AddElement(G4Element::GetElement("Mn"), 0.004);
833 
834  // from www.aalco.co.uk
835  G4Material *Al5083 = new G4Material("Al5083", density = 2.65 * g / cm3, ncomponents = 3);
836  Al5083->AddElement(G4Element::GetElement("Mn"), 0.004);
837  Al5083->AddElement(G4Element::GetElement("Mg"), 0.04);
838  Al5083->AddElement(G4Element::GetElement("Al"), 0.956);
839 
840  G4Material *FPC = new G4Material("FPC", 1.542 * g / cm3, 2);
841  FPC->AddMaterial(G4Material::GetMaterial("G4_Cu"), 0.0162);
842  FPC->AddMaterial(G4Material::GetMaterial("G4_KAPTON"), 0.9838);
843 
844  // This is an approximation for the W saturated epoxy of the EMCal.
845  G4Material *W_Epoxy = new G4Material("W_Epoxy", density = 10.2 * g / cm3, ncomponents = 2);
846  W_Epoxy->AddMaterial(G4Material::GetMaterial("G4_W"), fractionmass = 0.5);
847  W_Epoxy->AddMaterial(G4Material::GetMaterial("G4_POLYSTYRENE"), fractionmass = 0.5);
848 
849  //from http://www.physi.uni-heidelberg.de/~adler/TRD/TRDunterlagen/RadiatonLength/tgc2.htm
850  //Epoxy (for FR4 )
851  //density = 1.2*g/cm3;
852  G4Material *Epoxy = new G4Material("Epoxy", 1.2 * g / cm3, ncomponents = 2);
853  Epoxy->AddElement(G4Element::GetElement("H"), natoms = 2);
854  Epoxy->AddElement(G4Element::GetElement("C"), natoms = 2);
855 
856  //FR4 (Glass + Epoxy)
857  density = 1.86 * g / cm3;
858  G4Material *FR4 = new G4Material("FR4", density, ncomponents = 2);
859  FR4->AddMaterial(quartz, fractionmass = 0.528);
860  FR4->AddMaterial(Epoxy, fractionmass = 0.472);
861 // NOMEX (HoneyComb)
862 // density from http://www.fibreglast.com/product/Nomex_Honeycomb_1562/Vacuum_Bagging_Sandwich_Core
863 // 1562: 29 kg/m^3 <-- I guess it is this one
864 // 2562: 48 kg/m^3
865 // chemical composition http://ww2.unime.it/cdlchimind/adm/inviofile/uploads/HP_Pols2.b.pdf
866  density = 29*kg/m3;
867  G4Material *NOMEX = new G4Material("NOMEX", density, ncomponents = 4);
868  NOMEX->AddElement(G4Element::GetElement("C"), natoms = 14);
869  NOMEX->AddElement(G4Element::GetElement("H"), natoms = 10);
870  NOMEX->AddElement(G4Element::GetElement("N"), natoms = 2);
871  NOMEX->AddElement(G4Element::GetElement("O"), natoms = 2);
872  // spacal material. Source : EICROOT/A. Kiselev
873  /*
874  WEpoxyMix 3 12.011 1.008 183.85 6. 1. 74. 12.18 0.029 0.002 0.969
875  1 1 30. .00001
876  0
877  */
878  G4Material *Spacal_W_Epoxy =
879  new G4Material("Spacal_W_Epoxy", density = 12.18 * g / cm3, ncomponents = 3);
880  Spacal_W_Epoxy->AddElement(G4Element::GetElement("C"), 0.029);
881  Spacal_W_Epoxy->AddElement(G4Element::GetElement("H"), 0.002);
882  Spacal_W_Epoxy->AddElement(G4Element::GetElement("W"), 0.969);
883  /*
884 PMMA -3 12.01 1.008 15.99 6. 1. 8. 1.19 3.6 5.7 1.4
885  1 1 20. .00001
886  0
887  */
888  G4Material *PMMA =
889  new G4Material("PMMA", density = 1.19 * g / cm3, ncomponents = 3);
890  PMMA->AddElement(G4Element::GetElement("C"), 3.6 / (3.6 + 5.7 + 1.4));
891  PMMA->AddElement(G4Element::GetElement("H"), 5.7 / (3.6 + 5.7 + 1.4));
892  PMMA->AddElement(G4Element::GetElement("O"), 1.4 / (3.6 + 5.7 + 1.4));
893 
894  G4Material *G10 =
895  new G4Material("G10", density = 1.700 * g / cm3, ncomponents = 4);
896  G10->AddElement(G4Element::GetElement("Si"), natoms = 1);
897  G10->AddElement(G4Element::GetElement("O"), natoms = 2);
898  G10->AddElement(G4Element::GetElement("C"), natoms = 3);
899  G10->AddElement(G4Element::GetElement("H"), natoms = 3);
900 
901  G4Material *CsI =
902  new G4Material("CsI", density = 4.534 * g / cm3, ncomponents = 2);
903  CsI->AddElement(G4Element::GetElement("Cs"), natoms = 1);
904  CsI->AddElement(G4Element::GetElement("I"), natoms = 1);
905  CsI->GetIonisation()->SetMeanExcitationEnergy(553.1 * eV);
906 
907  G4Material *C4F10 =
908  new G4Material("C4F10", density = 0.00973 * g / cm3, ncomponents = 2);
909  C4F10->AddElement(G4Element::GetElement("C"), natoms = 4);
910  C4F10->AddElement(G4Element::GetElement("F"), natoms = 10);
911 
912  G4Material *CF4 = new G4Material("CF4", density = 3.72 * mg / cm3, ncomponents = 2, kStateGas, 288.15 * kelvin, 1 * atmosphere);
913  CF4->AddElement(G4Element::GetElement("C"), natoms = 1);
914  CF4->AddElement(G4Element::GetElement("F"), natoms = 4);
915 
919 
920  const double den_CF4 = CF4->GetDensity() * .1;
921  const double den_G4_Ar = G4Material::GetMaterial("G4_Ar")->GetDensity() * .8;
922  const double den_G4_CARBON_DIOXIDE = G4Material::GetMaterial("G4_CARBON_DIOXIDE")->GetDensity() * .1;
923  const double den = den_CF4 + den_G4_Ar + den_G4_CARBON_DIOXIDE;
924 
925  G4Material *ePHEINX_TPC_Gas = new G4Material("ePHEINX_TPC_Gas", den,
926  ncomponents = 3, kStateGas);
927  ePHEINX_TPC_Gas->AddMaterial(CF4, den_CF4 / den);
928  ePHEINX_TPC_Gas->AddMaterial(G4Material::GetMaterial("G4_Ar"), den_G4_Ar / den);
929  ePHEINX_TPC_Gas->AddMaterial(G4Material::GetMaterial("G4_CARBON_DIOXIDE"),
930  den_G4_CARBON_DIOXIDE / den);
931  // cross checked with original implementation made up of Ne,C,F
932  // this here is very close but makes more sense since it uses Ne and CF4
933  double G4_Ne_frac = 0.9;
934  double CF4_frac = 0.1;
935  const double den_G4_Ne = G4Material::GetMaterial("G4_Ne")->GetDensity();
936  const double den_CF4_2 = CF4->GetDensity();
937  const double den_sphenix_tpc_gas = den_G4_Ne * G4_Ne_frac + den_CF4_2 * CF4_frac;
938  G4Material *sPHENIX_tpc_gas = new G4Material("sPHENIX_TPC_Gas", den_sphenix_tpc_gas, ncomponents = 2, kStateGas);
939  sPHENIX_tpc_gas->AddMaterial(CF4, den_CF4_2 * CF4_frac / den_sphenix_tpc_gas);
940  sPHENIX_tpc_gas->AddMaterial(G4Material::GetMaterial("G4_Ne"), den_G4_Ne * G4_Ne_frac / den_sphenix_tpc_gas);
941  //
942  // CF4
943  //
944  const G4int nEntries_CF4 = 50;
945 
946  G4double PhotonEnergy_CF4[nEntries_CF4] =
947  {5.5 * eV, 5.6 * eV, 5.7 * eV, 5.8 * eV, 5.9 * eV,
948  6.0 * eV, 6.1 * eV, 6.2 * eV, 6.3 * eV, 6.4 * eV,
949  6.5 * eV, 6.6 * eV, 6.7 * eV, 6.8 * eV, 6.9 * eV,
950  7.0 * eV, 7.1 * eV, 7.2 * eV, 7.3 * eV, 7.4 * eV,
951  7.5 * eV, 7.6 * eV, 7.7 * eV, 7.8 * eV, 7.9 * eV,
952  8.0 * eV, 8.1 * eV, 8.2 * eV, 8.4 * eV, 8.6 * eV,
953  8.8 * eV, 9.0 * eV, 9.2 * eV, 9.4 * eV, 9.6 * eV,
954  9.8 * eV, 10.0 * eV, 10.2 * eV, 10.4 * eV, 10.6 * eV,
955  10.8 * eV, 11.0 * eV, 11.2 * eV, 11.3 * eV, 11.4 * eV,
956  11.5 * eV, 11.6 * eV, 11.7 * eV, 11.8 * eV, 11.9 * eV};
957 
958  G4double RefractiveIndex_CF4[nEntries_CF4] =
959  {1.000480, 1.000482, 1.000483, 1.000485, 1.000486,
960  1.000488, 1.000490, 1.000491, 1.000493, 1.000495,
961  1.000497, 1.000498, 1.000500, 1.000502, 1.000504,
962  1.000506, 1.000508, 1.000510, 1.000512, 1.000514,
963  1.000517, 1.000519, 1.000521, 1.000524, 1.000526,
964  1.000529, 1.000531, 1.000534, 1.000539, 1.000545,
965  1.000550, 1.000557, 1.000563, 1.000570, 1.000577,
966  1.000584, 1.000592, 1.000600, 1.000608, 1.000617,
967  1.000626, 1.000636, 1.000646, 1.000652, 1.000657,
968  1.000662, 1.000667, 1.000672, 1.000677, 1.000682};
969 
970  G4double Absorption_CF4[nEntries_CF4] =
971  {1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
972  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
973  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
974  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
975  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
976  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
977  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
978  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
979  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
980  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m};
981 
982  G4MaterialPropertiesTable *MPT_CF4 = new G4MaterialPropertiesTable();
983 
984  MPT_CF4->AddProperty("RINDEX", PhotonEnergy_CF4, RefractiveIndex_CF4, nEntries_CF4)
985  ->SetSpline(true);
986  MPT_CF4->AddProperty("ABSLENGTH", PhotonEnergy_CF4, Absorption_CF4, nEntries_CF4)
987  ->SetSpline(true);
988 
989  CF4->SetMaterialPropertiesTable(MPT_CF4);
990 
991  //
992  // LiF
993  //
994  G4Material *g4_lif = nist->FindOrBuildMaterial("G4_LITHIUM_FLUORIDE");
995  G4Material *LiF = new G4Material("LiF", density = 2.635 * g / cm3, ncomponents = 2);
996  LiF->AddElement(G4Element::GetElement("Li"), natoms = 1);
997  LiF->AddElement(G4Element::GetElement("F"), natoms = 1);
998 
999  if (verbosity > 1)
1000  {
1001  cout << "g4_lif: " << g4_lif << endl;
1002  cout << "LiF: " << LiF << endl;
1003  }
1004 
1005  const G4int nEntries_LiF = 50;
1006 
1007  G4double PhotonEnergy_LiF[nEntries_LiF] =
1008  {5.5 * eV, 5.6 * eV, 5.7 * eV, 5.8 * eV, 5.9 * eV,
1009  6.0 * eV, 6.1 * eV, 6.2 * eV, 6.3 * eV, 6.4 * eV,
1010  6.5 * eV, 6.6 * eV, 6.7 * eV, 6.8 * eV, 6.9 * eV,
1011  7.0 * eV, 7.1 * eV, 7.2 * eV, 7.3 * eV, 7.4 * eV,
1012  7.5 * eV, 7.6 * eV, 7.7 * eV, 7.8 * eV, 7.9 * eV,
1013  8.0 * eV, 8.1 * eV, 8.2 * eV, 8.4 * eV, 8.6 * eV,
1014  8.8 * eV, 9.0 * eV, 9.2 * eV, 9.4 * eV, 9.6 * eV,
1015  9.8 * eV, 10.0 * eV, 10.2 * eV, 10.4 * eV, 10.6 * eV,
1016  10.8 * eV, 11.0 * eV, 11.2 * eV, 11.3 * eV, 11.4 * eV,
1017  11.5 * eV, 11.6 * eV, 11.7 * eV, 11.8 * eV, 11.9 * eV};
1018 
1019  G4double RefractiveIndex_LiF[nEntries_LiF] =
1020  {1.42709, 1.42870, 1.42998, 1.43177, 1.43368,
1021  1.43520, 1.43736, 1.43907, 1.44088, 1.44279,
1022  1.44481, 1.44694, 1.44920, 1.45161, 1.45329,
1023  1.45595, 1.45781, 1.46077, 1.46285, 1.46503,
1024  1.46849, 1.47093, 1.47349, 1.47618, 1.47901,
1025  1.48198, 1.48511, 1.48841, 1.49372, 1.50152,
1026  1.50799, 1.51509, 1.52290, 1.53152, 1.54108,
1027  1.54805, 1.55954, 1.56799, 1.58202, 1.59243,
1028  1.60382, 1.61632, 1.63010, 1.63753, 1.64536,
1029  1.65363, 1.66236, 1.67159, 1.68139, 1.69178};
1030 
1031  G4double Absorption_LiF[nEntries_LiF] =
1032  {1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
1033  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
1034  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
1035  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
1036  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
1037  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
1038  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
1039  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
1040  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m,
1041  1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m, 1.e4 * m};
1042 
1043  G4MaterialPropertiesTable *MPT_LiF = new G4MaterialPropertiesTable();
1044 
1045  MPT_LiF->AddProperty("RINDEX", PhotonEnergy_LiF, RefractiveIndex_LiF, nEntries_LiF)
1046  ->SetSpline(true);
1047  MPT_LiF->AddProperty("ABSLENGTH", PhotonEnergy_LiF, Absorption_LiF, nEntries_LiF)
1048  ->SetSpline(true);
1049 
1050  LiF->SetMaterialPropertiesTable(MPT_LiF);
1051 
1052  //
1053  // CsI
1054  //
1055  const G4int nEntries_CsI = 50;
1056 
1057  G4double PhotonEnergy_CsI[nEntries_CsI] =
1058  {5.5 * eV, 5.6 * eV, 5.7 * eV, 5.8 * eV, 5.9 * eV,
1059  6.0 * eV, 6.1 * eV, 6.2 * eV, 6.3 * eV, 6.4 * eV,
1060  6.5 * eV, 6.6 * eV, 6.7 * eV, 6.8 * eV, 6.9 * eV,
1061  7.0 * eV, 7.1 * eV, 7.2 * eV, 7.3 * eV, 7.4 * eV,
1062  7.5 * eV, 7.6 * eV, 7.7 * eV, 7.8 * eV, 7.9 * eV,
1063  8.0 * eV, 8.1 * eV, 8.2 * eV, 8.4 * eV, 8.6 * eV,
1064  8.8 * eV, 9.0 * eV, 9.2 * eV, 9.4 * eV, 9.6 * eV,
1065  9.8 * eV, 10.0 * eV, 10.2 * eV, 10.4 * eV, 10.6 * eV,
1066  10.8 * eV, 11.0 * eV, 11.2 * eV, 11.3 * eV, 11.4 * eV,
1067  11.5 * eV, 11.6 * eV, 11.7 * eV, 11.8 * eV, 11.9 * eV};
1068 
1069  G4double RefractiveIndex_CsI[nEntries_CsI] =
1070  {1., 1., 1., 1., 1.,
1071  1., 1., 1., 1., 1.,
1072  1., 1., 1., 1., 1.,
1073  1., 1., 1., 1., 1.,
1074  1., 1., 1., 1., 1.,
1075  1., 1., 1., 1., 1.,
1076  1., 1., 1., 1., 1.,
1077  1., 1., 1., 1., 1.,
1078  1., 1., 1., 1., 1.,
1079  1., 1., 1., 1., 1.};
1080 
1081  G4double Absorption_CsI[nEntries_CsI] =
1082  {0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m,
1083  0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m,
1084  0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m,
1085  0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m,
1086  0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m,
1087  0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m,
1088  0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m,
1089  0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m,
1090  0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m,
1091  0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m, 0.0000001 * m};
1092 
1093  G4MaterialPropertiesTable *MPT_CsI = new G4MaterialPropertiesTable();
1094 
1095  MPT_CsI->AddProperty("RINDEX", PhotonEnergy_CsI, RefractiveIndex_CsI, nEntries_CsI)
1096  ->SetSpline(true);
1097  MPT_CsI->AddProperty("ABSLENGTH", PhotonEnergy_CsI, Absorption_CsI, nEntries_CsI)
1098  ->SetSpline(true);
1099 
1100  CsI->SetMaterialPropertiesTable(MPT_CsI);
1101 
1102  // define P10 Gas which will be used for TPC Benchmarking
1103  G4Material *P10 =
1104  new G4Material("P10", density = 1.74 * mg / cm3, ncomponents = 3); // @ 0K, 1atm
1105  P10->AddElement(G4Element::GetElement("Ar"), fractionmass = 0.9222);
1106  P10->AddElement(G4Element::GetElement("C"), fractionmass = 0.0623);
1107  P10->AddElement(G4Element::GetElement("H"), fractionmass = 0.0155);
1108 
1109  //------------------------------
1110  // for Modular RICH (mRICH)
1111  //------------------------------
1112 
1113  // mRICH_Air_Opt ---------------
1114  const int mRICH_nEntries_Air_Opt=2;
1115 
1116  G4double mRICH_PhotonEnergy_Air_Opt[mRICH_nEntries_Air_Opt] = {2.034*eV, 4.136*eV};
1117  G4double mRICH_RefractiveIndex_Air_Opt[mRICH_nEntries_Air_Opt] = {1.00, 1.00};
1118 
1119  G4MaterialPropertiesTable* mRICH_Air_Opt_MPT = new G4MaterialPropertiesTable();
1120  mRICH_Air_Opt_MPT->AddProperty("RINDEX", mRICH_PhotonEnergy_Air_Opt, mRICH_RefractiveIndex_Air_Opt, mRICH_nEntries_Air_Opt);
1121 
1122  G4Material* mRICH_Air_Opt = new G4Material("mRICH_Air_Opt", density=1.29*mg/cm3, ncomponents=2);
1123  mRICH_Air_Opt->AddElement(G4Element::GetElement("N"), fractionmass=70.*perCent);
1124  mRICH_Air_Opt->AddElement(G4Element::GetElement("O"), fractionmass=30.*perCent);
1125  mRICH_Air_Opt->SetMaterialPropertiesTable(mRICH_Air_Opt_MPT);
1126 
1127  // mRICH_Acrylic ---------------
1128  const int mRICH_nEntries1=32;
1129 
1130  //same photon energy array as aerogel 1
1131  G4double mRICH_PhotonEnergy[mRICH_nEntries1] =
1132  { 2.034*eV, 2.068*eV, 2.103*eV, 2.139*eV, // 610, 600, 590, 580, (nm)
1133  2.177*eV, 2.216*eV, 2.256*eV, 2.298*eV, // 570, 560, 550, 540,
1134  2.341*eV, 2.386*eV, 2.433*eV, 2.481*eV, // 530, 520, 510, 500,
1135  2.532*eV, 2.585*eV, 2.640*eV, 2.697*eV, // 490, 480, 470, 460,
1136  2.757*eV, 2.820*eV, 2.885*eV, 2.954*eV, // 450, 440, 430, 420,
1137  3.026*eV, 3.102*eV, 3.181*eV, 3.265*eV, // 410, 400, 390, 380,
1138  3.353*eV, 3.446*eV, 3.545*eV, 3.649*eV, // 370, 360, 350, 340,
1139  3.760*eV, 3.877*eV, 4.002*eV, 4.136*eV }; // 330, 320, 310, 300.
1140 
1141  G4double mRICH_AcRefractiveIndex[mRICH_nEntries1] =
1142  { 1.4902, 1.4907, 1.4913, 1.4918, 1.4924, // 610, 600, 590, 580, 570,
1143  1.4930, 1.4936, 1.4942, 1.4948, 1.4954, // 560, 550, 540, 530, 520, (this line is interpolated)
1144  1.4960, 1.4965, 1.4971, 1.4977, 1.4983, // 510, 500, 490, 480, 470,
1145  1.4991, 1.5002, 1.5017, 1.5017, 1.5017, // 460, 450, 440, 430, 420,
1146  1.5017, 1.5017, 1.5017, 1.5017, 1.5017, // 410,
1147  1.5017, 1.5017, 1.5017, 1.5017, 1.5017, // 360, look up values below 435
1148  1.5017, 1.5017};
1149 
1150  G4double mRICH_AcAbsorption[mRICH_nEntries1] =
1151  {25.25*cm, 25.25*cm, 25.25*cm, 25.25*cm,
1152  25.25*cm, 25.25*cm, 25.25*cm, 25.25*cm,
1153  25.25*cm, 25.25*cm, 25.25*cm, 25.25*cm,
1154  25.25*cm, 25.25*cm, 25.25*cm, 25.25*cm,
1155  25.25*cm, 25.25*cm, 25.25*cm, 25.25*cm,
1156  25.25*cm, 00.667*cm, 00.037*cm, 00.333*cm,
1157  00.001*cm, 00.001*cm, 00.001*cm, 00.001*cm,
1158  00.001*cm, 00.001*cm, 00.001*cm, 00.001*cm};
1159 
1160  G4MaterialPropertiesTable* mRICH_Ac_myMPT = new G4MaterialPropertiesTable();
1161  mRICH_Ac_myMPT->AddProperty("RINDEX" ,mRICH_PhotonEnergy, mRICH_AcRefractiveIndex,mRICH_nEntries1);
1162  mRICH_Ac_myMPT->AddProperty("ABSLENGTH", mRICH_PhotonEnergy, mRICH_AcAbsorption,mRICH_nEntries1);
1163 
1164  G4Material* mRICH_Acrylic=new G4Material("mRICH_Acrylic", density=1.19*g/cm3, ncomponents=3);
1165  mRICH_Acrylic->AddElement(G4Element::GetElement("C"), natoms=5);
1166  mRICH_Acrylic->AddElement(G4Element::GetElement("H"), natoms=8); // molecular ratios
1167  mRICH_Acrylic->AddElement(G4Element::GetElement("O"), natoms=2);
1168  mRICH_Acrylic->SetMaterialPropertiesTable(mRICH_Ac_myMPT);
1169 
1170  // mRICH_Agel1 -----------------
1171  // using same photon energy array as mRICH_Acrylic
1172 
1173  G4double mRICH_Agel1RefractiveIndex[mRICH_nEntries1] =
1174  { 1.02435, 1.0244, 1.02445, 1.0245, 1.02455,
1175  1.0246, 1.02465, 1.0247, 1.02475, 1.0248,
1176  1.02485, 1.02492, 1.025, 1.02505, 1.0251,
1177  1.02518, 1.02522, 1.02530, 1.02535, 1.0254,
1178  1.02545, 1.0255, 1.02555, 1.0256, 1.02568,
1179  1.02572, 1.0258, 1.02585, 1.0259, 1.02595,
1180  1.026, 1.02608};
1181 
1182  G4double mRICH_Agel1Absorption[mRICH_nEntries1] = //from Hubert
1183  { 3.448*m, 4.082*m, 6.329*m, 9.174*m, 12.346*m, 13.889*m,
1184  15.152*m, 17.241*m, 18.868*m, 20.000*m, 26.316*m, 35.714*m,
1185  45.455*m, 47.619*m, 52.632*m, 52.632*m, 55.556*m, 52.632*m,
1186  52.632*m, 47.619*m, 45.455*m, 41.667*m, 37.037*m, 33.333*m,
1187  30.000*m, 28.500*m, 27.000*m, 24.500*m, 22.000*m, 19.500*m,
1188  17.500*m, 14.500*m };
1189 
1190  G4double mRICH_Agel1Rayleigh[mRICH_nEntries1];
1191  //const G4double AerogelTypeAClarity = 0.00719*micrometer*micrometer*micrometer*micrometer/cm;
1192  const G4double AerogelTypeAClarity = 0.0020*micrometer*micrometer*micrometer*micrometer/cm;
1193  G4double Cparam = AerogelTypeAClarity*cm/(micrometer*micrometer*micrometer*micrometer);
1194  G4double PhotMomWaveConv = 1239*eV*nm;
1195 
1196  if(Cparam != 0.0 ) {
1197  for(int i=0; i<mRICH_nEntries1; i++ ){
1198  G4double ephoton = mRICH_PhotonEnergy[i];
1199  //In the following the 1000 is to convert form nm to micrometer
1200  G4double wphoton=(PhotMomWaveConv/ephoton)/(1000.0*nm);
1201  mRICH_Agel1Rayleigh[i]=(std::pow(wphoton,4))/Cparam;
1202  }
1203  }
1204 
1205  G4MaterialPropertiesTable* mRICH_Agel1_myMPT = new G4MaterialPropertiesTable();
1206  mRICH_Agel1_myMPT->AddProperty("RINDEX", mRICH_PhotonEnergy, mRICH_Agel1RefractiveIndex, mRICH_nEntries1);
1207  mRICH_Agel1_myMPT->AddProperty("ABSLENGTH", mRICH_PhotonEnergy, mRICH_Agel1Absorption,mRICH_nEntries1);
1208  mRICH_Agel1_myMPT->AddProperty("RAYLEIGH", mRICH_PhotonEnergy, mRICH_Agel1Rayleigh, mRICH_nEntries1); //Need table of rayleigh Scattering!!!
1209  mRICH_Agel1_myMPT->AddConstProperty("SCINTILLATIONYIELD",0./MeV);
1210  mRICH_Agel1_myMPT->AddConstProperty("RESOLUTIONSCALE",1.0);
1211 
1212  G4Material* mRICH_Aerogel1 = new G4Material("mRICH_Aerogel1", density=0.02*g/cm3, ncomponents=2);
1213  mRICH_Aerogel1->AddElement(G4Element::GetElement("Si"), natoms=1);
1214  mRICH_Aerogel1->AddElement(G4Element::GetElement("O"), natoms=2);
1215  mRICH_Aerogel1->SetMaterialPropertiesTable(mRICH_Agel1_myMPT);
1216 
1217  // mRICH_Agel2 -----------------
1218  const int mRICH_nEntries2=50;
1219 
1220  G4double mRICH_Agel2PhotonEnergy[mRICH_nEntries2]=
1221  {1.87855*eV,1.96673*eV,2.05490*eV,2.14308*eV,2.23126*eV,
1222  2.31943*eV,2.40761*eV,2.49579*eV,2.58396*eV,2.67214*eV,
1223  2.76032*eV,2.84849*eV,2.93667*eV,3.02485*eV,3.11302*eV,
1224  3.20120*eV,3.28938*eV,3.37755*eV,3.46573*eV,3.55391*eV,
1225  3.64208*eV,3.73026*eV,3.81844*eV,3.90661*eV,3.99479*eV,
1226  4.08297*eV,4.17114*eV,4.25932*eV,4.34750*eV,4.43567*eV,
1227  4.52385*eV,4.61203*eV,4.70020*eV,4.78838*eV,4.87656*eV,
1228  4.96473*eV,5.05291*eV,5.14109*eV,5.22927*eV,5.31744*eV,
1229  5.40562*eV,5.49380*eV,5.58197*eV,5.67015*eV,5.75833*eV,
1230  5.84650*eV,5.93468*eV,6.02286*eV,6.11103*eV,6.19921*eV };
1231 
1232  G4double mRICH_Agel2RefractiveIndex[mRICH_nEntries2] =
1233  {1.02825,1.02829,1.02834,1.02839,1.02844,
1234  1.02849,1.02854,1.02860,1.02866,1.02872,
1235  1.02878,1.02885,1.02892,1.02899,1.02906,
1236  1.02914,1.02921,1.02929,1.02938,1.02946,
1237  1.02955,1.02964,1.02974,1.02983,1.02993,
1238  1.03003,1.03014,1.03025,1.03036,1.03047,
1239  1.03059,1.03071,1.03084,1.03096,1.03109,
1240  1.03123,1.03137,1.03151,1.03166,1.03181,
1241  1.03196,1.03212,1.03228,1.03244,1.03261,
1242  1.03279,1.03297,1.03315,1.03334,1.03354};
1243 
1244  G4double mRICH_Agel2Absorption[mRICH_nEntries2] = //from Marco
1245  {17.5000*cm,17.7466*cm,17.9720*cm,18.1789*cm,18.3694*cm,
1246  18.5455*cm,18.7086*cm,18.8602*cm,19.0015*cm,19.1334*cm,
1247  19.2569*cm,19.3728*cm,19.4817*cm,19.5843*cm,19.6810*cm,
1248  19.7725*cm,19.8590*cm,19.9410*cm,20.0188*cm,20.0928*cm,
1249  18.4895*cm,16.0174*cm,13.9223*cm,12.1401*cm,10.6185*cm,
1250  9.3147*cm,8.1940*cm,7.2274*cm,6.3913*cm,5.6659*cm,
1251  5.0347*cm,4.4841*cm,4.0024*cm,3.5801*cm,3.2088*cm,
1252  2.8817*cm,2.5928*cm,2.3372*cm,2.1105*cm,1.9090*cm,
1253  1.7296*cm,1.5696*cm,1.4266*cm,1.2986*cm,1.1837*cm,
1254  1.0806*cm,0.9877*cm,0.9041*cm,0.8286*cm,0.7603*cm };
1255 
1256  G4double mRICH_Agel2Rayleigh[mRICH_nEntries2] = //from Marco
1257  {35.1384*cm, 29.24805*cm, 24.5418*cm, 20.7453*cm, 17.6553*cm,
1258  15.1197*cm, 13.02345*cm, 11.2782*cm, 9.81585*cm, 8.58285*cm,
1259  7.53765*cm, 6.6468*cm, 5.88375*cm, 5.22705*cm, 4.6596*cm,
1260  4.167*cm, 3.73785*cm, 3.36255*cm, 3.03315*cm, 2.7432*cm,
1261  2.487*cm, 2.26005*cm, 2.05845*cm, 1.87875*cm, 1.71825*cm,
1262  1.57455*cm, 1.44555*cm, 1.3296*cm, 1.2249*cm, 1.1304*cm,
1263  1.04475*cm, 0.9672*cm, 0.89655*cm, 0.83235*cm, 0.77385*cm,
1264  0.7203*cm, 0.67125*cm, 0.6264*cm, 0.58515*cm, 0.54735*cm,
1265  0.51255*cm, 0.48045*cm, 0.45075*cm, 0.4233*cm, 0.39795*cm,
1266  0.37455*cm, 0.3528*cm, 0.33255*cm, 0.3138*cm, 0.29625*cm};
1267 
1268  G4MaterialPropertiesTable* mRICH_Agel2MPT = new G4MaterialPropertiesTable();
1269  mRICH_Agel2MPT->AddProperty("RINDEX", mRICH_Agel2PhotonEnergy, mRICH_Agel2RefractiveIndex, mRICH_nEntries2);
1270  mRICH_Agel2MPT->AddProperty("ABSLENGTH", mRICH_Agel2PhotonEnergy, mRICH_Agel2Absorption,mRICH_nEntries2);
1271  mRICH_Agel2MPT->AddProperty("RAYLEIGH", mRICH_Agel2PhotonEnergy, mRICH_Agel2Rayleigh, mRICH_nEntries2);
1272  mRICH_Agel2MPT->AddConstProperty("SCINTILLATIONYIELD",0./MeV);
1273  mRICH_Agel2MPT->AddConstProperty("RESOLUTIONSCALE",1.0);
1274 
1275  G4Material* mRICH_Aerogel2 = new G4Material("mRICH_Aerogel2", density=0.02*g/cm3, ncomponents=2);
1276  mRICH_Aerogel2->AddElement(G4Element::GetElement("Si"), natoms=1);
1277  mRICH_Aerogel2->AddElement(G4Element::GetElement("O"), natoms=2);
1278  mRICH_Aerogel2->SetMaterialPropertiesTable(mRICH_Agel2MPT);
1279 
1280  // mRICH_Borosilicate ----------
1281  //using the same photon energy array as mRICH_Acrylic
1282 
1283  G4double mRICH_glassRefractiveIndex[mRICH_nEntries1] =
1284  { 1.47, 1.47, 1.47, 1.47, 1.47,
1285  1.47, 1.47, 1.47, 1.47, 1.47,
1286  1.47, 1.47, 1.47, 1.47, 1.47,
1287  1.47, 1.47, 1.47, 1.47, 1.47,
1288  1.47, 1.47, 1.47, 1.47, 1.47,
1289  1.47, 1.47, 1.47, 1.47, 1.47,
1290  1.47, 1.47};
1291 
1292  G4double mRICH_glassAbsorption[mRICH_nEntries1] =
1293  {4.25*cm, 4.25*cm, 4.25*cm, 4.25*cm,
1294  4.25*cm, 4.25*cm, 4.25*cm, 4.25*cm,
1295  4.25*cm, 4.25*cm, 4.25*cm, 4.25*cm,
1296  4.25*cm, 4.25*cm, 4.25*cm, 4.25*cm,
1297  4.25*cm, 4.25*cm, 4.25*cm, 4.25*cm,
1298  4.25*cm, 00.667*cm, 00.037*cm, 00.333*cm,
1299  00.001*cm, 00.001*cm, 00.001*cm, 00.001*cm,
1300  00.001*cm, 00.001*cm, 00.001*cm, 00.001*cm};
1301 
1302  G4MaterialPropertiesTable* mRICH_glass_myMPT = new G4MaterialPropertiesTable();
1303  //same photon energy array as aerogel 1
1304  mRICH_glass_myMPT->AddProperty("RINDEX", mRICH_PhotonEnergy, mRICH_glassRefractiveIndex, mRICH_nEntries1);
1305  mRICH_glass_myMPT->AddProperty("ABSLENGTH", mRICH_PhotonEnergy, mRICH_glassAbsorption, mRICH_nEntries1);
1306 
1307  const G4Material *G4_Pyrex_Glass = nist->FindOrBuildMaterial("G4_Pyrex_Glass");
1308  G4Material *mRICH_Borosilicate= new G4Material("mRICH_Borosilicate",G4_Pyrex_Glass->GetDensity(),G4_Pyrex_Glass,G4_Pyrex_Glass->GetState(),G4_Pyrex_Glass->GetTemperature(),G4_Pyrex_Glass->GetPressure());
1309  mRICH_Borosilicate->SetMaterialPropertiesTable(mRICH_glass_myMPT);
1310 
1311  // mRICH_Air ------------------
1312  //using same photon energy array as mRICH_Acrylic
1313 
1314  G4double mRICH_AirRefractiveIndex[mRICH_nEntries1] =
1315  { 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1316  1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1317  1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1318  1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1319  1.00, 1.00, 1.00, 1.00 };
1320 
1321  G4MaterialPropertiesTable* mRICH_Air_myMPT = new G4MaterialPropertiesTable();
1322  mRICH_Air_myMPT->AddProperty("RINDEX", mRICH_PhotonEnergy, mRICH_AirRefractiveIndex , mRICH_nEntries1);
1323  const G4Material *G4_AIR = G4Material::GetMaterial("G4_AIR");
1324  G4Material *mRICH_Air= new G4Material("mRICH_Air",G4_AIR->GetDensity(),G4_AIR,G4_AIR->GetState(),G4_AIR->GetTemperature(),G4_AIR->GetPressure());
1325  mRICH_Air->SetMaterialPropertiesTable(mRICH_Air_myMPT);
1326 
1327  //E1039 materials
1328  G4Element* eleD = new G4Element("eleD", "eleD", 1.0, 2.014);
1329 
1330  G4Material* SQ_LH2 = new G4Material("SQ_LH2", density = 0.07066*g/cm3, ncomponents = 1);
1331  SQ_LH2->AddElement(G4Element::GetElement("H"), natoms = 2);
1332 
1333  G4Material* SQ_LD2 = new G4Material("SQ_LD2", density = 0.15707*g/cm3, ncomponents = 1);
1334  SQ_LD2->AddElement(eleD, natoms = 2);
1335 
1336  G4Material* SQ_NH3 = new G4Material("SQ_NH3", density = 0.917*g/cm3, ncomponents = 2);
1337  SQ_NH3->AddElement(G4Element::GetElement("N"), natoms = 1);
1338  SQ_NH3->AddElement(G4Element::GetElement("H"), natoms = 3);
1339 
1340  G4Material* SQ_ND3 = new G4Material("SQ_ND3", density = 0.987*g/cm3, ncomponents = 2);
1341  SQ_ND3->AddElement(G4Element::GetElement("N"), natoms = 1);
1342  SQ_ND3->AddElement(eleD, natoms = 3);
1343 
1344  G4Material* SQ_boratedPoly = new G4Material("SQ_boratedPoly", density = 0.95000146*g/cm3, ncomponents = 3);
1345  SQ_boratedPoly->AddElement(G4Element::GetElement("B"), fractionmass = 0.7032045573308*perCent);
1346  SQ_boratedPoly->AddElement(G4Element::GetElement("C"), fractionmass = 4.0128564211902*perCent);
1347  SQ_boratedPoly->AddElement(G4Element::GetElement("H"), fractionmass = 95.283939021478*perCent);
1348 
1349  G4Material* SQ_Scintillator = new G4Material("SQ_Scintillator", density = 1.02300158*g/cm3, ncomponents = 2);
1350  SQ_Scintillator->AddElement(G4Element::GetElement("C"), fractionmass = 47.368421052631*perCent);
1351  SQ_Scintillator->AddElement(G4Element::GetElement("H"), fractionmass = 52.631578947368*perCent);
1352 
1353  G4Material* SQ_ArCO2 = new G4Material("SQ_ArCO2", density = 0.001822, ncomponents = 3);
1354  SQ_ArCO2->AddElement(G4Element::GetElement("Ar"), fractionmass = 77.651981*perCent);
1355  SQ_ArCO2->AddElement(G4Element::GetElement("C"), fractionmass = 5.83366*perCent);
1356  SQ_ArCO2->AddElement(G4Element::GetElement("O"), fractionmass = 16.514359*perCent);
1357 
1358  G4Material* SQ_P08CF4 = new G4Material("SQ_P08CF4", density = 0.00177504, ncomponents = 4);
1359  SQ_P08CF4->AddElement(G4Element::GetElement("Ar"), fractionmass = 89.121162862311*perCent);
1360  SQ_P08CF4->AddElement(G4Element::GetElement("C"), fractionmass = 3.2270886143930*perCent);
1361  SQ_P08CF4->AddElement(G4Element::GetElement("H"), fractionmass = 0.7168203310375*perCent);
1362  SQ_P08CF4->AddElement(G4Element::GetElement("F"), fractionmass = 6.9349281922577*perCent);
1363 }
1364 
1365 void
1367 {
1368  const G4RegionStore* theRegionStore = G4RegionStore::GetInstance();
1369  G4ProductionCuts *gcuts = new G4ProductionCuts(*(theRegionStore->GetRegion("DefaultRegionForTheWorld")->GetProductionCuts()));
1370  G4Region *tpcregion = new G4Region("REGION_TPCGAS");
1371  tpcregion->SetProductionCuts(gcuts);
1372 #if G4VERSION_NUMBER >= 1033
1373 // Use this from the new G4 version 10.03 on
1374 // add the PAI model to the TPCGAS region
1375 // undocumented, painfully digged out with debugger by tracing what
1376 // is done for command "/process/em/AddPAIRegion all TPCGAS PAI"
1377  G4EmParameters *g4emparams = G4EmParameters::Instance();
1378  g4emparams->AddPAIModel("all", "REGION_TPCGAS", "PAI");
1379 #endif
1380  return;
1381 }
1382 
1383 PHG4Subsystem *
1384 PHG4Reco::getSubsystem(const string &name)
1385 {
1386  //BOOST_FOREACH (PHG4Subsystem *subsys, subsystems_)
1387  for (PHG4Subsystem *subsys : subsystems_)
1388  {
1389  if (subsys->Name() == name)
1390  {
1391  if (verbosity > 0)
1392  {
1393  cout << "Found Subsystem " << name << endl;
1394  }
1395  return subsys;
1396  }
1397  }
1398  cout << "Could not find Subsystem " << name << endl;
1399  return nullptr;
1400 }
1401 
1402 void
1404 {
1405  if (runManager_)
1406  {
1407  runManager_->SetVerboseLevel(i);
1408  }
1409 }
PHG4PrimaryGeneratorAction * generatorAction_
event generator (read from PHG4INEVENT node)
Definition: PHG4Reco.h:168
int End(PHCompositeNode *)
end of run method
Definition: PHG4Reco.cc:672
std::string fieldmapfile
Definition: PHG4Reco.h:179
G4VisManager * visManager
Definition: PHG4Reco.h:175
int verbosity
The verbosity level. 0 means not verbose at all.
Definition: Fun4AllBase.h:75
PHTimer server for accessing external information.
Definition: PHTimeServer.h:28
SubsystemList subsystems_
Definition: PHG4Reco.h:172
PHNode * findFirst(const std::string &, const std::string &)
#define PHWHERE
Definition: phool.h:23
static bool RemoveGeometryFile(const std::string &file_name)
delete the geometry file after use
int ResetEvent(PHCompositeNode *)
Clean up after each event.
Definition: PHG4Reco.cc:661
PHBoolean addNode(PHNode *)
void g4guithread(void *ptr)
Definition: PHG4Reco.cc:731
void SetWorldSizeX(const G4double sx)
int InitField(PHCompositeNode *topNode)
Definition: PHG4Reco.cc:279
PHFieldConfig_v3 implements field configuration information for input a field map file...
static void Dump_GDML(const std::string &filename, G4VPhysicalVolume *vol, PHCompositeNode *topNode=nullptr)
save the current Geant4 geometry to GDML file. Reading PHG4GDMLConfig from topNode ...
PHFieldConfig store field configuration information.
Definition: PHFieldConfig.h:19
void AddAction(PHG4TrackingAction *action)
register an action. This is called in PHG4Reco::Init based on which actions are found on the tree ...
void SetWorldShape(const std::string &s)
void DefineMaterials()
Definition: PHG4Reco.cc:751
PHG4PhenixSteppingAction * steppingAction_
pointer to main stepping action
Definition: PHG4Reco.h:162
void G4Verbosity(const int i)
Definition: PHG4Reco.cc:1403
std::string physicslist
Definition: PHG4Reco.h:182
static int ImportGeomFile(PHCompositeNode *topNode, const std::string &geometry_file)
TGeo ROOT/GDML/Macro file -&gt; DST node with automatic file type discrimination based on file names...
int InitUImanager()
Definition: PHG4Reco.cc:586
transient DST object for field storage and access
Definition: PHField.h:13
PHG4Reco(const std::string &name="PHG4RECO")
constructor
Definition: PHG4Reco.cc:118
void Dump_GDML(const std::string &filename)
Definition: PHG4Reco.cc:560
static recoConsts * instance()
Definition: recoConsts.cc:7
void Verbosity(int verb)
std::string worldmaterial
Definition: PHG4Reco.h:181
void Verbosity(int verb)
Definition: PHG4UIsession.h:12
void DefineRegions()
Definition: PHG4Reco.cc:1366
void AddAction(PHG4SteppingAction *action)
register an action. This is called in PHG4Reco::Init based on which actions are found on the tree ...
static void G4Seed(const unsigned int i)
Definition: PHG4Reco.cc:725
void SetForceDecay(EDecayType force_decay_type)
PHG4UIsession * uisession_
pointer to geant ui session
Definition: PHG4Reco.h:153
bool active_decayer_
Definition: PHG4Reco.h:185
float magfield_rescale
Definition: PHG4Reco.h:143
double _eta_coverage
Definition: PHG4Reco.h:177
void SetWorldSizeZ(const G4double sz)
void stop()
stops the counter
Definition: PHTimer.h:61
virtual ~PHG4Reco()
destructor
Definition: PHG4Reco.cc:158
G4RunManager * runManager_
pointer to geant run manager
Definition: PHG4Reco.h:150
EDecayType force_decay_type_
Definition: PHG4Reco.h:187
static PHField * GetFieldMapNode(const PHFieldConfig *default_config=nullptr, PHCompositeNode *topNode=nullptr, const int verbosity=0)
Get transient PHField from DST nodes. If not found, make a new one based on default_config.
int Init(PHCompositeNode *)
full initialization
Definition: PHG4Reco.cc:175
PHG4PhenixEventAction * eventAction_
pointer to main event action
Definition: PHG4Reco.h:159
double WorldSize[3]
Definition: PHG4Reco.h:144
std::string worldshape
Definition: PHG4Reco.h:180
PHG4PhenixDetector * detector_
pointer to detector
Definition: PHG4Reco.h:156
void SetZeroFieldManager(G4FieldManager *man)
void restart()
Restart timer.
Definition: PHTimer.h:70
void SetWorldSizeY(const G4double sy)
PHTimer * get(void)
Definition: PHTimeServer.h:43
PHTimeServer::timer _timer
module timer.
Definition: PHG4Reco.h:192
virtual int Verbosity() const
Gets the verbosity of this module.
Definition: Fun4AllBase.h:64
PHFieldConfig_v2 implements field configuration information for uniform field model.
static void SetPseudoRapidityCoverage(const double eta)
Definition: PHG4Utils.cc:27
bool save_DST_geometry_
Definition: PHG4Reco.h:189
PHG4Subsystem * getSubsystem(const std::string &name)
Definition: PHG4Reco.cc:1384
PHG4PhenixTrackingAction * trackingAction_
pointer to main tracking action
Definition: PHG4Reco.h:165
static std::string GenerateGeometryFileName(const std::string &filename_extension="gdml")
static TThread * gui_thread
Definition: PHG4Reco.cc:109
G4VPhysicalVolume * GetPhysicalVolume(void)
bool optical_photon_
speed up options
Definition: PHG4Reco.h:195
void SetInEvent(PHG4InEvent *const inevt)
set top node (from where particle list is retrieved for passing to geant
int InitRun(PHCompositeNode *topNode)
Definition: PHG4Reco.cc:320
int process_event(PHCompositeNode *)
event processing method
Definition: PHG4Reco.cc:600
void SetZeroFieldStartZ(const G4double z)
PHFieldConfig::FieldConfigTypes mapdim
Definition: PHG4Reco.h:178
void set_rapidity_coverage(const double eta)
Definition: PHG4Reco.cc:719
void Print(const std::string &what=std::string()) const
print info
Definition: PHG4Reco.cc:677
void AddAction(PHG4EventAction *action)
register an action. This is called in PHG4Reco::Init based on which actions are found on the tree ...
void AddDetector(PHG4Detector *detector, int zero_field=0)
register a detector. This is called in PHG4Reco::Init based on which detectors are found on the tree ...
PHFieldConfig_v1 implements field configuration information for input a field map file...
int StartGui()
start the gui
Definition: PHG4Reco.cc:574
this is the main detector construction class, passed to geant to construct the entire phenix detector...
bool active_force_decay_
Definition: PHG4Reco.h:186
int setupInputEventNodeReader(PHCompositeNode *)
Definition: PHG4Reco.cc:692
float magfield
Definition: PHG4Reco.h:142
G4TBMagneticFieldSetup * field_
magnetic field
Definition: PHG4Reco.h:147
int ApplyCommand(const std::string &cmd)
interface to G4 cmd interpreter
Definition: PHG4Reco.cc:566
void setGeneratorAction(G4VUserPrimaryGeneratorAction *action)
Definition: PHG4Reco.cc:710
double zero_field_line_
Definition: PHG4Reco.h:197
double energy_threshold_
Definition: PHG4Reco.h:196
virtual void identify(std::ostream &os=std::cout) const
Definition: PHG4InEvent.cc:134
virtual void set_FloatFlag(const std::string &name, const float flag)
Definition: PHFlag.cc:111
G4UImanager * UImanager
Definition: PHG4Reco.cc:112
G4FieldManager * GetDummyFieldManager()
void SetWorldMaterial(const std::string &s)
string cmd
Definition: submit_bnl.py:63