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 sdigit: 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 : TArrayI of TDC values //
27 // fAdc : TArrayI of ADC values //
29 // Getters, setters and member functions defined here //
31 // -- Authors: F. Pierella, A. Seganti, D. Vicinanza //
32 //_________________________________________________________________________//
36 #include "AliTOFGeometry.h"
37 #include "AliTOFSDigit.h"
39 ClassImp(AliTOFSDigit)
41 ////////////////////////////////////////////////////////////////////////
42 AliTOFSDigit::AliTOFSDigit():
58 ////////////////////////////////////////////////////////////////////////
59 AliTOFSDigit::AliTOFSDigit(Int_t tracknum, Int_t * const vol,Int_t * const digit):
72 // Constructor of digit object
81 fTdc = new TArrayI(fNDigits);
82 (*fTdc)[0] = digit[0];
83 fAdc = new TArrayI(fNDigits);
84 (*fAdc)[0] = digit[1];
85 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
86 (*fTracks)[0] = tracknum;
87 for (Int_t i = 1; i <kMAXDIGITS*fNDigits; i++) {
92 ////////////////////////////////////////////////////////////////////////
93 AliTOFSDigit::AliTOFSDigit(const AliTOFSDigit & digit):
95 fSector(digit.fSector),
100 fNDigits(digit.fNDigits),
106 // copy ctor for AliTOFSDigit object
108 fTdc = new TArrayI(*digit.fTdc);
109 fAdc = new TArrayI(*digit.fAdc);
110 fTracks = new TArrayI(*digit.fTracks);
113 ////////////////////////////////////////////////////////////////////////
114 AliTOFSDigit& AliTOFSDigit::operator=(const AliTOFSDigit & digit)
117 // copy ctor for AliTOFSDigit object
123 TObject::operator=(digit);
124 fSector = digit.fSector;
125 fPlate = digit.fPlate;
126 fStrip = digit.fStrip;
129 fNDigits = digit.fNDigits;
132 fTracks = digit.fTracks;
137 ////////////////////////////////////////////////////////////////////////
138 AliTOFSDigit::AliTOFSDigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
139 Int_t padz, Int_t tdc, Int_t adc):
151 // Constructor for sdigit
153 fTdc = new TArrayI(fNDigits);
155 fAdc = new TArrayI(fNDigits);
157 // no tracks were specified, set them to -1
158 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
159 for (Int_t i = 0; i <kMAXDIGITS*fNDigits; i++) {
164 ////////////////////////////////////////////////////////////////////////
165 void AliTOFSDigit::GetLocation(Int_t *Loc) const
168 // Get the coordinates of the digit
169 // in terms of Sector - Plate - Strip - Pad
179 ////////////////////////////////////////////////////////////////////////
180 void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
183 // Add charge and track
187 Float_t tdcwindow = AliTOFGeometry::DeadTime()/tdcbin;
188 for (Int_t i = 0; i < fNDigits; i++) {
189 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
195 if (sameTime >= 0) { // another time measurement happens during the
196 // dead time of the hit pad => it corresponds
197 // to the same time measurement
198 (*fAdc)[sameTime] += adc;
200 // update track index array in case the current digit track index
201 // is different from -1
204 //Find the first -1 value of the track index array and replace
205 //it by the current digit track index
206 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
207 if (track==(*fTracks)[sameTime*kMAXDIGITS+iTrack]) break;
208 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
209 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
212 // write warning about many tracks going to this pad at same time
213 if (iTrack == kMAXDIGITS-1) {
214 AliDebug(1,Form("Update: Many different tracks in the same TOF pad"
215 " (%2d %1d %2d %1d %2d)\n",
216 fSector,fPlate,fStrip,fPadz,fPadx));
217 //ToAliWarning(PrintPad());
222 } else { // they are two different time measurements
227 (*fTdc)[fNDigits-1] = tdc;
229 (*fAdc)[fNDigits-1] = adc;
230 fTracks->Set(fNDigits*kMAXDIGITS);
231 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
232 for (Int_t i = 1; i <kMAXDIGITS; i++)
233 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
239 ////////////////////////////////////////////////////////////////////////
240 void AliTOFSDigit::Update(AliTOFSDigit * const sdig)
244 // Perform the sum with sdig
247 Float_t tdcbin = AliTOFGeometry::TdcBinWidth();// [ps] hardwired for the time being
253 // start loop on all sdig locations
254 Int_t nlocations = sdig->GetNDigits();
255 for (Int_t j = 0; j < nlocations; j++) {
256 tdc = (Int_t)sdig->GetTdc(j);
257 adc = (Int_t)sdig->GetAdc(j);
259 // getting here only the first track number
260 //Int_t track = GetTrack(j,0);
262 // getting here all the track numbers
263 for (Int_t iTrack = 0; iTrack<kMAXDIGITS; iTrack++) {
264 track = sdig->GetTrack(j,iTrack);
265 Update(tdcbin, tdc, adc, track);
266 } // end loop on tracks
268 } // end loop on sdig locations
273 ////////////////////////////////////////////////////////////////////////
274 AliTOFSDigit::~AliTOFSDigit()
284 ////////////////////////////////////////////////////////////////////////
286 Int_t AliTOFSDigit::GetTotPad() const
289 // Get the "total" index of the pad inside a Sector
290 // starting from the digits data.
293 Int_t pad = AliTOFGeometry::NpadZ()*fPadx + fPadz;
301 before = AliTOFGeometry::NStripC();
304 before = AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
307 before = AliTOFGeometry::NStripA() + AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
310 before = AliTOFGeometry::NStripA() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
314 Int_t strip = fStrip + before;
315 Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;