AliRoot Core  3dc7879 (3dc7879)
AliAnalysisDataContainer.h
Go to the documentation of this file.
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 
16 
17 #ifndef ROOT_TNamed
18 #include "TNamed.h"
19 #endif
20 
21 #ifndef ROOT_TString
22 #include "TString.h"
23 #endif
24 
25 #ifndef ROOT_TStopwatch
26 #include "TStopwatch.h"
27 #endif
28 
29 class TClass;
30 class TFile;
31 class TObjArray;
32 class TCollection;
33 class AliAnalysisTask;
35 class TBuffer;
36 
37 using std::ostream;
38 
39 class AliAnalysisDataContainer : public TNamed {
40 
41 public:
46 };
48  kPostEventLoop = BIT(14),
49  kSpecialOutput = BIT(15),
50  kRegisterDataset = BIT(16),
51  kExchangeData = BIT(17),
52  kTouchedFlag = BIT(18)
53 };
56  AliAnalysisDataContainer(const char *name, TClass *type);
57  virtual ~AliAnalysisDataContainer();
58 
62  TObject *GetData() const {return fData;}
63  const char *GetFileName() const {return fFileName.Data();}
64  const char *GetFolderName() const {return fFolderName.Data();}
65  TFile *GetFile() const {return fFile;}
66  TClass *GetType() const;
68  TObjArray *GetConsumers() const {return fConsumers;}
69  virtual void GetEntry(Long64_t ientry);
71  void Reset() {fData = 0; fDataReady = kFALSE; SetTouched(kFALSE);}
72  void ResetDataReady() {fDataReady = kFALSE;}
73  virtual Bool_t SetData(TObject *data, Option_t *option="");
74  void SetDataOwned(Bool_t flag) {fOwnedData = flag;}
75  void SetExchange(Bool_t flag) {TObject::SetBit(kExchangeData,flag);}
76  void SetPostEventLoop(Bool_t flag=kTRUE) {TObject::SetBit(kPostEventLoop,flag);}
77  void SetSpecialOutput(Bool_t flag=kTRUE) {TObject::SetBit(kSpecialOutput,flag);}
78  void SetRegisterDataset(Bool_t flag=kTRUE) {TObject::SetBit(kRegisterDataset,flag);}
79  void SetFileName(const char *filename);
80  void SetFile(TFile *f) {fFile = f;}
81  void SetProducer(AliAnalysisTask *prod, Int_t islot);
82  void SetTouched(Bool_t flag=kTRUE) {TObject::SetBit(kTouchedFlag,flag);}
83  void AddConsumer(AliAnalysisTask *cons, Int_t islot);
84  void DeleteData();
89  Bool_t IsDataReady() const {return fDataReady;}
90  Bool_t IsExchange() const {return TObject::TestBit(kExchangeData);}
91  Bool_t IsPostEventLoop() const {return TObject::TestBit(kPostEventLoop);}
92  Bool_t IsSpecialOutput() const {return TObject::TestBit(kSpecialOutput);}
93  Bool_t IsRegisterDataset() const {return TObject::TestBit(kRegisterDataset);}
94  Bool_t IsTouched() const {return TObject::TestBit(kTouchedFlag);}
95  Bool_t IsOwnedData() const {return fOwnedData;}
96  Bool_t ClientsExecuted() const;
97  Bool_t HasConsumers() const {return (fConsumers != 0);}
98  Bool_t HasProducer() const {return (fProducer != 0);}
100  virtual Long64_t Merge(TCollection *list);
102  virtual void NotifyChange(ENotifyMessage /*type*/) {;}
104  void PrintContainer(Option_t *option="all", Int_t indent=0) const;
105 
106 private:
107  void SetType(TClass *type) {fType = type;}
108 
109 protected:
110  Bool_t fDataReady;
111  Bool_t fOwnedData;
112  TString fFileName;
113  TString fFolderName;
114  TFile *fFile;
115  TObject *fData;
116  TClass *fType;
119 
120  ClassDef(AliAnalysisDataContainer,2) // Class describing a data container for analysis
121 };
122 
128 
129 class AliAnalysisDataWrapper : public TNamed {
130 
131 public:
132 
134  kDeleteData = BIT(14)
135 };
136  AliAnalysisDataWrapper() : TNamed(), fData(NULL) {}
137  AliAnalysisDataWrapper(TObject *data);
139  : TNamed(other), fData(other.fData) {}
140  virtual ~AliAnalysisDataWrapper();
141 
144 
145  TObject *Data() const {return fData;}
147  virtual Long64_t Merge(TCollection *list);
148  void SetDeleteData(Bool_t flag=kTRUE) {TObject::SetBit(kDeleteData,flag);}
149 
150 protected:
151  TObject *fData;
152 
153  ClassDef(AliAnalysisDataWrapper, 1) // Data wrapper class for exchange via the net
154 };
155 
160 class AliAnalysisFileDescriptor : public TObject {
161 
162 public:
164  AliAnalysisFileDescriptor(const TFile *file);
166  virtual ~AliAnalysisFileDescriptor();
167 
170 
171  void Done();
172 
173  const char *GetGUID() const {return fGUID;}
174  Int_t GetImage() const {return fImage;}
175  const char *GetLfn() const {return fLfn;}
176  Int_t GetNreplicas() const {return fNreplicas;}
177  Long64_t GetOpenAt() const {return fOpenedAt;}
178  Double_t GetOpenTime() const {return fOpenTime;}
179  const char *GetPfn() const {return fPfn;}
180  Long64_t GetReadBytes() const {return fReadBytes;}
181  Long64_t GetSize() const {return fSize;}
182  const char *GetSE() const {return fSE;}
183  Double_t GetThroughput() const {return fThroughput;}
184  Double_t GetProcessingTime() const {return fProcessingTime;}
185  const char *GetUrl() const {return fUrl;}
186  Bool_t IsArchive() const {return fIsArchive;}
187  virtual void Print(Option_t *option="") const;
188  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
189  void SetOpenTime(Double_t time) {fOpenTime = time;}
190 
191 
192 protected:
193  TString fLfn;
194  TString fGUID;
195  TString fUrl;
196  TString fPfn;
197  TString fSE;
198  Bool_t fIsArchive;
199  Int_t fImage;
200  Int_t fNreplicas;
201  Long64_t fStartBytes;
202  Long64_t fReadBytes;
203  Long64_t fSize;
204  Long64_t fOpenedAt;
205  Double_t fOpenTime;
206  Double_t fProcessingTime;
207  Double_t fThroughput;
208  TStopwatch fTimer;
209 
210  ClassDef(AliAnalysisFileDescriptor,1) // Class describing a a file processed in the analysis
211 };
212 
213 #endif
AliAnalysysTask - Class representing a basic analysis task. Any user-defined task should derive from...
AliAnalysisDataWrapper * ExportData() const
Wrapping.
TObject * fData
Wrapped data.
TString fUrl
url for the opened copy
#define TObjArray
virtual Long64_t Merge(TCollection *list)
Container merging.
TObject * GetData() const
Getters.
Bool_t fOwnedData
Flag data ownership.
void SetSpecialOutput(Bool_t flag=kTRUE)
AliAnalysisTask * GetProducer() const
void PrintContainer(Option_t *option="all", Int_t indent=0) const
Print connected tasks/status.
AliAnalysisTask * fProducer
Analysis task to which the slot belongs.
TString fSE
Storage element.
Long64_t fReadBytes
Number of bytes read.
TObjArray * GetConsumers() const
TObjArray * fConsumers
List of consumers of the data.
Double_t fProcessingTime
Processing.
AliAnalysysDataContainer AliAnalysysDataContainer - Container of data of arbitrary type deriving from...
Long64_t fOpenedAt
Absolute value for time when opened.
TStopwatch fTimer
! Processing time
AliAnalysisDataWrapper(const AliAnalysisDataWrapper &other)
virtual void NotifyChange(ENotifyMessage)
Send a notify signal to the container.
Long64_t fSize
Size of the file in bytes.
void Print(const char *method, TStopwatch &timer, Int_t n)
TClass * fType
! Type of contained data
Bool_t fDataReady
Flag that data is ready.
AliAnalysisDataContainer & operator=(const AliAnalysisDataContainer &cont)
Assignment.
void ImportData(AliAnalysisDataWrapper *pack)
Bool_t IsDataReady() const
Container status checking.
Long64_t fStartBytes
Total number of read bytes at start.
TString fPfn
physical file name
TString fFolderName
Folder name in the output file.
TObject * fData
Contained data.
TF1 * f
Definition: interpolTest.C:21
void SetDeleteData(Bool_t flag=kTRUE)
const char * GetFolderName() const
void SetPostEventLoop(Bool_t flag=kTRUE)
TString fFileName
File storing the data.
Int_t fNreplicas
Number of replicas.
const char * GetFileName() const
void SetFileName(const char *filename)
void SetRegisterDataset(Bool_t flag=kTRUE)
virtual Bool_t SetData(TObject *data, Option_t *option="")
void AddConsumer(AliAnalysisTask *cons, Int_t islot)
void SetProducer(AliAnalysisTask *prod, Int_t islot)
TString fLfn
logical file name
Double_t fOpenTime
Time elapsed to open file.
void SetTouched(Bool_t flag=kTRUE)
virtual void GetEntry(Long64_t ientry)