]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/AliJetGrid.h
Useful macros for the shifter
[u/mrichter/AliRoot.git] / JETAN / AliJetGrid.h
1 #ifndef ALIJETGRID_H
2 #define ALIJETGRID_H
3 /* Copyright(c) 2001-2002, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 // Class description : class used to generate grid for jet studies
7 //                     and extract parameter indexes from a given grid
8 //
9 // Author : Magali Estienne, SUBATECH Nantes 
10 // E-mail:  magali.estienne@subatech.in2p3.fr
11 //
12 // --- Standard library ---
13 #include <Riostream.h>
14 //-- Root headers ---
15 #include <TNamed.h>
16 #include <TMatrixD.h>
17 #include <TArrayD.h>
18 #include <TArrayI.h>
19 //-------------------
20
21 class AliJetGrid : public TNamed {
22
23  public:
24   
25   AliJetGrid();
26   AliJetGrid(Int_t nphi,Int_t neta,Double_t phiMin,Double_t etaMin,Double_t phiMax,Double_t etaMax);
27   virtual ~AliJetGrid();
28
29   // Getter
30   TArrayD*  GetArrayEta();
31   TArrayD*  GetArrayPhi();
32   TMatrixD* GetIndexObject();
33   void      InitParams(Double_t phiMinCal,Double_t phiMaxCal,Double_t etaMinCal,Double_t etaMaxCal);
34   Int_t     GetIndexFromEtaPhi(Double_t phi,Double_t eta) const;
35   void      GetEtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi);
36   Int_t     GetBinsEta() const {return fNeta+1;}
37   Int_t     GetBinsPhi() const {return fNphi+1;}
38   Int_t     GetTotBins() const {return (fNeta+1)*(fNphi+1);}
39   Int_t     GetPointsEta() const {return fNeta;}
40   Int_t     GetPointsPhi() const {return fNphi;}
41   Int_t     GetTotPoints() const {return fNeta*fNphi;}
42   Int_t     GetMatrixIndex(Int_t iphi,Int_t ieta) {return static_cast<Int_t>((*fIndex)(iphi,ieta));}
43   Int_t     GetIndexIFromPhi(Double_t phi);
44   Int_t     GetIndexJFromEta(Double_t eta);
45   Int_t     GetIndex(Double_t phi,Double_t eta);
46   void      GetAccParam(Int_t &nphi, Int_t &neta, Float_t &minphi, 
47                         Float_t &maxphi, Float_t &mineta, Float_t &maxeta) const ;
48   void      GetBinParam(Int_t &phibintpc, Int_t &etabintpc, 
49                         Int_t &phibinemc, Int_t &etabinemc, Int_t &nbinphi) const;
50   void      GetIJFromIndex(Int_t index, Int_t i, Int_t j) const;
51   void      GetEtaPhiFromIndex2(Int_t index, Float_t &phi, Float_t &eta);
52   Int_t     GetNEntries();
53   Int_t     GetNEntries2();
54   Int_t     GetDeta() const {if(fNeta!=0) return static_cast<Int_t>((fEtaMax-fEtaMin)/fNeta);
55                              else return static_cast<Int_t>(fEtaMax-fEtaMin);}
56   Int_t     GetDphi() const {if(fNphi!=0) return static_cast<Int_t>((fPhiMax-fPhiMin)/fNphi);
57                              else return static_cast<Int_t>(fPhiMax-fPhiMin);} 
58   Int_t     GetGridType() const {return fGrid;}
59
60   // Setter
61   void      SetEtaRange(Double_t etaMin, Double_t etaMax) {fEtaMin = etaMin; fEtaMax = etaMax;}
62   void      SetPhiRange(Double_t phiMin, Double_t phiMax) {fPhiMin = phiMin; fPhiMax = phiMax;}
63   void      SetNeta(Int_t neta) {fNeta = neta;}
64   void      SetNphi(Int_t nphi) {fNphi = nphi;}
65   void      SetMatrixIndexes();
66   void      SetMatrixIndex(Int_t i,Double_t par);
67   void      SetMatrixIndex(Int_t iphi,Int_t ieta,Double_t par) {
68                                  (*fIndex)(iphi,ieta)=par; return; }
69   void      SetGridType(Int_t type) {fGrid = type;}
70   void      SetIndexIJ();
71
72  private:
73   Int_t     fGrid;              // Close the type of grid you want to fill
74                                 // 0 = grid in tpc acceptance, 1 = grid in (tpc-emcal) acceptance  
75   Int_t     fNphi;              // number of points in the grid in phi
76   Int_t     fNeta;              //               "                 eta
77   TArrayD*  fPhi;               // grid points in phi
78   TArrayD*  fEta;               // grid points in eta
79   TMatrixD* fIndex;             // matrix of indexes in the grid points  
80   TArrayI*  fIndexI;            // grid points in phi
81   TArrayI*  fIndexJ;            // grid points in eta
82   Double_t  fPhiMin;            // phi acceptance min
83   Double_t  fPhiMax;            // phi acceptance max
84   Double_t  fEtaMin;            // eta acceptance min 
85   Double_t  fEtaMax;            // eta acceptance max
86   Int_t     fEtaBinInTPCAcc;    // number of points in TPC acceptance in eta
87   Int_t     fPhiBinInTPCAcc;    // number of points in TPC acceptance in phi
88   Int_t     fEtaBinInEMCalAcc;  // number of points in EMCal acceptance in eta
89   Int_t     fPhiBinInEMCalAcc;  // number of points in EMCal acceptance in phi
90   Int_t     fNbinEta;           // number of bins in eta
91   Int_t     fNbinPhi;           // number of bins in phi
92   Double_t  fMaxPhi;            // maximum phi
93   Double_t  fMinPhi;            // minimum phi
94   Double_t  fMaxEta;            // maximum eta
95   Double_t  fMinEta;            // minimum eta
96   Int_t     fDebug;             // debug flag
97
98  protected:
99   AliJetGrid(const AliJetGrid& grid);
100   AliJetGrid& operator=(const AliJetGrid& other);
101
102
103   ClassDef(AliJetGrid,1) 
104 };
105
106
107 #endif
108
109
110
111