]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCcalibTracksGain.h
Possibility to register data - AliTPCselector*
[u/mrichter/AliRoot.git] / TPC / AliTPCcalibTracksGain.h
1 #ifndef AliTPCCALIBTRACKSGAIN_H
2 #define AliTPCCALIBTRACKSGAIN_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 #include <TChain.h>
8 #include <TNamed.h>
9
10
11 #include <TObjArray.h>
12 #include <TH2D.h>
13 #include <TVectorD.h>
14 #include <TMatrixD.h>
15
16 #include <iostream>
17 #include <TH1F.h>
18
19 using namespace std;
20
21 class TTreeSRedirector;
22 class TObjString;
23 class TLinearFitter;
24 class TProfile; 
25 class TProfile2D; 
26 class TH1F; 
27
28 class AliTPCClusterParam; 
29 class AliTPCParamSR; 
30 class AliTPCCalROC;
31 class AliTPCCalPad;
32 class AliTPCseed; 
33 class AliTPCclusterMI; 
34 class AliTrackPointArray;
35 class TTreeStream;
36 class AliTPCcalibTracksCuts;
37 class AliTPCFitPad;
38
39 class AliTPCcalibTracksGain : public TNamed {
40 public:
41    enum {
42       kShortPads = 0,
43       kMediumPads = 1,
44       kLongPads = 2
45    };
46    enum {
47       kSimpleFitter = 0,
48       kSqrtFitter = 1,
49       kLogFitter = 2
50    };
51    
52   AliTPCcalibTracksGain();
53   AliTPCcalibTracksGain(const AliTPCcalibTracksGain& obj);
54   AliTPCcalibTracksGain(const char* name, const char* title, AliTPCcalibTracksCuts* cuts, TNamed* debugStreamPrefix = 0, AliTPCcalibTracksGain* prevIter = 0);
55   virtual ~AliTPCcalibTracksGain();
56   AliTPCcalibTracksGain& operator=(const AliTPCcalibTracksGain& rhs);
57   static void     AddInfo(TChain* chain, char* debugStreamPrefix = 0, char* prevIterFileName = 0);
58   void            Terminate();
59   //
60   // Tracks manipulation
61   //
62   void            Process(AliTPCseed* seed);
63   void            AddTrack(AliTPCseed* seed);
64   Bool_t          AcceptTrack(AliTPCseed* track);
65   void            DumpTrack(AliTPCseed* track);
66   Bool_t          GetDedx(AliTPCseed* track, Int_t padType,  Int_t*rows,
67                           Int_t &sector, Int_t& npoints, 
68                           TVectorD &dedxM, TVectorD &dedxQ, 
69                           TVectorD &parY, TVectorD &parZ, TVectorD & meanPos);
70   void            AddCluster(AliTPCclusterMI* cluster, Float_t momenta, Float_t mdedx, Int_t padType, Float_t xcenter, TVectorD &dedxQ, TVectorD & dedxM, Float_t fraction, Float_t fraction2, Float_t dedge, TVectorD& parY, TVectorD& parZ, TVectorD& meanPos);
71   void            AddTracklet(UInt_t sector, UInt_t padType,TVectorD &dedxQ, TVectorD &dedxM,TVectorD& parY, TVectorD& parZ, TVectorD& meanPos);
72
73   void            AddCluster(AliTPCclusterMI* cluster);
74
75   //
76   // Merging of the component
77   //
78   Long64_t        Merge(TCollection *list);
79   void            Add(AliTPCcalibTracksGain* cal);
80   //
81   // Histogram part
82   //
83   TH1F  * GetQM(Int_t sector=-1){return (TH1F*)(sector<0 ?  fArrayQM->At(72): fArrayQM->At(sector));}
84   TH1F  * GetQT(Int_t sector=-1){return (TH1F*)(sector<0 ?  fArrayQT->At(72): fArrayQT->At(sector));}
85   TProfile* GetProfileQM(Int_t sector){return (TProfile*)(sector<0 ? fProfileArrayQM->At(36): fProfileArrayQM->At(sector));}
86   TProfile* GetProfileQT(Int_t sector){return (TProfile*)(sector<0 ? fProfileArrayQT->At(36): fProfileArrayQT->At(sector));}
87   TProfile2D* GetProfileQM2D(Int_t sector){return (TProfile2D*)(sector<0 ? fProfileArrayQM2D->At(36): fProfileArrayQM2D->At(sector));}
88   TProfile2D* GetProfileQT2D(Int_t sector){return (TProfile2D*)(sector<0 ? fProfileArrayQT2D->At(36): fProfileArrayQT2D->At(sector));}
89   //
90   // Get Derived results - gain maps
91   //
92   AliTPCCalPad*   CreateFitCalPad(UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE);
93   AliTPCCalROC*   CreateFitCalROC(UInt_t sector, UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE);
94   AliTPCCalROC*   CreateFitCalROC(UInt_t sector, UInt_t padType, TVectorD &fitParam, UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE);
95   AliTPCCalROC*   CreateCombinedCalROC(const AliTPCCalROC* roc1, const AliTPCCalROC* roc2);
96   //
97   void            Evaluate(Bool_t robust = kFALSE, Double_t frac = -1.);
98   void            GetParameters(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitParam);
99   void            GetErrors(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitError);
100   Double_t        GetRedChi2(UInt_t segment, UInt_t padType, UInt_t fitType);
101   void            GetCovarianceMatrix(UInt_t segment, UInt_t padType, UInt_t fitType, TMatrixD& covMatrix);
102   TLinearFitter*  GetFitter(UInt_t segment, UInt_t padType, UInt_t fitType);
103 public:
104   //
105   // Helper function
106   //
107   static Double_t GetPadLength(Double_t lx);
108   static Int_t    GetPadType(Double_t lx);  
109   static Bool_t   GetRowPad(Double_t lx, Double_t ly, Int_t& row, Int_t& pad); // just for debugging
110   //
111   //
112   TTreeSRedirector* fDebugStream;          //! debug stream for debugging
113   AliTPCcalibTracksCuts* fCuts;            // cuts that are used for sieving the tracks used for calibration
114   //
115   // Simple Profiles and histograms - per chambers + 1 total
116   //
117   TObjArray*        fArrayQM;                // Qmax normalized
118   TObjArray*        fArrayQT;                // Qtot normalized 
119   TObjArray*        fProfileArrayQM;         // Qmax normalized  versus local X
120   TObjArray*        fProfileArrayQT;         // Qtot normalized  versus local X 
121   TObjArray*        fProfileArrayQM2D;       // Qmax normalized  versus local X and phi
122   TObjArray*        fProfileArrayQT2D;       // Qtot normalized  versus local X and phi
123   //
124   // Fitters
125   //
126   AliTPCFitPad*     fSimpleFitter;         // simple fitter for short pads
127   AliTPCFitPad*     fSqrtFitter;           // sqrt fitter for medium pads
128   AliTPCFitPad*     fLogFitter;            // log fitter for long pads
129   TLinearFitter*    fFitter0M;          // fitting of the atenuation, angular correction, and mean chamber gain
130   TLinearFitter*    fFitter1M;          // fitting of the atenuation, angular correction, and mean chamber gain
131   TLinearFitter*    fFitter2M;          // fitting of the atenuation, angular correction, and mean chamber gain
132   TLinearFitter*    fFitter0T;          // fitting of the atenuation, angular correction, and mean chamber gain
133   TLinearFitter*    fFitter1T;          // fitting of the atenuation, angular correction, and mean chamber gain
134   TLinearFitter*    fFitter2T;          // fitting of the atenuation, angular correction, and mean chamber gain
135   AliTPCFitPad*     fSingleSectorFitter;   // just for debugging
136   //
137   // Conters
138   //
139   UInt_t          fTotalTracks;         // just for debugging
140   UInt_t          fAcceptedTracks;      // just for debugging
141   AliTPCCalPad*   fDebugCalPadRaw;      // just for debugging
142   AliTPCCalPad*   fDebugCalPadCorr;     // just for debugging
143   UInt_t          fNShortClusters[36];   // number of clusters registered on short pads
144   UInt_t          fNMediumClusters[36];  // number of clusters registered on medium pads
145   UInt_t          fNLongClusters[36];    // number of clusters registered on long pads
146   //
147   //
148   AliTPCcalibTracksGain* fPrevIter;        // the calibration object in its previous iteration (will not be owned by the new object, don't forget to delete it!)    
149   //
150   // Setup
151   //
152    static       AliTPCParamSR* fgTPCparam;              //! helper object for geometry related operations
153    static const Double_t       fgkM;                    // value used in the transformation of the charge values for the logarithmic fitter
154    static const char*          fgkDebugStreamFileName;  // filename of the debug stream file
155    static const Bool_t         fgkUseTotalCharge;       // whether to use the cluster's total or maximum charge
156
157    ClassDef(AliTPCcalibTracksGain, 1);
158 };
159
160 #endif