FairRoot/PandaRoot
tutorials/analysis/simfast.C
Go to the documentation of this file.
1 // *******
2 // Macro for running fast simulation
3 // *******
4 
5 
6 void 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/rootlogon.C");
14  rootlogon();
15 
16  // Load this libraries
17  //gSystem->Load("libRho");
18  gSystem->Load("libfastsim");
19 
20  if (outfile=="") outfile=infile+".fast.root";
21 
22  FairRunSim *fRun = new FairRunSim();
23  fRun->SetOutputFile(outfile.Data());
24  fRun->SetName("TGeant3");
25 
26  // Create and Set Event Generator
27  //-------------------------------
28 
29  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
30  fRun->SetGenerator(primGen);
31 
32  FairEvtGenGenerator* evtGen = new FairEvtGenGenerator(infile.Data());
33  primGen->AddGenerator(evtGen);
34 
35  primGen->DoTracking(kFALSE);
36 
37 
38  //Setup the Fast Simulation Task
39  //-----------------------------
40  PndFastSim* fastSim = new PndFastSim();
41 
42  //increasing verbosity increases the amount of console output (mainly for debugging)
43  fastSim->SetVerbosity(0);
44 
45  //enable the producting of parametrized neutral (hadronic) split offs
46  if (soff)
47  fastSim->EnableSplitoffs("splitpars.dat");
48 
49  //EM Calorimeters w/ default parameters (don't have to be set, just to list the available parameters
50  //EM Calorimeters w/ default parameters (don't have to be set, just to list the available parameters
51  fastSim->AddDetector("EmcBarrel","thtMin=22.0 thtMax=140.0 Emin=0.01 barrelRadius=0.5");
52  fastSim->AddDetector("EmcFwCap", "thtMin=5.0 thtMax=22.0 Emin=0.01 dist=2.5");
53  fastSim->AddDetector("EmcBwCap", "thtMin=140.0 thtMax=170.0 Emin=0.01 dist=0.7");
54  fastSim->AddDetector("EmcFS", "thtMin=0.05 thtMax=5.0 aPar=0.02 bPar=0.0274 Emin=0.01 dist=8.0");
55 
56  //Tracking, Vertexing, dE/dx
57  fastSim->AddDetector("Mvd", "thtMin=0.0 thtMax=180.0 vtxRes=0.0001 pRes=0.1 phiRes=0.01 thetaRes=0.01 dEdxRes=0.25");
58  fastSim->AddDetector("Stt", "thtMin=7.765 thtMax=159.44 dEdxRes=0.2");
59  fastSim->AddDetector("MdcTS","thtMin=0.5 thtMax=22.0");
60  fastSim->AddDetector("MdcFS","thtMin=0.5 angleXMax=10.0 angleYMax=5.0");
61  //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");
62 
63  //PID detectors
64  fastSim->AddDetector("DrcBarrel","thtMin=22.0 thtMax=140.0 dthtc=0.01 nPhotMin=5 effNPhotons=0.075");
65  fastSim->AddDetector("DrcDisc","thtMin=5.0 thtMax=22.0 dthtc=0.01 nPhotMin=5 effNPhotons=0.075");
66  fastSim->AddDetector("Rich","angleXMax=5.0 angleYMax=10.0 dthtc=0.01 nPhotMin=5 effNPhotons=0.075");
67  fastSim->AddDetector("Tof","thtMin=22.0 thtMax=140.0 dp=0.01");
68 
69  fRun->AddTask(fastSim);
70 
71  fRun->Init();
72  if (nevts==0) nevts=10;
73  fRun->Run(nevts);
74 
75  timer.Stop();
76  Double_t rtime = timer.RealTime();
77  Double_t ctime = timer.CpuTime();
78  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
79 }
80 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
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