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