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 //_________________________________________________________________________
19 // TOF digit: member variables
20 // fSector : TOF sector
22 // fStrip : strips number
23 // fPadx : pad number along x
24 // fPadz : pad number along z
28 // Getters, setters and member functions defined here
30 //*-- Authors: F. Pierella, A. Seganti, D. Vicinanza
33 #include <Riostream.h>
37 #include "AliTOFdigit.h"
41 //______________________________________________________________________________
42 AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit)
46 // Constructor of digit object
57 //____________________________________________________________________________
58 AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
62 // copy ctor for AliTOFdigit object
66 for ( i = 0; i < 3 ; i++)
67 fTracks[i] = digit.fTracks[i] ;
68 fSector = digit.fSector;
69 fPlate = digit.fPlate;
70 fStrip = digit.fStrip;
78 //______________________________________________________________________________
79 AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
80 Int_t padz, Float_t tdc, Float_t adc)
83 // Constructor for sdigit
94 //______________________________________________________________________________
95 void AliTOFdigit::GetLocation(Int_t *Loc) const
98 // Get the cohordinates of the digit
99 // in terms of Sector - Plate - Strip - Pad
109 //______________________________________________________________________________
110 Int_t AliTOFdigit::GetTotPad() const
113 // Get the "total" index of the pad inside a Sector
114 // starting from the digits data.
120 tof =(AliTOF*) gAlice->GetDetector("TOF");
122 printf("AliTOFdigit::GetTotPad - No AliRun object present, exiting");
126 Int_t pad = fPadx+tof->GetNpadX()*(fPadz-1);
132 case 2: before = tof->GetNStripC();
134 case 3: before = tof->GetNStripB() + tof->GetNStripC();
136 case 4: before = tof->GetNStripA() + tof->GetNStripB() + tof->GetNStripC();
138 case 5: before = tof->GetNStripA() + 2*tof->GetNStripB() + tof->GetNStripC();
142 Int_t strip = fStrip+before;
143 Int_t padTot = tof->GetPadXStr()*(strip-1)+pad;
147 //______________________________________________________________________________
148 void AliTOFdigit::AddTrack(Int_t track)
151 // Add a new and different track to the digit
153 if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return;
156 }else if (fTracks[2]==0){
159 // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n");
163 // Overloading of Streaming, Sum and Comparison operators
165 //______________________________________________________________________________
166 Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const
169 // Overloading of Comparison operator
171 if (fSector==digit.fSector &&
172 fPlate==digit.fPlate &&
173 fStrip==digit.fStrip &&
174 fPadx==digit.fPadx &&
175 fPadz==digit.fPadz &&
177 fAdc==digit.fAdc) return kTRUE;
181 //______________________________________________________________________________
182 AliTOFdigit& AliTOFdigit::operator+(AliTOFdigit const &digit)
185 // Overloading of Sum operator
186 // Note: Some convolution
187 // between the two digit variables has to be inserted
189 if (fSector==digit.fSector &&
190 fPlate==digit.fPlate &&
191 fStrip==digit.fStrip &&
192 fPadx==digit.fPadx &&
193 fPadz==digit.fPadz) {
194 // convolution to be inserted here
198 AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc);
202 //______________________________________________________________________________
203 ostream& operator << (ostream& out, const AliTOFdigit &digit)
206 // Output streamer: output of the digit data
208 out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
209 out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
210 out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;