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.4 2000/07/13 16:19:44 fca
19 Mainly coding conventions + some small bug fixes
21 Revision 1.3 2000/07/03 11:54:57 morsch
22 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
23 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
25 Revision 1.2 2000/06/15 07:58:48 morsch
26 Code from MUON-dev joined
28 Revision 1.1.2.2 2000/06/12 07:58:06 morsch
31 Revision 1.1.2.1 2000/06/09 22:01:09 morsch
32 Code from AliMUONHitMap.h
33 Most coding rule violations corrected.
37 #include "AliMUONHitMapA1.h"
38 #include "AliSegmentation.h"
39 #include "AliMUONResponse.h"
40 #include "AliMUONDigit.h"
42 #include <TObjArray.h>
45 ClassImp(AliMUONHitMapA1)
48 AliMUONHitMapA1::AliMUONHitMapA1(AliSegmentation *seg, TObjArray *dig)
52 fNpx = fSegmentation->Npx();
53 fNpy = fSegmentation->Npy();
54 fMaxIndex=2*(fNpx+1)*2*(fNpy+1)+2*fNpy;
56 fHitMap = new Int_t[fMaxIndex];
58 fNdigits = fDigits->GetEntriesFast();
62 AliMUONHitMapA1::AliMUONHitMapA1(const AliMUONHitMapA1 & hitMap)
64 // Dummy copy constructor
69 AliMUONHitMapA1::~AliMUONHitMapA1()
72 // if (fDigits) delete fDigits;
73 if (fHitMap) delete[] fHitMap;
76 void AliMUONHitMapA1::Clear(const char *)
79 memset(fHitMap,0,sizeof(int)*fMaxIndex);
82 Int_t AliMUONHitMapA1::CheckedIndex(Int_t ix, Int_t iy) const
84 // Return checked indices ix, iy
85 Int_t index=2*fNpy*(ix+fNpx)+(iy+fNpy);
86 if (index > fMaxIndex) {
87 printf("\n \n \n Try to read/write outside array !!!! \n \n %d %d %d %d %d %d",ix,iy, fMaxIndex, index, fNpx, fNpy);
95 void AliMUONHitMapA1::FillHits()
97 // Fill hits from digits list
98 Int_t ndigits = fDigits->GetEntriesFast();
99 //printf("\n Filling hits into HitMap\n");
100 //printf("FindRawClusters -- ndigits %d \n",ndigits);
101 if (!ndigits) return;
103 for (Int_t ndig=0; ndig<fNdigits; ndig++) {
104 dig = (AliMUONDigit*)fDigits->UncheckedAt(ndig);
105 SetHit(dig->fPadX,dig->fPadY,ndig);
110 void AliMUONHitMapA1::SetHit(Int_t ix, Int_t iy, Int_t idigit)
112 // Assign digit to hit cell ix,iy
113 // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=idigit+1;
114 fHitMap[CheckedIndex(ix, iy)]=idigit+1;
117 void AliMUONHitMapA1::DeleteHit(Int_t ix, Int_t iy)
119 // Delete hit at cell ix,iy
120 // fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=0;
121 fHitMap[CheckedIndex(ix, iy)]=0;
124 void AliMUONHitMapA1::FlagHit(Int_t ix, Int_t iy)
127 fHitMap[CheckedIndex(ix, iy)]=
128 -TMath::Abs(fHitMap[CheckedIndex(ix, iy)]);
131 Int_t AliMUONHitMapA1::GetHitIndex(Int_t ix, Int_t iy) const
133 // Get absolute value of contents of hit cell ix,iy
134 return TMath::Abs(fHitMap[CheckedIndex(ix, iy)])-1;
137 TObject* AliMUONHitMapA1::GetHit(Int_t ix, Int_t iy) const
139 // Get pointer to object at hit cell ix, iy
140 // Force crash if index does not exist ! (Manu)
141 Int_t index=GetHitIndex(ix,iy);
142 return (index <0) ? 0 : fDigits->UncheckedAt(GetHitIndex(ix,iy));
145 FlagType AliMUONHitMapA1::TestHit(Int_t ix, Int_t iy)
147 // Check if hit cell is empty, used or unused
149 Int_t inf=fHitMap[CheckedIndex(ix, iy)];
152 } else if (inf == 0) {
159 AliMUONHitMapA1 & AliMUONHitMapA1::operator = (const AliMUONHitMapA1 & rhs)
161 // Dummy assignment operator