a lot of work on the analysis
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / AlidNdEtaCorrection.h
1 /* $Id$ */
2
3 #ifndef ALIDNDETACORRECTION_H
4 #define ALIDNDETACORRECTION_H
5
6
7 // ------------------------------------------------------
8 //
9 // Class to handle corrections for dN/dEta measurements
10 //
11 // ------------------------------------------------------
12 //
13 // TODO:
14 // - make the ntrack to npart correction 3D
15 // - add documentation
16 // - add status: generate or use maps
17 // - add functionality to set the bin sizes
18 // - update MERge function
19 //
20
21 #include <TNamed.h>
22
23 #include <AliCorrectionMatrix2D.h>
24 #include <AliCorrectionMatrix3D.h>
25
26 class AlidNdEtaCorrection : public TNamed
27 {
28 public:
29   AlidNdEtaCorrection(Char_t* name="dndeta_correction");
30
31   // fVertexRecoCorrection, fTriggerCorrection
32   void FillEvent(Float_t vtx, Float_t n)                        {fTriggerCorrection->FillGene(vtx, n);}
33   void FillEventWithTrigger(Float_t vtx, Float_t n)             {fVertexRecoCorrection->FillGene(vtx, n); fTriggerCorrection->FillMeas(vtx, n);}
34   void FillEventWithTriggerWithReconstructedVertex(Float_t vtx, Float_t n) {fVertexRecoCorrection->FillMeas(vtx, n);}
35
36   // fTrack2ParticleCorrection
37   void FillParticle(Float_t vtx, Float_t eta, Float_t pt)                  {fTrack2ParticleCorrection->FillGene(vtx, eta, pt);}
38   void FillParticleWhenMeasuredTrack(Float_t vtx, Float_t eta, Float_t pt) {fTrack2ParticleCorrection->FillMeas(vtx, eta, pt);}
39
40   // fTriggerBiasCorrection
41   void FillParticleAllEvents(Float_t eta, Float_t pt)          {fTriggerBiasCorrection->FillGene(eta, pt);}
42   void FillParticleWhenEventTriggered(Float_t eta, Float_t pt) {fTriggerBiasCorrection->FillMeas(eta, pt);}
43
44   void IncreaseEventCount() { fNEvents++; }
45   void IncreaseTriggeredEventCount() { fNTriggeredEvents++; }
46
47   void Finish();
48
49   AliCorrectionMatrix3D* GetTrack2ParticleCorrection()    {return fTrack2ParticleCorrection;}
50   AliCorrectionMatrix2D* GetVertexRecoCorrection()        {return fVertexRecoCorrection;}
51   AliCorrectionMatrix2D* GetTriggerBiasCorrection()       {return fTriggerBiasCorrection;}
52
53   virtual Long64_t Merge(TCollection* list);
54
55   void    SaveHistograms();
56   Bool_t  LoadHistograms(Char_t* fileName, Char_t* dir = "dndeta_correction");
57   Bool_t  LoadCorrection(Char_t* fileName, Char_t* dir = "dndeta_correction") 
58     {return LoadHistograms(fileName, dir);}
59   
60   void DrawHistograms();
61   
62   //  void RemoveEdges(Float_t cut=2, Int_t nBinsVtx=0, Int_t nBinsEta=0);
63   
64   Float_t GetTrack2ParticleCorrection(Float_t vtx, Float_t eta, Float_t pt) 
65     {return fTrack2ParticleCorrection->GetCorrection(vtx, eta, pt);}
66
67   Float_t GetVertexRecoCorrection(Float_t vtx, Float_t n) {return fVertexRecoCorrection->GetCorrection(vtx, n);}
68
69   Float_t GetTriggerCorrection(Float_t vtx, Float_t n) {return fTriggerCorrection->GetCorrection(vtx, n);}
70
71   Float_t GetTriggerBiasCorrection(Float_t eta, Float_t pt=0) {return fTriggerBiasCorrection->GetCorrection(eta, pt);}
72
73   Float_t GetMeasuredFraction(Float_t ptCutOff, Float_t eta = -1, Bool_t debug = kFALSE);
74
75 protected:
76   AliCorrectionMatrix3D* fTrack2ParticleCorrection; // handles the track-to-particle correction, function of vtx_z, eta, pt
77   AliCorrectionMatrix2D* fVertexRecoCorrection;     // handles the vertex reconstruction efficiency, function of n_clustersITS and vtx_z
78   AliCorrectionMatrix2D* fTriggerCorrection;       // handles the trigger efficiency efficiency, function of n_clustersITS and vtx_z
79
80   AliCorrectionMatrix2D* fTriggerBiasCorrection;          // MB to desired sample
81
82   Long64_t fNEvents;
83   Long64_t fNTriggeredEvents;
84
85   ClassDef(AlidNdEtaCorrection,0)
86 };
87
88 #endif