FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
runTF.C
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 int runTF()
9 {
10  TString dir = getenv("VMCWORKDIR");
11 
12  TString tut_geomdir = dir + "/common/geometry";
13  gSystem->Setenv("GEOMPATH", tut_geomdir.Data());
14 
15  TString tut_configdir = dir + "/common/gconfig";
16  gSystem->Setenv("CONFIG_DIR", tut_configdir.Data());
17 
18  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
19  Int_t iVerbose = 0; // just forget about it, for the moment
20 
21  // Input file (MC events)
22  TString inFile = "prop.hits.root";
23 
24  // Parameter file
25  TString parFile = "prop.par.root";
26 
27  // Output file
28  TString outFile = "prop.tracks.root";
29 
30  // ----- Timer --------------------------------------------------------
31  TStopwatch timer;
32 
33  // ----- Reconstruction run -------------------------------------------
34  FairRunAna* fRun = new FairRunAna();
35  fRun->SetSource(new FairFileSource(inFile));
36  fRun->SetSink(new FairRootFileSink(outFile));
37 
38  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
39  FairParRootFileIo* parInput1 = new FairParRootFileIo();
40  parInput1->open(parFile.Data());
41 
42  rtdb->setFirstInput(parInput1);
43 
45  fRun->AddTask(tfTask);
46 
47  fRun->Init();
48 
49  timer.Start();
50  fRun->Run();
51 
52  // ----- Finish -------------------------------------------------------
53 
54  cout << endl << endl;
55 
56  // Extract the maximal used memory an add is as Dart measurement
57  // This line is filtered by CTest and the value send to CDash
58  FairSystemInfo sysInfo;
59  Float_t maxMemory = sysInfo.GetMaxMemory();
60  cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
61  cout << maxMemory;
62  cout << "</DartMeasurement>" << endl;
63 
64  timer.Stop();
65  Double_t rtime = timer.RealTime();
66  Double_t ctime = timer.CpuTime();
67 
68  Float_t cpuUsage = ctime / rtime;
69  cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
70  cout << cpuUsage;
71  cout << "</DartMeasurement>" << endl;
72 
73  cout << endl << endl;
74  cout << "Output file is " << outFile << endl;
75  cout << "Parameter file is " << parFile << endl;
76  cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
77  cout << "Macro finished successfully." << endl;
78 
79  // ------------------------------------------------------------------------
80  return 0;
81 }
list of container factories
Definition: FairRuntimeDb.h:24
void Init()
Definition: FairRunAna.cxx:127
int runTF()
Definition: runTF.C:8
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()
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
Bool_t setFirstInput(FairParIo *)