Interface for setting up custom monitoring lib policy (Requested by Jens).
[u/mrichter/AliRoot.git] / STEER / 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 "AliTaskLoader.h"
33 #include "AliDataLoader.h"
34 #include "AliLog.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 void AliTaskLoader::Clean()
51 {
52   //
53   // Removes tasl from parental task
54   // DO NOT DELETE OBJECT contrary to BaseLoader
55   //
56   AliDebug(1, Form("Clean %s %s",GetName(),GetDataLoader()->GetName()));
57   TObject* obj = Get();
58   if(obj)
59     { 
60       AliDebug(1, Form("cleaning %s.",GetName()));
61       RemoveFromBoard(obj);
62     }
63 }
64
65
66 //______________________________________________________________________________
67 void AliTaskLoader::RemoveFromBoard(TObject* obj)
68 {
69   //
70   // Removes the task "obj" from the board
71   //
72   GetParentalTask()->GetListOfTasks()->Remove(obj);
73 }
74
75 //______________________________________________________________________________
76 Int_t AliTaskLoader::AddToBoard(TObject* obj)
77 {
78   //
79   // Adds task "obj" to the board
80   //
81   TTask* task = dynamic_cast<TTask*>(obj);
82   if (task == 0x0)
83     {
84       AliError("To TTask board can be added only tasks.");
85       return 1;
86     }
87   GetParentalTask()->Add(task);
88   return 0;
89 }
90
91 //______________________________________________________________________________
92 TObject* AliTaskLoader::Get() const
93 {
94   //
95   // Returns pointer to the current task
96   //
97   return (GetParentalTask()) ? GetParentalTask()->GetListOfTasks()->FindObject(GetName()) : 0x0;
98 }
99
100 //______________________________________________________________________________
101 TTask* AliTaskLoader::GetParentalTask() const
102 {
103   //
104   // Returns parental tasks for this task
105   //
106   return fParentalTask;
107 }
108
109
110