- // start loop over input stream
- while (in.NextDDL()) {
- while (in.NextChannel()) {
-
- //Check if the signal is high or low gain and then do the fit,
- //if it is from TRU do not fit
- caloFlag = in.GetCaloFlag();
- if (caloFlag != 0 && caloFlag != 1) continue;
-
- // There can be zero-suppression in the raw data,
- // so set up the TGraph in advance
- for (i=0; i < GetRawFormatTimeBins(); i++) {
- gSig->SetPoint(i, i , 0);
- }
-
- Int_t maxTime = 0;
- Int_t min = 0x3ff; // init to 10-bit max
- Int_t max = 0; // init to 10-bit min
- int nsamples = 0;
- while (in.NextBunch()) {
- const UShort_t *sig = in.GetSignals();
- startBin = in.GetStartTimeBin();
-
- if (((UInt_t) maxTime) < in.GetStartTimeBin()) {
- maxTime = in.GetStartTimeBin(); // timebins come in reverse order
- }
-
- if (maxTime < 0 || maxTime >= GetRawFormatTimeBins()) {
- AliWarning(Form("Invalid time bin %d",maxTime));
- maxTime = GetRawFormatTimeBins();
- }
- nsamples += in.GetBunchLength();
- for (i = 0; i < in.GetBunchLength(); i++) {
- time = startBin--;
- gSig->SetPoint(time, time, (Double_t) sig[i]) ;
- if (max < sig[i]) max= sig[i];
- if (min > sig[i]) min = sig[i];
- }
- } // loop over bunches
-
- if (nsamples > 0) { // this check is needed for when we have zero-supp. on, but not sparse readout
-
- id = fGeom->GetAbsCellIdFromCellIndexes(in.GetModule(), in.GetRow(), in.GetColumn()) ;
- lowGain = in.IsLowGain();
-
- gSig->Set(maxTime+1);
- if ( (max - min) > fNoiseThreshold) FitRaw(gSig, signalF, amp, time) ;
-
- //if (caloFlag == 0 || caloFlag == 1) { // low gain or high gain
- if (amp > 0 && amp < 2000) { //check both high and low end of
- //result, 2000 is somewhat arbitrary - not nice with magic numbers in the code..
- AliDebug(2,Form("id %d lowGain %d amp %g", id, lowGain, amp));
-
- AddDigit(digitsArr, id, lowGain, (Int_t)amp, time);
- }
-
- //}
-
- // Reset graph
- for (Int_t index = 0; index < gSig->GetN(); index++) {
- gSig->SetPoint(index, index, 0) ;
- }
- // Reset starting parameters for fit function
- signalF->SetParameters(10.,0.,fTau,fOrder,5.); //reset all defaults just to be safe
-
- } // nsamples>0 check, some data found for this channel; not only trailer/header
- } // end while over channel
- } //end while over DDL's, of input stream
-
- delete signalF ;
- delete gSig;
-
- return ;
-}
-
-//____________________________________________________________________________
-void AliEMCALRawUtils::AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Int_t amp, Float_t time) {
- //
- // Add a new digit.
- // This routine checks whether a digit exists already for this tower
- // and then decides whether to use the high or low gain info
- //
- // Called by Raw2Digits
-