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