]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSUDigitPix.cxx
minor fix
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUDigitPix.cxx
1 /**************************************************************************
2  * Copyright(c) 2004-2006, 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
16 #include <AliITSUDigitPix.h>
17 #include <TArrayI.h>
18
19 ///////////////////////////////////////////////////////////////////
20 //                                                               //
21 // Class defining the digit object
22 // for pixel
23 // Inherits from AliITSdigit
24 //                                                               //
25 ///////////////////////////////////////////////////////////////////
26
27 ClassImp(AliITSUDigitPix)
28
29 //______________________________________________________________________
30 AliITSUDigitPix::AliITSUDigitPix()
31 :  AliITSdigit()
32   ,fSignalPix(0)
33   ,fROCycle(0)
34 {
35     // default constructor, zero coordinates and set array
36     // elements to clearly unphysical values. A value of 0 may
37     // be a valide track of hit number.
38     Int_t i;
39
40     for(i=0;i<fgkSize;i++) fTracks[i]  = -3;
41     for(i=0;i<fgkSize;i++) fHits[i]    = -1;
42 }
43
44 //______________________________________________________________________
45 AliITSUDigitPix::AliITSUDigitPix(const Int_t *digits)
46   :fSignalPix(digits[2])
47   ,fROCycle(digits[3])
48 {
49     // Creates a pixel digit object
50     Int_t i;
51
52     for(i=0;i<fgkSize;i++) fTracks[i]  = -3;
53     for(i=0;i<fgkSize;i++) fHits[i]    = -1;
54     fCoord1       = digits[0];
55     fCoord2       = digits[1];
56     fSignal       = 1;
57 }
58
59 //______________________________________________________________________
60 AliITSUDigitPix::AliITSUDigitPix(const Int_t *digits,const Int_t *tracks,const Int_t *hits)
61 : fSignalPix(digits[2])
62 , fROCycle(digits[3])
63 {
64     // Creates a simulated pixel digit object
65
66     for(Int_t i=0; i<fgkSize; i++) {
67         fTracks[i] = tracks[i];
68         fHits[i]   = hits[i];
69     } // end for i
70     fCoord1       = digits[0];
71     fCoord2       = digits[1];
72     fSignal       = 1;
73 }
74
75 //______________________________________________________________________
76 Int_t AliITSUDigitPix::GetListOfTracks(TArrayI &t)
77 {
78     // Fills the TArrayI t with the tracks found in fTracks removing
79     // duplicated tracks, but otherwise in the same order. It will return
80     // the number of tracks and fill the remaining elements to the array
81     // t with -1.
82     // Inputs:
83     //   TArrayI  &t Reference to a TArrayI to contain the list of
84     //               nonduplicated track numbers.
85     // Output:
86     //   TArrayI  &t The input array filled with the nonduplicated track
87     //               numbers.
88     // Return:
89     //   Int_t The number of none -1 entries in the TArrayI t.
90     Int_t nt = t.GetSize();
91     Int_t nth = this->GetNTracks();
92     Int_t n = 0,i,j;
93     Bool_t inlist = kFALSE;
94
95     t.Reset(-1); // -1 array.
96     for(i=0;i<nth;i++) {
97         if(this->GetTrack(i) == -1) continue;
98         inlist = kFALSE;
99         for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)) inlist = kTRUE;
100         if(!inlist){ // add to end of list
101             t.AddAt(this->GetTrack(i),n);
102             if(n<nt) n++;
103         } // end if
104     } // end for i
105     return n;
106 }
107
108 //______________________________________________________________________
109 void AliITSUDigitPix::Print(ostream *os)
110 {
111     //Standard output format for this class
112     Int_t i;
113
114     AliITSdigit::Print(os);
115     for(i=0;i<fgkSize;i++) *os <<","<< fTracks[i];
116     for(i=0;i<fgkSize;i++) *os <<","<< fHits[i];
117     *os << "," << fSignalPix;
118     *os << "," << fROCycle;
119 }
120
121 //______________________________________________________________________
122 void AliITSUDigitPix::Read(istream *os)
123 {
124     //Standard input for this class
125     Int_t i;
126
127     AliITSdigit::Read(os);
128     for(i=0;i<fgkSize;i++) *os >> fTracks[i];
129     for(i=0;i<fgkSize;i++) *os >> fHits[i];
130     *os >> fSignalPix;
131     *os >> fROCycle;
132 }
133
134 //______________________________________________________________________
135 ostream &operator<<(ostream &os,AliITSUDigitPix &source)
136 {
137     // Standard output streaming function.
138
139     source.Print(&os);
140     return os;
141 }
142
143 //______________________________________________________________________
144 istream &operator>>(istream &os,AliITSUDigitPix &source)
145 {
146     // Standard output streaming function.
147
148     source.Read(&os);
149     return os;
150 }