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 //_________________________________________________________________________//
34 //#include "TArrayI.h"
38 #include "AliTOFGeometry.h"
39 #include "AliTOFSDigit.h"
41 ClassImp(AliTOFSDigit)
43 ////////////////////////////////////////////////////////////////////////
44 AliTOFSDigit::AliTOFSDigit():
60 ////////////////////////////////////////////////////////////////////////
61 AliTOFSDigit::AliTOFSDigit(Int_t tracknum, Int_t *vol,Int_t *digit):
74 // Constructor of digit object
83 fTdc = new TArrayI(fNDigits);
84 (*fTdc)[0] = digit[0];
85 fAdc = new TArrayI(fNDigits);
86 (*fAdc)[0] = digit[1];
87 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
88 (*fTracks)[0] = tracknum;
89 for (Int_t i = 1; i <kMAXDIGITS*fNDigits; i++) {
94 ////////////////////////////////////////////////////////////////////////
95 AliTOFSDigit::AliTOFSDigit(const AliTOFSDigit & digit):
97 fSector(digit.fSector),
102 fNDigits(digit.fNDigits),
108 // copy ctor for AliTOFSDigit object
110 fTdc = new TArrayI(*digit.fTdc);
111 fAdc = new TArrayI(*digit.fAdc);
112 fTracks = new TArrayI(*digit.fTracks);
115 ////////////////////////////////////////////////////////////////////////
116 AliTOFSDigit& AliTOFSDigit::operator=(const AliTOFSDigit & digit)
119 // copy ctor for AliTOFSDigit object
125 TObject::operator=(digit);
126 fSector = digit.fSector;
127 fPlate = digit.fPlate;
128 fStrip = digit.fStrip;
131 fNDigits = digit.fNDigits;
134 fTracks = digit.fTracks;
139 ////////////////////////////////////////////////////////////////////////
140 AliTOFSDigit::AliTOFSDigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
141 Int_t padz, Int_t tdc, Int_t adc):
153 // Constructor for sdigit
155 fTdc = new TArrayI(fNDigits);
157 fAdc = new TArrayI(fNDigits);
159 // no tracks were specified, set them to -1
160 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
161 for (Int_t i = 0; i <kMAXDIGITS*fNDigits; i++) {
166 ////////////////////////////////////////////////////////////////////////
167 void AliTOFSDigit::GetLocation(Int_t *Loc) const
170 // Get the coordinates of the digit
171 // in terms of Sector - Plate - Strip - Pad
181 ////////////////////////////////////////////////////////////////////////
182 void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
185 // Add charge and track
189 Float_t tdcwindow=((Float_t)AliTOFGeometry::TimeDiff())/tdcbin;
190 for (Int_t i = 0; i < fNDigits; i++) {
191 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
198 (*fAdc)[sameTime] += adc;
199 // update track - find the first -1 value and replace it by the
201 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
202 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
203 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
206 // write warning about many tracks going to this pad
207 if (iTrack == kMAXDIGITS) {
208 AliWarning("Many hits in the padhit");
209 // ToAliWarning(PrintPad());
216 (*fTdc)[fNDigits-1] = tdc;
218 (*fAdc)[fNDigits-1] = adc;
219 fTracks->Set(fNDigits*kMAXDIGITS);
220 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
221 for (Int_t i = 1; i <kMAXDIGITS; i++) {
222 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
228 ////////////////////////////////////////////////////////////////////////
229 void AliTOFSDigit::Update(AliTOFSDigit* sdig)
233 // Perform the sum with sdig
236 // start loop on all sdig locations
237 Int_t nlocations=sdig->GetNDigits();
239 for (Int_t j = 0; j < nlocations; j++) {
240 Float_t tdcbin = AliTOFGeometry::TdcBinWidth();// [ps] hardwired for the time being
241 Int_t tdc=(Int_t)sdig->GetTdc(j);
242 Int_t adc=(Int_t)sdig->GetAdc(j);
243 // getting here only the first track number
244 Int_t track=GetTrack(j,0);
248 Float_t tdcwindow=((Float_t)AliTOFGeometry::TimeDiff())/tdcbin;
249 for (Int_t i = 0; i < fNDigits; i++) {
250 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
257 (*fAdc)[sameTime] += adc;
258 // update track - find the first -1 value and replace it by the
260 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
261 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
262 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
265 // write warning about many tracks going to this pad
266 if (iTrack == kMAXDIGITS) {
267 AliWarning("Many hits in the padhit");
268 // ToAliWarning(PrintPad());
275 (*fTdc)[fNDigits-1] = tdc;
277 (*fAdc)[fNDigits-1] = adc;
278 fTracks->Set(fNDigits*kMAXDIGITS);
279 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
280 for (Int_t i = 1; i <kMAXDIGITS; i++) {
281 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
282 } // for (Int_t i = 1; i <kMAXDIGITS; i++)
283 } // if (sameTime >= 0)
284 } // end loop on sdig locations
287 ////////////////////////////////////////////////////////////////////////
288 AliTOFSDigit::~AliTOFSDigit()
298 ////////////////////////////////////////////////////////////////////////
300 Int_t AliTOFSDigit::GetTotPad() const
303 // Get the "total" index of the pad inside a Sector
304 // starting from the digits data.
307 Int_t pad = 2*fPadx + fPadz;
308 //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz;
316 before = AliTOFGeometry::NStripC();
319 before = AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
322 before = AliTOFGeometry::NStripA() + AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
325 before = AliTOFGeometry::NStripA() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
329 Int_t strip = fStrip + before;
330 Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;