FairRoot/PandaRoot
tutorials/charmonium/jul10/simfast.C
Go to the documentation of this file.
1 // *******
2 // Macro for running fast simulation
3 // *******
4 
5 
6 void simfast(TString infile="output.evt",int soff=0,int nevts=1000,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 
33  //FairEvtGenGenerator* evtGen = new FairEvtGenGenerator(infile.Data());
34  //primGen->AddGenerator(evtGen);
35 
37  PndEvtGenDirect *EvtGen = new PndEvtGenDirect("psi(2S)","PSI2S.DEC");
38  EvtGen->SetStoreTree();
39  primGen->AddGenerator(EvtGen);
40 
42 // Float_t mom = 6.991;
43 // PndDpmDirect *Dpm= new PndDpmDirect(mom,0);
44 // primGen->AddGenerator(Dpm);
45 
46  primGen->DoTracking(kFALSE);
47 
48 
49  //Setup the Fast Simulation Task
50  //-----------------------------
51  PndFastSim* fastSim = new PndFastSim();
52 
53  //increasing verbosity increases the amount of console output (mainly for debugging)
54  fastSim->SetVerbosity(0);
55 
56  //enable the producting of parametrized neutral (hadronic) split offs
57  if (soff)
58  fastSim->EnableSplitoffs("splitpars.dat");
59 
60  //EM Calorimeters w/ default parameters (don't have to be set, just to list the available parameters
61  //EM Calorimeters w/ default parameters (don't have to be set, just to list the available parameters
62  fastSim->AddDetector("EmcBarrel","thtMin=22.0 thtMax=140.0 Emin=0.01 barrelRadius=0.5");
63  fastSim->AddDetector("EmcFwCap", "thtMin=5.0 thtMax=22.0 Emin=0.01 dist=2.5");
64  fastSim->AddDetector("EmcBwCap", "thtMin=140.0 thtMax=170.0 Emin=0.01 dist=0.7");
65  fastSim->AddDetector("EmcFS", "thtMin=0.05 thtMax=5.0 aPar=0.02 bPar=0.0274 Emin=0.01 dist=8.0");
66 
67  //Tracking, Vertexing, dE/dx
68  fastSim->AddDetector("Mvd", "thtMin=0.0 thtMax=180.0 vtxRes=0.0001 pRes=0.1 phiRes=0.01 thetaRes=0.01 dEdxRes=0.25");
69  fastSim->AddDetector("Stt", "thtMin=7.765 thtMax=159.44 dEdxRes=0.2");
70  fastSim->AddDetector("MdcTS","thtMin=0.5 thtMax=22.0");
71  fastSim->AddDetector("MdcFS","thtMin=0.5 angleXMax=10.0 angleYMax=5.0");
72  //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");
73 
74  //PID detectors
75  fastSim->AddDetector("DrcBarrel","thtMin=22.0 thtMax=140.0 dthtc=0.01 nPhotMin=5 effNPhotons=0.075");
76  fastSim->AddDetector("DrcDisc","thtMin=5.0 thtMax=22.0 dthtc=0.01 nPhotMin=5 effNPhotons=0.075");
77  fastSim->AddDetector("Rich","angleXMax=5.0 angleYMax=10.0 dthtc=0.01 nPhotMin=5 effNPhotons=0.075");
78  fastSim->AddDetector("Tof","thtMin=22.0 thtMax=140.0 dp=0.01");
79 
80  fRun->AddTask(fastSim);
81 
82  fRun->Init();
83  if (nevts==0) nevts=10;
84  fRun->Run(nevts);
85 
86  timer.Stop();
87  Double_t rtime = timer.RealTime();
88  Double_t ctime = timer.CpuTime();
89  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
90 }
91 
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
void SetStoreTree(Bool_t store=true)
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
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