]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliTaskLoader.cxx
New class for debugging of the memory consumption and other run time parameters ...
[u/mrichter/AliRoot.git] / STEER / AliTaskLoader.cxx
1
2 /////////////////////////////////////////////////////////////////////////////////////////////
3 //                                                                                         //
4 //  class AliTaskLoader                                                                    //
5 //                                                                                         //
6 //  Container of all data needed for full                                                  //
7 //  description of each data type                                                          //
8 //  (Hits, Kine, ...)                                                                      //
9 //                                                                                         //
10 //  Each data loader has a basic standard setup of BaseLoaders                             //
11 //  which can be identuified by indexes (defined by EStdBasicLoaders)                      //
12 //  Data managed by these standard base loaders has fixed naming convention                //
13 //  e.g. - tree with hits is always named TreeH                                            //
14 //                     (defined in AliLoader::fgkDefaultHitsContainerName)                 //
15 //       - task DtectorName+Name defined                                                   //
16 //                                                                                         //
17 //  EStdBasicLoaders   idx     Object Type        Description                              //
18 //      kData           0    TTree or TObject     main data itself (hits,digits,...)       //
19 //      kTask           1        TTask            object producing main data               //
20 //      kQA             2        TTree                quality assurance tree               //
21 //      kQATask         3        TTask            task producing QA object                 //
22 //                                                                                         //
23 //                                                                                         //
24 //  User can define and add more basic loaders even Run Time.                              //
25 //  Caution: in order to save information about added base loader                          //
26 //  user must rewrite Run Loader to galice.file, overwriting old setup                     //
27 //                                                                                         //
28 /////////////////////////////////////////////////////////////////////////////////////////////
29
30 /* $Id$ */
31
32 #include "AliLog.h"
33 #include "AliRunLoader.h"
34 #include "AliTaskLoader.h"
35
36 ClassImp(AliTaskLoader)
37
38 //______________________________________________________________________________
39 AliTaskLoader::AliTaskLoader(const TString& name, AliDataLoader* dl, 
40                              TTask* parentaltask, Bool_t storeontop):
41  AliBaseLoader(name,dl,storeontop),
42  fParentalTask(parentaltask)
43 {
44   //
45   // Constructor
46   //
47 }
48
49 //______________________________________________________________________________
50 AliTaskLoader::AliTaskLoader(const AliTaskLoader& source):
51   AliBaseLoader(source),
52   fParentalTask(source.fParentalTask)
53 {
54   //
55   // copy constructor
56   //
57   AliFatal("Copy constructor not implemented");
58 }
59
60 //______________________________________________________________________________
61 AliTaskLoader& AliTaskLoader::operator=(const AliTaskLoader& /*source*/) 
62 {
63   //
64   // Assignment operator
65   //
66   AliFatal("Assignment operator not implemented");
67   return *this;
68 }
69
70 //______________________________________________________________________________
71 void AliTaskLoader::Clean()
72 {
73   //
74   // Removes tasl from parental task
75   // DO NOT DELETE OBJECT contrary to BaseLoader
76   //
77   AliDebug(1, Form("Clean","%s %s",GetName(),GetDataLoader()->GetName()));
78   TObject* obj = Get();
79   if(obj)
80     { 
81       AliDebug(1, Form("cleaning %s.",GetName()));
82       RemoveFromBoard(obj);
83     }
84 }
85
86
87 //______________________________________________________________________________
88 void AliTaskLoader::RemoveFromBoard(TObject* obj)
89 {
90   //
91   // Removes the task "obj" from the board
92   //
93   GetParentalTask()->GetListOfTasks()->Remove(obj);
94 }
95
96 //______________________________________________________________________________
97 Int_t AliTaskLoader::AddToBoard(TObject* obj)
98 {
99   //
100   // Adds task "obj" to the board
101   //
102   TTask* task = dynamic_cast<TTask*>(obj);
103   if (task == 0x0)
104     {
105       AliError("To TTask board can be added only tasks.");
106       return 1;
107     }
108   GetParentalTask()->Add(task);
109   return 0;
110 }
111
112 //______________________________________________________________________________
113 TObject* AliTaskLoader::Get() const
114 {
115   //
116   // Returns pointer to the current task
117   //
118   return (GetParentalTask()) ? GetParentalTask()->GetListOfTasks()->FindObject(GetName()) : 0x0;
119 }
120
121 //______________________________________________________________________________
122 TTask* AliTaskLoader::GetParentalTask() const
123 {
124   //
125   // Returns parental tasks for this task
126   //
127   return fParentalTask;
128 }
129
130
131