added correction for events with vertex but 0 tracks
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / AlidNdEtaCorrection.h
index 212c602fb81c2cfb8b52ed763218d031f53bc3c6..c56c95f2401eb60b7291c2712c21b579acda942f 100644 (file)
 // - update MERge function
 //
 
+#include <TCollection.h>
 #include <TNamed.h>
+#include "AliPWG0Helper.h"
 
-#include <AliCorrectionMatrix2D.h>
-#include <AliCorrectionMatrix3D.h>
+class AliCorrection;
+class TH1;
 
 class AlidNdEtaCorrection : public TNamed
 {
 public:
-  AlidNdEtaCorrection(Char_t* name="dndeta_correction");
+  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);
 
-  // fVertexRecoCorrection, fTriggerCorrection
-  void FillEvent(Float_t vtx, Float_t n)                        {fTriggerCorrection->FillGene(vtx, n);}
-  void FillEventWithTrigger(Float_t vtx, Float_t n)             {fVertexRecoCorrection->FillGene(vtx, n); fTriggerCorrection->FillMeas(vtx, n);}
-  void FillEventWithTriggerWithReconstructedVertex(Float_t vtx, Float_t n) {fVertexRecoCorrection->FillMeas(vtx, n);}
-
-  // fTrack2ParticleCorrection
-  void FillParticle(Float_t vtx, Float_t eta, Float_t pt)                  {fTrack2ParticleCorrection->FillGene(vtx, eta, pt);}
-  void FillParticleWhenMeasuredTrack(Float_t vtx, Float_t eta, Float_t pt) {fTrack2ParticleCorrection->FillMeas(vtx, eta, pt);}
+  virtual Long64_t Merge(TCollection* list);
 
-  // fTriggerBiasCorrection
-  void FillParticleAllEvents(Float_t eta, Float_t pt)          {fTriggerBiasCorrection->FillGene(eta, pt);}
-  void FillParticleWhenEventTriggered(Float_t eta, Float_t pt) {fTriggerBiasCorrection->FillMeas(eta, pt);}
+  ~AlidNdEtaCorrection();
 
-  void IncreaseEventCount() { fNEvents++; }
-  void IncreaseTriggeredEventCount() { fNTriggeredEvents++; }
+  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();
 
-  AliCorrectionMatrix3D* GetTrack2ParticleCorrection()    {return fTrack2ParticleCorrection;}
-  AliCorrectionMatrix2D* GetVertexRecoCorrection()        {return fVertexRecoCorrection;}
-  AliCorrectionMatrix2D* 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 GetTrack2ParticleCorrection(Float_t vtx, Float_t eta, Float_t pt) 
-    {return fTrack2ParticleCorrection->GetCorrection(vtx, eta, pt);}
+  Bool_t  LoadHistograms(const Char_t* dir = 0);
+  void    DrawHistograms();
+  void    DrawOverview(const char* canvasName = 0);
 
-  Float_t GetVertexRecoCorrection(Float_t vtx, Float_t n) {return fVertexRecoCorrection->GetCorrection(vtx, n);}
+  Float_t GetMeasuredFraction(CorrectionType correctionType, Float_t ptCutOff, Float_t eta = -100, Bool_t debug = kFALSE);
+  TH1*    GetMeasuredEventFraction(CorrectionType correctionType, Int_t multCut);
 
-  Float_t GetTriggerCorrection(Float_t vtx, Float_t n) {return fTriggerCorrection->GetCorrection(vtx, n);}
-
-  Float_t GetTriggerBiasCorrection(Float_t eta, Float_t pt=0) {return fTriggerBiasCorrection->GetCorrection(eta, pt);}
-
-  Float_t GetMeasuredFraction(Float_t ptCutOff, Float_t eta = -1, Bool_t debug = kFALSE);
+  void ReduceInformation();
 
 protected:
-  AliCorrectionMatrix3D* fTrack2ParticleCorrection; // handles the track-to-particle correction, function of vtx_z, eta, pt
-  AliCorrectionMatrix2D* fVertexRecoCorrection;     // handles the vertex reconstruction efficiency, function of n_clustersITS and vtx_z
-  AliCorrectionMatrix2D* fTriggerCorrection;       // handles the trigger efficiency efficiency, function of n_clustersITS and vtx_z
-
-  AliCorrectionMatrix2D* fTriggerBiasCorrection;          // MB to desired sample
+  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
 
-  Long64_t fNEvents;
-  Long64_t fNTriggeredEvents;
+private:
+  AlidNdEtaCorrection(const AlidNdEtaCorrection&);
+  AlidNdEtaCorrection& operator=(const AlidNdEtaCorrection&);
 
-  ClassDef(AlidNdEtaCorrection,0)
+  ClassDef(AlidNdEtaCorrection, 1)
 };
 
 #endif