FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
run_hits_sep.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_hits_sep(Int_t ifile, 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 = Form("pixel_f%d_", ifile);
15  inFile = inFile + mcEngine + ".digi.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 = Form("pixel_f%d_", ifile);
28  outFile = outFile + mcEngine + ".hits.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 
38  fRun->SetSink(new FairRootFileSink(outFile));
39 
40  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
41  FairParRootFileIo* parInput1 = new FairParRootFileIo();
42  parInput1->open(parFile.Data());
43 
44  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
45  parIo1->open(digParFile.Data(), "in");
46 
47  rtdb->setFirstInput(parInput1);
48  rtdb->setSecondInput(parIo1);
49 
50  // ----- TorinoDetector hit producers ---------------------------------
51  PixelFindHits* hitFinderTask = new PixelFindHits();
52  fRun->AddTask(hitFinderTask);
53 
54  fRun->Init();
55 
56  timer.Start();
57  fRun->Run();
58 
59  // ----- Finish -------------------------------------------------------
60 
61  cout << endl << endl;
62 
63  // Extract the maximal used memory an add is as Dart measurement
64  // This line is filtered by CTest and the value send to CDash
65  FairSystemInfo sysInfo;
66  Float_t maxMemory = sysInfo.GetMaxMemory();
67  cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
68  cout << maxMemory;
69  cout << "</DartMeasurement>" << endl;
70 
71  timer.Stop();
72  Double_t rtime = timer.RealTime();
73  Double_t ctime = timer.CpuTime();
74 
75  Float_t cpuUsage = ctime / rtime;
76  cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
77  cout << cpuUsage;
78  cout << "</DartMeasurement>" << endl;
79 
80  cout << endl << endl;
81  cout << "Output file is " << outFile << endl;
82  cout << "Parameter file is " << parFile << endl;
83  cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
84  cout << "Macro finished successfully." << endl;
85 
86  cout << "DATE MARKER" << flush;
87  gSystem->Exec("date");
88 
89  // ------------------------------------------------------------------------
90 }
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
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 run_hits_sep(Int_t ifile, TString mcEngine="TGeant3")
Definition: run_hits_sep.C:8
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 *)