]>
Commit | Line | Data |
---|---|---|
2134176d | 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 | ||
fb4e90e0 | 17 | //*********************************************************************** |
18 | // | |
9881a682 | 19 | // It consist of a TClonesArray of |
fb4e90e0 | 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 | ||
2134176d | 27 | #include "AliITSpList.h" |
fb4e90e0 | 28 | #include "AliITSpListItem.h" |
29 | ||
2134176d | 30 | |
31 | //______________________________________________________________________ | |
32 | ||
925e6570 | 33 | ClassImp(AliITSpList) |
2134176d | 34 | //______________________________________________________________________ |
e56160b8 | 35 | AliITSpList::AliITSpList(): |
36 | fNi(0), | |
37 | fNj(0), | |
38 | fa(0), | |
39 | fEntries(0){ | |
2134176d | 40 | // Default constructor |
c7d528c6 | 41 | // Inputs: |
42 | // none. | |
43 | // Outputs: | |
44 | // none. | |
45 | // Return: | |
46 | // A zeroed/empty AliITSpList class. | |
2134176d | 47 | |
2134176d | 48 | } |
49 | //______________________________________________________________________ | |
e56160b8 | 50 | AliITSpList::AliITSpList(Int_t imax,Int_t jmax): |
51 | fNi(imax), | |
52 | fNj(jmax), | |
5ff02a9a | 53 | fa(new AliITSpListItem[imax*jmax]), |
e56160b8 | 54 | fEntries(0){ |
2134176d | 55 | // Standard constructor |
c7d528c6 | 56 | // Inputs: |
57 | // none. | |
58 | // Outputs: | |
59 | // none. | |
60 | // Return: | |
61 | // A setup AliITSpList class. | |
2134176d | 62 | |
2134176d | 63 | } |
64 | //______________________________________________________________________ | |
65 | AliITSpList::~AliITSpList(){ | |
66 | // Default destructor | |
67 | ||
5ff02a9a | 68 | delete [] fa; |
69 | fNi = 0; | |
70 | fNj = 0; | |
71 | fEntries = 0; | |
2134176d | 72 | } |
fb4e90e0 | 73 | |
2134176d | 74 | //______________________________________________________________________ |
75 | void AliITSpList::ClearMap(){ | |
9881a682 | 76 | // Delete all AliITSpListItems and zero TClonesArray. |
c7d528c6 | 77 | // Inputs: |
78 | // none. | |
79 | // Outputs: | |
80 | // none. | |
81 | // Return: | |
82 | // A zeroed AliITSpList class. | |
5ff02a9a | 83 | for(Int_t i=0; i<fEntries; i++)(fa[i]).MarkUnused(); |
84 | fEntries = 0; | |
2134176d | 85 | } |
86 | //______________________________________________________________________ | |
87 | void AliITSpList::DeleteHit(Int_t i,Int_t j){ | |
9881a682 | 88 | // Delete a particular AliITSpListItems. |
c7d528c6 | 89 | // Inputs: |
90 | // Int_t i Row number | |
91 | // Int_t j Columns number | |
92 | // Outputs: | |
93 | // none. | |
94 | // Return: | |
95 | // none. | |
2134176d | 96 | Int_t k = GetIndex(i,j); |
5ff02a9a | 97 | if((fa[k]).IsUsed())(fa[k]).MarkUnused(); |
9881a682 | 98 | if(k==fEntries-1) fEntries--; |
2134176d | 99 | } |
100 | //______________________________________________________________________ | |
101 | AliITSpList& AliITSpList::operator=(const AliITSpList &source){ | |
102 | // = operator | |
c7d528c6 | 103 | // Inputs: |
104 | // const AliITSpList &source A AliITSpList object. | |
105 | // Outputs: | |
106 | // none. | |
107 | // Return: | |
108 | // A copied AliITSpList object. | |
2134176d | 109 | |
e56160b8 | 110 | this->~AliITSpList(); |
111 | new(this) AliITSpList(source); | |
112 | return *this; | |
2134176d | 113 | } |
114 | //______________________________________________________________________ | |
e56160b8 | 115 | AliITSpList::AliITSpList(const AliITSpList &source) : AliITSMap(source), |
5ff02a9a | 116 | fNi(source.fNi), |
117 | fNj(source.fNj), | |
118 | fa(new AliITSpListItem[fNi*fNj]), | |
119 | fEntries(source.fEntries){ | |
fb4e90e0 | 120 | // Copy constructor |
5ff02a9a | 121 | for(Int_t i=0; i<fEntries; i++)(fa[i]).Build(source.fa[i]); |
2134176d | 122 | } |
123 | //______________________________________________________________________ | |
c7d528c6 | 124 | void 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(); | |
5ff02a9a | 136 | AliITSpListItem &lit = fa[index]; |
137 | if(!lit.IsUsed())lit.Build(-2,-1,pl->GetModule(),index,0.); | |
138 | lit.AddTo(fileIndex,pl); | |
9881a682 | 139 | if(index>=fEntries) fEntries = index +1; |
c7d528c6 | 140 | } |
141 | //______________________________________________________________________ | |
2134176d | 142 | void AliITSpList::AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod, |
c7d528c6 | 143 | Double_t signal){ |
9881a682 | 144 | // Adds a Signal value to the TClonesArray at i,j. |
145 | // Creates the AliITSpListItem | |
2134176d | 146 | // if needed. |
c7d528c6 | 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. | |
9ce4d38b | 158 | Int_t index = GetIndex(i,j); |
d7f298dd | 159 | if (index<0) return; |
5ff02a9a | 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 | } | |
9881a682 | 167 | if(index>=fEntries) fEntries = index +1; |
2134176d | 168 | } |
169 | //______________________________________________________________________ | |
170 | void AliITSpList::AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise){ | |
9881a682 | 171 | // Adds a noise value to the TClonesArray at i,j. |
172 | // Creates the AliITSpListItem | |
2134176d | 173 | // if needed. |
c7d528c6 | 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. | |
9ce4d38b | 182 | Int_t index = GetIndex(i,j); |
5ff02a9a | 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 | } | |
9881a682 | 191 | if(index>=fEntries) fEntries = index +1; |
2134176d | 192 | } |
193 | //______________________________________________________________________ | |
fb4e90e0 | 194 | void 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; | |
2134176d | 201 | return; |
fb4e90e0 | 202 | } // end if |
203 | i = index/fNj; | |
204 | j = index - fNj*i; | |
205 | return; | |
206 | } |