]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/TPCcalib/AliTPCcalibTracks.h
TPC module
[u/mrichter/AliRoot.git] / TPC / TPCcalib / AliTPCcalibTracks.h
index 836b1de8862d9531f3e9db79bac5b88e0f0879ea..e486a1c4a31e343198081dcf1b8a4c75ee1ad83d 100644 (file)
 #define AliTPCCALIBTRACKS_H
 
 
-#include <TNamed.h>
-#include <TH2D.h>
-#include <TF2.h>
-#include <TSystem.h>
-#include <TCollection.h>
-#include <iostream>
-using namespace std;
-
-// #include "AliTPCClusterParam.h"
-
-
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//     Class to analyse tracks for calibration                               //
+//    to be used as a component in AliTPCSelectorTracks                     //
+//     In the constructor you have to specify name and title                 //
+//     to get the Object out of a file.                                      //
+//     The parameter 'clusterParam', a AliTPCClusterParam object             //
+//      (needed for TPC cluster error and shape parameterization)            //
+//     Normally you get this object out of the file 'TPCClusterParam.root'   //
+//     In the parameter 'cuts' the cuts are specified, that decide           //
+//     weather a track will be accepted for calibration or not.              //
+//                                                                           //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+
+
+#include <AliTPCcalibBase.h>
+#include "THnSparse.h"
+
+class TF2;
+class TH3F;
+class TH1F;
+class TH1I;
+class TH2I;
+class TH2D;
+class TCollection;
+class TTreeSRedirector;
+class TLinearFitter;
 class AliTPCClusterParam;
 class TTreeSRedirector;
 class AliTPCROC;
 class AliTPCseed;
 class AliESDtrack;
-class TH3F;
-class TH1F;
-class TH1I;
-class TTreeSRedirector;
+class AliTPCclusterMI;
 class AliTPCcalibTracksCuts;
+class AliTPCCalPad;
+class TChain;
+class TTree;
+class TMutex;
+class AliESDEvent;
 
+using namespace std;
 
-class AliTPCcalibTracks : public TNamed {
+class AliTPCcalibTracks : public AliTPCcalibBase {
 public :
-   AliTPCcalibTracks();
-   AliTPCcalibTracks(AliTPCcalibTracks* ct);
-   AliTPCcalibTracks(const Text_t *name, const Text_t *title, AliTPCClusterParam *clusterParam, AliTPCcalibTracksCuts* cuts);
-   virtual ~AliTPCcalibTracks();
-   
-   void            Process(AliTPCseed *track, AliESDtrack *esd);
-   
-   Float_t         TPCBetheBloch(Float_t bg);
-   Bool_t          AcceptTrack(AliTPCseed * track); 
-   void            FillHistoCluster(AliTPCseed * track);
-   void            FillResolutionHistoLocal(AliTPCseed * track);
-   void            AlignUpDown(AliTPCseed * track, AliESDtrack *esd);
-   static  Int_t   GetBin(Float_t q, Int_t pad);
-   static  Int_t   GetBin(Int_t  iq, Int_t pad);
-   static  Float_t GetQ(Int_t bin);
-   static  Float_t GetPad(Int_t bin){return bin%3;}
-
-   Long64_t Merge(TCollection *li);
-   static AliTPCcalibTracks* TestMerge(AliTPCcalibTracks *ct, AliTPCClusterParam *clusterParam, Int_t nCalTracks = 50);
-   void     MakeReport(Int_t stat, char* pathName = "plots");
-   void     MakeAmpPlots(Int_t stat, char* pathName = "plots");
-   void     MakeDeltaPlots(char* pathName = "plots");
-   void     FitResolutionNew(char* pathName = "plots");
-   void     FitRMSNew(char* pathName = "plots");
-   void     MakeResPlotsQ(Int_t minEntries = 1,  Bool_t bDraw=kFALSE, char* pathName = "plots"); 
-   void     MakeResPlotsQTree(Int_t minEntries = 1, char* pathName = "plots"); 
-   void     Draw(Option_t* opt);
-   void     SetStyle();
-
-   static TH2D      *MakeDiff(TH2D * hfit, TF2 * func);
-   static TObjArray *FitProjections(TH3F * hfit, Int_t val = 2, Int_t minEntry=500, Bool_t bDraw=kFALSE);
-   
-//protected:   
-   TObjArray* GetfArrayAmpRow() {return fArrayAmpRow;}
-   TObjArray* GetfArrayAmp() {return fArrayAmp;}
-   TObjArray* GetfArrayQDY() {return fArrayQDY;}
-   TObjArray* GetfArrayQDZ() {return fArrayQDZ;}
-   TObjArray* GetfArrayQRMSY() {return fArrayQRMSY;}
-   TObjArray* GetfArrayQRMSZ() {return fArrayQRMSZ;}
-   TH1F*      GetfDeltaY() {return fDeltaY;}
-   TH1F*      GetfDeltaZ() {return fDeltaZ;}
-   TObjArray* GetfResolY() {return fResolY;}
-   TObjArray* GetfResolZ() {return fResolZ;}
-   TObjArray* GetfRMSY() {return fRMSY;}
-   TObjArray* GetfRMSZ() {return fRMSZ;}
-   TH1I*      GetfHclus() {return fHclus;}
-   AliTPCcalibTracksCuts* GetCuts() {return fCuts;}
+   AliTPCcalibTracks();                         // default constructor
+  AliTPCcalibTracks(const AliTPCcalibTracks&calibTracks); // copy constructor
+  AliTPCcalibTracks(const Text_t *name, const Text_t *title, AliTPCClusterParam *clusterParam, AliTPCcalibTracksCuts* cuts, Int_t logLevel = 0);
+  AliTPCcalibTracks & operator=(const AliTPCcalibTracks& calibTracks);
+  
+  virtual ~AliTPCcalibTracks();                // destructor
+  
+  virtual void            Process(AliTPCseed *track);  // to be called by the Selector
+  void     Process(AliESDEvent *event) {AliTPCcalibBase::Process(event);};
+  void     Process(AliESDtrack *track, Int_t runNo=-1){AliTPCcalibBase::Process(track,runNo);};
+  virtual Long64_t Merge(TCollection *li);
+  void    AddHistos(AliTPCcalibTracks* calib);
+  void     MakeResPlotsQTree(Int_t minEntries = 100, const char* pathName = "plots");
+   void     MakeReport(Int_t stat, const char* pathName = "plots");     // calls all functions that procude pictures, results are written to pathName, stat is the minimal statistic threshold
+  //   
+  Int_t           AcceptTrack(AliTPCseed * track);
+  void            FillResolutionHistoLocal(AliTPCseed * track);  // the MAIN-FUNCTION, called for each track to fill the histograms, called by Process(...)
+  
+  
+  void     SetStyle() const;
+  
+  TObjArray* GetfArrayQDY() const {return fArrayQDY;}
+  TObjArray* GetfArrayQDZ() const {return fArrayQDZ;}
+  TObjArray* GetfArrayQRMSY() const {return fArrayQRMSY;}
+  TObjArray* GetfArrayQRMSZ() const {return fArrayQRMSZ;}
+  TObjArray* GetfResolY() const {return fResolY;}
+  TObjArray* GetfResolZ() const {return fResolZ;}
+  TObjArray* GetfRMSY() const {return fRMSY;}
+  TObjArray* GetfRMSZ() const {return fRMSZ;}
+  TH1I*      GetfRejectedTracksHisto() const {return fRejectedTracksHisto;}
+  TH2I*      GetfClusterCutHisto() const  {return fClusterCutHisto;}
+  AliTPCCalPad*          GetfCalPadClusterPerPad() const {return fCalPadClusterPerPad; }
+  AliTPCCalPad*          GetfCalPadClusterPerPadRaw() const {return fCalPadClusterPerPadRaw;}
+  AliTPCcalibTracksCuts* GetCuts() {return fCuts;}
+  void MakeHistos();  //make THnSparse
+  int UpdateClusterParam( AliTPCClusterParam *cParam, Bool_t MirrorZ=1, Bool_t MirrorPad=1, Bool_t MirrorAngle=1, Int_t MinStat=10 );
+
+  static void MakeSummaryTree(THnSparse *hisInput, TTreeSRedirector *pcstream, Int_t ptype);
+  static int GetTHnStat( const  THnBase *H, THnBase *&Mean, THnBase *&Sigma, THnBase *&Entr );
+  static int CreateWaveCorrection( const  THnBase *DeltaY, THnBase *&MeanY, THnBase *&SigmaY, THnBase *&EntrY,
+                                  Bool_t MirrorZ=1, Bool_t MirrorPad=1, Bool_t MirrorAngle=1, Int_t MinStat=10 );
+  static void SetMergeEntriesCut(Double_t entriesCut){fgkMergeEntriesCut = entriesCut;}
 
-   
-   
+protected:         
+  
 private:
-   AliTPCClusterParam *fClusterParam; //! pointer to cluster parameterization
-   TTreeSRedirector   *fDebugStream;  //! debug stream for
+
+   static Int_t   GetBin(Float_t q, Int_t pad);
+   static Int_t   GetBin(Int_t  iq, Int_t pad);
+   static Float_t GetQ(Int_t bin);
+   static Float_t GetPad(Int_t bin);
+   AliTPCClusterParam *fClusterParam; // pointer to cluster parameterization
    AliTPCROC *fROC;          //!
-   TObjArray *fArrayAmpRow; // array with amplitudes versus row for given sector 
-   TObjArray *fArrayAmp;    // array with amplitude for sectors
+public:
+  THnSparse  *fHisDeltaY;    // THnSparse - delta Y 
+  THnSparse  *fHisDeltaZ;    // THnSparse - delta Z 
+  THnSparse  *fHisRMSY;      // THnSparse - rms Y 
+  THnSparse  *fHisRMSZ;      // THnSparse - rms Z 
+  THnSparse  *fHisQmax;      // THnSparse - qmax 
+  THnSparse  *fHisQtot;      // THnSparse - qtot 
+
+private:
+  Double_t fPtDownscaleRatio;       // pt downscaling ratio (use subsample of data)
+  Double_t fQDownscaleRatio;        // Q downscaling ratio (use subsample of dta)
+
    TObjArray *fArrayQDY;    // q binned delta Y histograms
    TObjArray *fArrayQDZ;    // q binned delta Z histograms 
    TObjArray *fArrayQRMSY;  // q binned delta Y histograms
    TObjArray *fArrayQRMSZ;  // q binned delta Z histograms 
-   TH1F      *fDeltaY;      // integrated delta y histo
-   TH1F      *fDeltaZ;      // integrated delta z histo
+
    TObjArray *fResolY;      // array of resolution histograms Y
    TObjArray *fResolZ;      // array of resolution histograms Z
    TObjArray *fRMSY;        // array of RMS histograms Y
    TObjArray *fRMSZ;        // array of RMS histograms Z
    AliTPCcalibTracksCuts *fCuts; // object with cuts, that is passed to the constructor
-   TH1I *fHclus;             // number of clusters per track
-
-protected:         
-   ClassDef(AliTPCcalibTracks,1)
-};
+   TH1I      *fRejectedTracksHisto; // histogram of rejecteced tracks, the number coresponds to the failed cut
+   TH2I      *fClusterCutHisto;     // histogram showing in which padRow the clusters were cutted by which criterium
+   AliTPCCalPad *fCalPadClusterPerPad;    // AliTPCCalPad showing the number of clusters per Pad
+   AliTPCCalPad *fCalPadClusterPerPadRaw; // AliTPCCalPad showing the number of clusters per Pad before cuts on clusters are applied
+   static Double_t            fgkMergeEntriesCut;//maximal number of entries for merging  -can be modified via setter
 
-#endif
-
-
-
-
-#ifndef AliTPCCALIBTRACKSCUTS_H
-#define AliTPCCALIBTRACKSCUTS_H
-
-class AliTPCcalibTracksCuts: public TNamed {
-   //////////////////////////////////////////////////////
-   //                                                  //
-   //     Class to specify cuts for track analysis     //
-   //     with AliTPCcalibTracks                       //
-   //                                                  //
-   //////////////////////////////////////////////////////
-
-public:
-   AliTPCcalibTracksCuts(Int_t minClusters = 20, Float_t minRatio = 0.4, Float_t max1pt = 0.5,
-      Float_t edgeXZCutNoise = 0.13, Float_t edgeThetaCutNoise = 0.018):
-         TNamed("calibTracksCuts", "calibTracksCuts") {
-      // 
-      // Constuctor for AliTPCcalibTracksCuts
-      // specify the cuts to be set on the processed tracks
-      // 
-      fMinClusters = minClusters;
-      fMinRatio = minRatio;
-      fMax1pt = max1pt;
-      fEdgeYXCutNoise = edgeXZCutNoise;
-      fEdgeThetaCutNoise = edgeThetaCutNoise;
-   }
-   virtual ~AliTPCcalibTracksCuts(){cout << "AliTPCcalibTracksCuts destructor called, nothing happend." << endl;}
-   void SetMinClusters(Int_t minClusters){fMinClusters = minClusters;}
-   void SetMinRatio(Float_t minRatio){fMinRatio = minRatio;}
-   void SetMax1pt(Float_t max1pt){fMax1pt = max1pt;}
-   void SetEdgeXYCutNoise(Float_t edgeCutNoise){fEdgeYXCutNoise = edgeCutNoise;}
-   void SetEdgeThetaCutNoise(Float_t edgeCutNoise){fEdgeThetaCutNoise = edgeCutNoise;}
-   Int_t   GetMinClusters(){return fMinClusters;}
-   Float_t GetMinRatio(){return fMinRatio;}
-   Float_t GetMax1pt(){return fMax1pt;}
-   Float_t GetEdgeYXCutNoise(){return fEdgeYXCutNoise;}
-   Float_t GetEdgeThetaCutNoise(){return fEdgeThetaCutNoise;}
-   void Print(){
-      cout << "<AliTPCcalibTracksCuts>: The following cuts are specified: " << endl;
-      cout << "fMinClusters: " << fMinClusters << endl;
-      cout << "fMinRatio: " << fMinRatio << endl;
-      cout << "fMax1pt: " << fMax1pt << endl;
-      cout << "fEdgeYXCutNoise: " << fEdgeYXCutNoise << endl;
-      cout << "fEdgeThetaCutNoise: " << fEdgeThetaCutNoise << endl;
-   }  // Prints out the specified cuts
+  ClassDef(AliTPCcalibTracks,2)
    
-private:
-   Int_t   fMinClusters;         // number of clusters
-   Float_t fMinRatio;            // kMinRratio = 0.4
-   Float_t fMax1pt;              // kMax1pt = 0.5
-   Float_t fEdgeYXCutNoise;      // kEdgeYXCutNoise = 0.13
-   Float_t fEdgeThetaCutNoise;   // kEdgeThetaCutNoise = 0.018
-
-protected:         
-   ClassDef(AliTPCcalibTracksCuts,1)
 };
 
-
 #endif
-
-
-#ifndef AliTPCCALIBTRACKSCUTS_H
-#define AliTPCCALIBTRACKSCUTS_H
-
-
-class AliTPCcalibTracksCuts: public TNamed {
-   //////////////////////////////////////////////////////
-   //                                                  //
-   //     Class to specify cuts for track analysis     //
-   //     with AliTPCcalibTracks                       //
-   //                                                  //
-   //////////////////////////////////////////////////////
-
-public:
-   AliTPCcalibTracksCuts(Int_t minClusters = 20, Float_t minRatio = 0.4, Float_t max1pt = 0.5,
-      Float_t edgeXZCutNoise = 0.13, Float_t edgeThetaCutNoise = 0.018):
-         TNamed("calibTracksCuts", "calibTracksCuts") {
-      // 
-      // Constuctor for AliTPCcalibTracksCuts
-      // specify the cuts to be set on the processed tracks
-      // 
-      fMinClusters = minClusters;
-      fMinRatio = minRatio;
-      fMax1pt = max1pt;
-      fEdgeYXCutNoise = edgeXZCutNoise;
-      fEdgeThetaCutNoise = edgeThetaCutNoise;
-   }
-   virtual ~AliTPCcalibTracksCuts(){cout << "AliTPCcalibTracksCuts destructor called, nothing happend." << endl;}
-   void SetMinClusters(Int_t minClusters){fMinClusters = minClusters;}
-   void SetMinRatio(Float_t minRatio){fMinRatio = minRatio;}
-   void SetMax1pt(Float_t max1pt){fMax1pt = max1pt;}
-   void SetEdgeXYCutNoise(Float_t edgeCutNoise){fEdgeYXCutNoise = edgeCutNoise;}
-   void SetEdgeThetaCutNoise(Float_t edgeCutNoise){fEdgeThetaCutNoise = edgeCutNoise;}
-   Int_t   GetMinClusters(){return fMinClusters;}
-   Float_t GetMinRatio(){return fMinRatio;}
-   Float_t GetMax1pt(){return fMax1pt;}
-   Float_t GetEdgeYXCutNoise(){return fEdgeYXCutNoise;}
-   Float_t GetEdgeThetaCutNoise(){return fEdgeThetaCutNoise;}
-//    void Print();  // Prints out the specified cuts
-   void Print(){
-      cout << "<AliTPCcalibTracksCuts>: The following cuts are specified: " << endl;
-      cout << "fMinClusters: " << fMinClusters << endl;
-      cout << "fMinRatio: " << fMinRatio << endl;
-      cout << "fMax1pt: " << fMax1pt << endl;
-      cout << "fEdgeYXCutNoise: " << fEdgeYXCutNoise << endl;
-      cout << "fEdgeThetaCutNoise: " << fEdgeThetaCutNoise << endl;
-   }  // Prints out the specified cuts
-
-      
-private:
-   Int_t   fMinClusters;         // number of clusters
-   Float_t fMinRatio;            // kMinRratio = 0.4
-   Float_t fMax1pt;              // kMax1pt = 0.5
-   Float_t fEdgeYXCutNoise;      // kEdgeYXCutNoise = 0.13
-   Float_t fEdgeThetaCutNoise;   // kEdgeThetaCutNoise = 0.018
-
-protected:         
-   ClassDef(AliTPCcalibTracksCuts,1)
-};
-
-
-#endif
-
-