FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
run_dBinSource.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_dBinSource(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  // Parameter file
14  TString parFile = "pixel_";
15  parFile = parFile + mcEngine + ".params.root";
16 
17  // Digitization parameter file
18  TString dir = getenv("VMCWORKDIR");
19  TString tutdir = dir + "/MQ/pixelDetector";
20  TString digParFile = tutdir + "/param/pixel_digi.par";
21 
22  // Output file
23  TString outFile = "pixel_";
24  outFile = outFile + mcEngine + ".viaBinSource.hits.root";
25 
26  // ----- Timer --------------------------------------------------------
27  TStopwatch timer;
28 
29  PixelEventHeader* pixelEventHeader = new PixelEventHeader();
30 
31  // ----- Reconstruction run -------------------------------------------
32  FairRunAna* fRun = new FairRunAna();
33  fRun->SetEventHeader(pixelEventHeader);
34  fRun->SetSink(new FairRootFileSink(outFile));
35 
36  PixelDigiBinSource* digiSource = new PixelDigiBinSource("Pixel Digi Source");
37  digiSource->SetInputFileName("digisBin.dat");
38 
39  fRun->SetSource(digiSource);
40 
41  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
42  FairParRootFileIo* parInput1 = new FairParRootFileIo();
43  parInput1->open(parFile.Data());
44 
45  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
46  parIo1->open(digParFile.Data(), "in");
47 
48  rtdb->setFirstInput(parInput1);
49  rtdb->setSecondInput(parIo1);
50 
51  // ----- TorinoDetector hit producers ---------------------------------
52  // PixelDigiReadFromFile* digiRead = new PixelDigiReadFromFile();
53  // fRun->AddTask(digiRead);
54 
55  PixelFindHits* hitFinderTask = new PixelFindHits();
56  fRun->AddTask(hitFinderTask);
57 
58  fRun->Init();
59 
60  timer.Start();
61  fRun->Run();
62 
63  // ----- Finish -------------------------------------------------------
64 
65  cout << endl << endl;
66 
67  // Extract the maximal used memory an add is as Dart measurement
68  // This line is filtered by CTest and the value send to CDash
69  FairSystemInfo sysInfo;
70  Float_t maxMemory = sysInfo.GetMaxMemory();
71  cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
72  cout << maxMemory;
73  cout << "</DartMeasurement>" << endl;
74 
75  timer.Stop();
76  Double_t rtime = timer.RealTime();
77  Double_t ctime = timer.CpuTime();
78 
79  Float_t cpuUsage = ctime / rtime;
80  cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
81  cout << cpuUsage;
82  cout << "</DartMeasurement>" << endl;
83 
84  cout << endl << endl;
85  cout << "Output file is " << outFile << endl;
86  cout << "Parameter file is " << parFile << endl;
87  cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
88  cout << "Macro finished successfully." << endl;
89 
90  // ------------------------------------------------------------------------
91 }
void SetInputFileName(const TString &tstr)
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 SetEventHeader(FairEventHeader *EvHeader)
Definition: FairRun.h:76
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)
void run_dBinSource(TString mcEngine="TGeant3")
Definition: run_dBinSource.C:8
virtual void SetSource(FairSource *tempSource)
Definition: FairRunAna.h:70
Bool_t setFirstInput(FairParIo *)