some minor changes to adpat for the situation when no digits or clusters avalbale
[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   inline   FlagType TestHit(Int_t ix,Int_t iy);                                                                    //virtual
27   void     Print()                          const{fMap->Print();}                                                  
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 padx,Int_t pady)
36 {
37 //Is there a hit for given pad?
38   Int_t inf=(Int_t)(*fMap)(padx,pady);
39   if(inf<0){//flaged as used
40     return kUsed;
41   }else if(inf==0){//no hit 
42     return kEmpty;
43   }else{//index of not yet used hit
44     return kUnused;
45   }
46 }//TestHit()  
47 #endif