+ new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
+ //look if we have to add signal?
+ digit = (AliPHOSDigit *) digits->At(absID-1) ;
+
+ if(absID==nextSig){
+ //Add SDigits from all inputs
+ ticks->Clear() ;
+ Int_t contrib = 0 ;
+ Float_t a = digit->GetAmp() ;
+ Float_t b = TMath::Abs( a /fTimeSignalLength) ;
+ //Mark the beginnign of the signal
+ new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime(),0, b);
+ //Mark the end of the ignal
+ new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime()+fTimeSignalLength, -a, -b);
+
+ //loop over inputs
+ for(i=0; i<input; i++){
+ if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
+ curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
+ else
+ curSDigit = 0 ;
+ //May be several digits will contribute from the same input
+ while(curSDigit && curSDigit->GetId() == absID){
+ //Shift primary to separate primaries belonging different inputs
+ Int_t primaryoffset ;
+ if(fManager)
+ primaryoffset = fManager->GetMask(i) ;
+ else
+ primaryoffset = 10000000*i ;
+ curSDigit->ShiftPrimary(primaryoffset) ;
+
+ a = curSDigit->GetAmp() ;
+ b = a /fTimeSignalLength ;
+ new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime(),0, b);
+ new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b);
+
+ *digit = *digit + *curSDigit ; //add energies
+
+ index[i]++ ;
+ if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
+ curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
+ else
+ curSDigit = 0 ;
+ }
+ }
+
+ //calculate and set time
+ Float_t time = FrontEdgeTime(ticks) ;
+ digit->SetTime(time) ;
+
+ //Find next signal module
+ nextSig = 200000 ;
+ for(i=0; i<input; i++){
+ sdigits = ((TClonesArray *)sdigArray->At(i)) ;
+ Int_t curNext = nextSig ;
+ if(sdigits->GetEntriesFast() > index[i] ){
+ curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
+
+ }
+ if(curNext < nextSig) nextSig = curNext ;
+ }
+ }