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 // Simulation for BeAST detector tracker reslution estimates;
4 //
5 
6 // Uncomment this if want to add 2x2 2D MuMegas barrels to the setup;
7 // there are also nasty #include's in all other C scripts which allow
8 // to propagate this information further down the chain;
9 #define _WITH_MUMEGAS_
10 
11 void simulation(Int_t nEvents = 1000)
12 {
13  // Load basic libraries;
14  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
15 
16  // Create simulation run manager; use GEANT3 for tracking excercises here;
17  EicRunSim *fRun = new EicRunSim("TGeant3");
18  fRun->SetOutputFile("simulation.root");
19 
20  // Yes, secondaries of no need here;
21  fRun->SuppressSecondaries();
22 
23  fRun->AddModule(new EicDummyDetector("SOLENOID", "/DATA00/ayk/ZIGZAG/solenoid-v01.0.root"));
24 
25  // Vertex tracker;
26  fRun->AddModule(new EicMaps ("VST", "MAPS/vst-v01.0-ss.root", qVST));
27  fRun->AddModule(new EicMaps ("FST", "MAPS/fst-v01.0-ss.root", qFST));
28  fRun->AddModule(new EicMaps ("BST", "MAPS/bst-v01.0-ss.root", qBST));
29 
30  // GEM disks;
31  fRun->AddModule(new EicGem ("FGT", "GEM/fgt-v01.0.root", qFGT));
32  fRun->AddModule(new EicGem ("BGT", "GEM/bgt-v01.0.root", qBGT));
33 
34  // Beam pipe; details of IR not known yet -> just a cylinder with thin walls;
35  fRun->AddModule(new EicDummyDetector("BEAMPIPE", "BEAMPIPE/beampipe.root"));
36 
37  // TPC;
38  EicTpc *tpc = new EicTpc ("TPC/tpc-v01.0-ns.root");
39  //EicEnergyMonitor *monitor = tpc->AddEnergyMonitorVolume("TpcGas", 11, "hist", 0., 25.);
40  //monitor->AtVolumeExit();
41  //monitor->PrimaryOnly();
42  fRun->AddModule(tpc);
43 
44 #ifdef _WITH_MUMEGAS_
45  fRun->AddModule(new EicMuMegas("MMT", "MUMEGAS/mmt-v01.0.root", qDUMMY));
46 #endif
47 
48  // PID detector place holders;
49  fRun->AddModule(new EicDetector("FLR", "RICH/flr-v01.0.root", qDUMMY, qMergeStepsInOneHit));
50  fRun->AddModule(new EicDetector("BLR", "RICH/blr-v01.0.root", qDUMMY, qMergeStepsInOneHit));
51  fRun->AddModule(new EicDetector("CLR", "RICH/clr-v01.0.root", qDUMMY, qMergeStepsInOneHit));
52 
53  // RICH objects; NB: ROOT has to be patched to make SetScale() working (!!!);
54  // ~/FairRoot/eicroot/ is configured to use such one (?);
55 #if 1
56  CbmRich *frich = new CbmRich("FRICH", kTRUE, 0, 0, 55.); // Z-offset in [cm];
57  frich->SetGeometryFileName("rich_v13a_f.gdml"); frich->SetScale(0.6);//0.7);
58  fRun->AddModule(frich);
59 #endif
60 
61  fRun->AddModule(new EicCalorimeter("BEMC", "ECAL/bemc-v01.0-ns.root", qBEMC));
62  fRun->AddModule(new EicCalorimeter("CEMC", "ECAL/cemc-v01.0-ns.root", qFEMC));
63  fRun->AddModule(new EicCalorimeter("FEMC", "ECAL/femc-v01.0-ns.root", qFEMC));
64  fRun->AddModule(new EicCalorimeter("FHAC", "HCAL/fhac-v01.0-ns.root", qFHAC));
65  fRun->AddModule(new EicCalorimeter("BHAC", "HCAL/bhac-v01.0-ns.root", qBHAC));
66 
67  // Create and set up (Box) Event Generator;
68  {
69  // Be lazy, hardcode polar angles matching eta [0..4]:
70  // ~0.00, 0.50, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00;
71  // 89.00, 62.48, 40.40, 25.16, 15.41, 9.39, 5.70, 3.46, 2.10;
72 
73  int PDG = 211; // pion
74  double momentum = 10.0, theta = 25.16; //
75 
76  EicBoxGenerator *boxGen = new EicBoxGenerator(PDG);
77  boxGen->SetMomentum(momentum);
78  boxGen->SetTheta(theta);
79 
80  fRun->AddGenerator(boxGen);
81  }
82 
83  // Create and set up Apr'2016 solenoid field (binary file "input/SolenoidMap8.root");
84  fRun->AddField(new PndSolenoidMap("SolenoidMap8", "R"));
85 
86  // Initialize and run the simulation; exit at the end;
87  fRun->Run(nEvents);
88 } // simulation()
89