]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFdigit.cxx
Adding comments (Laurent)
[u/mrichter/AliRoot.git] / TOF / AliTOFdigit.cxx
CommitLineData
68861244 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
88cb7938 16/* $Id$ */
17
0e46b9ae 18//_________________________________________________________________________//
19// //
20// TOF digit: member variables //
21// fSector : TOF sector //
22// fPlate : TOF plate //
23// fStrip : strips number //
24// fPadx : pad number along x //
25// fPadz : pad number along z //
26// fTdc : TDC //
27// fAdc : ADC //
28// //
29// Getters, setters and member functions defined here //
30// //
31// -- Authors: F. Pierella, A. Seganti, D. Vicinanza //
32//_________________________________________________________________________//
88cb7938 33
34
0e46b9ae 35#include "Riostream.h"
d3c7bfac 36
68861244 37#include "AliTOFdigit.h"
0e46b9ae 38#include "AliTOFGeometry.h"
68861244 39
40ClassImp(AliTOFdigit)
41
655e379f 42//______________________________________________________________________________
43AliTOFdigit::AliTOFdigit()
44 :AliDigit(),
45 fSector(-1),
46 fPlate(-1),
47 fStrip(-1),
48 fPadx(-1),
49 fPadz(-1),
50 fTdc(0),
51 fTdcND(0),
52 fAdc(0),
53 fToT(0)
54{
55}
68861244 56//______________________________________________________________________________
bf33f8f0 57AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Int_t *digit)
655e379f 58 :AliDigit(tracks),
59 fSector(-1),
60 fPlate(-1),
61 fStrip(-1),
62 fPadx(-1),
63 fPadz(-1),
64 fTdc(0),
65 fTdcND(0),
66 fAdc(0),
67 fToT(0)
68861244 68{
69//
70// Constructor of digit object
71//
d0eb8f39 72
68861244 73 fSector = vol[0];
74 fPlate = vol[1];
75 fStrip = vol[2];
7e6dce66 76 fPadx = vol[3];
77 fPadz = vol[4];
68861244 78 fTdc = digit[0];
79 fAdc = digit[1];
d0eb8f39 80 fToT = digit[2];
bf33f8f0 81 fTdcND = digit[3];
d0eb8f39 82
68861244 83}
84
85//____________________________________________________________________________
86AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
655e379f 87 :AliDigit(digit),
88 fSector(-1),
89 fPlate(-1),
90 fStrip(-1),
91 fPadx(-1),
92 fPadz(-1),
93 fTdc(0),
94 fTdcND(0),
95 fAdc(0),
96 fToT(0)
68861244 97{
98 //
99 // copy ctor for AliTOFdigit object
100 //
101
102 Int_t i ;
103 for ( i = 0; i < 3 ; i++)
104 fTracks[i] = digit.fTracks[i] ;
105 fSector = digit.fSector;
106 fPlate = digit.fPlate;
107 fStrip = digit.fStrip;
108 fPadx = digit.fPadx;
109 fPadz = digit.fPadz;
110 fTdc = digit.fTdc;
6dc9348d 111 fTdcND = digit.fTdcND;
68861244 112 fAdc = digit.fAdc;
6dc9348d 113 fToT = digit.fToT;
68861244 114
115}
116
117//______________________________________________________________________________
118AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
bf33f8f0 119 Int_t padz, Int_t tdc, Int_t adc):
655e379f 120 fSector(-1),
121 fPlate(-1),
122 fStrip(-1),
123 fPadx(-1),
124 fPadz(-1),
125 fTdc(0),
126 fTdcND(0),
127 fAdc(0),
128 fToT(0)
68861244 129{
130//
131// Constructor for sdigit
132//
133 fSector = sector;
134 fPlate = plate;
135 fStrip = strip;
136 fPadx = padx;
137 fPadz = padz;
138 fTdc = tdc;
6dc9348d 139 fTdcND = 0;
68861244 140 fAdc = adc;
6dc9348d 141 fToT = 0;
68861244 142}
143
144//______________________________________________________________________________
145void AliTOFdigit::GetLocation(Int_t *Loc) const
146{
147//
148// Get the cohordinates of the digit
149// in terms of Sector - Plate - Strip - Pad
150//
151
152 Loc[0]=fSector;
153 Loc[1]=fPlate;
154 Loc[2]=fStrip;
155 Loc[3]=fPadx;
156 Loc[4]=fPadz;
157}
158
159//______________________________________________________________________________
d3c7bfac 160Int_t AliTOFdigit::GetTotPad(AliTOFGeometry *tofGeom) const
68861244 161{
162//
163// Get the "total" index of the pad inside a Sector
164// starting from the digits data.
165//
166
68861244 167 Int_t before=0;
168
169 switch(fPlate){
7e6dce66 170 case 0:
171 //before = 0;
172 break;
173 case 1:
d3c7bfac 174 before = tofGeom->NStripC();
7e6dce66 175 break;
176 case 2:
d3c7bfac 177 before = tofGeom->NStripC() + AliTOFGeometry::NStripB();
7e6dce66 178 break;
179 case 3:
d3c7bfac 180 before = tofGeom->NStripC() + AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
7e6dce66 181 break;
182 case 4:
d3c7bfac 183 before = tofGeom->NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
7e6dce66 184 break;
68861244 185 }
186
7e6dce66 187 Int_t pad = 2*fPadx + fPadz;
188 //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz;
189 Int_t strip = fStrip + before;
190 Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
191
68861244 192 return padTot;
193}
194
195//______________________________________________________________________________
196void AliTOFdigit::AddTrack(Int_t track)
197{
198//
517b7f8f 199// Add a new and different track to the digit
68861244 200//
517b7f8f 201 if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return;
202 if (fTracks[1]==0){
203 fTracks[1] = track;
204 }else if (fTracks[2]==0){
205 fTracks[2] = track;
206 }else{
207 // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n");
208 }
68861244 209}
210
211// Overloading of Streaming, Sum and Comparison operators
212
213//______________________________________________________________________________
214Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const
215{
216//
217// Overloading of Comparison operator
218//
219 if (fSector==digit.fSector &&
220 fPlate==digit.fPlate &&
221 fStrip==digit.fStrip &&
222 fPadx==digit.fPadx &&
223 fPadz==digit.fPadz &&
224 fTdc==digit.fTdc &&
6dc9348d 225 fTdcND==digit.fTdcND &&
226 fAdc==digit.fAdc &&
227 fToT==digit.fToT ) return kTRUE;
68861244 228 else return kFALSE;
229}
230
231//______________________________________________________________________________
655e379f 232AliTOFdigit AliTOFdigit::operator+(const AliTOFdigit &digit)
68861244 233{
234//
235// Overloading of Sum operator
236// Note: Some convolution
237// between the two digit variables has to be inserted
238//
239if (fSector==digit.fSector &&
240 fPlate==digit.fPlate &&
241 fStrip==digit.fStrip &&
242 fPadx==digit.fPadx &&
243 fPadz==digit.fPadz) {
244 // convolution to be inserted here
245 fTdc+=digit.fTdc;
246 fAdc+=digit.fAdc;
247 } else
248 AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc);
249 return *this;
250}
251
252//______________________________________________________________________________
253ostream& operator << (ostream& out, const AliTOFdigit &digit)
254{
d0eb8f39 255 //
256 // Output streamer: output of the digit data
257 //
258
259 out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
260 out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
261 out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
262
263 return out;
68861244 264}