Bug fix in method RefitAt: the cluster with index 0 was rejected (A. Dainese)
[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
c52c2132 22#ifndef ROOT_TString
23#include "TString.h"
24#endif
25
d3106602 26class TClass;
d3106602 27class TObjArray;
c52c2132 28class TCollection;
d3106602 29class AliAnalysisTask;
30class AliESD;
31
32class AliAnalysisDataContainer : public TNamed {
33
34public:
35enum ENotifyMessage {
36 kDeleteData,
37 kSaveData,
38 kFileChange
39};
40 AliAnalysisDataContainer();
37a26056 41 AliAnalysisDataContainer(const AliAnalysisDataContainer &cont);
d3106602 42 AliAnalysisDataContainer(const char *name, TClass *type);
43 virtual ~AliAnalysisDataContainer();
44
37a26056 45 // Assignment
46 AliAnalysisDataContainer &operator=(const AliAnalysisDataContainer &cont);
d3106602 47 // Getters
48 TObject *GetData() const {return fData;}
c52c2132 49 const char *GetFileName() const {return fFileName.Data();}
50 TClass *GetType() const;
d3106602 51 AliAnalysisTask *GetProducer() const {return fProducer;}
52 TObjArray *GetConsumers() const {return fConsumers;}
53 virtual void GetEntry(Long64_t ientry);
54 // Setters
327eaf46 55 void ResetDataReady() {fDataReady = kFALSE;}
d3106602 56 virtual Bool_t SetData(TObject *data, Option_t *option="");
57 void SetDataOwned(Bool_t flag) {fOwnedData = flag;}
c52c2132 58 void SetFileName(const char *filename) {fFileName = filename;}
d3106602 59 void SetProducer(AliAnalysisTask *prod, Int_t islot);
60 void AddConsumer(AliAnalysisTask *cons, Int_t islot);
61 void DeleteData();
62 // Container status checking
63 Bool_t IsDataReady() const {return fDataReady;}
64 Bool_t IsOwnedData() const {return fOwnedData;}
65 Bool_t ClientsExecuted() const;
66 Bool_t HasConsumers() const {return (fConsumers != 0);}
67 Bool_t HasProducer() const {return (fProducer != 0);}
c52c2132 68 // Container merging
69 virtual Long64_t Merge(TCollection *list);
d3106602 70 // Send a notify signal to the container
71 virtual void NotifyChange(ENotifyMessage /*type*/) {;}
72 // Print connected tasks/status
73 void PrintContainer(Option_t *option="all", Int_t indent=0) const;
c52c2132 74
75private:
76 void SetType(TClass *type) {fType = type;}
77
d3106602 78protected:
79 Bool_t fDataReady; // Flag that data is ready
80 Bool_t fOwnedData; // Flag data ownership
c52c2132 81 TString fFileName; // File storing the data
d3106602 82 TObject *fData; // Contained data
c52c2132 83 TClass *fType; //! Type of contained data
d3106602 84 AliAnalysisTask *fProducer; // Analysis task to which the slot belongs
85 TObjArray *fConsumers; // List of consumers of the data
86
87 ClassDef(AliAnalysisDataContainer,1) // Class describing a data container for analysis
88};
89#endif