]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
18 | #include "AliMUONHitMapA1.h" | |
a9e2aefa | 19 | #include "AliMUONDigit.h" |
08ee0858 | 20 | |
8c343c7c | 21 | #include "AliLog.h" |
a9e2aefa | 22 | |
08ee0858 | 23 | #include <TObjArray.h> |
24 | #include <TMath.h> | |
25 | ||
a9e2aefa | 26 | ClassImp(AliMUONHitMapA1) |
27 | ||
30178c30 | 28 | AliMUONHitMapA1::AliMUONHitMapA1() |
29 | : AliHitMap() | |
0a5f9c41 | 30 | { |
31 | // Default constructor | |
0a5f9c41 | 32 | fNpx = 0; |
33 | fNpy = 0; | |
34 | fMaxIndex = 0; | |
35 | ||
36 | fHitMap = 0; | |
37 | fDigits = 0; | |
0a5f9c41 | 38 | } |
e856ab99 | 39 | |
fed772f3 | 40 | //________________________________________________________________________________ |
08ee0858 | 41 | AliMUONHitMapA1::AliMUONHitMapA1(Int_t npx, Int_t npy, TObjArray* dig) |
fed772f3 | 42 | : AliHitMap() |
43 | { | |
44 | // Constructor with new segmentation | |
08ee0858 | 45 | /* |
fed772f3 | 46 | fNpx = seg->Npx(idDE)+1; |
47 | fNpy = seg->Npy(idDE)+1; | |
08ee0858 | 48 | */ |
49 | fNpx = npx; | |
50 | fNpy = npy; | |
fed772f3 | 51 | fMaxIndex=2*(fNpx+1)*2*(fNpy+1)+2*fNpy; |
52 | ||
53 | fHitMap = new Int_t[fMaxIndex]; | |
54 | fDigits = dig; | |
55 | Clear(); | |
56 | } | |
57 | //______________________________________________________________ | |
30178c30 | 58 | AliMUONHitMapA1::AliMUONHitMapA1(const AliMUONHitMapA1 & hitMap) |
59 | : AliHitMap(hitMap) | |
a9e2aefa | 60 | { |
30178c30 | 61 | // Protected copy constructor |
62 | ||
8c343c7c | 63 | AliFatal("Not implemented."); |
a9e2aefa | 64 | } |
fed772f3 | 65 | //_________________________________ |
a9e2aefa | 66 | AliMUONHitMapA1::~AliMUONHitMapA1() |
67 | { | |
68 | // Destructor | |
a9e2aefa | 69 | if (fHitMap) delete[] fHitMap; |
70 | } | |
fed772f3 | 71 | //______________________________________ |
ef42d733 | 72 | void AliMUONHitMapA1::Clear(const char *) |
a9e2aefa | 73 | { |
74 | // Clear hitmap | |
75 | memset(fHitMap,0,sizeof(int)*fMaxIndex); | |
76 | } | |
fed772f3 | 77 | //___________________________________________________ |
d91b86b7 | 78 | Bool_t AliMUONHitMapA1::ValidateHit(Int_t ix, Int_t iy) |
79 | { | |
80 | // | |
81 | // Check if pad coordinates are within boundaries | |
82 | // | |
83 | // printf("\n Validate %d %d %d %d", ix, iy, fNpx, fNpy); | |
84 | ||
85 | return (TMath::Abs(ix) <= fNpx && TMath::Abs(iy) <= fNpy); | |
86 | } | |
fed772f3 | 87 | //_________________________________________________________ |
94de3818 | 88 | Int_t AliMUONHitMapA1::CheckedIndex(Int_t ix, Int_t iy) const |
a9e2aefa | 89 | { |
90 | // Return checked indices ix, iy | |
91 | Int_t index=2*fNpy*(ix+fNpx)+(iy+fNpy); | |
796d78be | 92 | if ( index < 0 || index >= fMaxIndex ) { |
93 | AliWarning(Form("index outside array ix %d iy %d MaxIndex %d index %d Npx %d Npy %d", | |
94 | ix, iy, fMaxIndex, index, fNpx, fNpy)); | |
a9e2aefa | 95 | return fMaxIndex-1; |
96 | } else { | |
97 | return index; | |
98 | } | |
99 | } | |
fed772f3 | 100 | //_____________________________ |
a9e2aefa | 101 | void AliMUONHitMapA1::FillHits() |
102 | { | |
103 | // Fill hits from digits list | |
104 | Int_t ndigits = fDigits->GetEntriesFast(); | |
105 | //printf("\n Filling hits into HitMap\n"); | |
106 | //printf("FindRawClusters -- ndigits %d \n",ndigits); | |
107 | if (!ndigits) return; | |
108 | AliMUONDigit *dig; | |
2186f543 | 109 | for (Int_t ndig=0; ndig<ndigits; ndig++) { |
a9e2aefa | 110 | dig = (AliMUONDigit*)fDigits->UncheckedAt(ndig); |
1939e822 | 111 | SetHit(dig->PadX(),dig->PadY(),ndig); |
a9e2aefa | 112 | } |
113 | } | |
fed772f3 | 114 | //___________________________________________________________ |
a9e2aefa | 115 | void AliMUONHitMapA1::SetHit(Int_t ix, Int_t iy, Int_t idigit) |
116 | { | |
117 | // Assign digit to hit cell ix,iy | |
118 | // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=idigit+1; | |
119 | fHitMap[CheckedIndex(ix, iy)]=idigit+1; | |
120 | } | |
fed772f3 | 121 | //_______________________________________________ |
a9e2aefa | 122 | void AliMUONHitMapA1::DeleteHit(Int_t ix, Int_t iy) |
123 | { | |
124 | // Delete hit at cell ix,iy | |
125 | // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=0; | |
126 | fHitMap[CheckedIndex(ix, iy)]=0; | |
127 | } | |
fed772f3 | 128 | //_____________________________________________ |
a9e2aefa | 129 | void AliMUONHitMapA1::FlagHit(Int_t ix, Int_t iy) |
130 | { | |
131 | // Flag hit as used | |
132 | fHitMap[CheckedIndex(ix, iy)]= | |
133 | -TMath::Abs(fHitMap[CheckedIndex(ix, iy)]); | |
134 | } | |
fed772f3 | 135 | //________________________________________________________ |
94de3818 | 136 | Int_t AliMUONHitMapA1::GetHitIndex(Int_t ix, Int_t iy) const |
a9e2aefa | 137 | { |
138 | // Get absolute value of contents of hit cell ix,iy | |
139 | return TMath::Abs(fHitMap[CheckedIndex(ix, iy)])-1; | |
140 | } | |
fed772f3 | 141 | //_______________________________________________________ |
94de3818 | 142 | TObject* AliMUONHitMapA1::GetHit(Int_t ix, Int_t iy) const |
a9e2aefa | 143 | { |
144 | // Get pointer to object at hit cell ix, iy | |
145 | // Force crash if index does not exist ! (Manu) | |
146 | Int_t index=GetHitIndex(ix,iy); | |
147 | return (index <0) ? 0 : fDigits->UncheckedAt(GetHitIndex(ix,iy)); | |
148 | } | |
fed772f3 | 149 | //_________________________________________________ |
a9e2aefa | 150 | FlagType AliMUONHitMapA1::TestHit(Int_t ix, Int_t iy) |
151 | { | |
152 | // Check if hit cell is empty, used or unused | |
153 | // | |
d24d9982 | 154 | Int_t index = CheckedIndex(ix, iy); |
155 | if (index<0 || index >= fMaxIndex) return kEmpty; | |
156 | ||
157 | Int_t inf=fHitMap[index]; | |
a9e2aefa | 158 | if (inf < 0) { |
159 | return kUsed; | |
160 | } else if (inf == 0) { | |
161 | return kEmpty; | |
162 | } else { | |
163 | return kUnused; | |
164 | } | |
165 | } | |
fed772f3 | 166 | //________________________________________________________________________ |
30178c30 | 167 | AliMUONHitMapA1 & AliMUONHitMapA1::operator = (const AliMUONHitMapA1 & rhs) |
a9e2aefa | 168 | { |
30178c30 | 169 | // Protected assignement operator |
170 | ||
171 | if (this == &rhs) return *this; | |
172 | ||
8c343c7c | 173 | AliFatal( "Not implemented."); |
30178c30 | 174 | |
175 | return *this; | |
a9e2aefa | 176 | } |
177 | ||
178 | ||
bad7e393 | 179 | |
180 | ||
181 |