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