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 */
7 // Author: Andrei Gheata, 31/05/2006
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 //==============================================================================
25 class AliAnalysisTask;
28 class AliAnalysisDataContainer : public TNamed {
36 AliAnalysisDataContainer();
37 AliAnalysisDataContainer(const char *name, TClass *type);
38 virtual ~AliAnalysisDataContainer();
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);
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);
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;
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
73 ClassDef(AliAnalysisDataContainer,1) // Class describing a data container for analysis