]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICH.h
New geometry 2-3-2 introduced
[u/mrichter/AliRoot.git] / RICH / AliRICH.h
1 #ifndef AliRICH_h
2 #define AliRICH_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
10 #include <TObjArray.h>
11 #include <TClonesArray.h>
12 #include <AliDetector.h>
13 #include <AliHit.h>
14 #include <AliDigit.h>
15 #include "AliRICHConst.h"
16 #include "AliRICHChamber.h"
17
18 static const int kNCH=7;
19
20 class TFile;
21
22 class AliRICHRawCluster;
23 class AliRICHRecHit1D;
24 class AliRICHRecHit3D;
25 class AliRICHClusterFinder;
26 class AliRICHDetect;
27 class AliRICHChamber;
28 class AliRICHCerenkov;
29 class AliSegmentation;
30 class AliRICHResponse;
31 class AliRICHGeometry;
32 class AliRICHMerger;
33
34
35
36 class AliRICHhit : public AliHit
37 {
38 public:
39   inline   AliRICHhit();
40   inline   AliRICHhit(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *hits);
41   virtual ~AliRICHhit()         {;}
42     
43   Int_t   Chamber()             {return fChamber;}
44   Float_t Particle()            {return fParticle;}    
45   Float_t Theta()               {return fTheta;}
46   Float_t Phi()                 {return fPhi;}
47   Float_t Tlength()             {return fTlength;}
48   Float_t Eloss()               {return fEloss;}
49   Float_t Loss()                {return fLoss;}
50   Float_t   PHfirst()           {return fPHfirst;}
51   Float_t   PHlast()            {return fPHlast;}
52   Float_t MomX()                {return fMomX;}
53   Float_t MomY()                {return fMomY;}
54   Float_t MomZ()                {return fMomZ;}
55   Float_t CerenkovAngle()       {return fMomX;}
56   Float_t MomFreoX()            {return fMomX;}
57   Float_t MomFreoY()            {return fMomY;}
58   Float_t MomFreoZ()            {return fMomZ;}
59 protected:
60   Int_t     fChamber;       // Chamber number
61   Float_t   fParticle;      // Geant3 particle type
62   Float_t   fTheta ;        // Incident theta angle in degrees      
63   Float_t   fPhi   ;        // Incident phi angle in degrees
64   Float_t   fTlength;       // Track length inside the chamber
65   Float_t   fEloss;         // ionisation energy loss in gas   
66   Float_t   fPHfirst;       // first padhit
67   Float_t   fPHlast;        // last padhit
68   Float_t   fLoss;          // did it hit the freon?
69   Float_t   fMomX;          // x Momentum at photochatode entry point
70   Float_t   fMomY;          // y Momentum at photochatode entry point
71   Float_t   fMomZ;          // z Momentum at photochatode entry point
72   Float_t   fNPads;         // Pads hit
73   Float_t   fCerenkovAngle; // Dummy cerenkov angle
74   Float_t   fMomFreoX;      // x Momentum at freon entry point
75   Float_t   fMomFreoY;      // y Momentum at freon entry point
76   Float_t   fMomFreoZ;      // z Momentum at freon entry point             
77         
78   ClassDef(AliRICHhit,1)  //RICH hit class
79 };//class AliRICHhit
80 //______________________________________________________________________________  
81 AliRICHhit::AliRICHhit()
82            :AliHit() 
83 {//default ctor  
84   fChamber=-1;
85   fParticle=fTheta=fPhi=fTlength=fEloss=fPHfirst=fPHlast=fLoss=-1;
86   fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=fMomFreoX=fMomFreoY=fMomFreoZ=-1;
87 }//AliRICHhit::default ctor
88 //______________________________________________________________________________
89 AliRICHhit::AliRICHhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
90             AliHit(shunt, track)
91 {//ctor
92   fChamber=vol[0];
93   fParticle=hits[0];
94   fX=hits[1];
95   fY=hits[2];
96   fZ=hits[3];
97   fTheta=hits[4];
98   fPhi=hits[5];
99   fTlength=hits[6];
100   fEloss=hits[7];
101   fPHfirst=(Int_t) hits[8];
102   fPHlast=(Int_t) hits[9];
103   fLoss=hits[13];
104   fMomX=hits[14];
105   fMomY=hits[15];
106   fMomZ=hits[16];
107   fNPads=hits[17];
108   fCerenkovAngle=hits[18];
109   fMomFreoX=hits[19];
110   fMomFreoY=hits[20];
111   fMomFreoZ=hits[21];
112 }//AliRICHhit::ctor
113 //______________________________________________________________________________
114 //______________________________________________________________________________
115 //______________________________________________________________________________
116 class AliRICHCerenkov: public AliHit 
117 {
118 public:
119   inline   AliRICHCerenkov();
120   inline   AliRICHCerenkov(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *Cerenkovs);
121   virtual ~AliRICHCerenkov() {;}
122 public:
123   Int_t     fChamber;         // Chamber number
124   Float_t   fTheta ;          // Incident theta angle in degrees      
125   Float_t   fPhi   ;          // Incident phi angle in degrees
126   Float_t   fTlength;         // Track length inside the chamber
127   Float_t   fEloss;           // ionisation energy loss in gas
128   Int_t     fPHfirst;         // first padhit
129   Int_t     fPHlast;          // last padhit
130   Int_t     fCMother;         // index of mother particle
131   Float_t   fLoss;            // nature of particle loss
132   Float_t   fIndex;           // Index of photon
133   Float_t   fProduction;      // Point of production
134   Float_t   fMomX;            // Local Momentum
135   Float_t   fMomY;            // Local Momentum
136   Float_t   fMomZ;            // Local Momentum
137   Float_t   fNPads;           // Pads hit
138   Float_t   fCerenkovAngle;   // Cerenkov Angle
139     
140   ClassDef(AliRICHCerenkov,1)  //RICH cerenkov class
141 };//class AliRICHCerenkov
142 //______________________________________________________________________________
143 AliRICHCerenkov::AliRICHCerenkov()
144 {//ctor
145     fChamber=-1;
146     fX=fY=fZ=fTheta=fPhi=fTlength=fEloss=-1;
147     fPHfirst=fPHlast=fCMother=-1;
148     fLoss=fIndex=fProduction=fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=-1;
149 }//AliRICHCerenkov::ctor
150 //______________________________________________________________________________
151 AliRICHCerenkov::AliRICHCerenkov(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
152                 :AliHit(shunt, track)
153 {//ctor
154     fChamber=vol[0];
155     fX=hits[1];
156     fY=hits[2];
157     fZ=hits[3];
158     fTheta=hits[4];
159     fPhi=hits[5];
160     fTlength=hits[6];
161     fEloss=hits[7];
162     fPHfirst=(Int_t) hits[8];
163     fPHlast=(Int_t) hits[9];
164     fCMother=Int_t(hits[10]);
165     fIndex = hits[11];
166     fProduction = hits[12];  
167     fLoss=hits[13];
168     fMomX=hits[14];
169     fMomY=hits[15];
170     fMomZ=hits[16];
171     fNPads=hits[17];
172     fCerenkovAngle=hits[18];
173 }//AliRICHCerenkov::ctor
174 //______________________________________________________________________________
175 //______________________________________________________________________________
176 //______________________________________________________________________________
177 class AliRICHdigit :public AliDigit
178 {
179 public:
180            AliRICHdigit() {fPadX=fPadY=fChamber=fAdc=fTracks[0]=fTracks[1]=fTracks[2]=-1;}
181   inline   AliRICHdigit(Int_t iC,Int_t iX,Int_t iY,Int_t iAdc,Int_t iT1,Int_t iT2,Int_t iT3);
182   virtual ~AliRICHdigit() {;}  
183   Int_t C()   const{return fChamber;}
184   Int_t X()   const{return fPadX;}
185   Int_t Y()   const{return fPadY;}
186   Int_t Adc() const{return fAdc;}
187 protected:
188   Int_t fChamber;  //module number 
189   Int_t fPadX;    //pad number along X
190   Int_t fPadY;    //pad number along Y
191   Int_t fAdc;     //ADC value
192   ClassDef(AliRICHdigit,1) //RICH digit class       
193 };//class AliRICHdigit
194 //______________________________________________________________________________
195 AliRICHdigit::AliRICHdigit(Int_t iC,Int_t iX,Int_t iY,Int_t iAdc,Int_t iT0,Int_t iT1,Int_t iT2)
196 {
197   fChamber=iC;fPadX=iX;fPadY=iY;fAdc=iAdc;
198   fTracks[0]=iT0;fTracks[1]=iT1;fTracks[2]=iT2;
199 }//AliRICHdigit::ctor  
200 //______________________________________________________________________________
201 //______________________________________________________________________________
202 //______________________________________________________________________________
203 class AliRICHParam;
204 class AliRICHSDigit;
205
206 class AliRICH : public AliDetector 
207 {
208 public:
209             AliRICH();                                            
210             AliRICH(const char *name, const char *title);         
211             AliRICH(const AliRICH& RICH):AliDetector(RICH) {;}   
212   virtual  ~AliRICH();                                            
213           
214   AliRICH&  operator=(const AliRICH&)                 {return *this;}
215   virtual Int_t  IsVersion()const =0;            
216   AliRICHParam *Param()                               {return fpParam;}
217   inline  void  AddHit(Int_t track, Int_t *vol, Float_t *hits);//virtual
218   inline  void  AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs);
219   inline  void  AddSDigit(Int_t iC,Int_t iX,Int_t iY,Int_t iAdc,Int_t iT0,Int_t iT1=-1,Int_t iT2=-1);
220   inline  void  ResetHits();    //virtual
221   inline  void  ResetSDigits(); //virtual
222           void  Hits2SDigits(); //virtual 
223           
224   TClonesArray  *SDigits()                       const{return fSDigits;}
225   TClonesArray  *Cerenkovs()                     const{return fCerenkovs;}
226           void    CreateChambers();         
227   virtual void    CreateMaterials(); //GEANT materials definition
228           Float_t AbsoCH4(Float_t x);
229           Float_t Fresnel(Float_t ene,Float_t pdoti, Bool_t pola);
230   virtual void    BuildGeometry();   //TNode ROOT variant for event display
231   virtual void    CreateGeometry();  //GEANT volumes tree for simulation  
232   virtual void    StepManager()=0;
233   
234   AliRICHChamber* C(Int_t i)        const{return (AliRICHChamber*)fChambers->At(i);}//return pointer to requested chamber
235   AliRICHChamber& Chamber(Int_t id)      {return *((AliRICHChamber *) (*fChambers)[id]);}
236   TObjArray*      Chambers()        const{return fChambers;}
237   
238         void  AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits);
239           void  AddRawCluster(Int_t id, const AliRICHRawCluster& cluster);
240           void  AddRecHit1D(Int_t id, Float_t* rechit, Float_t* photons, Int_t* padsx, Int_t* padsy);
241           void  AddRecHit3D(Int_t id, Float_t* rechit, Float_t omega, Float_t theta, Float_t phi);
242           void  ResetDigits();  //virtual
243           void  ResetRawClusters();
244           void  ResetRecHits1D();
245           void  ResetRecHits3D();
246   virtual void  FindClusters(Int_t nev);
247           Int_t Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss,Int_t id, ResponseType res);//kir ????? to be  removed
248   virtual void  SDigits2Digits();
249   virtual void  Digits2Reco();   
250           Int_t    DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/)      {return 9999;}
251    
252   virtual void   MakeBranch(Option_t *opt=" ");
253   virtual void   MakeBranchInTreeD(TTree *treeD, const char *file=0);
254   virtual void   SetTreeAddress();
255    
256      
257    
258   AliRICHSDigit* FirstPad(AliRICHhit *hit, TClonesArray *clusters);
259   AliRICHSDigit* NextPad(TClonesArray *clusters);
260    
261
262   void     SetGeometryModel(Int_t iC,AliRICHGeometry *pRICHGeo)                    {C(iC)->SetGeometryModel(pRICHGeo);}
263   void     SetSegmentationModel(Int_t iC, AliSegmentation *pAliSeg)                {C(iC)->SetSegmentationModel(pAliSeg);}
264   void     SetResponseModel(Int_t iC, AliRICHResponse *pRICHRes)                   {C(iC)->SetResponseModel(pRICHRes);}
265   void     SetReconstructionModel(Int_t iC, AliRICHClusterFinder *pRICHReco)       {C(iC)->SetReconstructionModel(pRICHReco);}
266   AliRICHGeometry* GetGeometryModel(Int_t iC=0)                               const{return C(iC)->GetGeometryModel();}    
267   AliSegmentation* GetSegmentationModel(Int_t iC=0)                           const{return C(iC)->GetSegmentationModel();}
268   AliRICHResponse* GetResponseModel(Int_t iC)                                 const{return C(iC)->GetResponseModel();}
269
270 //kir  virtual void   SetMerger(AliRICHMerger* thisMerger) {fMerger=thisMerger;}  
271   
272   TObjArray     *Dchambers()                     {return fDchambers;}
273   TObjArray     *RecHits3D()                const{return fRecHits3D;}
274   TObjArray     *RecHits1D()                const{return fRecHits1D;}
275   Int_t         *Ndch()                          {return fNdch;}
276   Int_t         *Nrechits1D()                    {return fNrechits1D;} 
277   Int_t         *Nrechits3D()                    {return fNrechits3D;} 
278   TClonesArray  *DigitsAddress(Int_t id)         {return ((TClonesArray *) (*fDchambers)[id]);}
279   TClonesArray  *RecHitsAddress1D(Int_t id) const{return ((TClonesArray *) (*fRecHits1D)[id]);}
280   TClonesArray  *RecHitsAddress3D(Int_t id) const{return ((TClonesArray *) (*fRecHits3D)[id]);}
281   TClonesArray  *RawClustAddress(Int_t id)  const{return ((TClonesArray *) (*fRawClusters)[id]);}    
282
283   void DiagnosticsFE(Int_t evNumber1=0,Int_t evNumber2=0);    // Full events
284   void DiagnosticsSE(Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0);    // Single events
285  
286   virtual void Print(Option_t *option)const; // Prints debug information
287     
288 protected:
289   AliRICHParam         *fpParam;              //main RICH parametrization     
290   TObjArray            *fChambers;           //! List of RICH chambers
291   Int_t                 fNsdigits;           //Current number of sdigits
292   Int_t                 fNcerenkovs;         //Current number of cerenkovs
293   TClonesArray         *fSDigits;            //! List of sdigits
294   TObjArray            *fDchambers;          //! Array of lists of digits
295   TClonesArray         *fCerenkovs;          //! List of cerenkovs
296   Int_t                 fNdch[kNCH];         //Array of current numbers of digits
297   TObjArray            *fRawClusters;        // !List of raw clusters
298   TObjArray            *fRecHits1D;          // !List of rec. hits
299   TObjArray            *fRecHits3D;          // !List of rec. hits
300   Int_t                 fNrawch[kNCH];       //Array of current numbers of raw clusters
301   Int_t                 fNrechits1D[kNCH];   //Array of current numbers of rec hits 1D
302   Int_t                 fNrechits3D[kNCH];   //Array of current numbers of rec hits 3D 
303
304   Int_t fCkovNumber;                         // Number of Cerenkov photons
305   Int_t fFreonProd;                          // Cerenkovs produced in freon
306   Int_t fFeedbacks;                          // Number of feedback photons
307 //kir  Int_t fCkovQuarz;                          // Cerenkovs crossing quartz
308 //kir  Int_t fCkovGap;                            // Cerenkovs crossing gap
309 //kir  Int_t fCkovCsi;                            // Cerenkovs crossing csi
310 //kir  Int_t fLostRfreo;                          // Cerenkovs reflected in freon
311 //kir  Int_t fLostRquar;                          // Cerenkovs reflected in quartz
312 //kir  Int_t fLostAfreo;                          // Cerenkovs absorbed in freon 
313 //kir  Int_t fLostAquarz;                         // Cerenkovs absorbed in quartz
314 //kir  Int_t fLostAmeta;                          // Cerenkovs absorbed in methane
315 //kir  Int_t fLostCsi;                            // Cerenkovs below csi quantum efficiency 
316 //kir  Int_t fLostWires;                          // Cerenkovs lost in wires
317 //kir  Float_t fMipx;                             // x coord. of MIP
318 //kir  Float_t fMipy;                             // y coord. of MIP
319 //kir  Int_t fLostFresnel;                        // Cerenkovs lost by Fresnel reflection
320
321 //kir  Text_t *fFileName;                         //! File with background hits
322 //kir  AliRICHMerger *fMerger;                    //! pointer to merger
323     
324   ClassDef(AliRICH,2)                        //Main RICH class 
325 };//class AliRICH
326
327 //______________________________________________________________________________
328 void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits)
329 {//Adds the current hit to the RICH hits list
330   TClonesArray &tmp=*fHits;
331   new(tmp[fNhits++])AliRICHhit(fIshunt,track,vol,hits);
332 }
333 //______________________________________________________________________________
334 void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
335 {//Adds the current RICH cerenkov hit to the Cerenkovs list   
336   TClonesArray &tmp=*fCerenkovs;
337   new(tmp[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs);
338 }
339 //______________________________________________________________________________
340 void AliRICH::ResetHits()
341 {//Resets hits and cerenkovs
342   AliDetector::ResetHits();
343   fNcerenkovs = 0;
344   if(fCerenkovs)fCerenkovs->Clear();
345 }
346 //______________________________________________________________________________
347 void AliRICH::AddSDigit(Int_t iC,Int_t iX,Int_t iY,Int_t iAdc,Int_t iT0,Int_t iT1,Int_t iT2)
348 {//Adds the current Sdigit to the RICH list of Sdigits   
349   TClonesArray &tmp = *fSDigits;
350   new(tmp[fNsdigits++])AliRICHdigit(iC,iX,iY,iAdc,iT0,iT1,iT2);
351
352 //______________________________________________________________________________    
353 void AliRICH::ResetSDigits()
354 {//Resets sdigits
355   fNsdigits=0;
356   if(fSDigits)fSDigits->Clear();
357 }
358 //______________________________________________________________________________
359 #endif