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 = 10)
3 {
4  // Load basic libraries;
5  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
6 
7  // Create the simulation run manager;
8  EicRunSim *fRun = new EicRunSim("TGeant3");
9  fRun->SetCaveFileName("cave-40m.geo");
10  fRun->SetOutputFile("simulation.root");
11 
12  // Well, do not need secondaries in this simulation;
13  fRun->SuppressSecondaries();
14 
15  // A fraction of main detector volumes (for visualization purposes mainly);
16  fRun->AddModule(new EicTpc ( "TPC/tpc-v01.0-ns.root"));
17  fRun->AddModule(new EicMaps( "VST", "../geometry/vst-v02.0-ns.root", qVST));
18 
19  // Low Q^2 tagger tracker mockup;
20  fRun->AddModule(new EicDetector( "LQST", "../geometry/lqst.root",qDUMMY, qMergeStepsInOneHit));
21 
22  // Relevant part of the vacuum system;
23  {
24  fRun->AddModule(new EicDummyDetector("VP.CENTER", "pCDR-2018/geometry/vacuum.system/vp.center.root"));
25  fRun->AddModule(new EicDummyDetector("VP.E-GOING", "pCDR-2018/geometry/vacuum.system/vp.e-going.root"));
26 
27  fRun->AddModule(new EicDummyDetector("VP.E-GOING.GHOST", "pCDR-2018/geometry/vacuum.system/vp.e-going.ghost.root"));
28  }
29 
30  // Event Generator;
31  {
32  TString evFile = "../../data/pythia.ep.18x275.5Mevents.1.RadCor=0.Q2.all.1M-lines.txt";
33 
34  EicEventGenerator* evtGen = new EicEventGenerator(evFile.Data());
35 
36  // Select primary protons only; ignore all the rest;
37  evtGen->SelectPdgCode(11);
38  evtGen->SelectLeadingParticle();
39 
40  fRun->AddGenerator(evtGen);
41  }
42 
43  // Magnetic field; NB: re-scale properly!;
44  {
45  EicMagneticField *fField = new EicMagneticField();
46 
47  fField->AddBeamLineElementGrads("IR/pCDR-2018/madx/E.E-GOING", 1.8, kBlue);
48  //fField->SuppressYokeCreation("DB2");
49  fField->CreateYokeVolumes(kTRUE);
50 
51  fRun->SetField(fField);
52  }
53 
54  // Initialize and run the simulation; exit at the end;
55  fRun->Run(nEvents);
56 } // simulation()