]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - EMCAL/AliCaloRawAnalyzer.h
Factorization of the different raw fitting algorithms in EMCAL (Per Thomas)
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzer.h
... / ...
CommitLineData
1// -*- mode: c++ -*-
2#ifndef ALICALORAWANALYZER_H
3#define ALICALORAWANALYZER_H
4/**************************************************************************
5 * This file is property of and copyright by *
6 * the Relatvistic Heavy Ion Group (RHIG), Yale University, US, 2009 *
7 * *
8 * Primary Author: Per Thomas Hille <p.t.hille@fys.uio.no> *
9 * *
10 * Contributors are mentioned in the code where appropriate. *
11 * Please report bugs to p.t.hille@fys.uio.no *
12 * *
13 * Permission to use, copy, modify and distribute this software and its *
14 * documentation strictly for non-commercial purposes is hereby granted *
15 * without fee, provided that the above copyright notice appears in all *
16 * copies and that both the copyright notice and this permission notice *
17 * appear in the supporting documentation. The authors make no claims *
18 * about the suitability of this software for any purpose. It is *
19 * provided "as is" without express or implied warranty. *
20 **************************************************************************/
21
22//Base class for extraction
23//of signal amplitude and peak position
24//From CALO Calorimeter RAW data
25#include "Rtypes.h"
26#include "TObject.h"
27///#define MAXSAMPLES 1008 //CRAP PTH
28#include <vector>
29#include "AliCaloConstants.h"
30using namespace ALTRO;
31using namespace CALO;
32
33
34class AliCaloBunchInfo;
35#include "AliCaloFitResults.h"
36
37class AliCaloRawAnalyzer : public TObject
38{
39 friend class AliCaloRawAnalyzerFactory;
40
41 public:
42 AliCaloRawAnalyzer(const char *name="AliCaloRawAnalyzer", const char *nameshort="RawAna");
43 virtual ~AliCaloRawAnalyzer();
44 virtual AliCaloFitResults Evaluate( const std::vector<AliCaloBunchInfo> &/*bunchvector*/,
45 const UInt_t /*altrocfg1*/, const UInt_t /*altrocfg2*/ ) {return AliCaloFitResults( Ret::kInvalid , Ret::kInvalid);}
46 //enum fitAlgorithm {kCrude, kPeakFinder, kLMS, kFastFit, kNeuralNet, kNONE};
47 void PrintBunches( const std::vector<AliCaloBunchInfo> &bunchvector ) const;
48 void PrintBunch( const AliCaloBunchInfo &bunch ) const ;
49
50 int PreFitEvaluateSamples( const std::vector<AliCaloBunchInfo> &bunchvector,
51 const UInt_t altrocfg1, const UInt_t altrocfg2, Int_t & index,
52 Float_t & maxf, short & maxamp, short & maxampindex,
53 Float_t & ped, int & first, int & last, const int acut);
54
55 void SetTimeConstraint(const int min, const int max );
56 void SetVerbose(bool verbose = true){ fVerbose = verbose; };
57 void SetIsZeroSuppressed(const bool iszs = true) { fIsZerosupressed = iszs; } ;
58 void SetAmpCut(const Float_t cut) { fAmpCut = cut ; } ;
59 void SetFitArrayCut(const Int_t cut) { fFitArrayCut = cut ; } ;
60 void SetNsampleCut(const Int_t cut) { fNsampleCut = cut ; } ;
61 void SetOverflowCut(const Int_t cut) { fOverflowCut = cut ; } ;
62 void SetNsamplePed(const Int_t i) { fNsamplePed = i ; } ;
63
64 bool GetIsZeroSuppressed() const { return fIsZerosupressed;} ;
65 Float_t GetAmpCut() const { return fAmpCut; } ;
66 Int_t GetFitArrayCut() const { return fFitArrayCut; } ;
67 Int_t GetNsampleCut() const { return fNsampleCut; } ;
68 Int_t GetOverflowCut() const { return fOverflowCut; } ;
69 Int_t GetNsamplePed() const { return fNsamplePed; } ;
70
71 // access to array info
72 Double_t GetReversed(const int i) const { return fReversed[i]; }
73 const char * GetAlgoName() const { return fName; };
74 const char * GetAlgoAbbr() const { return fNameShort; };
75 Algo::fitAlgorithm GetAlgo() const { return fAlgo; };
76
77 Double_t CalculateChi2(const Double_t amp, const Double_t time,
78 const Int_t first, const Int_t last,
79 const Double_t adcErr=1,
80 const Double_t tau=2.35);
81
82 void CalculateMeanAndRMS(const Int_t first, const Int_t last,
83 Double_t & mean, Double_t & rms);
84 void SetL1Phase(const Double_t phase) {fL1Phase = phase;};
85
86protected:
87public: // PAI
88 short Max( const AliCaloBunchInfo *const bunch, int *const maxindex);
89 UShort_t Max(const UShort_t *data, const int length );
90 bool CheckBunchEdgesForMax( const AliCaloBunchInfo *const bunch) const;
91 bool IsInTimeRange( const int maxindex, const int maxtime, const int mintime );
92 Float_t ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t altrocfg1, const UInt_t altrocfg2, double *outarray ) const;
93 int SelectBunch( const std::vector<AliCaloBunchInfo> &bunchvector, short *const maxampbin, short *const maxamplitude );
94 void SelectSubarray( const Double_t *date, const int length, const short maxindex, int *const first, int *const last, const int cut);
95 Float_t EvaluatePedestal(const UShort_t * const data, const int length ) const;
96 Double_t fReversed[ALTROMAXSAMPLES]; //Reversed sequence of samples (pedestalsubtracted)
97 // private:
98 int fMinTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
99 int fMaxTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
100 int fFitArrayCut; //Cut on ADC value (after ped. subtraction) for signals used for fit
101 Float_t fAmpCut; //Max ADC - pedestal must be higher than this befor attemting to extract the amplitude
102 int fNsampleCut; //Minimum number of sample require before attemting to extract signal parameters
103 int fOverflowCut; // value when ADC starts to saturate
104 int fNsamplePed; //Number of samples used for pedestal calculation (first in bunch)
105 bool fIsZerosupressed; //Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracted if set to true
106 bool fVerbose; //Print debug information to std out if set to true
107 char fName[256]; // Name of the algorithm
108 char fNameShort[256]; // Abbrevation for the name
109 // CaloConstants fAlgo;
110 Algo::fitAlgorithm fAlgo;
111 // FILE *fFp;
112 Double_t fL1Phase;
113
114 Double_t fAmp; // The amplitude in entities of ADC counts
115 Double_t fTof; // The amplitude in entities of ADC counts
116
117 ClassDef(AliCaloRawAnalyzer, 2)
118
119};
120
121#endif