FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
run_reco.C
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 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 void run_reco(TString mcEngine = "TGeant3")
9 {
10 
12  logger->SetLogFileName("MyLog.log");
13  logger->SetLogToScreen(kTRUE);
14  // logger->SetLogToFile(kTRUE);
15  logger->SetLogVerbosityLevel("LOW");
16  // logger->SetLogFileLevel("DEBUG4");
17  logger->SetLogScreenLevel("INFO");
18 
19  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
20  Int_t iVerbose = 0; // just forget about it, for the moment
21 
22  // Input file (MC events)
23  TString inFile = "data/testdigi_";
24  inFile = inFile + mcEngine + ".root";
25 
26  // Parameter file
27  TString parFile = "data/testparams_";
28  parFile = parFile + mcEngine + ".root";
29 
30  // Output file
31  TString outFile = "data/testreco_";
32  outFile = outFile + mcEngine + ".root";
33 
34  // ----- Timer --------------------------------------------------------
35  TStopwatch timer;
36 
37  // ----- Reconstruction run -------------------------------------------
38  FairRunAna* fRun = new FairRunAna();
39  FairFileSource* fFileSource = new FairFileSource(inFile);
40  fRun->SetSource(fFileSource);
41  fRun->SetSink(new FairRootFileSink(outFile));
42  fRun->SetUseFairLinks(kTRUE);
44  // FairLinkManager::Instance()->AddIncludeType(1);
45  fRun->SetGenerateRunInfo(kTRUE); // Create FairRunInfo file
46 
47  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
48  FairParRootFileIo* parInput1 = new FairParRootFileIo();
49  parInput1->open(parFile.Data());
50  rtdb->setFirstInput(parInput1);
51 
52  // ----- TorinoDetector hit producers ---------------------------------
54  fRun->AddTask(hitProducer);
55 
56  fRun->Init();
57 
58  timer.Start();
59  fRun->Run();
60 
61  // ----- Finish -------------------------------------------------------
62 
63  cout << endl << endl;
64 
65  // Extract the maximal used memory an add is as Dart measurement
66  // This line is filtered by CTest and the value send to CDash
67  FairSystemInfo sysInfo;
68  Float_t maxMemory = sysInfo.GetMaxMemory();
69  cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
70  cout << maxMemory;
71  cout << "</DartMeasurement>" << endl;
72 
73  timer.Stop();
74  Double_t rtime = timer.RealTime();
75  Double_t ctime = timer.CpuTime();
76 
77  Float_t cpuUsage = ctime / rtime;
78  cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
79  cout << cpuUsage;
80  cout << "</DartMeasurement>" << endl;
81 
82  cout << endl << endl;
83  cout << "Output file is " << outFile << endl;
84  cout << "Parameter file is " << parFile << endl;
85  cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
86  cout << "Macro finished successfully." << endl;
87 
88  // ------------------------------------------------------------------------
89 }
list of container factories
Definition: FairRuntimeDb.h:24
void Init()
Definition: FairRunAna.cxx:127
void run_reco(TString mcEngine="TGeant3")
Definition: run_reco.C:8
void SetLogScreenLevel(const char *severity)
Definition: FairLogger.h:58
virtual void AddIncludeType(Int_t type)
void SetGenerateRunInfo(Bool_t write)
Definition: FairRun.h:131
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()
void SetUseFairLinks(Bool_t val)
Definition: FairRun.cxx:120
void SetLogFileName(const std::string &name)
Definition: FairLogger.h:79
static FairLinkManager * Instance()
void SetLogToScreen(bool enabled)
Definition: FairLogger.h:49
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 *)