ROOT logo
#ifndef ALITRDRESOLUTION_H
#define ALITRDRESOLUTION_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id: AliTRDresolution.h 27496 2008-07-22 08:35:45Z cblume $ */

////////////////////////////////////////////////////////////////////////////
//                                                                        //
//  TRD Resolution performance                                            //
//                                                                        //
//  Authors:                                                              //
//    Alexandru Bercuci <A.Bercuci@gsi.de>                                //
//    Markus Fasel <M.Fasel@gsi.de>                                       //
//                                                                        //
////////////////////////////////////////////////////////////////////////////

#ifndef ALITRDRECOTASK_H
#include "AliTRDrecoTask.h"
#endif

#ifndef Root_TNamed
#include "TNamed.h"
#endif

class TH1;
class TH2;
class TF1;
class TGraphErrors;
class TObjArray;
class TDatabasePDG;
class AliTRDrecoParam;
class AliTRDseedV1;
class AliTRDtrackInfo;
class AliTrackPoint;
class AliTRDresolution : public AliTRDrecoTask
{
public:
  enum ETRDresolutionSteer {
     kVerbose    = BIT(18) // switch verbosity
    ,kVisual     = BIT(19) // show partial results during processing
    ,kTrackRefit = BIT(20) // steer track refit
    ,kTrackSelect= BIT(21) // steer track selection
    ,kXchange    = BIT(22) // use exchange containers
  };
  enum ETRDresolutionSlots {
     kClToTrk    = 2
    ,kClToMC
    ,kTrkltToTrk
    ,kTrkltToMC
    ,kNSlots     = 4
  };
  enum ETRDresolutionClass {
     kDetector=0      // cluster - detector
    ,kCluster         // cluster - track
    ,kTracklet        // tracklet - track residuals/pulls
    ,kTrackIn         // tracklet - track residuals/pulls at lower TRD entrance
    ,kMCcluster       // cluster-mc resolution/pulls
    ,kMCtracklet      // tracklet-mc resolution/pulls
    ,kMCtrackIn       // TPC track monitor
    ,kMCtrack         // TRD track monitor
/*    ,kTrackOut        // tracklet - track residuals/pulls at lower TRD entrance during refit
    ,kMCtrackOut      // TOF/HMPID track monitor*/
    ,kNclasses        // total number of resolution classes
    ,kV0TrackIn       // tracklet - track residuals/pulls at lower TRD entrance for V0 tagged tracks
  };
  enum ETRDresolutionClassProjs {
    kDetNproj=460      // detector projections
    ,kClNproj=2800     // cluster projections
    ,kTrkltNproj=8000  // tracklet projections
    ,kTrkInNproj=1440  // trackIn projections
    ,kTrkNproj=2500    // track projections
    ,kMCTrkInNproj=1260// trackIn projections
  };
  enum ETRDresolutionProjs {
    kBC    = 0 // bunch cross
    ,kPhi
    ,kEta
    ,kYrez
    ,kPrez
    ,kZrez
    ,kSpeciesChgRC
    ,kPt
    ,kNdim  // no of dimensions in the THnSparse
    ,kNdimDet     = 4
    ,kNdimCl      = 4
    ,kNdimTrklt   = 4
    ,kNdimTrkIn   = 7
    ,kNbunchCross = 3  // no of classes for bunch crossing
    ,kNspc        = 3  // no of species e, mu+pi, K+p
    ,kNcharge     = 2  // no of charges
    ,kNpads       = 4  // no of charges
  };

  AliTRDresolution();
  AliTRDresolution(char* name, Bool_t xchange=kTRUE);
  AliTRDresolution(const AliTRDresolution&);
  AliTRDresolution& operator=(const AliTRDresolution&);
  virtual ~AliTRDresolution();
  
  static Bool_t   FitTrack(const Int_t np, AliTrackPoint *points, Float_t params[10]);
  static Bool_t   FitTracklet(const Int_t ly, const Int_t np, const AliTrackPoint *points, const Float_t trackPars[10], Float_t trackletPars[3]);
  void            UserCreateOutputObjects();
//  Float_t GetCorrectionX(Int_t det, Int_t tb) const {return fXcorr[det][tb];}
  static void     GetRangeZ(TH2 *h2, Float_t &m, Float_t &M);
  Float_t         GetPtThreshold() const {return fPtThreshold;}
  Bool_t          GetRefFigure(Int_t ifig);

  virtual TObjArray*  Histos(); 
//  Bool_t  Load(const Char_t *file = "AnalysisResults.root", const Char_t *dir="TRD_Performance");
//  Bool_t  LoadCorrection(const Char_t *file=NULL);
  void            MakeSummary();

  TObjArray*      Results(ETRDresolutionClass c) const  { if(!fProj) return NULL; return (TObjArray*)fProj->At(c);}
  void            UserExec(Option_t * opt);
  void            InitExchangeContainers();
/*  Bool_t          HasTrackRefit() const                 { return TestBit(kTrackRefit);}
  Bool_t          HasTrackSelection() const             { return TestBit(kTrackSelect);}*/
  Bool_t          IsVerbose() const                     { return TestBit(kVerbose);}
  Bool_t          IsVisual() const                      { return TestBit(kVisual);}
  Bool_t          UseBCselectTOF() const                { return fBCbinTOF>0;}
  Bool_t          UseBCselectFill() const               { return fBCbinFill>0;}
  Bool_t          UseLYselectTrklt() const              { return fLYselect>=0;}
  Bool_t          UseExchangeContainers() const         { return TestBit(kXchange);}
  Bool_t          PostProcess();

  TH1*            DetCluster(const TObjArray *cl=NULL);
  TH1*            PlotCluster(const AliTRDtrackV1 *t=NULL);
  TH1*            PlotTracklet(const AliTRDtrackV1 *t=NULL);
  TH1*            PlotTrackIn(const AliTRDtrackV1 *t=NULL);
//  TH1*            PlotTrackOut(const AliTRDtrackV1 *t=NULL);
  TH1*            PlotMC(const AliTRDtrackV1 *t=NULL);

  static Bool_t   Process(TH2* const /*h2*/, TGraphErrors **/*g*/, Int_t stat=100){ return Bool_t(stat);}
  void            SetPtThreshold(Float_t pt)            { fPtThreshold = pt;}
  void            SetBCselectTOF(Int_t b=0)             { fBCbinTOF = b;}
  void            SetBCselectFill(Int_t b=0)            { fBCbinFill = b<0||b>3499?1:b+1;}
  void            SetBsign(Int_t b=0)                   { fBsign = Bool_t(b);}
  void            SetLYselect(Int_t ly=0)               { fLYselect = ly;}
  void            SetProcesses(Bool_t det, Bool_t cl, Bool_t trklt, Bool_t trkin);
  void            SetDump3D(Bool_t det, Bool_t cl, Bool_t trklt, Bool_t trkin);
  void            SetVerbose(Bool_t v = kTRUE)          { SetBit(kVerbose, v);}
  void            SetVisual(Bool_t v = kTRUE)           { SetBit(kVisual, v);}
/*  void            SetTrackRefit(Bool_t v = kTRUE)       { SetBit(kTrackRefit, v);}
  void            SetTrackSelection(Bool_t v = kTRUE)   { SetBit(kTrackSelect, v);}*/
  void            SetUseExchangeContainers(Bool_t v = kTRUE) { SetBit(kXchange, v);}

  void            Terminate(Option_t * opt);
  static Bool_t   UseTrack(const Int_t np, const AliTrackPoint *points, Float_t params[10]);

  void        AdjustF1(TH1 *h, TF1 *f);
  TH2*        DrawSigma(TH2 *h2, const Char_t *t, Float_t m=0., Float_t M=-1., Float_t scale=1);
  void        GetLandauMpvFwhm(TF1 * const f, Float_t &mpv, Float_t &xm, Float_t &xM);
  void        GetRange(TH2 *h2, Char_t mod, Float_t *range);

protected:
  Bool_t      HasDump3DFor(ETRDresolutionClass cls) const { return TESTBIT(fSteer, 4+cls);}
  Bool_t      HasProcess(ETRDresolutionClass cls) const   { return TESTBIT(fSteer, cls);}
  Bool_t      MakeProjectionDetector();
  Bool_t      MakeProjectionCluster(Bool_t mc=kFALSE);
  Bool_t      MakeProjectionTracklet(Bool_t mc=kFALSE);
  Bool_t      MakeProjectionTrackIn(Bool_t mc=kFALSE, Bool_t v0=kFALSE);
  Bool_t      MakeProjectionTrack();
  Bool_t      Process(TH2* const /*h2*/, TF1 */*f*/, Float_t /*k*/, TGraphErrors **/*g*/) { return kTRUE;}
  Bool_t      Pulls(Double_t dyz[2], Double_t cc[3], Double_t tilt) const;

  UShort_t              fSteer;           // bit map to steer internal behaviour of class
                                          // MakeProjection [kTrackIn kTracklet kCluster kDetector]
                                          // Dump3D [4+kTrackIn 4+kTracklet 4+kCluster 4+kDetector]
  Float_t               fPtThreshold;     // pt threshold for some performance plots
  Int_t                 fBCbinTOF;        // set/select by TOF BC index
  Int_t                 fBCbinFill;       // set/select by Bunch Fill index
  Int_t                 fLYselect;        // select layer for Tracklet projections (in debug mode)
  Bool_t                fBsign;           // sign of magnetic field (kFALSE[-] kTRUE[+])
  static Char_t const  *fgPerformanceName[kNclasses]; //! name of performance plot
  static Int_t const    fgkNbins[kNdim];  //! no of bins/projection
  static Double_t const fgkMin[kNdim];    //! low limits for projections
  static Double_t const fgkMax[kNdim];    //! high limits for projections
  static Char_t const  *fgkTitle[kNdim];  //! title of projection
  TObjArray            *fProj;            //! result holder - sigma values
  TDatabasePDG         *fDBPDG;           //! PDG database

  // calibration containers
  TObjArray            *fCl;              //! cluster2track calib
  TObjArray            *fMCcl;            //! cluster2mc calib
  
  ClassDef(AliTRDresolution, 11) // TRD tracking resolution task
};
#endif
 AliTRDresolution.h:1
 AliTRDresolution.h:2
 AliTRDresolution.h:3
 AliTRDresolution.h:4
 AliTRDresolution.h:5
 AliTRDresolution.h:6
 AliTRDresolution.h:7
 AliTRDresolution.h:8
 AliTRDresolution.h:9
 AliTRDresolution.h:10
 AliTRDresolution.h:11
 AliTRDresolution.h:12
 AliTRDresolution.h:13
 AliTRDresolution.h:14
 AliTRDresolution.h:15
 AliTRDresolution.h:16
 AliTRDresolution.h:17
 AliTRDresolution.h:18
 AliTRDresolution.h:19
 AliTRDresolution.h:20
 AliTRDresolution.h:21
 AliTRDresolution.h:22
 AliTRDresolution.h:23
 AliTRDresolution.h:24
 AliTRDresolution.h:25
 AliTRDresolution.h:26
 AliTRDresolution.h:27
 AliTRDresolution.h:28
 AliTRDresolution.h:29
 AliTRDresolution.h:30
 AliTRDresolution.h:31
 AliTRDresolution.h:32
 AliTRDresolution.h:33
 AliTRDresolution.h:34
 AliTRDresolution.h:35
 AliTRDresolution.h:36
 AliTRDresolution.h:37
 AliTRDresolution.h:38
 AliTRDresolution.h:39
 AliTRDresolution.h:40
 AliTRDresolution.h:41
 AliTRDresolution.h:42
 AliTRDresolution.h:43
 AliTRDresolution.h:44
 AliTRDresolution.h:45
 AliTRDresolution.h:46
 AliTRDresolution.h:47
 AliTRDresolution.h:48
 AliTRDresolution.h:49
 AliTRDresolution.h:50
 AliTRDresolution.h:51
 AliTRDresolution.h:52
 AliTRDresolution.h:53
 AliTRDresolution.h:54
 AliTRDresolution.h:55
 AliTRDresolution.h:56
 AliTRDresolution.h:57
 AliTRDresolution.h:58
 AliTRDresolution.h:59
 AliTRDresolution.h:60
 AliTRDresolution.h:61
 AliTRDresolution.h:62
 AliTRDresolution.h:63
 AliTRDresolution.h:64
 AliTRDresolution.h:65
 AliTRDresolution.h:66
 AliTRDresolution.h:67
 AliTRDresolution.h:68
 AliTRDresolution.h:69
 AliTRDresolution.h:70
 AliTRDresolution.h:71
 AliTRDresolution.h:72
 AliTRDresolution.h:73
 AliTRDresolution.h:74
 AliTRDresolution.h:75
 AliTRDresolution.h:76
 AliTRDresolution.h:77
 AliTRDresolution.h:78
 AliTRDresolution.h:79
 AliTRDresolution.h:80
 AliTRDresolution.h:81
 AliTRDresolution.h:82
 AliTRDresolution.h:83
 AliTRDresolution.h:84
 AliTRDresolution.h:85
 AliTRDresolution.h:86
 AliTRDresolution.h:87
 AliTRDresolution.h:88
 AliTRDresolution.h:89
 AliTRDresolution.h:90
 AliTRDresolution.h:91
 AliTRDresolution.h:92
 AliTRDresolution.h:93
 AliTRDresolution.h:94
 AliTRDresolution.h:95
 AliTRDresolution.h:96
 AliTRDresolution.h:97
 AliTRDresolution.h:98
 AliTRDresolution.h:99
 AliTRDresolution.h:100
 AliTRDresolution.h:101
 AliTRDresolution.h:102
 AliTRDresolution.h:103
 AliTRDresolution.h:104
 AliTRDresolution.h:105
 AliTRDresolution.h:106
 AliTRDresolution.h:107
 AliTRDresolution.h:108
 AliTRDresolution.h:109
 AliTRDresolution.h:110
 AliTRDresolution.h:111
 AliTRDresolution.h:112
 AliTRDresolution.h:113
 AliTRDresolution.h:114
 AliTRDresolution.h:115
 AliTRDresolution.h:116
 AliTRDresolution.h:117
 AliTRDresolution.h:118
 AliTRDresolution.h:119
 AliTRDresolution.h:120
 AliTRDresolution.h:121
 AliTRDresolution.h:122
 AliTRDresolution.h:123
 AliTRDresolution.h:124
 AliTRDresolution.h:125
 AliTRDresolution.h:126
 AliTRDresolution.h:127
 AliTRDresolution.h:128
 AliTRDresolution.h:129
 AliTRDresolution.h:130
 AliTRDresolution.h:131
 AliTRDresolution.h:132
 AliTRDresolution.h:133
 AliTRDresolution.h:134
 AliTRDresolution.h:135
 AliTRDresolution.h:136
 AliTRDresolution.h:137
 AliTRDresolution.h:138
 AliTRDresolution.h:139
 AliTRDresolution.h:140
 AliTRDresolution.h:141
 AliTRDresolution.h:142
 AliTRDresolution.h:143
 AliTRDresolution.h:144
 AliTRDresolution.h:145
 AliTRDresolution.h:146
 AliTRDresolution.h:147
 AliTRDresolution.h:148
 AliTRDresolution.h:149
 AliTRDresolution.h:150
 AliTRDresolution.h:151
 AliTRDresolution.h:152
 AliTRDresolution.h:153
 AliTRDresolution.h:154
 AliTRDresolution.h:155
 AliTRDresolution.h:156
 AliTRDresolution.h:157
 AliTRDresolution.h:158
 AliTRDresolution.h:159
 AliTRDresolution.h:160
 AliTRDresolution.h:161
 AliTRDresolution.h:162
 AliTRDresolution.h:163
 AliTRDresolution.h:164
 AliTRDresolution.h:165
 AliTRDresolution.h:166
 AliTRDresolution.h:167
 AliTRDresolution.h:168
 AliTRDresolution.h:169
 AliTRDresolution.h:170
 AliTRDresolution.h:171
 AliTRDresolution.h:172
 AliTRDresolution.h:173
 AliTRDresolution.h:174
 AliTRDresolution.h:175
 AliTRDresolution.h:176
 AliTRDresolution.h:177
 AliTRDresolution.h:178
 AliTRDresolution.h:179
 AliTRDresolution.h:180
 AliTRDresolution.h:181
 AliTRDresolution.h:182
 AliTRDresolution.h:183
 AliTRDresolution.h:184
 AliTRDresolution.h:185
 AliTRDresolution.h:186
 AliTRDresolution.h:187
 AliTRDresolution.h:188
 AliTRDresolution.h:189