new Hits2SDigits.
[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 /* $Id$ */
8
9 #include <TRotMatrix.h>
10 #include <TVector3.h>
11 #include <TMath.h>
12 #include <TRotation.h>
13
14 #include "AliRICHTresholdMap.h"
15 #include "AliSegmentation.h"
16 #include "AliRICHGeometry.h"
17 #include "AliRICHResponse.h"
18
19 class AliRICHClusterFinder;
20
21 typedef enum {kMip, kCerenkov} ResponseType;
22 class AliRICHParam;
23
24 class AliRICHChamber : public TNamed
25 {
26 public:
27     
28    Int_t                fIndexMap[50];   //indeces of tresholds
29    AliRICHTresholdMap*  fTresh;          //map of tresholds
30
31 public:
32            AliRICHChamber();                                        //default ctor
33            AliRICHChamber(Int_t iModuleN,AliRICHParam *pParam);
34            AliRICHChamber(const AliRICHChamber &chamber ) {;}//copy ctor 
35   virtual ~AliRICHChamber()                               {;}//dtor
36   AliRICHChamber& operator=(const AliRICHChamber& rhs){return *this;}
37   void LocaltoGlobal(Float_t pos[3],Float_t Localpos[3]);//Transformation from local to global coordinates, chamber-dependant
38   void GlobaltoLocal(Float_t pos[3],Float_t localpos[3]);//Transformation from Global to local coordinates, chamber-dependant 
39   void GenerateTresholds();                              //Generate pad dependent tresholds
40   void DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit, Int_t&x, Float_t newclust[6][500], ResponseType res);// Cluster formation method
41   void    Init(Int_t id)           {fSegmentation->Init(id);} // Recalculates all the values after some of them have been changed
42   void    SetGid(Int_t id)         {fGid=id;}           // Set and get GEANT id  
43   Int_t   GetGid()            const{return fGid;}       // Get GEANT id  
44   void SetRInner(Float_t rmin)     {frMin=rmin;}        // Set inner radius of sensitive volume   
45   Float_t RInner()            const{return frMin;}      // Return inner radius of sensitive volume 
46   void SetROuter(Float_t rmax)     {frMax=rmax;}        // Set outer radius of sensitive volum  
47   Float_t ROuter()            const{return frMax;}      // Return outer radius of sensitive volum  
48   void    SetZPOS(Float_t p1)      {fzPos=p1;}
49   Float_t ZPosition()         const{return fzPos;}
50   void              SetGeometryModel(AliRICHGeometry* pRICHGeometry)           {fGeometry=pRICHGeometry;}        
51   AliRICHGeometry*  GetGeometryModel()                                    const{return fGeometry;}
52   void              SetResponseModel(AliRICHResponse* pRICHResponse)            {fResponse=pRICHResponse;}
53   AliRICHResponse*  GetResponseModel()                                     const{return fResponse;}
54   void              SetSegmentationModel(AliSegmentation* pRICHSegmentation)   {fSegmentation=pRICHSegmentation;}
55   AliSegmentation*  GetSegmentationModel(Int_t i=0)                       const{return fSegmentation;}
56   void                  SetReconstructionModel(AliRICHClusterFinder *pRICHReconstruction)    {fReconstruction=pRICHReconstruction;}
57   AliRICHClusterFinder* &GetReconstructionModel()                                            {return fReconstruction;}
58   void   SigGenInit(Float_t x, Float_t y, Float_t z)   {fSegmentation->SigGenInit(x, y, z) ;}
59   Int_t  SigGenCond(Float_t x, Float_t y, Float_t z)    {return fSegmentation->SigGenCond(x, y, z);}
60   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    
61   void   SetPadSize(Float_t p1, Float_t p2)            {fSegmentation->SetPadSize(p1,p2);}
62   Float_t IntPH(Float_t eloss, Float_t yhit)                        {return fResponse->IntPH(eloss,yhit);}
63   Float_t IntPH(Float_t yhit)                                       {return fResponse->IntPH(yhit);}
64   void  SetSigmaIntegration(Float_t p)                             {fResponse->SetSigmaIntegration(p);}
65   void  SetChargeSlope(Float_t p)                                  {fResponse->SetChargeSlope(p);}
66   void  SetChargeSpread(Float_t p1, Float_t p2)                    {fResponse->SetChargeSpread(p1,p2);}
67   void  SetMaxAdc(Float_t p)                                       {fResponse->SetMaxAdc(p);}
68   void  SetSqrtKx3(Float_t p)                                      {fResponse->SetSqrtKx3(p);}
69   void  SetKx2(Float_t p)                                          {fResponse->SetKx2(p);}
70   void  SetKx4(Float_t p)                                          {fResponse->SetKx4(p);}
71   void  SetSqrtKy3(Float_t p)                                      {fResponse->SetSqrtKy3(p);}
72   void  SetKy2(Float_t p)                                          {fResponse->SetKy2(p);}
73   void  SetKy4(Float_t p)                                          {fResponse->SetKy4(p);}    
74   void  SetPitch(Float_t p)                                        {fResponse->SetPitch(p);}
75   void  SetWireSag(Int_t p)                                        {fResponse->SetWireSag(p);}
76   void  SetVoltage(Int_t p)                                        {fResponse->SetVoltage(p);}       
77   void  SetGapThickness(Float_t thickness)                         {fGeometry->SetGapThickness(thickness);} 
78   void  SetProximityGapThickness(Float_t thickness)                {fGeometry->SetProximityGapThickness(thickness);}
79   void  SetQuartzLength(Float_t length)                            {fGeometry->SetQuartzLength(length);}
80   void  SetQuartzWidth(Float_t width)                              {fGeometry->SetQuartzWidth(width);}
81   void  SetQuartzThickness(Float_t thickness)                      {fGeometry->SetQuartzThickness(thickness);}
82   void  SetOuterFreonLength(Float_t length)                        {fGeometry->SetOuterFreonLength(length);}
83   void  SetOuterFreonWidth(Float_t width)                          {fGeometry->SetOuterFreonWidth(width);}
84   void  SetInnerFreonLength(Float_t length)                        {fGeometry->SetInnerFreonLength(length);}
85   void  SetInnerFreonWidth(Float_t width)                          {fGeometry->SetInnerFreonWidth(width);}
86   void  SetFreonThickness(Float_t thickness)                       {fGeometry->SetFreonThickness(thickness);}
87   TRotMatrix* RotMatrix()          const{return fpRotMatrix;}
88   const char* RotMatrixName()      const{return "rot"+fName;}
89   TRotation   Rot()                const{return fRot;}
90   Double_t    Rho()                const{return fCenterV3.Mag();} 
91   Double_t    Theta()              const{return fCenterV3.Theta();}    
92   Double_t    Phi()                const{return fCenterV3.Phi();}    
93   void        RotateX(Double_t a)       {fRot.RotateX(a);fCenterV3.RotateX(a);}
94   void        RotateY(Double_t a)       {fRot.RotateY(a);fCenterV3.RotateY(a);}
95   void        RotateZ(Double_t a)       {fRot.RotateZ(a);fCenterV3.RotateZ(a);}
96   Double_t    X()                  const{return fCenterV3.X();}  
97   Double_t    Y()                  const{return fCenterV3.Y();}   
98   Double_t    Z()                  const{return fCenterV3.Z();}
99   Double_t    GetX()               const{return fX;}
100   Double_t    GetY()               const{return fY;}
101   Double_t    GetZ()               const{return fZ;}    
102   Double_t    GetOffset()          const{return TMath::Sqrt(fX*fX+fY*fY+fZ*fZ);}    
103   inline void SetCenter(Double_t x,Double_t y,Double_t z);
104   TRotMatrix *GetRotMatrix()       const{return fpRotMatrix;}
105   void        SetChamberTransform(Float_t x,Float_t y,Float_t z,TRotMatrix *pRotMatrix) {fX=x; fY=y; fZ=z; fpRotMatrix=pRotMatrix;}
106   
107   virtual void Print(Option_t *sOption)const;      
108 protected:
109   Float_t frMin;                                         // Minimum Chamber size
110   Float_t frMax;                                         // Maximum Chamber size 
111   Int_t   fGid;                                          // Id tag 
112   Float_t fzPos;                                         // z-position of this chamber
113
114   Float_t fX,fY,fZ;                                      // Position of the center of the chamber in MRS (cm)
115
116   AliSegmentation               *fSegmentation;          // ??????????Segmentation model for each chamber
117   AliRICHResponse               *fResponse;              // ??????????Response model for each chamber
118   AliRICHGeometry               *fGeometry;              // ??????????Geometry model for each chamber
119   AliRICHClusterFinder          *fReconstruction;        // ??????????Reconstruction model for each chamber
120    
121   TVector3      fCenterV3;        //chamber center position in MRS (cm)
122   TRotation     fRot;             //chamber rotation in MRS
123   TRotMatrix   *fpRotMatrix;      //rotation matrix of the chamber with respect to MRS 
124   AliRICHParam *fpParam;          //main RICH parameters description  
125   ClassDef(AliRICHChamber,1)      //single RICH chamber description
126 };//class AliRICHChamber
127
128 void AliRICHChamber::SetCenter(Double_t x,Double_t y,Double_t z)
129 {
130   fCenterV3.SetXYZ(x,y,z);
131   fX=x;fY=y;fZ=z;
132 }
133   
134 #endif //AliRICHChamber_h