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 : TArrayF of TDC values //
27 // fAdc : TArrayF of ADC values //
29 // Getters, setters and member functions defined here //
31 // -- Authors: F. Pierella, A. Seganti, D. Vicinanza //
32 //_________________________________________________________________________//
39 #include "AliTOFGeometry.h"
40 #include "AliTOFSDigit.h"
42 ClassImp(AliTOFSDigit)
44 ////////////////////////////////////////////////////////////////////////
45 AliTOFSDigit::AliTOFSDigit():
61 ////////////////////////////////////////////////////////////////////////
62 AliTOFSDigit::AliTOFSDigit(Int_t tracknum, Int_t *vol,Float_t *digit):
75 // Constructor of digit object
84 fTdc = new TArrayF(fNDigits);
85 (*fTdc)[0] = digit[0];
86 fAdc = new TArrayF(fNDigits);
87 (*fAdc)[0] = digit[1];
88 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
89 (*fTracks)[0] = tracknum;
90 for (Int_t i = 1; i <kMAXDIGITS*fNDigits; i++) {
95 ////////////////////////////////////////////////////////////////////////
96 AliTOFSDigit::AliTOFSDigit(const AliTOFSDigit & digit):
109 // copy ctor for AliTOFSDigit object
111 fSector = digit.fSector;
112 fPlate = digit.fPlate;
113 fStrip = digit.fStrip;
116 fNDigits = digit.fNDigits;
117 fTdc = new TArrayF(*digit.fTdc);
118 fAdc = new TArrayF(*digit.fAdc);
119 fTracks = new TArrayI(*digit.fTracks);
122 ////////////////////////////////////////////////////////////////////////
123 AliTOFSDigit& AliTOFSDigit::operator=(const AliTOFSDigit & digit)
126 // copy ctor for AliTOFSDigit object
128 this->fSector = digit.fSector;
129 this->fPlate = digit.fPlate;
130 this->fStrip = digit.fStrip;
131 this->fPadx = digit.fPadx;
132 this->fPadz = digit.fPadz;
133 this->fNDigits = digit.fNDigits;
134 this->fTdc = digit.fTdc;
135 this->fAdc = digit.fAdc;
136 this->fTracks = digit.fTracks;
141 ////////////////////////////////////////////////////////////////////////
142 AliTOFSDigit::AliTOFSDigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
143 Int_t padz, Float_t tdc, Float_t adc):
155 // Constructor for sdigit
157 fTdc = new TArrayF(fNDigits);
159 fAdc = new TArrayF(fNDigits);
161 // no tracks were specified, set them to -1
162 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
163 for (Int_t i = 0; i <kMAXDIGITS*fNDigits; i++) {
168 ////////////////////////////////////////////////////////////////////////
169 void AliTOFSDigit::GetLocation(Int_t *Loc) const
172 // Get the coordinates of the digit
173 // in terms of Sector - Plate - Strip - Pad
183 ////////////////////////////////////////////////////////////////////////
184 void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
187 // Add charge and track
191 Float_t tdcwindow=((Float_t)AliTOFGeometry::TimeDiff())/tdcbin;
192 for (Int_t i = 0; i < fNDigits; i++) {
193 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
200 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
201 // update track - find the first -1 value and replace it by the
203 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
204 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
205 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
208 // write warning about many tracks going to this pad
209 if (iTrack == kMAXDIGITS) {
210 AliWarning("Many hits in the padhit");
211 // ToAliWarning(PrintPad());
218 (*fTdc)[fNDigits-1] = tdc;
220 (*fAdc)[fNDigits-1] = adc;
221 fTracks->Set(fNDigits*kMAXDIGITS);
222 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
223 for (Int_t i = 1; i <kMAXDIGITS; i++) {
224 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
230 ////////////////////////////////////////////////////////////////////////
231 void AliTOFSDigit::Update(AliTOFSDigit* sdig)
235 // Perform the sum with sdig
238 // start loop on all sdig locations
239 Int_t nlocations=sdig->GetNDigits();
241 for (Int_t j = 0; j < nlocations; j++) {
242 Float_t tdcbin = AliTOFGeometry::TdcBinWidth();// [ps] hardwired for the time being
243 Int_t tdc=(Int_t)sdig->GetTdc(j);
244 Int_t adc=(Int_t)sdig->GetAdc(j);
245 // getting here only the first track number
246 Int_t track=GetTrack(j,0);
250 Float_t tdcwindow=((Float_t)AliTOFGeometry::TimeDiff())/tdcbin;
251 for (Int_t i = 0; i < fNDigits; i++) {
252 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
259 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
260 // update track - find the first -1 value and replace it by the
262 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
263 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
264 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
267 // write warning about many tracks going to this pad
268 if (iTrack == kMAXDIGITS) {
269 AliWarning("Many hits in the padhit");
270 // ToAliWarning(PrintPad());
277 (*fTdc)[fNDigits-1] = tdc;
279 (*fAdc)[fNDigits-1] = adc;
280 fTracks->Set(fNDigits*kMAXDIGITS);
281 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
282 for (Int_t i = 1; i <kMAXDIGITS; i++) {
283 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
284 } // for (Int_t i = 1; i <kMAXDIGITS; i++)
285 } // if (sameTime >= 0)
286 } // end loop on sdig locations
289 ////////////////////////////////////////////////////////////////////////
290 AliTOFSDigit::~AliTOFSDigit()
300 ////////////////////////////////////////////////////////////////////////
302 Int_t AliTOFSDigit::GetTotPad(AliTOFGeometry *tofGeom) const
305 // Get the "total" index of the pad inside a Sector
306 // starting from the digits data.
309 Int_t pad = 2*fPadx + fPadz;
310 //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz;
318 before = tofGeom->NStripC();
321 before = AliTOFGeometry::NStripB() + tofGeom->NStripC();
324 before = AliTOFGeometry::NStripA() + AliTOFGeometry::NStripB() + tofGeom->NStripC();
327 before = AliTOFGeometry::NStripA() + 2*AliTOFGeometry::NStripB() + tofGeom->NStripC();
331 Int_t strip = fStrip + before;
332 Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;