]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/Tools/AliTHn.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / Tools / AliTHn.h
1 #ifndef AliTHn_H
2 #define AliTHn_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 // optimized data container reusing functionality of AliCFContainer / THnsparse
8 //
9 // Use AliTHn instead of AliCFContainer and your memory consumption will be drastically reduced
10 // As AliTHn derives from AliCFContainer, you can just replace your current AliCFContainer object by AliTHn
11 // Once you have the merged output, call FillParent() and you can use AliCFContainer as usual
12
13 #include "TObject.h"
14 #include "TString.h"
15 #include "AliCFContainer.h"
16
17 class TArrayF;
18 class TCollection;
19
20 class AliTHn : public AliCFContainer
21 {
22  public:
23   AliTHn();
24   AliTHn(const Char_t* name, const Char_t* title,const Int_t nSelStep, const Int_t nVarIn, const Int_t* nBinIn);
25   
26   virtual ~AliTHn();
27   
28   virtual void  Fill(const Double_t *var, Int_t istep, Double_t weight=1.) ;
29   virtual void  FillParent();
30   virtual void  FillContainer(AliCFContainer* cont);
31   
32   TArrayF* GetValues(Int_t step) { return fValues[step]; }
33   TArrayF* GetSumw2(Int_t step)  { return fSumw2[step]; }
34   
35   void DeleteContainers();
36   void ReduceAxis();
37   
38   AliTHn(const AliTHn &c);
39   AliTHn& operator=(const AliTHn& corr);
40   virtual void Copy(TObject& c) const;
41
42   virtual Long64_t Merge(TCollection* list);
43   
44 protected:
45   void Init();
46   Long64_t GetGlobalBinIndex(const Int_t* binIdx);
47   
48   Long64_t fNBins;   // number of total bins
49   Int_t    fNVars;   // number of variables
50   Int_t    fNSteps;  // number of selection steps
51   TArrayF **fValues; //[fNSteps] data container
52   TArrayF **fSumw2;  //[fNSteps] data container
53   
54   TAxis** axisCache; //! cache axis pointers (about 50% of the time in Fill is spent in GetAxis otherwise)
55   Int_t* fNbinsCache; //! cache Nbins per axis
56   Double_t* fLastVars; //! caching of last used bins (in many loops some vars are the same for a while)
57   Int_t* fLastBins; //! caching of last used bins (in many loops some vars are the same for a while)
58   
59   ClassDef(AliTHn, 4) // THn like container
60 };
61
62 #endif