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
31 #include <Riostream.h>
36 #include "AliTOFSDigit.h"
37 #include "AliTOFConstants.h"
40 ClassImp(AliTOFSDigit)
42 ////////////////////////////////////////////////////////////////////////
43 AliTOFSDigit::AliTOFSDigit()
54 ////////////////////////////////////////////////////////////////////////
55 AliTOFSDigit::AliTOFSDigit(Int_t tracknum, Int_t *vol,Float_t *digit)
58 // Constructor of digit object
66 fTdc = new TArrayF(fNDigits);
67 (*fTdc)[0] = digit[0];
68 fAdc = new TArrayF(fNDigits);
69 (*fAdc)[0] = digit[1];
70 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
71 (*fTracks)[0] = tracknum;
72 for (Int_t i = 1; i <kMAXDIGITS*fNDigits; i++) {
77 ////////////////////////////////////////////////////////////////////////
78 AliTOFSDigit::AliTOFSDigit(const AliTOFSDigit & digit)
81 // copy ctor for AliTOFSDigit object
83 fSector = digit.fSector;
84 fPlate = digit.fPlate;
85 fStrip = digit.fStrip;
88 fNDigits = digit.fNDigits;
89 fTdc = new TArrayF(*digit.fTdc);
90 fAdc = new TArrayF(*digit.fAdc);
91 fTracks = new TArrayI(*digit.fTracks);
94 ////////////////////////////////////////////////////////////////////////
95 AliTOFSDigit::AliTOFSDigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
96 Int_t padz, Float_t tdc, Float_t adc)
99 // Constructor for sdigit
107 fTdc = new TArrayF(fNDigits);
109 fAdc = new TArrayF(fNDigits);
111 // no tracks were specified, set them to -1
112 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
113 for (Int_t i = 0; i <kMAXDIGITS*fNDigits; i++) {
118 ////////////////////////////////////////////////////////////////////////
119 void AliTOFSDigit::GetLocation(Int_t *Loc) const
122 // Get the coordinates of the digit
123 // in terms of Sector - Plate - Strip - Pad
133 ////////////////////////////////////////////////////////////////////////
134 void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
137 // Add charge and track
141 Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
142 for (Int_t i = 0; i < fNDigits; i++) {
143 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
150 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
151 // update track - find the first -1 value and replace it by the
153 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
154 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
155 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
158 // write warning about many tracks going to this pad
159 if (iTrack == kMAXDIGITS) {
160 cerr<<"WARNING: AliTOFSDigit::Update Many hits in the padhit"<<endl;
169 (*fTdc)[fNDigits-1] = tdc;
171 (*fAdc)[fNDigits-1] = adc;
172 fTracks->Set(fNDigits*kMAXDIGITS);
173 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
174 for (Int_t i = 1; i <kMAXDIGITS; i++) {
175 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
181 ////////////////////////////////////////////////////////////////////////
182 void AliTOFSDigit::Update(AliTOFSDigit* sdig)
186 // Perform the sum with sdig
189 // start loop on all sdig locations
190 Int_t nlocations=sdig->GetNDigits();
192 for (Int_t j = 0; j < nlocations; j++) {
193 Float_t tdcbin=50.; // [ps] hardwired for the time being
194 Int_t tdc=(Int_t)sdig->GetTdc(j);
195 Int_t adc=(Int_t)sdig->GetAdc(j);
196 // getting here only the first track number
197 Int_t track=GetTrack(j,0);
201 Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
202 for (Int_t i = 0; i < fNDigits; i++) {
203 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
210 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
211 // update track - find the first -1 value and replace it by the
213 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
214 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
215 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
218 // write warning about many tracks going to this pad
219 if (iTrack == kMAXDIGITS) {
220 cerr<<"WARNING: AliTOFSDigit::Update Many hits in the padhit"<<endl;
229 (*fTdc)[fNDigits-1] = tdc;
231 (*fAdc)[fNDigits-1] = adc;
232 fTracks->Set(fNDigits*kMAXDIGITS);
233 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
234 for (Int_t i = 1; i <kMAXDIGITS; i++) {
235 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
236 } // for (Int_t i = 1; i <kMAXDIGITS; i++)
237 } // if (sameTime >= 0)
238 } // end loop on sdig locations
241 ////////////////////////////////////////////////////////////////////////
242 AliTOFSDigit::~AliTOFSDigit()
252 ////////////////////////////////////////////////////////////////////////
254 Int_t AliTOFSDigit::GetTotPad() const
257 // Get the "total" index of the pad inside a Sector
258 // starting from the digits data.
261 Int_t pad = fPadx+AliTOFConstants::fgkNpadX*(fPadz-1);
267 case 2: before = AliTOFConstants::fgkNStripC;
269 case 3: before = AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
271 case 4: before = AliTOFConstants::fgkNStripA + AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
273 case 5: before = AliTOFConstants::fgkNStripA + 2*AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
277 Int_t strip = fStrip+before;
278 Int_t padTot = AliTOFConstants::fgkPadXStrip*(strip-1)+pad;