FairRoot/PandaRoot
simLambda.C
Go to the documentation of this file.
1 // Macro for running Pnd with Geant3 or Geant4 (M. Al-Turany , D. Bertini)
2 // Modified 22/06/2005 D.Bertini
3 {
4  TStopwatch timer;
5  timer.Start();
6  gDebug=0;
7  int verboseLevel = 1;
8  Int_t nEvents = 1000;
9  // Load basic libraries
10  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
11  basiclibs();
12 
13  // Load this example libraries
14  gSystem->Load("libGeoBase");
15  gSystem->Load("libParBase");
16  gSystem->Load("libBase");
17  gSystem->Load("libPndData");
18  gSystem->Load("libField");
19  gSystem->Load("libPassive");
20 
21  gSystem->Load("libgenfit");
22  gSystem->Load("libtrackrep");
23  gSystem->Load("libtpc");
24  gSystem->Load("libtpcreco");
25  gSystem->Load("librecotasks");
26 
27  gSystem->Load("libMvd");
28  gSystem->Load("libGen");
29  gSystem->Load("libPGen");
30 
31  PndRunSim *fRun = new PndRunSim();
32 
33  // set the MC version used
34  // ------------------------
35 
36  fRun->SetName("TGeant3");
37  // Choose the Geant Navigation System
38 
39  fRun->SetOutputFile("../data/lambdasMC.root");
40 
41  // Set Material file Name
42  //-----------------------
43 
44  fRun->SetMaterials("media_pnd.geo");
45 
46  // Create and add detectors
47  //-------------------------
48 
49  PndModule *Cave= new PndCave("CAVE");
50  Cave->SetGeometryFileName("pndcave.geo");
51  fRun->AddModule(Cave);
52 
53 // PndModule *Magnet= new PndMagnet("MAGNET");
54 // Magnet->SetGeometryFileName("magnet.geo");
55 // fRun->AddModule(Magnet);
56 
57 // PndModule *Pipe= new PndPipe("PIPE");
58 // Pipe->SetGeometryFileName("pipebeamtarget.geo");
59 // fRun->AddModule(Pipe);
60 
61  PndDetector *Mvd = new PndMvdDetector("MVD", kTRUE);
62  //Mvd->SetGeometryFileName("MVD_Rev14b_Corr+Dead.geo");
63  Mvd->SetGeometryFileName("MVD14.root");
64 // Mvd->SetGeometryFileName("Root_Test.root");
65  //Mvd->SetGeometryFileName("MVD14_b.root");
66  Mvd->SetVerboseLevel(verboseLevel);
67  fRun->AddModule(Mvd);
68 
69 
70  // Create and Set Event Generator
71  //-------------------------------
72 
73  PndPrimaryGenerator* primGen = new PndPrimaryGenerator();
74  fRun->SetGenerator(primGen);
75 
76  // Urqmd Generator
77  // PndUrqmdGenerator* urqmdGen = new PndUrqmdGenerator("../../input/00-03fm.100ev.f14");
78  // primGen->AddGenerator(urqmdGen);
79 
80  // Particle Generator (pdgid,mult, px,py,pz, vx,vy,vz)
81 
82  // shoot one lambda0
83  PndParticleGenerator* partGen = new PndParticleGenerator(3122 ,1, 1.,0.,0., 0.,0.,0.);
84  primGen->AddGenerator(partGen);
85 
86  // Ion Generator
87  // PndIonGenerator *fIongen= new PndIonGenerator(79, 197,79,1, 0.,0., 25, 0.,0.,-1.);
88  // primGen->AddGenerator(fIongen);
89 
90  // Box Generator
91  // PndBoxGenerator *fBox = new PndBoxGenerator(211, 10);
92  // fBox->SetPRange(0.1,10);
93 // fBox->SetThetaRange(60,120); //barrel
94 // fBox->SetThetaRange(0,30); //forward
95  // fBox->SetThetaRange(0,180); //all
96  // fBox->SetYRange(-100,100);
97  // fBox->SetCosTheta();
98  // primGen->AddGenerator(fBox);
99 
100  // DPM Generator
101  //PndDpmGenerator* dpmGen = new PndDpmGenerator("/home/kph/stockman/fairroot/cbmroot/pandaroot/pgenerators/DpmEvtGen/Background-micro.root");
102  //primGen->AddGenerator(dpmGen);
103 
104  // Field Map Definition
105  // --------------------
106  // 1- Reading the new field map in the old format
107 
108  // PndFieldMap *fMagField= new PndFieldMap("FIELD.v04_pavel.map");
109  // Constant Field
110  // PndConstField *fMagField=new PndConstField();
111  // fMagField->SetFieldXYZ(0, 14 ,0 ); // values are in kG
112  // MinX=-75, MinY=-40,MinZ=-12 ,MaxX=75, MaxY=40 ,MaxZ=124 ); // values are in cm
113  // fMagField->SetFieldRegions(-74, -39 ,-22 , 74, 39 , 160 );
114 
115  // 2- Reading the new field map in the new format
116 
117 // PndField *fMagField= new PndFieldMapSym3("FieldActive");
118  // Active Shielding
119 
120 // fRun->SetField(fMagField);
121 
122  //fRun->SetStoreTraj(kTRUE);
123  fRun->SetStoreTraj(kFALSE);
124 
125 
126  fRun->Init();
127 
128  // -Trajectories Visualization (TGeoManager Only )
129  // -----------------------------------------------
130 
131 
132  // Set cuts for storing the trajectpries
133  /* PndTrajFilter* trajFilter = PndTrajFilter::Instance();
134  trajFilter->SetStepSizeCut(0.01); // 1 cm
135  trajFilter->SetVertexCut(-2000., -2000., 4., 2000., 2000., 100.);
136  trajFilter->SetMomentumCutP(10e-3); // p_lab > 10 MeV
137  trajFilter->SetEnergyCut(0., 1.02); // 0 < Etot < 1.04 GeV
138  trajFilter->SetStorePrimaries(kTRUE);
139  trajFilter->SetStoreSecondaries(kTRUE);
140  */
141 
142  // Fill the Parameter containers for this run
143  //-------------------------------------------
144 
145  PndRuntimeDb *rtdb=fRun->GetRuntimeDb();
147  PndParRootFileIo* output=new PndParRootFileIo(kParameterMerged);
148  output->open("../data/testParams.root");
149  rtdb->setOutput(output);
150  rtdb->saveOutput();
151  rtdb->print();
152 
153  // Transport nEvents
154  // -----------------
155 
156  fRun->Run(nEvents);
157 
158 
159 
160  timer.Stop();
161  Double_t rtime = timer.RealTime();
162  Double_t ctime = timer.CpuTime();
163  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
164 }
165 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
basiclibs()
int verboseLevel
Definition: Lars/runMvdSim.C:7
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
FairDetector * Mvd
Definition: sim_emc_apd.C:51
PndHypBupGenerator * partGen
Definition: runSimHF_ptr.C:144
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
FairRunAna * fRun
Definition: hit_dirc.C:58
Double_t
FairModule * Cave
Definition: sim_emc_apd.C:32
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
gDebug
Definition: sim_emc_apd.C:6
Double_t ctime
Definition: hit_dirc.C:114
Double_t rtime
Definition: hit_dirc.C:113
Definition: PndCave.h:8