]>
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 | ||
17 | #include <stdio.h> | |
18 | #include <stdlib.h> | |
4ae5bbc4 | 19 | #include <Riostream.h> |
2134176d | 20 | #include <TObjArray.h> |
21 | #include <TRandom.h> | |
22 | #include <TMath.h> | |
23 | ||
24 | #include "AliITSpList.h" | |
25 | ||
26 | //______________________________________________________________________ | |
27 | ||
28 | ClassImp(AliITSpList); | |
29 | //______________________________________________________________________ | |
30 | AliITSpList::AliITSpList(){ | |
31 | // Default constructor | |
c7d528c6 | 32 | // Inputs: |
33 | // none. | |
34 | // Outputs: | |
35 | // none. | |
36 | // Return: | |
37 | // A zeroed/empty AliITSpList class. | |
2134176d | 38 | |
39 | fNi = 0; | |
40 | fNj = 0; | |
41 | fa = 0; | |
42 | } | |
43 | //______________________________________________________________________ | |
44 | AliITSpList::AliITSpList(Int_t imax,Int_t jmax){ | |
45 | // Standard constructor | |
c7d528c6 | 46 | // Inputs: |
47 | // none. | |
48 | // Outputs: | |
49 | // none. | |
50 | // Return: | |
51 | // A setup AliITSpList class. | |
2134176d | 52 | |
53 | fNi = imax; | |
54 | fNj = jmax; | |
9ce4d38b | 55 | fEnteries = 0; |
2134176d | 56 | fa = new TObjArray(fNi*fNj); // elements are zeroed by |
57 | // TObjArray creator | |
58 | } | |
59 | //______________________________________________________________________ | |
60 | AliITSpList::~AliITSpList(){ | |
61 | // Default destructor | |
c7d528c6 | 62 | // Inputs: |
63 | // none. | |
64 | // Outputs: | |
65 | // none. | |
66 | // Return: | |
67 | // a properly destroyed class | |
2134176d | 68 | |
69 | for(Int_t i=0;i<GetMaxIndex();i++) if(fa->At(i)!=0){ | |
c7d528c6 | 70 | delete fa->At(i); |
71 | fa->AddAt(0,i); // zero content | |
2134176d | 72 | } // end for i && if |
73 | fNi = 0; | |
74 | fNj = 0; | |
75 | delete fa; | |
76 | fa = 0; | |
9ce4d38b | 77 | fEnteries = 0; |
2134176d | 78 | } |
79 | //______________________________________________________________________ | |
80 | void AliITSpList::ClearMap(){ | |
81 | // Delete all AliITSpListItems and zero TObjArray. | |
c7d528c6 | 82 | // Inputs: |
83 | // none. | |
84 | // Outputs: | |
85 | // none. | |
86 | // Return: | |
87 | // A zeroed AliITSpList class. | |
2134176d | 88 | |
9ce4d38b | 89 | fa->Delete(); |
cab0142f | 90 | /* |
91 | for(Int_t i=0;i<GetMaxIndex();i++) if(fa->At(i)!=0){ | |
92 | delete fa->At(i); | |
93 | fa->AddAt(0,i); // zero content | |
94 | } // end for i && if | |
95 | */ | |
9ce4d38b | 96 | fEnteries = 0; |
2134176d | 97 | } |
98 | //______________________________________________________________________ | |
99 | void AliITSpList::DeleteHit(Int_t i,Int_t j){ | |
100 | // Delete a particular AliITSpListItems and zero TObjArray. | |
c7d528c6 | 101 | // Inputs: |
102 | // Int_t i Row number | |
103 | // Int_t j Columns number | |
104 | // Outputs: | |
105 | // none. | |
106 | // Return: | |
107 | // none. | |
2134176d | 108 | Int_t k = GetIndex(i,j); |
109 | ||
110 | if(fa->At(k)!=0){ | |
c7d528c6 | 111 | delete fa->At(k); |
112 | fa->AddAt(0,k); // zero content | |
2134176d | 113 | } // end for i && if |
9ce4d38b | 114 | if(k==fEnteries-1) fEnteries--; |
2134176d | 115 | } |
116 | //______________________________________________________________________ | |
117 | AliITSpList& AliITSpList::operator=(const AliITSpList &source){ | |
118 | // = operator | |
c7d528c6 | 119 | // Inputs: |
120 | // const AliITSpList &source A AliITSpList object. | |
121 | // Outputs: | |
122 | // none. | |
123 | // Return: | |
124 | // A copied AliITSpList object. | |
2134176d | 125 | |
126 | if(this == &source) return *this; | |
127 | ||
128 | if(this->fa!=0){ // if this->fa exists delete it first. | |
c7d528c6 | 129 | for(Int_t i=0;i<GetMaxIndex();i++) if(fa->At(i)!=0){ |
130 | delete fa->At(i); | |
131 | fa->AddAt(0,i); // zero content | |
132 | } // end for i && if | |
133 | delete this->fa; | |
2134176d | 134 | } // end if this->fa!=0 |
135 | this->fNi = source.fNi; | |
136 | this->fNj = source.fNj; | |
137 | this->fa = new TObjArray(*(source.fa)); | |
9ce4d38b | 138 | this->fEnteries = source.fEnteries; |
2134176d | 139 | |
140 | return *this; | |
141 | } | |
142 | //______________________________________________________________________ | |
143 | AliITSpList::AliITSpList(AliITSpList &source){ | |
144 | // Copy operator | |
c7d528c6 | 145 | // Inputs: |
146 | // AliITSpList &source A AliITSpList Object | |
147 | // Outputs: | |
148 | // none. | |
149 | // Return: | |
150 | // A copied AliITSpList object | |
2134176d | 151 | |
152 | *this = source; | |
153 | } | |
154 | //______________________________________________________________________ | |
c7d528c6 | 155 | void AliITSpList::AddItemTo(Int_t fileIndex, AliITSpListItem *pl) { |
156 | // Adds the contents of pl to the list with track number off set given by | |
157 | // fileIndex. | |
158 | // Creates the AliITSpListItem if needed. | |
159 | // Inputs: | |
160 | // Int_t fileIndex track number offset value | |
161 | // AliITSpListItem *pl an AliITSpListItem to be added to this class. | |
162 | // Outputs: | |
163 | // none. | |
164 | // Return: | |
165 | // none. | |
166 | Int_t index = pl->GetIndex(); | |
167 | ||
168 | if( fa->At( index ) == 0 ) { // most create AliITSpListItem | |
169 | fa->AddAt(new AliITSpListItem(-2,-1,pl->GetModule(),index,0.0),index); | |
170 | } // end if | |
171 | ||
cab0142f | 172 | ((AliITSpListItem*)(fa->At(index)))->AddTo( fileIndex,pl); |
9ce4d38b | 173 | if(index>=fEnteries) fEnteries = index +1; |
c7d528c6 | 174 | } |
175 | //______________________________________________________________________ | |
2134176d | 176 | void AliITSpList::AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod, |
c7d528c6 | 177 | Double_t signal){ |
2134176d | 178 | // Adds a Signal value to the TObjArray at i,j. Creates the AliITSpListItem |
179 | // if needed. | |
c7d528c6 | 180 | // Inputs: |
181 | // Int_t i Row number for this signal | |
182 | // Int_t j Column number for this signal | |
183 | // Int_t trk Track number creating this signal | |
184 | // Int_t ht Hit number creating this signal | |
185 | // Int_t mod The module where this signal is in | |
186 | // Double_t signal The signal (ionization) | |
187 | // Outputs: | |
188 | // none. | |
189 | // Return: | |
190 | // none. | |
9ce4d38b | 191 | Int_t index = GetIndex(i,j); |
2134176d | 192 | |
9ce4d38b | 193 | if(GetpListItem(index)==0){ // most create AliITSpListItem |
cab0142f | 194 | fa->AddAt(new AliITSpListItem(trk,ht,mod,index,signal),index); |
2134176d | 195 | }else{ // AliITSpListItem exists, just add signal to it. |
9ce4d38b | 196 | GetpListItem(index)->AddSignal(trk,ht,mod,index,signal); |
2134176d | 197 | } // end if |
9ce4d38b | 198 | if(index>=fEnteries) fEnteries = index +1; |
2134176d | 199 | } |
200 | //______________________________________________________________________ | |
201 | void AliITSpList::AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise){ | |
202 | // Adds a noise value to the TObjArray at i,j. Creates the AliITSpListItem | |
203 | // if needed. | |
c7d528c6 | 204 | // Inputs: |
205 | // Int_t i Row number for this noise | |
206 | // Int_t j Column number for this noise | |
207 | // Double_t noise The noise signal value. | |
208 | // Outputs: | |
209 | // none. | |
210 | // Return: | |
211 | // none. | |
9ce4d38b | 212 | Int_t index = GetIndex(i,j); |
2134176d | 213 | |
9ce4d38b | 214 | if(GetpListItem(index)==0){ // most create AliITSpListItem |
215 | fa->AddAt(new AliITSpListItem(mod,index,noise),index); | |
2134176d | 216 | }else{ // AliITSpListItem exists, just add signal to it. |
9ce4d38b | 217 | GetpListItem(index)->AddNoise(mod,index,noise); |
2134176d | 218 | } // end if |
9ce4d38b | 219 | if(index>=fEnteries) fEnteries = index +1; |
2134176d | 220 | } |
221 | //______________________________________________________________________ | |
222 | ||
223 | ClassImp(AliITSpListItem) | |
224 | //______________________________________________________________________ | |
225 | AliITSpListItem::AliITSpListItem(){ | |
226 | // Default constructor | |
c7d528c6 | 227 | // Inputs: |
228 | // none. | |
229 | // Outputs: | |
230 | // none. | |
231 | // Return: | |
232 | // A zeroed/empty AliITSpListItem class. | |
2134176d | 233 | |
234 | fmodule = -1; | |
235 | findex = -1; | |
236 | for(Int_t i=0;i<this->fkSize;i++){ | |
c7d528c6 | 237 | this->fTrack[i] = -2; |
238 | this->fHits[i] = -1; | |
239 | this->fSignal[i] = 0.0; | |
2134176d | 240 | } // end if i |
241 | fTsignal = 0.0; | |
242 | fNoise = 0.0; | |
cab0142f | 243 | fSignalAfterElect = 0.0; |
2134176d | 244 | } |
245 | //______________________________________________________________________ | |
246 | AliITSpListItem::AliITSpListItem(Int_t module,Int_t index,Double_t noise){ | |
247 | // Standard noise constructor | |
c7d528c6 | 248 | // Inputs: |
249 | // Int_t module The module where this noise occurred | |
250 | // Int_t index The cell index where this noise occurred | |
251 | // Double_t noise The value of the noise. | |
252 | // Outputs: | |
253 | // none. | |
254 | // Return: | |
255 | // A setup and noise filled AliITSpListItem class. | |
2134176d | 256 | |
257 | this->fmodule = module; | |
258 | this->findex = index; | |
259 | for(Int_t i=0;i<this->fkSize;i++){ | |
c7d528c6 | 260 | this->fTrack[i] = -2; |
261 | this->fSignal[i] = 0.0; | |
262 | this->fHits[i] = -1; | |
2134176d | 263 | } // end if i |
264 | this->fTsignal = 0.0; | |
cab0142f | 265 | this->fSignalAfterElect = 0.0; |
2134176d | 266 | this->fNoise = noise; |
267 | } | |
268 | //______________________________________________________________________ | |
269 | AliITSpListItem::AliITSpListItem(Int_t track,Int_t hit,Int_t module, | |
c7d528c6 | 270 | Int_t index,Double_t signal){ |
2134176d | 271 | // Standard signal constructor |
c7d528c6 | 272 | // Inputs: |
273 | // Int_t track The track number which produced this signal | |
274 | // Int_t hit The hit number which produced this signal | |
275 | // Int_t module The module where this signal occurred | |
276 | // Int_t index The cell index where this signal occurred | |
277 | // Double_t signal The value of the signal (ionization) | |
278 | // Outputs: | |
279 | // none. | |
280 | // Return: | |
281 | // A setup and signal filled AliITSpListItem class. | |
2134176d | 282 | |
283 | this->fmodule = module; | |
284 | this->findex = index; | |
285 | this->fTrack[0] = track; | |
286 | this->fHits[0] = hit; | |
287 | this->fSignal[0] = signal; | |
288 | for(Int_t i=1;i<this->fkSize;i++){ | |
c7d528c6 | 289 | this->fTrack[i] = -2; |
290 | this->fSignal[i] = 0.0; | |
291 | this->fHits[i] = -1; | |
2134176d | 292 | } // end if i |
293 | this->fTsignal = signal; | |
294 | this->fNoise = 0.0; | |
cab0142f | 295 | this->fSignalAfterElect = 0.0; |
2134176d | 296 | } |
297 | //______________________________________________________________________ | |
298 | AliITSpListItem::~AliITSpListItem(){ | |
c7d528c6 | 299 | // Destructor |
300 | // Inputs: | |
301 | // none. | |
302 | // Outputs: | |
303 | // none. | |
304 | // Return: | |
305 | // A properly destroyed AliITSpListItem class. | |
54657caf | 306 | |
2134176d | 307 | } |
308 | //______________________________________________________________________ | |
309 | AliITSpListItem& AliITSpListItem::operator=(const AliITSpListItem &source){ | |
310 | // = operator | |
c7d528c6 | 311 | // Inputs: |
312 | // AliITSpListItem &source A AliITSpListItem Object | |
313 | // Outputs: | |
314 | // none. | |
315 | // Return: | |
316 | // A copied AliITSpListItem object | |
f8d9a5b8 | 317 | Int_t i; |
2134176d | 318 | |
319 | if(this == &source) return *this; | |
320 | ||
321 | this->fmodule = source.fmodule; | |
322 | this->findex = source.findex; | |
f8d9a5b8 | 323 | for(i=0;i<this->fkSize;i++){ |
c7d528c6 | 324 | this->fTrack[i] = source.fTrack[i]; |
325 | this->fSignal[i] = source.fSignal[i]; | |
326 | this->fHits[i] = source.fHits[i]; | |
2134176d | 327 | } // end if i |
328 | this->fTsignal = source.fTsignal; | |
329 | this->fNoise = source.fNoise; | |
cab0142f | 330 | this->fSignalAfterElect = source.fSignalAfterElect; |
f8d9a5b8 | 331 | /* |
332 | cout <<"this fTrack[0-9]="; | |
333 | for(i=0;i<this->fkSize;i++) cout <<this->fTrack[i]<<","; | |
334 | cout <<" fHits[0-9]="; | |
335 | for(i=0;i<this->fkSize;i++) cout <<this->fHits[i]<<","; | |
336 | cout <<" fSignal[0-9]="; | |
337 | for(i=0;i<this->fkSize;i++) cout <<this->fSignal[i]<<","; | |
338 | cout << endl; | |
339 | cout <<"source fTrack[0-9]="; | |
340 | for(i=0;i<this->fkSize;i++) cout <<source.fTrack[i]<<","; | |
341 | cout <<" fHits[0-9]="; | |
342 | for(i=0;i<this->fkSize;i++) cout <<source.fHits[i]<<","; | |
343 | cout <<" fSignal[0-9]="; | |
344 | for(i=0;i<this->fkSize;i++) cout <<source.fSignal[i]<<","; | |
345 | cout << endl; | |
346 | */ | |
2134176d | 347 | return *this; |
348 | } | |
349 | //______________________________________________________________________ | |
350 | AliITSpListItem::AliITSpListItem(AliITSpListItem &source){ | |
351 | // Copy operator | |
c7d528c6 | 352 | // Inputs: |
353 | // AliITSpListItem &source A AliITSpListItem Object | |
354 | // Outputs: | |
355 | // none. | |
356 | // Return: | |
357 | // A copied AliITSpListItem object | |
2134176d | 358 | |
359 | *this = source; | |
360 | } | |
361 | //______________________________________________________________________ | |
362 | void AliITSpListItem::AddSignal(Int_t track,Int_t hit,Int_t module, | |
c7d528c6 | 363 | Int_t index,Double_t signal){ |
364 | // Adds this track number and signal to the pList and orders them | |
365 | // Inputs: | |
366 | // Int_t track The track number which produced this signal | |
367 | // Int_t hit The hit number which produced this signal | |
368 | // Int_t module The module where this signal occurred | |
369 | // Int_t index The cell index where this signal occurred | |
370 | // Double_t signal The value of the signal (ionization) | |
371 | // Outputs: | |
372 | // none. | |
373 | // Return: | |
374 | // none. | |
2134176d | 375 | Int_t i,j,trk,hts; |
376 | Double_t sig; | |
377 | Bool_t flg=kFALSE; | |
378 | ||
379 | if(findex!=index || fmodule!=module) | |
c7d528c6 | 380 | Warning("AddSignal","index=%d != findex=%d or module=%d != fmodule=%d", |
381 | index,findex,module,fmodule); | |
2134176d | 382 | fTsignal += signal; // Keep track of sum signal. |
cab0142f | 383 | |
384 | for(i=0;i<fkSize;i++) if( track==fTrack[i] && hit==fHits[i] ){ | |
c7d528c6 | 385 | fSignal[i] += signal; |
386 | flg = kTRUE; | |
2134176d | 387 | } // end for i & if. |
f8d9a5b8 | 388 | //cout << "track="<<track<<endl; |
c7d528c6 | 389 | if(flg){ // resort arrays. |
390 | for(i=1;i<fkSize;i++){ | |
391 | j = i; | |
392 | while(j>0 && fSignal[j]>fSignal[j-1]){ | |
393 | trk = fTrack[j-1]; | |
394 | hts = fHits[j-1]; | |
395 | sig = fSignal[j-1]; | |
396 | fTrack[j-1] = fTrack[j]; | |
397 | fHits[j-1] = fHits[j]; | |
398 | fSignal[j-1] = fSignal[j]; | |
399 | fTrack[j] = trk; | |
400 | fHits[j] = hts; | |
401 | fSignal[j] = sig; | |
f8d9a5b8 | 402 | //cout << "#fTrack["<<j-1<<"]="<<fTrack[j-1]<< " fTrack["<< |
403 | // j<<"]="<<fTrack[j]<<endl; | |
c7d528c6 | 404 | j--; |
405 | } // end while | |
406 | } // end if i | |
407 | return; | |
408 | } // end if added to existing and resorted array | |
9176630b | 409 | |
ab5aed76 | 410 | // new entry add it in order. |
411 | // if this signal is <= smallest then don't add it. | |
412 | if(signal <= fSignal[fkSize-1]) return; | |
413 | for(i=fkSize-2;i>=0;i--){ | |
c7d528c6 | 414 | if(signal > fSignal[i]){ |
415 | fSignal[i+1] = fSignal[i]; | |
416 | fTrack[i+1] = fTrack[i]; | |
417 | fHits[i+1] = fHits[i]; | |
418 | }else{ | |
419 | fSignal[i+1] = signal; | |
420 | fTrack[i+1] = track; | |
421 | fHits[i+1] = hit; | |
422 | return; // put it in the right place, now exit. | |
423 | } // end if | |
f8d9a5b8 | 424 | //cout << "$fTrack["<<i+1<<"]="<<fTrack[i+1]<< " fTrack["<<i<<"]=" |
425 | //<<fTrack[i]<< " fHits["<<i+1<<"]="<<fHits[i+1]<< " fHits["<<i<<"]=" | |
426 | //<<fHits[i]<< " fSignal["<<i+1<<"]="<<fSignal[i+1]<< " fSignal["<<i | |
427 | //<<"]="<<fSignal[i]<<endl; | |
ab5aed76 | 428 | } // end if; end for i |
429 | // Still haven't found the right place. Must be at top of list. | |
430 | fSignal[0] = signal; | |
431 | fTrack[0] = track; | |
432 | fHits[0] = hit; | |
f8d9a5b8 | 433 | //cout << "$fTrack["<<0<<"]="<<fTrack[0]<<" fHits["<<0<<"]="<<fHits[0] |
434 | //<<" fSignal["<<0<<"]="<<fSignal[0]<<endl; | |
ab5aed76 | 435 | return; |
2134176d | 436 | } |
437 | //______________________________________________________________________ | |
438 | void AliITSpListItem::AddNoise(Int_t module,Int_t index,Double_t noise){ | |
c7d528c6 | 439 | // Adds noise to this existing list. |
440 | // Inputs: | |
441 | // Int_t module The module where this noise occurred | |
442 | // Int_t index The cell index where this noise occurred | |
443 | // Double_t noise The value of the noise. | |
444 | // Outputs: | |
445 | // none. | |
446 | // Return: | |
447 | // none. | |
2134176d | 448 | |
449 | if(findex!=index || fmodule!=module) | |
cab0142f | 450 | Warning("AddNoise","index=%d != findex=%d or module=%d != fmodule=%d", |
c7d528c6 | 451 | index,findex,module,fmodule); |
2134176d | 452 | fNoise += noise; // Keep track of sum signal. |
453 | } | |
454 | //______________________________________________________________________ | |
cab0142f | 455 | void AliITSpListItem::AddSignalAfterElect(Int_t module,Int_t index,Double_t signal){ |
456 | // Adds signal after electronics to this existing list. | |
457 | // Inputs: | |
458 | // Int_t module The module where this noise occurred | |
459 | // Int_t index The cell index where this noise occurred | |
460 | // Double_t signal The value of the signal. | |
461 | // Outputs: | |
462 | // none. | |
463 | // Return: | |
464 | // none. | |
465 | ||
466 | if(findex!=index || fmodule!=module) | |
467 | Warning("AddSignalAfterElect","index=%d != findex=%d or module=%d " | |
468 | "!= fmodule=%d",index,findex,module,fmodule); | |
469 | fSignalAfterElect += signal; // Keep track of sum signal. | |
470 | } | |
471 | //______________________________________________________________________ | |
472 | void AliITSpListItem::Add(AliITSpListItem *pl){ | |
473 | // Adds the contents of pl to this | |
474 | // pl could come from different module and index | |
475 | // Inputs: | |
476 | // AliITSpListItem *pl an AliITSpListItem to be added to this class. | |
477 | // Outputs: | |
478 | // none. | |
479 | // Return: | |
480 | // none. | |
481 | Int_t i; | |
482 | Double_t sig = 0.0; | |
483 | Double_t sigT = 0.0; | |
484 | ||
485 | for(i=0;i<pl->GetNsignals();i++){ | |
486 | sig = pl->GetSignal(i); | |
487 | if( sig <= 0.0 ) break; // no more signals | |
488 | AddSignal(pl->GetTrack(i),pl->GetHit(i),fmodule,findex,sig); | |
489 | sigT += sig; | |
490 | } // end for i | |
491 | fTsignal += (pl->fTsignal - sigT); | |
492 | fNoise += pl->fNoise; | |
493 | return; | |
494 | } | |
495 | //______________________________________________________________________ | |
2134176d | 496 | void AliITSpListItem::AddTo(Int_t fileIndex,AliITSpListItem *pl){ |
497 | // Adds the contents of pl to this with track number off set given by | |
498 | // fileIndex. | |
c7d528c6 | 499 | // Inputs: |
500 | // Int_t fileIndex track number offset value | |
501 | // AliITSpListItem *pl an AliITSpListItem to be added to this class. | |
502 | // Outputs: | |
503 | // none. | |
504 | // Return: | |
505 | // none. | |
2134176d | 506 | Int_t i,trk; |
cab0142f | 507 | Double_t sig = 0.0; |
2134176d | 508 | |
cab0142f | 509 | Int_t module = pl->GetModule(); |
510 | Int_t index = pl->GetIndex(); | |
c7d528c6 | 511 | for(i=0;i<pl->GetNsignals();i++){ |
cab0142f | 512 | sig = pl->GetSignal(i); |
513 | if( sig <= 0.0 ) break; // no more signals | |
c7d528c6 | 514 | trk = pl->GetTrack(i); |
cab0142f | 515 | trk += fileIndex; |
516 | AddSignal(trk,pl->GetHit(i),module,index,sig); | |
2134176d | 517 | } // end for i |
cab0142f | 518 | fSignalAfterElect += (pl->fSignalAfterElect + pl->fNoise - fNoise); |
519 | fNoise = pl->fNoise; | |
2134176d | 520 | return; |
521 | } | |
522 | //______________________________________________________________________ | |
523 | Int_t AliITSpListItem::ShiftIndex(Int_t in,Int_t trk){ | |
c7d528c6 | 524 | // Shift an index number to occupy the upper four bits. No longer used. |
525 | // Inputs: | |
526 | // Int_t in The file number | |
527 | // Int_t trk The track number | |
528 | // Outputs: | |
529 | // none. | |
530 | // Return: | |
531 | // Int_t The track number with the file number in the upper bits. | |
2134176d | 532 | Int_t si = sizeof(Int_t) * 8; |
cab0142f | 533 | UInt_t uin,utrk; // use UInt_t to avoid interger overflow-> goes negative. |
2134176d | 534 | |
535 | uin = in; | |
536 | utrk = trk; | |
537 | for(Int_t i=0;i<si-4;i++) uin *= 2; | |
538 | uin += utrk; | |
539 | in = uin; | |
540 | return in; | |
541 | } | |
542 | //______________________________________________________________________ | |
543 | void AliITSpListItem::Print(ostream *os){ | |
544 | //Standard output format for this class | |
c7d528c6 | 545 | // Inputs: |
546 | // ostream *os The output stream | |
547 | // Outputs: | |
548 | // none. | |
549 | // Return: | |
550 | // none. | |
2134176d | 551 | Int_t i; |
552 | ||
553 | *os << fmodule <<","<<findex<<","; | |
554 | *os << fkSize <<","; | |
555 | for(i=0;i<fkSize;i++) *os << fTrack[i] <<","; | |
556 | for(i=0;i<fkSize;i++) *os << fHits[i] <<","; | |
557 | for(i=0;i<fkSize;i++) *os << fSignal[i] <<","; | |
cab0142f | 558 | *os << fTsignal <<","<< fNoise << "," << fSignalAfterElect; |
2134176d | 559 | } |
560 | //______________________________________________________________________ | |
561 | void AliITSpListItem::Read(istream *is){ | |
562 | // Standard output streaming function. | |
c7d528c6 | 563 | // Inputs: |
564 | // istream *is The input stream | |
565 | // Outputs: | |
566 | // none. | |
567 | // Return: | |
568 | // none. | |
2134176d | 569 | Int_t i,iss; |
570 | ||
571 | *is >> fmodule >> findex; | |
572 | *is >> iss; // read in fkSize | |
573 | for(i=0;i<fkSize&&i<iss;i++) *is >> fTrack[i]; | |
574 | for(i=0;i<fkSize&&i<iss;i++) *is >> fHits[i]; | |
575 | for(i=0;i<fkSize&&i<iss;i++) *is >> fSignal[i]; | |
cab0142f | 576 | *is >> fTsignal >> fNoise >> fSignalAfterElect; |
2134176d | 577 | } |
578 | //______________________________________________________________________ | |
579 | ostream &operator<<(ostream &os,AliITSpListItem &source){ | |
580 | // Standard output streaming function. | |
c7d528c6 | 581 | // Inputs: |
582 | // ostream &os The output stream | |
583 | // AliITSpListItem &source The AliITSpListItem object to be written out. | |
584 | // Outputs: | |
585 | // none. | |
586 | // Return: | |
587 | // ostream The output stream | |
2134176d | 588 | |
589 | source.Print(&os); | |
590 | return os; | |
591 | } | |
592 | //______________________________________________________________________ | |
593 | istream &operator>>(istream &os,AliITSpListItem &source){ | |
594 | // Standard output streaming function. | |
c7d528c6 | 595 | // Inputs: |
596 | // istream os The input stream | |
597 | // AliITSpListItem &source The AliITSpListItem object to be inputted | |
598 | // Outputs: | |
599 | // none. | |
600 | // Return: | |
601 | // istream The input stream. | |
2134176d | 602 | |
603 | source.Read(&os); | |
604 | return os; | |
605 | } | |
c7d528c6 | 606 |