]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliCaloRawAnalyzer.h
Fix for bug #78633 (Diego)
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzer.h
index 2575d3b159ba0b5b92bf1fe27ca914dc83064ce0..4aa5df3ae315a941872e5f7eb13727ab4df4ffdf 100644 (file)
@@ -1,3 +1,4 @@
+// -*- mode: c++ -*-
 #ifndef ALICALORAWANALYZER_H
 #define ALICALORAWANALYZER_H
 /**************************************************************************
 //of signal amplitude and peak position
 //From CALO Calorimeter RAW data
 
-
 #include "Rtypes.h"
 #include "TObject.h"
-
 #define MAXSAMPLES 1008 //CRAP PTH
-
-//#include "AliCaloRawAnalyzer.h"
-
-//class AliCaloBunchInfo;
-
-//#include "AliCaloBunchInfo.h"
-
-
 #include <vector>
-using namespace std;
-
-class AliCaloBunchInfo;
-class AliCaloFitResults;
+#include "AliCaloConstants.h"
 
-//class vector<AliCaloBunchInfo> ;
+//using  namespace CaloConstants::FitAlgorithm;
+//using  CaloConstants::ReturnCodes;
 
-//class  vector;
+class AliCaloBunchInfo;
+#include "AliCaloFitResults.h"
 
 class  AliCaloRawAnalyzer : public TObject
 {
  public:
   AliCaloRawAnalyzer(const char *name="AliCaloRawAnalyzer", const char *nameshort="RawAna");
   virtual ~AliCaloRawAnalyzer();
-  virtual AliCaloFitResults Evaluate( const vector<AliCaloBunchInfo> &bunchvector
-                                     const UInt_t altrocfg1,  const UInt_t altrocfg2 );
-  void PrintBunches( const vector<AliCaloBunchInfo> &bunchvector ) const;
+  virtual AliCaloFitResults Evaluate( const std::vector<AliCaloBunchInfo> &/*bunchvector*/
+                                     const UInt_t /*altrocfg1*/,  const UInt_t /*altrocfg2*/ ) {return AliCaloFitResults( Ret::kInvalid , Ret::kInvalid);}
+  //enum fitAlgorithm {kCrude, kPeakFinder, kLMS, kFastFit, kNeuralNet, kNONE};
+  void PrintBunches( const std::vector<AliCaloBunchInfo> &bunchvector ) const;
   void PrintBunch( const AliCaloBunchInfo &bunch ) const ;
-
-  virtual int PreFitEvaluateSamples( const vector<AliCaloBunchInfo>  &bunchvector, 
+  
+  virtual 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);
   void SetTimeConstraint(const int min, const int max );
@@ -66,25 +56,38 @@ class  AliCaloRawAnalyzer : public TObject
   void SetAmpCut(const Float_t cut) { fAmpCut = cut ; } ;
   void SetFitArrayCut(const Int_t cut) { fFitArrayCut = cut ; } ;
   void SetNsampleCut(const Int_t cut) { fNsampleCut = cut ; } ;
+  void SetOverflowCut(const Int_t cut) { fOverflowCut = cut ; } ;
   void SetNsamplePed(const Int_t i) { fNsamplePed = i ; } ;
 
   bool GetIsZeroSuppressed() const { return fIsZerosupressed;} ;
   Float_t GetAmpCut() const { return fAmpCut; } ;
   Int_t GetFitArrayCut() const { return fFitArrayCut; } ;
   Int_t GetNsampleCut() const { return fNsampleCut; } ;
+  Int_t GetOverflowCut() const { return fOverflowCut; } ;
   Int_t GetNsamplePed() const { return fNsamplePed; } ;
 
   // access to array info
   Double_t GetReversed(const int i) const { return fReversed[i]; }
   const char * GetAlgoName() const { return fName;  };
   const char * GetAlgoAbbr() const { return fNameShort;  };
+  Algo::fitAlgorithm GetAlgo() const { return fAlgo; };
+
+  Double_t CalculateChi2(const Double_t amp, const Double_t time,
+                        const Int_t first, const Int_t last,
+                        const Double_t adcErr=1, 
+                        const Double_t tau=2.35);
+
+  void CalculateMeanAndRMS(const Int_t first, const Int_t last,
+                          Double_t & mean, Double_t & rms);
 
  protected:
+public: // PAI
   short Max( const AliCaloBunchInfo *const bunch, int *const maxindex) const;
   UShort_t Max(const UShort_t *data, const int length ) const;
+  bool CheckBunchEdgesForMax( const AliCaloBunchInfo *const bunch) const;
   bool IsInTimeRange( const int maxindex ) const;
   Float_t  ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t altrocfg1,  const UInt_t altrocfg2, double *outarray ) const;
-  int  SelectBunch( const vector<AliCaloBunchInfo> &bunchvector, short *const maxampbin, short *const maxamplitude ) 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;
   Float_t EvaluatePedestal(const UShort_t * const data, const int length ) const;
   
@@ -96,13 +99,18 @@ class  AliCaloRawAnalyzer : public TObject
   int fFitArrayCut;  //Cut on ADC value (after ped. subtraction) for signals used for fit
   Float_t fAmpCut;   //Max ADC - pedestal must be higher than this befor attemting to extract the amplitude 
   int fNsampleCut;   //Minimum number of sample require before attemting to extract signal parameters 
+  int fOverflowCut; // value when ADC starts to saturate
   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;
+  
   ClassDef(AliCaloRawAnalyzer, 2)  
 
 };