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 //_________________________________________________________________________
19 // TOF sdigit: member variables
20 // fSector : TOF sector
22 // fStrip : strips number
23 // fPadx : pad number along x
24 // fPadz : pad number along z
25 // fTdc : TArrayF of TDC values
26 // fAdc : TArrayF of ADC values
28 // Getters, setters and member functions defined here
30 //*-- Authors: F. Pierella, A. Seganti, D. Vicinanza
32 #include <Riostream.h>
38 #include "AliTOFConstants.h"
39 #include "AliTOFSDigit.h"
41 ClassImp(AliTOFSDigit)
43 ////////////////////////////////////////////////////////////////////////
44 AliTOFSDigit::AliTOFSDigit()
55 ////////////////////////////////////////////////////////////////////////
56 AliTOFSDigit::AliTOFSDigit(Int_t tracknum, Int_t *vol,Float_t *digit)
60 // Constructor of digit object
68 fTdc = new TArrayF(fNDigits);
69 (*fTdc)[0] = digit[0];
70 fAdc = new TArrayF(fNDigits);
71 (*fAdc)[0] = digit[1];
72 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
73 (*fTracks)[0] = tracknum;
74 for (Int_t i = 1; i <kMAXDIGITS*fNDigits; i++) {
79 ////////////////////////////////////////////////////////////////////////
80 AliTOFSDigit::AliTOFSDigit(const AliTOFSDigit & digit)
84 // copy ctor for AliTOFSDigit object
86 fSector = digit.fSector;
87 fPlate = digit.fPlate;
88 fStrip = digit.fStrip;
91 fNDigits = digit.fNDigits;
92 fTdc = new TArrayF(*digit.fTdc);
93 fAdc = new TArrayF(*digit.fAdc);
94 fTracks = new TArrayI(*digit.fTracks);
97 ////////////////////////////////////////////////////////////////////////
98 AliTOFSDigit::AliTOFSDigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
99 Int_t padz, Float_t tdc, Float_t adc)
102 // Constructor for sdigit
110 fTdc = new TArrayF(fNDigits);
112 fAdc = new TArrayF(fNDigits);
114 // no tracks were specified, set them to -1
115 fTracks = new TArrayI(kMAXDIGITS*fNDigits);
116 for (Int_t i = 0; i <kMAXDIGITS*fNDigits; i++) {
121 ////////////////////////////////////////////////////////////////////////
122 void AliTOFSDigit::GetLocation(Int_t *Loc) const
125 // Get the coordinates of the digit
126 // in terms of Sector - Plate - Strip - Pad
136 ////////////////////////////////////////////////////////////////////////
137 void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
140 // Add charge and track
144 Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
145 for (Int_t i = 0; i < fNDigits; i++) {
146 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
153 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
154 // update track - find the first -1 value and replace it by the
156 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
157 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
158 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
161 // write warning about many tracks going to this pad
162 if (iTrack == kMAXDIGITS) {
163 cerr<<"WARNING: AliTOFSDigit::Update Many hits in the padhit"<<endl;
172 (*fTdc)[fNDigits-1] = tdc;
174 (*fAdc)[fNDigits-1] = adc;
175 fTracks->Set(fNDigits*kMAXDIGITS);
176 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
177 for (Int_t i = 1; i <kMAXDIGITS; i++) {
178 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
184 ////////////////////////////////////////////////////////////////////////
185 void AliTOFSDigit::Update(AliTOFSDigit* sdig)
189 // Perform the sum with sdig
192 // start loop on all sdig locations
193 Int_t nlocations=sdig->GetNDigits();
195 for (Int_t j = 0; j < nlocations; j++) {
196 Float_t tdcbin=50.; // [ps] hardwired for the time being
197 Int_t tdc=(Int_t)sdig->GetTdc(j);
198 Int_t adc=(Int_t)sdig->GetAdc(j);
199 // getting here only the first track number
200 Int_t track=GetTrack(j,0);
204 Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
205 for (Int_t i = 0; i < fNDigits; i++) {
206 if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
213 (*fAdc)[sameTime] += static_cast<Float_t>(adc);
214 // update track - find the first -1 value and replace it by the
216 for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
217 if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
218 (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
221 // write warning about many tracks going to this pad
222 if (iTrack == kMAXDIGITS) {
223 cerr<<"WARNING: AliTOFSDigit::Update Many hits in the padhit"<<endl;
232 (*fTdc)[fNDigits-1] = tdc;
234 (*fAdc)[fNDigits-1] = adc;
235 fTracks->Set(fNDigits*kMAXDIGITS);
236 (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
237 for (Int_t i = 1; i <kMAXDIGITS; i++) {
238 (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
239 } // for (Int_t i = 1; i <kMAXDIGITS; i++)
240 } // if (sameTime >= 0)
241 } // end loop on sdig locations
244 ////////////////////////////////////////////////////////////////////////
245 AliTOFSDigit::~AliTOFSDigit()
255 ////////////////////////////////////////////////////////////////////////
257 Int_t AliTOFSDigit::GetTotPad() const
260 // Get the "total" index of the pad inside a Sector
261 // starting from the digits data.
264 Int_t pad = fPadx+AliTOFConstants::fgkNpadX*(fPadz-1);
270 case 2: before = AliTOFConstants::fgkNStripC;
272 case 3: before = AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
274 case 4: before = AliTOFConstants::fgkNStripA + AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
276 case 5: before = AliTOFConstants::fgkNStripA + 2*AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
280 Int_t strip = fStrip+before;
281 Int_t padTot = AliTOFConstants::fgkPadXStrip*(strip-1)+pad;