1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________//
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 //
29 // Getters, setters and member functions defined here //
31 // -- Authors: F. Pierella, A. Seganti, D. Vicinanza //
32 //_________________________________________________________________________//
35 #include "Riostream.h"
37 #include "AliTOFdigit.h"
38 #include "AliTOFGeometry.h"
44 //______________________________________________________________________________
45 AliTOFdigit::AliTOFdigit()
58 //______________________________________________________________________________
59 AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol, Int_t *digit)
72 // Constructor of digit object
76 //____________________________________________________________________________
77 AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
79 fSector(digit.fSector),
90 // copy ctor for AliTOFdigit object
94 for ( i = 0; i < 3 ; i++)
95 fTracks[i] = digit.fTracks[i] ;
99 //______________________________________________________________________________
100 AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
101 Int_t padz, Int_t tdc, Int_t adc):
113 // Constructor for sdigit
117 //______________________________________________________________________________
118 void AliTOFdigit::GetLocation(Int_t *loc) const
121 // Get the cohordinates of the digit
122 // in terms of Sector - Plate - Strip - Pad
132 //______________________________________________________________________________
133 Int_t AliTOFdigit::GetTotPad() const
136 // Get the "total" index of the pad inside a Sector
137 // starting from the digits data.
147 before = AliTOFGeometry::NStripC();
150 before = AliTOFGeometry::NStripC() + AliTOFGeometry::NStripB();
153 before = AliTOFGeometry::NStripC() + AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
156 before = AliTOFGeometry::NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
160 Int_t pad = AliTOFGeometry::NpadZ()*fPadx + fPadz;
161 Int_t strip = fStrip + before;
162 Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
167 //______________________________________________________________________________
168 void AliTOFdigit::AddTrack(Int_t track)
171 // Add a new and different track to the digit
173 if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return;
176 else if (fTracks[2]==-1)
179 printf("W-AliTOFdigit::AddTrack: Too many tracks (>3) that contribute to the same TOF digit\n");
183 // Overloading of Streaming, Sum and Comparison operators
185 //______________________________________________________________________________
186 Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const
189 // Overloading of Comparison operator
191 if (fSector==digit.fSector &&
192 fPlate==digit.fPlate &&
193 fStrip==digit.fStrip &&
194 fPadx==digit.fPadx &&
195 fPadz==digit.fPadz &&
197 fTdcND==digit.fTdcND &&
199 fToT==digit.fToT ) return kTRUE;
203 //______________________________________________________________________________
204 AliTOFdigit AliTOFdigit::operator+(const AliTOFdigit &digit)
207 // Overloading of Sum operator
208 // Note: Some convolution
209 // between the two digit variables has to be inserted
211 if (fSector==digit.fSector &&
212 fPlate==digit.fPlate &&
213 fStrip==digit.fStrip &&
214 fPadx==digit.fPadx &&
215 fPadz==digit.fPadz) {
216 // convolution to be inserted here
220 AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc);
224 //______________________________________________________________________________
225 ostream& operator << (ostream & out, const AliTOFdigit &digit)
228 // Output streamer: output of the digit data
231 out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
232 out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
233 out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;