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; all parameters hardcoded for simplicity;
4 //
5 
6 void simulation(Int_t nEvents = 1000)
7 {
8  // Create the simulation run manager; either "TGeant3" or "TGeant4";
9  auto fRun = new EicRunSim("TGeant3");
10  fRun->SetOutputFile("simulation.root");
11 
12  // Well, do not need secondaries in this simulation;
13  fRun->SuppressSecondaries();
14 
15  // "FWDST" name here (case-insensitive) should match the respective name
16  // in tracker.C script used to create the detector; one can actually
17  // create more than one tracking detector this way, and as long as their names differ
18  // (and physical locations do not overlap), all the simulation/digitization/reconstruction
19  // scheme will work (including Kalman filter track fitting); qMergeStepsInOneHit as a
20  // last parameter means that if particle makes more than one step in silicon, they will
21  // be merged together and yield only one hit;
22  fRun->AddModule(new EicDetector("FWDST", "./fwdst.root", qDUMMY, qMergeStepsInOneHit));
23 
24  // Create and set up (Box) Event Generator;
25  {
26  int PDG = 211; // pion
27  double pmin = 9.0, pmax = 11.0, theta = 5.0; // [9..11] GeV/c @ 5 degrees
28 
29  auto boxGen = new EicBoxGenerator(PDG);
30  boxGen->SetMomentumRange(pmin, pmax);
31  boxGen->SetTheta(theta);
32 
33  fRun->AddGenerator(boxGen);
34  }
35 
36  // Create and set up Elmer-based Apr'2016 solenoid field (binary file "input/SolenoidMap8.root");
37  fRun->AddField(new PndSolenoidMap("SolenoidMap8", "R"));
38 
39  // Initialize and run the simulation; exit at the end;
40  fRun->Run(nEvents);
41 } // simulation()