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