]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Factorization of the different raw fitting algorithms in EMCAL (Per Thomas)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Mar 2011 10:35:53 +0000 (10:35 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Mar 2011 10:35:53 +0000 (10:35 +0000)
59 files changed:
ALIROOT/CMakebinaliroot.pkg
EMCAL/AliCaloConstants.h
EMCAL/AliCaloFastAltroFitv0.cxx [new file with mode: 0644]
EMCAL/AliCaloFastAltroFitv0.h [new file with mode: 0644]
EMCAL/AliCaloFitResults.cxx
EMCAL/AliCaloFitResults.h
EMCAL/AliCaloRawAnalyzer.cxx
EMCAL/AliCaloRawAnalyzer.h
EMCAL/AliCaloRawAnalyzerCrude.cxx
EMCAL/AliCaloRawAnalyzerCrude.h
EMCAL/AliCaloRawAnalyzerFactory.cxx [new file with mode: 0644]
EMCAL/AliCaloRawAnalyzerFactory.h [new file with mode: 0644]
EMCAL/AliCaloRawAnalyzerFakeALTRO.cxx
EMCAL/AliCaloRawAnalyzerFakeALTRO.h
EMCAL/AliCaloRawAnalyzerFastFit.cxx
EMCAL/AliCaloRawAnalyzerFastFit.h
EMCAL/AliCaloRawAnalyzerKStandard.cxx [new file with mode: 0644]
EMCAL/AliCaloRawAnalyzerKStandard.h [new file with mode: 0644]
EMCAL/AliCaloRawAnalyzerLMS.cxx
EMCAL/AliCaloRawAnalyzerLMS.h
EMCAL/AliCaloRawAnalyzerLMSOffline.cxx [new file with mode: 0644]
EMCAL/AliCaloRawAnalyzerLMSOffline.h [new file with mode: 0644]
EMCAL/AliCaloRawAnalyzerNN.cxx
EMCAL/AliCaloRawAnalyzerNN.h
EMCAL/AliCaloRawAnalyzerPeakFinder.cxx
EMCAL/AliCaloRawAnalyzerPeakFinder.h
EMCAL/AliEMCALQADataMakerRec.cxx
EMCAL/AliEMCALQADataMakerRec.h
EMCAL/AliEMCALRawUtils.cxx
EMCAL/AliEMCALRawUtils.h
EMCAL/AliEMCALRecPoint.cxx
EMCAL/AliEMCALReconstructor.cxx
EMCAL/AliEMCALTrigger.cxx
EMCAL/AliEMCALTriggerRawDigitMaker.cxx
EMCAL/CMakelibEMCALUtils.pkg
EMCAL/CMakelibEMCALbase.pkg
EMCAL/CMakelibEMCALraw.pkg [new file with mode: 0644]
EMCAL/CMakelibEMCALrec.pkg
EMCAL/EMCALUtilsLinkDef.h
EMCAL/EMCALbaseLinkDef.h
EMCAL/EMCALrawLinkDef.h [new file with mode: 0644]
EVE/CMakebinalieve.pkg
EVE/CMakebinalihlteve.pkg
HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.cxx
HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.h
HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.cxx
HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.h
HLT/EMCAL/AliHLTEMCALRawAnalyzerCrudeComponent.cxx
HLT/EMCAL/AliHLTEMCALRawAnalyzerFastFitComponent.cxx
HLT/EMCAL/AliHLTEMCALRawAnalyzerLMSComponent.cxx
HLT/EMCAL/AliHLTEMCALRawAnalyzerNNComponent.cxx
HLT/EMCAL/AliHLTEMCALRawAnalyzerNNComponent.h
HLT/EMCAL/AliHLTEMCALRawAnalyzerPeakFinderComponent.cxx
HLT/PHOS/AliHLTPHOSRawAnalyzerComponentv3.cxx
HLT/PHOS/AliHLTPHOSRawAnalyzerComponentv3.h
HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.cxx
HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.h
RAW/CMakelibRAWDatarec.pkg
RAW/RAWDatarecLinkDef.h

index 0a4e49a1abe6540f778603c2f613611144993d65..9f12cff80a949a9f0cf798d07ba4dfe670c820f5 100644 (file)
@@ -30,7 +30,7 @@ set ( CSRCS fpu.c)
 
 set ( ELIBSDIR )
 
-set ( ELIBS  MUONevaluation    MUONmapping MUONshuttle MUONgraphics MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore TPCbase TPCsim TPCrec TPCfast ITSbase ITSsim ITSrec PMDbase PMDsim PMDrec TRDbase TRDsim TRDrec FMDbase FMDsim FMDrec TOFbase TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec BCM STRUCT T0base T0sim T0rec FASTSIM microcern HLTbase TRIGGERbase STEER STAT CDB AOD  STEERBase ESD RAWDatasim RAWDatarec RAWDatabase)
+set ( ELIBS  MUONevaluation    MUONmapping MUONshuttle MUONgraphics MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore TPCbase TPCsim TPCrec TPCfast ITSbase ITSsim ITSrec PMDbase PMDsim PMDrec TRDbase TRDsim TRDrec FMDbase FMDsim FMDrec TOFbase TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec EMCALraw BCM STRUCT T0base T0sim T0rec FASTSIM microcern HLTbase TRIGGERbase STEER STAT CDB AOD  STEERBase ESD RAWDatasim RAWDatarec RAWDatabase)
 
 if(PYTHIA6)
   list(APPEND ELIBS EVGEN)
index 3881093d793fe7724837eaff37700308e31dcd67..8c9f3af98c20d58a1c01151ed01906f35fb2ed01 100644 (file)
@@ -20,6 +20,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+
 //
 // Constants used by the HLT
 // ALICE Offlinw
 namespace CaloConstants
 {
   const int MAXHOSTS=20; // related to the emcal debug online display
+  const int TIMEBINS     = 256;       // number of sampling bins of the raw RO signal (we typically use 15-50; max is 1k+) 
+  const double TIMEBINWITH = 100E-9 ;   // each sample is 100 ns
+  const double TIMEBINMAX  =  TIMEBINS*TIMEBINWITH; 
+  //  const double TAU = 2.35;
+  //  const int  ORDER = 2;
+  
+  const int OVERFLOWCUT = 950;
+  const double HGLGFACTOR = 16;
   
+  // const double ECENTRALHIT = 0.85; //Percentage of total enegry contain in a single tower for a central hit 
+
   namespace ALTROConstants
   {
     const int ALTROMAXSAMPLES = 1008;    // The maximum number of samples of the ALTRO
@@ -44,7 +56,7 @@ namespace CaloConstants
     const int LOWGAIN     =   0;         // Mnemonic for Low Gain
     const int HG = HIGHGAIN;             // Abbrevation for HIGHGAIN
     const int LG = LOWGAIN;              // Abbrevation for LOWGAIN
- }
 }
 
   //FEE constants common to PHOS EMCAL
   const int CSPSPERFEE       =   32;    // Charge Sensitive Preamplifiers (CSPs) per FEE
@@ -53,17 +65,30 @@ namespace CaloConstants
   
   namespace EMCALConstants
   {
-    const int NZROWSMOD      =  48;   // Number of rows per module
-    const int NXCOLUMNSMOD   =  24;   // Number of columns per module 
+    // const int NZROWSMOD      =  48;   // Number of rows per module
+    // const int NXCOLUMNSMOD   =  24;   // Number of columns per module 
+    const double ECENTRALHIT = 0.845678; //Percentage of total enegry contain in a single tower for a central hit  
+    
+    const int NZROWSMOD      =  24;   // Number of rows per module
+    const int NXCOLUMNSMOD   =  48;   // Number of columns per module 
+    
+    const int NROWSMOD     = NZROWSMOD;   // Number of rows per module
+    const int NCOLUMNSMOD  = NXCOLUMNSMOD;   // Number of columns per module 
+    
+    //   const int NZROWSMOD      =  24;   // Number of rows per module
+    //   const int NXCOLUMNSMOD   =  48;   // Number of columns per module 
+    
     const int NRCUSPERSECTOR = 4;     // Number of RCUs per sector
     const int NMODULES    =    10;    // Number of modules of the EMCAL detector
     const int NRCUSPERMODULE =  2 ;   // Number of RCUs per Module
     const int NFEECS         =  9;    // Number of Frontend cards per branch*/
     const int NZROWSRCU     =   48;   // Number of Rows per RCU
     const int NXCOLUMNSRCU  =   16;   // Number of columns per RCU
+    const int ORDER  = 2; // Order of shaping stages of the signal conditioning unit
+    const double TAU = 2.35;  // approximate shaping time
+    
   }
-  
-  
+
   namespace PHOSConstants
   {
     const int NZROWSMOD      =  56;   // Number of rows per module       
@@ -77,7 +102,7 @@ namespace CaloConstants
   namespace FitAlgorithm
   {
     enum fitAlgorithm { kStandard = 0, kCrude = 1, kPeakFinder = 2, kNeuralNet = 3, kFastFit= 4,
-                       kLogFit = 5, kLMS = 6,  kNONE = 7}; // possible return values
+                       kLogFit = 5, kLMS = 6,  kLMSOffline = 7, kFakeAltro = 9, kNONE = 8}; // possible return values
   }
 
   namespace ReturnCodes
diff --git a/EMCAL/AliCaloFastAltroFitv0.cxx b/EMCAL/AliCaloFastAltroFitv0.cxx
new file mode 100644 (file)
index 0000000..08521c1
--- /dev/null
@@ -0,0 +1,519 @@
+/**************************************************************************
+ * Copyright(c) 1998-2010 ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+/* History of cvs commits:
+ * $Log$
+ */
+
+//______________________________________________________ 
+// Author : Aleksei Pavlinov; IHEP, Protvino, Russia
+// Feb 17, 2009
+// Implementation of fit procedure from ALICE-INT-2008-026:
+// "Time and amplitude reconstruction from sampling 
+//  measurements of the PHOS signal profile"
+//  M.Yu.Bogolyubsky and ..
+//
+//  Fit by function en*x*x*exp(-2.*x): x = (t-t0)/tau.
+//  The main goal is fast estimation of amplitude and t0.
+//
+
+// --- AliRoot header files ---
+#include "AliCaloFastAltroFitv0.h"
+
+#include <TH1.h>
+#include <TF1.h>
+#include <TCanvas.h>
+#include <TGraphErrors.h>
+#include <TMath.h>
+
+#include <math.h>
+
+ClassImp(AliCaloFastAltroFitv0)
+
+//____________________________________________________________________________
+  AliCaloFastAltroFitv0::AliCaloFastAltroFitv0() 
+: TNamed(), 
+  fSig(0),fTau(0),fN(0),fPed(0), fAmp(0),fAmpErr(0),fT0(0),fT0Err(0),fChi2(0.),fNDF(0)
+,fNoFit(0),fNfit(0),fTfit(0),fAmpfit(0), fStdFun(0)
+{
+}
+
+//____________________________________________________________________________
+AliCaloFastAltroFitv0::AliCaloFastAltroFitv0(const char* name, const char* title, 
+  const Double_t sig, const Double_t tau, const Double_t n)
+  : TNamed(name, title), 
+  fSig(sig),fTau(tau),fN(n),fPed(0), fAmp(0),fAmpErr(0),fT0(0),fT0Err(0),fChi2(0.),fNDF(0) 
+ ,fNoFit(0),fNfit(0),fTfit(0),fAmpfit(0), fStdFun(0)
+{
+  if(strlen(name)==0) SetName("CaloFastAltroFitv0");
+}
+
+//____________________________________________________________________________
+AliCaloFastAltroFitv0::AliCaloFastAltroFitv0(const AliCaloFastAltroFitv0 &obj)
+  : TNamed(obj), 
+  fSig(0),fTau(0),fN(2.),fPed(0), fAmp(0),fAmpErr(0),fT0(0),fT0Err(0),fChi2(0.),fNDF(0) 
+ ,fNoFit(0),fNfit(0),fTfit(0),fAmpfit(0), fStdFun(0)
+{
+}
+
+//____________________________________________________________________________
+AliCaloFastAltroFitv0::~AliCaloFastAltroFitv0() 
+{  
+  if(fTfit) delete [] fTfit;
+  if(fAmpfit) delete [] fAmpfit;
+}
+
+//____________________________________________________________________________
+AliCaloFastAltroFitv0& AliCaloFastAltroFitv0::operator= (const AliCaloFastAltroFitv0 &/*obj*/)
+{
+  // Not implemented yet
+  return (*this);
+}
+
+void AliCaloFastAltroFitv0::FastFit(Int_t* t, Int_t* y, Int_t nPoints, Double_t sig, Double_t tau, 
+                                   Double_t /*n*/, Double_t ped, Double_t tMax)
+{
+  Reset();
+
+  fSig = sig;
+  fTau = tau;
+  fPed = ped;
+
+  Int_t ii=0;
+  CutRightPart(t,y,nPoints,tMax, ii);
+  nPoints = ii;
+
+  fNfit   = 0;
+  fTfit   = new Double_t[nPoints]; 
+  fAmpfit = new Double_t[nPoints]; 
+
+  
+  DeductPedestal(t,y,nPoints,  tau,ped,  fTfit,fAmpfit,fNfit);
+  //  printf(" n %i : fNfit %i : ped %f \n", n, fNfit, ped);
+  // for(int i=0; i<fNfit; i++) 
+  // printf(" i %i : fAmpfit %7.2f : fTfit %7.2f \n", i, fAmpfit[i], fTfit[i]); 
+
+  if(fNfit>=2) {
+    FastFit(fTfit,fAmpfit,fNfit,sig,tau, fAmp,fAmpErr, fT0,fT0Err,fChi2);
+
+    if(fChi2> 0.0) {
+      fNDF = fNfit - 2;
+    } else {
+      fNDF = 0;
+      fNoFit++;
+    }
+  } else if(fNfit==1){
+    Reset(); // What to do here => fT0 = fTfit[0]; fAmp = fAmpFit[0] ??
+  } else {
+    Reset();
+  }
+}
+
+//____________________________________________________________________________
+void AliCaloFastAltroFitv0::FastFit(TH1F* h, Double_t sig, Double_t tau, Double_t n,
+Double_t ped, Double_t tMax)
+{
+  // Service method for convinience only
+  // h - hist with altro response, could have empty bin
+  // and center of bin could be different from bin number  
+  Reset();
+
+  if(h==0) return;
+  Int_t nPoints = h->GetNbinsX();
+  if(nPoints<2) return; // Sep 07, 09
+
+  Int_t* t = new Int_t[nPoints];
+  Int_t* y = new Int_t[nPoints];
+
+  Int_t nPositive=0;
+  for(Int_t i=0; i<nPoints; i++) {
+    if(h->GetBinContent(i+1) > 0.0){ // Get only positive
+      y[nPositive] = Int_t(h->GetBinContent(i+1));
+      t[nPositive] = Int_t(h->GetBinCenter(i+1)+0.0001);
+      nPositive++;
+    }
+  }
+
+  if(nPositive >= 2) {
+    FastFit(t,y,nPoints, sig,tau,n,ped, tMax);
+  }
+  if(fChi2<=0.0) fNoFit++;
+
+  delete [] t;
+  delete [] y;
+}
+
+void AliCaloFastAltroFitv0::Reset()
+{
+  // Reset variables
+  fSig  = fTau = 0.0;
+  fAmp  = fAmpErr = fT0 = fT0Err = 0.0;
+  fChi2 = -1.;
+  fNDF  = fNfit = 0;
+
+  if(fTfit)   delete [] fTfit;
+  if(fAmpfit) delete [] fAmpfit;
+  fTfit = fAmpfit = 0;
+}
+
+
+void AliCaloFastAltroFitv0::GetFitResult(Double_t &amp,Double_t &eamp,Double_t &t0,Double_t &et0, 
+Double_t &chi2, Int_t &ndf) const
+{
+  // Return results of fitting procedure
+  amp  = fAmp;
+  eamp = fAmpErr;
+  t0   = fT0;
+  et0  = fT0Err;
+  chi2 = fChi2;
+  ndf  = fNDF;
+}
+
+void AliCaloFastAltroFitv0::GetFittedPoints(Int_t &nfit, Double_t* ar[2]) const
+{
+  nfit  = fNfit;
+  ar[0] = fTfit;
+  ar[1] = fAmpfit;
+}
+//
+// static functions
+// 
+void  AliCaloFastAltroFitv0::CutRightPart(Int_t *t,Int_t *y,Int_t nPoints,Double_t tMax, Int_t &ii)
+{
+  // Cut right part of altro sample : static function
+  Int_t tt=0;
+  for(Int_t i=0; i<nPoints; i++) {
+    tt = t[i];
+    if(tMax && tt <= Int_t(tMax)) {
+      t[ii] = tt;
+      y[ii] = y[i];
+      ii++;
+    }
+  }
+  if(0) printf(" ii %i -> ii %i : tMax %7.2f \n", nPoints, ii, tMax);
+}
+
+void AliCaloFastAltroFitv0::DeductPedestal(Int_t* t, Int_t* y, Int_t nPoints, Double_t tau, Double_t ped, 
+  Double_t* tn, Double_t* yn, Int_t &nPointsOut)
+{
+  // Pedestal deduction if ped is positive : static function
+  // Discard part od samle if it is not compact.
+  static Double_t yMinUnderPed=2.; // should be tune
+  Int_t ymax=0, nmax=0;
+  for(Int_t i=0; i<nPoints; i++){
+    if(y[i]>ymax) {
+      ymax = y[i];
+      nmax = i;
+    }
+  }
+  Int_t i1 = nmax - Int_t(tau);
+  //i1 = 0;
+  i1 = i1<0?0:i1;
+  Int_t i2 = nPoints;
+
+  nPointsOut = 0;
+  Double_t yd=0.0, tdiff=0.0;;
+  for(Int_t i=i1; i<i2; i++) {
+    if(ped>0.0) {
+      yd = Double_t(y[i]) - ped;
+    } else {
+      yd = Double_t(y[i]);
+    }
+    if(yd < yMinUnderPed) continue;
+
+    if(i>i1 && nPointsOut>0){
+      tdiff = t[i] - tn[nPointsOut-1];
+      //      printf(" i %i : nPointsOut %i : tdiff %6.2f : tn[nPointsOut] %6.2f \n", i,nPointsOut, tdiff, tn[nPointsOut-1]);
+      if(tdiff>1.) {
+     // discard previous points if its are before maximum point and with gap>1
+        if(i<nmax ) {
+          nPointsOut = 0; // nPointsOut--;
+     // if point with gap after maximum - finish selection
+        } else if(i>=nmax ) {
+          break;
+        }
+      }
+     // Far away from maximum
+     //if(i-nmax > Int_t(5*tau))              break;
+    }
+    tn[nPointsOut] = Double_t(t[i]);
+    yn[nPointsOut] = yd;
+    //printf("i %i : nPointsOut %i : tn %6.2f : yn %6.2f \n", i, nPointsOut, tn[nPointsOut], yn[nPointsOut]); 
+    nPointsOut++;
+  }
+  //printf(" nmax %i : nPointsIn %i :nPointsOut %i i1 %i \n", nmax, nPointsIn, nPointsOut, i1);
+}
+
+void AliCaloFastAltroFitv0::FastFit(const Double_t* t, const Double_t* y, const Int_t nPoints, 
+                                    const Double_t sig, const Double_t tau,
+                                    Double_t &amp, Double_t &eamp, Double_t &t0, Double_t &et0, Double_t &chi2)
+{
+  // Static function
+  // It is case of n=k=2 : fnn = x*x*exp(2 - 2*x)
+  // Input: 
+  //nPoints  - number of points 
+  //   t[]   - array of time bins
+  //   y[]   - array of amplitudes after pedestal subtractions;
+  //   sig   - error of amplitude measurement (one value for all channels)
+  //   tau   - filter time response (in timebin units)
+  // Output:
+  //       amp - amplitude at t0;
+  //      eamp - error of amplitude; 
+  //        t0 - time of max amplitude; 
+  //       et0 - error of t0;
+  //      chi2 - chi2
+  static Double_t xx; // t/tau
+  static Double_t a, b, c;
+  static Double_t f02, f12, f22;    // functions
+  static Double_t f02d, f12d, f22d; // functions derivations
+
+  chi2 = -1.;
+
+  if(nPoints<2) {
+    printf(" AliCaloFastAltroFitv0::FastFit : nPoints<=%i \n", nPoints); 
+    return;
+  }
+
+  a = b = c = 0.0;
+  for(Int_t i=0; i<nPoints; i++){
+    xx  = t[i]/tau;
+    f02 = exp(-2.*xx);
+    f12 = xx*f02;
+    f22 = xx*f12;
+    // Derivations
+    f02d = -2.*f02;
+    f12d = f02 - 2.*f12;
+    f22d = 2.*(f12 - f22); 
+    //
+    a += f02d * y[i];
+    b -= 2.*f12d * y[i];
+    c += f22d * y[i];
+  }
+  Double_t t01=0.0, t02=0.0;
+  Double_t amp1=0.0, amp2=0.0, chi21=0.0, chi22=0.0;
+  if(QuadraticRoots(a,b,c, t01,t02)) {
+    t01 *= tau;
+    t02 *= tau;
+    Amplitude(t,y,nPoints, sig, tau, t01, amp1, chi21);
+    Amplitude(t,y,nPoints, sig, tau, t02, amp2, chi22);
+    if(0) {
+      printf(" t01 %f : t02 %f \n", t01, t02);
+      printf(" amp1 %f : amp2 %f \n", amp1, amp2);
+      printf(" chi21 %f : chi22 %f \n", chi21, chi22);
+    }
+    // t0 less on one tau with comparing with value from  "canonical equation"
+    amp  = amp1;
+    t0   = t01;
+    chi2 = chi21; 
+    if(chi21 > chi22) {
+      amp  = amp2;
+      t0   = t02; 
+      chi2 = chi22; 
+    }
+    if(tau<3.) { // EMCAL case : small tau 
+      t0 += -0.03; // Discard bias in t0
+      Amplitude(t,y,nPoints, sig, tau, t0, amp, chi2);
+    }
+    CalculateParsErrors(t, y, nPoints, sig, tau, amp, t0, eamp, et0);
+
+    // Fill1();
+    
+    // DrawFastFunction(amp, t0, fUtils->GetPedestalValue(), "1");
+    //    DrawFastFunction(amp1, t01, fUtils->GetPedestalValue(), "1");
+    // DrawFastFunction(amp2, t02, fUtils->GetPedestalValue(), "2");
+  } else {
+    chi2 = t01; // no roots, bad fit - negative chi2
+  }
+}
+
+Bool_t AliCaloFastAltroFitv0::QuadraticRoots(const Double_t a, const Double_t b, const Double_t c, 
+                                             Double_t &x1, Double_t &x2)
+{
+  // Resolve quadratic equations a*x**2 + b*x + c
+  //printf(" a %12.5e b %12.5e c %12.5e \n", a, b, c);
+  static Double_t dtmp = 0.0, dtmpCut = -1.e-6;
+  static Int_t iWarning=0, iNoSolution=0;
+  dtmp = b*b - 4.*a*c;
+
+  if(dtmp>=dtmpCut && dtmp<0.0) {
+    if(iWarning<5 || iWarning%1000==0)
+      printf("<W> %i small neg. sq. : dtmp %12.5e \n", iWarning, dtmp);
+    iWarning++;
+    dtmp = 0.0;
+  }
+  if(dtmp>=0.0) {
+    dtmp = sqrt(dtmp);
+    x1   = (-b + dtmp) / (2.*a);
+    x2   = (-b - dtmp) / (2.*a);
+
+    //    printf(" x1 %f : x2 %f \n", x1, x2);
+    return kTRUE;
+  } else {
+    x1 = dtmp;
+    if(iNoSolution<5 || iNoSolution%1000==0)
+      printf("<No solution> %i neg. sq. : dtmp %12.5e \n", iNoSolution, dtmp);
+    iNoSolution++;
+    return kFALSE;
+  }
+}
+
+void AliCaloFastAltroFitv0::Amplitude(const Double_t* t,const Double_t* y,const Int_t nPoints, 
+                                      const Double_t sig, const Double_t tau, const Double_t t0, 
+                                      Double_t &amp, Double_t &chi2)
+{  
+  // Calculate parameters error too - Mar 24,09
+  // sig is independent from points
+  amp = 0.;
+  Double_t x=0.0, f=0.0, den=0.0, f02;
+  for(Int_t i=0; i<nPoints; i++){
+    x    = (t[i] - t0)/tau;
+    f02  = exp(-2.*x);
+    f    = x*x*f02;     
+    amp += f*y[i];
+    den += f*f;
+  }
+  if(den>0.0) amp /= den;
+  //
+  // chi2 calculation
+  //
+  Double_t dy=0.0;
+  chi2=0.;
+  for(Int_t i=0; i<nPoints; i++){
+    x    = (t[i] - t0)/tau;
+    f02  = exp(-2.*x);
+    f    = amp*x*x*f02;
+    dy   = y[i]-f;
+    chi2 += dy*dy;
+    //    printf(" %i : y %f -> f %f : dy %f \n", i, y[i], f, dy); 
+  }
+  chi2 /= (sig*sig);
+}
+
+void AliCaloFastAltroFitv0::CalculateParsErrors(const Double_t* t, const Double_t* /*y*/, const Int_t nPoints, 
+                                                const Double_t sig, const Double_t tau, 
+                                                Double_t &amp, Double_t &t0, Double_t &eamp, Double_t &et0)
+{
+  // Remember that fmax = exp(-n);
+  // fmax_nk = (n/k)**n*exp(-n) => n=k=2 => exp(-n) = exp(-2.)
+  static Double_t cc = exp(-2.);
+  //   static Double_t cc = exp(-fN); // mean(N)~1.5 ??
+
+  Double_t sumf2=0.0, sumfd2=0.0, x, f02, f12, f22, f22d;
+
+  for(Int_t i=0; i<nPoints; i++){
+    x    = (t[i] - t0)/tau;
+    f02  = exp(-2.*x);
+    f12  = x*f02;
+    f22  = x*f12;
+    sumf2 += f22 * f22;
+    //
+    f22d = 2.*(f12 - f22); 
+    sumfd2 += f22d * f22d;
+  }
+  et0  = (sig/amp)/sqrt(sumfd2);
+  eamp = sig/sqrt(sumf2);
+
+  amp  *= cc;
+  eamp *= cc;
+}
+
+//
+// Drawing
+//
+TCanvas* AliCaloFastAltroFitv0::DrawFastFunction()
+{
+  // QA of fitting
+  if(fNfit<=0) return 0; // no points
+
+  static TCanvas *c = 0;
+  if(c==0) {
+    c =  new TCanvas("fastFun","fastFun",800,600);
+  }
+
+  c->cd();
+  
+  Double_t* eamp = new Double_t[fNfit];
+  Double_t* et   = new Double_t[fNfit];
+
+  for(Int_t i=0; i<fNfit; i++) {
+    eamp[i] = fSig;
+    et[i]   = 0.0;
+  }
+
+  TGraphErrors *gr = new TGraphErrors(fNfit, fTfit,fAmpfit, et,eamp);
+  gr->Draw("Ap");
+  gr->SetTitle(Form("Fast Fit : #chi^{2}/ndf = %8.2f / %i", GetChi2(), GetNDF()));
+  gr->GetHistogram()->SetXTitle(" time bin ");
+  gr->GetHistogram()->SetYTitle(" amplitude ");
+
+  if(fStdFun==0) {
+     fStdFun = new TF1("stdFun", StdResponseFunction, 0., fTfit[fNfit-1]+2., 5);    
+     fStdFun->SetParNames("amp","t0","tau","N","ped");
+  }
+  fStdFun->SetParameter(0, GetEnergy());
+  fStdFun->SetParameter(1, GetTime() + GetTau());
+  fStdFun->SetParameter(2, GetTau());  // 
+  fStdFun->SetParameter(3, GetN());    // 2
+  fStdFun->SetParameter(4, 0.);  // 
+  
+  fStdFun->SetLineColor(kBlue);
+  fStdFun->SetLineWidth(1);
+
+  fStdFun->Draw("same");
+
+  delete [] eamp;
+  delete [] et;
+
+  c->Update();
+
+  return c;
+}
+
+Double_t AliCaloFastAltroFitv0::StdResponseFunction(const Double_t *x, const Double_t *par)
+{
+  // Static Standard Response Function : 
+  // look to Double_t AliEMCALRawUtils::RawResponseFunction(Double_t *x, Double_t *par)
+  // Using for drawing only.
+  // 
+  // Shape of the electronics raw reponse:
+  // It is a semi-gaussian, 2nd order Gamma function (n=2) of the general form
+  //
+  // t' = (t - t0 + tau) / tau
+  // F = A * t**N * exp( N * ( 1 - t) )   for t >= 0
+  // F = 0                                for t < 0 
+  //
+  // parameters:
+  // A:   par[0]   // Amplitude = peak value
+  // t0:  par[1]
+  // tau: par[2]
+  // N:   par[3]
+  // ped: par[4]
+  //
+  static Double_t signal , tau, n, ped, xx;
+
+  tau = par[2];
+  n   = par[3];
+  ped = par[4];
+  xx = ( x[0] - par[1] + tau ) / tau ;
+
+  if (xx <= 0) 
+    signal = ped ;  
+  else {  
+    signal = ped + par[0] * TMath::Power(xx , n) * TMath::Exp(n * (1 - xx )) ; 
+  }
+  return signal ;  
+}
diff --git a/EMCAL/AliCaloFastAltroFitv0.h b/EMCAL/AliCaloFastAltroFitv0.h
new file mode 100644 (file)
index 0000000..cff3f24
--- /dev/null
@@ -0,0 +1,112 @@
+//_________________________________________________________________________
+//  Procedure of fast altro fitting     
+//                  
+//*-- Author:  Aleksei Pavlinov; IHEP, Protvino, Russia & WSU, Detroit, USA
+
+#ifndef ALICALOFASTALTROFITV0_H
+#define ALICALOFASTALTROFITV0_H
+/* Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice     */
+/* $Id$ */
+
+/* History of svn commits
+ * $Log$
+ */
+
+#include <TNamed.h>
+// --- ROOT system ---
+class TCanvas;
+class TVirtualPad;
+class TF1;
+class TH1F;
+
+class AliCaloFastAltroFitv0 : public TNamed {
+
+public:
+
+  AliCaloFastAltroFitv0();
+  AliCaloFastAltroFitv0(const char* name, const char* title,
+  const Double_t sig=1.3, const Double_t tau=2.35, const Double_t n=2.);
+  virtual ~AliCaloFastAltroFitv0(); 
+
+  virtual void FastFit(Int_t* t, Int_t* y, Int_t nPoints, Double_t sig, Double_t tau, 
+  Double_t n, Double_t ped, Double_t tMax);
+
+  void FastFit(TH1F* h, Double_t sig, Double_t tau, 
+  Double_t n, Double_t ped, Double_t tMax);
+
+  void Reset();
+  void SetSig(const Double_t sig) {fSig = sig;}
+  void SetTau(const Double_t tau) {fTau = tau;}
+  void SetN(const Double_t n)     {fN = n;}
+  void SetParameters(const Double_t sig, const Double_t tau, const Double_t n) 
+  {fSig = sig; fTau = tau; fN = n;}
+
+  Double_t GetSig()    const {return fSig;}
+  Double_t GetTau()    const {return fTau;}
+  Double_t GetN()      const {return fN;}
+  Double_t GetPed()    const {return fPed;}
+
+  Double_t GetEnergy() const {return fAmp;}
+  Double_t GetAmp()    const {return GetEnergy();}
+  Double_t GetAmpErr() const {return fAmpErr;}
+  Double_t GetTime()   const {return fT0;}
+  Double_t GetT0()     const {return GetTime();}
+  Double_t GetT0Err()  const {return fT0Err;}
+  Double_t GetChi2()   const {return fChi2;}
+  Int_t    GetNDF()    const {return fNDF;}
+  Int_t    GetNfit()   const {return fNfit;}
+  Int_t    GetNoFit()  const {return fNoFit;}
+
+  void GetFitResult(Double_t &amp, Double_t &eamp, Double_t &t0, Double_t &et0, 
+                    Double_t &chi2,Int_t &ndf) const;
+  void     GetFittedPoints(Int_t &nfit, Double_t* ar[2]) const;
+
+  // Drawing for QA
+  TCanvas* DrawFastFunction(); // *MENU*
+  static Double_t StdResponseFunction(const Double_t *x, const  Double_t *par); 
+
+  static void CutRightPart(Int_t *t,Int_t *y,Int_t nPoints, Double_t tMax, Int_t &ii); 
+  static void DeductPedestal(Int_t* t, Int_t* y, Int_t nPointsIn, Double_t ped, Double_t tau, 
+  Double_t* tn, Double_t* yn, Int_t &nPointsOut);
+
+  static void FastFit(const Double_t* t, const Double_t* y, const Int_t nPoints, 
+                      const Double_t sig, const Double_t tau,
+                      Double_t &amp, Double_t &eamp, Double_t &t0, Double_t &et0, Double_t &chi2);
+  static Bool_t QuadraticRoots(const Double_t a, const Double_t b, const Double_t c, 
+                               Double_t &x1, Double_t &x2);
+  static void Amplitude(const Double_t* t, const Double_t* y, const Int_t nPoints, 
+                        const Double_t sig, const Double_t tau, 
+                        Double_t t0, Double_t &amp, Double_t &chi2);
+  static void CalculateParsErrors(const Double_t* t, const Double_t* y, const Int_t nPoints, 
+                                 const Double_t sig, const Double_t tau,
+                                Double_t &amp, Double_t &t0, Double_t &eamp, Double_t &et0);
+protected:
+  Double_t fSig; // error in amplitude - used in chi2 calculation
+  Double_t fTau; // first  fixed parameter od fitting function (should be - filter time response
+  Double_t fN;   // second fixed parameter od fitting function (should be positive)
+  Double_t fPed; // pedestal
+
+  Double_t fAmp;    // amplitude
+  Double_t fAmpErr; // amplitude error
+  Double_t fT0;     // time
+  Double_t fT0Err;  // time error
+  Double_t fChi2;   // chi square
+  Int_t    fNDF;    // number degree of freedom
+  Int_t    fNoFit;  // no solution for square equation
+
+  // Working variable
+  Int_t     fNfit;   //! number points for fit
+  Double_t* fTfit;   //! points for fit after selection - time bins
+  Double_t* fAmpfit; //!                                - amplitudes
+  // 
+  TF1*      fStdFun; //! function for drawing
+
+private:
+  AliCaloFastAltroFitv0(const AliCaloFastAltroFitv0 &obj);
+  AliCaloFastAltroFitv0& operator= (const AliCaloFastAltroFitv0 &obj);
+
+  ClassDef(AliCaloFastAltroFitv0,1) // Class for fast altro fitting
+};
+
+#endif // ALICALOFASTALTROFITV0_H
index 80c9009af1eb62bae0c54d0dbb2e986764346e98..d0c7b6f8b89edacf6092deb1a563f054c72c3a8a 100644 (file)
 #include "AliCaloFitResults.h"
 #include "AliCaloConstants.h"
 
-AliCaloFitResults::AliCaloFitResults() : fMaxSig(-1),
+
+AliCaloFitResults::AliCaloFitResults() : fMaxSig(0),
                                         fPed(-1), 
                                         fStatus(-1),
                                         fAmpSig(-1),
                                         fTime(-1),
                                         fMaxTimebin(-1),
                                         fChi2Sig(-1),
-                                        fNdfSig(-1),
-                                        fMinSig(-1),
+                                        fNdfSig(0),
+                                        fMinSig(0),
                                         fFitSubarray(10) 
 {
   
@@ -45,11 +46,12 @@ AliCaloFitResults::AliCaloFitResults() : fMaxSig(-1),
 // The signal was fitted sucessfully. fStatus might have a different meaning If other 
 // procedures than  A different meaning Fitting is applied 
 
+
 AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, 
                                     const Float_t ped, 
                                     const Short_t fitstatus, 
                                     const Float_t  amp,  
-                                    const Float_t time,  
+                                    const double time,  
                                     const Int_t maxTimebin, 
                                     const Float_t chi,  
                                     const Int_t ndf, 
@@ -70,9 +72,10 @@ AliCaloFitResults::AliCaloFitResults(const Int_t maxSig,
 }
 
 
+
 AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped, 
                                     const Short_t fitstatus, const Float_t  amp,  
-                                    const Float_t time, const Int_t maxTimebin, const Float_t chi,  
+                                    const double time, const Int_t maxTimebin, const Float_t chi,  
                                     const Int_t ndf, Int_t minSig ) : 
   fMaxSig(maxSig),
   fPed(ped), 
@@ -89,6 +92,7 @@ AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped,
 }
 
 
+
 AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped, 
                                     const Short_t fitstatus, const Float_t  amp,  
                                     const Int_t maxTimebin) : 
@@ -99,8 +103,8 @@ AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped,
   fTime(maxTimebin),
   fMaxTimebin(maxTimebin),
   fChi2Sig( Ret::kNoFit ),
-  fNdfSig( Ret::kNoFit ),
-  fMinSig( Ret::kNoFit ),
+  fNdfSig( 0 ),
+  fMinSig( 0 ),
   fFitSubarray( Ret::kNoFit ) 
 {
 
@@ -108,6 +112,7 @@ AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped,
 
 
 
+
 AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Int_t minSig) : 
   fMaxSig(maxSig),
   fPed( Ret::kInvalid ),
@@ -116,13 +121,13 @@ AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Int_t minSig) :
   fTime( Ret::kInvalid ),
   fMaxTimebin( Ret::kInvalid ),
   fChi2Sig( Ret::kInvalid ),
-  fNdfSig( Ret::kInvalid),
+  fNdfSig( ),
   fMinSig (minSig),
   fFitSubarray( Ret::kInvalid )  
 {
 
 }
-
 
 
 AliCaloFitResults::~AliCaloFitResults()
index a282f601994fc8625375e1f5bcbfda6be05bac77..990d1b4ee4f42b6a6f15d2ac80ee09a3c1e227ac 100644 (file)
@@ -33,23 +33,25 @@ class  AliCaloFitResults
   // kNoFit: maximum was used, exception handling for fit invoked
   // kInvalid: could not even look for maximum
 
+  
   explicit AliCaloFitResults( const Int_t maxSig, 
                              const Float_t ped, 
                              const Short_t fitStatus, 
                              const Float_t  amp, 
-                             const Float_t time,
+                             const double time,
                              const Int_t maxTimebin,
                              //   const Float_t chi, 
                              const Float_t chi,  
                              const Int_t ndf, 
                              const Int_t minSig, 
                              const AliCaloFitSubarray fitSubarray  ); 
+  
 
   explicit AliCaloFitResults( const Int_t maxSig, 
                              const Float_t ped, 
                              const Short_t fitStatus, 
                              const Float_t  amp, 
-                             const Float_t time,
+                             const double time,
                              const Int_t maxTimebin,
                              //   const Float_t chi, 
                              const Float_t chi, 
@@ -59,11 +61,14 @@ class  AliCaloFitResults
 
 
   // shorter interface when no fit is done
+
+  
   explicit AliCaloFitResults( const Int_t maxSig, 
                              const Float_t ped, 
                              const Short_t fitStatus, 
                              const Float_t  amp, 
                              const Int_t maxTimebin); 
+  
 
   // minimum interface
   explicit AliCaloFitResults( const Int_t maxSig, const Int_t minSig );
@@ -76,20 +81,21 @@ class  AliCaloFitResults
   Int_t  GetStatus() const  { return fStatus;};
   Float_t   GetAmp() const {  return fAmpSig; };
   Float_t   GetTof() const {  return fTime; }; 
-  Float_t   GetTime() const {  return fTime; };
+  double   GetTime() const {  return fTime; };
   Int_t   GetMaxTimebin() const {  return fMaxTimebin; };
   Float_t   GetChi2() const { return fChi2Sig;};
   UShort_t  GetNdf() const { return fNdfSig; };
   AliCaloFitSubarray  GetFitSubarray() const { return fFitSubarray; };
-  
-  
+  void SetTime(Float_t time ) { fTime = time; };
+  void SetAmp(Float_t amp ) { fAmpSig = amp; };
+
  private:
   // AliCaloFitResults();
   UShort_t   fMaxSig;      //Maximum sample value ( 0 - 1023 )
   Float_t    fPed;      //Pedestal 
   Int_t   fStatus;      //Sucess or failure of fitting pocedure
   Float_t    fAmpSig;   //Amplitude in entities of ADC counts
-  Float_t    fTime;     //peak/max time of signal in entities of sample intervals 
+  double    fTime;     //peak/max time of signal in entities of sample intervals 
   Int_t    fMaxTimebin; //timebin with maximum ADC value
   Float_t    fChi2Sig;  //Chi Square of fit 
   UShort_t   fNdfSig;      //Number of degrees of freedom of fit
index d74b1994a42f9b7f7d45a241aab054c5a078bc52..b4eb88e34abe9f97416d66052f35148571b30f26 100644 (file)
@@ -45,16 +45,23 @@ AliCaloRawAnalyzer::AliCaloRawAnalyzer(const char *name, const char *nameshort)
   fNsamplePed(3),
   fIsZerosupressed( false ),
   fVerbose( false ),
-  fAlgo(Algo::kNONE)
+  fAlgo(Algo::kNONE), 
+// fFp(0), 
+  fL1Phase(0),
+  fAmp(0),
+  fTof(0)
 {
   //Comment 
   snprintf(fName, 256,"%s", name);
   snprintf(fNameShort,256, "%s", nameshort);
     
-  for(int i=0; i < MAXSAMPLES; i++ )
+  for(int i=0; i < ALTROMAXSAMPLES; i++ )
     {
       fReversed[i] = 0;
     }
+
+  // fFp = fopen("amp2.txt", "w");
+
 }
 
 AliCaloRawAnalyzer::~AliCaloRawAnalyzer()
@@ -67,7 +74,7 @@ void
 AliCaloRawAnalyzer::SetTimeConstraint(const int min, const int max ) 
 {
   //Require that the bin if the maximum ADC value is between min and max (timebin)
-  if(  ( min > max ) || min > MAXSAMPLES  || max > MAXSAMPLES  )
+  if(  ( min > max ) || min > ALTROMAXSAMPLES  || max > ALTROMAXSAMPLES  )
     {
       AliWarning( Form( "Attempt to set Invalid time bin range (Min , Max) = (%d, %d), Ingored",  min, max ) ); 
     }
@@ -80,7 +87,7 @@ AliCaloRawAnalyzer::SetTimeConstraint(const int min, const int max )
 
 
 UShort_t 
-AliCaloRawAnalyzer::Max(const UShort_t *data, const int length ) const
+AliCaloRawAnalyzer::Max(const UShort_t *data, const int length )
 {
   //------------
   UShort_t tmpmax  = data[0];
@@ -97,39 +104,39 @@ AliCaloRawAnalyzer::Max(const UShort_t *data, const int length ) const
 
 
 void 
-AliCaloRawAnalyzer::SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first,  int *const last ) const
+AliCaloRawAnalyzer::SelectSubarray( const Double_t *data, const int length, const short maxindex, int *const first,  int *const last, const int cut)
 {
   //Selection of subset of data from one bunch that will be used for fitting or
   //Peak finding.  Go to the left and right of index of the maximum time bin
   //Until the ADC value is less that fFitArrayCut, or derivative changes sign (data jump)
   int tmpfirst =  maxindex;
   int tmplast  =  maxindex;
-  Double_t prevFirst =  fData[maxindex];
-  Double_t prevLast  =  fData[maxindex];  
+  Double_t prevFirst =  data[maxindex];
+  Double_t prevLast  =  data[maxindex];  
   bool firstJump = false;
   bool lastJump = false;
 
-  while( (tmpfirst >= 0) && (fData[tmpfirst] >= fFitArrayCut) && (!firstJump) ) 
+  while( (tmpfirst >= 0) && (data[tmpfirst] >= cut ) && (!firstJump) ) 
     {
       // jump check:
       if (tmpfirst != maxindex) { // neighbor to maxindex can share peak with maxindex
-       if (fData[tmpfirst] >= prevFirst) {
+       if ( data[tmpfirst] >= prevFirst) {
          firstJump = true;
        }
       }
-      prevFirst = fData[tmpfirst];
+      prevFirst = data[tmpfirst];
       tmpfirst -- ;
     }
   
-  while( (tmplast < length) && (fData[tmplast] >= fFitArrayCut) && (!lastJump) ) 
+  while( (tmplast < length) && (data[tmplast] >=  cut ) && (!lastJump) ) 
     {
       // jump check:
       if (tmplast != maxindex) { // neighbor to maxindex can share peak with maxindex
-       if (fData[tmplast] >= prevLast) {
+       if ( data[tmplast] >= prevLast) {
          lastJump = true;
        }
       }
-      prevLast = fData[tmplast];
+      prevLast = data[tmplast];
       tmplast ++;
     }
 
@@ -184,7 +191,7 @@ AliCaloRawAnalyzer::EvaluatePedestal(const UShort_t * const data, const int /*le
 
 
 short  
-AliCaloRawAnalyzer::Max( const AliCaloBunchInfo *const bunch , int *const maxindex ) const
+AliCaloRawAnalyzer::Max( const AliCaloBunchInfo *const bunch , int *const maxindex )
 {
   //comment
   short tmpmax = -1;
@@ -238,7 +245,7 @@ AliCaloRawAnalyzer::CheckBunchEdgesForMax( const AliCaloBunchInfo *const bunch )
 
 
 int 
-AliCaloRawAnalyzer::SelectBunch( const vector<AliCaloBunchInfo> &bunchvector,short *const maxampbin, short *const maxamplitude ) const
+AliCaloRawAnalyzer::SelectBunch( const vector<AliCaloBunchInfo> &bunchvector,short *const maxampbin, short *const maxamplitude )
 {
   //We select the bunch with the highest amplitude unless any time constraints is set
   short max = -1;
@@ -249,7 +256,7 @@ AliCaloRawAnalyzer::SelectBunch( const vector<AliCaloBunchInfo> &bunchvector,sho
   for(unsigned int i=0; i < bunchvector.size(); i++ )
     {
       max = Max(  &bunchvector.at(i), &indx ); // CRAP PTH, bug fix, trouble if more than one bunches  
-      if( IsInTimeRange( indx) )
+      if( IsInTimeRange( indx, fMaxTimeIndex, fMinTimeIndex) )
        {
          if( max > maxall )
            {
@@ -273,14 +280,14 @@ AliCaloRawAnalyzer::SelectBunch( const vector<AliCaloBunchInfo> &bunchvector,sho
 
 
 bool 
-AliCaloRawAnalyzer::IsInTimeRange( const int maxindex  ) const
+AliCaloRawAnalyzer::IsInTimeRange( const int maxindex, const int maxtindx, const int mintindx )
 {
   // Ckeck if the index of the max ADC vaue is consistent with trigger.
-  if( ( fMinTimeIndex  < 0 && fMaxTimeIndex  < 0) ||fMaxTimeIndex  < 0 )
+  if( ( mintindx  < 0 && maxtindx   < 0) ||maxtindx  < 0 )
     {
       return true; 
     }
-  return ( maxindex < fMaxTimeIndex ) && ( maxindex > fMinTimeIndex  ) ? true : false;
+  return ( maxindex < maxtindx ) && ( maxindex > mintindx  ) ? true : false;
 }
 
 
@@ -417,31 +424,34 @@ AliCaloRawAnalyzer::CalculateMeanAndRMS(const Int_t first, const Int_t last,
 
 
 int
-AliCaloRawAnalyzer::PreFitEvaluateSamples( const vector<AliCaloBunchInfo>  &bunchvector, const UInt_t altrocfg1,  const UInt_t altrocfg2, Int_t & index, Float_t & maxf, short & maxamp, short & maxrev, Float_t & ped, int & first, int & last)
+AliCaloRawAnalyzer::PreFitEvaluateSamples( const vector<AliCaloBunchInfo>  &bunchvector, const UInt_t altrocfg1,  
+                                          const UInt_t altrocfg2, Int_t & index, Float_t & maxf, short & maxamp, 
+                                          short & maxrev, Float_t & ped, int & first, int & last,const int acut )
 { // method to do the selection of what should possibly be fitted
   int nsamples  = 0;
   short maxampindex = 0;
   index = SelectBunch( bunchvector,  &maxampindex,  &maxamp ); // select the bunch with the highest amplitude unless any time constraints is set
 
   
-  if( index >= 0 && maxamp >= fAmpCut) // something valid was found, and non-zero amplitude
+  if( index >= 0 && maxamp >= acut ) // something valid was found, and non-zero amplitude
     {
       // use more convenient numbering and possibly subtract pedestal
       ped  = ReverseAndSubtractPed( &(bunchvector.at(index)),  altrocfg1, altrocfg2, fReversed  );
       maxf = TMath::MaxElement( bunchvector.at(index).GetLength(),  fReversed );
       
-      if ( maxf >= fAmpCut ) // possibly significant signal
+      if ( maxf >= acut  ) // possibly significant signal
        {
          // select array around max to possibly be used in fit
          maxrev = maxampindex - bunchvector.at(index).GetStartBin(); 
-         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev, &first, &last);
+         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev, &first, &last, acut );
 
          // sanity check: maximum should not be in first or last bin
          // if we should do a fit
-         if (first!=maxrev && last!=maxrev) {
-           // calculate how many samples we have 
-           nsamples =  last - first + 1;         
-         }
+         if (first!=maxrev && last!=maxrev) 
+           {
+             // calculate how many samples we have 
+             nsamples =  last - first + 1;       
+           }
        }
     }
 
index 4aa5df3ae315a941872e5f7eb13727ab4df4ffdf..100d53d89b94bc3059b01482c63335465e3a935b 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-
 //Base class for extraction 
 //of signal amplitude and peak position
 //From CALO Calorimeter RAW data
-
 #include "Rtypes.h"
 #include "TObject.h"
-#define MAXSAMPLES 1008 //CRAP PTH
+///#define MAXSAMPLES 1008 //CRAP PTH
 #include <vector>
 #include "AliCaloConstants.h"
+using namespace ALTRO;
+using namespace CALO;
 
-//using  namespace CaloConstants::FitAlgorithm;
-//using  CaloConstants::ReturnCodes;
 
 class AliCaloBunchInfo;
 #include "AliCaloFitResults.h"
 
 class  AliCaloRawAnalyzer : public TObject
 {
+  friend class AliCaloRawAnalyzerFactory;
+
  public:
   AliCaloRawAnalyzer(const char *name="AliCaloRawAnalyzer", const char *nameshort="RawAna");
   virtual ~AliCaloRawAnalyzer();
@@ -47,9 +47,11 @@ class  AliCaloRawAnalyzer : public TObject
   void PrintBunches( const std::vector<AliCaloBunchInfo> &bunchvector ) const;
   void PrintBunch( const AliCaloBunchInfo &bunch ) const ;
   
-  virtual int PreFitEvaluateSamples( const std::vector<AliCaloBunchInfo>  &bunchvector, 
+  int PreFitEvaluateSamples( const std::vector<AliCaloBunchInfo>  &bunchvector, 
                                     const UInt_t altrocfg1,  const UInt_t altrocfg2, Int_t & index, 
-                                    Float_t & maxf, short & maxamp, short & maxampindex, Float_t & ped, int & first, int & last);
+                                    Float_t & maxf, short & maxamp, short & maxampindex, 
+                                   Float_t & ped, int & first, int & last, const int acut);
+  
   void SetTimeConstraint(const int min, const int max );
   void SetVerbose(bool verbose = true){ fVerbose = verbose; };
   void SetIsZeroSuppressed(const bool iszs = true) { fIsZerosupressed = iszs; } ;
@@ -79,20 +81,19 @@ class  AliCaloRawAnalyzer : public TObject
 
   void CalculateMeanAndRMS(const Int_t first, const Int_t last,
                           Double_t & mean, Double_t & rms);
-
- protected:
+  void SetL1Phase(const Double_t phase) {fL1Phase = phase;};
+  
+protected:
 public: // PAI
-  short Max( const AliCaloBunchInfo *const bunch, int *const maxindex) const;
-  UShort_t Max(const UShort_t *data, const int length ) const;
+  short Max( const AliCaloBunchInfo *const bunch, int *const maxindex);
+  UShort_t Max(const UShort_t *data, const int length );
   bool CheckBunchEdgesForMax( const AliCaloBunchInfo *const bunch) const;
-  bool IsInTimeRange( const int maxindex ) const;
+  bool IsInTimeRange( const int maxindex, const int maxtime, const int mintime );
   Float_t  ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t altrocfg1,  const UInt_t altrocfg2, double *outarray ) const;
-  int  SelectBunch( const std::vector<AliCaloBunchInfo> &bunchvector, short *const maxampbin, short *const maxamplitude ) const;
-  virtual void SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const  first, int *const last ) const;
+  int  SelectBunch( const std::vector<AliCaloBunchInfo> &bunchvector, short *const maxampbin, short *const maxamplitude );
+  void SelectSubarray( const Double_t *date, const int length, const short maxindex, int *const  first, int *const last, const int cut);
   Float_t EvaluatePedestal(const UShort_t * const data, const int length ) const;
-  
-  Double_t fReversed[MAXSAMPLES]; //Reversed sequence of samples (pedestalsubtracted)
-
+  Double_t fReversed[ALTROMAXSAMPLES]; //Reversed sequence of samples (pedestalsubtracted)
   // private:
   int fMinTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
   int fMaxTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
@@ -103,14 +104,16 @@ public: // PAI
   int fNsamplePed;   //Number of samples used for pedestal calculation (first in bunch) 
   bool fIsZerosupressed; //Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracted if set to true
   bool fVerbose;     //Print debug information to std out if set to true
-
   char fName[256]; // Name of the algorithm
   char fNameShort[256]; // Abbrevation for the name
-
   //  CaloConstants  fAlgo;
   Algo::fitAlgorithm fAlgo;
+  // FILE *fFp;
+  Double_t fL1Phase;
   
+  Double_t fAmp; // The amplitude in entities of ADC counts
+  Double_t fTof; // The amplitude in entities of ADC counts
+
   ClassDef(AliCaloRawAnalyzer, 2)  
 
 };
index 52e68f4340d661abdccb40147cb2e66ba79edb2e..0662f260c28a95a863242749a53129a713c940a3 100644 (file)
@@ -28,7 +28,7 @@
 #include "TMath.h"
 using namespace std;
 
-#include "AliCaloConstants.h"
+//#include "AliCaloConstants.h"
 
 ClassImp(AliCaloRawAnalyzerCrude)  
 
@@ -68,7 +68,7 @@ AliCaloRawAnalyzerCrude::Evaluate(const vector<AliCaloBunchInfo> &bunchvector, c
          int first = 0;
          int last = 0;
          int maxrev =  maxampindex -  bunchvector.at(index).GetStartBin();
-         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(), maxrev , &first, &last);
+         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(), maxrev , &first, &last, fFitArrayCut );
 
          Float_t chi2 = CalculateChi2(maxf, maxrev, first, last);
          Int_t ndf = last - first - 1; // nsamples - 2
index 3af9532a315096a361cb2be30ccc52665ef30852..0241bb0814961576d6a1d3714213138591c7555e 100644 (file)
 class AliCaloFitResults;
 class AliCaloBunchInfo;
 
+//class AliEMCALQADataMakerRec
+
 class  AliCaloRawAnalyzerCrude : public  AliCaloRawAnalyzer
 {
+
+  //friend class AliEMCALQADataMakerRec;
+  friend class AliCaloRawAnalyzerFactory;
+  // friend class AliHLTPHOSRawAnalyzerCrudeComponent;
+  // friend class AliHLTEMCALRawAnalyzerCrudeComponent;
+
  public:
+   AliCaloRawAnalyzerCrude(); 
   virtual AliCaloFitResults Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector, 
                                       const UInt_t altrocfg1,  const UInt_t altrocfg2 );
-   
-   AliCaloRawAnalyzerCrude();
-   virtual ~AliCaloRawAnalyzerCrude();
-
-   ClassDef(AliCaloRawAnalyzerCrude, 1)  
-
+  // AliCaloRawAnalyzerCrude();
+  virtual ~AliCaloRawAnalyzerCrude();
+ private:
+  //// AliCaloRawAnalyzerCrude();
+
+  ClassDef(AliCaloRawAnalyzerCrude, 1)  
+    
+    
 };
 
 #endif
diff --git a/EMCAL/AliCaloRawAnalyzerFactory.cxx b/EMCAL/AliCaloRawAnalyzerFactory.cxx
new file mode 100644 (file)
index 0000000..e47ba15
--- /dev/null
@@ -0,0 +1,80 @@
+// -*- mode: c++ -*-
+
+/**************************************************************************
+ * This file is property of and copyright by the Experimental Nuclear     *
+ * Physics Group, Dep. of Physics                                         *
+ * University of Oslo, Norway, 2007                                       *
+ *                                                                        *
+ * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
+ * Contributors are mentioned in the code where appropriate.              *
+ * Please report bugs to perthi@fys.uio.no                                *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+#include "AliCaloRawAnalyzerFactory.h"
+#include "AliCaloRawAnalyzerFastFit.h"
+#include "AliCaloRawAnalyzerNN.h"
+#include "AliCaloRawAnalyzerLMS.h"
+#include "AliCaloRawAnalyzerPeakFinder.h"
+#include "AliCaloRawAnalyzerCrude.h"
+#include "AliCaloRawAnalyzerLMSOffline.h"
+#include "AliCaloRawAnalyzerKStandard.h"
+#include "AliCaloRawAnalyzerFakeALTRO.h"
+
+AliCaloRawAnalyzerFactory::AliCaloRawAnalyzerFactory()
+{
+
+}
+
+AliCaloRawAnalyzerFactory::~AliCaloRawAnalyzerFactory()
+{
+
+}
+
+AliCaloRawAnalyzer*
+AliCaloRawAnalyzerFactory::CreateAnalyzer( const int algo )
+{
+  switch ( algo) 
+    {
+    case  kFastFit:
+      return new  AliCaloRawAnalyzerFastFit();
+      break;
+    case kNeuralNet:
+      return new AliCaloRawAnalyzerNN();
+      break;
+    case kLMS:
+      //return new AliCaloRawAnalyzerLMS();
+      return new AliCaloRawAnalyzerLMSOffline();
+      break;
+    case kPeakFinder:
+      return new AliCaloRawAnalyzerPeakFinder();
+      break;
+    case kCrude:
+      return  new AliCaloRawAnalyzerCrude();
+      break;
+    case kLMSOffline:
+      return new AliCaloRawAnalyzerLMSOffline();
+      break;
+    case kStandard:
+      return new AliCaloRawAnalyzerKStandard();
+      break;
+    case kFakeAltro:
+      return  new AliCaloRawAnalyzerFakeALTRO();
+      break;
+    default:
+      return  new AliCaloRawAnalyzerCrude();
+      break;
+   }
+}
+
+
+
+
+
diff --git a/EMCAL/AliCaloRawAnalyzerFactory.h b/EMCAL/AliCaloRawAnalyzerFactory.h
new file mode 100644 (file)
index 0000000..7e23ce0
--- /dev/null
@@ -0,0 +1,38 @@
+// -*- mode: c++ -*-
+
+#ifndef ALICALORAWANALYZERFACTORY_H
+#define ALICALORAWANALYZERFACTORY_H
+
+/**************************************************************************
+ * This file is property of and copyright by the Experimental Nuclear     *
+ * Physics Group, Yale University, US 2011                                *
+ *                                                                        *
+ * Author: Per Thomas Hille <perthomas.hille@yale.edu> for the ALICE      *
+ * experiment. Contributors are mentioned in the code where appropriate.  *
+ * Please report bugs to  perthomas.hille@yale.edu                        *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+#include "AliCaloConstants.h"
+using namespace Algo;
+
+class AliCaloRawAnalyzer;
+
+class  AliCaloRawAnalyzerFactory
+{
+public:
+  virtual ~AliCaloRawAnalyzerFactory();
+  static AliCaloRawAnalyzer* CreateAnalyzer( const int algo ); 
+
+private:
+  AliCaloRawAnalyzerFactory();
+};
+
+#endif
index 36a3c14c18588ef247243b6eada510f2536f96db..2d4edac87f085bc39809d19c982e41677ad1a16d 100644 (file)
@@ -45,7 +45,7 @@ AliCaloRawAnalyzerFakeALTRO::AliCaloRawAnalyzerFakeALTRO() : AliCaloRawAnalyzer(
                                                 fFixTau(kTRUE)
 {
   //comment
-  for(int i=0; i < MAXSAMPLES; i++)
+  for(int i=0; i < ALTROMAXSAMPLES; i++)
     {
       fXaxis[i] = i;
     }
@@ -92,7 +92,7 @@ AliCaloRawAnalyzerFakeALTRO::Evaluate( const vector<AliCaloBunchInfo>  &bunchvec
        {
          int first = 0;
          int last = 0;
-         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev, &first, &last);
+         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev, &first, &last, fFitArrayCut );
          int nsamples =  last - first + 1;
          
          if( ( nsamples  )  >= fNsampleCut )
index c7ecc540c8641d715c67806e3238db854a1ae96b..d479d177dc7aae4a6d85f658f6212b96a8d41b1d 100644 (file)
@@ -18,10 +18,12 @@ class  TGraph;
 
 class  AliCaloRawAnalyzerFakeALTRO : public AliCaloRawAnalyzer
 {
+  friend class AliCaloRawAnalyzerFactory;
+
  public:
-           AliCaloRawAnalyzerFakeALTRO();
+  //AliCaloRawAnalyzerFakeALTRO();
   virtual ~AliCaloRawAnalyzerFakeALTRO();
-       
+  
   virtual AliCaloFitResults  Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector, const UInt_t altrocfg1,  const UInt_t altrocfg2 );
   void PrintFitResult(const TF1 *f) const;
   
@@ -35,10 +37,11 @@ class  AliCaloRawAnalyzerFakeALTRO : public AliCaloRawAnalyzer
   TF1 * GetFit() const { return fTf1; };
 
  private:
+  AliCaloRawAnalyzerFakeALTRO();
   AliCaloRawAnalyzerFakeALTRO(const AliCaloRawAnalyzerFakeALTRO & );
   AliCaloRawAnalyzerFakeALTRO  & operator = (const AliCaloRawAnalyzerFakeALTRO  &);
  
-  double fXaxis[MAXSAMPLES]; //Axis if time bins, ( used by TGraph )
+  double fXaxis[ALTROMAXSAMPLES]; //Axis if time bins, ( used by TGraph )
   const double fkEulerSquared; //e^2 = 7.389056098930650227
   TF1 *fTf1;     // Analytical formula of the Semi Gaussian to be fitted
 
index dd45f5cd9fcc1795496e14390fd9ed16b3cd9442..f8ba8c89de09ddffb8d5b6d99e45e046e11ce3bb 100644 (file)
@@ -84,7 +84,8 @@ AliCaloRawAnalyzerFastFit::Evaluate( const vector<AliCaloBunchInfo> &bunchvector
          int last = 0;
          int maxrev =  maxampindex -  bunchvector.at(index).GetStartBin();
 
-         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(), maxrev , &first, &last);
+         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(), maxrev , &first, &last, fFitArrayCut);
+
          int nsamples =  last - first + 1;
 
          if( ( nsamples  )  >= fNsampleCut )  
index 8858adcdc2fe31fdc4c81ba3e99f2a0fd3ec4082..79675aa45615165cc01779b1a999fedc6b5bb51b 100644 (file)
 
 class  AliCaloRawAnalyzerFastFit : public AliCaloRawAnalyzer
 {
+  friend class  AliCaloRawAnalyzerFactory;
  public:
-  AliCaloRawAnalyzerFastFit();
+  //AliCaloRawAnalyzerFastFit();
   virtual ~AliCaloRawAnalyzerFastFit();
   virtual AliCaloFitResults Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector, 
                                      const UInt_t altrocfg1,  const UInt_t altrocfg2 ); 
  private:
+  AliCaloRawAnalyzerFastFit();
   Double_t fXAxis[1008]; // Xaxis (time bins) corresponding to the ADC samples
 
   ClassDef( AliCaloRawAnalyzerFastFit, 1 )
diff --git a/EMCAL/AliCaloRawAnalyzerKStandard.cxx b/EMCAL/AliCaloRawAnalyzerKStandard.cxx
new file mode 100644 (file)
index 0000000..fd5bd0d
--- /dev/null
@@ -0,0 +1,488 @@
+/**************************************************************************
+ * This file is property of and copyright by                              *
+ * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009     *
+ *                                                                        *
+ * Primary Author: Per Thomas Hille <p.t.hille@fys.uio.no>                *
+ *                                                                        *
+ * Contributors are mentioned in the code where appropriate.              *
+ * Please report bugs to p.t.hille@fys.uio.no                             *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+// Extraction of amplitude and peak position
+// FRom CALO raw data using
+// least square fit for the
+// Moment assuming identical and 
+// independent errors (equivalent with chi square)
+// 
+
+#include "AliCaloRawAnalyzerKStandard.h"
+#include "AliCaloBunchInfo.h"
+#include "AliCaloFitResults.h"
+#include "AliLog.h"
+#include "TMath.h"
+#include <stdexcept>
+#include <iostream>
+#include "TF1.h"
+#include "TGraph.h"
+#include "TRandom.h"
+
+
+using namespace std;
+
+
+#define BAD 4  //CRAP PTH
+ClassImp( AliCaloRawAnalyzerKStandard )
+
+
+AliCaloRawAnalyzerKStandard::AliCaloRawAnalyzerKStandard() : AliCaloRawAnalyzer("Chi Square ( kStandard )", "KStandard"),
+                                                fkEulerSquared(7.389056098930650227),
+                                                fTf1(0),
+                                                fTau(2.35),
+                                                fFixTau(kTRUE)
+{
+  
+  fAlgo = Algo::kStandard;
+  //comment
+  for(int i=0; i < ALTROMAXSAMPLES; i++)
+    {
+      fXaxis[i] = i;
+    }
+  
+  fTf1 = new TF1( "myformula", "[0]*((x - [1])/[2])^2*exp(-2*(x -[1])/[2])",  0, 30 ); 
+  if (fFixTau) 
+    {
+    fTf1->FixParameter(2, fTau);
+    }
+  else 
+    {
+      fTf1->ReleaseParameter(2); // allow par. to vary
+      fTf1->SetParameter(2, fTau);
+    }
+}
+
+
+AliCaloRawAnalyzerKStandard::~AliCaloRawAnalyzerKStandard()
+{
+  delete fTf1;
+}
+
+
+
+AliCaloFitResults
+AliCaloRawAnalyzerKStandard::Evaluate( const vector<AliCaloBunchInfo>  &bunchlist, const UInt_t altrocfg1,  const UInt_t altrocfg2 )
+{
+  
+  Float_t pedEstimate  = 0;
+  short maxADC = 0;
+  Int_t first = 0;
+  Int_t last = 0;
+  Int_t bunchIndex = 0;
+  Float_t ampEstimate = 0;
+  short timeEstimate  = 0;
+  Float_t time = 0;
+  Float_t amp=0;
+  Float_t chi2 = 0;
+  Int_t ndf = 0;
+  Bool_t fitDone = kFALSE;
+
+  
+  int nsamples = PreFitEvaluateSamples( bunchlist, altrocfg1, altrocfg2, bunchIndex, ampEstimate, 
+                                       maxADC, timeEstimate, pedEstimate, first, last,   fAmpCut ); 
+  
+  
+  if (ampEstimate >= fAmpCut  ) 
+    { 
+      time = timeEstimate; 
+      Int_t timebinOffset = bunchlist.at(bunchIndex).GetStartBin() - (bunchlist.at(bunchIndex).GetLength()-1); 
+      amp = ampEstimate; 
+      
+      if ( nsamples > 1 && maxADC< OVERFLOWCUT ) 
+       { 
+         FitRaw(first, last, amp, time, chi2, fitDone);
+         time += timebinOffset;
+         timeEstimate += timebinOffset;
+         ndf = nsamples - 2;
+       }
+    } 
+  if ( fitDone ) 
+    { 
+      Float_t ampAsymm = (amp - ampEstimate)/(amp + ampEstimate);
+      Float_t timeDiff = time - timeEstimate;
+      
+      if ( (TMath::Abs(ampAsymm) > 0.1) || (TMath::Abs(timeDiff) > 2) ) 
+       {
+         amp     = ampEstimate;
+         time    = timeEstimate; 
+         fitDone = kFALSE;
+       } 
+    }  
+  if (amp >= fAmpCut ) 
+    { 
+      if ( ! fitDone) 
+       { 
+         amp += (0.5 - gRandom->Rndm()); 
+       }
+      //Int_t id = fGeom->GetAbsCellIdFromCellIndexes(in.GetModule(), in.GetRow(), in.GetColumn()) ;
+      // lowGain  = in.IsLowGain();
+     
+      time = time * TIMEBINWITH; 
+      
+      /////////////!!!!!!!!!time -= in.GetL1Phase();
+
+      time -= fL1Phase;
+
+      //    AliDebug(2,Form("id %d lowGain %d amp %g", id, lowGain, amp));
+      //  AddDigit(digitsArr, id, lowGain, amp, time, chi2, ndf); 
+      
+
+      return AliCaloFitResults( -99, -99, fAlgo , amp, time,
+                               time, chi2, ndf, Ret::kDummy );
+      
+      
+      //       AliCaloFitSubarray(index, maxrev, first, last));
+    
+    }
+  
+  
+  return AliCaloFitResults( Ret::kInvalid, Ret::kInvalid );
+}
+
+
+
+
+/*  
+   return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset,
+                                       timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); 
+           }
+        } // ampcut
+    }
+  return AliCaloFitResults( Ret::kInvalid, Ret::kInvalid );
+*/
+
+
+/*
+  // Extracting signal parameters using fitting
+  short maxampindex; //index of maximum amplitude
+  short maxamp; //Maximum amplitude
+  int index = SelectBunch( bunchvector,  &maxampindex,  &maxamp );
+  
+  if( index >= 0)
+    {
+      Float_t  ped  = ReverseAndSubtractPed( &(bunchvector.at(index))  ,  altrocfg1, altrocfg2, fReversed  );
+      Float_t maxf = TMath::MaxElement( bunchvector.at(index).GetLength(),  fReversed );
+      short maxrev = maxampindex  -  bunchvector.at(index).GetStartBin();
+      // timebinOffset is timebin value at maximum (maxrev)
+      short timebinOffset = maxampindex - (bunchvector.at(index).GetLength()-1);
+      if(  maxf < fAmpCut  ||  ( maxamp - ped) > fOverflowCut  ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then)
+       {
+         return  AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset);
+       }            
+      else if ( maxf >= fAmpCut )
+       {
+         int first = 0;
+         int last = 0;
+         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev, &first, &last, fFitArrayCut);
+         int nsamples =  last - first + 1;
+         
+         if( ( nsamples  )  >= fNsampleCut )
+           {
+             Float_t tmax = (maxrev - first); // local tmax estimate
+             TGraph *graph =  new TGraph(  nsamples, fXaxis,  &fReversed[first] );
+             fTf1->SetParameter(0, maxf*fkEulerSquared );
+             fTf1->SetParameter(1, tmax - fTau); 
+             // set rather loose parameter limits
+             fTf1->SetParLimits(0, 0.5*maxf*fkEulerSquared, 2*maxf*fkEulerSquared );
+             fTf1->SetParLimits(1, tmax - fTau - 4, tmax - fTau + 4); 
+
+             if (fFixTau) {
+               fTf1->FixParameter(2, fTau);
+             }
+             else {
+               fTf1->ReleaseParameter(2); // allow par. to vary
+               fTf1->SetParameter(2, fTau);
+             }
+
+             Short_t tmpStatus = 0;
+             try {
+               tmpStatus =  graph->Fit(fTf1, "Q0RW");
+             }
+             catch (const std::exception & e) {
+               AliError( Form("TGraph Fit exception %s", e.what()) ); 
+               return AliCaloFitResults( maxamp, ped, Ret::kNoFit, maxf, timebinOffset,
+                                         timebinOffset, Ret::kDummy, Ret::kDummy, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) );
+             }
+
+             if( fVerbose == true )
+               {
+                 AliCaloRawAnalyzer::PrintBunch( bunchvector.at(index) ); 
+                 PrintFitResult( fTf1 ) ;
+               }  
+             // global tmax
+             tmax = fTf1->GetParameter(1) + timebinOffset - (maxrev - first) // abs. t0
+               + fTf1->GetParameter(2); // +tau, makes sum tmax
+             
+               delete graph;
+               return AliCaloFitResults( maxamp, ped , Ret::kFitPar,
+                                         fTf1->GetParameter(0)/fkEulerSquared, 
+                                         tmax,
+                                         timebinOffset,  
+                                         fTf1->GetChisquare(), 
+                                         fTf1->GetNDF(),
+                                         Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) );
+                               
+               //     delete graph;
+       
+           }
+         else
+           {
+             
+             Float_t chi2 = CalculateChi2(maxf, maxrev, first, last);
+             Int_t ndf = last - first - 1; // nsamples - 2
+             return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset,
+                                       timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); 
+           }
+        } // ampcut
+    }
+  return AliCaloFitResults( Ret::kInvalid, Ret::kInvalid );
+  
+}
+*/
+
+
+
+void 
+AliCaloRawAnalyzerKStandard::PrintFitResult(const TF1 *f) const
+{
+  //comment
+  cout << endl;
+  cout << __FILE__ << __LINE__ << "Using this samplerange we get" << endl;
+  cout << __FILE__ << __LINE__ << "AMPLITUDE = " << f->GetParameter(0)/fkEulerSquared << ",.. !!!!" << endl;
+  cout << __FILE__ << __LINE__ << "TOF = " << f->GetParameter(1) << ",.. !!!!" << endl;
+  cout << __FILE__ << __LINE__ << "NDF = " << f->GetNDF() << ",.. !!!!" << endl;
+  //  cout << __FILE__ << __LINE__ << "STATUS = " << f->GetStatus()  << ",.. !!!!" << endl << endl;
+  cout << endl << endl;
+}
+
+
+
+
+       
+//____________________________________________________________________________ 
+void
+ AliCaloRawAnalyzerKStandard::FitRaw(const Int_t firstTimeBin, const Int_t lastTimeBin, Float_t & amp, Float_t & time, Float_t & chi2, Bool_t & fitDone) const 
+{ // Fits the raw signal time distribution
+  
+  //--------------------------------------------------
+  //Do the fit, different fitting algorithms available
+  //--------------------------------------------------
+  
+  // fprintf(fp, "%s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__ );
+
+  int nsamples = lastTimeBin - firstTimeBin + 1;
+  fitDone = kFALSE;
+  
+  // switch(fFittingAlgorithm) 
+  //   {
+  //  case Algo::kStandard:
+  //    {
+  if (nsamples < 3) { return; } // nothing much to fit
+  //printf("Standard fitter \n");
+
+  // Create Graph to hold data we will fit 
+  
+  TGraph *gSig =  new TGraph( nsamples); 
+  for (int i=0; i<nsamples; i++) 
+    {
+      Int_t timebin = firstTimeBin + i;    
+      gSig->SetPoint(i, timebin, GetReversed(timebin)); 
+    }
+      
+  TF1 * signalF = new TF1("signal", RawResponseFunction, 0, TIMEBINS , 5);
+  signalF->SetParameters(10.,5., TAU  ,ORDER,0.); //set all defaults once, just to be safe
+  signalF->SetParNames("amp","t0","tau","N","ped");
+  signalF->FixParameter(2,TAU); // tau in units of time bin
+  signalF->FixParameter(3,ORDER); // order
+  signalF->FixParameter(4, 0); // pedestal should be subtracted when we get here 
+  signalF->SetParameter(1, time);
+  signalF->SetParameter(0, amp);
+  // set rather loose parameter limits
+  signalF->SetParLimits(0, 0.5*amp, 2*amp );
+  signalF->SetParLimits(1, time - 4, time + 4); 
+      
+  try {                        
+    gSig->Fit(signalF, "QROW"); // Note option 'W': equal errors on all points
+    // assign fit results
+    amp  = signalF->GetParameter(0); 
+    time = signalF->GetParameter(1);
+    chi2 = signalF->GetChisquare();
+    fitDone = kTRUE;
+  }
+  catch (const std::exception & e) {
+    AliError( Form("TGraph Fit exception %s", e.what()) ); 
+    // stay with default amp and time in case of exception, i.e. no special action required
+    fitDone = kFALSE;
+  }
+  delete signalF;
+      
+  //printf("Std   : Amp %f, time %g\n",amp, time);
+  delete gSig; // delete TGraph
+      
+  //   break;
+  //    }//kStandard Fitter
+  //----------------------------
+  /*
+    case Algo::kLogFit:
+    {
+    if (nsamples < 3) { return; } // nothing much to fit
+    //printf("LogFit \n");
+      
+    // Create Graph to hold data we will fit 
+    TGraph *gSigLog =  new TGraph( nsamples); 
+    for (int i=0; i<nsamples; i++) {
+    Int_t timebin = firstTimeBin + i;    
+    gSigLog->SetPoint(timebin, timebin, TMath::Log(fRawAnalyzer->GetReversed(timebin) ) ); 
+    }
+      
+    TF1 * signalFLog = new TF1("signalLog", RawResponseFunctionLog, 0,  TIMEBINS , 5);
+    signalFLog->SetParameters(2.3, 5.,TAU,ORDER,0.); //set all defaults once, just to be safe
+    signalFLog->SetParNames("amplog","t0","tau","N","ped");
+    signalFLog->FixParameter(2,TAU); // tau in units of time bin
+    signalFLog->FixParameter(3, ORDER); // order
+    signalFLog->FixParameter(4, 0); // pedestal should be subtracted when we get here 
+    signalFLog->SetParameter(1, time);
+    if (amp>=1) {
+    signalFLog->SetParameter(0, TMath::Log(amp));
+    }
+      
+    gSigLog->Fit(signalFLog, "QROW"); // Note option 'W': equal errors on all points
+      
+    // assign fit results
+    Double_t amplog = signalFLog->GetParameter(0); //Not Amp, but Log of Amp
+    amp = TMath::Exp(amplog);
+    time = signalFLog->GetParameter(1);
+    fitDone = kTRUE;
+      
+    delete signalFLog;
+    //printf("LogFit: Amp %f, time %g\n",amp, time);
+    delete gSigLog; 
+    break;
+    } //kLogFit 
+      //----------------------------   
+      //----------------------------
+      }//switch fitting algorithms
+  */
+  return;
+}
+
+
+//__________________________________________________________________
+void 
+AliCaloRawAnalyzerKStandard::FitParabola(const TGraph *gSig, Float_t & amp) const 
+{
+  //BEG YS alternative methods to calculate the amplitude
+  Double_t * ymx = gSig->GetX() ; 
+  Double_t * ymy = gSig->GetY() ; 
+  const Int_t kN = 3 ; 
+  Double_t ymMaxX[kN] = {0., 0., 0.} ; 
+  Double_t ymMaxY[kN] = {0., 0., 0.} ; 
+  Double_t ymax = 0. ; 
+  // find the maximum amplitude
+  Int_t ymiMax = 0 ;  
+  for (Int_t ymi = 0; ymi < gSig->GetN(); ymi++) {
+    if (ymy[ymi] > ymMaxY[0] ) {
+      ymMaxY[0] = ymy[ymi] ; //<========== This is the maximum amplitude
+      ymMaxX[0] = ymx[ymi] ;
+      ymiMax = ymi ; 
+    }
+  }
+  // find the maximum by fitting a parabola through the max and the two adjacent samples
+  if ( ymiMax < gSig->GetN()-1 && ymiMax > 0) {
+    ymMaxY[1] = ymy[ymiMax+1] ;
+    ymMaxY[2] = ymy[ymiMax-1] ; 
+    ymMaxX[1] = ymx[ymiMax+1] ;
+    ymMaxX[2] = ymx[ymiMax-1] ; 
+    if (ymMaxY[0]*ymMaxY[1]*ymMaxY[2] > 0) {
+      //fit a parabola through the 3 points y= a+bx+x*x*x
+      Double_t sy = 0 ; 
+      Double_t sx = 0 ; 
+      Double_t sx2 = 0 ; 
+      Double_t sx3 = 0 ; 
+      Double_t sx4 = 0 ; 
+      Double_t sxy = 0 ; 
+      Double_t sx2y = 0 ; 
+      for (Int_t i = 0; i < kN ; i++) {
+        sy += ymMaxY[i] ; 
+        sx += ymMaxX[i] ;              
+        sx2 += ymMaxX[i]*ymMaxX[i] ; 
+        sx3 += ymMaxX[i]*ymMaxX[i]*ymMaxX[i] ; 
+        sx4 += ymMaxX[i]*ymMaxX[i]*ymMaxX[i]*ymMaxX[i] ; 
+        sxy += ymMaxX[i]*ymMaxY[i] ; 
+        sx2y += ymMaxX[i]*ymMaxX[i]*ymMaxY[i] ; 
+      }
+      Double_t cN = (sx2y*kN-sy*sx2)*(sx3*sx-sx2*sx2)-(sx2y*sx-sxy*sx2)*(sx3*kN-sx*sx2); 
+      Double_t cD = (sx4*kN-sx2*sx2)*(sx3*sx-sx2*sx2)-(sx4*sx-sx3*sx2)*(sx3*kN-sx*sx2) ;
+      Double_t c  = cN / cD ; 
+      Double_t b  = ((sx2y*kN-sy*sx2)-c*(sx4*kN-sx2*sx2))/(sx3*kN-sx*sx2) ;
+      Double_t a  = (sy-b*sx-c*sx2)/kN  ;
+      Double_t xmax = -b/(2*c) ; 
+      ymax = a + b*xmax + c*xmax*xmax ;//<========== This is the maximum amplitude
+      amp = ymax;
+    }
+  }
+  
+  Double_t diff = TMath::Abs(1-ymMaxY[0]/amp) ; 
+  if (diff > 0.1) 
+    amp = ymMaxY[0] ; 
+  //printf("Yves   : Amp %f, time %g\n",amp, time);
+  //END YS
+  return;
+}
+
+
+
+//__________________________________________________________________
+Double_t 
+AliCaloRawAnalyzerKStandard::RawResponseFunction(Double_t *x, Double_t *par)
+{
+  // Matches version used in 2007 beam test
+  //
+  // Shape of the electronics raw reponse:
+  // It is a semi-gaussian, 2nd order Gamma function of the general form
+  //
+  // xx = (t - t0 + tau) / tau  [xx is just a convenient help variable]
+  // F = A * (xx**N * exp( N * ( 1 - xx) )   for xx >= 0
+  // F = 0                                   for xx < 0 
+  //
+  // parameters:
+  // A:   par[0]   // Amplitude = peak value
+  // t0:  par[1]
+  // tau: par[2]
+  // N:   par[3]
+  // ped: par[4]
+  //
+  Double_t signal = 0.;
+  Double_t tau    = par[2];
+  Double_t n      = par[3];
+  Double_t ped    = par[4];
+  Double_t xx     = ( x[0] - par[1] + tau ) / tau ;
+
+  if (xx <= 0) 
+    signal = ped ;  
+  else {  
+    signal = ped + par[0] * TMath::Power(xx , n) * TMath::Exp(n * (1 - xx )) ; 
+  }
+  return signal ;  
+}
+
diff --git a/EMCAL/AliCaloRawAnalyzerKStandard.h b/EMCAL/AliCaloRawAnalyzerKStandard.h
new file mode 100644 (file)
index 0000000..5abc093
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef ALICALORAWANALYZERSTANDARD_H
+#define ALICALORAWANALYZERSTANDARD_H
+/**************************************************************************
+ * This file is property of and copyright by                              *
+ * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009     *
+ *                                                                        *
+ * Primary Author: Per Thomas Hille <p.t.hille@fys.uio.no>                *
+ *                                                                        *
+ * Contributors are mentioned in the code where appropriate.              *
+ * Please report bugs to p.t.hille@fys.uio.no                             *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+// Extraction of amplitude and peak position
+// FRom CALO raw data using
+// Chi square fit
+
+#include "AliCaloRawAnalyzer.h"
+#include "AliCaloConstants.h"
+
+using namespace ALTRO;
+using namespace EMCAL;
+
+class  TF1;
+class  TGraph;
+
+class  AliCaloRawAnalyzerKStandard : public AliCaloRawAnalyzer
+{
+  friend class AliCaloRawAnalyzerFactory;
+
+ public:
+  //AliCaloRawAnalyzerKStandard();
+  virtual ~AliCaloRawAnalyzerKStandard();
+  virtual AliCaloFitResults  Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector, const UInt_t altrocfg1,  const UInt_t altrocfg2 );
+  void PrintFitResult(const TF1 *f) const;
+  static Double_t RawResponseFunction(Double_t *x, Double_t *par); 
+  void FitRaw(const Int_t firstTimeBin, const Int_t lastTimeBin, Float_t & amp, Float_t & time, 
+             Float_t & chi2, Bool_t & fitDone) const ;
+  void FitParabola(const TGraph *gSig, Float_t & amp) const ;
+  // shaper tau value, in time-bins, and flag for keeping tau fixed
+  Float_t GetTau() const { return fTau;};
+  void SetTau(Float_t f) { fTau = f; }; 
+  Bool_t GetFixTau() const { return fFixTau; }; 
+  void SetFixTau(Bool_t b) { fFixTau = b; }; 
+
+  // extra interfaces
+  TF1 * GetFit() const { return fTf1; };
+
+ private:
+  AliCaloRawAnalyzerKStandard();
+  AliCaloRawAnalyzerKStandard(const AliCaloRawAnalyzerKStandard & );
+  AliCaloRawAnalyzerKStandard  & operator = (const AliCaloRawAnalyzerKStandard  &);
+  double fXaxis[ALTROMAXSAMPLES]; //Axis if time bins, ( used by TGraph )
+  const double fkEulerSquared; //e^2 = 7.389056098930650227
+  TF1 *fTf1;     // Analytical formula of the Semi Gaussian to be fitted
+
+  Float_t fTau; // shaper tau, in time bins
+  Bool_t fFixTau; // flag if tau should be fix
+
+  ClassDef(AliCaloRawAnalyzerKStandard, 2)
+
+};
+
+#endif
index 412630147609817b83a0db5d5e6639dc42eaadcb..a38dbd2bc722cde53063e35164bba08f1e227113 100644 (file)
@@ -34,6 +34,7 @@
 #include "TF1.h"
 #include "TGraph.h"
 
+
 using namespace std;
 
 
@@ -51,7 +52,7 @@ AliCaloRawAnalyzerLMS::AliCaloRawAnalyzerLMS() : AliCaloRawAnalyzer("Chi Square
   
   fAlgo = Algo::kLMS;
   //comment
-  for(int i=0; i < MAXSAMPLES; i++)
+  for(int i=0; i < ALTROMAXSAMPLES; i++)
     {
       fXaxis[i] = i;
     }
@@ -99,7 +100,7 @@ AliCaloRawAnalyzerLMS::Evaluate( const vector<AliCaloBunchInfo>  &bunchvector, c
        {
          int first = 0;
          int last = 0;
-         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev, &first, &last);
+         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev, &first, &last, fFitArrayCut);
          int nsamples =  last - first + 1;
          
          if( ( nsamples  )  >= fNsampleCut )
@@ -153,6 +154,7 @@ AliCaloRawAnalyzerLMS::Evaluate( const vector<AliCaloBunchInfo>  &bunchvector, c
            }
          else
            {
+             
              Float_t chi2 = CalculateChi2(maxf, maxrev, first, last);
              Int_t ndf = last - first - 1; // nsamples - 2
              return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset,
index c3fb89a9ac1be2944b8648385743167de3b2f507..b7608dcd737c9225ccf96961840441fe79b67aec 100644 (file)
 // Chi square fit
 
 #include "AliCaloRawAnalyzer.h"
+#include "AliCaloConstants.h"
 
+using namespace ALTRO;
 
 class  TF1;
 class  TGraph;
 
 class  AliCaloRawAnalyzerLMS : public AliCaloRawAnalyzer
 {
+  friend class AliCaloRawAnalyzerFactory;
+
  public:
-  AliCaloRawAnalyzerLMS();
+  //  AliCaloRawAnalyzerLMS();
   virtual ~AliCaloRawAnalyzerLMS();
   virtual AliCaloFitResults  Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector, const UInt_t altrocfg1,  const UInt_t altrocfg2 );
   void PrintFitResult(const TF1 *f) const;
@@ -47,10 +51,11 @@ class  AliCaloRawAnalyzerLMS : public AliCaloRawAnalyzer
   TF1 * GetFit() const { return fTf1; };
 
  private:
+  AliCaloRawAnalyzerLMS();
   AliCaloRawAnalyzerLMS(const AliCaloRawAnalyzerLMS & );
   AliCaloRawAnalyzerLMS  & operator = (const AliCaloRawAnalyzerLMS  &);
  
-  double fXaxis[MAXSAMPLES]; //Axis if time bins, ( used by TGraph )
+  double fXaxis[ALTROMAXSAMPLES]; //Axis if time bins, ( used by TGraph )
   const double fkEulerSquared; //e^2 = 7.389056098930650227
   TF1 *fTf1;     // Analytical formula of the Semi Gaussian to be fitted
 
diff --git a/EMCAL/AliCaloRawAnalyzerLMSOffline.cxx b/EMCAL/AliCaloRawAnalyzerLMSOffline.cxx
new file mode 100644 (file)
index 0000000..1816f31
--- /dev/null
@@ -0,0 +1,127 @@
+/**************************************************************************
+ * This file is property of and copyright by                              *
+ * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009     *
+ *                                                                        *
+ * Primary Author: Per Thomas Hille <p.t.hille@fys.uio.no>                *
+ *                                                                        *
+ * Contributors are mentioned in the code where appropriate.              *
+ * Please report bugs to p.t.hille@fys.uio.no                             *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+// Extraction of amplitude and peak position
+// FRom CALO raw data using
+// least square fit for the
+// Moment assuming identical and 
+// independent errors (equivalent with chi square)
+// 
+
+#include "AliCaloRawAnalyzerLMSOffline.h"
+#include "AliCaloBunchInfo.h"
+#include "AliCaloFitResults.h"
+#include "AliLog.h"
+#include "TMath.h"
+#include <stdexcept>
+#include <iostream>
+#include "TF1.h"
+#include "TGraph.h"
+#include "AliEMCALRawUtils.h"
+#include <TRandom.h>
+
+//#include "AliCaloRawAnalyzerLMS.h"
+
+#include "AliCaloRawAnalyzerFactory.h"
+
+using namespace std;
+
+
+//#define BAD 4  //CRAP PTH
+ClassImp( AliCaloRawAnalyzerLMSOffline )
+
+
+AliCaloRawAnalyzerLMSOffline::AliCaloRawAnalyzerLMSOffline() : AliCaloRawAnalyzer("Chi Square Fit OFFLINE", "LMSOffline"),
+  fNoiseThreshold(0),
+                                                              fRawAnalyzer(0), fSmearFactor()
+{
+  fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer(kLMS);
+  fAlgo = Algo::kLMSOffline;
+}
+
+
+AliCaloRawAnalyzerLMSOffline::~AliCaloRawAnalyzerLMSOffline()
+{
+  //  delete fTf1;
+}
+
+
+AliCaloFitResults
+AliCaloRawAnalyzerLMSOffline::Evaluate( const vector<AliCaloBunchInfo>  &bunchlist, const UInt_t altrocfg1,  const UInt_t altrocfg2 )
+{
+  // fRawAnalyzer setup
+  fRawAnalyzer->SetNsampleCut(5); // requirement for fits to be done, for the new methods
+  fRawAnalyzer->SetOverflowCut(OVERFLOWCUT);
+  fRawAnalyzer->SetAmpCut(fNoiseThreshold);
+  fRawAnalyzer->SetFitArrayCut(fNoiseThreshold);
+  
+  //  fRawAnalyzer->SetIsZeroSuppressed(true); // TMP - should use stream->IsZeroSuppressed(), or altro cfg registers later
+
+  fRawAnalyzer->SetIsZeroSuppressed(fIsZerosupressed); // TMP - should use stream->IsZeroSuppressed(), or altro cfg registers later
+
+
+  AliCaloFitResults fitResults;
+  Float_t time = 0; 
+  Float_t amp  = 0; 
+  short timeEstimate  = 0;
+  Float_t ampEstimate = 0;
+  Bool_t fitDone = kFALSE;
+  fitResults = fRawAnalyzer->Evaluate( bunchlist, altrocfg1, altrocfg2 ); 
+  amp          = fitResults.GetAmp();
+  time         = fitResults.GetTime();
+  timeEstimate = fitResults.GetMaxTimebin();
+  ampEstimate  = fitResults.GetMaxSig();
+  
+  if (fitResults.GetStatus() == Ret::kFitPar) 
+    {
+      fitDone = kTRUE;
+    }
+  
+  if ( fitDone ) 
+    { // brief sanity check of fit results         
+      Float_t ampAsymm = (amp - ampEstimate)/(amp + ampEstimate);
+      Float_t timeDiff = time - timeEstimate;
+      
+      if ( (TMath::Abs(ampAsymm) > 0.1) || (TMath::Abs(timeDiff) > 2) ) 
+       {
+         amp     = ampEstimate;
+         time    = timeEstimate; 
+         fitDone = kFALSE;
+       } 
+    } // fitDone
+  
+  if (amp >= fNoiseThreshold) 
+    { // something to be stored
+      if ( ! fitDone) 
+       { // smear ADC with +- 0.5 uniform (avoid discrete effects)
+         fSmearFactor =  (0.5 - gRandom->Rndm() );
+         amp += fSmearFactor; // Rndm generates a number in ]0,1]
+       }
+      // go from time-bin units to physical time fgtimetrigger
+      time = time *TIMEBINWITH; // skip subtraction of fgTimeTrigger?
+      // subtract RCU L1 phase (L1Phase is in seconds) w.r.t. L0:
+      //   time -= in.GetL1Phase();
+      time -= fL1Phase;
+      time = time/  TIMEBINWITH; 
+    }
+  fitResults.SetTime(time);
+  fitResults.SetAmp(amp);
+  return fitResults ; 
+}
+
diff --git a/EMCAL/AliCaloRawAnalyzerLMSOffline.h b/EMCAL/AliCaloRawAnalyzerLMSOffline.h
new file mode 100644 (file)
index 0000000..245816a
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef ALICALORAWANALYZERLMSOFFLINE_H
+#define ALICALORAWANALYZERLMSOFFLINE_H
+/**************************************************************************
+ * This file is property of and copyright by                              *
+ * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009     *
+ *                                                                        *
+ * Primary Author: Per Thomas Hille <p.t.hille@fys.uio.no>                *
+ *                                                                        *
+ * Contributors are mentioned in the code where appropriate.              *
+ * Please report bugs to p.t.hille@fys.uio.no                             *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+// Extraction of amplitude and peak position
+// FRom CALO raw data using
+// Chi square fit
+
+#include "AliCaloRawAnalyzer.h"
+
+class AliCaloRawAnalyzerLMS;
+
+
+class  AliCaloRawAnalyzerLMSOffline : public AliCaloRawAnalyzer
+{
+  friend class  AliCaloRawAnalyzerFactory;
+
+ public:
+  //  AliCaloRawAnalyzerLMSOffline();
+  virtual ~AliCaloRawAnalyzerLMSOffline();
+  virtual AliCaloFitResults  Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector, 
+                                      const UInt_t altrocfg1,  const UInt_t altrocfg2 );
+  Double_t  GetSmearFactor() {  return fSmearFactor; };
+   
+ private:
+  AliCaloRawAnalyzerLMSOffline();
+  AliCaloRawAnalyzerLMSOffline(const AliCaloRawAnalyzerLMSOffline & );
+  AliCaloRawAnalyzerLMSOffline  & operator = (const AliCaloRawAnalyzerLMSOffline  &);
+  Int_t fNoiseThreshold;                // threshold to consider signal or noise
+  AliCaloRawAnalyzer *fRawAnalyzer;
+  Double_t fSmearFactor;
+  ClassDef(AliCaloRawAnalyzerLMSOffline, 2)
+
+};
+
+#endif
index 96bc9e43b17d83e1915646861c4c0af0e54fc02e..69825b6e0aa021198417e3163679be5efd1d9d72 100644 (file)
@@ -63,6 +63,8 @@ AliCaloRawAnalyzerNN::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
   // The eveluation of  Peak position and amplitude using the Neural Network
   if( bunchvector.size()  <=  0 )
     {
+      //  cout << __FILE__ << __LINE__<< " INVALID "<< endl;
+
       return AliCaloFitResults( Ret::kInvalid, Ret::kInvalid);
     } 
  
@@ -73,6 +75,7 @@ AliCaloRawAnalyzerNN::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
   
   if( index   < 0 )
     {
+      //  cout << __FILE__ << __LINE__<< "INVALID !!!!!!" << endl;
       return AliCaloFitResults( Ret::kInvalid, Ret::kInvalid);
     }
   
@@ -82,13 +85,14 @@ AliCaloRawAnalyzerNN::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
 
   if(  maxf < fAmpCut  ||  ( maxamp - ped) > fOverflowCut  ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then)
     {
+      //   cout << __FILE__ << __LINE__<< ":  timebinOffset = " <<  timebinOffset  << "  maxf "<< maxf  << endl; 
       return  AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset);
     }
 
   int first = 0;
   int last = 0; 
   short maxrev = maxampindex  -  bunchvector.at(index).GetStartBin();
-  SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev , &first, &last);
+  SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev , &first, &last, fFitArrayCut );
 
   Float_t chi2 = 0;
   Int_t ndf = 0;
@@ -98,6 +102,7 @@ AliCaloRawAnalyzerNN::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
        {
          chi2 = CalculateChi2(maxf, maxrev, first, last);
          ndf = last - first - 1; // nsamples - 2
+         //      cout << __FILE__ << __LINE__<< ":  timebinOffset = " <<  timebinOffset << "  maxf\t"<< maxf <<endl;
          return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset,
                                    timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); 
        }
@@ -116,6 +121,7 @@ AliCaloRawAnalyzerNN::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
          // use local-array time for chi2 estimate
          chi2 = CalculateChi2(amp, tof-timebinOffset+maxrev, first, last);
          ndf = last - first - 1; // nsamples - 2
+         //cout << __FILE__ << __LINE__<< ":  tof = " <<  tof << "   amp" << amp <<endl;
          return AliCaloFitResults( maxamp, ped , Ret::kFitPar, amp , tof, timebinOffset, chi2, ndf,
                                    Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) );
 
@@ -123,6 +129,8 @@ AliCaloRawAnalyzerNN::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
     }
   chi2 = CalculateChi2(maxf, maxrev, first, last);
   ndf = last - first - 1; // nsamples - 2
+  
+  // cout << __FILE__ << __LINE__<< ":  timebinOffset = " << timebinOffset <<  "   maxf ="<< maxf  << endl;
   return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset,
                            timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); 
 
index 581f4492d21355658ed05dac673fc350ec62c6b1..a0df81de94e41ae72373b83d4147a5ce6b0a8ab5 100644 (file)
@@ -32,14 +32,16 @@ class AliCaloNeuralFit;
 
 class  AliCaloRawAnalyzerNN : public AliCaloRawAnalyzer
 {
+  friend class AliCaloRawAnalyzerFactory;
  public:
-  AliCaloRawAnalyzerNN();
+  // AliCaloRawAnalyzerNN();
   virtual ~AliCaloRawAnalyzerNN();
   virtual AliCaloFitResults Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector, 
                                       const UInt_t altrocfg1,  const UInt_t altrocfg2 );
   //  virtual void SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const  first, int *const last ) const;
 
  private:
+  AliCaloRawAnalyzerNN();
   AliCaloRawAnalyzerNN( const AliCaloRawAnalyzerNN   & );
   AliCaloRawAnalyzerNN   & operator = ( const  AliCaloRawAnalyzerNN  & );
   AliCaloNeuralFit *fNeuralNet; // pointer to the class whick actually implements the Neural Network for EMCAL
index c246278d6af65a937e7bdc7c7164f0fca4b08c11..45c99dcfbc543a5c7ee433304d195a6939f69dba 100644 (file)
@@ -36,6 +36,8 @@
 #include "TFile.h"
 #include "AliCaloPeakFinderVectors.h"
 #include <iostream>
+//#include "AliEMCALRawUtils.h"
+
 using namespace std;
 
 
@@ -43,7 +45,7 @@ ClassImp( AliCaloRawAnalyzerPeakFinder )
 
 
 AliCaloRawAnalyzerPeakFinder::AliCaloRawAnalyzerPeakFinder() :AliCaloRawAnalyzer("Peak-Finder", "PF"),  
-                                                             fAmp(0),
+//    fAmp(0),
                                                              fPeakFinderVectors(0),
                                                              fRunOnAlien(false),
                                                              fIsInitialized(false)
@@ -146,7 +148,7 @@ AliCaloRawAnalyzerPeakFinder::Evaluate( const vector<AliCaloBunchInfo> &bunchvec
          int first = 0;
          int last = 0;
          short maxrev = maxampindex  -  bunchvector.at(index).GetStartBin();     
-         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(), maxrev, &first, &last);
+         SelectSubarray( fReversed,  bunchvector.at(index).GetLength(), maxrev, &first, &last, fFitArrayCut);
          int nsamples =  last - first;
 
          if( ( nsamples  )  >= fNsampleCut ) // no if statement needed really; keep for readability
@@ -195,7 +197,9 @@ AliCaloRawAnalyzerPeakFinder::Evaluate( const vector<AliCaloBunchInfo> &bunchvec
                  fAmp = maxf;
                }
              
-             tof = timebinOffset - 0.01*tof/fAmp; // clock ticks
+             //      tof = timebinOffset - 0.01*tof/fAmp; // clock ticks
+             tof = timebinOffset - 0.01*tof/fAmp - fL1Phase/TIMEBINWITH; // clock
+
              // use local-array time for chi2 estimate
              Float_t chi2 = CalculateChi2(fAmp, tof-timebinOffset+maxrev, first, last);
              Int_t ndf = last - first - 1; // nsamples - 2
index 3f3fe4c1644f2b01763a92635a9b412713c28419..b3633efee5b5d2cec43c9a9f70052779910cef48 100644 (file)
@@ -32,13 +32,15 @@ class AliCaloPeakFinderVectors;
 
 class  AliCaloRawAnalyzerPeakFinder : public AliCaloRawAnalyzer
 {
+  friend class AliCaloRawAnalyzerFactory;
  public:
-  AliCaloRawAnalyzerPeakFinder();
+  // AliCaloRawAnalyzerPeakFinder( );
   virtual ~AliCaloRawAnalyzerPeakFinder();
   virtual AliCaloFitResults Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector, 
                                      const UInt_t altrocfg1,  const UInt_t altrocfg2 );
 
  private:
+  AliCaloRawAnalyzerPeakFinder();
   AliCaloRawAnalyzerPeakFinder( const AliCaloRawAnalyzerPeakFinder   & );
   AliCaloRawAnalyzerPeakFinder   & operator = ( const  AliCaloRawAnalyzerPeakFinder  & );
   void     LoadVectorsASCII();
@@ -53,7 +55,9 @@ class  AliCaloRawAnalyzerPeakFinder : public AliCaloRawAnalyzer
   Double_t fPFTofVectorsCoarse[PF::MAXSTART][PF::SAMPLERANGE][100];  // Vectors for TOF extraction, first iteration
   Double_t fPFAmpVectors[PF::MAXSTART][PF::SAMPLERANGE][100];        // Vectors for Amplitude extraction, second iteration
   Double_t fPFTofVectors[PF::MAXSTART][PF::SAMPLERANGE][100];        // Vectors for TOF extraction, second iteration
-  Double_t fAmp; // The amplitude in entities of ADC counts
+  
+  //Double_t fAmp; // The amplitude in entities of ADC counts
   AliCaloPeakFinderVectors  *fPeakFinderVectors; // Collection of Peak-Fincer vectors
   bool fRunOnAlien; // Wether or not we are running on the GRID
   bool fIsInitialized;
index dd20221c8d209d67b401b9a2212fffb1724c5070..1cd1aab9daa8f73a3ddabe951f3d0f40b202c461 100644 (file)
@@ -69,6 +69,8 @@ Also calculate the ratio of amplitude from LED Monitor system (current/Reference
 #include "AliCaloRawAnalyzerPeakFinder.h"
 #include "AliCaloRawAnalyzerCrude.h"
 
+#include "AliCaloRawAnalyzerFactory.h"
+
 using namespace std;
 
 ClassImp(AliEMCALQADataMakerRec)
@@ -105,7 +107,11 @@ AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(fitAlgorithm fitAlgo) :
 {
   // ctor
   SetFittingAlgorithm(fitAlgo);
-  fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
+  
+  //fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
+  
+  fRawAnalyzerTRU =  ( AliCaloRawAnalyzerLMS*)AliCaloRawAnalyzerFactory::CreateAnalyzer(kLMS);
+  
   fRawAnalyzerTRU->SetFixTau(kTRUE); 
   fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper
 //  for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
@@ -146,7 +152,9 @@ AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(const AliEMCALQADataMakerRec& qad
   SetName((const char*)qadm.GetName()) ; 
   SetTitle((const char*)qadm.GetTitle()); 
   SetFittingAlgorithm(qadm.GetFittingAlgorithm());
-  fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
+  
+  //fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
+  fRawAnalyzerTRU = (AliCaloRawAnalyzerLMS*)AliCaloRawAnalyzerFactory::CreateAnalyzer(kLMS);
   fRawAnalyzerTRU->SetFixTau(kTRUE); 
   fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper
 //  for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
@@ -883,7 +891,18 @@ void AliEMCALQADataMakerRec::SetFittingAlgorithm(Int_t fitAlgo)
 {
   //Set fitting algorithm and initialize it if this same algorithm was not set before.
   //printf("**** Set Algorithm , number %d ****\n",fitAlgo);
+
+  
+  // fRawAnalyzer =  AliCaloRawAnalyzerFactory::CreateAnalyzer(fitAlgo);
+  // fFittingAlgorithm = fitAlgo; 
+  
   
+  //CRAP PTH
+  fRawAnalyzer =  AliCaloRawAnalyzerFactory::CreateAnalyzer(kLMS);
+  fFittingAlgorithm = kLMS; 
+
+
+  /*
   if(fitAlgo == fFittingAlgorithm && fRawAnalyzer) {
     //Do nothing, this same algorithm already set before.
     //printf("**** Algorithm already set before, number %d, %s ****\n",fitAlgo, fRawAnalyzer->GetName());
@@ -917,6 +936,7 @@ void AliEMCALQADataMakerRec::SetFittingAlgorithm(Int_t fitAlgo)
 
   }
   return;
+  */
 }
 
 //_____________________________________________________________________________________
index f895d6c4cd00bf713ad159884e8aed110954e03f..c8d3e1ece4ad8fa47b137f60e8d5fabc6522a02c 100644 (file)
@@ -135,9 +135,10 @@ public:
 private:
  void ConvertProfile2H(TProfile * p, TH2 * histo) ; //change the profile plot to a 2D histogram
   
-  Int_t fFittingAlgorithm;             // select the fitting algorithm
-  AliCaloRawAnalyzer *fRawAnalyzer;    // for signal fitting
-  AliCaloRawAnalyzerLMS *fRawAnalyzerTRU;    // for signal fitting, for TRU
+ Int_t fFittingAlgorithm;             // select the fitting algorithm
+
+ AliCaloRawAnalyzer *fRawAnalyzer;    // for signal fitting
+ AliCaloRawAnalyzerLMS *fRawAnalyzerTRU;    // for signal fitting, for TRU
 
   int fSuperModules; //The number of SuperModules activated
   int fFirstPedestalSample; // first sample for pedestal calculation, in bunch
index abc6a6d448cd85b5a5cfa2596766b79244511bc9..2f959041b6e3d33baa9319a5a038aed4638be75c 100644 (file)
 //    No pedestal is added to the raw signal.
 //*-- Author: Marco van Leeuwen (LBL)
 
+
 #include "AliEMCALRawUtils.h"
-#include <stdexcept>
-  
 #include "TF1.h"
 #include "TGraph.h"
 #include <TRandom.h>
-class TSystem;
-  
-class AliLog;
 #include "AliRun.h"
 #include "AliRunLoader.h"
-class AliCaloAltroMapping;
 #include "AliAltroBuffer.h"
 #include "AliRawReader.h"
 #include "AliCaloRawStreamV3.h"
 #include "AliDAQ.h"
-  
 #include "AliEMCALRecParam.h"
 #include "AliEMCALLoader.h"
 #include "AliEMCALGeometry.h"
-class AliEMCALDigitizer;
 #include "AliEMCALDigit.h"
 #include "AliEMCALRawDigit.h"
 #include "AliEMCAL.h"
 #include "AliCaloCalibPedestal.h"  
-#include "AliCaloFastAltroFitv0.h"
-#include "AliCaloNeuralFit.h"
 #include "AliCaloBunchInfo.h"
 #include "AliCaloFitResults.h"
-#include "AliCaloRawAnalyzerFastFit.h"
-#include "AliCaloRawAnalyzerNN.h"
-#include "AliCaloRawAnalyzerLMS.h"
-#include "AliCaloRawAnalyzerPeakFinder.h"
-#include "AliCaloRawAnalyzerCrude.h"
 #include "AliEMCALTriggerRawDigitMaker.h"
 #include "AliEMCALTriggerSTURawStream.h"
 #include "AliEMCALTriggerData.h"
+#include "AliCaloConstants.h"
+#include "AliCaloRawAnalyzer.h"
+#include "AliCaloRawAnalyzerFactory.h"
 
-ClassImp(AliEMCALRawUtils)
-  
-// Signal shape parameters
-Int_t    AliEMCALRawUtils::fgTimeBins     = 256;       // number of sampling bins of the raw RO signal (we typically use 15-50; theoretical max is 1k+) 
-Double_t AliEMCALRawUtils::fgTimeBinWidth = 100E-9 ;   // each sample is 100 ns
-Double_t AliEMCALRawUtils::fgTimeTrigger  = 600E-9 ;   // the time of the trigger as approximately seen in the data
+using namespace CALO;
+using namespace EMCAL;
 
-// some digitization constants
+Double_t AliEMCALRawUtils::fgTimeTrigger  = 600E-9 ;   // the time of the trigger as approximately seen in the data
 Int_t    AliEMCALRawUtils::fgThreshold         = 1;
-Int_t    AliEMCALRawUtils::fgDDLPerSuperModule = 2;  // 2 ddls per SuperModule
 Int_t    AliEMCALRawUtils::fgPedestalValue     = 0;  // pedestal value for digits2raw, default generate ZS data
 Double_t AliEMCALRawUtils::fgFEENoise          = 3.; // 3 ADC channels of noise (sampled)
 
-AliEMCALRawUtils::AliEMCALRawUtils( Algo::fitAlgorithm fitAlgo)
-  : fHighLowGainFactor(0.), fOrder(0), fTau(0.), fNoiseThreshold(0),
-    fNPedSamples(0), fGeom(0), fOption(""),
-    fRemoveBadChannels(kTRUE),fFittingAlgorithm(0),  
-    fTimeMin(-1.),fTimeMax(1.),
-    fUseFALTRO(kFALSE),fRawAnalyzer(0),
-    fTriggerRawDigitMaker(0x0)
-{
+ClassImp(AliEMCALRawUtils)
+
 
-  //These are default parameters.  
-  //Can be re-set from without with setter functions
-  //Already set in the OCDB and passed via setter in the AliEMCALReconstructor
-  fHighLowGainFactor = 16. ;   // Adjusted for a low gain range of 82 GeV (10 bits) 
-  fOrder             = 2;      // Order of gamma fn
-  fTau               = 2.35;   // in units of timebin, from CERN 2007 testbeam
-  fNoiseThreshold    = 3;      // 3 ADC counts is approx. noise level
-  fNPedSamples       = 4;      // Less than this value => likely pedestal samples
-  fRemoveBadChannels = kFALSE; // Do not remove bad channels before fitting
-  fUseFALTRO         = kTRUE;  // Get the trigger FALTRO information and pass it to digits.
+AliEMCALRawUtils::AliEMCALRawUtils( Algo::fitAlgorithm fitAlgo) : fNoiseThreshold(3),
+                                                                 fNPedSamples(4), 
+                                                                 fGeom(0), 
+                                                                 fOption(""),
+                                                                 fRemoveBadChannels(kFALSE),
+                                                                 fFittingAlgorithm(0),  
+                                                                 fTimeMin(-1.),
+                                                                 fTimeMax(1.),
+                                                                 fUseFALTRO(kTRUE),
+                                                                 fRawAnalyzer(0),
+                                                                 fTriggerRawDigitMaker(0x0)
+{
   SetFittingAlgorithm(fitAlgo);
+  // SetFittingAlgorithm(  Algo::kLMSOffline);
 
   //Get Mapping RCU files from the AliEMCALRecParam                                 
   const TObjArray* maps = AliEMCALRecParam::GetMappings();
@@ -130,112 +111,53 @@ AliEMCALRawUtils::AliEMCALRawUtils( Algo::fitAlgorithm fitAlgo)
 
 }
 
+
 //____________________________________________________________________________
-AliEMCALRawUtils::AliEMCALRawUtils(AliEMCALGeometry *pGeometry, Algo::fitAlgorithm fitAlgo)
-  : fHighLowGainFactor(0.), fOrder(0), fTau(0.), fNoiseThreshold(0),
-    fNPedSamples(0), fGeom(pGeometry), fOption(""),
-    fRemoveBadChannels(kTRUE),fFittingAlgorithm(0),
-    fTimeMin(-1.),fTimeMax(1.),
-    fUseFALTRO(kFALSE),fRawAnalyzer(),
-    fTriggerRawDigitMaker(0x0)
+AliEMCALRawUtils::AliEMCALRawUtils(AliEMCALGeometry *pGeometry, Algo::fitAlgorithm fitAlgo) : //fHighLowGainFactor(16.), 
+                                                                                             //fOrder(2), 
+  //  fTau(2.35), 
+  fNoiseThreshold(3),
+  fNPedSamples(4), 
+  fGeom(pGeometry), 
+  fOption(""),
+  fRemoveBadChannels(kFALSE),fFittingAlgorithm(0),
+  fTimeMin(-1.),fTimeMax(1.),
+  fUseFALTRO(kTRUE),fRawAnalyzer(0),
+  fTriggerRawDigitMaker(0x0)
 {
-  //
-  // Initialize with the given geometry - constructor required by HLT
+
+ // Initialize with the given geometry - constructor required by HLT
   // HLT does not use/support AliRunLoader(s) instances
   // This is a minimum intervention solution
   // Comment by MPloskon@lbl.gov
-  //
-
-  //These are default parameters. 
-  //Can be re-set from without with setter functions 
-  //Already set in the OCDB and passed via setter in the AliEMCALReconstructor
-  fHighLowGainFactor = 16. ;   // adjusted for a low gain range of 82 GeV (10 bits)
-  fOrder             = 2;      // order of gamma fn
-  fTau               = 2.35;   // in units of timebin, from CERN 2007 testbeam
-  fNoiseThreshold    = 3;      // 3 ADC counts is approx. noise level
-  fNPedSamples       = 4;      // Less than this value => likely pedestal samples
-  fRemoveBadChannels = kFALSE; // Do not remove bad channels before fitting
-  fUseFALTRO         = kTRUE;  // Get the trigger FALTRO information and pass it to digits.
   SetFittingAlgorithm(fitAlgo);
-
+  // SetFittingAlgorithm(  Algo::kLMSOffline);
   //Get Mapping RCU files from the AliEMCALRecParam
   const TObjArray* maps = AliEMCALRecParam::GetMappings();
   if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
-
-  for(Int_t i = 0; i < 4; i++) {
-    fMapping[i] = (AliAltroMapping*)maps->At(i);
-  }
+  
+  for(Int_t i = 0; i < 4; i++) 
+    {
+      fMapping[i] = (AliAltroMapping*)maps->At(i);
+    }
 
   if(!fGeom) AliFatal(Form("Could not get geometry!"));
-       
   fTriggerRawDigitMaker = new AliEMCALTriggerRawDigitMaker();  
 }
 
-//____________________________________________________________________________
-AliEMCALRawUtils::AliEMCALRawUtils(const AliEMCALRawUtils& rawU)
-  : TObject(),
-    fHighLowGainFactor(rawU.fHighLowGainFactor), 
-    fOrder(rawU.fOrder),
-    fTau(rawU.fTau),
-    fNoiseThreshold(rawU.fNoiseThreshold),
-    fNPedSamples(rawU.fNPedSamples),
-    fGeom(rawU.fGeom), 
-    fOption(rawU.fOption),
-    fRemoveBadChannels(rawU.fRemoveBadChannels),
-    fFittingAlgorithm(rawU.fFittingAlgorithm),
-    fTimeMin(rawU.fTimeMin),fTimeMax(rawU.fTimeMax),
-    fUseFALTRO(rawU.fUseFALTRO),
-    fRawAnalyzer(rawU.fRawAnalyzer),
-    fTriggerRawDigitMaker(rawU.fTriggerRawDigitMaker)
-{
-  //copy ctor
-  fMapping[0] = rawU.fMapping[0];
-  fMapping[1] = rawU.fMapping[1];
-  fMapping[2] = rawU.fMapping[2];
-  fMapping[3] = rawU.fMapping[3];
-}
 
 //____________________________________________________________________________
-AliEMCALRawUtils& AliEMCALRawUtils::operator =(const AliEMCALRawUtils &rawU)
+AliEMCALRawUtils::~AliEMCALRawUtils() 
 {
-  //assignment operator
-
-  if(this != &rawU) {
-    fHighLowGainFactor = rawU.fHighLowGainFactor;
-    fOrder             = rawU.fOrder;
-    fTau               = rawU.fTau;
-    fNoiseThreshold    = rawU.fNoiseThreshold;
-    fNPedSamples       = rawU.fNPedSamples;
-    fGeom              = rawU.fGeom;
-    fOption            = rawU.fOption;
-    fRemoveBadChannels = rawU.fRemoveBadChannels;
-    fFittingAlgorithm  = rawU.fFittingAlgorithm;
-    fTimeMin           = rawU.fTimeMin;
-    fTimeMax           = rawU.fTimeMax;
-    fUseFALTRO         = rawU.fUseFALTRO;
-    fRawAnalyzer       = rawU.fRawAnalyzer;
-    fMapping[0]        = rawU.fMapping[0];
-    fMapping[1]        = rawU.fMapping[1];
-    fMapping[2]        = rawU.fMapping[2];
-    fMapping[3]        = rawU.fMapping[3];
-    fTriggerRawDigitMaker = rawU.fTriggerRawDigitMaker;  
-  }
-
-  return *this;
-
-}
-
-//____________________________________________________________________________
-AliEMCALRawUtils::~AliEMCALRawUtils() {
   //dtor
-
 }
 
+
 //____________________________________________________________________________
 void AliEMCALRawUtils::Digits2Raw()
 {
   // convert digits of the current event to raw data
-  
   AliRunLoader *rl = AliRunLoader::Instance();
   AliEMCALLoader *loader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
   
@@ -254,32 +176,36 @@ void AliEMCALRawUtils::Digits2Raw()
   for (Int_t i=0; i < nDDL; i++)
     buffers[i] = 0;
   
-  TArrayI adcValuesLow(fgTimeBins);
-  TArrayI adcValuesHigh(fgTimeBins);
+  TArrayI adcValuesLow( TIMEBINS );
+  TArrayI adcValuesHigh( TIMEBINS );
   
   // loop over digits (assume ordered digits)
-  for (Int_t iDigit = 0; iDigit < digits->GetEntries(); iDigit++) {
-    AliEMCALDigit* digit = dynamic_cast<AliEMCALDigit *>(digits->At(iDigit)) ;
-    if(!digit){
-      AliFatal("NULL Digit");
-    }
-    else{
-      if (digit->GetAmplitude() < fgThreshold) 
-        continue;
-      
-      //get cell indices
-      Int_t nSM = 0;
-      Int_t nIphi = 0;
-      Int_t nIeta = 0;
-      Int_t iphi = 0;
-      Int_t ieta = 0;
-      Int_t nModule = 0;
-      fGeom->GetCellIndex(digit->GetId(), nSM, nModule, nIphi, nIeta);
-      fGeom->GetCellPhiEtaIndexInSModule(nSM, nModule, nIphi, nIeta,iphi, ieta) ;
+  for (Int_t iDigit = 0; iDigit < digits->GetEntries(); iDigit++) 
+    {
+      AliEMCALDigit* digit = dynamic_cast<AliEMCALDigit *>(digits->At(iDigit)) ;
+      if(!digit)
+       {
+         AliFatal("NULL Digit");
+       }
+      else
+       {
+         if (digit->GetAmplitude() < fgThreshold) 
+           {
+             continue;
+           }
+         //get cell indices
+         Int_t nSM = 0;
+         Int_t nIphi = 0;
+         Int_t nIeta = 0;
+         Int_t iphi = 0;
+         Int_t ieta = 0;
+         Int_t nModule = 0;
+         fGeom->GetCellIndex(digit->GetId(), nSM, nModule, nIphi, nIeta);
+         fGeom->GetCellPhiEtaIndexInSModule(nSM, nModule, nIphi, nIeta,iphi, ieta) ;
       
-      //Check which is the RCU, 0 or 1, of the cell.
-      Int_t iRCU = -111;
-      //RCU0
+         //Check which is the RCU, 0 or 1, of the cell.
+         Int_t iRCU = -111;
+         //RCU0
       if (0<=iphi&&iphi<8) iRCU=0; // first cable row
       else if (8<=iphi&&iphi<16 && 0<=ieta&&ieta<24) iRCU=0; // first half; 
       //second cable row
@@ -294,7 +220,7 @@ void AliEMCALRawUtils::Digits2Raw()
         Fatal("Digits2Raw()","Non-existent RCU number: %d", iRCU);
       
       //Which DDL?
-      Int_t iDDL = fgDDLPerSuperModule* nSM + iRCU;
+      Int_t iDDL = NRCUSPERMODULE*nSM + iRCU;
       if (iDDL < 0 || iDDL >= nDDL){
         Fatal("Digits2Raw()","Non-existent DDL board number: %d", iDDL);
       }
@@ -314,19 +240,19 @@ void AliEMCALRawUtils::Digits2Raw()
         }
         
         // out of time range signal (?)
-        if (digit->GetTimeR() > GetRawFormatTimeMax() ) {
+        if (digit->GetTimeR() >  TIMEBINMAX  ) {
           AliInfo("Signal is out of time range.\n");
           buffers[iDDL]->FillBuffer((Int_t)digit->GetAmplitude());
-          buffers[iDDL]->FillBuffer(GetRawFormatTimeBins() );  // time bin
+          buffers[iDDL]->FillBuffer( TIMEBINS );  // time bin
           buffers[iDDL]->FillBuffer(3);          // bunch length      
           buffers[iDDL]->WriteTrailer(3, ieta, iphi, nSM);  // trailer
           // calculate the time response function
         } else {
           Bool_t lowgain = RawSampledResponse(digit->GetTimeR(), digit->GetAmplitude(), adcValuesHigh.GetArray(), adcValuesLow.GetArray()) ; 
           if (lowgain) 
-            buffers[iDDL]->WriteChannel(ieta, iphi, 0, GetRawFormatTimeBins(), adcValuesLow.GetArray(), fgThreshold);
+            buffers[iDDL]->WriteChannel(ieta, iphi, 0, TIMEBINS, adcValuesLow.GetArray(), fgThreshold);
           else 
-            buffers[iDDL]->WriteChannel(ieta,iphi, 1, GetRawFormatTimeBins(), adcValuesHigh.GetArray(), fgThreshold);
+            buffers[iDDL]->WriteChannel(ieta,iphi, 1, TIMEBINS, adcValuesHigh.GetArray(), fgThreshold);
         }
       }// iDDL under the limits
     }//digit exists
@@ -344,252 +270,138 @@ void AliEMCALRawUtils::Digits2Raw()
   loader->UnloadDigits();
 }
 
+
+//____________________________________________________________________________ 
+void AliEMCALRawUtils::AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Float_t amp, Float_t time, Float_t chi2, Int_t ndf) 
+{
+  AliEMCALDigit *digit = 0, *tmpdigit = 0;
+  TIter nextdigit(digitsArr);
+  while (digit == 0 && (tmpdigit = (AliEMCALDigit*) nextdigit())) 
+    {
+      if (tmpdigit->GetId() == id) digit = tmpdigit;
+    }
+  
+  if (!digit) { // no digit existed for this tower; create one
+    Int_t type = AliEMCALDigit::kHG; // use enum in AliEMCALDigit
+    if (lowGain) 
+      { 
+       amp *= HGLGFACTOR;
+       type = AliEMCALDigit::kLGnoHG;
+      } 
+    
+    Int_t idigit = digitsArr->GetEntries();
+    new((*digitsArr)[idigit]) AliEMCALDigit( -1, -1, id, amp, time, type, idigit, chi2, ndf); 
+    AliDebug(2,Form("Add digit Id %d for the first time, type %d", id, type));
+  }//digit added first time
+  else 
+    { // a digit already exists, check range 
+               // (use high gain if signal < cut value, otherwise low gain)
+      if (lowGain) 
+       { // new digit is low gain
+         if (digit->GetAmplitude() >  OVERFLOWCUT ) 
+           {  // use if previously stored (HG) digit is out of range
+             digit->SetAmplitude( HGLGFACTOR * amp);
+             digit->SetTime(time);
+             digit->SetType(AliEMCALDigit::kLG);
+             AliDebug(2,Form("Add LG digit ID %d for the second time, type %d", digit->GetId(), digit->GetType()));
+           }
+       }//new low gain digit
+      else { // new digit is high gain 
+       
+       if (amp <  OVERFLOWCUT  ) 
+         { // new digit is high gain; use if not out of range
+           digit->SetAmplitude(amp);
+           digit->SetTime(time);
+           digit->SetType(AliEMCALDigit::kHG);
+           AliDebug(2,Form("Add HG digit ID %d for the second time, type %d", digit->GetId(), digit->GetType()));
+         }
+       else 
+         { // HG out of range, just change flag value to show that HG did exist
+           digit->SetType(AliEMCALDigit::kLG);
+           AliDebug(2,Form("Change LG digit to HG, ID %d, type %d", digit->GetId(), digit->GetType()));
+         }
+      }//new high gain digit
+    }//digit existed replace it
+}
+
+
 //____________________________________________________________________________
 void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr, const AliCaloCalibPedestal* pedbadmap, TClonesArray *digitsTRG, AliEMCALTriggerData* trgData)
 {
-  // convert raw data of the current event to digits                                                                                     
-  
+
   if(digitsArr) digitsArr->Clear("C"); 
-  
-  if (!digitsArr) {
-    Error("Raw2Digits", "no digits found !");
-    return;
-  }
-  if (!reader) {
-    Error("Raw2Digits", "no raw reader found !");
-    return;
-  }
-       
+  if (!digitsArr) { Error("Raw2Digits", "no digits found !");return;}
+  if (!reader) {Error("Raw2Digits", "no raw reader found !");return;}
   AliEMCALTriggerSTURawStream inSTU(reader);
-       
   AliCaloRawStreamV3 in(reader,"EMCAL",fMapping);      
-       
-  // Select EMCAL DDL's;
   reader->Select("EMCAL",0,43); // 43 = AliEMCALGeoParams::fgkLastAltroDDL
-  
   fTriggerRawDigitMaker->Reset();      
   fTriggerRawDigitMaker->SetIO(reader, in, inSTU, digitsTRG, trgData);
-       
-  // fRawAnalyzer setup
-  fRawAnalyzer->SetNsampleCut(5); // requirement for fits to be done, for the new methods
-  fRawAnalyzer->SetOverflowCut(fgkOverflowCut);
-  fRawAnalyzer->SetAmpCut(fNoiseThreshold);
-  fRawAnalyzer->SetFitArrayCut(fNoiseThreshold);
   fRawAnalyzer->SetIsZeroSuppressed(true); // TMP - should use stream->IsZeroSuppressed(), or altro cfg registers later
-  
-  // channel info parameters
+    
   Int_t lowGain  = 0;
   Int_t caloFlag = 0; // low, high gain, or TRU, or LED ref.
   
-  // start loop over input stream 
-  while (in.NextDDL()) {
-         
-    //    if ( in.GetDDLNumber() != 0 && in.GetDDLNumber() != 2 ) continue;
-    
-    while (in.NextChannel()) {
-      
-      //Check if the signal  is high or low gain and then do the fit, 
-      //if it  is from TRU or LEDMon do not fit
-      caloFlag = in.GetCaloFlag();
-      //               if (caloFlag != 0 && caloFlag != 1) continue; 
-      if (caloFlag > 2) continue; // Work with ALTRO and FALTRO 
-      
-      //Do not fit bad channels of ALTRO
-      if(caloFlag < 2 && fRemoveBadChannels && pedbadmap->IsBadChannel(in.GetModule(),in.GetColumn(),in.GetRow())) {
-        //printf("Tower from SM %d, column %d, row %d is BAD!!! Skip \n", in.GetModule(),in.GetColumn(),in.GetRow());
-        continue;
-      }  
-      
-      vector<AliCaloBunchInfo> bunchlist; 
-      while (in.NextBunch()) {
-        bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) );
-      } // loop over bunches
-      if (bunchlist.size() == 0) continue;
-      if ( caloFlag < 2 )
-       { // ALTRO
-         Float_t time = 0; 
-         Float_t amp  = 0; 
-         short timeEstimate  = 0;
-         Float_t ampEstimate = 0;
-         Bool_t fitDone = kFALSE;
-         Float_t chi2 = 0;
-         Int_t ndf = 0;
-
-         if ( fFittingAlgorithm == Algo::kFastFit || fFittingAlgorithm == Algo::kNeuralNet || 
-              fFittingAlgorithm == Algo::kLMS || fFittingAlgorithm == Algo::kPeakFinder || 
-              fFittingAlgorithm == Algo::kCrude) {
-          // all functionality to determine amp and time etc is encapsulated inside the Evaluate call for these methods 
-          AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2()); 
-          
-          amp          = fitResults.GetAmp();
-          time         = fitResults.GetTime();
-          timeEstimate = fitResults.GetMaxTimebin();
-          ampEstimate  = fitResults.GetMaxSig();
-          chi2 = fitResults.GetChi2();
-          ndf = fitResults.GetNdf();
-          if (fitResults.GetStatus() == Ret::kFitPar) {
-            fitDone = kTRUE;
-          }
-        }
-        else { // for the other methods we for now use the functionality of 
-          // AliCaloRawAnalyzer as well, to select samples and prepare for fits, 
-          // if it looks like there is something to fit
-          
-          // parameters init.
-          Float_t pedEstimate  = 0;
-          short maxADC = 0;
-          Int_t first = 0;
-          Int_t last = 0;
-          Int_t bunchIndex = 0;
-          //
-          // The PreFitEvaluateSamples + later call to FitRaw will hopefully 
-          // be replaced by a single Evaluate call or so soon, like for the other
-          // methods, but this should be good enough for evaluation of 
-          // the methods for now (Jan. 2010)
-          //
-          int nsamples = fRawAnalyzer->PreFitEvaluateSamples( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2(), bunchIndex, ampEstimate, maxADC, timeEstimate, pedEstimate, first, last); 
-          
-          if (ampEstimate >= fNoiseThreshold) { // something worth looking at
-            
-            time = timeEstimate; // maxrev in AliCaloRawAnalyzer speak; comes with an offset w.r.t. real timebin
-            Int_t timebinOffset = bunchlist.at(bunchIndex).GetStartBin() - (bunchlist.at(bunchIndex).GetLength()-1); 
-            amp = ampEstimate; 
-            
-            if ( nsamples > 1 && maxADC<fgkOverflowCut ) { // possibly something to fit
-              FitRaw(first, last, amp, time, chi2, fitDone);
-              time += timebinOffset;
-              timeEstimate += timebinOffset;
-              ndf = nsamples - 2;
-            }
-            
-          } // ampEstimate check
-        } // method selection
-
-        if ( fitDone ) { // brief sanity check of fit results      
-          Float_t ampAsymm = (amp - ampEstimate)/(amp + ampEstimate);
-          Float_t timeDiff = time - timeEstimate;
-          if ( (TMath::Abs(ampAsymm) > 0.1) || (TMath::Abs(timeDiff) > 2) ) {
-            // AliDebug(2,Form("Fit results amp %f time %f not consistent with expectations amp %f time %d", amp, time, ampEstimate, timeEstimate));
-            
-            // for now just overwrite the fit results with the simple/initial estimate
-            amp     = ampEstimate;
-            time    = timeEstimate; 
-            fitDone = kFALSE;
-          } 
-        } // fitDone
-        
-        if (amp >= fNoiseThreshold) { // something to be stored
-          if ( ! fitDone) { // smear ADC with +- 0.5 uniform (avoid discrete effects)
-            amp += (0.5 - gRandom->Rndm()); // Rndm generates a number in ]0,1]
-          }
-          
-          Int_t id = fGeom->GetAbsCellIdFromCellIndexes(in.GetModule(), in.GetRow(), in.GetColumn()) ;
-          lowGain  = in.IsLowGain();
-          
-          // go from time-bin units to physical time fgtimetrigger
-          time = time * GetRawFormatTimeBinWidth(); // skip subtraction of fgTimeTrigger?
-          // subtract RCU L1 phase (L1Phase is in seconds) w.r.t. L0:
-          time -= in.GetL1Phase();
-          
-          AliDebug(2,Form("id %d lowGain %d amp %g", id, lowGain, amp));
-          // printf("Added tower: SM %d, row %d, column %d, amp %3.2f\n",in.GetModule(), in.GetRow(), in.GetColumn(),amp);
-
-          AddDigit(digitsArr, id, lowGain, amp, time, chi2, ndf); 
-        }
-        
-      }//ALTRO
-      else if(fUseFALTRO)
-      {// Fake ALTRO
-        fTriggerRawDigitMaker->Add( bunchlist );
-      }//Fake ALTRO
-    } // end while over channel   
-  } //end while over DDL's, of input stream 
-  
+  while (in.NextDDL()) 
+    {
+      //  fprintf(fp," TP1\n");
+      while (in.NextChannel()) 
+       {
+         //      fprintf(fp," TP2\n");
+         caloFlag = in.GetCaloFlag();
+         if (caloFlag > 2) continue; // Work with ALTRO and FALTRO 
+         if(caloFlag < 2 && fRemoveBadChannels && pedbadmap->IsBadChannel(in.GetModule(),in.GetColumn(),in.GetRow()))
+           {
+             continue;
+           }  
+         vector<AliCaloBunchInfo> bunchlist; 
+         while (in.NextBunch()) 
+           {
+             bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) );
+           } 
+         if (bunchlist.size() == 0) continue;
+         if ( caloFlag < 2 )
+           { // ALTRO
+             Int_t id = fGeom->GetAbsCellIdFromCellIndexes(in.GetModule(), in.GetRow(), in.GetColumn()) ;
+             lowGain  = in.IsLowGain();
+             fRawAnalyzer->SetL1Phase( in.GetL1Phase() );
+             AliCaloFitResults res =  fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());  
+             if(res.GetAmp() >= fNoiseThreshold )
+               {
+                 AddDigit(digitsArr, id, lowGain, res.GetAmp(),  res.GetTime(), res.GetChi2(),  res.GetNdf() ); 
+               }
+           }//ALTRO
+         else if(fUseFALTRO)
+           {// Fake ALTRO
+             fTriggerRawDigitMaker->Add( bunchlist );
+           }//Fake ALTRO
+       } // end while over channel   
+    } //end while over DDL's, of input stream 
   fTriggerRawDigitMaker->PostProcess();        
-       
   TrimDigits(digitsArr);
-       
-  return ; 
 }
 
-//____________________________________________________________________________ 
-void AliEMCALRawUtils::AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Float_t amp, Float_t time, Float_t chi2, Int_t ndf) {
-  //
-  // 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
-  
-  AliEMCALDigit *digit = 0, *tmpdigit = 0;
-  TIter nextdigit(digitsArr);
-  while (digit == 0 && (tmpdigit = (AliEMCALDigit*) nextdigit())) {
-    if (tmpdigit->GetId() == id) digit = tmpdigit;
-  }
-
-  if (!digit) { // no digit existed for this tower; create one
-               Int_t type = AliEMCALDigit::kHG; // use enum in AliEMCALDigit
-               if (lowGain) { 
-                       amp *= fHighLowGainFactor;
-                       type = AliEMCALDigit::kLGnoHG;
-               } 
-               Int_t idigit = digitsArr->GetEntries();
-               new((*digitsArr)[idigit]) AliEMCALDigit( -1, -1, id, amp, time, type, idigit, chi2, ndf); 
-               AliDebug(2,Form("Add digit Id %d for the first time, type %d", id, type));
-  }//digit added first time
-  else { // a digit already exists, check range 
-               // (use high gain if signal < cut value, otherwise low gain)
-               if (lowGain) { // new digit is low gain
-                       if (digit->GetAmplitude() > fgkOverflowCut) {  // use if previously stored (HG) digit is out of range
-                               digit->SetAmplitude(fHighLowGainFactor * amp);
-                               digit->SetTime(time);
-                               digit->SetType(AliEMCALDigit::kLG);
-                               AliDebug(2,Form("Add LG digit ID %d for the second time, type %d", digit->GetId(), digit->GetType()));
-                       }
-               }//new low gain digit
-               else { // new digit is high gain 
-                       if (amp < fgkOverflowCut) { // new digit is high gain; use if not out of range
-                               digit->SetAmplitude(amp);
-                               digit->SetTime(time);
-                               digit->SetType(AliEMCALDigit::kHG);
-                               AliDebug(2,Form("Add HG digit ID %d for the second time, type %d", digit->GetId(), digit->GetType()));
-                       }
-                       else { // HG out of range, just change flag value to show that HG did exist
-                               digit->SetType(AliEMCALDigit::kLG);
-                               AliDebug(2,Form("Change LG digit to HG, ID %d, type %d", digit->GetId(), digit->GetType()));
-                       }
-               }//new high gain digit
-  }//digit existed replace it
-  
-}
 
-//____________________________________________________________________________ 
 void AliEMCALRawUtils::TrimDigits(TClonesArray *digitsArr) 
 {
-  // Remove digits with only low gain and large time
-  
   AliEMCALDigit *digit = 0;
   Int_t n = 0;
   Int_t nDigits = digitsArr->GetEntriesFast();
   TIter nextdigit(digitsArr);
   while ((digit = (AliEMCALDigit*) nextdigit())) {
-
-    //Check if only LG existed, remove if so
     if (digit->GetType() == AliEMCALDigit::kLGnoHG) {
-      AliDebug(10,Form("Remove digit with id %d, LGnoHG",digit->GetId()));
+      AliDebug(1,Form("Remove digit with id %d, LGnoHG",digit->GetId()));
       digitsArr->Remove(digit);
     }
-    //Check if time is too large or too small, remove if so
     else if(fTimeMin > digit->GetTime() || fTimeMax < digit->GetTime()) {
       digitsArr->Remove(digit);
-      AliDebug(10,Form("Remove digit with id %d, Bad Time %e",digit->GetId(), digit->GetTime()));
+      AliDebug(1,Form("Remove digit with id %d, Bad Time %e",digit->GetId(), digit->GetTime()));
     }
-    // Check if Chi2 is undefined
     else if (0 > digit->GetChi2()) {
       digitsArr->Remove(digit);
-      AliDebug(10,Form("Remove digit with id %d, Bad Chi2 %e",digit->GetId(), digit->GetChi2()));
+      AliDebug(1,Form("Remove digit with id %d, Bad Chi2 %e",digit->GetId(), digit->GetChi2()));
     }
-    //Good digit, just reassign the index of the digit in case there was a previous removal
     else {
       digit->SetIndexInList(n);        
       n++;
@@ -598,368 +410,93 @@ void AliEMCALRawUtils::TrimDigits(TClonesArray *digitsArr)
   
   digitsArr->Compress();
   AliDebug(1,Form("N Digits before trimming : %d; after array compression %d",nDigits,digitsArr->GetEntriesFast()));
-          
-}
-       
-//____________________________________________________________________________ 
-void AliEMCALRawUtils::FitRaw(const Int_t firstTimeBin, const Int_t lastTimeBin, Float_t & amp, Float_t & time, Float_t & chi2, Bool_t & fitDone) const 
-{ // Fits the raw signal time distribution
-  
-  //--------------------------------------------------
-  //Do the fit, different fitting algorithms available
-  //--------------------------------------------------
-  int nsamples = lastTimeBin - firstTimeBin + 1;
-  fitDone = kFALSE;
-  
-  switch(fFittingAlgorithm) {
-  case Algo::kStandard:
-    {
-      if (nsamples < 3) { return; } // nothing much to fit
-      //printf("Standard fitter \n");
-
-      // Create Graph to hold data we will fit 
-      TGraph *gSig =  new TGraph( nsamples); 
-      for (int i=0; i<nsamples; i++) {
-        Int_t timebin = firstTimeBin + i;    
-        gSig->SetPoint(i, timebin, fRawAnalyzer->GetReversed(timebin)); 
-      }
-      
-      TF1 * signalF = new TF1("signal", RawResponseFunction, 0, GetRawFormatTimeBins(), 5);
-      signalF->SetParameters(10.,5.,fTau,fOrder,0.); //set all defaults once, just to be safe
-      signalF->SetParNames("amp","t0","tau","N","ped");
-      signalF->FixParameter(2,fTau); // tau in units of time bin
-      signalF->FixParameter(3,fOrder); // order
-      signalF->FixParameter(4, 0); // pedestal should be subtracted when we get here 
-      signalF->SetParameter(1, time);
-      signalF->SetParameter(0, amp);
-      // set rather loose parameter limits
-      signalF->SetParLimits(0, 0.5*amp, 2*amp );
-      signalF->SetParLimits(1, time - 4, time + 4); 
-      
-      try {                    
-        gSig->Fit(signalF, "QROW"); // Note option 'W': equal errors on all points
-        // assign fit results
-        amp  = signalF->GetParameter(0); 
-        time = signalF->GetParameter(1);
-        chi2 = signalF->GetChisquare();
-        fitDone = kTRUE;
-      }
-      catch (const std::exception & e) {
-        AliError( Form("TGraph Fit exception %s", e.what()) ); 
-        // stay with default amp and time in case of exception, i.e. no special action required
-        fitDone = kFALSE;
-      }
-      delete signalF;
-      
-      //printf("Std   : Amp %f, time %g\n",amp, time);
-      delete gSig; // delete TGraph
-      
-      break;
-    }//kStandard Fitter
-      //----------------------------
-  case Algo::kLogFit:
-    {
-      if (nsamples < 3) { return; } // nothing much to fit
-      //printf("LogFit \n");
-      
-      // Create Graph to hold data we will fit 
-      TGraph *gSigLog =  new TGraph( nsamples); 
-      for (int i=0; i<nsamples; i++) {
-        Int_t timebin = firstTimeBin + i;    
-        gSigLog->SetPoint(timebin, timebin, TMath::Log(fRawAnalyzer->GetReversed(timebin) ) ); 
-      }
-      
-      TF1 * signalFLog = new TF1("signalLog", RawResponseFunctionLog, 0, GetRawFormatTimeBins(), 5);
-      signalFLog->SetParameters(2.3, 5.,fTau,fOrder,0.); //set all defaults once, just to be safe
-      signalFLog->SetParNames("amplog","t0","tau","N","ped");
-      signalFLog->FixParameter(2,fTau); // tau in units of time bin
-      signalFLog->FixParameter(3,fOrder); // order
-      signalFLog->FixParameter(4, 0); // pedestal should be subtracted when we get here 
-      signalFLog->SetParameter(1, time);
-      if (amp>=1) {
-        signalFLog->SetParameter(0, TMath::Log(amp));
-      }
-      
-      gSigLog->Fit(signalFLog, "QROW"); // Note option 'W': equal errors on all points
-      
-      // assign fit results
-      Double_t amplog = signalFLog->GetParameter(0); //Not Amp, but Log of Amp
-      amp = TMath::Exp(amplog);
-      time = signalFLog->GetParameter(1);
-      fitDone = kTRUE;
-      
-      delete signalFLog;
-      //printf("LogFit: Amp %f, time %g\n",amp, time);
-      delete gSigLog; 
-      break;
-    } //kLogFit 
-      //----------------------------   
-      
-      //----------------------------
-  }//switch fitting algorithms
-  
-  return;
 }
 
-//__________________________________________________________________
-void AliEMCALRawUtils::FitParabola(const TGraph *gSig, Float_t & amp) const 
-{
-  //BEG YS alternative methods to calculate the amplitude
-  Double_t * ymx = gSig->GetX() ; 
-  Double_t * ymy = gSig->GetY() ; 
-  const Int_t kN = 3 ; 
-  Double_t ymMaxX[kN] = {0., 0., 0.} ; 
-  Double_t ymMaxY[kN] = {0., 0., 0.} ; 
-  Double_t ymax = 0. ; 
-  // find the maximum amplitude
-  Int_t ymiMax = 0 ;  
-  for (Int_t ymi = 0; ymi < gSig->GetN(); ymi++) {
-    if (ymy[ymi] > ymMaxY[0] ) {
-      ymMaxY[0] = ymy[ymi] ; //<========== This is the maximum amplitude
-      ymMaxX[0] = ymx[ymi] ;
-      ymiMax = ymi ; 
-    }
-  }
-  // find the maximum by fitting a parabola through the max and the two adjacent samples
-  if ( ymiMax < gSig->GetN()-1 && ymiMax > 0) {
-    ymMaxY[1] = ymy[ymiMax+1] ;
-    ymMaxY[2] = ymy[ymiMax-1] ; 
-    ymMaxX[1] = ymx[ymiMax+1] ;
-    ymMaxX[2] = ymx[ymiMax-1] ; 
-    if (ymMaxY[0]*ymMaxY[1]*ymMaxY[2] > 0) {
-      //fit a parabola through the 3 points y= a+bx+x*x*x
-      Double_t sy = 0 ; 
-      Double_t sx = 0 ; 
-      Double_t sx2 = 0 ; 
-      Double_t sx3 = 0 ; 
-      Double_t sx4 = 0 ; 
-      Double_t sxy = 0 ; 
-      Double_t sx2y = 0 ; 
-      for (Int_t i = 0; i < kN ; i++) {
-        sy += ymMaxY[i] ; 
-        sx += ymMaxX[i] ;              
-        sx2 += ymMaxX[i]*ymMaxX[i] ; 
-        sx3 += ymMaxX[i]*ymMaxX[i]*ymMaxX[i] ; 
-        sx4 += ymMaxX[i]*ymMaxX[i]*ymMaxX[i]*ymMaxX[i] ; 
-        sxy += ymMaxX[i]*ymMaxY[i] ; 
-        sx2y += ymMaxX[i]*ymMaxX[i]*ymMaxY[i] ; 
-      }
-      Double_t cN = (sx2y*kN-sy*sx2)*(sx3*sx-sx2*sx2)-(sx2y*sx-sxy*sx2)*(sx3*kN-sx*sx2); 
-      Double_t cD = (sx4*kN-sx2*sx2)*(sx3*sx-sx2*sx2)-(sx4*sx-sx3*sx2)*(sx3*kN-sx*sx2) ;
-      Double_t c  = cN / cD ; 
-      Double_t b  = ((sx2y*kN-sy*sx2)-c*(sx4*kN-sx2*sx2))/(sx3*kN-sx*sx2) ;
-      Double_t a  = (sy-b*sx-c*sx2)/kN  ;
-      Double_t xmax = -b/(2*c) ; 
-      ymax = a + b*xmax + c*xmax*xmax ;//<========== This is the maximum amplitude
-      amp = ymax;
-    }
-  }
-  
-  Double_t diff = TMath::Abs(1-ymMaxY[0]/amp) ; 
-  if (diff > 0.1) 
-    amp = ymMaxY[0] ; 
-  //printf("Yves   : Amp %f, time %g\n",amp, time);
-  //END YS
-  return;
-}
 
-//__________________________________________________________________
-Double_t AliEMCALRawUtils::RawResponseFunction(Double_t *x, Double_t *par)
+Double_t 
+AliEMCALRawUtils::RawResponseFunction(Double_t *x, Double_t *par)
 {
-  // Matches version used in 2007 beam test
-  //
-  // Shape of the electronics raw reponse:
-  // It is a semi-gaussian, 2nd order Gamma function of the general form
-  //
-  // xx = (t - t0 + tau) / tau  [xx is just a convenient help variable]
-  // F = A * (xx**N * exp( N * ( 1 - xx) )   for xx >= 0
-  // F = 0                                   for xx < 0 
-  //
-  // parameters:
-  // A:   par[0]   // Amplitude = peak value
-  // t0:  par[1]
-  // tau: par[2]
-  // N:   par[3]
-  // ped: par[4]
-  //
   Double_t signal = 0.;
   Double_t tau    = par[2];
   Double_t n      = par[3];
   Double_t ped    = par[4];
   Double_t xx     = ( x[0] - par[1] + tau ) / tau ;
-
   if (xx <= 0) 
     signal = ped ;  
-  else {  
-    signal = ped + par[0] * TMath::Power(xx , n) * TMath::Exp(n * (1 - xx )) ; 
-  }
+  else 
+    {  
+      signal = ped + par[0] * TMath::Power(xx , n) * TMath::Exp(n * (1 - xx )) ; 
+    }
   return signal ;  
 }
 
-//__________________________________________________________________
-Double_t AliEMCALRawUtils::RawResponseFunctionLog(Double_t *x, Double_t *par)
-{
-  // Matches version used in 2007 beam test
-  //
-  // Shape of the electronics raw reponse:
-  // It is a semi-gaussian, 2nd order Gamma function of the general form
-  //
-  // xx = (t - t0 + tau) / tau  [xx is just a convenient help variable]
-  // F = A * (xx**N * exp( N * ( 1 - xx) )   for xx >= 0
-  // F = 0                                   for xx < 0 
-  //
-  // parameters:
-  // Log[A]:   par[0]   // Amplitude = peak value
-  // t0:  par[1]
-  // tau: par[2]
-  // N:   par[3]
-  // ped: par[4]
-  //
-  Double_t signal = 0. ;
-  Double_t tau    = par[2];
-  Double_t n      = par[3];
-  //Double_t ped = par[4]; // not used
-  Double_t xx     = ( x[0] - par[1] + tau ) / tau ;
 
-  if (xx < 0) 
-    signal = par[0] - n*TMath::Log(TMath::Abs(xx)) + n * (1 - xx ) ;  
-  else {  
-    signal = par[0] + n*TMath::Log(xx) + n * (1 - xx ) ; 
-  }
-  return signal ;  
-}
-
-//__________________________________________________________________
-Bool_t AliEMCALRawUtils::RawSampledResponse(const Double_t dtime, const Double_t damp, Int_t * adcH, Int_t * adcL, const Int_t keyErr) const 
+Bool_t AliEMCALRawUtils::RawSampledResponse(const Double_t dtime, const Double_t damp, Int_t * adcH, 
+                                           Int_t * adcL, const Int_t keyErr) const 
 {
-  // for a start time dtime and an amplitude damp given by digit, 
-  // calculates the raw sampled response AliEMCAL::RawResponseFunction
   Bool_t lowGain = kFALSE ; 
-  
-  // A:   par[0]   // Amplitude = peak value
-  // t0:  par[1]                            
-  // tau: par[2]                            
-  // N:   par[3]                            
-  // ped: par[4]
-  
-  TF1 signalF("signal", RawResponseFunction, 0, GetRawFormatTimeBins(), 5);
+  TF1 signalF("signal", RawResponseFunction, 0, TIMEBINS, 5);
   signalF.SetParameter(0, damp) ; 
-  signalF.SetParameter(1, (dtime + fgTimeTrigger)/fgTimeBinWidth) ; 
-  signalF.SetParameter(2, fTau) ; 
-  signalF.SetParameter(3, fOrder);
+  signalF.SetParameter(1, (dtime + fgTimeTrigger)/ TIMEBINWITH) ; 
+  signalF.SetParameter(2, TAU) ; 
+  signalF.SetParameter(3, ORDER);
   signalF.SetParameter(4, fgPedestalValue);
        
   Double_t signal=0.0, noise=0.0;
-  for (Int_t iTime = 0; iTime < GetRawFormatTimeBins(); iTime++) {
+  for (Int_t iTime = 0; iTime <  TIMEBINS; iTime++) {
     signal = signalF.Eval(iTime) ;  
-    // Next lines commeted for the moment but in principle it is not necessary to add
-    // extra noise since noise already added at the digits level.      
-    
-    //According to Terry Awes, 13-Apr-2008
-    //add gaussian noise in quadrature to each sample
-    //Double_t noise = gRandom->Gaus(0.,fgFEENoise);
-    //signal = sqrt(signal*signal + noise*noise);
     
-    // March 17,09 for fast fit simulations by Alexei Pavlinov.
-    // Get from PHOS analysis. In some sense it is open questions.
     if(keyErr>0) {
       noise = gRandom->Gaus(0.,fgFEENoise);
       signal += noise; 
     }
          
     adcH[iTime] =  static_cast<Int_t>(signal + 0.5) ;
-    if ( adcH[iTime] > fgkRawSignalOverflow ){  // larger than 10 bits 
-      adcH[iTime] = fgkRawSignalOverflow ;
+    if ( adcH[iTime] > MAXBINVALUE ){  // larger than 10 bits 
+      adcH[iTime] = MAXBINVALUE ;
       lowGain = kTRUE ; 
     }
-    
-    signal /= fHighLowGainFactor;
-    
+    signal /= HGLGFACTOR;
     adcL[iTime] =  static_cast<Int_t>(signal + 0.5) ;
-    if ( adcL[iTime] > fgkRawSignalOverflow)  // larger than 10 bits 
-      adcL[iTime] = fgkRawSignalOverflow ;
-        
+    if ( adcL[iTime] > MAXBINVALUE )  // larger than 10 bits 
+      adcL[iTime] = MAXBINVALUE ;
   }
-  
   return lowGain ; 
 }
 
+
 //__________________________________________________________________
-void AliEMCALRawUtils::CalculateChi2(const Double_t* t, const Double_t* y, const Int_t nPoints, 
-const Double_t sig, const Double_t tau, const Double_t amp, const Double_t t0, Double_t &chi2)
+Double_t AliEMCALRawUtils::RawResponseFunctionLog(Double_t *x, Double_t *par)
 {
-  //   Input:
-  //   t[]   - array of time bins
-  //   y[]   - array of amplitudes after pedestal subtractions;
-  //   nPoints  - number of points 
-  //   sig   - error of amplitude measurement (one value for all channels)
-  //           if sig<0 that mean sig=1.
-  //   tau   - filter time response (in timebin units)
-  //   amp   - amplitude at t0;
-  //   t0    - time of max amplitude; 
-  // Output:
-  //   chi2 - chi2
-  //   ndf = nPoints - 2 when tau fixed 
-  //   ndf = nPoints - 3 when tau free
-  static Double_t par[5]={0.0, 0.0, 0.0, 2.0, 0.0};
-
-  par[0] = amp;
-  par[1] = t0;
-  par[2] = tau;
-  // par[3]=n=2.; par[4]=ped=0.0
-
-  Double_t dy = 0.0, x = 0.0, f=0.0;
-  for(Int_t i=0; i<nPoints; i++){
-    x     = t[i];
-    f     = RawResponseFunction(&x, par);
-    dy    = y[i] - f;
-    chi2 += dy*dy;
-    //printf(" AliEMCALRawUtils::CalculateChi2 : %i : y %f -> f %f : dy %f \n", i, y[i], f, dy); 
-  }
-  if(sig>0.0) chi2 /= (sig*sig);
+  Double_t signal = 0. ;
+  Double_t tau    = par[2];
+  Double_t n      = par[3];
+  Double_t xx     = ( x[0] - par[1] + tau ) / tau ;
+
+  if (xx < 0)
+    { 
+      signal = par[0] - n*TMath::Log(TMath::Abs(xx)) + n * (1 - xx ) ;  
+    }
+  else 
+    {  
+      signal = par[0] + n*TMath::Log(xx) + n * (1 - xx ) ; 
+    }
+  return signal ;  
 }
 
+
+
 //__________________________________________________________________
 void AliEMCALRawUtils::SetFittingAlgorithm(Int_t fitAlgo)              
 {
-       //Set fitting algorithm and initialize it if this same algorithm was not set before.
-       //printf("**** Set Algorithm , number %d ****\n",fitAlgo);
-
-       if(fitAlgo == fFittingAlgorithm && fRawAnalyzer) {
-               //Do nothing, this same algorithm already set before.
-               //printf("**** Algorithm already set before, number %d, %s ****\n",fitAlgo, fRawAnalyzer->GetName());
-               return;
-       }
-       //Initialize the requested algorithm
-  AliDebug(1,Form("Fitting algorithm : %d\n", fFittingAlgorithm));
-
-       if(fitAlgo != fFittingAlgorithm || !fRawAnalyzer) {
-               //printf("**** Init Algorithm , number %d ****\n",fitAlgo);
-               
-               fFittingAlgorithm = fitAlgo; 
-               if (fRawAnalyzer) delete fRawAnalyzer;  // delete prev. analyzer if existed.
-               
-               if (fitAlgo == Algo::kFastFit) {
-                       fRawAnalyzer = new AliCaloRawAnalyzerFastFit();
-               }
-               else if (fitAlgo == Algo::kNeuralNet) {
-                       fRawAnalyzer = new AliCaloRawAnalyzerNN();
-               }
-               else if (fitAlgo == Algo::kLMS) {
-                       fRawAnalyzer = new AliCaloRawAnalyzerLMS();
-               }
-               else if (fitAlgo == Algo::kPeakFinder) {
-                       fRawAnalyzer = new AliCaloRawAnalyzerPeakFinder();
-               }
-               else if (fitAlgo == Algo::kCrude) {
-                       fRawAnalyzer = new AliCaloRawAnalyzerCrude();
-               }
-               else {
-                 fRawAnalyzer = new AliCaloRawAnalyzer();
-                 //fRawAnalyzer = 0;
-               }
-       }
-       
+  // fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer(  Algo::kStandard );
+  fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer( fitAlgo );
+  fRawAnalyzer->SetNsampleCut(5); // requirement for fits to be done, for the new methods
+  fRawAnalyzer->SetOverflowCut ( OVERFLOWCUT );
+  fRawAnalyzer->SetAmpCut(fNoiseThreshold);
+  fRawAnalyzer->SetFitArrayCut(fNoiseThreshold);
+  //  return;
 }
 
 
+
index 874526eb6b68e719f6c35dbbe551eeb7e354e23e..ab4fa716ad5b6d0b440667cb6c2d9bbaf54b2b61 100644 (file)
@@ -6,6 +6,7 @@
 
 /* $Id$ */
 
+
 //_________________________________________________________________________
 //  Utility Class for handling Raw data
 //  Does all transitions from Digits to Raw and vice versa, 
@@ -22,6 +23,7 @@
 #include <TString.h>
 
 
+class AliAnalysisManager;
 class AliCaloRawStreamV3;
 class AliAltroMapping;
 class TGraph;
@@ -29,49 +31,37 @@ class AliRawReader;
 class AliEMCALGeometry;
 class AliCaloCalibPedestal;
 class AliCaloRawAnalyzer;
+class AliCaloRawAnalyzerLMSOffline;
 class AliEMCALTriggerRawDigitMaker;
 class AliEMCALTriggerData;
+
 #include "AliCaloConstants.h"
 
+
 class AliEMCALRawUtils : public TObject {
  public:
-  // enum fitAlgorithm {kStandard = 0, kFastFit= 1, kNeuralNet = 2, kLogFit = 3, kLMS = 4, kPeakFinder = 5, kCrude = 6};
-       
   AliEMCALRawUtils(Algo::fitAlgorithm fitAlgo = Algo::kStandard);
   AliEMCALRawUtils(AliEMCALGeometry *pGeometry, Algo::fitAlgorithm fitAlgo = Algo::kStandard);
   virtual ~AliEMCALRawUtils();
-       
-  AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils);  //copy ctor
-  AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils);
-
+  
+  // void FitRaw(const Int_t firstTimeBin, const Int_t lastTimeBin, Float_t & amp, Float_t & time, Float_t & chi2, Bool_t & fitDone) const ;
+  //  void FitParabola(const TGraph *gSig, Float_t & amp) const ; 
+  
   void Digits2Raw();
   void Raw2Digits(AliRawReader *reader, TClonesArray *digitsArr, const AliCaloCalibPedestal* pedbadmap,
                                  TClonesArray *digitsTRG=0x0, AliEMCALTriggerData* trgData = 0x0);
-
+  static Double_t RawResponseFunctionLog(Double_t *x, Double_t *par); 
   void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Float_t amp, Float_t time, Float_t chi2, Int_t ndf);
-//  void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t timeSamples[], Int_t nSamples);
   void TrimDigits(TClonesArray *digitsArr);
-
-  // Signal shape parameters
-  Double_t GetRawFormatHighLowGainFactor() const { return fHighLowGainFactor ;}
-  Int_t    GetRawFormatOrder()             const { return fOrder ; }   
-  Double_t GetRawFormatTau()               const { return fTau ; }    
   Int_t    GetNoiseThreshold()             const { return fNoiseThreshold; }
   Int_t    GetNPedSamples()                const { return fNPedSamples; }
-       
-  // get methods for fast fit simulation
   Int_t    GetPedestalValue()     const {return fgPedestalValue;}
   Double_t GetFEENoise()          const {return fgFEENoise;}
-
   Bool_t   GetRemoveBadChannels() const {return fRemoveBadChannels;}
   Int_t    GetFittingAlgorithm()  const {return fFittingAlgorithm; }
   Float_t  GetTimeMax()           const {return fTimeMax ;}
   Float_t  GetTimeMin()           const {return fTimeMin ;}
   Bool_t   UseFALTRO()            const {return fUseFALTRO; }
-
-  void SetRawFormatHighLowGainFactor(Double_t val) {fHighLowGainFactor=val;}
-  void SetRawFormatOrder(Int_t val)                {fOrder=val; }   
-  void SetRawFormatTau(Double_t val)               {fTau=val; }    
   void SetNoiseThreshold(Int_t val)                {fNoiseThreshold=val; }
   void SetNPedSamples(Int_t val)                   {fNPedSamples=val; }
   void SetRemoveBadChannels(Bool_t val)            {fRemoveBadChannels=val; }
@@ -79,70 +69,38 @@ class AliEMCALRawUtils : public TObject {
   void SetTimeMin(Float_t t)                       {fTimeMin   = t          ;}
   void SetTimeMax(Float_t t)                       {fTimeMax   = t          ;}
   void SetFALTROUsage(Bool_t val)                  {fUseFALTRO=val; }
-       
-  // set methods for fast fit simulation
   void SetFEENoise(Double_t val)                   {fgFEENoise = val;}
-  void SetRawFormatTimeBins(Int_t val)             {fgTimeBins = val;}
   void SetPedestalValue(Int_t val)                 {fgPedestalValue = val;}
-  
-  static Int_t GetRawFormatTimeBins()        { return fgTimeBins ; }    
-  static Double_t GetRawFormatTimeMax()      { return fgTimeBins*fgTimeBinWidth; }   
-  static Double_t GetRawFormatTimeBinWidth() { return fgTimeBinWidth; }   
-  static Double_t GetRawFormatTimeBin() 
-  { return GetRawFormatTimeMax() / GetRawFormatTimeBins(); }   
   Double_t GetRawFormatTimeTrigger()    const { return fgTimeTrigger ; }
   Int_t GetRawFormatThreshold()         const { return fgThreshold ; }       
-  Int_t GetRawFormatDDLPerSuperModule() const { return fgDDLPerSuperModule ; } 
   AliCaloRawAnalyzer *GetRawAnalyzer()  const { return fRawAnalyzer;}
-
   virtual Option_t* GetOption() const { return fOption.Data(); }
   void SetOption(const Option_t* opt) { fOption = opt; }
-
-  // Signal shape functions
-       
-  void FitRaw(const Int_t firstTimeBin, const Int_t lastTimeBin, Float_t & amp, Float_t & time, Float_t & chi2, Bool_t & fitDone) const ;
-  void FitParabola(const TGraph *gSig, Float_t & amp) const ; 
   static Double_t RawResponseFunction(Double_t *x, Double_t *par); 
-  static Double_t RawResponseFunctionLog(Double_t *x, Double_t *par); 
   Bool_t   RawSampledResponse(Double_t dtime, Double_t damp, Int_t * adcH, Int_t * adcL, const Int_t keyErr=0) const;  
-
-  static void CalculateChi2(const Double_t* t,const Double_t* y,const Int_t nPoints, 
-                           const Double_t sig, const Double_t tau, const Double_t amp, const Double_t t0, Double_t &chi2);
-
- private:
-  Double_t fHighLowGainFactor ;         // high to low gain factor for the raw RO signal
-  Int_t fOrder ;                        // order of the gamma function for the RO signal
-  Double_t fTau ;                       // tau parameter of gamma function for the RO signal
+  
+private:
+  AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils);  //copy ctor
+  AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils);
   Int_t fNoiseThreshold;                // threshold to consider signal or noise
   Int_t fNPedSamples;                   // number of samples to use in pedestal calculation
-       
-  static const Int_t fgkOverflowCut = 950;  // cut to discriminate overflowed channels
-  static const Int_t fgkRawSignalOverflow = 0x3FF; // maximum signal (10 bits)
-  static Int_t fgTimeBins; // number of sampling bins of the raw RO signal
-
   static Double_t fgTimeTrigger ;       // time of the trigger for the RO signal 
-  static Double_t fgTimeBinWidth;       // maximum sampled time of the raw RO signal                             
   static Int_t fgThreshold;             // threshold
-  static Int_t fgDDLPerSuperModule;     // number of DDL per SuperModule
   static Int_t fgPedestalValue;         // pedestal value for Digits2Raw
   static Double_t fgFEENoise;           // electronics noise in ADC units
-
   AliEMCALGeometry* fGeom;              // geometry
   AliAltroMapping*  fMapping[4];        // only two for now
-
-  TString fOption;                      //! option passed from Reconstructor
-
+  TString fOption;                      // option passed from Reconstructor
   Bool_t  fRemoveBadChannels;           // select if bad channels are removed before fitting
   Int_t   fFittingAlgorithm;            // select the fitting algorithm
   Float_t fTimeMin;                     // minimum threshold for the time of the signal
   Float_t fTimeMax;                     // maximum threshold for the time of the signal
   Bool_t  fUseFALTRO;                  // use FALTRO and pass it to the digits
-       
   AliCaloRawAnalyzer *fRawAnalyzer;     // e.g. for sample selection for fits
-
   AliEMCALTriggerRawDigitMaker* fTriggerRawDigitMaker; 
-       
   ClassDef(AliEMCALRawUtils,7)          // utilities for raw signal fitting
+
 };
 
 #endif
index 4a638d0efd2f0c30f735ca133310cbd29aab51e7..57d97934b1a437ae838a2c52f8714682f8617227 100644 (file)
@@ -466,7 +466,10 @@ void AliEMCALRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits, const Bo
        
   //Called last because it sets the global position of the cluster?
   //Do not call it when recalculating clusters out of standard reconstruction
-  if(!justClusters) EvalLocal2TrackingCSTransform();
+  if(!justClusters){ 
+    printf("NOT JUST CLUSTERS\n");
+    EvalLocal2TrackingCSTransform();
+  }
 
 }
 
index 8fe4f91e16d1e9db7df57e6496ed54baff50ada1..fd67b8dd8a441a8262db81b27f54bf0fb13a300b 100644 (file)
@@ -278,18 +278,24 @@ void AliEMCALReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digits
     //must be done here because, in constructor, option is not yet known
     fgRawUtils->SetOption(GetOption());
     
-    fgRawUtils->SetRawFormatHighLowGainFactor(GetRecParam()->GetHighLowGainFactor());
-    fgRawUtils->SetRawFormatOrder(GetRecParam()->GetOrderParameter());
-    fgRawUtils->SetRawFormatTau(GetRecParam()->GetTau());
+    //  fgRawUtils->SetRawFormatHighLowGainFactor(GetRecParam()->GetHighLowGainFactor());
+  
+    //   fgRawUtils->SetRawFormatOrder(GetRecParam()->GetOrderParameter());
+    //    fgRawUtils->SetRawFormatTau(GetRecParam()->GetTau());
     fgRawUtils->SetNoiseThreshold(GetRecParam()->GetNoiseThreshold());
     fgRawUtils->SetNPedSamples(GetRecParam()->GetNPedSamples());
     fgRawUtils->SetRemoveBadChannels(GetRecParam()->GetRemoveBadChannels());
     fgRawUtils->SetFittingAlgorithm(GetRecParam()->GetFittingAlgorithm());
     fgRawUtils->SetFALTROUsage(GetRecParam()->UseFALTRO());
-    fgRawUtils->SetTimeMin(GetRecParam()->GetTimeMin());
-    fgRawUtils->SetTimeMax(GetRecParam()->GetTimeMax());
+    
+    //fgRawUtils->SetTimeMin(GetRecParam()->GetTimeMin());
+    //fgRawUtils->SetTimeMax(GetRecParam()->GetTimeMax());
+    
+    //  fgRawUtils->SetTimeMin(-99999 );
+    //  fgRawUtils->SetTimeMax( 99999 );
     
     fgRawUtils->Raw2Digits(rawReader,fgDigitsArr,fPedestalData,digitsTrg,fTriggerData);
+    
   }//skip calibration event
   else{
     AliDebug(1," Calibration Event, skip!");
index bf3e9965b98e9aa789900872a7a776a6a1935748..f018d08a15af9ba4ca5028cc6a7a925e1e3fdc97 100644 (file)
@@ -60,6 +60,9 @@
 #include "AliEMCALGeometry.h"
 #include "AliEMCALRawUtils.h"
 #include "AliLog.h"
+#include "AliCaloConstants.h"
+
+using namespace CALO;
 
 ClassImp(AliEMCALTrigger)
 
@@ -637,7 +640,8 @@ void AliEMCALTrigger::SetTriggers(const TClonesArray * ampmatrix,const Int_t iSM
   Float_t maxtimeR2 = -1 ;
   Float_t maxtimeRn = -1 ;
   static AliEMCALRawUtils rawUtil;
-  Int_t nTimeBins = rawUtil.GetRawFormatTimeBins() ;
+  // Int_t nTimeBins = rawUtil.GetRawFormatTimeBins() ;
+  Int_t nTimeBins = TIMEBINS;  //changed by PTH
 
   //Set max of 2x2 amplitudes and select L0 trigger
   if(max2[0] > f2x2MaxAmp ){
@@ -664,9 +668,12 @@ void AliEMCALTrigger::SetTriggers(const TClonesArray * ampmatrix,const Int_t iSM
         fADCValuesHigh2x2 = new Int_t[nTimeBins];
       }
       //printf(" maxtimeR2 %12.5e (1)\n", maxtimeR2);
-      rawUtil.RawSampledResponse(maxtimeR2 * AliEMCALRawUtils::GetRawFormatTimeBin(), 
-      f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
-    
+      //  rawUtil.RawSampledResponse(maxtimeR2 * AliEMCALRawUtils::GetRawFormatTimeBin(), 
+      //                                f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
+       
+      rawUtil.RawSampledResponse(maxtimeR2*TIMEBINMAX/TIMEBINS, 
+                                f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
+      
     // Set Trigger Inputs, compare ADC time bins until threshold is attained
     // Set L0
       for(Int_t i = 0 ; i < nTimeBins ; i++){
@@ -706,9 +713,12 @@ void AliEMCALTrigger::SetTriggers(const TClonesArray * ampmatrix,const Int_t iSM
         fADCValuesHighnxn = new Int_t[nTimeBins];
         fADCValuesLownxn  = new Int_t[nTimeBins];
       }
-      rawUtil.RawSampledResponse(maxtimeRn * AliEMCALRawUtils::GetRawFormatTimeBin(), 
+      //  rawUtil.RawSampledResponse(maxtimeRn * AliEMCALRawUtils::GetRawFormatTimeBin(), 
+      //   fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
+      rawUtil.RawSampledResponse(maxtimeRn*TIMEBINMAX/TIMEBINS, 
       fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
-    
+
+
     //Set Trigger Inputs, compare ADC time bins until threshold is attained
     //SetL1 Low
       for(Int_t i = 0 ; i < nTimeBins ; i++){
index 10860bc696c122a1d0aec24ff3d8c744eb1c7dfa..881fd3d2348c3198afe06ec0feb80bebe6887273 100644 (file)
@@ -45,6 +45,8 @@ Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
 
 #include "Riostream.h"
 
+#include "AliCaloRawAnalyzerFactory.h"
+
 namespace
 {
        const Int_t kSTUEqId = 4652;
@@ -77,8 +79,10 @@ fTriggerData(0x0)
       fGeometry =  AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName());
     }
   
-  fRawAnalyzer = new AliCaloRawAnalyzerFakeALTRO();
+  //  fRawAnalyzer = new AliCaloRawAnalyzerFakeALTRO ();
   
+  fRawAnalyzer =  (AliCaloRawAnalyzerFakeALTRO*)AliCaloRawAnalyzerFactory::CreateAnalyzer(kFakeAltro);
+
   fDCSConfig = AliEMCALTriggerDCSConfigDB::Instance();
   
   for (Int_t i=0; i<3072; i++) fRawDigitIndex[i] = -1;
index 92346dc2ee75efe1900b43e6bf85aa5a13b049fa..1a5e92a451c00812240ccd183e454ed5e3655293 100644 (file)
@@ -25,7 +25,7 @@
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-set ( SRCS  AliEMCALGeoParams.cxx AliEMCALGeoUtils.cxx AliEMCALGeometry.cxx AliEMCALEMCGeometry.cxx AliEMCALShishKebabTrd1Module.cxx AliEMCALPIDUtils.cxx AliCaloNeuralFit.cxx AliCaloRawAnalyzer.cxx AliCaloBunchInfo.cxx AliCaloFitResults.cxx AliCaloFitSubarray.cxx AliCaloRawAnalyzerCrude.cxx AliCaloRawAnalyzerLMS.cxx AliCaloRawAnalyzerNN.cxx AliCaloPeakFinderVectors.cxx AliEMCALHistoUtilities.cxx AliEMCALRecoUtils.cxx AliEMCALTrack.cxx AliEMCALCalibTimeDepCorrection.cxx) 
+set ( SRCS  AliEMCALGeoParams.cxx AliEMCALGeoUtils.cxx AliEMCALGeometry.cxx AliEMCALEMCGeometry.cxx AliEMCALShishKebabTrd1Module.cxx AliEMCALPIDUtils.cxx AliEMCALHistoUtilities.cxx AliEMCALRecoUtils.cxx AliEMCALTrack.cxx AliEMCALCalibTimeDepCorrection.cxx) 
 
 string (REPLACE ".cxx" ".h" HDRS "${SRCS}")
 
@@ -33,7 +33,7 @@ set(HDRS ${HDRS} AliCaloConstants.h)
 
 set ( DHDR  EMCALUtilsLinkDef.h)
 
-set ( EXPORT AliEMCALGeoParams.h AliEMCALGeoUtils.h AliEMCALEMCGeometry.h AliEMCALShishKebabTrd1Module.h AliEMCALPIDUtils.h AliCaloNeuralFit.h AliCaloRawAnalyzer.h AliCaloBunchInfo.h AliCaloFitResults.h AliCaloRawAnalyzerCrude.h AliCaloRawAnalyzerLMS.h AliCaloRawAnalyzerPeakFinder.h AliCaloRawAnalyzerNN.h AliEMCALGeometry.h AliEMCALRecoUtils.h AliEMCALTrack.h)
+set ( EXPORT AliEMCALGeoParams.h AliEMCALGeoUtils.h AliEMCALEMCGeometry.h AliEMCALShishKebabTrd1Module.h AliEMCALPIDUtils.h  AliEMCALGeometry.h AliEMCALRecoUtils.h AliEMCALTrack.h)
 
 set ( PACKCXXFLAGS "${CXXFLAGS} -D__EMCALUTIL__")
 
index 5f79aaa0edea537ebe2142d78077bf351814119b..271da13b6f6e8a7a0e246eca58f689c828da60f0 100644 (file)
@@ -25,7 +25,7 @@
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-set ( SRCS  AliEMCALHit.cxx AliEMCALLoader.cxx AliEMCALWsuCosmicRaySetUp.cxx AliEMCALRecPoint.cxx AliEMCALSDigitizer.cxx AliEMCALDigitizer.cxx AliEMCALDigit.cxx AliEMCALCalibData.cxx AliEMCALCalibTimeDep.cxx  AliEMCALPreprocessor.cxx AliEMCALSensorTemp.cxx AliEMCALSensorTempArray.cxx AliCaloCalibPedestal.cxx AliCaloCalibSignal.cxx AliEMCALSurvey.cxx AliEMCALRecParam.cxx AliEMCALSimParam.cxx AliEMCALQAChecker.cxx AliEMCALSpaceFrame.cxx AliEMCALBiasAPD.cxx AliEMCALCalibAbs.cxx AliEMCALCalibReference.cxx AliEMCALCalibMapAPD.cxx AliEMCALCalibTempCoeff.cxx SMcalib/AliEMCALCCUSBRawStream.cxx AliEMCALRawDigit.cxx AliEMCALTrigger.cxx AliEMCALTriggerSTURawStream.cxx AliEMCAL.cxx AliEMCALRawUtils.cxx AliCaloRawAnalyzerFastFit.cxx AliCaloRawAnalyzerPeakFinder.cxx AliEMCALTriggerDCSConfig.cxx AliEMCALTriggerTRUDCSConfig.cxx AliEMCALTriggerSTUDCSConfig.cxx AliEMCALTriggerDCSConfigDB.cxx AliEMCALTriggerRawDigitMaker.cxx AliCaloRawAnalyzerFakeALTRO.cxx AliEMCALTriggerRawDigit.cxx)
+set ( SRCS  AliEMCALHit.cxx AliEMCALLoader.cxx AliEMCALWsuCosmicRaySetUp.cxx AliEMCALRecPoint.cxx AliEMCALSDigitizer.cxx AliEMCALDigitizer.cxx AliEMCALDigit.cxx AliEMCALCalibData.cxx AliEMCALCalibTimeDep.cxx  AliEMCALPreprocessor.cxx AliEMCALSensorTemp.cxx AliEMCALSensorTempArray.cxx AliCaloCalibPedestal.cxx AliCaloCalibSignal.cxx AliEMCALSurvey.cxx AliEMCALRecParam.cxx AliEMCALSimParam.cxx AliEMCALQAChecker.cxx AliEMCALSpaceFrame.cxx AliEMCALBiasAPD.cxx AliEMCALCalibAbs.cxx AliEMCALCalibReference.cxx AliEMCALCalibMapAPD.cxx AliEMCALCalibTempCoeff.cxx  AliEMCALRawDigit.cxx AliEMCALTrigger.cxx AliEMCALTriggerSTURawStream.cxx AliEMCAL.cxx AliEMCALRawUtils.cxx AliEMCALTriggerDCSConfig.cxx AliEMCALTriggerTRUDCSConfig.cxx AliEMCALTriggerSTUDCSConfig.cxx AliEMCALTriggerDCSConfigDB.cxx AliEMCALTriggerRawDigitMaker.cxx AliEMCALTriggerRawDigit.cxx)
 
 string (REPLACE ".cxx" ".h" HDRS "${SRCS}")
 
@@ -35,6 +35,6 @@ set ( EINCLUDE PYTHIA6 RAW EVGEN THijing EMCAL/SMcalib)
 
 if( ALICE_TARGET STREQUAL "win32gcc")
        
-                                       set ( PACKSOFLAGS  ${SOFLAGS} -L${ALICE_ROOT}/lib/tgt_${ALICE_TARGET} -lEMCALUtils -lSTEERBase -lCDB -lSTEER -lRAWDatarec -lRAWDatabase -L${ROOTLIBDIR} -lVMC -lGeom -lMinuit)
+                                       set ( PACKSOFLAGS  ${SOFLAGS} -L${ALICE_ROOT}/lib/tgt_${ALICE_TARGET} -lEMCALUtils -lEMCALraw -lSTEERBase -lCDB -lSTEER -lRAWDatarec -lRAWDatabase -L${ROOTLIBDIR} -lVMC -lGeom -lMinuit)
 
 endif( ALICE_TARGET STREQUAL "win32gcc")
diff --git a/EMCAL/CMakelibEMCALraw.pkg b/EMCAL/CMakelibEMCALraw.pkg
new file mode 100644 (file)
index 0000000..3133515
--- /dev/null
@@ -0,0 +1,40 @@
+#--------------------------------------------------------------------------------#
+# Package File for EMCALbase                                                     #
+# Author : Johny Jose (johny.jose@cern.ch)                                       #
+# Variables Defined :                                                            #
+#                                                                                #
+# SRCS - C++ source files                                                        #
+# HDRS - C++ header files                                                        #
+# DHDR - ROOT Dictionary Linkdef header file                                     #
+# CSRCS - C source files                                                         #
+# CHDRS - C header files                                                         #
+# EINCLUDE - Include directories                                                 #
+# EDEFINE - Compiler definitions                                                 #
+# ELIBS - Extra libraries to link                                                #
+# ELIBSDIR - Extra library directories                                           #
+# PACKFFLAGS - Fortran compiler flags for package                                #
+# PACKCXXFLAGS - C++ compiler flags for package                                  #
+# PACKCFLAGS - C compiler flags for package                                      #
+# PACKSOFLAGS - Shared library linking flags                                     #
+# PACKLDFLAGS - Module linker flags                                              #
+# PACKBLIBS - Libraries to link (Executables only)                               #
+# EXPORT - Header files to be exported                                           #
+# CINTHDRS - Dictionary header files                                             #
+# CINTAUTOLINK - Set automatic dictionary generation                             #
+# ARLIBS - Archive Libraries and objects for linking (Executables only)          #
+# SHLIBS - Shared Libraries and objects for linking (Executables only)           #
+#--------------------------------------------------------------------------------#
+
+set ( SRCS   AliCaloRawAnalyzerFastFit.cxx AliCaloRawAnalyzerPeakFinder.cxx AliCaloRawAnalyzerLMSOffline.cxx AliCaloRawAnalyzerLMS.cxx AliCaloRawAnalyzerFakeALTRO.cxx AliCaloRawAnalyzerKStandard.cxx AliCaloRawAnalyzerNN.cxx AliCaloRawAnalyzerCrude.cxx AliCaloRawAnalyzerFactory.cxx AliCaloNeuralFit.cxx AliCaloPeakFinderVectors.cxx AliCaloFitSubarray.cxx AliCaloRawAnalyzer.cxx AliCaloBunchInfo.cxx AliCaloFitResults.cxx  AliCaloFastAltroFitv0.cxx SMcalib/AliEMCALCCUSBRawStream.cxx )
+
+string (REPLACE ".cxx" ".h" HDRS "${SRCS}")
+
+set ( DHDR EMCALrawLinkDef.h)
+
+set ( EINCLUDE PYTHIA6 RAW EVGEN THijing EMCAL/SMcalib)
+
+if( ALICE_TARGET STREQUAL "win32gcc")
+       
+                                       set ( PACKSOFLAGS  ${SOFLAGS} -lRAWDatabase -L${ROOTLIBDIR} -lVMC -lGeom -lMinuit)
+
+endif( ALICE_TARGET STREQUAL "win32gcc")
index 4af3d20e19e7a7290c9fe3a564f99f3388d638bc..ddd9270384968ec0574d13502d26891bbaa61952 100644 (file)
@@ -37,6 +37,6 @@ set ( EINCLUDE PYTHIA6 RAW EVGEN THijing VZERO)
 
 if( ALICE_TARGET STREQUAL "win32gcc")
        
-                       set ( PACKSOFLAGS  ${SOFLAGS} -L${ALICE_ROOT}/lib/tgt_${ALICE_TARGET} -lEMCALUtils -lEMCALbase -lEMCALsim -lSTEER -lESD -lCDB -lSTEERBase -L${ROOTLIBDIR} -lMinuit)
+                       set ( PACKSOFLAGS  ${SOFLAGS} -L${ALICE_ROOT}/lib/tgt_${ALICE_TARGET} -lEMCALUtils -lEMCALbase -lEMCALraw -lEMCALsim -lSTEER -lESD -lCDB -lSTEERBase -L${ROOTLIBDIR} -lMinuit)
 
 endif( ALICE_TARGET STREQUAL "win32gcc")
index 8089e279ff91d7d12b34b3abbfa0939f56531d82..a33432296a75d185d31fd99bb51db5f6878d3e42 100644 (file)
@@ -3,22 +3,12 @@
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
-
 #pragma link C++ class AliEMCALGeoParams+;
 #pragma link C++ class AliEMCALGeoUtils+;
 #pragma link C++ class AliEMCALGeometry+;
 #pragma link C++ class AliEMCALEMCGeometry+;
 #pragma link C++ class AliEMCALShishKebabTrd1Module+;
 #pragma link C++ class AliEMCALPIDUtils+;
-#pragma link C++ class AliCaloNeuralFit+;
-#pragma link C++ class AliCaloRawAnalyzer+;
-#pragma link C++ class AliCaloBunchInfo+;
-#pragma link C++ class AliCaloFitResults+;
-#pragma link C++ class AliCaloFitSubarray+;
-#pragma link C++ class AliCaloRawAnalyzerCrude+;
-#pragma link C++ class AliCaloRawAnalyzerNN+;
-#pragma link C++ class AliCaloRawAnalyzerLMS+;
-#pragma link C++ class AliCaloPeakFinderVectors+;
 #pragma link C++ class AliEMCALHistoUtilities+;
 #pragma link C++ class AliEMCALRecoUtils+;
 #pragma link C++ class AliEMCALTrack+;
index b6420ce010b465b150aaaecd2ad7a3025850689b..b84b8580dfd5cd080f4ae1facf09f990b7e6677a 100644 (file)
@@ -23,7 +23,6 @@
 #pragma link C++ class AliEMCALSimParam+;
 #pragma link C++ class AliEMCALQAChecker+;
 #pragma link C++ class AliEMCALSpaceFrame+;
-#pragma link C++ class AliEMCALCCUSBRawStream+;
 #pragma link C++ class AliEMCALBiasAPD+;
 #pragma link C++ class AliEMCALCalibAbs+;
 #pragma link C++ class AliEMCALCalibReference+;
 #pragma link C++ class AliEMCALTrigger+;
 #pragma link C++ class AliEMCALTriggerSTURawStream+;
 #pragma link C++ class AliEMCALRawUtils+;
-#pragma link C++ class AliCaloRawAnalyzerFastFit+;
-#pragma link C++ class AliCaloRawAnalyzerPeakFinder+;
 #pragma link C++ class AliEMCAL+;
 #pragma link C++ class AliEMCALTriggerDCSConfig+;
 #pragma link C++ class AliEMCALTriggerTRUDCSConfig+;
 #pragma link C++ class AliEMCALTriggerSTUDCSConfig+;
 #pragma link C++ class AliEMCALTriggerDCSConfigDB+;
 #pragma link C++ class AliEMCALTriggerRawDigitMaker+;
-#pragma link C++ class AliCaloRawAnalyzerFakeALTRO+;
 #pragma link C++ class AliEMCALTriggerRawDigit+;
 
 #endif
diff --git a/EMCAL/EMCALrawLinkDef.h b/EMCAL/EMCALrawLinkDef.h
new file mode 100644 (file)
index 0000000..32e832a
--- /dev/null
@@ -0,0 +1,26 @@
+#ifdef __CINT__
+// for libEMCALbase.pkg 
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ class AliCaloRawAnalyzerPeakFinder+;
+#pragma link C++ class AliCaloRawAnalyzerLMS+;
+#pragma link C++ class AliCaloRawAnalyzerLMSOffline+;
+#pragma link C++ class AliCaloRawAnalyzerNN+;
+#pragma link C++ class AliCaloRawAnalyzerFastFit+;
+#pragma link C++ class AliCaloRawAnalyzerPeakFinder+;
+#pragma link C++ class AliCaloRawAnalyzerKStandard+;
+#pragma link C++ class AliCaloRawAnalyzerFakeALTRO+;
+#pragma link C++ class AliCaloRawAnalyzerCrude+;
+#pragma link C++ class AliCaloNeuralFit+;
+#pragma link C++ class AliCaloPeakFinderVectors+;
+#pragma link C++ class AliCaloFitSubarray+;
+#pragma link C++ class AliCaloRawAnalyzer+; 
+#pragma link C++ class AliCaloBunchInfo+; 
+#pragma link C++ class AliCaloFitResults+; 
+#pragma link C++ class AliCaloRawAnalyzerFakeALTRO+;
+#pragma link C++ class AliEMCALCCUSBRawStream+;
+#pragma link C++ class AliCaloFastAltroFitv0+;
+
+#endif
+
index 416cdc8ab8d3bfb60ae89a0c3006889092f85baa..3399c122a0f855da9c244254161200f352fd9ad1 100644 (file)
@@ -31,7 +31,7 @@ set ( CSRCS )
 set ( EINCLUDE )
 set ( ELIBSDIR )
 
-set ( ELIBS  EveBase EveDet MONITOR MUONmapping MUONevaluation MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore TPCfast TPCsim TPCrec TPCbase ITSbase ITSsim ITSrec PMDbase PMDsim PMDrec TRDbase TRDsim TRDrec FMDbase FMDsim FMDrec TOFbase TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec BCM STRUCT T0base T0sim T0rec STEER CDB AOD ESD STEERBase ANALYSISalice ANALYSIS THijing hijing THbtp TEPEMGEN FASTSIM microcern RAWDatasim RAWDatarec RAWDatabase HLTbase XMLParser STAT)
+set ( ELIBS  EveBase EveDet MONITOR MUONmapping MUONevaluation MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore TPCfast TPCsim TPCrec TPCbase ITSbase ITSsim ITSrec PMDbase PMDsim PMDrec TRDbase TRDsim TRDrec FMDbase FMDsim FMDrec TOFbase TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec EMCALraw BCM STRUCT T0base T0sim T0rec STEER CDB AOD ESD STEERBase ANALYSISalice ANALYSIS THijing hijing THbtp TEPEMGEN FASTSIM microcern RAWDatasim RAWDatarec RAWDatabase HLTbase XMLParser STAT)
 
 if(PYTHIA6)
   list (APPEND ELIBS EVGEN)
index 162b03bb74020b4fd973902434e86ebe63969b55..8fa5e68c31c244d3ab45b630c4d72a61934fd66b 100644 (file)
@@ -31,7 +31,7 @@ set ( CSRCS )
 set ( EINCLUDE )
 set ( ELIBSDIR )
 
-set ( ELIBS  EveBase EveHLT EveDet MONITOR HLTbase HLTrec AliHLTUtil AliHLTEve AliHLTTPC TPCcalib AliHLTRCU AliHLTMUON TPCsim TPCrec TPCbase ITSbase ITSrec TRDbase TRDrec AliHLTTRD PHOSbase PHOSUtils EMCALbase EMCALUtils EMCALrec EMCALsim TRIGGERbase VZERObase VZEROrec VZEROsim TRIGGERbase MUONmapping MUONevaluation MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore STEER CDB AOD ESD STEERBase ANALYSISalice ANALYSIS FASTSIM microcern RAWDatasim RAWDatarec RAWDatabase XMLParser STAT TOFbase TOFsim FMDbase FMDsim FMDrec PMDbase T0base)
+set ( ELIBS  EveBase EveHLT EveDet MONITOR HLTbase HLTrec AliHLTUtil AliHLTEve AliHLTTPC TPCcalib AliHLTRCU AliHLTMUON TPCsim TPCrec TPCbase ITSbase ITSrec TRDbase TRDrec AliHLTTRD PHOSbase PHOSUtils EMCALbase EMCALraw EMCALUtils EMCALrec EMCALsim TRIGGERbase VZERObase VZEROrec VZEROsim TRIGGERbase MUONmapping MUONevaluation MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore STEER CDB AOD ESD STEERBase ANALYSISalice ANALYSIS FASTSIM microcern RAWDatasim RAWDatarec RAWDatabase XMLParser STAT TOFbase TOFsim FMDbase FMDsim FMDrec PMDbase T0base)
 
 set ( PACKBLIBS  ${ROOTCLIBS} ${ROOTPLIBS} -lTreePlayer -lGeomPainter -lGed -lRGL -lEve ${SYSLIBS})
 
index 1f55a21c47eee36b91fda4c635c9955f6eda16e2..e5056daab7b034783b064cfe6327f7191a7c4f6d 100644 (file)
 #include "AliLog.h"
 #include "TStopwatch.h"
 
+#include "AliCaloRawAnalyzerFactory.h"
+
+//#include "AliCaloConstants.h"
+
+//#include "AliCaloRawAnalyzer.h"
+
+//using namespace Algo;
 
 #include <vector>
 using namespace std;
@@ -38,26 +45,29 @@ ClassImp(AliHLTCaloRawAnalyzerComponentv3);
 
 
 
-AliHLTCaloRawAnalyzerComponentv3::AliHLTCaloRawAnalyzerComponentv3(TString det):AliHLTCaloProcessor(),
-                                                                               AliHLTCaloConstantsHandler(det),
-                                                                               fAnalyzerPtr(0),
-                                                                               fMapperPtr(0),     
-                                                                               fCurrentSpec(-1),
-                                                                               fDebug(false),
-                                                                               fSanityInspectorPtr(0),
-                                                                               fRawReaderMemoryPtr(0),
-                                                                               fAltroRawStreamPtr(0),
-                                                                               fAlgorithm(0),  
-                                                                               fOffset(0),
-                                                                               fBunchSizeCut(0),
-                                                                               fMinPeakPosition(0),
-                                                                               fMaxPeakPosition(100),
-                                                                               fDoPushBadRawData(false),
-                                                                               fDoPushRawData(false),
-                                                                               fRawDataWriter(0)
+AliHLTCaloRawAnalyzerComponentv3::AliHLTCaloRawAnalyzerComponentv3(TString det, fitAlgorithm algo  ):AliHLTCaloProcessor(),
+                                                                                                    AliHLTCaloConstantsHandler(det),
+                                                                                                    fAnalyzerPtr(0),
+                                                                                                    fMapperPtr(0),     
+                                                                                                    fCurrentSpec(-1),
+                                                                                                    fDebug(false),
+                                                                                                    fSanityInspectorPtr(0),
+                                                                                                    fRawReaderMemoryPtr(0),
+                                                                                                    fAltroRawStreamPtr(0),
+                                                                                                    fAlgorithm(0),  
+                                                                                                    fOffset(0),
+                                                                                                    fBunchSizeCut(0),
+                                                                                                    fMinPeakPosition(0),
+                                                                                                    fMaxPeakPosition(100),
+                                                                                                    fDoPushBadRawData(false),
+                                                                                                    fDoPushRawData(false),
+                                                                                                    fRawDataWriter(0)
                                                                        
 {
   //Constructor
+  
+  fAnalyzerPtr = AliCaloRawAnalyzerFactory::CreateAnalyzer(algo);
+  fAnalyzerPtr->SetIsZeroSuppressed(true);
   fSanityInspectorPtr = new AliHLTCaloSanityInspector();
   
   if( fDoPushRawData == true  )
index f8576ac7fb563c49b372911fa28ec6c36f12e6b7..2d8720b26f1b4475dbe556cb7bb313afe0d520e4 100644 (file)
@@ -99,8 +99,12 @@ class AliAltroRawStreamV3;
 
 #include "AliHLTCaloConstantsHandler.h"
 #include "AliHLTCaloProcessor.h"
+#include "AliCaloRawAnalyzer.h"
 
 
+#include "AliCaloConstants.h"
+using namespace Algo;
+
 class AliHLTCaloMapper;
 
 
@@ -109,7 +113,7 @@ class AliHLTCaloRawAnalyzerComponentv3 :  public AliHLTCaloProcessor, protected
  public:
 
   /** Constructor must be initialized to specific calorimeter */
-  AliHLTCaloRawAnalyzerComponentv3(TString det);
+  AliHLTCaloRawAnalyzerComponentv3(TString det, fitAlgorithm algo );
   virtual ~AliHLTCaloRawAnalyzerComponentv3();
   virtual int DoInit(int argc =0, const char** argv  = 0) ;
   virtual int DoDeinit();
index fd5460852a53779cac32c53f8d005f7831bf669f..51d3b35e2575192d5785391935f7314e312023a1 100644 (file)
 #include "AliHLTEMCALMapper.h"
 #include "AliHLTEMCALDefinitions.h"
 
+#include "AliCaloConstants.h"
 
+using namespace Algo;
 
-AliHLTEMCALRawAnalyzerComponent::AliHLTEMCALRawAnalyzerComponent() : AliHLTCaloRawAnalyzerComponentv3("EMCAL")
+AliHLTEMCALRawAnalyzerComponent::AliHLTEMCALRawAnalyzerComponent( fitAlgorithm algo ) : AliHLTCaloRawAnalyzerComponentv3("EMCAL", algo)
 {
   //fDebug = true;
   fDebug = false;
index 2290c0f22dd8c0c03e1672a8d868423ed4393906..60be0a6ac862083c7a216d82d0dd954ed91f11bb 100644 (file)
@@ -31,7 +31,7 @@
 class  AliHLTEMCALRawAnalyzerComponent : public AliHLTCaloRawAnalyzerComponentv3
 {
  public:
-  AliHLTEMCALRawAnalyzerComponent();
+  AliHLTEMCALRawAnalyzerComponent( fitAlgorithm algo );
   virtual ~AliHLTEMCALRawAnalyzerComponent();
   void GetInputDataTypes( vector <AliHLTComponentDataType>& list);
   AliHLTComponentDataType GetOutputDataType();
@@ -39,6 +39,7 @@ class  AliHLTEMCALRawAnalyzerComponent : public AliHLTCaloRawAnalyzerComponentv3
   virtual AliHLTComponent* Spawn() = 0; 
   
  private:
+  AliHLTEMCALRawAnalyzerComponent();
   AliHLTEMCALRawAnalyzerComponent(const AliHLTEMCALRawAnalyzerComponent & );
   AliHLTEMCALRawAnalyzerComponent & operator = (const AliHLTEMCALRawAnalyzerComponent  &);
   virtual void InitMapping( const int specification );
index fed0b957622462ad7bfd6c33c341a10d5652aa38..a4d540e065f0186cf4e4cdc858ec24661605980a 100644 (file)
@@ -34,22 +34,24 @@ AliHLTEMCALRawAnalyzerCrudeComponent  gAliHLTEMCALRawAnalyzerCrudeComponent;
 
 
 //AliHLTEMCALRawAnalyzerCrudeComponent::AliHLTEMCALRawAnalyzerCrudeComponent : AliHLTEMCALRawAnalyzerComponent() 
-AliHLTEMCALRawAnalyzerCrudeComponent::AliHLTEMCALRawAnalyzerCrudeComponent() : AliHLTEMCALRawAnalyzerComponent()
+AliHLTEMCALRawAnalyzerCrudeComponent::AliHLTEMCALRawAnalyzerCrudeComponent() : AliHLTEMCALRawAnalyzerComponent( kCrude )
 {
   // constructor
   //  fAnalyzerPtr = new   AliHLTCaloRawAnalyzerCrude();
-  fAnalyzerPtr = new   AliCaloRawAnalyzerCrude();
+  // fAnalyzerPtr = new   AliCaloRawAnalyzerCrude();
 }
 
 
 AliHLTEMCALRawAnalyzerCrudeComponent::~AliHLTEMCALRawAnalyzerCrudeComponent()
 {
   // destructor
+  /*
   if (0 != fAnalyzerPtr)
     {
       delete fAnalyzerPtr;
       fAnalyzerPtr = 0;
     }
+  */
 }
 
 int 
index af3160001cd26b82ad730e4f285e7d2a19fd9457..c613db8d54a20e43be9a3d056f3b3392df8a7907 100644 (file)
 
 AliHLTEMCALRawAnalyzerFastFitComponent  gAliHLTEMCALRawAnalyzerFastFitComponent;
 
-AliHLTEMCALRawAnalyzerFastFitComponent::AliHLTEMCALRawAnalyzerFastFitComponent() : AliHLTEMCALRawAnalyzerComponent()
+AliHLTEMCALRawAnalyzerFastFitComponent::AliHLTEMCALRawAnalyzerFastFitComponent() : AliHLTEMCALRawAnalyzerComponent(kFastFit)
 {
   // fAnalyzerPtr
-  fAnalyzerPtr = new AliCaloRawAnalyzerFastFit();
+  //  fAnalyzerPtr = new AliCaloRawAnalyzerFastFit();
 }
 
 
index 7a9879df0fc10c309e1f4230267a9c1805e469f2..bc0600fc64f68126e4153bf97c01e16897a4b5e3 100644 (file)
 
 AliHLTEMCALRawAnalyzerLMSComponent  gAliHLTEMCALRawAnalyzerLMSComponent;
 
-AliHLTEMCALRawAnalyzerLMSComponent::AliHLTEMCALRawAnalyzerLMSComponent() : AliHLTEMCALRawAnalyzerComponent()
+AliHLTEMCALRawAnalyzerLMSComponent::AliHLTEMCALRawAnalyzerLMSComponent() : AliHLTEMCALRawAnalyzerComponent(kLMS)
 {
   // fAnalyzerPtr
-  fAnalyzerPtr = new AliCaloRawAnalyzerLMS();
+  //  fAnalyzerPtr = new AliCaloRawAnalyzerLMS();
 }
 
 
 AliHLTEMCALRawAnalyzerLMSComponent::~AliHLTEMCALRawAnalyzerLMSComponent()
 {
-  delete fAnalyzerPtr;
+  // delete fAnalyzerPtr;
 }
 
 
index 8dd965ba5f36fc651c8409036bc061d67e81f13a..60689d07eca56f7a5b9a2db3f15daf29b09af6fd 100644 (file)
 
 AliHLTEMCALRawAnalyzerNNComponent  gAliHLTEMCALRawAnalyzerNNComponent;
 
-AliHLTEMCALRawAnalyzerNNComponent::AliHLTEMCALRawAnalyzerNNComponent() : AliHLTEMCALRawAnalyzerComponent()
+AliHLTEMCALRawAnalyzerNNComponent::AliHLTEMCALRawAnalyzerNNComponent() : AliHLTEMCALRawAnalyzerComponent(kNeuralNet)
 {
   // fAnalyzerPtr
-  fAnalyzerPtr = new AliCaloRawAnalyzerNN();
+  //  fAnalyzerPtr = new AliCaloRawAnalyzerNN();
 }
 
 
 AliHLTEMCALRawAnalyzerNNComponent::~AliHLTEMCALRawAnalyzerNNComponent()
 {
-  delete fAnalyzerPtr;
+  //  delete fAnalyzerPtr;
 }
 
 
index df7527d50b912bf41bd3db442993cb3d7c429ad7..a39d2f5097ac55e15b7d00e07bb5e12b8740b6f8 100644 (file)
@@ -34,13 +34,14 @@ class  AliHLTEMCALRawAnalyzerNNComponent : public AliHLTEMCALRawAnalyzerComponen
 {
 
  public:
-  AliHLTEMCALRawAnalyzerNNComponent();
+  AliHLTEMCALRawAnalyzerNNComponent( );
   virtual ~AliHLTEMCALRawAnalyzerNNComponent();
   virtual const char* GetComponentID() ;
   virtual AliHLTComponent* Spawn();
   virtual int Deinit();
 
  private:
+  // AliHLTEMCALRawAnalyzerNNComponent();
   AliHLTEMCALRawAnalyzerNNComponent              (   const AliHLTEMCALRawAnalyzerNNComponent &,  TString det ); 
   AliHLTEMCALRawAnalyzerNNComponent & operator = (   const AliHLTEMCALRawAnalyzerNNComponent );
   //  AliEMCALRawAnalyzerNN *fRawAnalyzer;
index d978443552e3801e8852a52a88422c972932384f..fcfcf387b0f0ec8ad1b26c8967c96bc36c33b3f5 100644 (file)
 AliHLTEMCALRawAnalyzerPeakFinderComponent  gAliHLTEMCALRawAnalyzerPeakFinderComponent;
 
 
-AliHLTEMCALRawAnalyzerPeakFinderComponent::AliHLTEMCALRawAnalyzerPeakFinderComponent (): AliHLTEMCALRawAnalyzerComponent()
+AliHLTEMCALRawAnalyzerPeakFinderComponent::AliHLTEMCALRawAnalyzerPeakFinderComponent (): AliHLTEMCALRawAnalyzerComponent(kPeakFinder)
 {
-
   // constructor
   //  fAnalyzerPtr = new    AliCaloRawAnalyzerPeakFinder();
-
 }
 
 
 AliHLTEMCALRawAnalyzerPeakFinderComponent::~AliHLTEMCALRawAnalyzerPeakFinderComponent()
 {
   // destructor
+  /*
   if (0 != fAnalyzerPtr)
     {
       delete fAnalyzerPtr;
       fAnalyzerPtr = 0;
     }
+  */
 }
 
 int
 AliHLTEMCALRawAnalyzerPeakFinderComponent::DoInit(int argc, const char** argv)
 {
-    fAnalyzerPtr = new AliCaloRawAnalyzerPeakFinder();
+  // fAnalyzerPtr = new AliCaloRawAnalyzerPeakFinder();
     return AliHLTCaloRawAnalyzerComponentv3::DoInit(argc, argv);
 }
 
@@ -61,11 +61,14 @@ int
 AliHLTEMCALRawAnalyzerPeakFinderComponent::DoDeinit()
 {
   //comment
+  /*
   if (0 != fAnalyzerPtr)
     {
       delete fAnalyzerPtr;
       fAnalyzerPtr = 0;
     }
+  */
 
   return AliHLTEMCALRawAnalyzerComponent::DoDeinit();
 }
index 2b9e404dd03e0c22830c5ea299cad4f48592f6cd..90047fc265de7d9c8aaa42d8c99250aea1a34960 100644 (file)
@@ -19,8 +19,7 @@
 #include "AliHLTPHOSMapper.h"
 
 
-AliHLTPHOSRawAnalyzerComponentv3::AliHLTPHOSRawAnalyzerComponentv3() :
-   AliHLTCaloRawAnalyzerComponentv3("PHOS")
+AliHLTPHOSRawAnalyzerComponentv3::AliHLTPHOSRawAnalyzerComponentv3(  fitAlgorithm algo ) : AliHLTCaloRawAnalyzerComponentv3("PHOS", algo)
 {
   // See header file for class documentation
 //   InitMapping(0x1); //using 0x1 to avoid error message
index a4a26ea663819fbf08964e171b243b3bf9ab6245..1e19ca2f62e79bfc0ca30a2e3aa8b88d0f707095 100644 (file)
@@ -87,10 +87,15 @@ class AliHLTPHOSRawAnalyzer;
  */ 
 
 
+//#include "AliCaloConstants.h"
+
+//using namespace Algo;
+
+
 class AliHLTPHOSRawAnalyzerComponentv3 : public AliHLTCaloRawAnalyzerComponentv3
 {
  public:
-  AliHLTPHOSRawAnalyzerComponentv3(); /** Standard constructor */
+  AliHLTPHOSRawAnalyzerComponentv3( fitAlgorithm algo ); /** Standard constructor */
   virtual ~AliHLTPHOSRawAnalyzerComponentv3();
   virtual void GetInputDataTypes( vector <AliHLTComponentDataType>& list);/** interface function, see @ref AliHLTComponent for description */
   virtual AliHLTComponentDataType GetOutputDataType();/** interface function, see @ref AliHLTComponent for description */
@@ -106,6 +111,7 @@ class AliHLTPHOSRawAnalyzerComponentv3 : public AliHLTCaloRawAnalyzerComponentv3
   virtual void InitMapping(const int specification);
   
  private:
+  AliHLTPHOSRawAnalyzerComponentv3();
   AliHLTPHOSRawAnalyzerComponentv3(const AliHLTPHOSRawAnalyzerComponentv3 & );
   AliHLTPHOSRawAnalyzerComponentv3 & operator = (const AliHLTPHOSRawAnalyzerComponentv3 &);
   
index 8adac323899c9bef2811410e36609f37497d5a5a..28600c4baa136bd56e5a0239fc01da79c4ddbdf6 100644 (file)
 
 
 #include "AliHLTPHOSRawAnalyzerCrudeComponent.h"
-#include "AliCaloRawAnalyzerCrude.h"
 
 AliHLTPHOSRawAnalyzerCrudeComponent gAliHLTPHOSRawAnalyzerCrudeComponent;
 
 //___________________________________________________________________________
-AliHLTPHOSRawAnalyzerCrudeComponent::AliHLTPHOSRawAnalyzerCrudeComponent()
+AliHLTPHOSRawAnalyzerCrudeComponent::AliHLTPHOSRawAnalyzerCrudeComponent() : AliHLTPHOSRawAnalyzerComponentv3(kCrude)
 {
-  fAnalyzerPtr = new AliCaloRawAnalyzerCrude();
-  fAnalyzerPtr->SetIsZeroSuppressed(true);
+
 } 
 
+
 //___________________________________________________________________________
 AliHLTPHOSRawAnalyzerCrudeComponent::~AliHLTPHOSRawAnalyzerCrudeComponent()
 {
-//   if(fAnalyzerPtr)
-//     {
-//       delete fAnalyzerPtr;
-//       fAnalyzerPtr = 0;
-//     }
+
 }
 
+
 //___________________________________________________________________________
-AliHLTPHOSRawAnalyzerCrudeComponent::AliHLTPHOSRawAnalyzerCrudeComponent(const AliHLTPHOSRawAnalyzerCrudeComponent & ):AliHLTPHOSRawAnalyzerComponentv3()
+AliHLTPHOSRawAnalyzerCrudeComponent::AliHLTPHOSRawAnalyzerCrudeComponent(const AliHLTPHOSRawAnalyzerCrudeComponent & ):AliHLTPHOSRawAnalyzerComponentv3(kCrude)
 {
 
 }
 
+
 int
 AliHLTPHOSRawAnalyzerCrudeComponent::Deinit()
 {
-  
-  if(fAnalyzerPtr)
-    {
-      delete fAnalyzerPtr;
-      fAnalyzerPtr = 0;
-    }
   Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerCrudeComponent Deinit");
   return 0;
 }
 
+
 //___________________________________________________________________________
 const char* 
 AliHLTPHOSRawAnalyzerCrudeComponent::GetComponentID()
@@ -65,6 +57,7 @@ AliHLTPHOSRawAnalyzerCrudeComponent::GetComponentID()
   return "PhosRawCrude";
 }
 
+
 //___________________________________________________________________________
 AliHLTComponent*
 AliHLTPHOSRawAnalyzerCrudeComponent::Spawn()
index e3bc1fe4844667ab958ee3b7881f008f3f384c67..a2929aa02cae534750b9a2244eccd01c723f8553 100644 (file)
@@ -11,7 +11,6 @@
  * See cxx source for full Copyright notice  */ 
 
 
-
 class AliHLTPHOSRawAnalyzerCrudeComponent: public AliHLTPHOSRawAnalyzerComponentv3
 //class AliHLTPHOSRawAnalyzerCrudeComponent: public AliHLTCaloRawAnalyzerComponentv3
 {
index 26e41409467181021ef4299487faa0f0338e2245..e50a3d0a6cf6a2660d5822e25bf13d3206c64150 100644 (file)
@@ -25,7 +25,7 @@
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-set ( SRCS   AliFilter.cxx AliRawReader.cxx AliRawReaderFile.cxx AliRawReaderRoot.cxx AliRawReaderChain.cxx AliRawReaderDate.cxx AliRawReaderMemory.cxx AliRawHLTManager.cxx AliAltroRawStream.cxx AliCaloRawStream.cxx AliCaloRawStreamV3.cxx AliVMERawStream.cxx AliAltroDecoder.cxx AliAltroData.cxx AliAltroBunch.cxx AliAltroRawStreamFast.cxx AliAltroRawStreamV3.cxx AliCaloFastAltroFitv0.cxx)
+set ( SRCS   AliFilter.cxx AliRawReader.cxx AliRawReaderFile.cxx AliRawReaderRoot.cxx AliRawReaderChain.cxx AliRawReaderDate.cxx AliRawReaderMemory.cxx AliRawHLTManager.cxx AliAltroRawStream.cxx AliCaloRawStream.cxx AliCaloRawStreamV3.cxx AliVMERawStream.cxx AliAltroDecoder.cxx AliAltroData.cxx AliAltroBunch.cxx AliAltroRawStreamFast.cxx AliAltroRawStreamV3.cxx )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
index aba16afa8de85f7dea0c7f39a6956262ec7adf5f..9696aa6ae8675fdf798f3f7ce70783a986a0eebc 100644 (file)
@@ -21,5 +21,4 @@
 #pragma link C++ class AliAltroRawStreamFast+;
 #pragma link C++ class AliRawHLTManager+;
 #pragma link C++ class AliAltroRawStreamV3+;
-#pragma link C++ class AliCaloFastAltroFitv0+;
 #endif