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  // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
11  Int_t iVerbose = 0; // just forget about it, for the moment
12 
13  // Input file (MC events)
14  TString inFile = "pixel_";
15  inFile = inFile + mcEngine + ".mc.root";
16 
17  // Parameter file
18  TString parFile = "pixel_";
19  parFile = parFile + mcEngine + ".params.root";
20 
21  // Digitization parameter file
22  TString dir = getenv("VMCWORKDIR");
23  TString tutdir = dir + "/MQ/pixelDetector";
24  TString digParFile = tutdir + "/param/pixel_digi.par";
25 
26  // Output file
27  TString outFile = "pixel_";
28  outFile = outFile + mcEngine + ".reco.root";
29 
30  // ----- Timer --------------------------------------------------------
31  TStopwatch timer;
32 
33  // ----- Reconstruction run -------------------------------------------
34  FairRunAna* fRun = new FairRunAna();
35  FairFileSource* fFileSource = new FairFileSource(inFile);
36  fRun->SetSource(fFileSource);
37  fRun->SetSink(new FairRootFileSink(outFile));
38 
39  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
40  FairParRootFileIo* parInput1 = new FairParRootFileIo();
41  parInput1->open(parFile.Data());
42 
43  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
44  parIo1->open(digParFile.Data(), "in");
45 
46  rtdb->setFirstInput(parInput1);
47  rtdb->setSecondInput(parIo1);
48 
49  // ----- TorinoDetector hit producers ---------------------------------
50  PixelDigitize* digiTask = new PixelDigitize();
51  fRun->AddTask(digiTask);
52 
53  PixelFindHits* hitFinderTask = new PixelFindHits();
54  fRun->AddTask(hitFinderTask);
55 
56  PixelFindTracks* trackFinderTask = new PixelFindTracks();
57  fRun->AddTask(trackFinderTask);
58 
59  PixelFitTracks* trackFitterTask = new PixelFitTracks();
60  fRun->AddTask(trackFitterTask);
61 
62  fRun->Init();
63 
64  timer.Start();
65  fRun->Run();
66 
67  // ----- Finish -------------------------------------------------------
68 
69  cout << endl << endl;
70 
71  // Extract the maximal used memory an add is as Dart measurement
72  // This line is filtered by CTest and the value send to CDash
73  FairSystemInfo sysInfo;
74  Float_t maxMemory = sysInfo.GetMaxMemory();
75  cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
76  cout << maxMemory;
77  cout << "</DartMeasurement>" << endl;
78 
79  timer.Stop();
80  Double_t rtime = timer.RealTime();
81  Double_t ctime = timer.CpuTime();
82 
83  Float_t cpuUsage = ctime / rtime;
84  cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
85  cout << cpuUsage;
86  cout << "</DartMeasurement>" << endl;
87 
88  cout << endl << endl;
89  cout << "Output file is " << outFile << endl;
90  cout << "Parameter file is " << parFile << endl;
91  cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
92  cout << "Macro finished successfully." << endl;
93 
94  // ------------------------------------------------------------------------
95 }
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
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()
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 *)