]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHChamber.h
Adding makefile for Darwin and XLC compiler
[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 <TVector3.h>
8 #include <TMath.h>
9 #include <TRotation.h>
10 #include <TLorentzVector.h>
11 #include "AliRICHParam.h"
12 #include "AliSegmentation.h"
13 class AliRICHGeometry;
14 class AliRICHResponse;
15 class TRotMatrix;
16
17 typedef enum {kMip, kPhoton} ResponseType;
18 class AliRICHParam;
19
20 class AliRICHChamber : public TNamed
21 {
22 public:
23            AliRICHChamber();
24            AliRICHChamber(Int_t iModuleN,AliRICHParam *pParam);
25            AliRICHChamber(const AliRICHChamber &chamber):TNamed(chamber) {;}
26   virtual ~AliRICHChamber()                                              {;}
27            AliRICHChamber& operator=(const AliRICHChamber&)              {return *this;}
28   
29   TRotMatrix* RotMatrix()          const{return fpRotMatrix;}
30   TString RotMatrixName()          const{return "rot"+fName;}
31   TRotation   Rot()                const{return fRot;}
32   Double_t    Rho()                const{return fCenterV3.Mag();} 
33   Double_t    ThetaD()             const{return fCenterV3.Theta()*TMath::RadToDeg();}    
34   Double_t    PhiD()               const{return fCenterV3.Phi()*TMath::RadToDeg();}    
35   Double_t    ThetaXd()            const{return fRot.ThetaX()*TMath::RadToDeg();}    
36   Double_t    PhiXd()              const{return fRot.PhiX()*TMath::RadToDeg();}    
37   Double_t    ThetaYd()            const{return fRot.ThetaY()*TMath::RadToDeg();}    
38   Double_t    PhiYd()              const{return fRot.PhiY()*TMath::RadToDeg();}    
39   Double_t    ThetaZd()            const{return fRot.ThetaZ()*TMath::RadToDeg();}    
40   Double_t    PhiZd()              const{return fRot.PhiZ()*TMath::RadToDeg();}    
41   void        RotateX(Double_t a)       {fRot.RotateX(a);fCenterV3.RotateX(a);fPcX3.RotateX(a);}
42   void        RotateY(Double_t a)       {fRot.RotateY(a);fCenterV3.RotateY(a);fPcX3.RotateY(a);}
43   void        RotateZ(Double_t a)       {fRot.RotateZ(a);fCenterV3.RotateZ(a);fPcX3.RotateZ(a);}
44   Double_t    X()                  const{return fCenterV3.X();}  
45   Double_t    Y()                  const{return fCenterV3.Y();}   
46   Double_t    Z()                  const{return fCenterV3.Z();}
47   TVector3    L2G(TVector3 x3)                       const{x3.Transform(fRot);x3+=fCenterV3;return x3;}
48   TVector3    G2L(TVector3 x3)                       const{x3-=fCenterV3;x3.Transform(fRot.Inverse()); return x3;}
49   inline TVector2  Glob2Loc(TVector3 x3, Bool_t isVector=kFALSE) const;
50   TVector2    Glob2Loc(TLorentzVector x4,Bool_t isVector=kFALSE) const{return Glob2Loc(x4.Vect(),isVector);}
51   TVector3    L2G(Double_t x,Double_t y,Double_t z)  const{return L2G(TVector3(x,y,z));}
52   TVector3    G2L(TLorentzVector x4)                 const{return G2L(x4.Vect());}
53   Float_t     G2Ly(TLorentzVector x4)                const{TVector3 x3=G2L(x4.Vect()); return x3.Z();}
54   TVector3    G2L(Double_t x,Double_t y,Double_t z)  const{return G2L(TVector3(x,y,z));}
55   Float_t     G2Lx(Double_t x,Double_t y,Double_t z) const{TVector3 x3=G2L(x,y,z); return x3.X();}
56   Float_t     G2Ly(Double_t x,Double_t y,Double_t z) const{TVector3 x3=G2L(x,y,z); return x3.Z();}
57   void        Print(Option_t *sOption)const;//virtual      
58    
59   void LocaltoGlobal(Float_t pos[3],Float_t localpos[3]) {
60     //Transformation from local to global coordinates, chamber-dependant
61     TVector3 buf = L2G(localpos[0],localpos[1],localpos[2]);
62     pos[0]=buf.X();pos[1]=buf.Y();pos[2]=buf.Z();
63   }
64   void GlobaltoLocal(Float_t pos[3],Float_t localpos[3]) {
65     //Transformation from Global to local coordinates, chamber-dependant 
66     TVector3 buf = G2L(pos[0],pos[1],pos[2]);
67     localpos[0]=buf.X();localpos[1]=buf.Y();localpos[2]=buf.Z();
68   }
69   inline void SetToZenith();
70   TRotMatrix *GetRotMatrix()       const{return fpRotMatrix;}  
71 protected:
72   TVector3      fCenterV3;        //chamber center position in MRS (cm)
73   TVector3      fPcX3;            //PC center position in MRS (cm)
74   TRotation     fRot;             //chamber rotation in MRS
75   TRotMatrix   *fpRotMatrix;      //rotation matrix of the chamber with respect to MRS 
76   AliRICHParam *fpParam;          //main RICH parameters description  
77   ClassDef(AliRICHChamber,5)      //single RICH chamber description
78 };//class AliRICHChamber
79 //__________________________________________________________________________________________________
80 void AliRICHChamber::SetToZenith()
81 {
82   fCenterV3.SetXYZ(0,AliRICHParam::Offset()-AliRICHParam::GapThickness()/2,0); 
83   fPcX3.SetXYZ(0,AliRICHParam::Offset()-AliRICHParam::GapThickness()/2+5.276+0.25,0);   
84 }
85 //__________________________________________________________________________________________________
86 TVector2 AliRICHChamber::Glob2Loc(TVector3 x3,Bool_t isVector)const
87 {
88   if(!isVector) x3-=fPcX3;
89   x3.Transform(fRot.Inverse()); 
90   return TVector2(x3.X(),x3.Z());//attention Y and Z are misplaced!
91 }
92 //__________________________________________________________________________________________________  
93 #endif //AliRICHChamber_h