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 // Tracker simulation script;
4 //
5 
6 void simulation(Int_t nEvents = 1000)
7 {
8  // Load basic libraries;
9  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
10 
11  // Create the simulation run manager; use GEANT3 transport;
12  EicRunSim *fRun = new EicRunSim("TGeant3");
13  fRun->SetOutputFile("simulation.root");
14 
15  // Well, do not need secondaries in this simulation;
16  fRun->SuppressSecondaries();
17 
18  // Declare detector;
19  fRun->AddModule(new EicDetector("FWDGT", "./fwdgt.root", qDUMMY, qMergeStepsInOneHit));
20 
21  // Create and set up (Box) Event Generator;
22  {
23  int PDG = 211; // pion
24  double momentum = 20.0, theta = 2.10; // 20 GeV/c @ eta=4
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 either homogeneous 1.5T field (SolenoidMap2) or more or
34  // less realistic BaBaR magnet field (SolenoidMap3 or SolenoidMap5); see
35  // input/README for more details;
36  fRun->AddField(new PndSolenoidMap("SolenoidMap2", "R"));
37 
38  // Initialize and run the simulation; exit at the end;
39  fRun->Run(nEvents);
40 } // simulation()