]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSpList.cxx
Coding violations corrected.
[u/mrichter/AliRoot.git] / ITS / AliITSpList.cxx
... / ...
CommitLineData
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/* $Id$ */
16
17//***********************************************************************
18//
19// It consist of a TClonesArray of
20// AliITSpListItem objects
21// This array can be accessed via 2 indexed
22// it is used at digitization level by
23// all the 3 ITS subdetectors
24//
25// ***********************************************************************
26
27#include "AliITSpList.h"
28#include "AliITSpListItem.h"
29
30
31//______________________________________________________________________
32
33ClassImp(AliITSpList)
34//______________________________________________________________________
35AliITSpList::AliITSpList():
36fNi(0),
37fNj(0),
38fa(0),
39fEntries(0){
40 // Default constructor
41 // Inputs:
42 // none.
43 // Outputs:
44 // none.
45 // Return:
46 // A zeroed/empty AliITSpList class.
47
48}
49//______________________________________________________________________
50AliITSpList::AliITSpList(Int_t imax,Int_t jmax):
51fNi(imax),
52fNj(jmax),
53fa(new AliITSpListItem[imax*jmax]),
54fEntries(0){
55 // Standard constructor
56 // Inputs:
57 // none.
58 // Outputs:
59 // none.
60 // Return:
61 // A setup AliITSpList class.
62
63}
64//______________________________________________________________________
65AliITSpList::~AliITSpList(){
66 // Default destructor
67
68 delete [] fa;
69 fNi = 0;
70 fNj = 0;
71 fEntries = 0;
72}
73
74//______________________________________________________________________
75void AliITSpList::ClearMap(){
76 // Delete all AliITSpListItems and zero TClonesArray.
77 // Inputs:
78 // none.
79 // Outputs:
80 // none.
81 // Return:
82 // A zeroed AliITSpList class.
83 for(Int_t i=0; i<fEntries; i++)(fa[i]).MarkUnused();
84 fEntries = 0;
85}
86//______________________________________________________________________
87void AliITSpList::DeleteHit(Int_t i,Int_t j){
88 // Delete a particular AliITSpListItems.
89 // Inputs:
90 // Int_t i Row number
91 // Int_t j Columns number
92 // Outputs:
93 // none.
94 // Return:
95 // none.
96 Int_t k = GetIndex(i,j);
97 if((fa[k]).IsUsed())(fa[k]).MarkUnused();
98 if(k==fEntries-1) fEntries--;
99}
100//______________________________________________________________________
101AliITSpList& AliITSpList::operator=(const AliITSpList &source){
102 // = operator
103 // Inputs:
104 // const AliITSpList &source A AliITSpList object.
105 // Outputs:
106 // none.
107 // Return:
108 // A copied AliITSpList object.
109
110 this->~AliITSpList();
111 new(this) AliITSpList(source);
112 return *this;
113}
114//______________________________________________________________________
115AliITSpList::AliITSpList(const AliITSpList &source) : AliITSMap(source),
116fNi(source.fNi),
117fNj(source.fNj),
118fa(new AliITSpListItem[fNi*fNj]),
119fEntries(source.fEntries){
120 // Copy constructor
121 for(Int_t i=0; i<fEntries; i++)(fa[i]).Build(source.fa[i]);
122}
123//______________________________________________________________________
124void AliITSpList::AddItemTo(Int_t fileIndex, AliITSpListItem *pl) {
125 // Adds the contents of pl to the list with track number off set given by
126 // fileIndex.
127 // Creates the AliITSpListItem if needed.
128 // Inputs:
129 // Int_t fileIndex track number offset value
130 // AliITSpListItem *pl an AliITSpListItem to be added to this class.
131 // Outputs:
132 // none.
133 // Return:
134 // none.
135 Int_t index = pl->GetIndex();
136 AliITSpListItem &lit = fa[index];
137 if(!lit.IsUsed())lit.Build(-2,-1,pl->GetModule(),index,0.);
138 lit.AddTo(fileIndex,pl);
139 if(index>=fEntries) fEntries = index +1;
140}
141//______________________________________________________________________
142void AliITSpList::AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,
143 Double_t signal){
144 // Adds a Signal value to the TClonesArray at i,j.
145 // Creates the AliITSpListItem
146 // if needed.
147 // Inputs:
148 // Int_t i Row number for this signal
149 // Int_t j Column number for this signal
150 // Int_t trk Track number creating this signal
151 // Int_t ht Hit number creating this signal
152 // Int_t mod The module where this signal is in
153 // Double_t signal The signal (ionization)
154 // Outputs:
155 // none.
156 // Return:
157 // none.
158 Int_t index = GetIndex(i,j);
159 if (index<0) return;
160 AliITSpListItem &lit = fa[index];
161 if(!lit.IsUsed()){
162 lit.Build(trk,ht,mod,index,signal);
163 }
164 else {
165 lit.AddSignal(trk,ht,mod,index,signal);
166 }
167 if(index>=fEntries) fEntries = index +1;
168}
169//______________________________________________________________________
170void AliITSpList::AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise){
171 // Adds a noise value to the TClonesArray at i,j.
172 // Creates the AliITSpListItem
173 // if needed.
174 // Inputs:
175 // Int_t i Row number for this noise
176 // Int_t j Column number for this noise
177 // Double_t noise The noise signal value.
178 // Outputs:
179 // none.
180 // Return:
181 // none.
182 Int_t index = GetIndex(i,j);
183 if (index<0) return;
184 AliITSpListItem &lit = fa[index];
185 if(!lit.IsUsed()){
186 lit.Build(mod,index,noise);
187 }
188 else {
189 lit.AddNoise(mod,index,noise);
190 }
191 if(index>=fEntries) fEntries = index +1;
192}
193//______________________________________________________________________
194void AliITSpList::GetCell(Int_t index,Int_t &i,Int_t &j) const {
195 // returns the i,j index numbers from the linearized index computed
196 // with GetIndex
197 if(index<0 || index>=fNi*fNj){
198 Warning("GetCell","Index out of range 0<=index=%d<%d",
199 index,fNi*fNj);
200 i=-1;j=-1;
201 return;
202 } // end if
203 i = index/fNj;
204 j = index - fNj*i;
205 return;
206}