new code
[u/mrichter/AliRoot.git] / RICH / AliRICHMap.h
1 #ifndef AliRICHMap_h
2 #define AliRICHMap_h
3
4
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 #include "AliHitMap.h"
9 #include <TMatrix.h>
10 #include <TMath.h>
11 #include <TClonesArray.h>
12
13 class AliRICHMap : public AliHitMap 
14 {    
15 public:
16            AliRICHMap(TClonesArray *pDig);
17   virtual ~AliRICHMap()                          {delete fMap;}
18   void     FillHits();                                           //virtual
19   void     Clear(const char *)                   {fMap->Zero();}                                             //virtual  
20   void     DeleteHit(Int_t ix,Int_t iy)          {(*fMap)(ix,iy)=0;}                                            //virtual
21   void     SetHit(Int_t ix,Int_t iy,Int_t idigit){(*fMap)(ix,iy)=idigit+1;}                                     //virtual  
22   Int_t    GetHitIndex(Int_t ix,Int_t iy)   const{return (Int_t)TMath::Abs((*fMap)(ix, iy))-1;}                       //virtual
23   TObject* GetHit(Int_t ix,Int_t iy)        const{Int_t idx=GetHitIndex(ix,iy);return(idx <0)?0:fDigits->At(idx);} //virtual
24   void     FlagHit(Int_t ix,Int_t iy)            {(*fMap)(ix, iy)=-TMath::Abs((*fMap)(ix,iy));}                          //virtual
25   Bool_t   ValidateHit(Int_t,Int_t)              {return 1;}                                                 //virtual
26   void     Print()                          const{fMap->Print();}
27   inline   FlagType TestHit(Int_t ix,Int_t iy);                                                              //virtual
28 protected:
29   TClonesArray *fDigits;                                 //List of digits
30   Int_t         fNdigits;                                //Number of digits
31   TMatrix      *fMap;                                    //hit map
32   ClassDef(AliRICHMap,0)                                 //Implements map as TMatrix
33 };
34 //__________________________________________________________________________________________________  
35 FlagType AliRICHMap::TestHit(Int_t ix,Int_t iy)
36 {//Is there a hit?
37   Int_t inf=(Int_t)(*fMap)(ix, iy);
38   if(inf<0){//flaged as used
39     return kUsed;
40   }else if(inf==0){//no hit 
41     return kEmpty;
42   }else{//index of not yet used hit
43     return kUnused;
44   }
45 }  
46 #endif