]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/TPCcalib/AliTPCcalibTracksGain.h
Update in the AliTPCcalibTracksGain (Marian, Stefan)
[u/mrichter/AliRoot.git] / TPC / TPCcalib / 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 TH3F; 
23 class TLinearFitter;
24
25 class AliTPCClusterParam; 
26 class AliTPCParamSR; 
27 class AliTPCCalROC;
28 class AliTPCCalPad;
29 class AliTPCseed; 
30 class AliTPCclusterMI; 
31 class AliTrackPointArray;
32 class TTreeStream;
33 class AliTPCcalibTracksCuts;
34 class AliTPCFitPad;
35
36 class AliTPCcalibTracksGain : public TNamed {
37 private:
38    class PreProcess {
39    public:
40       PreProcess(AliTPCseed* seed);
41       virtual ~PreProcess();
42       
43       AliTPCseed* GetSeed() { return fSeed; }
44       Double_t    GetAngleTrackPadrow(UInt_t segment, UInt_t padType) { return fAngleTrackPadrow[segment + 36*padType]; }
45       Double_t    GetAngleTrackBeam(UInt_t segment, UInt_t padType) { return fAngleTrackBeam[segment + 36*padType]; }
46       Double_t    GetMeanCharge(UInt_t segment, UInt_t padType) { return fMeanCharge[segment + 36*padType]; }
47       Double_t    GetMeanZ(UInt_t segment, UInt_t padType) { return fMeanZ[segment + 36*padType]; }
48       Bool_t      IsClusterAccepted(UInt_t clusterIndex) { return fAcceptedClusters[clusterIndex]; }
49       
50    private:
51       AliTPCseed*  fSeed;                   // the seed used for preprocessing
52       Double_t*    fAngleTrackPadrow;       // angle between the track and the padrows of one TPC pad region, calculated using a line fit through the appropriate clusters
53       Double_t*    fAngleTrackBeam;         // angle between the track and the beam axis, calculated using a line fit through the appropriate clusters
54       Double_t*    fMeanCharge;             // the mean charges for this seed (for each pad region)
55       Double_t*    fMeanZ;                  // the mean z position for this seed (for each pad region)
56       Bool_t       fAcceptedClusters[159];  // contains kFALSE for not accepted clusters, kTRUE for accepted ones (index is padrow)
57    };
58    
59 public:
60    enum {
61       kShortPads = 0,
62       kMediumPads = 1,
63       kLongPads = 2
64    };
65    enum {
66       kSimpleFitter = 0,
67       kSqrtFitter = 1,
68       kLogFitter = 2
69    };
70    
71    AliTPCcalibTracksGain();
72    AliTPCcalibTracksGain(const AliTPCcalibTracksGain& obj);
73    AliTPCcalibTracksGain(const char* name, const char* title, AliTPCcalibTracksCuts* cuts, TNamed* debugStreamPrefix = 0, AliTPCcalibTracksGain* prevIter = 0);
74    virtual ~AliTPCcalibTracksGain();
75    AliTPCcalibTracksGain& operator=(const AliTPCcalibTracksGain& rhs);
76    
77    static void testSeed(char* file = "/d/alice07/sma/v4-06-Rev-03/pp/0201/AliESDs.root", Int_t entry = 87, Int_t track = 0); // LOESCH MICH ODER DU WIRST UNTERGEHEN
78    static void     AddInfo(TChain* chain, char* debugStreamPrefix = 0, char* prevIterFileName = 0);
79    Int_t          AcceptTrack(AliTPCseed* track);
80    void            Terminate();
81    //Bool_t          AcceptCluster(AliTPCclusterMI* cluster);
82    void            Add(AliTPCcalibTracksGain* cal);
83    void            AddTrack(AliTPCseed* seed);
84    void            AddCluster(AliTPCclusterMI* cluster, AliTPCcalibTracksGain::PreProcess& preProc);
85    void            AddCluster2(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);
86    void            Process(AliTPCseed* seed);
87    Long64_t        Merge(TCollection *list);
88    void            Evaluate(Bool_t robust = kFALSE, Double_t frac = -1.);
89    Int_t           Evaluate(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD* fitParam = 0, TVectorD* fitError = 0, Double_t* redChi2 = 0, Bool_t robust = kFALSE, Double_t frac = -1.);
90    void            GetParameters(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitParam);
91    void            GetErrors(UInt_t segment, UInt_t padType, UInt_t fitType, TVectorD &fitError);
92    Double_t        GetRedChi2(UInt_t segment, UInt_t padType, UInt_t fitType);
93    void            GetCovarianceMatrix(UInt_t segment, UInt_t padType, UInt_t fitType, TMatrixD& covMatrix);
94    AliTPCCalPad*   CreateFitCalPad(UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE);
95    AliTPCCalROC*   CreateFitCalROC(UInt_t sector, UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE);
96    AliTPCCalROC*   CreateFitCalROC(UInt_t sector, UInt_t padType, TVectorD &fitParam, UInt_t fitType, Bool_t undoTransformation = kFALSE, Bool_t normalizeToPadSize = kFALSE);
97    AliTPCCalROC*   CreateCombinedCalROC(const AliTPCCalROC* roc1, const AliTPCCalROC* roc2);
98    TLinearFitter*  GetFitter(UInt_t segment, UInt_t padType, UInt_t fitType);
99    static Double_t GetPadLength(Double_t lx);
100    static Int_t    GetPadType(Double_t lx);
101    void            DumpTrack(AliTPCseed* track);
102    Bool_t          GetDedx(AliTPCseed* track, Int_t padType, Int_t* rows);
103    
104    static Bool_t   GetRowPad(Double_t lx, Double_t ly, Int_t& row, Int_t& pad); // just for debugging, remove me
105    UInt_t          fTotalTracks;         // just for debugging, remove me
106    UInt_t          fAcceptedTracks;      // just for debugging, remove me
107    AliTPCCalPad*   fDebugCalPadRaw;      // just for debugging, remove me
108    AliTPCCalPad*   fDebugCalPadCorr;     // just for debugging, remove me
109
110 public:
111    TTreeSRedirector* fDebugStream;          //! debug stream for debugging
112    
113    AliTPCFitPad*     fSimpleFitter;         // simple fitter for short pads
114    AliTPCFitPad*     fSqrtFitter;           // sqrt fitter for medium pads
115    AliTPCFitPad*     fLogFitter;            // log fitter for long pads
116    AliTPCFitPad*     fSingleSectorFitter;   // just for debugging
117
118    AliTPCcalibTracksGain* fPrevIter;        // the calibration object in its previous iteration (will not be owned by the new object, don't forget to delete it!)
119    
120    UInt_t            fNShortClusters[36];   // number of clusters registered on short pads
121    UInt_t            fNMediumClusters[36];  // number of clusters registered on medium pads
122    UInt_t            fNLongClusters[36];    // number of clusters registered on long pads
123    TObjString*       fDebugStreamPrefix;    // pathname of the final location of the debug stream file (may also be an xrootd directory)
124    AliTPCcalibTracksCuts* fCuts;            // cuts that are used for sieving the tracks used for calibration
125
126    static       AliTPCParamSR* fgTPCparam;              //! helper object for geometry related operations
127    static const Double_t       fgkM;                    // value used in the transformation of the charge values for the logarithmic fitter
128    static const char*          fgkDebugStreamFileName;  // filename of the debug stream file
129    static const Bool_t         fgkUseTotalCharge;       // whether to use the cluster's total or maximum charge
130
131    ClassDef(AliTPCcalibTracksGain, 1);
132 };
133
134 #endif