FairRoot/PandaRoot
SimCompleteMain.cxx
Go to the documentation of this file.
1 // Example of a compiled program to perform a full simulation run: a compiled
2 // version of the sim_complete_tpc.C macro.
3 //
4 // Elwin Dijck, December 2009
5 // JGM, January 2010
6 
7 #include "SimComplete.h"
8 
9 #include <TRint.h>
10 #include <TROOT.h>
11 
12 #include <iostream>
13 #include <sstream>
14 
15 
16 using namespace std;
17 
18 
19 template <typename Type>
20 Type StrTo(char const *str);
21 
22 
23 int main(int argc, char *argv[])
24 {
25  // Start application.
26  gROOT->SetBatch();
27  TApplication app("SimComplete", &argc, argv, 0, -1);
28 
29  // Read the command line options or provide default values.
30  Int_t nEvents = argc > 1 ? StrTo<Int_t>(argv[1]) : 10;
31  TString trackDetector = argc > 2 ? argv[2] : "stt";
32  TString const &simEngine = argc > 3 ? argv[3] : "TGeant3";
33  Double_t momentum = argc > 4 ? StrTo<Double_t>(argv[4]) : 7.24;
34  Bool_t useEvtGen = argc > 5 ? StrTo<Bool_t>(argv[5]) : kTRUE;
35  Bool_t useDpm = argc > 6 ? StrTo<Bool_t>(argv[6]) : kFALSE;
36  Bool_t useBoxGenerator = argc > 7 ? StrTo<Bool_t>(argv[7]) : kFALSE;
37  Double_t beamMomentum = argc > 8 ? StrTo<Double_t>(argv[8]) : 15.0;
38  TString outFile= argc > 9 ? argv[9] : "sim_complete.root";
39  TString outParamsFile= argc > 10 ? argv[10] : "simparams.root";
40  TString inDigiParamsFile = argc > 11 ? argv[11] : "all.par";
41 
42  cout << boolalpha;
43 
44  cout << endl << "Starting full simulation with:" << endl
45  << " # events : " << nEvents << endl
46  << " tracking detector : " << trackDetector << endl
47  << " sim engine : " << simEngine << endl
48  << " momentum : " << momentum << "GeV/c" << endl
49  << " using EvtGen : " << useEvtGen << endl
50  << " using Dpm : " << useDpm << endl
51  << " using BoxGenerator : " << useBoxGenerator << endl
52  << " beam momentum : " << beamMomentum << "GeV/c" << endl
53  << " output file : " << outFile << endl
54  << " output params file : " << outParamsFile << endl
55  << " input digi params file : " << inDigiParamsFile << endl << endl;
56 
57  // Start the simulation.
58 
59  SimComplete(nEvents, simEngine, momentum, useEvtGen, useDpm,
60  useBoxGenerator, beamMomentum, outFile, outParamsFile,
61  inDigiParamsFile,trackDetector);
62 
63  return 0;
64 }
65 
66 
67 // Helper function to convert an argument to any type.
68 template <typename Type>
69 Type StrTo(char const *str)
70 {
71  istringstream iss(str);
72 
73  iss >> boolalpha; // Use true/false instead of 1/0 for booleans.
74 
75  Type result;
76  iss >> result;
77 
78  return result;
79 }
TString outFile
Definition: hit_dirc.C:17
Type StrTo(char const *str)
Double_t
Int_t nEvents
Definition: hit_dirc.C:11
int main(int argc, char *argv[])
void SimComplete(Int_t nEvents, TString const &simEngine, Double_t momentum, Bool_t useEvtGen, Bool_t useDpm, Bool_t useBoxGenerator, Double_t beamMomentum, TString const &outFile, TString const &outParamsFile, TString const &inDigiParamsFile, TString const &trackDetector)
Definition: SimComplete.cxx:40