AliAODEvent::GetHeader now return AliVHeader
[u/mrichter/AliRoot.git] / PWG / muon / AliAnalysisMuMuBinning.h
CommitLineData
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
15class TMap;
16class TObjArray;
17
18
19class AliAnalysisMuMuBinning : public TNamed
20{
21public:
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;
51
52 TObjArray* CreateBinObjArray() const;
5376e016
CP
53 TObjArray* CreateBinObjArray(const char* what) const;
54 TObjArray* CreateBinObjArray(const char* what, const char* quantity, const char* flavour) const;
d440e2c5 55
5376e016 56 AliAnalysisMuMuBinning* Project(const char* what, const char* quantity, const char* flavour="") const;
d440e2c5 57
58 virtual void Print(Option_t* opt="") const;
59
5376e016 60 void CreateMesh(const char* what, const char* quantity1, const char* quantity2, const char* flavour="", Bool_t remove12=kFALSE);
d440e2c5 61
62 Long64_t Merge(TCollection* list);
63
64 Bool_t IsEqual(const TObject* obj) const;
65
66 class Range : public TObject {
67
68 public:
69
5376e016 70 Range(const char* what="",const char* quantity="",
d440e2c5 71 Double_t xmin=TMath::Limits<Double_t>::Max(),
72 Double_t xmax=TMath::Limits<Double_t>::Max(),
73 Double_t ymin=TMath::Limits<Double_t>::Max(),
1afce1ce 74 Double_t ymax=TMath::Limits<Double_t>::Max(),
75 const char* version="");
d440e2c5 76
77 virtual Int_t Compare(const TObject* obj) const;
78 Bool_t IsEqual(const TObject* obj) const { return Compare(obj)==0; }
79 Bool_t IsSortable() const { return kTRUE; }
80
81 virtual TObject* Clone(const char* /*newname*/ = "") const { return new Range(*this); }
82
83 bool operator==(const Range& other) const { return Compare(&other)==0; }
84
85 bool operator!=(const Range& other) const { return !(*this==other); }
86
5376e016
CP
87 Bool_t IsIntegrated() const;
88
89 TString Quantity() const { return fQuantity; }
90 TString What() const { return fWhat; }
d440e2c5 91 Double_t Xmin() const { return fXmin; }
92 Double_t Xmax() const { return fXmax; }
93 Double_t Ymin() const { return fYmin; }
94 Double_t Ymax() const { return fYmax; }
95
96 Double_t WidthX() const { return TMath::Abs(fXmin-fXmax); }
97
98 Double_t WidthY() const { return TMath::Abs(fYmin-fYmax); }
99
100 Bool_t Is2D() const { return fYmax > fYmin; }
101
5376e016 102 const char* GetName() const { return What().Data(); }
d440e2c5 103
104 TString AsString() const;
105
106 virtual void Print(Option_t* opt="") const;
107
108 Bool_t IsInRange(Double_t x, Double_t y=TMath::Limits<Double_t>::Max()) const;
109
1afce1ce 110 TString Flavour() const { return fFlavour; }
111
d440e2c5 112 private:
5376e016
CP
113 TString fWhat; // what this range is about (e.g. J/psi particle, event, etc...)
114 TString fQuantity; // binning type (e.g. pt, y, phi)
d440e2c5 115 Double_t fXmin; // x-min of the range
116 Double_t fXmax; // x-max of the range
117 Double_t fYmin; // x-min of the range
118 Double_t fYmax; // x-max of the range
1afce1ce 119 TString fFlavour; // flavour (if any) this range, e.g. coarse, fine, etc...
d440e2c5 120
5376e016 121 ClassDef(AliAnalysisMuMuBinning::Range,3)
d440e2c5 122 };
123
124
125 private:
126
5376e016 127 TMap* fBins; // list of bins (what -> list of bins) = (TObjString -> TObjArray)
d440e2c5 128
5376e016 129 ClassDef(AliAnalysisMuMuBinning,2) // custom binning for MuMu analysis
d440e2c5 130};
131
132#endif