Corrected sintax of the commands in ProcessLine (Yves)
[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;
981f2614 30class AliAnalysisDataWrapper;
d3106602 31class AliESD;
32
33class AliAnalysisDataContainer : public TNamed {
34
35public:
36enum ENotifyMessage {
37 kDeleteData,
38 kSaveData,
39 kFileChange
40};
c5a87c56 41enum EAnalysisContainerFlags {
b1310ef5 42 kPostEventLoop = BIT(14)
c5a87c56 43};
d3106602 44 AliAnalysisDataContainer();
37a26056 45 AliAnalysisDataContainer(const AliAnalysisDataContainer &cont);
d3106602 46 AliAnalysisDataContainer(const char *name, TClass *type);
47 virtual ~AliAnalysisDataContainer();
48
37a26056 49 // Assignment
50 AliAnalysisDataContainer &operator=(const AliAnalysisDataContainer &cont);
d3106602 51 // Getters
52 TObject *GetData() const {return fData;}
c52c2132 53 const char *GetFileName() const {return fFileName.Data();}
54 TClass *GetType() const;
d3106602 55 AliAnalysisTask *GetProducer() const {return fProducer;}
56 TObjArray *GetConsumers() const {return fConsumers;}
57 virtual void GetEntry(Long64_t ientry);
58 // Setters
327eaf46 59 void ResetDataReady() {fDataReady = kFALSE;}
d3106602 60 virtual Bool_t SetData(TObject *data, Option_t *option="");
61 void SetDataOwned(Bool_t flag) {fOwnedData = flag;}
b1310ef5 62 void SetPostEventLoop(Bool_t flag=kTRUE) {TObject::SetBit(kPostEventLoop,flag);}
c52c2132 63 void SetFileName(const char *filename) {fFileName = filename;}
d3106602 64 void SetProducer(AliAnalysisTask *prod, Int_t islot);
65 void AddConsumer(AliAnalysisTask *cons, Int_t islot);
66 void DeleteData();
981f2614 67 // Wrapping
68 AliAnalysisDataWrapper *ExportData() const;
69 void ImportData(AliAnalysisDataWrapper *pack);
d3106602 70 // Container status checking
71 Bool_t IsDataReady() const {return fDataReady;}
b1310ef5 72 Bool_t IsPostEventLoop() const {return TObject::TestBit(kPostEventLoop);}
d3106602 73 Bool_t IsOwnedData() const {return fOwnedData;}
74 Bool_t ClientsExecuted() const;
75 Bool_t HasConsumers() const {return (fConsumers != 0);}
76 Bool_t HasProducer() const {return (fProducer != 0);}
c52c2132 77 // Container merging
78 virtual Long64_t Merge(TCollection *list);
d3106602 79 // Send a notify signal to the container
80 virtual void NotifyChange(ENotifyMessage /*type*/) {;}
81 // Print connected tasks/status
82 void PrintContainer(Option_t *option="all", Int_t indent=0) const;
c52c2132 83
84private:
85 void SetType(TClass *type) {fType = type;}
86
d3106602 87protected:
88 Bool_t fDataReady; // Flag that data is ready
89 Bool_t fOwnedData; // Flag data ownership
c52c2132 90 TString fFileName; // File storing the data
d3106602 91 TObject *fData; // Contained data
c52c2132 92 TClass *fType; //! Type of contained data
d3106602 93 AliAnalysisTask *fProducer; // Analysis task to which the slot belongs
94 TObjArray *fConsumers; // List of consumers of the data
95
96 ClassDef(AliAnalysisDataContainer,1) // Class describing a data container for analysis
97};
981f2614 98
99//==============================================================================
100// AliAnalysysDataWrapper - A basic wrapper for exchanging via the network
101// the data held by AliAnalysisDataContainer between the master and the client
102// in PROOF case.
103//==============================================================================
104
105class AliAnalysisDataWrapper : public TNamed {
106
107public:
108 AliAnalysisDataWrapper() : TNamed(), fData(NULL) {}
109 AliAnalysisDataWrapper(TObject *data) : TNamed(), fData(data) {}
110 AliAnalysisDataWrapper(const AliAnalysisDataWrapper &other)
111 : TNamed(other), fData(other.fData) {}
112 virtual ~AliAnalysisDataWrapper() {}
113
114 // Assignment
115 AliAnalysisDataWrapper &operator=(const AliAnalysisDataWrapper &other);
116
117 TObject *Data() const {return fData;}
118 // Merging
119 virtual Long64_t Merge(TCollection *list);
120
121protected:
122 TObject *fData; // Wrapped data
123
124 ClassDef(AliAnalysisDataWrapper, 1) // Data wrapper class for exchange via the net
125};
126
d3106602 127#endif