1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
21 #include "AliRICHHitMap.h"
23 ClassImp(AliRICHHitMap)
24 ClassImp(AliRICHHitMapA1)
27 AliRICHHitMapA1::AliRICHHitMapA1(AliRICHSegmentation *seg, TObjArray *dig)
30 fNpx = fSegmentation->Npx();
31 fNpy = fSegmentation->Npy();
32 fMaxIndex=2*(fNpx+1)*2*(fNpy+1)+2*fNpy;
34 fHitMap = new Int_t[fMaxIndex];
36 fNdigits = fDigits->GetEntriesFast();
41 AliRICHHitMapA1::~AliRICHHitMapA1()
43 // if (fDigits) delete fDigits;
44 if (fHitMap) delete[] fHitMap;
47 void AliRICHHitMapA1::Clear()
49 memset(fHitMap,0,sizeof(int)*fMaxIndex);
52 Int_t AliRICHHitMapA1::CheckedIndex(Int_t ix, Int_t iy)
54 Int_t index=2*fNpy*(ix+fNpx)+(iy+fNpy);
55 if (index > fMaxIndex) {
56 printf("\n \n \n Try to read/write outside array !!!! \n \n %d %d %d %d %d %d",ix,iy, fMaxIndex, index, fNpx, fNpy);
64 void AliRICHHitMapA1::FillHits()
66 Int_t ndigits = fDigits->GetEntriesFast();
67 //printf("\n Filling hits into HitMap\n");
68 //printf("FindRawClusters -- ndigits %d \n",ndigits);
71 for (Int_t ndig=0; ndig<fNdigits; ndig++) {
72 dig = (AliRICHDigit*)fDigits->UncheckedAt(ndig);
73 SetHit(dig->fPadX,dig->fPadY,ndig);
78 void AliRICHHitMapA1::SetHit(Int_t ix, Int_t iy, Int_t idigit)
80 // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=idigit+1;
81 fHitMap[CheckedIndex(ix, iy)]=idigit+1;
84 void AliRICHHitMapA1::DeleteHit(Int_t ix, Int_t iy)
86 // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=0;
87 fHitMap[CheckedIndex(ix, iy)]=0;
90 void AliRICHHitMapA1::FlagHit(Int_t ix, Int_t iy)
92 fHitMap[CheckedIndex(ix, iy)]=
93 -TMath::Abs(fHitMap[CheckedIndex(ix, iy)]);
96 Int_t AliRICHHitMapA1::GetHitIndex(Int_t ix, Int_t iy)
98 return TMath::Abs(fHitMap[CheckedIndex(ix, iy)])-1;
101 TObject* AliRICHHitMapA1::GetHit(Int_t ix, Int_t iy)
103 Int_t index=GetHitIndex(ix,iy);
104 // Force crash if index does not exist ! (Manu)
105 return (index <0) ? 0 : fDigits->UncheckedAt(GetHitIndex(ix,iy));
108 Flag_t AliRICHHitMapA1::TestHit(Int_t ix, Int_t iy)
110 Int_t inf=fHitMap[CheckedIndex(ix, iy)];
113 } else if (inf == 0) {