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