Line data Source code
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 :
33 118 : ClassImp(AliITSpList)
34 : //______________________________________________________________________
35 0 : AliITSpList::AliITSpList():
36 0 : fNi(0),
37 0 : fNj(0),
38 0 : fa(0),
39 0 : fEntries(0){
40 : // Default constructor
41 : // Inputs:
42 : // none.
43 : // Outputs:
44 : // none.
45 : // Return:
46 : // A zeroed/empty AliITSpList class.
47 :
48 0 : }
49 : //______________________________________________________________________
50 3 : AliITSpList::AliITSpList(Int_t imax,Int_t jmax):
51 3 : fNi(imax),
52 3 : fNj(jmax),
53 1133580 : fa(new AliITSpListItem[imax*jmax]),
54 18 : fEntries(0){
55 : // Standard constructor
56 : // Inputs:
57 : // none.
58 : // Outputs:
59 : // none.
60 : // Return:
61 : // A setup AliITSpList class.
62 :
63 6 : }
64 : //______________________________________________________________________
65 18 : AliITSpList::~AliITSpList(){
66 : // Default destructor
67 :
68 566793 : delete [] fa;
69 3 : fNi = 0;
70 3 : fNj = 0;
71 3 : fEntries = 0;
72 9 : }
73 :
74 : //______________________________________________________________________
75 : void 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 201553470 : for(Int_t i=0; i<fEntries; i++)(fa[i]).MarkUnused();
84 9850 : fEntries = 0;
85 9850 : }
86 : //______________________________________________________________________
87 : void 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 12845056 : Int_t k = GetIndex(i,j);
97 6423005 : if((fa[k]).IsUsed())(fa[k]).MarkUnused();
98 6422542 : if(k==fEntries-1) fEntries--;
99 6422528 : }
100 : //______________________________________________________________________
101 : AliITSpList& 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 0 : this->~AliITSpList();
111 0 : new(this) AliITSpList(source);
112 0 : return *this;
113 0 : }
114 : //______________________________________________________________________
115 0 : AliITSpList::AliITSpList(const AliITSpList &source) : AliITSMap(source),
116 0 : fNi(source.fNi),
117 0 : fNj(source.fNj),
118 0 : fa(new AliITSpListItem[fNi*fNj]),
119 0 : fEntries(source.fEntries){
120 : // Copy constructor
121 0 : for(Int_t i=0; i<fEntries; i++)(fa[i]).Build(source.fa[i]);
122 0 : }
123 : //______________________________________________________________________
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 12845056 : Int_t index = pl->GetIndex();
136 6422528 : AliITSpListItem &lit = fa[index];
137 12845056 : if(!lit.IsUsed())lit.Build(-2,-1,pl->GetModule(),index,0.);
138 6422528 : lit.AddTo(fileIndex,pl);
139 9548449 : if(index>=fEntries) fEntries = index +1;
140 6422528 : }
141 : //______________________________________________________________________
142 : void 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 1111728 : Int_t index = GetIndex(i,j);
159 555864 : if (index<0) return;
160 555864 : AliITSpListItem &lit = fa[index];
161 555864 : if(!lit.IsUsed()){
162 14660 : lit.Build(trk,ht,mod,index,signal);
163 14660 : }
164 : else {
165 541204 : lit.AddSignal(trk,ht,mod,index,signal);
166 : }
167 566812 : if(index>=fEntries) fEntries = index +1;
168 1111728 : }
169 : //______________________________________________________________________
170 : void 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 98635892 : Int_t index = GetIndex(i,j);
183 49317946 : if (index<0) return;
184 49317946 : AliITSpListItem &lit = fa[index];
185 49317946 : if(!lit.IsUsed()){
186 47582778 : lit.Build(mod,index,noise);
187 47582778 : }
188 : else {
189 1735168 : lit.AddNoise(mod,index,noise);
190 : }
191 91781338 : if(index>=fEntries) fEntries = index +1;
192 98635892 : }
193 : //______________________________________________________________________
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 0 : if(index<0 || index>=fNi*fNj){
198 0 : Warning("GetCell","Index out of range 0<=index=%d<%d",
199 0 : index,fNi*fNj);
200 0 : i=-1;j=-1;
201 0 : return;
202 : } // end if
203 0 : i = index/fNj;
204 0 : j = index - fNj*i;
205 0 : return;
206 0 : }
|