FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
runHP.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 runHP()
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.mc.root";
23 
24  // Parameter file
25  TString parFile = "prop.par.root";
26 
27  // Output file
28  TString outFile = "prop.hits.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(hpTask);
46 
48  hpTask2->SetPointsArrayName("FairTutPropPoint2");
49  hpTask2->SetHitsArrayName("FairTutPropHits2");
50  fRun->AddTask(hpTask2);
51 
52  fRun->Init();
53 
54  timer.Start();
55  fRun->Run();
56 
57  // ----- Finish -------------------------------------------------------
58 
59  cout << endl << endl;
60 
61  // Extract the maximal used memory an add is as Dart measurement
62  // This line is filtered by CTest and the value send to CDash
63  FairSystemInfo sysInfo;
64  Float_t maxMemory = sysInfo.GetMaxMemory();
65  cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
66  cout << maxMemory;
67  cout << "</DartMeasurement>" << endl;
68 
69  timer.Stop();
70  Double_t rtime = timer.RealTime();
71  Double_t ctime = timer.CpuTime();
72 
73  Float_t cpuUsage = ctime / rtime;
74  cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
75  cout << cpuUsage;
76  cout << "</DartMeasurement>" << endl;
77 
78  cout << endl << endl;
79  cout << "Output file is " << outFile << endl;
80  cout << "Parameter file is " << parFile << endl;
81  cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
82  cout << "Macro finished successfully." << endl;
83 
84  // ------------------------------------------------------------------------
85  return 0;
86 }
list of container factories
Definition: FairRuntimeDb.h:24
void Init()
Definition: FairRunAna.cxx:127
void SetHitsArrayName(const std::string &tempName)
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
void SetPointsArrayName(const std::string &tempName)
Bool_t setFirstInput(FairParIo *)
int runHP()
Definition: runHP.C:8