FairRoot/PandaRoot
materialsim.C
Go to the documentation of this file.
1 {
2  TStopwatch timer;
3  timer.Start();
4  gDebug=0;
5  int verboseLevel = 0;
6  Int_t nEvents = 10000;
7  // ---- Load libraries -------------------------------------------------
8  gROOT->Macro("../Libs.C");
9 
10  FairRunSim *fRun = new FairRunSim();
11 
12  // set the MC version used
13  // ------------------------
14 
15 // fRun->SetName("TGeant3");
16  fRun->SetName("TGeant4");
17  // Choose the Geant Navigation System
18 
19 // PndFileNameCreator namecreator("../data/mvdmaterial.root");
20  PndFileNameCreator namecreator("../data/mvdTestGeo.root");
22  fRun->SetOutputFile(filename.c_str());
23 
24  // Set Material file Name
25  //-----------------------
26 
27  fRun->SetMaterials("media_pnd.geo");
28 
29  // Create and add detectors
30  //-------------------------
31 
32  FairModule *Cave= new PndCave("CAVE");
33  Cave->SetGeometryFileName("pndcave.geo");
34  fRun->AddModule(Cave);
35 
36 // FairModule *Magnet= new PndMagnet("MAGNET");
37 // Magnet->SetGeometryFileName("magnet.geo");
38 // fRun->AddModule(Magnet);
39 
40  FairModule *Pipe= new PndPipe("PIPE");
41  Pipe->SetGeometryFileName("pipebeamtarget.geo");
42  fRun->AddModule(Pipe);
43 
44  FairDetector *Mvd = new PndMvdDetector("MVD", kFALSE);//kTRUE);
45  Mvd->SetGeometryFileName("MVD_v1.0_woPassiveTraps.root");
46 // Mvd->SetGeometryFileName("MVD_v1.0.root");
47 // Mvd->SetGeometryFileName("MVD14.root");
48  Mvd->SetVerboseLevel(verboseLevel);
49  fRun->AddModule(Mvd);
50 
51 
52 
53  // Create and Set Event Generator
54  //-------------------------------
55 
56  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
57  fRun->SetGenerator(primGen);
58  //ROOTino
60  fBox1->SetXYZ(0.,0.,0.);
61  fBox1->SetPRange(0.1,0.5);
62  fBox1->SetThetaRange(0.,180.);
63  fBox1->SetPhiRange(0.,360.);
64  fBox1->SetCosTheta();
65  primGen->AddGenerator(fBox1);
66 
67 
68 
69  //fRun->SetStoreTraj(kTRUE);
70  fRun->SetStoreTraj(kFALSE);
71  fRun->SetRadLenRegister(kTRUE);
72 // gRandom->SetSeed(12345);
73  fRun->Init();
74  Mvd->Initialize(); // do this, if the detector is not set active
75 
76  // Fill the Parameter containers for this run
77  //-------------------------------------------
78 
79  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
81  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
82  output->open("../data/mvdTestGeo1.0_par.root");
83  rtdb->setOutput(output);
84  rtdb->saveOutput();
85  rtdb->print();
86 
87  // Transport nEvents
88  // -----------------
89  fRun->SetTrackingDebugMode(false);
90  fRun->Run(nEvents);
91 
92  timer.Stop();
93  Double_t rtime = timer.RealTime();
94  Double_t ctime = timer.CpuTime();
95  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
96 }
97 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
void SetThetaRange(Double32_t thetamin=0, Double32_t thetamax=90)
std::string filename
Definition: materialsim.C:21
FairRunSim * fRun
Definition: materialsim.C:10
FairRuntimeDb * rtdb
Definition: materialsim.C:79
PndFileNameCreator namecreator("../data/mvdTestGeo.root")
Bool_t kParameterMerged
Definition: materialsim.C:80
void SetXYZ(Double32_t x=0, Double32_t y=0, Double32_t z=0)
gDebug
Definition: materialsim.C:4
FairParRootFileIo * output
Definition: materialsim.C:81
std::string GetSimFileName(std::string addon="", bool cut=false)
Int_t nEvents
Definition: materialsim.C:6
FairModule * Pipe
Definition: materialsim.C:40
PndBoxGenerator * fBox1
Definition: materialsim.C:59
Double_t rtime
Definition: materialsim.C:93
A simple class which adds the corresponding file extensions to a given base class.
Double_t
TStopwatch timer
Definition: hit_dirc.C:51
FairPrimaryGenerator * primGen
Definition: materialsim.C:56
int verboseLevel
Definition: materialsim.C:5
FairModule * Cave
Definition: materialsim.C:32
void SetPRange(Double32_t pmin=0, Double32_t pmax=10)
Double_t ctime
Definition: materialsim.C:94
FairDetector * Mvd
Definition: materialsim.C:44
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)
Definition: PndCave.h:8