FairRoot/PandaRoot
PndMasterTask.cxx
Go to the documentation of this file.
1 #include "PndMasterTask.h"
2 #include "TGeoManager.h"
3 #include "TROOT.h"
4 #include <iostream>
5 
6 // ----- Default constructor -------------------------------------------
8  PndBlackBoxTask("Master Task")
9 {
10 }
11 
12 // ----- Cconstructor ------- -------------------------------------------
14  PndBlackBoxTask(name)
15 {
16 }
17 // -------------------------------------------------------------------------
18 
25 {
26  TList* thistasks = this->GetListOfTasks();
27 
28  Int_t counter = 0;
29  TIter next(thistasks->MakeIterator());
30  while (FairTask *task = (FairTask*)next())
31  {
32  if (counter < 10)
33  std::cout << "Task #" << counter << "\tTitle: " << task->GetTitle() << "\tName: " << task->GetName() << std::endl;
34  else
35  std::cout << "Task #" << counter << "\tTitle: " << task->GetTitle() << "\tName: " << task->GetName() << std::endl;
36  counter++;
37  }
38 
39  return;
40 }
41 
44 {
45  TList* thistasks = this->GetListOfTasks();
46 
47  TIter next(thistasks->MakeIterator());
48  while (FairTask *task = (FairTask*)next())
49  {
50  task->SetVerbose(iVerbose);
51  }
52 
53  return;
54 }
55 
57 void PndMasterTask::SetVerbose(Int_t nTask, Int_t iVerbose)
58 {
59  TList* thistasks = this->GetListOfTasks();
60  ((FairTask*)thistasks->At(nTask))->SetVerbose(iVerbose);
61 
62  return;
63 }
64 
67 {
68  std::for_each(fBranchTasks.begin(), fBranchTasks.end(), [pers](PndPersistencyTask* task){task->SetPersistency(pers);});
69  std::for_each(fFixedPersistency.begin(), fFixedPersistency.end(), [](std::pair<PndPersistencyTask*, bool> task){task.first->SetPersistency(task.second);});
70 
71  return;
72 }
73 
75 FairTask* PndMasterTask::GetTask(Int_t nTask)
76 {
77  TList* thistasks = this->GetListOfTasks();
78 
79  return ((FairTask*)thistasks->At(nTask));
80 }
81 
82 // ----- Destructor ----------------------------------------------------
84 {
85  if (gROOT->GetVersionInt() >= 60602 && gGeoManager!=NULL) {
86  gGeoManager->GetListOfVolumes()->Delete();
87  gGeoManager->GetListOfShapes()->Delete();
88  delete gGeoManager;
89  }
90 }
91 // -------------------------------------------------------------------------
92 
void PrintTaskList()
It prints the list of tasks.
void SetVerbose(Int_t iVerbose=1)
Set the Verbosity to all the tasks.
FairTask * GetTask(Int_t nTask)
Return the pointer to a single task.
TGeoManager * gGeoManager
Abstract class for all the master task list classes.
Definition: PndMasterTask.h:21
std::vector< PndPersistencyTask * > fBranchTasks
Definition: PndMasterTask.h:80
int counter
Definition: ZeeAnalysis.C:59
TString name
virtual void SetPersistency(Bool_t pers=kTRUE)
Set the persistency of all the tasks This function has to be implemented for each master task...
std::map< PndPersistencyTask *, bool > fFixedPersistency
Definition: PndMasterTask.h:82
virtual ~PndMasterTask()
Destructor.
ClassImp(PndAnaContFact)
Int_t iVerbose
PndMasterTask()
Default constructor.
static int next[96]
Definition: ranlxd.cxx:374