}
}
+
+////////////////////////////////////////////////////////////////////////
+void AliTOFSDigit::Update(AliTOFSDigit* sdig)
+{
+
+ //
+ // Perform the sum with sdig
+ //
+
+ // start loop on all sdig locations
+ Int_t nlocations=sdig->GetNDigits();
+
+ for (Int_t j = 0; j < nlocations; j++) {
+ Float_t tdcbin=50.; // [ps] hardwired for the time being
+ Int_t tdc=(Int_t)sdig->GetTdc(j);
+ Int_t adc=(Int_t)sdig->GetAdc(j);
+ // getting here only the first track number
+ Int_t track=GetTrack(j,0);
+
+
+ Int_t sameTime = -1;
+ Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
+ for (Int_t i = 0; i < fNDigits; i++) {
+ if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
+ sameTime = i;
+ break;
+ }
+ }
+
+ if (sameTime >= 0) {
+ (*fAdc)[sameTime] += static_cast<Float_t>(adc);
+ // update track - find the first -1 value and replace it by the
+ // track number
+ for (Int_t iTrack=0; iTrack<kMAXDIGITS; iTrack++) {
+ if ((*fTracks)[sameTime*kMAXDIGITS+iTrack] == -1) {
+ (*fTracks)[sameTime*kMAXDIGITS+iTrack] = track;
+ break;
+ }
+ // write warning about many tracks going to this pad
+ if (iTrack == kMAXDIGITS) {
+ cerr<<"WARNING: AliTOFSDigit::Update Many hits in the padhit"<<endl;
+ cerr<<" ";
+ // PrintPad();
+ }
+ }
+ } else {
+ // add new time slot
+ fNDigits++;
+ fTdc->Set(fNDigits);
+ (*fTdc)[fNDigits-1] = tdc;
+ fAdc->Set(fNDigits);
+ (*fAdc)[fNDigits-1] = adc;
+ fTracks->Set(fNDigits*kMAXDIGITS);
+ (*fTracks)[(fNDigits-1)*kMAXDIGITS] = track;
+ for (Int_t i = 1; i <kMAXDIGITS; i++) {
+ (*fTracks)[(fNDigits-1)*kMAXDIGITS+i] = -1;
+ } // for (Int_t i = 1; i <kMAXDIGITS; i++)
+ } // if (sameTime >= 0)
+ } // end loop on sdig locations
+}
+
////////////////////////////////////////////////////////////////////////
AliTOFSDigit::~AliTOFSDigit()
{