er  dev
ERTask.cxx
1 /********************************************************************************
2  * Copyright (C) Joint Institute for Nuclear Research *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence version 3 (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #include "ERTask.h"
10 
11 #include "FairLogger.h"
12 #include "FairRuntimeDb.h"
13 
14 // ----------------------------------------------------------------------------
15 ERTask::ERTask(TString name)
16  : FairTask(name),
17  fRun(NULL)
18 {
19 }
20 // ----------------------------------------------------------------------------
21 
22 // ----------------------------------------------------------------------------
23 ERTask::ERTask(TString name, Int_t verbose)
24  : FairTask(name, verbose),
25  fRun(NULL)
26 {
27 }
28 // ----------------------------------------------------------------------------
29 
30 // ----------------------------------------------------------------------------
31 InitStatus ERTask::Init()
32 {
33  fRun = FairRun::Instance();
34 
35  if (CheckRunManager() != kSUCCESS)
36  return kFATAL;
37 
38  return kSUCCESS;
39 }
40 // ----------------------------------------------------------------------------
41 
42 // ----------------------------------------------------------------------------
44 {
45  if (fAvailibleRunManagers.size() == 0){
46  LOG(WARNING) << "Availible run manager not defined for task " << this->ClassName() << FairLogger::endl;
47  LOG(WARNING) << "No check will be performed" << FairLogger::endl;
48  return kSUCCESS;
49  }
50 
51  for (auto availibleRun : fAvailibleRunManagers){
52  if (fRun->ClassName() == availibleRun)
53  return kSUCCESS;
54  }
55 
56  return kFATAL;
57 }
58 // ----------------------------------------------------------------------------
59 
60 // ----------------------------------------------------------------------------
62 {
63  fRun = FairRun::Instance();
64  if (!fRun)
65  LOG(FATAL) << "No run manager!" << FairLogger::endl;
66  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
67  if (!rtdb)
68  LOG(FATAL) << "No runtime database!" << FairLogger::endl;
69 }
70 // ----------------------------------------------------------------------------
71 
72 // ----------------------------------------------------------------------------
74 {
75 
76 }
77 // ----------------------------------------------------------------------------
78 
79 // ----------------------------------------------------------------------------
81 {
82 
83 }
84 // ----------------------------------------------------------------------------
85 
86 // ----------------------------------------------------------------------------
88 {
89 }
90 // ----------------------------------------------------------------------------
91 ClassImp(ERTask)
InitStatus CheckRunManager()
Check is instance of run manager availible for this task.
Definition: ERTask.cxx:43
virtual InitStatus Init()
Definition: ERTask.cxx:31
virtual void Reset()
Definition: ERTask.cxx:80
virtual void Finish()
Definition: ERTask.cxx:73
virtual void SetParContainers()
Initializes runtime database for getting parameters from .par file.
Definition: ERTask.cxx:61
~ERTask()
Definition: ERTask.cxx:87
FairRun * fRun
Pointer to run manager object.
Definition: ERTask.h:63
std::vector< TString > fAvailibleRunManagers
Run managers that are availible for this task.
Definition: ERTask.h:64
Base abstract class for all tasks in er.
Definition: ERTask.h:27
ERTask(TString name)
Definition: ERTask.cxx:15