added correction for events with vertex but 0 tracks
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / AlidNdEtaCorrection.h
index 9958d473832632bdae9fd7f8eb6321a984677e9f..c56c95f2401eb60b7291c2712c21b579acda942f 100644 (file)
 // - add documentation
 // - add status: generate or use maps
 // - add functionality to set the bin sizes
-// 
+// - update MERge function
+//
 
+#include <TCollection.h>
 #include <TNamed.h>
-#include <TFile.h>
-
-#include <CorrectionMatrix2D.h>
+#include "AliPWG0Helper.h"
 
+class AliCorrection;
+class TH1;
 
 class AlidNdEtaCorrection : public TNamed
 {
-protected:  
-  
-  CorrectionMatrix2D* fNtrackToNparticleCorrection; // handles the track-to-vertex correction
-  CorrectionMatrix2D* fVertexRecoCorrection;        // handles the vertex reco (n tracks vs vtx)
+public:
+  enum CorrectionType {
+    kNone = 0,
+    kTrack2Particle,  // measured events
+    kVertexReco,      // MB sample
+    kINEL,
+    kNSD,
+    kND
+  };
+
+  AlidNdEtaCorrection();
+  AlidNdEtaCorrection(const Char_t* name, const Char_t* title, AliPWG0Helper::AnalysisMode analysis = AliPWG0Helper::kTPC);
 
-  CorrectionMatrix2D* fTriggerBiasCorrection;          // MB to desired sample
+  virtual Long64_t Merge(TCollection* list);
 
-public:
-  AlidNdEtaCorrection(Char_t* name="dndeta_correction");
+  ~AlidNdEtaCorrection();
 
-  void FillEvent(Float_t vtx, Float_t n)                        {fVertexRecoCorrection->FillGene(vtx, n);}
-  void FillEventWithReconstructedVertex(Float_t vtx, Float_t n) {fVertexRecoCorrection->FillMeas(vtx, n);}
-  
-  void FillParticle(Float_t vtx, Float_t eta, Float_t pt=0)                  {fNtrackToNparticleCorrection->FillGene(vtx, eta);}
-  void FillParticleWhenMeasuredTrack(Float_t vtx, Float_t eta, Float_t pt=0) {fNtrackToNparticleCorrection->FillMeas(vtx, eta);}
-  
-  void FillParticleAllEvents(Float_t eta, Float_t pt=0)          {fTriggerBiasCorrection->FillGene(eta, pt);}
-  void FillParticleWhenEventTriggered(Float_t eta, Float_t pt=0) {fTriggerBiasCorrection->FillMeas(eta, pt);}
+  void FillMCParticle(Float_t vtx, Float_t eta, Float_t pt, Bool_t trigger, Bool_t vertex, Int_t processType);
+  void FillTrackedParticle(Float_t vtx, Float_t eta, Float_t pt);
+  void FillEvent(Float_t vtx, Float_t n, Bool_t trigger, Bool_t vertex, Int_t processType);
 
-  void Finish(Int_t nEventsAll = 1, Int_t nEventsTriggered = 1);
+  void Finish();
 
-  CorrectionMatrix2D* GetNtrackToNpraticleCorrection() {return fNtrackToNparticleCorrection;}
-  CorrectionMatrix2D* GetVertexRecoCorrection()        {return fVertexRecoCorrection;}
-  CorrectionMatrix2D* GetTriggerBiasCorrection()       {return fTriggerBiasCorrection;}
+  AliCorrection* GetTrack2ParticleCorrection()  {return fTrack2ParticleCorrection;}
+  AliCorrection* GetVertexRecoCorrection()      {return fVertexRecoCorrection;}
+  AliCorrection* GetTriggerBiasCorrectionINEL() {return fTriggerBiasCorrectionMBToINEL;}
+  AliCorrection* GetTriggerBiasCorrectionNSD()  {return fTriggerBiasCorrectionMBToNSD;}
+  AliCorrection* GetTriggerBiasCorrectionND()   {return fTriggerBiasCorrectionMBToND;}
+  AliCorrection* GetCorrection(CorrectionType correctionType);
 
-  virtual Long64_t Merge(TCollection* list);
+  void    Reset(void);
+  void    Add(AlidNdEtaCorrection* aCorrectionsToAdd, Float_t c=1);
 
   void    SaveHistograms();
-  Bool_t  LoadHistograms(Char_t* fileName, Char_t* dir = "dndeta_correction");
-  Bool_t  LoadCorrection(Char_t* fileName, Char_t* dir = "dndeta_correction") 
-    {return LoadHistograms(fileName, dir);}
-  
-  void DrawHistograms();
-  
-  //  void RemoveEdges(Float_t cut=2, Int_t nBinsVtx=0, Int_t nBinsEta=0);
-  
-  Float_t GetNtracksToNpartCorrection(Float_t vtx, Float_t eta, Float_t pt) 
-    {return fNtrackToNparticleCorrection->GetCorrection(vtx, eta);}  
-  
-  Float_t GetVertexRecoCorrection(Float_t vtx, Float_t n) {return fVertexRecoCorrection->GetCorrection(vtx, n);}
-
-  Float_t GetTriggerBiasCorrection(Float_t eta, Float_t pt=0) {return fTriggerBiasCorrection->GetCorrection(eta, pt);}
-  
-
-  ClassDef(AlidNdEtaCorrection,0)
+  Bool_t  LoadHistograms(const Char_t* dir = 0);
+  void    DrawHistograms();
+  void    DrawOverview(const char* canvasName = 0);
+
+  Float_t GetMeasuredFraction(CorrectionType correctionType, Float_t ptCutOff, Float_t eta = -100, Bool_t debug = kFALSE);
+  TH1*    GetMeasuredEventFraction(CorrectionType correctionType, Int_t multCut);
+
+  void ReduceInformation();
+
+protected:
+  AliCorrection* fTrack2ParticleCorrection;       //-> handles the track-to-particle correction (only track level (vtx_z, eta, pt))
+  AliCorrection* fVertexRecoCorrection;           //-> handles the vertex reconstruction efficiency, (n, vtx_z)
+  AliCorrection* fTriggerBiasCorrectionMBToINEL;  //-> handles the trigger bias MB->INEL, function of n and vtx_z
+  AliCorrection* fTriggerBiasCorrectionMBToNSD;   //-> handles the trigger bias MB->NSD,  function of n and vtx_z
+  AliCorrection* fTriggerBiasCorrectionMBToND;    //-> handles the trigger bias MB->ND,   function of n and vtx_z
+
+private:
+  AlidNdEtaCorrection(const AlidNdEtaCorrection&);
+  AlidNdEtaCorrection& operator=(const AlidNdEtaCorrection&);
+
+  ClassDef(AlidNdEtaCorrection, 1)
 };
 
 #endif