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 **************************************************************************/
18 Revision 1.1.2.2 2000/06/12 07:58:06 morsch
21 Revision 1.1.2.1 2000/06/09 22:01:09 morsch
22 Code from AliMUONHitMap.h
23 Most coding rule violations corrected.
27 #include "AliMUONHitMapA1.h"
28 #include "AliMUONSegmentation.h"
29 #include "AliMUONResponse.h"
30 #include "AliMUONDigit.h"
32 #include <TObjArray.h>
35 ClassImp(AliMUONHitMapA1)
38 AliMUONHitMapA1::AliMUONHitMapA1(AliMUONSegmentation *seg, TObjArray *dig)
42 fNpx = fSegmentation->Npx();
43 fNpy = fSegmentation->Npy();
44 fMaxIndex=2*(fNpx+1)*2*(fNpy+1)+2*fNpy;
46 fHitMap = new Int_t[fMaxIndex];
48 fNdigits = fDigits->GetEntriesFast();
52 AliMUONHitMapA1::AliMUONHitMapA1(const AliMUONHitMapA1 & hitMap)
54 // Dummy copy constructor
59 AliMUONHitMapA1::~AliMUONHitMapA1()
62 // if (fDigits) delete fDigits;
63 if (fHitMap) delete[] fHitMap;
66 void AliMUONHitMapA1::Clear()
69 memset(fHitMap,0,sizeof(int)*fMaxIndex);
72 Int_t AliMUONHitMapA1::CheckedIndex(Int_t ix, Int_t iy)
74 // Return checked indices ix, iy
75 Int_t index=2*fNpy*(ix+fNpx)+(iy+fNpy);
76 if (index > fMaxIndex) {
77 printf("\n \n \n Try to read/write outside array !!!! \n \n %d %d %d %d %d %d",ix,iy, fMaxIndex, index, fNpx, fNpy);
85 void AliMUONHitMapA1::FillHits()
87 // Fill hits from digits list
88 Int_t ndigits = fDigits->GetEntriesFast();
89 //printf("\n Filling hits into HitMap\n");
90 //printf("FindRawClusters -- ndigits %d \n",ndigits);
93 for (Int_t ndig=0; ndig<fNdigits; ndig++) {
94 dig = (AliMUONDigit*)fDigits->UncheckedAt(ndig);
95 SetHit(dig->fPadX,dig->fPadY,ndig);
100 void AliMUONHitMapA1::SetHit(Int_t ix, Int_t iy, Int_t idigit)
102 // Assign digit to hit cell ix,iy
103 // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=idigit+1;
104 fHitMap[CheckedIndex(ix, iy)]=idigit+1;
107 void AliMUONHitMapA1::DeleteHit(Int_t ix, Int_t iy)
109 // Delete hit at cell ix,iy
110 // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=0;
111 fHitMap[CheckedIndex(ix, iy)]=0;
114 void AliMUONHitMapA1::FlagHit(Int_t ix, Int_t iy)
117 fHitMap[CheckedIndex(ix, iy)]=
118 -TMath::Abs(fHitMap[CheckedIndex(ix, iy)]);
121 Int_t AliMUONHitMapA1::GetHitIndex(Int_t ix, Int_t iy)
123 // Get absolute value of contents of hit cell ix,iy
124 return TMath::Abs(fHitMap[CheckedIndex(ix, iy)])-1;
127 TObject* AliMUONHitMapA1::GetHit(Int_t ix, Int_t iy)
129 // Get pointer to object at hit cell ix, iy
130 // Force crash if index does not exist ! (Manu)
131 Int_t index=GetHitIndex(ix,iy);
132 return (index <0) ? 0 : fDigits->UncheckedAt(GetHitIndex(ix,iy));
135 FlagType AliMUONHitMapA1::TestHit(Int_t ix, Int_t iy)
137 // Check if hit cell is empty, used or unused
139 Int_t inf=fHitMap[CheckedIndex(ix, iy)];
142 } else if (inf == 0) {
149 AliMUONHitMapA1 & AliMUONHitMapA1::operator = (const AliMUONHitMapA1 & rhs)
151 // Dummy assignment operator