]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSdigitSPD.cxx
In v1 geometry cluster should be attached to sensor according to sensor VIDs, rather...
[u/mrichter/AliRoot.git] / ITS / AliITSdigitSPD.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 <AliITSdigitSPD.h>
17 #include <TArrayI.h>
18
19 ///////////////////////////////////////////////////////////////////
20 //                                                               //
21 // Class defining the digit object
22 // for SPD
23 // Inherits from AliITSdigit
24 //                                                               //
25 ///////////////////////////////////////////////////////////////////
26
27 ClassImp(AliITSdigitSPD)
28
29 //______________________________________________________________________
30 AliITSdigitSPD::AliITSdigitSPD():AliITSdigit(),
31 fSignalSPD(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 AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits):
42 fSignalSPD(digits[2]){
43     // Creates a SPD digit object
44     Int_t i;
45
46     for(i=0;i<fgkSize;i++) fTracks[i]  = -3;
47     for(i=0;i<fgkSize;i++) fHits[i]    = -1;
48     fCoord1       = digits[0];
49     fCoord2       = digits[1];
50     fSignal       = 1;
51  }
52 //______________________________________________________________________
53 AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits,const Int_t *tracks,
54                                const Int_t *hits):
55 fSignalSPD(digits[2]){
56     // Creates a simulated SPD digit object
57
58     for(Int_t i=0; i<fgkSize; i++) {
59         fTracks[i] = tracks[i];
60         fHits[i]   = hits[i];
61     } // end for i
62     fCoord1       = digits[0];
63     fCoord2       = digits[1];
64     fSignal       = 1;
65 }
66 //______________________________________________________________________
67 Int_t AliITSdigitSPD::GetListOfTracks(TArrayI &t){
68     // Fills the TArrayI t with the tracks found in fTracks removing
69     // duplicated tracks, but otherwise in the same order. It will return
70     // the number of tracks and fill the remaining elements to the array
71     // t with -1.
72     // Inputs:
73     //   TArrayI  &t Reference to a TArrayI to contain the list of
74     //               nonduplicated track numbers.
75     // Output:
76     //   TArrayI  &t The input array filled with the nonduplicated track
77     //               numbers.
78     // Return:
79     //   Int_t The number of none -1 entries in the TArrayI t.
80     Int_t nt = t.GetSize();
81     Int_t nth = this->GetNTracks();
82     Int_t n = 0,i,j;
83     Bool_t inlist = kFALSE;
84
85     t.Reset(-1); // -1 array.
86     for(i=0;i<nth;i++) {
87         if(this->GetTrack(i) == -1) continue;
88         inlist = kFALSE;
89         for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)) inlist = kTRUE;
90         if(!inlist){ // add to end of list
91             t.AddAt(this->GetTrack(i),n);
92             if(n<nt) n++;
93         } // end if
94     } // end for i
95     return n;
96 }
97 //______________________________________________________________________
98 void AliITSdigitSPD::Print(ostream *os){
99     //Standard output format for this class
100     Int_t i;
101
102     AliITSdigit::Print(os);
103     for(i=0;i<fgkSize;i++) *os <<","<< fTracks[i];
104     for(i=0;i<fgkSize;i++) *os <<","<< fHits[i];
105     *os << "," << fSignalSPD;
106 }
107 //______________________________________________________________________
108 void AliITSdigitSPD::Read(istream *os){
109     //Standard input for this class
110     Int_t i;
111
112     AliITSdigit::Read(os);
113     for(i=0;i<fgkSize;i++) *os >> fTracks[i];
114     for(i=0;i<fgkSize;i++) *os >> fHits[i];
115     *os >> fSignalSPD;
116 }
117 //______________________________________________________________________
118 ostream &operator<<(ostream &os,AliITSdigitSPD &source){
119     // Standard output streaming function.
120
121     source.Print(&os);
122     return os;
123 }
124 //______________________________________________________________________
125 istream &operator>>(istream &os,AliITSdigitSPD &source){
126     // Standard output streaming function.
127
128     source.Read(&os);
129     return os;
130 }