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 **************************************************************************/
17 //_________________________________________________________________________
18 // TOF sdigit: member variables
19 // fSector : TOF sector
21 // fStrip : strips number
22 // fPadx : pad number along x
23 // fPadz : pad number along z
24 // fTdc : TArrayF of TDC values
25 // fAdc : TArrayF of ADC values
27 // Getters, setters and member functions defined here
29 //*-- Authors: F. Pierella, A. Seganti, D. Vicinanza
36 #include "AliTOFSDigit.h"
37 #include "AliTOFConstants.h"
41 ClassImp(AliTOFSDigit)
43 ////////////////////////////////////////////////////////////////////////
44 AliTOFSDigit::AliTOFSDigit()
55 ////////////////////////////////////////////////////////////////////////
56 AliTOFSDigit::AliTOFSDigit(Int_t tracknum, Int_t *vol,Float_t *digit)
59 // Constructor of digit object
67 fTdc = new TArrayF(fNDigits);
68 (*fTdc)[0] = digit[0];
69 fAdc = new TArrayF(fNDigits);
70 (*fAdc)[0] = digit[1];
71 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
72 (*fTracks)[0] = tracknum;
73 for (Int_t i = 1; i <kMAXDIGITS*fNDigits; i++) {
78 ////////////////////////////////////////////////////////////////////////
79 AliTOFSDigit::AliTOFSDigit(const AliTOFSDigit & digit)
82 // copy ctor for AliTOFSDigit object
84 fSector = digit.fSector;
85 fPlate = digit.fPlate;
86 fStrip = digit.fStrip;
89 fNDigits = digit.fNDigits;
90 fTdc = new TArrayF(*digit.fTdc);
91 fAdc = new TArrayF(*digit.fAdc);
92 fTracks = new TArrayI(*digit.fTracks);
95 ////////////////////////////////////////////////////////////////////////
96 AliTOFSDigit::AliTOFSDigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
97 Int_t padz, Float_t tdc, Float_t adc)
100 // Constructor for sdigit
108 fTdc = new TArrayF(fNDigits);
110 fAdc = new TArrayF(fNDigits);
112 // no tracks were specified, set them to -1
113 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
114 for (Int_t i = 0; i <kMAXDIGITS*fNDigits; i++) {
119 ////////////////////////////////////////////////////////////////////////
120 void AliTOFSDigit::GetLocation(Int_t *Loc) const
123 // Get the coordinates of the digit
124 // in terms of Sector - Plate - Strip - Pad
134 ////////////////////////////////////////////////////////////////////////
135 void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
138 // Add charge and track
142 Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
143 for (Int_t i = 0; i < fNDigits; i++) {
144 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
151 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
152 // update track - find the first -1 value and replace it by the
154 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
155 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
156 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
159 // write warning about many tracks going to this pad
160 if (iTrack == kMAXDIGITS) {
161 cerr<<"WARNING: AliTOFSDigit::Update Many hits in the padhit"<<endl;
170 (*fTdc)[fNDigits-1] = tdc;
172 (*fAdc)[fNDigits-1] = adc;
173 fTracks->Set(fNDigits*kMAXDIGITS);
174 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
175 for (Int_t i = 1; i <kMAXDIGITS; i++) {
176 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
182 ////////////////////////////////////////////////////////////////////////
183 void AliTOFSDigit::Update(AliTOFSDigit* sdig)
187 // Perform the sum with sdig
190 // start loop on all sdig locations
191 Int_t nlocations=sdig->GetNDigits();
193 for (Int_t j = 0; j < nlocations; j++) {
194 Float_t tdcbin=50.; // [ps] hardwired for the time being
195 Int_t tdc=(Int_t)sdig->GetTdc(j);
196 Int_t adc=(Int_t)sdig->GetAdc(j);
197 // getting here only the first track number
198 Int_t track=GetTrack(j,0);
202 Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
203 for (Int_t i = 0; i < fNDigits; i++) {
204 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
211 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
212 // update track - find the first -1 value and replace it by the
214 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
215 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
216 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
219 // write warning about many tracks going to this pad
220 if (iTrack == kMAXDIGITS) {
221 cerr<<"WARNING: AliTOFSDigit::Update Many hits in the padhit"<<endl;
230 (*fTdc)[fNDigits-1] = tdc;
232 (*fAdc)[fNDigits-1] = adc;
233 fTracks->Set(fNDigits*kMAXDIGITS);
234 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
235 for (Int_t i = 1; i <kMAXDIGITS; i++) {
236 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
237 } // for (Int_t i = 1; i <kMAXDIGITS; i++)
238 } // if (sameTime >= 0)
239 } // end loop on sdig locations
242 ////////////////////////////////////////////////////////////////////////
243 AliTOFSDigit::~AliTOFSDigit()
253 ////////////////////////////////////////////////////////////////////////
255 Int_t AliTOFSDigit::GetTotPad() const
258 // Get the "total" index of the pad inside a Sector
259 // starting from the digits data.
262 Int_t pad = fPadx+AliTOFConstants::fgkNpadX*(fPadz-1);
268 case 2: before = AliTOFConstants::fgkNStripC;
270 case 3: before = AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
272 case 4: before = AliTOFConstants::fgkNStripA + AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
274 case 5: before = AliTOFConstants::fgkNStripA + 2*AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
278 Int_t strip = fStrip+before;
279 Int_t padTot = AliTOFConstants::fgkPadXStrip*(strip-1)+pad;