FairRoot/PandaRoot
DigiCompleteMain.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 digi_complete_tpc.C macro.
3 //
4 // Elwin Dijck, December 2009
5 // JGM, January 2010
6 
7 #include "DigiComplete.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("DigiComplete", &argc, argv, 0, -1);
28 
29  // Read the command line options or provide default values.
30 
31  TString inFile = argc > 1 ? argv[1] : "sim_complete.root";
32  TString parFile = argc > 2 ? argv[2] : "simparams.root";
33  TString digiFile = argc > 3 ? argv[3] : "all.par";
34  TString outFile = argc > 4 ? argv[4] : "digi_complete.root";
35 
36  cout << boolalpha;
37 
38  cout << endl << "Starting digi simulation with TPC:" << endl
39  << " input file : " << inFile << endl
40  << " output file : " << outFile << endl
41  << " params file : " << parFile << endl
42  << " input digi params file : " << digiFile << endl << endl;
43 
44  // Start the simulation.
45  DigiComplete(inFile, parFile, digiFile, outFile);
46 
47  return 0;
48 }
49 
50 
51 // Helper function to convert an argument to any type.
52 template <typename Type>
53 Type StrTo(char const *str)
54 {
55  istringstream iss(str);
56 
57  iss >> boolalpha; // Use true/false instead of 1/0 for booleans.
58 
59  Type result;
60  iss >> result;
61 
62  return result;
63 }
int main(int argc, char **argv)
TString outFile
Definition: hit_dirc.C:17
TString digiFile
Definition: bump_emc.C:20
TString inFile
Definition: hit_dirc.C:8
Type StrTo(char const *str)
TString parFile
Definition: hit_dirc.C:14
void DigiComplete(TString const &inFile, TString const &parFile, TString const &digiFile, TString const &outFile)