Adding the sharing efficiency and event selection efficiency correction to the task...
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Oct 2009 15:31:27 +0000 (15:31 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Oct 2009 15:31:27 +0000 (15:31 +0000)
PWG2/FORWARD/analysis/AliFMDAnalysisTaskBackgroundCorrection.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskDndeta.cxx

index 46b35d1..5afa997 100644 (file)
@@ -77,6 +77,7 @@ void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
   
   
   TH2F* hMult = 0;
+  TH2F* hMultTrVtx = 0;
   TH2F* hHits = 0;
   // TH2F* hHitsNoCuts = 0;
   Int_t nVtxbins = pars->GetNvtxBins();
@@ -98,6 +99,14 @@ void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
                              nSec, 0, 2*TMath::Pi());
            hMult->Sumw2();
            fOutputList->Add(hMult);
+           hMultTrVtx  = new TH2F(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),Form("mult_FMD%d%c_vtxbin%d",det,ringChar,i),
+                                  hBg->GetNbinsX(),
+                                  hBg->GetXaxis()->GetXmin(),
+                                  hBg->GetXaxis()->GetXmax(),
+                                  nSec, 0, 2*TMath::Pi());
+           hMultTrVtx->Sumw2();
+
+           fOutputList->Add(hMultTrVtx);
            hHits  = new TH2F(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hits_FMD%d%c_vtxbin%d",det,ringChar,i),
                              hBg->GetNbinsX(),
                              hBg->GetXaxis()->GetXmin(),
@@ -112,13 +121,9 @@ void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
            
            */
            hHits->Sumw2();
-           //hHitsNoCuts->Sumw2();
-           
            fHitList->Add(hHits);
            fOutputList->Add(hHits);
-           // fHitList->Add(hHitsNoCuts);
-           //  fOutputList->Add(hHitsNoCuts);
-           
+                   
          }
        } 
     }
@@ -152,6 +157,8 @@ void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
       Char_t ringChar = (ir == 0 ? 'I' : 'O');
       TH2F* hMult = (TH2F*)fOutputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       hMult->Reset();
+      TH2F* hMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
+      hMultTrVtx->Reset();
     }
     
   }
@@ -159,26 +166,52 @@ void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
   
   
   for(UShort_t det=1;det<=3;det++) {
-   
+    
     Int_t nRings = (det==1 ? 1 : 2);
     for (UShort_t ir = 0; ir < nRings; ir++) {
       Char_t ringChar = (ir == 0 ? 'I' : 'O');
-   
-      TH2F* hMultTotal = (TH2F*)fOutputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
-    
+      
+      TH2F* hMult      = (TH2F*)fOutputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
+      TH2F* hMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       TH2F* hMultInput = (TH2F*)fInputList->FindObject(Form("FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       TH2F* hHits      = (TH2F*)fOutputList->FindObject(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       
       if(pars->GetProcessHits())
-        hHits->Add(hMultInput);
+       hHits->Add(hMultInput);
       
       TH2F* hBg        = pars->GetBackgroundCorrection(det, ringChar, vtxbin);
       
-      hMultTotal->Add(hMultInput);
+      hMult->Add(hMultInput);
+      hMultTrVtx->Add(hMultInput);
+      hMult->Divide(hBg);//,"B");
+      hMultTrVtx->Divide(hBg);//,"B");
+
+      //sharing efficiency correction ?
+      
+      TH1F* hSharingEff = pars->GetSharingEfficiency(det,ringChar,vtxbin);
+      TH1F* hSharingEffTrVtx = pars->GetSharingEfficiencyTrVtx(det,ringChar,vtxbin);   
       
-      hMultTotal->Divide(hBg);//,"B");
+      for(Int_t nx=1; nx<hMult->GetNbinsX(); nx++) {
+       Float_t correction = hSharingEff->GetBinContent(nx);
+       Float_t correctionTrVtx = hSharingEffTrVtx->GetBinContent(nx);
+       for(Int_t ny=1; ny<hMult->GetNbinsY(); ny++) {
+         
+         if(correction != 0){
+           hMult->SetBinContent(nx,ny,hMult->GetBinContent(nx,ny)/correction);
+           Float_t error = TMath::Sqrt(TMath::Power(hMult->GetBinError(nx,ny),2) + TMath::Power(hMult->GetBinContent(nx,ny)*hSharingEff->GetBinError(nx),2)) / correction;
+           hMult->SetBinError(nx,ny,error);
+         }
+         if(correctionTrVtx != 0){
+           hMultTrVtx->SetBinContent(nx,ny,hMultTrVtx->GetBinContent(nx,ny)/correctionTrVtx);
+           Float_t error = TMath::Sqrt(TMath::Power(hMultTrVtx->GetBinError(nx,ny),2) + TMath::Power(hMultTrVtx->GetBinContent(nx,ny)*hSharingEffTrVtx->GetBinError(nx),2)) / correctionTrVtx;
+           hMultTrVtx->SetBinError(nx,ny,error);
+         }
+       }
+       
+      }
+      
+      hMult->Scale(1/pars->GetEventSelectionEfficiency(vtxbin));
       
-      //sharing efficiency correction ?
       
     }
   }
index 21e2e75..cc1edcb 100644 (file)
@@ -75,6 +75,7 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects()
   
   TH2F* hMult = 0;
   TH1F* hHits = 0;
+  TH2F* hMultTrVtx = 0;
   TH1F* hPrimVertexBin = 0;
   
   
@@ -105,7 +106,11 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects()
                              hBg->GetXaxis()->GetXmin(),
                              hBg->GetXaxis()->GetXmax(),
                              nSec, 0, 2*TMath::Pi());
-           
+           hMultTrVtx  = new TH2F(Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,i),
+                                  hBg->GetNbinsX(),
+                                  hBg->GetXaxis()->GetXmin(),
+                                  hBg->GetXaxis()->GetXmax(),
+                                  nSec, 0, 2*TMath::Pi());
            hHits  = new TH1F(Form("hMCHits_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hMCHits_FMD%d%c_vtxbin%d",det,ringChar,i),
                              hBg->GetNbinsX(),
                              hBg->GetXaxis()->GetXmin(),
@@ -115,6 +120,9 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects()
            
            hMult->Sumw2();
            fOutputList->Add(hMult);
+
+           hMultTrVtx->Sumw2();
+           fOutputList->Add(hMultTrVtx);
            
          }
       } 
@@ -163,11 +171,13 @@ void AliFMDAnalysisTaskDndeta::Exec(Option_t */*option*/)
       Char_t ringChar = (ir == 0 ? 'I' : 'O');
             
       TH2F* hMultTotal = (TH2F*)fOutputList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
-     
+      TH2F* hMultTotalTrVtx = (TH2F*)fOutputList->FindObject(Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       
       TH2F* hMultInput = (TH2F*)fInputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
+      TH2F* hMultInputTrVtx = (TH2F*)fInputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       
       hMultTotal->Add(hMultInput);
+      hMultTotalTrVtx->Add(hMultInputTrVtx);
             
     }
   }
@@ -194,10 +204,13 @@ void AliFMDAnalysisTaskDndeta::Terminate(Option_t */*option*/) {
       Char_t ringChar = (ir == 0 ? 'I' : 'O');
       for(Int_t i =0; i<nVtxbins; i++) {
        
+       TH2F* hMultTotal = (TH2F*)fOutputList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,i));
+       //TH2F* hMultTrVtx = (TH2F*)hMultTotal->Clone(Form("dNdeta_FMD%d%c_TrVtx_vtxbin%d",det,ringChar,i));
+       TH2F* hMultTrVtx = (TH2F*)fOutputList->FindObject(Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i));
+       /*
        TH1F* hSharingEff = pars->GetSharingEfficiency(det,ringChar,i);
        TH1F* hSharingEffTrVtx = pars->GetSharingEfficiencyTrVtx(det,ringChar,i);       
-       TH2F* hMultTotal = (TH2F*)fOutputList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,i));
-       TH2F* hMultTrVtx = (TH2F*)hMultTotal->Clone(Form("dNdeta_FMD%d%c_TrVtx_vtxbin%d",det,ringChar,i));
+       
        
        for(Int_t nx=1; nx<hMultTotal->GetNbinsX(); nx++) {
          Float_t correction = hSharingEff->GetBinContent(nx);
@@ -221,7 +234,7 @@ void AliFMDAnalysisTaskDndeta::Terminate(Option_t */*option*/) {
        //hMultTotal->Divide(hSharingEff);
        
        hMultTotal->Scale(1/pars->GetEventSelectionEfficiency(i));
-       
+       */
        //hMultTrVtx->Divide(hSharingEffTrVtx);
        
        TH1D* hMultProj   = hMultTotal->ProjectionX(Form("dNdeta_FMD%d%c_vtxbin%d_proj",det,ringChar,i),1,hMultTotal->GetNbinsY());