]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHTresholdMap.cxx
old digits-clusters removed
[u/mrichter/AliRoot.git] / RICH / AliRICHTresholdMap.cxx
CommitLineData
2da3485f 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
2da3485f 16
17
18#include "AliRICHTresholdMap.h"
a2f7eaf6 19#include "AliSegmentation.h"
2da3485f 20
21#include <TObjArray.h>
22#include <TMath.h>
23
24ClassImp(AliRICHTresholdMap)
25
26
a2f7eaf6 27AliRICHTresholdMap::AliRICHTresholdMap(AliSegmentation *seg)
2da3485f 28{
29
30// Constructor for AliRICHTresholdMap
31
32 fSegmentation = seg;
33 fNpx = fSegmentation->Npx();
34 fNpy = fSegmentation->Npy();
35 fMaxIndex=2*(fNpx+1)*2*(fNpy+1)+2*fNpy;
36
37 fHitMap = new Int_t[fMaxIndex];
38 Clear();
39}
40
41
42AliRICHTresholdMap::~AliRICHTresholdMap()
43{
44// Destructor
45// if (fDigits) delete fDigits;
46 if (fHitMap) delete[] fHitMap;
47}
48
cc23c5c6 49void AliRICHTresholdMap::Clear(const char */*opt*/)
2da3485f 50{
51
52// Clear contents of hit map
53
54 memset(fHitMap,0,sizeof(int)*fMaxIndex);
55}
56
a2f7eaf6 57Int_t AliRICHTresholdMap::CheckedIndex(Int_t ix, Int_t iy) const
2da3485f 58{
59
60// Check if index is valid
61
62 Int_t index=2*fNpy*(ix+fNpx)+(iy+fNpy);
63 if (index > fMaxIndex) {
64 printf("\n \n \n Try to read/write outside array !!!! \n \n %d %d %d %d %d %d",ix,iy, fMaxIndex, index, fNpx, fNpy);
65 return fMaxIndex-1;
66 } else {
67 return index;
68 }
69}
70
71
72void AliRICHTresholdMap::FillHits()
73{
74
75// Dummy
76}
77
78
79void AliRICHTresholdMap::SetHit(Int_t ix, Int_t iy, Int_t charge)
80{
81//
82// Set current hit
83// fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=idigit+1;
84
85 fHitMap[CheckedIndex(ix, iy)]=charge;
86}
87
88void AliRICHTresholdMap::DeleteHit(Int_t ix, Int_t iy)
89{
90// Delete hit
91//
92// fHitMap[kMaxNpady*(ix+fNpx)+(iy+fNpy)]=0;
93 fHitMap[CheckedIndex(ix, iy)]=0;
94}
95
96void AliRICHTresholdMap::FlagHit(Int_t ix, Int_t iy)
97{
98//
99// Flag hit
100
101 fHitMap[CheckedIndex(ix, iy)]=
102 -TMath::Abs(fHitMap[CheckedIndex(ix, iy)]);
103}
104
a2f7eaf6 105Int_t AliRICHTresholdMap::GetHitIndex(Int_t ix, Int_t iy) const
2da3485f 106{
107
108// Return hit coordinates from index
109
110 //printf("ix:%d, iy:%d, index:%d\n",ix,iy,CheckedIndex(ix, iy));
111
112 return TMath::Abs(fHitMap[CheckedIndex(ix, iy)]);
113
114}
115
a2f7eaf6 116TObject* AliRICHTresholdMap::GetHit(Int_t ix, Int_t iy) const
2da3485f 117{
118
119// Return index from coordinates
120
121 Int_t index=GetHitIndex(ix,iy);
122 if (index>0)
123 return((TObject*) index);
124 else
125 return((TObject*) 0);
126}
127
128FlagType AliRICHTresholdMap::TestHit(Int_t ix, Int_t iy)
129{
130
131// Is there a hit?
132
133 Int_t inf=fHitMap[CheckedIndex(ix, iy)];
134 if (inf < 0) {
135 return kUsed;
136 } else if (inf == 0) {
137 return kEmpty;
138 } else {
139 return kUnused;
140 }
141}
142