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 **************************************************************************/
20 #include "AliMUONHitMap.h"
21 ClassImp(AliMUONHitMap)
22 ClassImp(AliMUONHitMapA1)
24 AliMUONHitMapA1::AliMUONHitMapA1(AliMUONsegmentation *seg, TObjArray *dig)
27 fNpx = fSegmentation->Npx();
28 fNpy = fSegmentation->Npy();
29 fMaxIndex=2*(fNpx+1)*2*(fNpy+1)+2*fNpy;
31 fHitMap = new Int_t[fMaxIndex];
33 fNdigits = fDigits->GetEntriesFast();
38 AliMUONHitMapA1::~AliMUONHitMapA1()
40 // if (fDigits) delete fDigits;
41 if (fHitMap) delete[] fHitMap;
44 void AliMUONHitMapA1::ClearMap()
46 memset(fHitMap,0,sizeof(int)*fMaxIndex);
49 Int_t AliMUONHitMapA1::CheckedIndex(Int_t ix, Int_t iy)
51 Int_t index=2*fNpy*(ix+fNpx)+(iy+fNpy);
52 if (index > fMaxIndex) {
53 printf("\n \n \n Try to read/write outside array !!!! \n \n %d %d %d %d %d %d",ix,iy, fMaxIndex, index, fNpx, fNpy);
61 void AliMUONHitMapA1::FillHits()
63 Int_t ndigits = fDigits->GetEntriesFast();
64 //printf("\n Filling hits into HitMap\n");
65 //printf("FindRawClusters -- ndigits %d \n",ndigits);
68 for (Int_t ndig=0; ndig<fNdigits; ndig++) {
69 dig = (AliMUONdigit*)fDigits->UncheckedAt(ndig);
70 SetHit(dig->fPadX,dig->fPadY,ndig);
75 void AliMUONHitMapA1::SetHit(Int_t ix, Int_t iy, Int_t idigit)
77 // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=idigit+1;
78 fHitMap[CheckedIndex(ix, iy)]=idigit+1;
81 void AliMUONHitMapA1::DeleteHit(Int_t ix, Int_t iy)
83 // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=0;
84 fHitMap[CheckedIndex(ix, iy)]=0;
87 void AliMUONHitMapA1::FlagHit(Int_t ix, Int_t iy)
89 fHitMap[CheckedIndex(ix, iy)]=
90 -TMath::Abs(fHitMap[CheckedIndex(ix, iy)]);
93 Int_t AliMUONHitMapA1::GetHitIndex(Int_t ix, Int_t iy)
95 return TMath::Abs(fHitMap[CheckedIndex(ix, iy)])-1;
98 TObject* AliMUONHitMapA1::GetHit(Int_t ix, Int_t iy)
100 Int_t index=GetHitIndex(ix,iy);
101 // Force crash if index does not exist ! (Manu)
102 return (index <0) ? 0 : fDigits->UncheckedAt(GetHitIndex(ix,iy));
105 Flag_t AliMUONHitMapA1::TestHit(Int_t ix, Int_t iy)
107 Int_t inf=fHitMap[CheckedIndex(ix, iy)];
110 } else if (inf == 0) {