]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHChamber.h
Add L2G and G2L for vectors.
[u/mrichter/AliRoot.git] / RICH / AliRICHChamber.h
1 #ifndef AliRICHChamber_h
2 #define AliRICHChamber_h
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 #include <TRotMatrix.h>
8 #include <TVector3.h>
9 #include <TMath.h>
10 #include <TRotation.h>
11 #include <TLorentzVector.h>
12 #include "AliRICHConst.h"
13
14 #include "AliRICHTresholdMap.h"
15 #include "AliSegmentation.h"
16 #include "AliRICHGeometry.h"
17 #include "AliRICHResponse.h"
18
19 typedef enum {kMip, kPhoton} ResponseType;
20 class AliRICHParam;
21
22 class AliRICHChamber : public TNamed
23 {
24 public:
25     
26    Int_t                fIndexMap[50];   //indeces of tresholds
27    AliRICHTresholdMap*  fTresh;          //map of tresholds
28
29 public:
30            AliRICHChamber();
31            AliRICHChamber(Int_t iModuleN,AliRICHParam *pParam);
32            AliRICHChamber(const AliRICHChamber &chamber):TNamed(chamber) {;}
33   virtual ~AliRICHChamber()                                              {;}
34            AliRICHChamber& operator=(const AliRICHChamber&)              {return *this;}
35   
36   TRotMatrix* RotMatrix()          const{return fpRotMatrix;}
37   const char* RotMatrixName()      const{return "rot"+fName;}
38   TRotation   Rot()                     {return fRot;}
39   Double_t    Rho()                const{return fCenterV3.Mag();} 
40   Double_t    ThetaD()             const{return fCenterV3.Theta()*TMath::RadToDeg();}    
41   Double_t    PhiD()               const{return fCenterV3.Phi()*TMath::RadToDeg();}    
42   Double_t    ThetaXd()            const{return fRot.ThetaX()*TMath::RadToDeg();}    
43   Double_t    PhiXd()              const{return fRot.PhiX()*TMath::RadToDeg();}    
44   Double_t    ThetaYd()            const{return fRot.ThetaY()*TMath::RadToDeg();}    
45   Double_t    PhiYd()              const{return fRot.PhiY()*TMath::RadToDeg();}    
46   Double_t    ThetaZd()            const{return fRot.ThetaZ()*TMath::RadToDeg();}    
47   Double_t    PhiZd()              const{return fRot.PhiZ()*kR2d;}    
48   void        RotateX(Double_t a)       {fRot.RotateX(a);fCenterV3.RotateX(a);}
49   void        RotateY(Double_t a)       {fRot.RotateY(a);fCenterV3.RotateY(a);}
50   void        RotateZ(Double_t a)       {fRot.RotateZ(a);fCenterV3.RotateZ(a);}
51   Double_t    X()                  const{return fCenterV3.X();}  
52   Double_t    Y()                  const{return fCenterV3.Y();}   
53   Double_t    Z()                  const{return fCenterV3.Z();}
54   TVector3    L2G(TVector3 x3)                       const{x3.Transform(fRot);x3+=fCenterV3;return x3;}
55   TVector3    G2L(TVector3 x3)                       const{x3-=fCenterV3;x3.Transform(fRot.Inverse()); return x3;}
56   TVector3    L2G(Double_t x,Double_t y,Double_t z)  const{return L2G(TVector3(x,y,z));}
57   TVector3    G2L(TLorentzVector x4)                 const{return G2L(x4.Vect());}
58   Float_t     G2Ly(TLorentzVector x4)                const{TVector3 x3=G2L(x4.Vect()); return x3.Z();}
59   TVector3    G2L(Double_t x,Double_t y,Double_t z)  const{return G2L(TVector3(x,y,z));}
60   Float_t     G2Lx(Double_t x,Double_t y,Double_t z) const{TVector3 x3=G2L(x,y,z); return x3.X();}
61   Float_t     G2Ly(Double_t x,Double_t y,Double_t z) const{TVector3 x3=G2L(x,y,z); return x3.Z();}
62   TVector3    L2Gvector(TVector3 x3)                 const{x3.Transform(fRot);return x3;}
63   TVector3    G2Lvector(TVector3 x3)                 const{x3.Transform(fRot.Inverse()); return x3;}
64 //  TLorentzVector L2G(TLorentzVector v4)  const{v4.Transform(fRot.Inverse());v4+=fCenterV3;return v4;}???
65   void        Print(Option_t *sOption)const;//virtual      
66    
67   void LocaltoGlobal(Float_t pos[3],Float_t Localpos[3]);//Transformation from local to global coordinates, chamber-dependant
68   void GlobaltoLocal(Float_t pos[3],Float_t localpos[3]);//Transformation from Global to local coordinates, chamber-dependant 
69   void GenerateTresholds();                              //Generate pad dependent tresholds
70   void DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit, Int_t&x, Float_t newclust[6][500], ResponseType res);// Cluster formation method
71   void    Init(Int_t id)           {fSegmentation->Init(id);} // Recalculates all the values after some of them have been changed
72   void              SetGeometryModel(AliRICHGeometry* pRICHGeometry)            {fGeometry=pRICHGeometry;}        
73   AliRICHGeometry*  GetGeometryModel()                                     const{return fGeometry;}
74   void              SetResponseModel(AliRICHResponse* pRICHResponse)            {fResponse=pRICHResponse;}
75   AliRICHResponse*  GetResponseModel()                                     const{return fResponse;}
76   void              SetSegmentationModel(AliSegmentation* pRICHSegmentation)    {fSegmentation=pRICHSegmentation;}
77   AliSegmentation*  GetSegmentationModel()                                 const{return fSegmentation;}
78   void   SigGenInit(Float_t x, Float_t y, Float_t z)   {fSegmentation->SigGenInit(x, y, z) ;}
79   Int_t  SigGenCond(Float_t x, Float_t y, Float_t z)   {return fSegmentation->SigGenCond(x, y, z);}
80   Int_t  Sector(Float_t x, Float_t y)                  {return fSegmentation->Sector((Int_t)x, (Int_t)y);} // Returns number of sector containing (x,y) position    
81   void   SetPadSize(Float_t p1, Float_t p2)            {fSegmentation->SetPadSize(p1,p2);}
82   Double_t    GetX()               const{return fX;}
83   Double_t    GetY()               const{return fY;}
84   Double_t    GetZ()               const{return fZ;}    
85   inline void SetCenter(Double_t x,Double_t y,Double_t z);
86   TRotMatrix *GetRotMatrix()       const{return fpRotMatrix;}
87   void        SetChamberTransform(Float_t x,Float_t y,Float_t z,TRotMatrix *pRotMatrix);
88   
89 protected:
90   Float_t fX,fY,fZ;                                      // Position of the center of the chamber in MRS (cm)
91
92   AliSegmentation               *fSegmentation;          //???Segmentation model for each chamber
93   AliRICHResponse               *fResponse;              //???Response model for each chamber
94   AliRICHGeometry               *fGeometry;              //???Geometry model for each chamber
95    
96   TVector3      fCenterV3;        //chamber center position in MRS (cm)
97   TRotation     fRot;             //chamber rotation in MRS
98   TRotMatrix   *fpRotMatrix;      //rotation matrix of the chamber with respect to MRS 
99   AliRICHParam *fpParam;          //main RICH parameters description  
100   ClassDef(AliRICHChamber,2)      //single RICH chamber description
101 };//class AliRICHChamber
102
103 void AliRICHChamber::SetCenter(Double_t x,Double_t y,Double_t z)
104 {
105   fCenterV3.SetXYZ(x,y,z);
106   fX=x;fY=y;fZ=z;
107 }
108   
109 #endif //AliRICHChamber_h