FairRoot/PandaRoot
Functions
runHCalSim.C File Reference

Go to the source code of this file.

Functions

int runHCalSim (Double_t beam_mom=0.7, Int_t nEvents=100)
 

Function Documentation

int runHCalSim ( Double_t  beam_mom = 0.7,
Int_t  nEvents = 100 
)

Definition at line 5 of file runHCalSim.C.

References Bool_t, Cave, ctime, Double_t, fBox, fRun, gDebug, kParameterMerged, nEvents, output, parOutput, primGen, printf(), rtdb, rtime, simOutput, timer, TString, and verboseLevel.

7 {
8  TStopwatch timer;
9  timer.Start();
10  gDebug=0;
11  int verboseLevel = 0;
12 
13  //FileNames
14  TString simOutput="HCalMC.root";
15  TString parOutput="HCalMC_Params.root";
16 
17  // Load basic libraries
18  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
19 
20  FairRunSim *fRun = new FairRunSim();
21 
22  // set the MC version used
23  // ------------------------
24 
25  fRun->SetName("TGeant4");
26  // Choose the Geant Navigation System
27 
28  fRun->SetOutputFile(simOutput);
29 
30  // Set Material file Name
31  //-----------------------
32  fRun->SetMaterials("media_pnd.geo");
33 
34  // Create and add detectors
35  //-------------------------
36 
37  FairModule *Cave= new PndCave("CAVE");
38  Cave->SetGeometryFileName("pndcave.geo");
39  fRun->AddModule(Cave);
40 
41  FairDetector *HCal = new PndMvdDetector("HCal", kTRUE);
42  HCal->SetGeometryFileName("HCal.root");
43  HCal->SetVerboseLevel(verboseLevel);
44  fRun->AddModule(HCal);
45 
46  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
47  fRun->SetGenerator(primGen);
48 
49  // Box Generator
50 
51  FairBoxGenerator *fBox = new FairBoxGenerator(2212, 1);
52  fBox->SetPRange(beam_mom,beam_mom);
53  fBox->SetThetaRange(0.,0.);
54  fBox->SetPhiRange(0.,360);
55  fBox->SetXYZ(0.,0.,-5.);
56  primGen->AddGenerator(fBox);
57 
58  // fRun->SetStoreTraj(kFALSE); // toggle this for use with EVE
59  fRun->SetStoreTraj(kTRUE); // toggle this for use with EVE
60  //fRun->SetRadLenRegister(kTRUE);
61 
62  fRun->Init();
63 
64  // Fill the Parameter containers for this run
65  //-------------------------------------------
66  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
68  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
69  output->open(parOutput.Data(),"RECREATE");
70  rtdb->setOutput(output);
71 
72  // Transport nEvents
73  // -----------------
74 
75  fRun->Run(nEvents);
76 
77  rtdb->saveOutput();
78  rtdb->print();
79 
80  timer.Stop();
81  Double_t rtime = timer.RealTime();
82  Double_t ctime = timer.CpuTime();
83  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
84  return 0;
85 
86 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
int verboseLevel
Definition: Lars/runMvdSim.C:7
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
FairBoxGenerator * fBox
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
TString parOutput
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
TString simOutput
Double_t rtime
Definition: hit_dirc.C:113
Definition: PndCave.h:8