- TF1 * signalF = new TF1("signal", RawResponseFunction, 0, GetRawFormatTimeBins(), 5);
- signalF->SetParameters(10.,0.,fTau,fOrder,5.); //set all defaults once, just to be safe
- signalF->SetParNames("amp","t0","tau","N","ped");
- signalF->SetParameter(2,fTau); // tau in units of time bin
- signalF->SetParLimits(2,2,-1);
- signalF->SetParameter(3,fOrder); // order
- signalF->SetParLimits(3,2,-1);
-
- Int_t id = -1;
- Float_t time = 0. ;
- Float_t amp = 0. ;
-
- //Graph to hold data we will fit (should be converted to an array
- //later to speed up processing
- TGraph * gSig = new TGraph(GetRawFormatTimeBins());
-
- Int_t readOk = 1;
- Int_t lowGain = 0;
-
- while (readOk && in.GetModule() < 0)
- readOk = in.Next(); // Go to first digit
-
- Int_t col = 0;
- Int_t row = 0;
-
- while (readOk) {
- id = fGeom->GetAbsCellIdFromCellIndexes(in.GetModule(), in.GetRow(), in.GetColumn()) ;
- lowGain = in.IsLowGain();
- Int_t maxTime = in.GetTime(); // timebins come in reverse order
- if (maxTime < 0 || maxTime >= GetRawFormatTimeBins()) {
- AliWarning(Form("Invalid time bin %d",maxTime));
- maxTime = GetRawFormatTimeBins();
- }
- gSig->Set(maxTime+1);
- // There is some kind of zero-suppression in the raw data,
- // so set up the TGraph in advance
- for (Int_t i=0; i < maxTime; i++) {
- gSig->SetPoint(i, i , 0);
- }
-
- Int_t iTime = 0;
- do {
- if (in.GetTime() >= gSig->GetN()) {
- AliWarning("Too many time bins");
- gSig->Set(in.GetTime());
- }
- col = in.GetColumn();
- row = in.GetRow();
-
- gSig->SetPoint(in.GetTime(), in.GetTime(), in.GetSignal()) ;
-
- if (in.GetTime() > maxTime)
- maxTime = in.GetTime();
- iTime++;
- } while ((readOk = in.Next()) && !in.IsNewHWAddress());
-
- FitRaw(gSig, signalF, amp, time) ;
-
- if (amp > 0 && amp < 10000) { //check both high and low end of
- //result, 10000 is somewhat arbitrary
- AliDebug(2,Form("id %d lowGain %d amp %g", id, lowGain, amp));
- //cout << "col " << col-40 << " row " << row-8 << " lowGain " << lowGain << " amp " << amp << endl;
-
- 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
-
- }; // EMCAL entries loop
-
- 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
-