Go to the documentation of this file.00001 #ifndef TPEDESTALEXTRACTOR_H
00002 #define TPEDESTALEXTRACTOR_H
00003
00004 #include "TH1.h"
00005 #include "TH2.h"
00006
00007 class TPedestalExtractor {
00008 private:
00009 typedef TH1F THistogramType;
00010 static const Int_t fkEntriesMin = 100;
00011 static const Double_t fkInvalidPedestalValue = -1000.0;
00012 static const Double_t fkInvalidWidthValue = -1000.0;
00013 Int_t fNRocs;
00014 Int_t fNNxs;
00015 Int_t fNChannels;
00016 THistogramType* fHistograms;
00017 Double_t* fPedestals;
00018 Double_t* fWidths;
00019 Int_t IndexEnc( Int_t iRoc, Int_t iNx, Int_t iChannel ) { return iChannel + iNx * fNChannels + iRoc * fNChannels * fNNxs ; }
00020 void IndexDec( Int_t index, Int_t& iRoc, Int_t& iNx, Int_t& iChannel );
00021 Int_t IndexMax() { return fNRocs * fNNxs * fNChannels -1; }
00022 bool TestValid( Int_t iRoc, Int_t iNx, Int_t iChannel );
00023
00024 public:
00025 TPedestalExtractor( Int_t nRocs = 8, Int_t nNxs = 4, Int_t nChannels = 128, Int_t nAdcBins = 4096, Double_t adcMin = 0.0, Double_t adcMax = 4096.0);
00026 virtual ~TPedestalExtractor();
00027 void AddHit ( Int_t iRoc, Int_t iNx, Int_t iChannel, Int_t adc);
00028 void Extract();
00029 static void Extract( TH1* hist, Double_t& pedestal, Double_t& width );
00030 void Reset();
00031 Double_t GetPedestal( Int_t iRoc, Int_t iNx, Int_t iChannel );
00032
00033 TH1* GetHistogram( Int_t iRoc, Int_t iNx, Int_t iChannel );
00034 void Print();
00035 Int_t GetNxNum() { return fNNxs; }
00036
00037 ClassDef(TPedestalExtractor, 1)
00038 };
00039
00040 #endif // #ifndef TPEDESTALEXTRACTOR_H