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()
56 ////////////////////////////////////////////////////////////////////////
57 AliTOFSDigit::AliTOFSDigit(Int_t tracknum, Int_t *vol,Float_t *digit)
61 // Constructor of digit object
70 fTdc = new TArrayF(fNDigits);
71 (*fTdc)[0] = digit[0];
72 fAdc = new TArrayF(fNDigits);
73 (*fAdc)[0] = digit[1];
74 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
75 (*fTracks)[0] = tracknum;
76 for (Int_t i = 1; i <kMAXDIGITS*fNDigits; i++) {
81 ////////////////////////////////////////////////////////////////////////
82 AliTOFSDigit::AliTOFSDigit(const AliTOFSDigit & digit)
86 // copy ctor for AliTOFSDigit object
88 fSector = digit.fSector;
89 fPlate = digit.fPlate;
90 fStrip = digit.fStrip;
93 fNDigits = digit.fNDigits;
94 fTdc = new TArrayF(*digit.fTdc);
95 fAdc = new TArrayF(*digit.fAdc);
96 fTracks = new TArrayI(*digit.fTracks);
99 ////////////////////////////////////////////////////////////////////////
100 AliTOFSDigit& AliTOFSDigit::operator=(const AliTOFSDigit & digit)
103 // copy ctor for AliTOFSDigit object
105 this->fSector = digit.fSector;
106 this->fPlate = digit.fPlate;
107 this->fStrip = digit.fStrip;
108 this->fPadx = digit.fPadx;
109 this->fPadz = digit.fPadz;
110 this->fNDigits = digit.fNDigits;
111 this->fTdc = digit.fTdc;
112 this->fAdc = digit.fAdc;
113 this->fTracks = digit.fTracks;
118 ////////////////////////////////////////////////////////////////////////
119 AliTOFSDigit::AliTOFSDigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
120 Int_t padz, Float_t tdc, Float_t adc)
123 // Constructor for sdigit
131 fTdc = new TArrayF(fNDigits);
133 fAdc = new TArrayF(fNDigits);
135 // no tracks were specified, set them to -1
136 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
137 for (Int_t i = 0; i <kMAXDIGITS*fNDigits; i++) {
142 ////////////////////////////////////////////////////////////////////////
143 void AliTOFSDigit::GetLocation(Int_t *Loc) const
146 // Get the coordinates of the digit
147 // in terms of Sector - Plate - Strip - Pad
157 ////////////////////////////////////////////////////////////////////////
158 void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
161 // Add charge and track
165 Float_t tdcwindow=((Float_t)AliTOFGeometry::TimeDiff())/tdcbin;
166 for (Int_t i = 0; i < fNDigits; i++) {
167 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
174 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
175 // update track - find the first -1 value and replace it by the
177 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
178 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
179 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
182 // write warning about many tracks going to this pad
183 if (iTrack == kMAXDIGITS) {
184 AliWarning("Many hits in the padhit");
185 // ToAliWarning(PrintPad());
192 (*fTdc)[fNDigits-1] = tdc;
194 (*fAdc)[fNDigits-1] = adc;
195 fTracks->Set(fNDigits*kMAXDIGITS);
196 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
197 for (Int_t i = 1; i <kMAXDIGITS; i++) {
198 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
204 ////////////////////////////////////////////////////////////////////////
205 void AliTOFSDigit::Update(AliTOFSDigit* sdig)
209 // Perform the sum with sdig
212 // start loop on all sdig locations
213 Int_t nlocations=sdig->GetNDigits();
215 for (Int_t j = 0; j < nlocations; j++) {
216 Float_t tdcbin = AliTOFGeometry::TdcBinWidth();// [ps] hardwired for the time being
217 Int_t tdc=(Int_t)sdig->GetTdc(j);
218 Int_t adc=(Int_t)sdig->GetAdc(j);
219 // getting here only the first track number
220 Int_t track=GetTrack(j,0);
224 Float_t tdcwindow=((Float_t)AliTOFGeometry::TimeDiff())/tdcbin;
225 for (Int_t i = 0; i < fNDigits; i++) {
226 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
233 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
234 // update track - find the first -1 value and replace it by the
236 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
237 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
238 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
241 // write warning about many tracks going to this pad
242 if (iTrack == kMAXDIGITS) {
243 AliWarning("Many hits in the padhit");
244 // ToAliWarning(PrintPad());
251 (*fTdc)[fNDigits-1] = tdc;
253 (*fAdc)[fNDigits-1] = adc;
254 fTracks->Set(fNDigits*kMAXDIGITS);
255 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
256 for (Int_t i = 1; i <kMAXDIGITS; i++) {
257 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
258 } // for (Int_t i = 1; i <kMAXDIGITS; i++)
259 } // if (sameTime >= 0)
260 } // end loop on sdig locations
263 ////////////////////////////////////////////////////////////////////////
264 AliTOFSDigit::~AliTOFSDigit()
274 ////////////////////////////////////////////////////////////////////////
276 Int_t AliTOFSDigit::GetTotPad(AliTOFGeometry *tofGeom) const
279 // Get the "total" index of the pad inside a Sector
280 // starting from the digits data.
283 Int_t pad = 2*fPadx + fPadz;
284 //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz;
292 before = tofGeom->NStripC();
295 before = AliTOFGeometry::NStripB() + tofGeom->NStripC();
298 before = AliTOFGeometry::NStripA() + AliTOFGeometry::NStripB() + tofGeom->NStripC();
301 before = AliTOFGeometry::NStripA() + 2*AliTOFGeometry::NStripB() + tofGeom->NStripC();
305 Int_t strip = fStrip + before;
306 Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;