FairRoot/PandaRoot
rungeotest.C
Go to the documentation of this file.
1 // Macro for running Cbm 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 = 3;
8  Int_t nEvents = 10;
9  // ---- Load libraries -------------------------------------------------
10  gROOT->Macro("../Libs.C");
11 
12  FairRunSim *fRun = new FairRunSim();
13 
14  // set the MC version used
15  // ------------------------
16 
17  fRun->SetName("TGeant4");
18  // Choose the Geant Navigation System
19  // fRun->SetGeoModel("G3Native");
20 
21  fRun->SetOutputFile("../data/testMCgeo.root");
22 
23  // Set Material file Name
24  //-----------------------
25 
26  fRun->SetMaterials("media_pnd.geo");
27 
28  // Create and add detectors
29  //-------------------------
30 
31  FairModule *Cave= new PndCave("CAVE");
32  Cave->SetGeometryFileName("pndcave.geo");
33  fRun->AddModule(Cave);
34 
35 // FairModule *Magnet= new PndMagnet("MAGNET");
36 // Magnet->SetGeometryFileName("magnet.geo");
37 // fRun->AddModule(Magnet);
38 
39  FairModule *Pipe= new PndPipe("PIPE");
40  Pipe->SetGeometryFileName("pipebeamtarget.geo");
41  fRun->AddModule(Pipe);
42 
43  FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE);
44 // Mvd->SetGeometryFileName("MVD14.root");
45  Mvd->SetGeometryFileName("MVD_v1.0.root");
46  Mvd->SetVerboseLevel(verboseLevel);
47  fRun->AddModule(Mvd);
48 
49 
50  // Create and Set Event Generator
51  //-------------------------------
52 
53  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
54  fRun->SetGenerator(primGen);
55 
56 
57  // Box Generator
59  fBox->SetPRange(0.1,10);
60  fBox->SetThetaRange(0,180); //all
61  fBox->SetYRange(-100,100);
62  fBox->SetCosTheta();
63  primGen->AddGenerator(fBox);
64 
65  fRun->SetStoreTraj(kFALSE);
66 
67 
68  fRun->Init();
69  // Fill the Parameter containers for this run
70  //-------------------------------------------
71 
72  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
74  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
75  output->open("../data/testMCGeoParams.root");
76  rtdb->setOutput(output);
77  rtdb->saveOutput();
78  rtdb->print();
79 
80  // Transport nEvents
81  // -----------------
82  fRun->Run(nEvents);
83 
84  gGeoManager->SetVisLevel(1000);
85  gGeoManager->DefaultColors();
86  gGeoManager->GetMasterVolume()->Draw("ogl");
87  gGeoManager->GetListOfVolumes()->Print();
88 
89 // gGeoManager->CheckOverlaps();
90 // gGeoManager->PrintOverlaps();
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 }
98 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
void SetThetaRange(Double32_t thetamin=0, Double32_t thetamax=90)
int verboseLevel
Definition: Lars/runMvdSim.C:7
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
void SetYRange(Double32_t ymin=-5, Double32_t ymax=7)
FairDetector * Mvd
Definition: sim_emc_apd.C:51
TGeoManager * gGeoManager
FairBoxGenerator * fBox
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
void SetPRange(Double32_t pmin=0, Double32_t pmax=10)
FairModule * Pipe
Definition: sim_emc_apd.C:44
Double_t rtime
Definition: hit_dirc.C:113
Definition: PndCave.h:8