fixed compiler problem
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisDataContainer.h
CommitLineData
d3106602 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
22class TClass;
327eaf46 23class TFile;
d3106602 24class TObjArray;
25class AliAnalysisTask;
26class AliESD;
27
28class AliAnalysisDataContainer : public TNamed {
29
30public:
31enum ENotifyMessage {
32 kDeleteData,
33 kSaveData,
34 kFileChange
35};
36 AliAnalysisDataContainer();
37a26056 37 AliAnalysisDataContainer(const AliAnalysisDataContainer &cont);
d3106602 38 AliAnalysisDataContainer(const char *name, TClass *type);
39 virtual ~AliAnalysisDataContainer();
40
37a26056 41 // Assignment
42 AliAnalysisDataContainer &operator=(const AliAnalysisDataContainer &cont);
d3106602 43 // Getters
44 TObject *GetData() const {return fData;}
45 TClass *GetType() const {return fType;}
46 AliAnalysisTask *GetProducer() const {return fProducer;}
47 TObjArray *GetConsumers() const {return fConsumers;}
48 virtual void GetEntry(Long64_t ientry);
49 // Setters
327eaf46 50 void ResetDataReady() {fDataReady = kFALSE;}
d3106602 51 virtual Bool_t SetData(TObject *data, Option_t *option="");
52 void SetDataOwned(Bool_t flag) {fOwnedData = flag;}
327eaf46 53 void OpenFile(const char *name, Option_t *option="RECREATE");
d3106602 54 void SetProducer(AliAnalysisTask *prod, Int_t islot);
55 void AddConsumer(AliAnalysisTask *cons, Int_t islot);
56 void DeleteData();
57 // Container status checking
58 Bool_t IsDataReady() const {return fDataReady;}
59 Bool_t IsOwnedData() const {return fOwnedData;}
60 Bool_t ClientsExecuted() const;
61 Bool_t HasConsumers() const {return (fConsumers != 0);}
62 Bool_t HasProducer() const {return (fProducer != 0);}
63 // Send a notify signal to the container
64 virtual void NotifyChange(ENotifyMessage /*type*/) {;}
65 // Print connected tasks/status
66 void PrintContainer(Option_t *option="all", Int_t indent=0) const;
327eaf46 67 void WriteData();
d3106602 68
69protected:
70 Bool_t fDataReady; // Flag that data is ready
71 Bool_t fOwnedData; // Flag data ownership
327eaf46 72 TFile *fFile; // File storing the data
d3106602 73 TObject *fData; // Contained data
74 TClass *fType; // Type of contained data
75 AliAnalysisTask *fProducer; // Analysis task to which the slot belongs
76 TObjArray *fConsumers; // List of consumers of the data
77
78 ClassDef(AliAnalysisDataContainer,1) // Class describing a data container for analysis
79};
80#endif