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