]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliCaloRawAnalyzer.h
added settings for magnetic field
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzer.h
CommitLineData
168c7b3c 1// -*- mode: c++ -*-
57839add 2#ifndef ALICALORAWANALYZER_H
3#define ALICALORAWANALYZER_H
d655d7dd 4/**************************************************************************
5 * This file is property of and copyright by *
e37e3c84 6 * the Relatvistic Heavy Ion Group (RHIG), Yale University, US, 2009 *
d655d7dd 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
57839add 22
d655d7dd 23//Base class for extraction
24//of signal amplitude and peak position
57839add 25//From CALO Calorimeter RAW data
d655d7dd 26
d655d7dd 27#include "Rtypes.h"
28#include "TObject.h"
d655d7dd 29#define MAXSAMPLES 1008 //CRAP PTH
e37e3c84 30#include <vector>
168c7b3c 31#include "AliCaloConstants.h"
32
33//using namespace CaloConstants::FitAlgorithm;
34//using CaloConstants::ReturnCodes;
d655d7dd 35
57839add 36class AliCaloBunchInfo;
37class AliCaloFitResults;
d655d7dd 38
57839add 39class AliCaloRawAnalyzer : public TObject
d655d7dd 40{
41 public:
48a2e3eb 42 AliCaloRawAnalyzer(const char *name="AliCaloRawAnalyzer", const char *nameshort="RawAna");
57839add 43 virtual ~AliCaloRawAnalyzer();
ce95bae9 44 virtual AliCaloFitResults Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector,
168c7b3c 45 const UInt_t altrocfg1, const UInt_t altrocfg2 ) = 0;
46 //enum fitAlgorithm {kCrude, kPeakFinder, kLMS, kFastFit, kNeuralNet, kNONE};
ce95bae9 47 void PrintBunches( const std::vector<AliCaloBunchInfo> &bunchvector ) const;
57839add 48 void PrintBunch( const AliCaloBunchInfo &bunch ) const ;
168c7b3c 49
ce95bae9 50 virtual int PreFitEvaluateSamples( const std::vector<AliCaloBunchInfo> &bunchvector,
e37e3c84 51 const UInt_t altrocfg1, const UInt_t altrocfg2, Int_t & index,
52 Float_t & maxf, short & maxamp, short & maxampindex, Float_t & ped, int & first, int & last);
d655d7dd 53 void SetTimeConstraint(const int min, const int max );
54 void SetVerbose(bool verbose = true){ fVerbose = verbose; };
55 void SetIsZeroSuppressed(const bool iszs = true) { fIsZerosupressed = iszs; } ;
56 void SetAmpCut(const Float_t cut) { fAmpCut = cut ; } ;
57839add 57 void SetFitArrayCut(const Int_t cut) { fFitArrayCut = cut ; } ;
58 void SetNsampleCut(const Int_t cut) { fNsampleCut = cut ; } ;
2cd0ffda 59 void SetOverflowCut(const Int_t cut) { fOverflowCut = cut ; } ;
f57baa2d 60 void SetNsamplePed(const Int_t i) { fNsamplePed = i ; } ;
61
62 bool GetIsZeroSuppressed() const { return fIsZerosupressed;} ;
63 Float_t GetAmpCut() const { return fAmpCut; } ;
64 Int_t GetFitArrayCut() const { return fFitArrayCut; } ;
65 Int_t GetNsampleCut() const { return fNsampleCut; } ;
2cd0ffda 66 Int_t GetOverflowCut() const { return fOverflowCut; } ;
f57baa2d 67 Int_t GetNsamplePed() const { return fNsamplePed; } ;
57839add 68
69 // access to array info
70 Double_t GetReversed(const int i) const { return fReversed[i]; }
e37e3c84 71 const char * GetAlgoName() const { return fName; };
48a2e3eb 72 const char * GetAlgoAbbr() const { return fNameShort; };
168c7b3c 73 Algo::fitAlgorithm GetAlgo() const { return fAlgo; };
d655d7dd 74
947c8e28 75 Double_t CalculateChi2(const Double_t amp, const Double_t time,
76 const Int_t first, const Int_t last,
77 const Double_t adcErr=1,
78 const Double_t tau=2.35);
79
80 void CalculateMeanAndRMS(const Int_t first, const Int_t last,
81 Double_t & mean, Double_t & rms);
82
d655d7dd 83 protected:
3d841a9f 84public: // PAI
57839add 85 short Max( const AliCaloBunchInfo *const bunch, int *const maxindex) const;
d655d7dd 86 UShort_t Max(const UShort_t *data, const int length ) const;
507751ce 87 bool CheckBunchEdgesForMax( const AliCaloBunchInfo *const bunch) const;
d655d7dd 88 bool IsInTimeRange( const int maxindex ) const;
57839add 89 Float_t ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t altrocfg1, const UInt_t altrocfg2, double *outarray ) const;
ce95bae9 90 int SelectBunch( const std::vector<AliCaloBunchInfo> &bunchvector, short *const maxampbin, short *const maxamplitude ) const;
e37e3c84 91 virtual void SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first, int *const last ) const;
57839add 92 Float_t EvaluatePedestal(const UShort_t * const data, const int length ) const;
d655d7dd 93
94 Double_t fReversed[MAXSAMPLES]; //Reversed sequence of samples (pedestalsubtracted)
95
96 // private:
97 int fMinTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
98 int fMaxTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
99 int fFitArrayCut; //Cut on ADC value (after ped. subtraction) for signals used for fit
100 Float_t fAmpCut; //Max ADC - pedestal must be higher than this befor attemting to extract the amplitude
101 int fNsampleCut; //Minimum number of sample require before attemting to extract signal parameters
2cd0ffda 102 int fOverflowCut; // value when ADC starts to saturate
f57baa2d 103 int fNsamplePed; //Number of samples used for pedestal calculation (first in bunch)
d655d7dd 104 bool fIsZerosupressed; //Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracted if set to true
105 bool fVerbose; //Print debug information to std out if set to true
57839add 106
e37e3c84 107 char fName[256]; // Name of the algorithm
48a2e3eb 108 char fNameShort[256]; // Abbrevation for the name
168c7b3c 109
e37e3c84 110
168c7b3c 111 // CaloConstants fAlgo;
112 Algo::fitAlgorithm fAlgo;
113
f57baa2d 114 ClassDef(AliCaloRawAnalyzer, 2)
e37e3c84 115
d655d7dd 116};
117
118#endif