]>
Commit | Line | Data |
---|---|---|
d440e2c5 | 1 | #ifndef ALIANALYSISMUMUBINNING_H |
2 | #define ALIANALYSISMUMUBINNING_H | |
3 | ||
4 | #include "TNamed.h" | |
5 | #include "TString.h" | |
6 | #include "TMath.h" | |
7 | ||
8 | // | |
9 | // AliAnalysisMuMuBinning : | |
10 | // helper class to store the various bins used | |
11 | // | |
12 | // author: L. Aphecetche (Subatech) | |
13 | // | |
14 | ||
15 | class TMap; | |
16 | class TObjArray; | |
17 | ||
18 | ||
19 | class AliAnalysisMuMuBinning : public TNamed | |
20 | { | |
21 | public: | |
22 | ||
23 | class Range; | |
24 | ||
25 | AliAnalysisMuMuBinning(const char* name="", const char* title=""); | |
26 | AliAnalysisMuMuBinning(const AliAnalysisMuMuBinning& rhs); | |
27 | AliAnalysisMuMuBinning& operator=(const AliAnalysisMuMuBinning& rhs); | |
28 | ||
29 | virtual ~AliAnalysisMuMuBinning(); | |
30 | ||
31 | void AddBin(const AliAnalysisMuMuBinning::Range& bin); | |
32 | ||
5376e016 | 33 | void AddBin(const char* what, const char* quantity, |
d440e2c5 | 34 | Double_t xmin=TMath::Limits<Double_t>::Max(), |
35 | Double_t xmax=TMath::Limits<Double_t>::Max(), | |
5376e016 CP |
36 | const char* flavour="") |
37 | { AddBin(what,quantity,xmin,xmax,TMath::Limits<Double_t>::Max(),TMath::Limits<Double_t>::Max(),flavour); } | |
38 | ||
39 | void AddBin(const char* what, const char* quantity, | |
40 | Double_t xmin, | |
41 | Double_t xmax, | |
42 | Double_t ymin, | |
43 | Double_t ymax, | |
1afce1ce | 44 | const char* flavour=""); |
d440e2c5 | 45 | |
5376e016 | 46 | TObjArray* CreateWhatArray() const; |
d440e2c5 | 47 | |
5376e016 | 48 | TObjArray* CreateQuantityArray() const; |
d440e2c5 | 49 | |
50 | Double_t* CreateBinArray() const; | |
16560e8e | 51 | Double_t* CreateBinArrayY() const; |
52 | Double_t* CreateBinArrayX() const; | |
d440e2c5 | 53 | |
54 | TObjArray* CreateBinObjArray() const; | |
5376e016 CP |
55 | TObjArray* CreateBinObjArray(const char* what) const; |
56 | TObjArray* CreateBinObjArray(const char* what, const char* quantity, const char* flavour) const; | |
d440e2c5 | 57 | |
16560e8e | 58 | Int_t GetNBinsX() const; |
59 | Int_t GetNBinsY() const; | |
60 | ||
5376e016 | 61 | AliAnalysisMuMuBinning* Project(const char* what, const char* quantity, const char* flavour="") const; |
d440e2c5 | 62 | |
63 | virtual void Print(Option_t* opt="") const; | |
64 | ||
5376e016 | 65 | void CreateMesh(const char* what, const char* quantity1, const char* quantity2, const char* flavour="", Bool_t remove12=kFALSE); |
d440e2c5 | 66 | |
67 | Long64_t Merge(TCollection* list); | |
68 | ||
69 | Bool_t IsEqual(const TObject* obj) const; | |
70 | ||
71 | class Range : public TObject { | |
72 | ||
73 | public: | |
74 | ||
5376e016 | 75 | Range(const char* what="",const char* quantity="", |
d440e2c5 | 76 | Double_t xmin=TMath::Limits<Double_t>::Max(), |
77 | Double_t xmax=TMath::Limits<Double_t>::Max(), | |
78 | Double_t ymin=TMath::Limits<Double_t>::Max(), | |
1afce1ce | 79 | Double_t ymax=TMath::Limits<Double_t>::Max(), |
80 | const char* version=""); | |
d440e2c5 | 81 | |
82 | virtual Int_t Compare(const TObject* obj) const; | |
83 | Bool_t IsEqual(const TObject* obj) const { return Compare(obj)==0; } | |
84 | Bool_t IsSortable() const { return kTRUE; } | |
85 | ||
86 | virtual TObject* Clone(const char* /*newname*/ = "") const { return new Range(*this); } | |
87 | ||
88 | bool operator==(const Range& other) const { return Compare(&other)==0; } | |
89 | ||
90 | bool operator!=(const Range& other) const { return !(*this==other); } | |
91 | ||
5376e016 CP |
92 | Bool_t IsIntegrated() const; |
93 | ||
94 | TString Quantity() const { return fQuantity; } | |
95 | TString What() const { return fWhat; } | |
d440e2c5 | 96 | Double_t Xmin() const { return fXmin; } |
97 | Double_t Xmax() const { return fXmax; } | |
98 | Double_t Ymin() const { return fYmin; } | |
99 | Double_t Ymax() const { return fYmax; } | |
100 | ||
101 | Double_t WidthX() const { return TMath::Abs(fXmin-fXmax); } | |
102 | ||
103 | Double_t WidthY() const { return TMath::Abs(fYmin-fYmax); } | |
104 | ||
105 | Bool_t Is2D() const { return fYmax > fYmin; } | |
106 | ||
5376e016 | 107 | const char* GetName() const { return What().Data(); } |
d440e2c5 | 108 | |
109 | TString AsString() const; | |
110 | ||
111 | virtual void Print(Option_t* opt="") const; | |
112 | ||
113 | Bool_t IsInRange(Double_t x, Double_t y=TMath::Limits<Double_t>::Max()) const; | |
114 | ||
1afce1ce | 115 | TString Flavour() const { return fFlavour; } |
116 | ||
d440e2c5 | 117 | private: |
5376e016 CP |
118 | TString fWhat; // what this range is about (e.g. J/psi particle, event, etc...) |
119 | TString fQuantity; // binning type (e.g. pt, y, phi) | |
d440e2c5 | 120 | Double_t fXmin; // x-min of the range |
121 | Double_t fXmax; // x-max of the range | |
122 | Double_t fYmin; // x-min of the range | |
123 | Double_t fYmax; // x-max of the range | |
1afce1ce | 124 | TString fFlavour; // flavour (if any) this range, e.g. coarse, fine, etc... |
d440e2c5 | 125 | |
5376e016 | 126 | ClassDef(AliAnalysisMuMuBinning::Range,3) |
d440e2c5 | 127 | }; |
128 | ||
129 | ||
130 | private: | |
131 | ||
5376e016 | 132 | TMap* fBins; // list of bins (what -> list of bins) = (TObjString -> TObjArray) |
d440e2c5 | 133 | |
5376e016 | 134 | ClassDef(AliAnalysisMuMuBinning,2) // custom binning for MuMu analysis |
d440e2c5 | 135 | }; |
136 | ||
137 | #endif |