Coding convention violations (RC17): suppression
[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
42//______________________________________________________________________________
655e379f 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}
56//______________________________________________________________________________
3e2f0097 57AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol, Int_t *digit)
655e379f 58 :AliDigit(tracks),
8a190ba2 59 fSector(vol[0]),
60 fPlate(vol[1]),
61 fStrip(vol[2]),
62 fPadx(vol[3]),
63 fPadz(vol[4]),
64 fTdc(digit[0]),
65 fTdcND(digit[3]),
66 fAdc(digit[1]),
67 fToT(digit[2])
68861244 68{
69//
70// Constructor of digit object
71//
68861244 72}
73
74//____________________________________________________________________________
75AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
655e379f 76 :AliDigit(digit),
8a190ba2 77 fSector(digit.fSector),
78 fPlate(digit.fPlate),
79 fStrip(digit.fStrip),
80 fPadx(digit.fPadx),
81 fPadz(digit.fPadz),
82 fTdc(digit.fTdc),
83 fTdcND(digit.fTdcND),
84 fAdc(digit.fAdc),
85 fToT(digit.fToT)
68861244 86{
87 //
88 // copy ctor for AliTOFdigit object
89 //
90
91 Int_t i ;
92 for ( i = 0; i < 3 ; i++)
93 fTracks[i] = digit.fTracks[i] ;
68861244 94
95}
96
97//______________________________________________________________________________
98AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
bf33f8f0 99 Int_t padz, Int_t tdc, Int_t adc):
8a190ba2 100 fSector(sector),
101 fPlate(plate),
102 fStrip(strip),
103 fPadx(padx),
104 fPadz(padz),
105 fTdc(tdc),
655e379f 106 fTdcND(0),
8a190ba2 107 fAdc(adc),
655e379f 108 fToT(0)
68861244 109{
110//
111// Constructor for sdigit
112//
68861244 113}
114
115//______________________________________________________________________________
3e2f0097 116void AliTOFdigit::GetLocation(Int_t *loc) const
68861244 117{
118//
119// Get the cohordinates of the digit
120// in terms of Sector - Plate - Strip - Pad
121//
122
3e2f0097 123 loc[0] = fSector;
124 loc[1] = fPlate;
125 loc[2] = fStrip;
126 loc[3] = fPadx;
127 loc[4] = fPadz;
68861244 128}
129
130//______________________________________________________________________________
96f01799 131Int_t AliTOFdigit::GetTotPad() const
68861244 132{
133//
134// Get the "total" index of the pad inside a Sector
135// starting from the digits data.
136//
137
68861244 138 Int_t before=0;
139
140 switch(fPlate){
7e6dce66 141 case 0:
142 //before = 0;
143 break;
144 case 1:
96f01799 145 before = AliTOFGeometry::NStripC();
7e6dce66 146 break;
147 case 2:
96f01799 148 before = AliTOFGeometry::NStripC() + AliTOFGeometry::NStripB();
7e6dce66 149 break;
150 case 3:
96f01799 151 before = AliTOFGeometry::NStripC() + AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
7e6dce66 152 break;
153 case 4:
96f01799 154 before = AliTOFGeometry::NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
7e6dce66 155 break;
68861244 156 }
157
c630773f 158 Int_t pad = AliTOFGeometry::NpadZ()*fPadx + fPadz;
7e6dce66 159 Int_t strip = fStrip + before;
160 Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
161
68861244 162 return padTot;
163}
164
165//______________________________________________________________________________
166void AliTOFdigit::AddTrack(Int_t track)
167{
168//
517b7f8f 169// Add a new and different track to the digit
68861244 170//
517b7f8f 171 if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return;
c630773f 172 if (fTracks[1]==-1)
517b7f8f 173 fTracks[1] = track;
c630773f 174 else if (fTracks[2]==-1)
517b7f8f 175 fTracks[2] = track;
c630773f 176 else
177 printf("W-AliTOFdigit::AddTrack: Too many tracks (>3) that contribute to the same TOF digit\n");
178
68861244 179}
180
181// Overloading of Streaming, Sum and Comparison operators
182
183//______________________________________________________________________________
184Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const
185{
186//
187// Overloading of Comparison operator
188//
189 if (fSector==digit.fSector &&
190 fPlate==digit.fPlate &&
191 fStrip==digit.fStrip &&
192 fPadx==digit.fPadx &&
193 fPadz==digit.fPadz &&
194 fTdc==digit.fTdc &&
6dc9348d 195 fTdcND==digit.fTdcND &&
196 fAdc==digit.fAdc &&
197 fToT==digit.fToT ) return kTRUE;
68861244 198 else return kFALSE;
199}
200
201//______________________________________________________________________________
655e379f 202AliTOFdigit AliTOFdigit::operator+(const AliTOFdigit &digit)
68861244 203{
204//
205// Overloading of Sum operator
206// Note: Some convolution
207// between the two digit variables has to be inserted
208//
209if (fSector==digit.fSector &&
210 fPlate==digit.fPlate &&
211 fStrip==digit.fStrip &&
212 fPadx==digit.fPadx &&
213 fPadz==digit.fPadz) {
214 // convolution to be inserted here
215 fTdc+=digit.fTdc;
216 fAdc+=digit.fAdc;
217 } else
218 AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc);
219 return *this;
220}
221
222//______________________________________________________________________________
0e74c396 223ostream& operator << (ostream & out, const AliTOFdigit &digit)
68861244 224{
d0eb8f39 225 //
226 // Output streamer: output of the digit data
227 //
228
229 out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
230 out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
231 out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
232
233 return out;
68861244 234}