Minor changes in support of changes to AliITSdigitS?D class'.
[u/mrichter/AliRoot.git] / ITS / AliITSdigit.cxx
CommitLineData
f8dece8d 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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/* $Id$ */
16
3bd79107 17////////////////////////////////////////////////
f8dece8d 18// Digits classes for all ITS detectors //
3bd79107 19////////////////////////////////////////////////
58005f18 20#include "AliITSdigit.h"
3bd79107 21
f8dece8d 22//______________________________________________________________________
58005f18 23ClassImp(AliITSdigit)
f8dece8d 24AliITSdigit::AliITSdigit(const Int_t *digits) {
3bd79107 25 // Creates a real data digit object
f8dece8d 26
3bd79107 27 fCoord1 = digits[0];
28 fCoord2 = digits[1];
29 fSignal = digits[2];
30}
f8dece8d 31//______________________________________________________________________
32void AliITSdigit::Print(ostream *os){
33 //Standard output format for this class
3bd79107 34
f8dece8d 35 *os << fCoord1 <<","<< fCoord2 <<","<< fSignal;
36}
37//______________________________________________________________________
38void AliITSdigit::Read(istream *os){
39 //Standard input for this class
3bd79107 40
f8dece8d 41 *os >> fCoord1 >> fCoord2 >> fSignal;
42}
43//______________________________________________________________________
44ostream &operator<<(ostream &os,AliITSdigit &source){
45 // Standard output streaming function.
46
47 source.Print(&os);
48 return os;
49}
50//______________________________________________________________________
51istream &operator>>(istream &os,AliITSdigit &source){
52 // Standard output streaming function.
53
54 source.Read(&os);
55 return os;
56}
57//______________________________________________________________________
3bd79107 58ClassImp(AliITSdigitSPD)
f8dece8d 59AliITSdigitSPD::AliITSdigitSPD():AliITSdigit(){
60 // default constructor, zero coordinates and set array
61 // elements to clearly unphysical values. A value of 0 may
62 // be a valide track of hit number.
63
64 fTracks[0] = fTracks[1] = fTracks[2] = -3;
65 fHits[0] = fHits[1] = fHits[2] = -1;
3bd79107 66}
f8dece8d 67//______________________________________________________________________
75bc3366 68AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits){
f8dece8d 69 // Creates a SPD digit object
58005f18 70
f8dece8d 71 fTracks[0] = fTracks[1] = fTracks[2] = -3;
72 fHits[0] = fHits[1] = fHits[2] = -1;
75bc3366 73 fCoord1 = digits[0];
74 fCoord2 = digits[1];
75 fSignal = 1;
76 fSignalSPD = digits[2];
58005f18 77}
f8dece8d 78//______________________________________________________________________
79AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits,const Int_t *tracks,
75bc3366 80 const Int_t *hits){
f8dece8d 81 // Creates a simulated SPD digit object
3bd79107 82
f8dece8d 83 for(Int_t i=0; i<3; i++) {
84 fTracks[i] = tracks[i];
85 fHits[i] = hits[i];
86 } // end for i
75bc3366 87 fCoord1 = digits[0];
88 fCoord2 = digits[1];
89 fSignal = 1;
90 fSignalSPD = digits[2];
f8dece8d 91}
92//______________________________________________________________________
93void AliITSdigitSPD::Print(ostream *os){
94 //Standard output format for this class
95
96 AliITSdigit::Print(os);
97 *os <<","<< fTracks[0] <<","<< fTracks[1] <<","<< fTracks[2];
98 *os <<","<< fHits[0] <<","<< fHits[1] <<","<< fHits[2];
75bc3366 99 *os << "," << fSignalSPD;
f8dece8d 100}
101//______________________________________________________________________
102void AliITSdigitSPD::Read(istream *os){
103 //Standard input for this class
104
105 AliITSdigit::Read(os);
106 *os >> fTracks[0] >> fTracks[1] >> fTracks[2];
75bc3366 107 *os >> fHits[0] >> fHits[1] >> fHits[2] >> fSignalSPD;
f8dece8d 108}
109//______________________________________________________________________
110ostream &operator<<(ostream &os,AliITSdigitSPD &source){
111 // Standard output streaming function.
112
113 source.Print(&os);
114 return os;
115}
116//______________________________________________________________________
117istream &operator>>(istream &os,AliITSdigitSPD &source){
118 // Standard output streaming function.
3bd79107 119
f8dece8d 120 source.Read(&os);
121 return os;
122}
123//______________________________________________________________________
3bd79107 124ClassImp(AliITSdigitSDD)
f8dece8d 125AliITSdigitSDD::AliITSdigitSDD():AliITSdigit(){
126 // default constructor, zero coordinates and set array
127 // elements to clearly unphysical values. A value of 0 may
128 // be a valide track of hit number.
92c19c36 129
f8dece8d 130 fTracks[0] = fTracks[1] = fTracks[2] = -3;
131 fHits[0] = fHits[1] = fHits[2] = -1;
132 fPhysics = 0;
133 fTcharges[0] = fTcharges[1] = fTcharges[2] = 0;
3bd79107 134}
f8dece8d 135//________________________________________________________________________
136AliITSdigitSDD::AliITSdigitSDD(Float_t phys,const Int_t *digits):
137 AliITSdigit(digits){
138 // Creates a simulated SDD digit object to be updated
3bd79107 139
f8dece8d 140 fPhysics = phys;
141}
3bd79107 142//_____________________________________________________________________________
f8dece8d 143AliITSdigitSDD::AliITSdigitSDD(Float_t phys,const Int_t *digits,
144 const Int_t *tracks,const Int_t *hits,
145 const Float_t *charges):
146 AliITSdigit(digits){
147 // Creates a simulated SDD digit object
148
149 fPhysics = phys;
150 for(Int_t i=0; i<3; i++) {
151 fTcharges[i] = charges[i];
152 fTracks[i] = tracks[i];
153 fHits[i] = hits[i];
154 } // end for i
3bd79107 155}
f8dece8d 156//______________________________________________________________________
157void AliITSdigitSDD::Print(ostream *os){
158 //Standard output format for this class
3bd79107 159
f8dece8d 160 AliITSdigit::Print(os);
161 *os <<","<< fPhysics;
162 *os <<","<< fTcharges[0] <<","<< fTcharges[1] <<","<< fTcharges[2];
163 *os <<","<< fTracks[0] <<","<< fTracks[1] <<","<< fTracks[2];
164 *os <<","<< fHits[0] <<","<< fHits[1] <<","<< fHits[2];
165}
166//______________________________________________________________________
167void AliITSdigitSDD::Read(istream *os){
168 //Standard input for this class
169
170 AliITSdigit::Read(os);
171 *os >>fPhysics;
172 *os >> fTcharges[0] >> fTcharges[1] >> fTcharges[2];
173 *os >> fTracks[0] >> fTracks[1] >> fTracks[2];
174 *os >> fHits[0] >> fHits[1] >> fHits[2];
175}
176//______________________________________________________________________
177ostream &operator<<(ostream &os,AliITSdigitSDD &source){
178 // Standard output streaming function.
179
180 source.Print(&os);
181 return os;
182}
183//______________________________________________________________________
184istream &operator>>(istream &os,AliITSdigitSDD &source){
185 // Standard output streaming function.
3bd79107 186
f8dece8d 187 source.Read(&os);
188 return os;
189}
190//______________________________________________________________________
3bd79107 191ClassImp(AliITSTransientDigit)
f8dece8d 192AliITSTransientDigit::AliITSTransientDigit(Float_t phys,const Int_t *digits):
3bd79107 193 AliITSdigitSDD(phys,digits) {
f8dece8d 194 // Creates a digit object in a list of digits to be updated
3bd79107 195
f8dece8d 196 fTrackList = new TObjArray;
197}
3bd79107 198//__________________________________________________________________________
199AliITSTransientDigit::AliITSTransientDigit(const AliITSTransientDigit &source){
f8dece8d 200 // Copy Constructor
201 if(&source == this) return;
202 this->fTrackList = source.fTrackList;
203 return;
3bd79107 204}
3bd79107 205//_________________________________________________________________________
f8dece8d 206AliITSTransientDigit& AliITSTransientDigit::operator=(
207 const AliITSTransientDigit &source) {
208 // Assignment operator
209 if(&source == this) return *this;
210 this->fTrackList = source.fTrackList;
211 return *this;
3bd79107 212}
f8dece8d 213//______________________________________________________________________
214void AliITSTransientDigit::Print(ostream *os){
215 //Standard output format for this class
3bd79107 216
f8dece8d 217 AliITSdigitSDD::Print(os);
218}
219//______________________________________________________________________
220void AliITSTransientDigit::Read(istream *os){
221 //Standard input for this class
92c19c36 222
f8dece8d 223 AliITSdigitSDD::Read(os);
3bd79107 224}
f8dece8d 225//______________________________________________________________________
226ostream &operator<<(ostream &os,AliITSTransientDigit &source){
227 // Standard output streaming function.
3bd79107 228
f8dece8d 229 source.Print(&os);
230 return os;
231}
232//______________________________________________________________________
233istream &operator>>(istream &os,AliITSTransientDigit &source){
234 // Standard output streaming function.
235
236 source.Read(&os);
237 return os;
238}
239//______________________________________________________________________
240ClassImp(AliITSdigitSSD)
241AliITSdigitSSD::AliITSdigitSSD():AliITSdigit(){
242 // default constructor
243
244 fTracks[0] = fTracks[1] = fTracks[2] = -3;
245 fHits[0] = fHits[1] = fHits[2] = -1;
246}
247//__________________________________________________________________________
248AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits):AliITSdigit(digits){
249 // Creates a real SSD digit object
250}
3bd79107 251//_____________________________________________________________________________
f8dece8d 252AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits,const Int_t *tracks,
253 const Int_t *hits):AliITSdigit(digits){
254 // Creates a simulated SSD digit object
255
256 for(Int_t i=0; i<3; i++) {
257 fTracks[i] = tracks[i];
258 fHits[i] = hits[i];
259 } // end for i
3bd79107 260}
f8dece8d 261//______________________________________________________________________
262void AliITSdigitSSD::Print(ostream *os){
263 //Standard output format for this class
3bd79107 264
f8dece8d 265 AliITSdigit::Print(os);
266 *os <<","<< fTracks[0] <<","<< fTracks[1] <<","<< fTracks[2];
267 *os <<","<< fHits[0] <<","<< fHits[1] <<","<< fHits[2];
268}
269//______________________________________________________________________
270void AliITSdigitSSD::Read(istream *os){
271 //Standard input for this class
272
273 AliITSdigit::Read(os);
274 *os >> fTracks[0] >> fTracks[1] >> fTracks[2];
275 *os >> fHits[0] >> fHits[1] >> fHits[2];
276}
277//______________________________________________________________________
278ostream &operator<<(ostream &os,AliITSdigitSSD &source){
279 // Standard output streaming function.
280
281 source.Print(&os);
282 return os;
283}
284//______________________________________________________________________
285istream &operator>>(istream &os,AliITSdigitSSD &source){
286 // Standard output streaming function.
287
288 source.Read(&os);
289 return os;
290}