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", Bool_t AlignDone = true)
9 {
10  // ---- Load libraries -------------------------------------------------
12  // logger->SetLogFileName("MyLog.log");
13  logger->SetLogToScreen(kTRUE);
14  // logger->SetLogToFile(kTRUE);
15  // logger->SetLogVerbosityLevel("HIGH");
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  TString Align = "";
23  if (AlignDone) {
24  Align = "align_";
25  }
26  TString InDir = "./data/";
27  // Input file (MC Events)
28  TString inFile = "testrun_";
29  inFile = InDir + inFile + Align + mcEngine + ".root";
30 
31  // Output file name
32  TString outFile = "testreco_";
33  outFile = InDir + outFile + Align + mcEngine + ".root";
34 
35  // Parameter file
36  TString parFile = "testparams_";
37  parFile = InDir + parFile + Align + mcEngine + ".root";
38 
39  // Millepede file name
40  TString milleFile = "testmille_";
41  milleFile = InDir + milleFile + Align + mcEngine;
42 
43  TList* parFileList = new TList();
44 
45  TString workDir = gSystem->Getenv("VMCWORKDIR");
46  TString paramDir = workDir + "/simulation/Tutorial4/parameters/";
47  TString paramFile = paramDir + "example.par";
48 
49  TObjString tutDetDigiFile;
50  tutDetDigiFile.SetString(paramFile);
51  parFileList->Add(&tutDetDigiFile);
52 
53  // ----- Timer --------------------------------------------------------
54  TStopwatch timer;
55 
56  // ----- Reconstruction run -------------------------------------------
57  FairRunAna* fRun = new FairRunAna();
58  FairFileSource* fFileSource = new FairFileSource(inFile);
59  fRun->SetSource(fFileSource);
60  fRun->SetSink(new FairRootFileSink(outFile));
61 
62  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
63  FairParRootFileIo* parInput1 = new FairParRootFileIo();
64  FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
65  parIo2->open(parFileList, "in");
66  parInput1->open(parFile.Data());
67  parIo2->open(parFileList, "in");
68  rtdb->setFirstInput(parInput1);
69  rtdb->setSecondInput(parIo2);
70  rtdb->setOutput(parInput1);
71  rtdb->saveOutput();
72 
73  // ----- TorinoDetector hit producers ---------------------------------
75  hitProducer->DoMisalignment(kFALSE);
76  fRun->AddTask(hitProducer);
77 
79  fitter->SetVersion(2);
80  fRun->AddTask(fitter);
81 
83  // writer->SetWriteAscii(kTRUE);
84  writer->SetVersion(2);
85  writer->SetFileName(milleFile);
86  fRun->AddTask(writer);
87 
88  fRun->Init();
89 
90  timer.Start();
91  fRun->Run();
92 
93  // ----- Finish -------------------------------------------------------
94 
95  cout << endl << endl;
96 
97  // Extract the maximal used memory an add is as Dart measurement
98  // This line is filtered by CTest and the value send to CDash
99  FairSystemInfo sysInfo;
100  Float_t maxMemory = sysInfo.GetMaxMemory();
101  cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
102  cout << maxMemory;
103  cout << "</DartMeasurement>" << endl;
104 
105  timer.Stop();
106  Double_t rtime = timer.RealTime();
107  Double_t ctime = timer.CpuTime();
108 
109  Float_t cpuUsage = ctime / rtime;
110  cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
111  cout << cpuUsage;
112  cout << "</DartMeasurement>" << endl;
113 
114  cout << endl << endl;
115  cout << "Output file is " << outFile << endl;
116  cout << "Parameter file is " << parFile << endl;
117  cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
118  cout << "Macro finished successfully." << endl;
119  // ------------------------------------------------------------------------
120 }
list of container factories
Definition: FairRuntimeDb.h:24
Bool_t open(const Text_t *fname, const Text_t *status="in")
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
Bool_t setSecondInput(FairParIo *)
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 SetLogToScreen(bool enabled)
Definition: FairLogger.h:49
static FairLogger * GetLogger()
Definition: FairLogger.cxx:39
FairRuntimeDb * GetRuntimeDb(void)
Definition: FairRun.h:80
Bool_t setOutput(FairParIo *)
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
Bool_t setFirstInput(FairParIo *)
void saveOutput(void)