]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalibTCF.h
New functions for exporting the found TCF parameters to an ascii-file
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibTCF.h
1 #ifndef ALI_TPC_CALIB_TCF_H
2 #define ALI_TPC_CALIB_TCF_H
3
4
5 /* Copyright(c) 2007-08, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                             */
7
8 ///////////////////////////////////////////////////////////////////////////////
9 //                        Class AliTPCCalibTCF                               //
10 // Class for Extraction and test of TCF parameters needed by the ALTRO chip  //
11 ///////////////////////////////////////////////////////////////////////////////
12
13 #include "TSystem.h"
14
15 class TObject;
16 class TGraph;
17 class AliTPCRawStream;
18 class TNtuple;
19 class TH1F;
20 class TH2F;
21
22 class AliTPCCalibTCF : public TNamed {
23
24 public:
25
26   AliTPCCalibTCF();
27   AliTPCCalibTCF(Int_t gateWidth, Int_t Sample, Int_t pulseLength, Int_t lowPulseLim, Int_t upPulseLim, Double_t rmsLim, Double_t ratioIntLim);
28   AliTPCCalibTCF(const AliTPCCalibTCF &sig);
29   virtual ~AliTPCCalibTCF();
30   
31   AliTPCCalibTCF& operator = (const  AliTPCCalibTCF &source);
32
33  
34   void ProcessRawFile(const char *nameRawFile, const char *nameFileOut);//Int_t *tresholds);
35   void ProcessRawEvent(AliTPCRawStream *rawStream, const char *nameFileOut);
36
37   void MergeHistoPerSector(const char *nameFileIn);
38
39   void AnalyzeRootFile(const char *nameFileIn, Int_t minNumPulse=1, Int_t histStart=1, Int_t histEnd=1000000);
40   Int_t AnalyzePulse(TH1F *hisIn, Double_t *coefZ, Double_t *coefP); 
41
42   void TestTCFonRootFile(const char *nameFileIn, const char *nameFileTCF, Int_t nPulseMin=0, Int_t plotFlag=0, Int_t lowKey=1, Int_t upKey=1000000);
43   void TestTCFonRawFile(const char *nameRawFile, const char *nameFileOut, const char *nameFileTCF, Int_t nPulseMin=0, Int_t plotFlag=0);
44
45   Int_t DumpTCFparamToFilePerSector(const char *nameFileTCFPerSec, const char *nameMappingFile="$ALICE_ROOT/TPC/Calib/tpcMapping.root");  
46   Int_t DumpTCFparamToFilePerPad(const char *nameFileTCFPerPad,const char *nameFileTCFPerSec, const char *nameMappingFile="$ALICE_ROOT/TPC/Calib/tpcMapping.root");  
47  
48   TH2F *PlotOccupSummary2Dhist(const char *nameFileIn, Int_t side=0);
49   void PlotOccupSummary(const char *nameFile, Int_t side=0, Int_t nPulseMin=0); 
50
51   void PlotQualitySummary(const char *nameFileQuality, const char *plotSpec="widthRed:maxUndershot", const char *cut="maxUndershot<0.1&&maxUndershot>-40&&widthRed>0&&widthRed<100", const char *pOpt="LEGO2Z");
52
53   void PrintPulseThresholds();
54
55   void MergeHistoPerFile(const char *fileNameIn, const char *fileSum, Int_t mode=0);
56   void MergeToOneFile(const char *nameFileSum);
57
58 private:
59   
60   // tresholds for proper pulse finder (Analyze functions)
61   Int_t fGateWidth;     // expected Gate fluctuation length
62   Int_t fSample;        // expected usefull signal length
63   Int_t fPulseLength;   // needed pulselength for TC characterisation
64   Int_t fLowPulseLim;   // lower pulse height limit
65   Int_t fUpPulseLim;    // upper pulse height limit
66   Double_t fRMSLim;     // signal RMS limit
67   Double_t fRatioIntLim;// ratio of signal-integral/pulse-integral limit
68
69   Int_t FitPulse(TNtuple *dataTuple, Double_t *coefZ, Double_t *coefP);
70   static void FitFcn(Int_t &nPar, Double_t *grad, Double_t &f, Double_t *par, Int_t iflag);
71
72   Double_t* ExtractPZValues(Double_t *param);
73   Int_t Equalization(TNtuple *dataTuple, Double_t *coefZ, Double_t *coefP);
74
75   Int_t FindCorTCFparam(TH1F *hisIn, const char *nameFileTCF, Double_t *coefZ, Double_t *coefP);
76   Double_t *GetQualityOfTCF(TH1F *hisIn, Double_t *coefZ, Double_t *coefP,Int_t plotFlag=0); 
77
78   TNtuple *ApplyTCFilter(TH1F *hisIn, Double_t *coefZ, Double_t *coefP, Int_t plotFlag=0);
79
80   ClassDef(AliTPCCalibTCF,1);
81
82 };
83 #endif