FairRoot/PandaRoot
macro/examples/fastsim/simfast.C
Go to the documentation of this file.
1 // *******
2 // Macro for running fast simulation
3 // *******
4 
5 
6 int simfast(TString infile="dsdsj20k.evt",int soff=0,int nevts=0,TString outfile="")
7 {
8  TStopwatch timer;
9  timer.Start();
10  gDebug=0;
11 
12  // Load basic libraries
13  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
14  basiclibs();
15 
16  // Load this example libraries
17  gSystem->Load("libGeoBase");
18  gSystem->Load("libParBase");
19  gSystem->Load("libBase");
20  gSystem->Load("libPndData");
21  gSystem->Load("libGen");
22  gSystem->Load("libRho");
23  gSystem->Load("libfsim");
24 
25  if (outfile=="") outfile=infile+".fast.root";
26 
27  FairRunSim *fRun = new FairRunSim();
28  fRun->SetOutputFile(outfile.Data());
29 
30  // Create and Set Event Generator
31  //-------------------------------
32 
33  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
34  fRun->SetGenerator(primGen);
35 
36  FairEvtGenGenerator* evtGen = new FairEvtGenGenerator(infile.Data());
37  primGen->AddGenerator(evtGen);
38 
39  primGen->DoTracking(kFALSE);
40 
41 
42  //Setup the Fast Simulation Task
43  //-----------------------------
44  PndFastSim* fastSim = new PndFastSim();
45 
46  //increasing verbosity increases the amount of console output (mainly for debugging)
47  fastSim->SetVerbosity(0);
48 
49  //enable the producting of parametrized neutral (hadronic) split offs
50  if (soff)
51  fastSim->EnableSplitoffs("splitpars.dat");
52 
53  //EM Calorimeters w/ default parameters (don't have to be set, just to list the available parameters
54  //EM Calorimeters w/ default parameters (don't have to be set, just to list the available parameters
55  fastSim->AddDetector("EmcBarrel","thtMin=22.0 thtMax=140.0 Emin=0.01 barrelRadius=0.5");
56  fastSim->AddDetector("EmcFwCap", "thtMin=5.0 thtMax=22.0 Emin=0.01 dist=2.5");
57  fastSim->AddDetector("EmcBwCap", "thtMin=140.0 thtMax=170.0 Emin=0.01 dist=0.7");
58  fastSim->AddDetector("EmcFS", "thtMin=0.05 thtMax=5.0 aPar=0.02 bPar=0.0274 Emin=0.01 dist=8.0");
59 
60  //Tracking, Vertexing, dE/dx
61  fastSim->AddDetector("Mvd", "thtMin=0.0 thtMax=180.0 vtxRes=0.0001 pRes=0.1 phiRes=0.01 thetaRes=0.01 dEdxRes=0.25");
62  fastSim->AddDetector("Stt", "thtMin=7.765 thtMax=159.44 dEdxRes=0.2");
63  fastSim->AddDetector("MdcTS","thtMin=0.5 thtMax=22.0");
64  fastSim->AddDetector("MdcFS","thtMin=0.5 angleXMax=10.0 angleYMax=5.0");
65  //fastSim->AddDetector("Tpc", "thtMin=7.765 thtMax=159.44 efficiency=1.0 pmin=0.0 pRes=0.005 phiRes=0.1 thetaRes=0.1 dEdxRes=0.07");
66 
67  //PID detectors
68  fastSim->AddDetector("DrcBarrel","thtMin=22.0 thtMax=140.0 dthtc=0.01 nPhotMin=5 effNPhotons=0.075");
69  fastSim->AddDetector("DrcDisc","thtMin=5.0 thtMax=22.0 dthtc=0.01 nPhotMin=5 effNPhotons=0.075");
70  fastSim->AddDetector("Rich","angleXMax=5.0 angleYMax=10.0 dthtc=0.01 nPhotMin=5 effNPhotons=0.075");
71  fastSim->AddDetector("Tof","thtMin=22.0 thtMax=140.0 dp=0.01");
72 
73  fRun->AddTask(fastSim);
74 
75  fRun->Init();
76  if (nevts==0) nevts=10;
77  fRun->Run(nevts);
78 
79  timer.Stop();
80  Double_t rtime = timer.RealTime();
81  Double_t ctime = timer.CpuTime();
82  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
83  return 0;
84 }
85 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
basiclibs()
bool AddDetector(std::string name, std::string params="")
Definition: PndFastSim.cxx:313
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
FairRunAna * fRun
Definition: hit_dirc.C:58
Double_t
TStopwatch timer
Definition: hit_dirc.C:51
gDebug
Definition: sim_emc_apd.C:6
bool EnableSplitoffs(std::string fname="splitpars.dat")
Definition: PndFastSim.cxx:224
Double_t ctime
Definition: hit_dirc.C:114
void SetVerbosity(int vb)
Definition: PndFastSim.h:59
FairEvtGenGenerator * evtGen
Double_t rtime
Definition: hit_dirc.C:113
int simfast(TString infile="dsdsj20k.evt", int soff=0, int nevts=0, TString outfile="")
TFile infile("dedx_out.root","READ")
TString outfile