EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
simulation.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file simulation.C
1 
2 //
3 // Hadronic calorimeter simulation script;
4 //
5 
6 void simulation(unsigned nEvents = 1000)
7 {
8  // Create simulation run manager; use GEANT4 here;
9  auto fRun = new EicRunSim("TGeant4");
10  fRun->SetOutputFile("simulation.root");
11 
12  // *Standard* BeAST forward HCal geometry (full structure);
13  auto fhac = new EicCalorimeter("FHAC", "HCAL/fhac-v00.0-fs.root", qDUMMY);
14  fRun->AddModule(fhac);
15 
16  // Create and set up (Box) Event Generator;
17  {
18  int PDG = 211; // pion
19  double momentum = 10.0, theta = 5.0; // 10 GeV/c @ 5 degrees
20 
21  auto boxGen = new EicBoxGenerator(PDG);
22  boxGen->SetMomentum(momentum);
23  boxGen->SetTheta(theta);
24 
25  fRun->AddGenerator(boxGen);
26  }
27 
28  // Initialize and run the simulation; exit at the end;
29  fRun->Init();
30  // NB: for realistic simulation need to set this value to 0.001 (1um shower
31  // particle range); it takes a long then;
32  ((TGeant4*)gMC)->ProcessGeantCommand("/mcPhysics/rangeCuts 0.1 mm");
33  fRun->Run(nEvents);
34 } // simulation()