Fixed bugs in SetDefaults.
[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//______________________________________________________________________
68AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits):AliITSdigit(digits){
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;
58005f18 73}
f8dece8d 74//______________________________________________________________________
75AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits,const Int_t *tracks,
76 const Int_t *hits): AliITSdigit(digits){
77 // Creates a simulated SPD digit object
3bd79107 78
f8dece8d 79 for(Int_t i=0; i<3; i++) {
80 fTracks[i] = tracks[i];
81 fHits[i] = hits[i];
82 } // end for i
83}
84//______________________________________________________________________
85void AliITSdigitSPD::Print(ostream *os){
86 //Standard output format for this class
87
88 AliITSdigit::Print(os);
89 *os <<","<< fTracks[0] <<","<< fTracks[1] <<","<< fTracks[2];
90 *os <<","<< fHits[0] <<","<< fHits[1] <<","<< fHits[2];
91}
92//______________________________________________________________________
93void AliITSdigitSPD::Read(istream *os){
94 //Standard input for this class
95
96 AliITSdigit::Read(os);
97 *os >> fTracks[0] >> fTracks[1] >> fTracks[2];
98 *os >> fHits[0] >> fHits[1] >> fHits[2];
99}
100//______________________________________________________________________
101ostream &operator<<(ostream &os,AliITSdigitSPD &source){
102 // Standard output streaming function.
103
104 source.Print(&os);
105 return os;
106}
107//______________________________________________________________________
108istream &operator>>(istream &os,AliITSdigitSPD &source){
109 // Standard output streaming function.
3bd79107 110
f8dece8d 111 source.Read(&os);
112 return os;
113}
114//______________________________________________________________________
3bd79107 115ClassImp(AliITSdigitSDD)
f8dece8d 116AliITSdigitSDD::AliITSdigitSDD():AliITSdigit(){
117 // default constructor, zero coordinates and set array
118 // elements to clearly unphysical values. A value of 0 may
119 // be a valide track of hit number.
92c19c36 120
f8dece8d 121 fTracks[0] = fTracks[1] = fTracks[2] = -3;
122 fHits[0] = fHits[1] = fHits[2] = -1;
123 fPhysics = 0;
124 fTcharges[0] = fTcharges[1] = fTcharges[2] = 0;
3bd79107 125}
f8dece8d 126//________________________________________________________________________
127AliITSdigitSDD::AliITSdigitSDD(Float_t phys,const Int_t *digits):
128 AliITSdigit(digits){
129 // Creates a simulated SDD digit object to be updated
3bd79107 130
f8dece8d 131 fPhysics = phys;
132}
3bd79107 133//_____________________________________________________________________________
f8dece8d 134AliITSdigitSDD::AliITSdigitSDD(Float_t phys,const Int_t *digits,
135 const Int_t *tracks,const Int_t *hits,
136 const Float_t *charges):
137 AliITSdigit(digits){
138 // Creates a simulated SDD digit object
139
140 fPhysics = phys;
141 for(Int_t i=0; i<3; i++) {
142 fTcharges[i] = charges[i];
143 fTracks[i] = tracks[i];
144 fHits[i] = hits[i];
145 } // end for i
3bd79107 146}
f8dece8d 147//______________________________________________________________________
148void AliITSdigitSDD::Print(ostream *os){
149 //Standard output format for this class
3bd79107 150
f8dece8d 151 AliITSdigit::Print(os);
152 *os <<","<< fPhysics;
153 *os <<","<< fTcharges[0] <<","<< fTcharges[1] <<","<< fTcharges[2];
154 *os <<","<< fTracks[0] <<","<< fTracks[1] <<","<< fTracks[2];
155 *os <<","<< fHits[0] <<","<< fHits[1] <<","<< fHits[2];
156}
157//______________________________________________________________________
158void AliITSdigitSDD::Read(istream *os){
159 //Standard input for this class
160
161 AliITSdigit::Read(os);
162 *os >>fPhysics;
163 *os >> fTcharges[0] >> fTcharges[1] >> fTcharges[2];
164 *os >> fTracks[0] >> fTracks[1] >> fTracks[2];
165 *os >> fHits[0] >> fHits[1] >> fHits[2];
166}
167//______________________________________________________________________
168ostream &operator<<(ostream &os,AliITSdigitSDD &source){
169 // Standard output streaming function.
170
171 source.Print(&os);
172 return os;
173}
174//______________________________________________________________________
175istream &operator>>(istream &os,AliITSdigitSDD &source){
176 // Standard output streaming function.
3bd79107 177
f8dece8d 178 source.Read(&os);
179 return os;
180}
181//______________________________________________________________________
3bd79107 182ClassImp(AliITSTransientDigit)
f8dece8d 183AliITSTransientDigit::AliITSTransientDigit(Float_t phys,const Int_t *digits):
3bd79107 184 AliITSdigitSDD(phys,digits) {
f8dece8d 185 // Creates a digit object in a list of digits to be updated
3bd79107 186
f8dece8d 187 fTrackList = new TObjArray;
188}
3bd79107 189//__________________________________________________________________________
190AliITSTransientDigit::AliITSTransientDigit(const AliITSTransientDigit &source){
f8dece8d 191 // Copy Constructor
192 if(&source == this) return;
193 this->fTrackList = source.fTrackList;
194 return;
3bd79107 195}
3bd79107 196//_________________________________________________________________________
f8dece8d 197AliITSTransientDigit& AliITSTransientDigit::operator=(
198 const AliITSTransientDigit &source) {
199 // Assignment operator
200 if(&source == this) return *this;
201 this->fTrackList = source.fTrackList;
202 return *this;
3bd79107 203}
f8dece8d 204//______________________________________________________________________
205void AliITSTransientDigit::Print(ostream *os){
206 //Standard output format for this class
3bd79107 207
f8dece8d 208 AliITSdigitSDD::Print(os);
209}
210//______________________________________________________________________
211void AliITSTransientDigit::Read(istream *os){
212 //Standard input for this class
92c19c36 213
f8dece8d 214 AliITSdigitSDD::Read(os);
3bd79107 215}
f8dece8d 216//______________________________________________________________________
217ostream &operator<<(ostream &os,AliITSTransientDigit &source){
218 // Standard output streaming function.
3bd79107 219
f8dece8d 220 source.Print(&os);
221 return os;
222}
223//______________________________________________________________________
224istream &operator>>(istream &os,AliITSTransientDigit &source){
225 // Standard output streaming function.
226
227 source.Read(&os);
228 return os;
229}
230//______________________________________________________________________
231ClassImp(AliITSdigitSSD)
232AliITSdigitSSD::AliITSdigitSSD():AliITSdigit(){
233 // default constructor
234
235 fTracks[0] = fTracks[1] = fTracks[2] = -3;
236 fHits[0] = fHits[1] = fHits[2] = -1;
237}
238//__________________________________________________________________________
239AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits):AliITSdigit(digits){
240 // Creates a real SSD digit object
241}
3bd79107 242//_____________________________________________________________________________
f8dece8d 243AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits,const Int_t *tracks,
244 const Int_t *hits):AliITSdigit(digits){
245 // Creates a simulated SSD digit object
246
247 for(Int_t i=0; i<3; i++) {
248 fTracks[i] = tracks[i];
249 fHits[i] = hits[i];
250 } // end for i
3bd79107 251}
f8dece8d 252//______________________________________________________________________
253void AliITSdigitSSD::Print(ostream *os){
254 //Standard output format for this class
3bd79107 255
f8dece8d 256 AliITSdigit::Print(os);
257 *os <<","<< fTracks[0] <<","<< fTracks[1] <<","<< fTracks[2];
258 *os <<","<< fHits[0] <<","<< fHits[1] <<","<< fHits[2];
259}
260//______________________________________________________________________
261void AliITSdigitSSD::Read(istream *os){
262 //Standard input for this class
263
264 AliITSdigit::Read(os);
265 *os >> fTracks[0] >> fTracks[1] >> fTracks[2];
266 *os >> fHits[0] >> fHits[1] >> fHits[2];
267}
268//______________________________________________________________________
269ostream &operator<<(ostream &os,AliITSdigitSSD &source){
270 // Standard output streaming function.
271
272 source.Print(&os);
273 return os;
274}
275//______________________________________________________________________
276istream &operator>>(istream &os,AliITSdigitSSD &source){
277 // Standard output streaming function.
278
279 source.Read(&os);
280 return os;
281}