1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ////////////////////////////////////////////////
19 // Digits classes for all ITS detectors //
20 ////////////////////////////////////////////////
21 #include <TObjArray.h>
25 #include "AliITSdigit.h"
27 //______________________________________________________________________
29 AliITSdigit::AliITSdigit(const Int_t *digits) {
30 // Creates a real data digit object
36 //______________________________________________________________________
37 void AliITSdigit::Print(ostream *os){
38 //Standard output format for this class
40 *os << fCoord1 <<","<< fCoord2 <<","<< fSignal;
42 //______________________________________________________________________
43 void AliITSdigit::Read(istream *os){
44 //Standard input for this class
46 *os >> fCoord1 >> fCoord2 >> fSignal;
48 //______________________________________________________________________
49 ostream &operator<<(ostream &os,AliITSdigit &source){
50 // Standard output streaming function.
55 //______________________________________________________________________
56 istream &operator>>(istream &os,AliITSdigit &source){
57 // Standard output streaming function.
62 //______________________________________________________________________
63 ClassImp(AliITSdigitSPD)
64 AliITSdigitSPD::AliITSdigitSPD():AliITSdigit(){
65 // default constructor, zero coordinates and set array
66 // elements to clearly unphysical values. A value of 0 may
67 // be a valide track of hit number.
70 for(i=0;i<fkSspd;i++) fTracks[i] = -3;
71 for(i=0;i<fkSspd;i++) fHits[i] = -1;
73 //______________________________________________________________________
74 AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits){
75 // Creates a SPD digit object
78 for(i=0;i<fkSspd;i++) fTracks[i] = -3;
79 for(i=0;i<fkSspd;i++) fHits[i] = -1;
83 fSignalSPD = digits[2];
85 //______________________________________________________________________
86 AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits,const Int_t *tracks,
88 // Creates a simulated SPD digit object
90 for(Int_t i=0; i<fkSspd; i++) {
91 fTracks[i] = tracks[i];
97 fSignalSPD = digits[2];
99 //______________________________________________________________________
100 Int_t AliITSdigitSPD::GetListOfTracks(TArrayI &t){
101 // Fills the TArrayI t with the tracks found in fTracks removing
102 // duplicated tracks, but otherwise in the same order. It will return
103 // the number of tracks and fill the remaining elements to the array
106 // TArrayI &t Reference to a TArrayI to contain the list of
107 // nonduplicated track numbers.
109 // TArrayI &t The input array filled with the nonduplicated track
112 // Int_t The number of none -1 entries in the TArrayI t.
113 Int_t nt = t.GetSize();
114 Int_t nth = this->GetNTracks();
116 Bool_t inlist = kFALSE;
118 t.Reset(-1); // -1 array.
120 if(this->GetTrack(i) == -1) continue;
122 for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)) inlist = kTRUE;
123 if(!inlist){ // add to end of list
124 t.AddAt(this->GetTrack(i),n);
130 //______________________________________________________________________
131 void AliITSdigitSPD::Print(ostream *os){
132 //Standard output format for this class
135 AliITSdigit::Print(os);
136 for(i=0;i<fkSspd;i++) *os <<","<< fTracks[i];
137 for(i=0;i<fkSspd;i++) *os <<","<< fHits[i];
138 *os << "," << fSignalSPD;
140 //______________________________________________________________________
141 void AliITSdigitSPD::Read(istream *os){
142 //Standard input for this class
145 AliITSdigit::Read(os);
146 for(i=0;i<fkSspd;i++) *os >> fTracks[i];
147 for(i=0;i<fkSspd;i++) *os >> fHits[i];
150 //______________________________________________________________________
151 ostream &operator<<(ostream &os,AliITSdigitSPD &source){
152 // Standard output streaming function.
157 //______________________________________________________________________
158 istream &operator>>(istream &os,AliITSdigitSPD &source){
159 // Standard output streaming function.
164 //______________________________________________________________________
165 ClassImp(AliITSdigitSDD)
166 AliITSdigitSDD::AliITSdigitSDD():AliITSdigit(){
167 // default constructor, zero coordinates and set array
168 // elements to clearly unphysical values. A value of 0 may
169 // be a valide track of hit number.
172 for(i=0;i<fkSsdd;i++) fTracks[i] = -3;
173 for(i=0;i<fkSsdd;i++) fHits[i] = -1;
175 for(i=0;i<fkSsdd;i++) fTcharges[i] = 0;
177 //________________________________________________________________________
178 AliITSdigitSDD::AliITSdigitSDD(Float_t phys,const Int_t *digits):
180 // Creates a simulated SDD digit object to be updated
184 //_____________________________________________________________________________
185 AliITSdigitSDD::AliITSdigitSDD(Float_t phys,const Int_t *digits,
186 const Int_t *tracks,const Int_t *hits,
187 const Float_t *charges):
189 // Creates a simulated SDD digit object
192 for(Int_t i=0; i<fkSsdd; i++) {
193 fTcharges[i] = charges[i];
194 fTracks[i] = tracks[i];
198 //______________________________________________________________________
199 Int_t AliITSdigitSDD::GetListOfTracks(TArrayI &t,TArrayF &c){
200 // Fills the TArrayI t with the tracks found in fTracks removing
201 // duplicated tracks, summing up their charge, and ordering the tracks
202 // by the charge contributed to this digit. It will return
203 // the number of tracks and fill the remaining elements to the array
206 // TArrayI &t Reference to a TArrayI to contain the list of
207 // nonduplicated track numbers.
208 // TArrayF &c Reference to a TArrayF to contain the summed charge
209 // contributed by each track.
211 // TArrayI &t The input array filled with the nonduplicated track
213 // TArrayF &c The input array filled with the summed charge
214 // contributed by the corresponding track in the array t.
216 // Int_t The number of none -1 entries in the TArrayI t.
217 Int_t nt = t.GetSize();
218 nt = TMath::Min(nt,c.GetSize());
219 Int_t nth = this->GetNTracks();
221 Bool_t inlist = kFALSE;
223 t.Reset(-1); // -1 array.
224 c.Reset(0.0); // zero array.
226 if(this->GetTrack(i) == -1) continue;
228 for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)){
230 c.AddAt(this->GetCharge(i)+c.At(j),j);
231 } // end for j/end if
232 if(!inlist){ // add to end of list
233 t.AddAt(this->GetTrack(i),n);
234 c.AddAt(this->GetCharge(i),n);
239 // Now lets sort the TArrays according to the charge. This algorithm
240 // is based on the method from Chapter 8 section 1 Straight Insertion
241 // sort. Wiliam H. Press, Saul A. Teukolsky, William T. Vetterling
242 // and Brian P. Flannery, "Numerical Recipeis in C, The Art of Scientific
243 // Computing", second Edition page 330 (1997).
250 while(j>-1 && c.At(j)>ch){
251 t.AddAt(t.At(j+1),j);
252 c.AddAt(c.At(j+1),j);
261 //______________________________________________________________________
262 void AliITSdigitSDD::Print(ostream *os){
263 //Standard output format for this class
266 AliITSdigit::Print(os);
267 *os <<","<< fPhysics;
268 for(i=0; i<fkSsdd; i++) *os <<","<< fTcharges[i];
269 for(i=0; i<fkSsdd; i++) *os <<","<< fTracks[i];
270 for(i=0; i<fkSsdd; i++) *os <<","<< fHits[i];
272 //______________________________________________________________________
273 void AliITSdigitSDD::Read(istream *os){
274 //Standard input for this class
277 AliITSdigit::Read(os);
279 for(i=0; i<fkSsdd; i++) *os >> fTcharges[i];
280 for(i=0; i<fkSsdd; i++) *os >> fTracks[i];
281 for(i=0; i<fkSsdd; i++) *os >> fHits[i];
283 //______________________________________________________________________
284 ostream &operator<<(ostream &os,AliITSdigitSDD &source){
285 // Standard output streaming function.
290 //______________________________________________________________________
291 istream &operator>>(istream &os,AliITSdigitSDD &source){
292 // Standard output streaming function.
297 //______________________________________________________________________
298 ClassImp(AliITSTransientDigit)
299 AliITSTransientDigit::AliITSTransientDigit(Float_t phys,const Int_t *digits):
300 AliITSdigitSDD(phys,digits) {
301 // Creates a digit object in a list of digits to be updated
303 fTrackList = new TObjArray;
305 //__________________________________________________________________________
306 AliITSTransientDigit::AliITSTransientDigit(const AliITSTransientDigit &source){
308 if(&source == this) return;
309 this->fTrackList = source.fTrackList;
312 //_________________________________________________________________________
313 AliITSTransientDigit& AliITSTransientDigit::operator=(
314 const AliITSTransientDigit &source) {
315 // Assignment operator
316 if(&source == this) return *this;
317 this->fTrackList = source.fTrackList;
320 //______________________________________________________________________
321 void AliITSTransientDigit::Print(ostream *os){
322 //Standard output format for this class
324 AliITSdigitSDD::Print(os);
326 //______________________________________________________________________
327 void AliITSTransientDigit::Read(istream *os){
328 //Standard input for this class
330 AliITSdigitSDD::Read(os);
332 //______________________________________________________________________
333 ostream &operator<<(ostream &os,AliITSTransientDigit &source){
334 // Standard output streaming function.
339 //______________________________________________________________________
340 istream &operator>>(istream &os,AliITSTransientDigit &source){
341 // Standard output streaming function.
346 //______________________________________________________________________
347 ClassImp(AliITSdigitSSD)
348 AliITSdigitSSD::AliITSdigitSSD():AliITSdigit(){
349 // default constructor
352 for(i=0; i<fkSssd; i++) fTracks[i] = -3;
353 for(i=0; i<fkSssd; i++) fHits[i] = -1;
355 //__________________________________________________________________________
356 AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits):AliITSdigit(digits){
357 // Creates a real SSD digit object
359 //_____________________________________________________________________________
360 AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits,const Int_t *tracks,
361 const Int_t *hits):AliITSdigit(digits){
362 // Creates a simulated SSD digit object
364 for(Int_t i=0; i<fkSssd; i++) {
365 fTracks[i] = tracks[i];
369 //______________________________________________________________________
370 Int_t AliITSdigitSSD::GetListOfTracks(TArrayI &t){
371 // Fills the TArrayI t with the tracks found in fTracks removing
372 // duplicated tracks, but otherwise in the same order. It will return
373 // the number of tracks and fill the remaining elements to the array
376 // TArrayI &t Reference to a TArrayI to contain the list of
377 // nonduplicated track numbers.
379 // TArrayI &t The input array filled with the nonduplicated track
382 // Int_t The number of none -1 entries in the TArrayI t.
383 Int_t nt = t.GetSize();
384 Int_t nth = this->GetNTracks();
386 Bool_t inlist = kFALSE;
388 t.Reset(-1); // -1 array.
390 if(this->GetTrack(i) == -1) continue;
392 for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)) inlist = kTRUE;
393 if(!inlist){ // add to end of list
394 t.AddAt(this->GetTrack(i),n);
400 //______________________________________________________________________
401 void AliITSdigitSSD::Print(ostream *os){
402 //Standard output format for this class
405 AliITSdigit::Print(os);
406 for(i=0; i<fkSssd; i++) *os <<","<< fTracks[i];
407 for(i=0; i<fkSssd; i++) *os <<","<< fHits[i];
409 //______________________________________________________________________
410 void AliITSdigitSSD::Read(istream *os){
411 //Standard input for this class
414 AliITSdigit::Read(os);
415 for(i=0; i<fkSssd; i++) *os >> fTracks[i];
416 for(i=0; i<fkSssd; i++) *os >> fHits[i];
418 //______________________________________________________________________
419 ostream &operator<<(ostream &os,AliITSdigitSSD &source){
420 // Standard output streaming function.
425 //______________________________________________________________________
426 istream &operator>>(istream &os,AliITSdigitSSD &source){
427 // Standard output streaming function.