FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
run_digi_reco_local.C
Go to the documentation of this file.
1 void run_digi_reco_local(Int_t nofFiles, TString mcEngine = "TGeant3")
2 {
4  // logger->SetLogFileName("MyLog.log");
5  // logger->SetLogToScreen(kTRUE);
6  // logger->SetLogToFile(kTRUE);
7  logger->SetLogVerbosityLevel("LOW");
8  // logger->SetLogFileLevel("DEBUG4");
9  // logger->SetLogScreenLevel("DEBUG");
10 
11  TString workDir = gSystem->WorkingDirectory();
12 
13  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
14  Int_t iVerbose = 0; // just forget about it, for the moment
15 
16  // Input file (MC events)
17  // TString inFile = "data/testrun_";
18  // inFile = inFile + mcEngine + ".root";
19 
20  // Parameter file
21  // TString parFile = "data/testparams_";
22  // parFile = parFile + mcEngine + ".root";
23 
24  // Output file
25  TString outFile = Form("data/testDiReLo_%df_", nofFiles);
26  outFile = outFile + mcEngine + ".root";
27 
28  // ----- Timer --------------------------------------------------------
29  TStopwatch timer;
30 
31  // ----- Reconstruction run -------------------------------------------
32  FairRunAna* fRun = new FairRunAna();
33  TString inFile = Form("file://%s/data/testrun_%s_f%d.root", workDir.Data(), mcEngine.Data(), 0);
34  FairFileSource* fFileSource = new FairFileSource(inFile);
35  fRun->SetSource(fFileSource);
36 
37  for (Int_t ifile = 1; ifile < nofFiles; ifile++) {
38  cout << "fRun->AddFile(....f" << ifile << ".root" << endl;
39  fFileSource->AddFile(Form("file://%s/data/testrun_%s_f%d.root", workDir.Data(), mcEngine.Data(), ifile));
40  }
41 
42  fRun->SetSink(new FairRootFileSink(outFile));
43 
44  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
45  FairParRootFileIo* parInput1 = new FairParRootFileIo();
46 
47  TList* fnamelist = new TList();
48 
49  for (Int_t ifile = 0; ifile < nofFiles; ifile++)
50  fnamelist->Add(new TObjString(Form("%s/data/testpar_%s_f%d.root", workDir.Data(), mcEngine.Data(), ifile)));
51 
52  cout << "PAR LIST CREATED" << endl;
53  parInput1->open(fnamelist);
54  // parInput1->open(parFile.Data());
55 
56  rtdb->setFirstInput(parInput1);
57 
59  fRun->AddTask(digiTask);
60 
62  fRun->AddTask(hitProducer);
63 
64  fRun->Init();
65 
66  timer.Start();
67  fRun->Run();
68 
69  // ----- Finish -------------------------------------------------------
70 
71  cout << endl << endl;
72 
73  // Extract the maximal used memory an add is as Dart measurement
74  // This line is filtered by CTest and the value send to CDash
75  FairSystemInfo sysInfo;
76  Float_t maxMemory = sysInfo.GetMaxMemory();
77  cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
78  cout << maxMemory;
79  cout << "</DartMeasurement>" << endl;
80 
81  timer.Stop();
82  Double_t rtime = timer.RealTime();
83  Double_t ctime = timer.CpuTime();
84 
85  Float_t cpuUsage = ctime / rtime;
86  cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
87  cout << cpuUsage;
88  cout << "</DartMeasurement>" << endl;
89 
90  cout << endl << endl;
91  cout << "Output file is " << outFile << endl;
92  cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
93  cout << "Macro finished successfully." << endl;
94 
95  // ------------------------------------------------------------------------
96 }
list of container factories
Definition: FairRuntimeDb.h:24
void Init()
Definition: FairRunAna.cxx:127
void Run(Int_t NStart=0, Int_t NStop=0)
Definition: FairRunAna.cxx:275
void SetSink(FairSink *tempSink)
Definition: FairRun.h:84
Float_t GetMaxMemory()
static FairLogger * GetLogger()
Definition: FairLogger.cxx:39
FairRuntimeDb * GetRuntimeDb(void)
Definition: FairRun.h:80
virtual void AddTask(FairTask *t)
Definition: FairRun.cxx:70
Bool_t open(const Text_t *fname, Option_t *option="READ", const Text_t *ftitle="", Int_t compress=1)
virtual void SetSource(FairSource *tempSource)
Definition: FairRunAna.h:70
StepLogger logger
void SetLogVerbosityLevel(const char *verbosity)
Definition: FairLogger.h:87
Bool_t setFirstInput(FairParIo *)
void run_digi_reco_local(Int_t nofFiles, TString mcEngine="TGeant3")