peak finder code from Per Thomas/Yale
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRawAnalyzer.h
CommitLineData
d655d7dd 1#ifndef ALIEMCALRAWANALYZER_H
2#define ALIEMCALRAWANALYZER_H
3/**************************************************************************
4 * This file is property of and copyright by *
5 * the Relatvistic Heavy Ion Group (RHIG), Yale University, US, 2009 *
6 * *
7 * Primary Author: Per Thomas Hille <p.t.hille@fys.uio.no> *
8 * *
9 * Contributors are mentioned in the code where appropriate. *
10 * Please report bugs to p.t.hille@fys.uio.no *
11 * *
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 **************************************************************************/
20
21//Base class for extraction
22//of signal amplitude and peak position
23//From EMCAL Calorimeter RAW data
24
25
26#include "Rtypes.h"
27#include "TObject.h"
28#include <vector>
29using namespace std;
30
31#define MAXSAMPLES 1008 //CRAP PTH
32#include "AliEMCALRawAnalyzer.h"
33
34class AliEMCALBunchInfo;
35class AliEMCALFitResults;
36
37
38class AliEMCALRawAnalyzer : public TObject
39{
40 public:
41 AliEMCALRawAnalyzer();
42 virtual ~AliEMCALRawAnalyzer();
43 virtual AliEMCALFitResults Evaluate( const vector<AliEMCALBunchInfo> &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ) = 0;
44
45 void PrintBunches( const vector<AliEMCALBunchInfo> &bunchvector ) const;
46 void PrintBunch( const AliEMCALBunchInfo &bunch ) const ;
47
48 void SetTimeConstraint(const int min, const int max );
49 void SetVerbose(bool verbose = true){ fVerbose = verbose; };
50 void SetIsZeroSuppressed(const bool iszs = true) { fIsZerosupressed = iszs; } ;
51 void SetAmpCut(const Float_t cut) { fAmpCut = cut ; } ;
52
53 protected:
54 short Max( const AliEMCALBunchInfo *const bunch, int *const maxindex) const;
55 UShort_t Max(const UShort_t *data, const int length ) const;
56 bool IsInTimeRange( const int maxindex ) const;
57 Float_t ReverseAndSubtractPed( const AliEMCALBunchInfo *bunch, const UInt_t altrocfg1, const UInt_t altrocfg2, double *outarray ) const;
58 int SelectBunch( const vector<AliEMCALBunchInfo> &bunchvector, short *const maxampbin, short *const maxamplitude ) const;
59 void SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first, int *const last ) const;
60
61 Double_t fReversed[MAXSAMPLES]; //Reversed sequence of samples (pedestalsubtracted)
62
63 // private:
64 int fMinTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
65 int fMaxTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex
66 int fFitArrayCut; //Cut on ADC value (after ped. subtraction) for signals used for fit
67 Float_t fAmpCut; //Max ADC - pedestal must be higher than this befor attemting to extract the amplitude
68 int fNsampleCut; //Minimum number of sample require before attemting to extract signal parameters
69 bool fIsZerosupressed; //Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracted if set to true
70 bool fVerbose; //Print debug information to std out if set to true
71
72};
73
74#endif