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 void simulation(Int_t nEvents = 1)
3 {
4  // Load basic libraries;
5  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
6 
7  // Create simulation run manager; use GEANT3 for tracking excercises here;
8  EicRunSim *fRun = new EicRunSim("TGeant3");
9  fRun->SetOutputFile("simulation.root");
10 
11  // Yes, secondaries of no need here;
12  fRun->SuppressSecondaries();
13 
14  fRun->AddModule(new EicDummyDetector("HCAL", "./hcal-v00.0.root"));
15 
16  // Create and set up (Box) Event Generator;
17  {
18  // Be lazy, hardcode polar angles matching eta [0..4]:
19  // ~0.00, 0.50, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00;
20  // 89.00, 62.48, 40.40, 25.16, 15.41, 9.39, 5.70, 3.46, 2.10;
21 
22  int PDG = 211; // pion
23  //double momentum = 10.0, theta = 25.16; //
24  double momentum = 50.0, theta = 3.46; //
25 
26  EicBoxGenerator *boxGen = new EicBoxGenerator(PDG);
27  boxGen->SetMomentum(momentum);
28  boxGen->SetTheta(theta);
29 
30  fRun->AddGenerator(boxGen);
31  }
32 
33  // Create and set up Apr'2016 solenoid field (binary file "input/SolenoidMap8.root");
34  fRun->AddField(new PndSolenoidMap("SolenoidMap8", "R"));
35 
36  // Initialize and run the simulation; exit at the end;
37  fRun->Run(nEvents);
38 } // simulation()
39