]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliEventPoolSparse.h
updated merging function (Michele)
[u/mrichter/AliRoot.git] / ANALYSIS / AliEventPoolSparse.h
1 #ifndef ALIEVENTPOOLSPARSE_H
2 #define ALIEVENTPOOLSPARSE_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
8 // Event pool based on THnSparseI
9 // This class is needed by the AnalysisManager to steer a mixing analysis.
10 // Author: Peter Hristov
11 // Peter.Hristov@cern.ch
12
13 #include <THnSparse.h>
14 #include <TEntryList.h>
15 #include "AliVEventPool.h"
16
17 class TChain;
18 class TTreeFormula;
19
20 //_____________________________________________________________________________
21 class AliEventPoolSparse : public AliVEventPool {
22  public:
23
24   AliEventPoolSparse();
25   AliEventPoolSparse(const char* name, const char* title, TChain * tagchain, Int_t dim,
26                      const char ** vars, const Int_t* nbins, const Double_t* xmin = 0,
27                      const Double_t* xmax = 0, Int_t chunksize = 1024 * 16);
28
29   virtual ~AliEventPoolSparse();
30
31   // Interface from AiVEventPool, to be overloaded
32   virtual TChain* GetNextChain();
33   virtual void  GetCurrentBin(Float_t* xbin);
34   virtual Int_t GetDimension(){return fN;}
35   virtual void  Init();
36
37   TEntryList * GetNextPool(Int_t i) {
38     // Returns the array associated with bin "i"
39     return fPool>0 ? fPool[i] : 0x0;
40   }
41
42   TEntryList * GetEvents(const Double_t * x) {
43     // Returns the array associated with the bin
44     // that corresponds to vector "x"
45     Int_t bin = fHnSparseI.GetBin(x,kFALSE);
46     return fPool>0 ? fPool[bin] : 0x0;
47   }
48
49   void SetTagChain(TChain * chain){
50     // Input tag chain
51     fTagChain = chain;
52   }
53
54   TChain * GetTagChain() const {
55     // Return the input tag chain
56     return fTagChain;
57   }
58
59   // Cuts
60   void SetRunCut(const char * cut);
61   void SetLHCCut(const char * cut);
62   void SetDetCut(const char * cut);
63   void SetEventCut(const char * cut);
64
65   TTreeFormula ** GetPoolVars() const {return fVars;}
66   TTreeFormula * GetRunCut() const {return fRunCut;}
67   TTreeFormula * GetLHCCut() const {return fLHCCut;}
68   TTreeFormula * GetDetCut() const {return fDetCut;}
69   TTreeFormula * GetEventCut() const {return fEvCut;}
70   Int_t BinNumber() const {return fBinNumber;}
71           
72  protected:
73
74   void Set(Int_t n);
75
76
77  private:
78
79   AliEventPoolSparse(const AliEventPoolSparse& source); // Not implemented
80   AliEventPoolSparse& operator = (const AliEventPoolSparse& source); // Not implemented
81
82   THnSparseI fHnSparseI; // Sparse histogram to 
83   Int_t fChunkSize;      //! Cached chunk size since the getter is protected
84   Int_t fN;              // Size of the array fPool
85   TEntryList ** fPool;   // Arrays of pointers to the TEntryList containing the event IDs
86   Int_t fCurrentBin;     //! Current bin
87   TChain * fTagChain;    //! Input chain of tags
88
89   TTreeFormula ** fVars; // Array of variables used to create the pools 
90   TTreeFormula * fRunCut;// Run selection
91   TTreeFormula * fLHCCut;// LNC-based selection
92   TTreeFormula * fDetCut;// Detector-based selection
93   TTreeFormula * fEvCut; // Event-based selection
94   Int_t fBinNumber;      // Current bin
95   
96   ClassDef(AliEventPoolSparse,1)  // 
97 };
98
99 #endif
100
101