1 #ifndef ALICALORAWANALYZER_H
2 #define ALICALORAWANALYZER_H
3 /**************************************************************************
4 * This file is property of and copyright by *
5 * the Relatvistic Heavy Ion Group (RHIG), Yale University, US, 2009 *
7 * Primary Author: Per Thomas Hille <p.t.hille@fys.uio.no> *
9 * Contributors are mentioned in the code where appropriate. *
10 * Please report bugs to p.t.hille@fys.uio.no *
12 * Permission to use, copy, modify and distribute this software and its *
13 * documentation strictly for non-commercial purposes is hereby granted *
14 * without fee, provided that the above copyright notice appears in all *
15 * copies and that both the copyright notice and this permission notice *
16 * appear in the supporting documentation. The authors make no claims *
17 * about the suitability of this software for any purpose. It is *
18 * provided "as is" without express or implied warranty. *
19 **************************************************************************/
22 //Base class for extraction
23 //of signal amplitude and peak position
24 //From CALO Calorimeter RAW data
30 #define MAXSAMPLES 1008 //CRAP PTH
34 class AliCaloBunchInfo;
35 class AliCaloFitResults;
37 class AliCaloRawAnalyzer : public TObject
40 AliCaloRawAnalyzer(const char *name="AliCaloRawAnalyzer", const char *nameshort="RawAna");
41 virtual ~AliCaloRawAnalyzer();
42 virtual AliCaloFitResults Evaluate( const std::vector<AliCaloBunchInfo> &bunchvector,
43 const UInt_t altrocfg1, const UInt_t altrocfg2 );
45 void PrintBunches( const std::vector<AliCaloBunchInfo> &bunchvector ) const;
46 void PrintBunch( const AliCaloBunchInfo &bunch ) const ;
48 virtual int PreFitEvaluateSamples( const std::vector<AliCaloBunchInfo> &bunchvector,
49 const UInt_t altrocfg1, const UInt_t altrocfg2, Int_t & index,
50 Float_t & maxf, short & maxamp, short & maxampindex, Float_t & ped, int & first, int & last);
51 void SetTimeConstraint(const int min, const int max );
52 void SetVerbose(bool verbose = true){ fVerbose = verbose; };
53 void SetIsZeroSuppressed(const bool iszs = true) { fIsZerosupressed = iszs; } ;
54 void SetAmpCut(const Float_t cut) { fAmpCut = cut ; } ;
55 void SetFitArrayCut(const Int_t cut) { fFitArrayCut = cut ; } ;
56 void SetNsampleCut(const Int_t cut) { fNsampleCut = cut ; } ;
57 void SetNsamplePed(const Int_t i) { fNsamplePed = i ; } ;
59 bool GetIsZeroSuppressed() const { return fIsZerosupressed;} ;
60 Float_t GetAmpCut() const { return fAmpCut; } ;
61 Int_t GetFitArrayCut() const { return fFitArrayCut; } ;
62 Int_t GetNsampleCut() const { return fNsampleCut; } ;
63 Int_t GetNsamplePed() const { return fNsamplePed; } ;
65 // access to array info
66 Double_t GetReversed(const int i) const { return fReversed[i]; }
67 const char * GetAlgoName() const { return fName; };
68 const char * GetAlgoAbbr() const { return fNameShort; };
71 short Max( const AliCaloBunchInfo *const bunch, int *const maxindex) const;
72 UShort_t Max(const UShort_t *data, const int length ) const;
73 bool CheckBunchEdgesForMax( const AliCaloBunchInfo *const bunch) const;
74 bool IsInTimeRange( const int maxindex ) const;
75 Float_t ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t altrocfg1, const UInt_t altrocfg2, double *outarray ) const;
76 int SelectBunch( const std::vector<AliCaloBunchInfo> &bunchvector, short *const maxampbin, short *const maxamplitude ) const;
77 virtual void SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first, int *const last ) const;
78 Float_t EvaluatePedestal(const UShort_t * const data, const int length ) const;
80 Double_t fReversed[MAXSAMPLES]; //Reversed sequence of samples (pedestalsubtracted)
83 int fMinTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
84 int fMaxTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
85 int fFitArrayCut; //Cut on ADC value (after ped. subtraction) for signals used for fit
86 Float_t fAmpCut; //Max ADC - pedestal must be higher than this befor attemting to extract the amplitude
87 int fNsampleCut; //Minimum number of sample require before attemting to extract signal parameters
88 int fNsamplePed; //Number of samples used for pedestal calculation (first in bunch)
89 bool fIsZerosupressed; //Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracted if set to true
90 bool fVerbose; //Print debug information to std out if set to true
92 char fName[256]; // Name of the algorithm
93 char fNameShort[256]; // Abbrevation for the name
95 ClassDef(AliCaloRawAnalyzer, 2)