]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHitMapA1.cxx
Removal of useless dependecies via forward declarations
[u/mrichter/AliRoot.git] / MUON / AliMUONHitMapA1.cxx
CommitLineData
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
16/*
17$Log$
94de3818 18Revision 1.4 2000/07/13 16:19:44 fca
19Mainly coding conventions + some small bug fixes
20
ef42d733 21Revision 1.3 2000/07/03 11:54:57 morsch
22AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
23The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
24
a30a000f 25Revision 1.2 2000/06/15 07:58:48 morsch
26Code from MUON-dev joined
27
a9e2aefa 28Revision 1.1.2.2 2000/06/12 07:58:06 morsch
29include TMath.h
30
31Revision 1.1.2.1 2000/06/09 22:01:09 morsch
32Code from AliMUONHitMap.h
33Most coding rule violations corrected.
34
35*/
36
37#include "AliMUONHitMapA1.h"
a30a000f 38#include "AliSegmentation.h"
a9e2aefa 39#include "AliMUONResponse.h"
40#include "AliMUONDigit.h"
41
42#include <TObjArray.h>
43#include <TMath.h>
44
45ClassImp(AliMUONHitMapA1)
46
47
a30a000f 48AliMUONHitMapA1::AliMUONHitMapA1(AliSegmentation *seg, TObjArray *dig)
a9e2aefa 49{
50// Constructor
51 fSegmentation = seg;
52 fNpx = fSegmentation->Npx();
53 fNpy = fSegmentation->Npy();
54 fMaxIndex=2*(fNpx+1)*2*(fNpy+1)+2*fNpy;
55
56 fHitMap = new Int_t[fMaxIndex];
57 fDigits = dig;
58 fNdigits = fDigits->GetEntriesFast();
59 Clear();
60}
61
62AliMUONHitMapA1::AliMUONHitMapA1(const AliMUONHitMapA1 & hitMap)
63{
64// Dummy copy constructor
65 ;
66}
67
68
69AliMUONHitMapA1::~AliMUONHitMapA1()
70{
71// Destructor
72// if (fDigits) delete fDigits;
73 if (fHitMap) delete[] fHitMap;
74}
75
ef42d733 76void AliMUONHitMapA1::Clear(const char *)
a9e2aefa 77{
78// Clear hitmap
79 memset(fHitMap,0,sizeof(int)*fMaxIndex);
80}
81
94de3818 82Int_t AliMUONHitMapA1::CheckedIndex(Int_t ix, Int_t iy) const
a9e2aefa 83{
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);
88 return fMaxIndex-1;
89 } else {
90 return index;
91 }
92}
93
94
95void AliMUONHitMapA1::FillHits()
96{
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;
102 AliMUONDigit *dig;
103 for (Int_t ndig=0; ndig<fNdigits; ndig++) {
104 dig = (AliMUONDigit*)fDigits->UncheckedAt(ndig);
105 SetHit(dig->fPadX,dig->fPadY,ndig);
106 }
107}
108
109
110void AliMUONHitMapA1::SetHit(Int_t ix, Int_t iy, Int_t idigit)
111{
112// Assign digit to hit cell ix,iy
113// fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=idigit+1;
114 fHitMap[CheckedIndex(ix, iy)]=idigit+1;
115}
116
117void AliMUONHitMapA1::DeleteHit(Int_t ix, Int_t iy)
118{
119// Delete hit at cell ix,iy
120// fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=0;
121 fHitMap[CheckedIndex(ix, iy)]=0;
122}
123
124void AliMUONHitMapA1::FlagHit(Int_t ix, Int_t iy)
125{
126// Flag hit as used
127 fHitMap[CheckedIndex(ix, iy)]=
128 -TMath::Abs(fHitMap[CheckedIndex(ix, iy)]);
129}
130
94de3818 131Int_t AliMUONHitMapA1::GetHitIndex(Int_t ix, Int_t iy) const
a9e2aefa 132{
133// Get absolute value of contents of hit cell ix,iy
134 return TMath::Abs(fHitMap[CheckedIndex(ix, iy)])-1;
135}
136
94de3818 137TObject* AliMUONHitMapA1::GetHit(Int_t ix, Int_t iy) const
a9e2aefa 138{
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));
143}
144
145FlagType AliMUONHitMapA1::TestHit(Int_t ix, Int_t iy)
146{
147// Check if hit cell is empty, used or unused
148//
149 Int_t inf=fHitMap[CheckedIndex(ix, iy)];
150 if (inf < 0) {
151 return kUsed;
152 } else if (inf == 0) {
153 return kEmpty;
154 } else {
155 return kUnused;
156 }
157}
158
159AliMUONHitMapA1 & AliMUONHitMapA1::operator = (const AliMUONHitMapA1 & rhs)
160{
161// Dummy assignment operator
162 return *this;
163}
164
165