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 **************************************************************************/
17 ////////////////////////////////////////////////
18 // Digits classes for all ITS detectors //
19 ////////////////////////////////////////////////
20 #include <TObjArray.h>
24 #include "AliITSdigit.h"
26 //______________________________________________________________________
28 AliITSdigit::AliITSdigit(const Int_t *digits) {
29 // Creates a real data digit object
35 //______________________________________________________________________
36 void AliITSdigit::Print(ostream *os){
37 //Standard output format for this class
39 *os << fCoord1 <<","<< fCoord2 <<","<< fSignal;
41 //______________________________________________________________________
42 void AliITSdigit::Read(istream *os){
43 //Standard input for this class
45 *os >> fCoord1 >> fCoord2 >> fSignal;
47 //______________________________________________________________________
48 ostream &operator<<(ostream &os,AliITSdigit &source){
49 // Standard output streaming function.
54 //______________________________________________________________________
55 istream &operator>>(istream &os,AliITSdigit &source){
56 // Standard output streaming function.
61 //______________________________________________________________________
62 ClassImp(AliITSdigitSPD)
63 AliITSdigitSPD::AliITSdigitSPD():AliITSdigit(){
64 // default constructor, zero coordinates and set array
65 // elements to clearly unphysical values. A value of 0 may
66 // be a valide track of hit number.
69 for(i=0;i<fkSspd;i++) fTracks[i] = -3;
70 for(i=0;i<fkSspd;i++) fHits[i] = -1;
72 //______________________________________________________________________
73 AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits){
74 // Creates a SPD digit object
77 for(i=0;i<fkSspd;i++) fTracks[i] = -3;
78 for(i=0;i<fkSspd;i++) fHits[i] = -1;
82 fSignalSPD = digits[2];
84 //______________________________________________________________________
85 AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits,const Int_t *tracks,
87 // Creates a simulated SPD digit object
89 for(Int_t i=0; i<fkSspd; i++) {
90 fTracks[i] = tracks[i];
96 fSignalSPD = digits[2];
98 //______________________________________________________________________
99 Int_t AliITSdigitSPD::GetListOfTracks(TArrayI &t){
100 // Fills the TArrayI t with the tracks found in fTracks removing
101 // duplicated tracks, but otherwise in the same order. It will return
102 // the number of tracks and fill the remaining elements to the array
105 // TArrayI &t Reference to a TArrayI to contain the list of
106 // nonduplicated track numbers.
108 // TArrayI &t The input array filled with the nonduplicated track
111 // Int_t The number of none -1 entries in the TArrayI t.
112 Int_t nt = t.GetSize();
113 Int_t nth = this->GetNTracks();
115 Bool_t inlist = kFALSE;
117 t.Reset(-1); // -1 array.
119 if(this->GetTrack(i) == -1) continue;
121 for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)) inlist = kTRUE;
122 if(!inlist){ // add to end of list
123 t.AddAt(this->GetTrack(i),n);
129 //______________________________________________________________________
130 void AliITSdigitSPD::Print(ostream *os){
131 //Standard output format for this class
134 AliITSdigit::Print(os);
135 for(i=0;i<fkSspd;i++) *os <<","<< fTracks[i];
136 for(i=0;i<fkSspd;i++) *os <<","<< fHits[i];
137 *os << "," << fSignalSPD;
139 //______________________________________________________________________
140 void AliITSdigitSPD::Read(istream *os){
141 //Standard input for this class
144 AliITSdigit::Read(os);
145 for(i=0;i<fkSspd;i++) *os >> fTracks[i];
146 for(i=0;i<fkSspd;i++) *os >> fHits[i];
149 //______________________________________________________________________
150 ostream &operator<<(ostream &os,AliITSdigitSPD &source){
151 // Standard output streaming function.
156 //______________________________________________________________________
157 istream &operator>>(istream &os,AliITSdigitSPD &source){
158 // Standard output streaming function.
163 //______________________________________________________________________
164 ClassImp(AliITSdigitSDD)
165 AliITSdigitSDD::AliITSdigitSDD():AliITSdigit(){
166 // default constructor, zero coordinates and set array
167 // elements to clearly unphysical values. A value of 0 may
168 // be a valide track of hit number.
171 for(i=0;i<fkSsdd;i++) fTracks[i] = -3;
172 for(i=0;i<fkSsdd;i++) fHits[i] = -1;
174 for(i=0;i<fkSsdd;i++) fTcharges[i] = 0;
176 //________________________________________________________________________
177 AliITSdigitSDD::AliITSdigitSDD(Float_t phys,const Int_t *digits):
179 // Creates a simulated SDD digit object to be updated
183 //_____________________________________________________________________________
184 AliITSdigitSDD::AliITSdigitSDD(Float_t phys,const Int_t *digits,
185 const Int_t *tracks,const Int_t *hits,
186 const Float_t *charges):
188 // Creates a simulated SDD digit object
191 for(Int_t i=0; i<fkSsdd; i++) {
192 fTcharges[i] = charges[i];
193 fTracks[i] = tracks[i];
197 //______________________________________________________________________
198 Int_t AliITSdigitSDD::GetListOfTracks(TArrayI &t,TArrayF &c){
199 // Fills the TArrayI t with the tracks found in fTracks removing
200 // duplicated tracks, summing up their charge, and ordering the tracks
201 // by the charge contributed to this digit. It will return
202 // the number of tracks and fill the remaining elements to the array
205 // TArrayI &t Reference to a TArrayI to contain the list of
206 // nonduplicated track numbers.
207 // TArrayF &c Reference to a TArrayF to contain the summed charge
208 // contributed by each track.
210 // TArrayI &t The input array filled with the nonduplicated track
212 // TArrayF &c The input array filled with the summed charge
213 // contributed by the corresponding track in the array t.
215 // Int_t The number of none -1 entries in the TArrayI t.
216 Int_t nt = t.GetSize();
217 nt = TMath::Min(nt,c.GetSize());
218 Int_t nth = this->GetNTracks();
220 Bool_t inlist = kFALSE;
222 t.Reset(-1); // -1 array.
223 c.Reset(0.0); // zero array.
225 if(this->GetTrack(i) == -1) continue;
227 for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)){
229 c.AddAt(this->GetCharge(i)+c.At(j),j);
230 } // end for j/end if
231 if(!inlist){ // add to end of list
232 t.AddAt(this->GetTrack(i),n);
233 c.AddAt(this->GetCharge(i),n);
238 // Now lets sort the TArrays according to the charge. This algorithm
239 // is based on the method from Chapter 8 section 1 Straight Insertion
240 // sort. Wiliam H. Press, Saul A. Teukolsky, William T. Vetterling
241 // and Brian P. Flannery, "Numerical Recipeis in C, The Art of Scientific
242 // Computing", second Edition page 330 (1997).
249 while(j>-1 && c.At(j)>ch){
250 t.AddAt(t.At(j+1),j);
251 c.AddAt(c.At(j+1),j);
260 //______________________________________________________________________
261 void AliITSdigitSDD::Print(ostream *os){
262 //Standard output format for this class
265 AliITSdigit::Print(os);
266 *os <<","<< fPhysics;
267 for(i=0; i<fkSsdd; i++) *os <<","<< fTcharges[i];
268 for(i=0; i<fkSsdd; i++) *os <<","<< fTracks[i];
269 for(i=0; i<fkSsdd; i++) *os <<","<< fHits[i];
271 //______________________________________________________________________
272 void AliITSdigitSDD::Read(istream *os){
273 //Standard input for this class
276 AliITSdigit::Read(os);
278 for(i=0; i<fkSsdd; i++) *os >> fTcharges[i];
279 for(i=0; i<fkSsdd; i++) *os >> fTracks[i];
280 for(i=0; i<fkSsdd; i++) *os >> fHits[i];
282 //______________________________________________________________________
283 ostream &operator<<(ostream &os,AliITSdigitSDD &source){
284 // Standard output streaming function.
289 //______________________________________________________________________
290 istream &operator>>(istream &os,AliITSdigitSDD &source){
291 // Standard output streaming function.
296 //______________________________________________________________________
297 ClassImp(AliITSTransientDigit)
298 AliITSTransientDigit::AliITSTransientDigit(Float_t phys,const Int_t *digits):
299 AliITSdigitSDD(phys,digits) {
300 // Creates a digit object in a list of digits to be updated
302 fTrackList = new TObjArray;
304 //__________________________________________________________________________
305 AliITSTransientDigit::AliITSTransientDigit(const AliITSTransientDigit &source){
307 if(&source == this) return;
308 this->fTrackList = source.fTrackList;
311 //_________________________________________________________________________
312 AliITSTransientDigit& AliITSTransientDigit::operator=(
313 const AliITSTransientDigit &source) {
314 // Assignment operator
315 if(&source == this) return *this;
316 this->fTrackList = source.fTrackList;
319 //______________________________________________________________________
320 void AliITSTransientDigit::Print(ostream *os){
321 //Standard output format for this class
323 AliITSdigitSDD::Print(os);
325 //______________________________________________________________________
326 void AliITSTransientDigit::Read(istream *os){
327 //Standard input for this class
329 AliITSdigitSDD::Read(os);
331 //______________________________________________________________________
332 ostream &operator<<(ostream &os,AliITSTransientDigit &source){
333 // Standard output streaming function.
338 //______________________________________________________________________
339 istream &operator>>(istream &os,AliITSTransientDigit &source){
340 // Standard output streaming function.
345 //______________________________________________________________________
346 ClassImp(AliITSdigitSSD)
347 AliITSdigitSSD::AliITSdigitSSD():AliITSdigit(){
348 // default constructor
351 for(i=0; i<fkSssd; i++) fTracks[i] = -3;
352 for(i=0; i<fkSssd; i++) fHits[i] = -1;
354 //__________________________________________________________________________
355 AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits):AliITSdigit(digits){
356 // Creates a real SSD digit object
358 //_____________________________________________________________________________
359 AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits,const Int_t *tracks,
360 const Int_t *hits):AliITSdigit(digits){
361 // Creates a simulated SSD digit object
363 for(Int_t i=0; i<fkSssd; i++) {
364 fTracks[i] = tracks[i];
368 //______________________________________________________________________
369 Int_t AliITSdigitSSD::GetListOfTracks(TArrayI &t){
370 // Fills the TArrayI t with the tracks found in fTracks removing
371 // duplicated tracks, but otherwise in the same order. It will return
372 // the number of tracks and fill the remaining elements to the array
375 // TArrayI &t Reference to a TArrayI to contain the list of
376 // nonduplicated track numbers.
378 // TArrayI &t The input array filled with the nonduplicated track
381 // Int_t The number of none -1 entries in the TArrayI t.
382 Int_t nt = t.GetSize();
383 Int_t nth = this->GetNTracks();
385 Bool_t inlist = kFALSE;
387 t.Reset(-1); // -1 array.
389 if(this->GetTrack(i) == -1) continue;
391 for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)) inlist = kTRUE;
392 if(!inlist){ // add to end of list
393 t.AddAt(this->GetTrack(i),n);
399 //______________________________________________________________________
400 void AliITSdigitSSD::Print(ostream *os){
401 //Standard output format for this class
404 AliITSdigit::Print(os);
405 for(i=0; i<fkSssd; i++) *os <<","<< fTracks[i];
406 for(i=0; i<fkSssd; i++) *os <<","<< fHits[i];
408 //______________________________________________________________________
409 void AliITSdigitSSD::Read(istream *os){
410 //Standard input for this class
413 AliITSdigit::Read(os);
414 for(i=0; i<fkSssd; i++) *os >> fTracks[i];
415 for(i=0; i<fkSssd; i++) *os >> fHits[i];
417 //______________________________________________________________________
418 ostream &operator<<(ostream &os,AliITSdigitSSD &source){
419 // Standard output streaming function.
424 //______________________________________________________________________
425 istream &operator>>(istream &os,AliITSdigitSSD &source){
426 // Standard output streaming function.