]>
Commit | Line | Data |
---|---|---|
1 | #ifndef ALIANALYSISDATACONTAINER_H | |
2 | #define ALIANALYSISDATACONTAINER_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | // Author: Andrei Gheata, 31/05/2006 | |
8 | ||
9 | //============================================================================== | |
10 | // AliAnalysysDataContainer - Container of data of arbitrary type deriving | |
11 | // from TObject used for analysis. A container must be connected to the | |
12 | // output data slot of a single analysis task (producer) , but also as | |
13 | // input slot for possibly several other tasks (consumers). The connected | |
14 | // slots must enforce the same data type as the container (or a derived type). | |
15 | // A container becomes the owner of the contained data once this was produced. | |
16 | //============================================================================== | |
17 | ||
18 | #ifndef ROOT_TNamed | |
19 | #include "TNamed.h" | |
20 | #endif | |
21 | ||
22 | class TClass; | |
23 | class TString; | |
24 | class TObjArray; | |
25 | class AliAnalysisTask; | |
26 | class AliESD; | |
27 | ||
28 | class AliAnalysisDataContainer : public TNamed { | |
29 | ||
30 | public: | |
31 | enum ENotifyMessage { | |
32 | kDeleteData, | |
33 | kSaveData, | |
34 | kFileChange | |
35 | }; | |
36 | AliAnalysisDataContainer(); | |
37 | AliAnalysisDataContainer(const char *name, TClass *type); | |
38 | virtual ~AliAnalysisDataContainer(); | |
39 | ||
40 | // Getters | |
41 | TObject *GetData() const {return fData;} | |
42 | TClass *GetType() const {return fType;} | |
43 | AliAnalysisTask *GetProducer() const {return fProducer;} | |
44 | TObjArray *GetConsumers() const {return fConsumers;} | |
45 | virtual void GetEntry(Long64_t ientry); | |
46 | // Setters | |
47 | virtual Bool_t SetData(TObject *data, Option_t *option=""); | |
48 | void SetDataOwned(Bool_t flag) {fOwnedData = flag;} | |
49 | void SetFileName(const char *name); | |
50 | void SetProducer(AliAnalysisTask *prod, Int_t islot); | |
51 | void AddConsumer(AliAnalysisTask *cons, Int_t islot); | |
52 | void DeleteData(); | |
53 | // Container status checking | |
54 | Bool_t IsDataReady() const {return fDataReady;} | |
55 | Bool_t IsOwnedData() const {return fOwnedData;} | |
56 | Bool_t ClientsExecuted() const; | |
57 | Bool_t HasConsumers() const {return (fConsumers != 0);} | |
58 | Bool_t HasProducer() const {return (fProducer != 0);} | |
59 | // Send a notify signal to the container | |
60 | virtual void NotifyChange(ENotifyMessage /*type*/) {;} | |
61 | // Print connected tasks/status | |
62 | void PrintContainer(Option_t *option="all", Int_t indent=0) const; | |
63 | ||
64 | protected: | |
65 | Bool_t fDataReady; // Flag that data is ready | |
66 | Bool_t fOwnedData; // Flag data ownership | |
67 | TString fFileName; // Name of the file that will store the data if requested | |
68 | TObject *fData; // Contained data | |
69 | TClass *fType; // Type of contained data | |
70 | AliAnalysisTask *fProducer; // Analysis task to which the slot belongs | |
71 | TObjArray *fConsumers; // List of consumers of the data | |
72 | ||
73 | ClassDef(AliAnalysisDataContainer,1) // Class describing a data container for analysis | |
74 | }; | |
75 | #endif |