Adding calibration object for the sharing efficiency
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Oct 2009 14:21:03 +0000 (14:21 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Oct 2009 14:21:03 +0000 (14:21 +0000)
FMD/Correction/SharingEfficiency/sharingefficiency_1_0_1_0_0_0.root [new file with mode: 0644]
FMD/analysis/AliFMDAnaCalibSharingEfficiency.cxx [new file with mode: 0644]
FMD/analysis/AliFMDAnaCalibSharingEfficiency.h [new file with mode: 0644]
FMD/analysis/AliFMDAnaParameters.cxx
FMD/analysis/AliFMDAnaParameters.h
FMD/analysis/AliFMDAnalysisTaskDensity.cxx
FMD/analysis/AliFMDDndeta.cxx
FMD/analysis/AliFMDDndeta.h
FMD/analysis/FMDanalysisLinkDef.h
FMD/libFMDanalysis.pkg

diff --git a/FMD/Correction/SharingEfficiency/sharingefficiency_1_0_1_0_0_0.root b/FMD/Correction/SharingEfficiency/sharingefficiency_1_0_1_0_0_0.root
new file mode 100644 (file)
index 0000000..c26bf83
Binary files /dev/null and b/FMD/Correction/SharingEfficiency/sharingefficiency_1_0_1_0_0_0.root differ
diff --git a/FMD/analysis/AliFMDAnaCalibSharingEfficiency.cxx b/FMD/analysis/AliFMDAnaCalibSharingEfficiency.cxx
new file mode 100644 (file)
index 0000000..eadd175
--- /dev/null
@@ -0,0 +1,145 @@
+
+#include "AliFMDAnaCalibSharingEfficiency.h"
+#include <TH2F.h>
+#include <TH1F.h>
+#include <TBrowser.h>
+
+ClassImp(AliFMDAnaCalibSharingEfficiency)
+#if 0
+; // For Emacs
+#endif 
+
+//____________________________________________________________________
+AliFMDAnaCalibSharingEfficiency::AliFMDAnaCalibSharingEfficiency() : TObject(),
+                                                                    fArray(),
+                                                                    fArrayTrVtx(),
+                                                                    fIsInit(kFALSE)
+{
+  
+  
+  
+}
+
+
+//____________________________________________________________________
+AliFMDAnaCalibSharingEfficiency::AliFMDAnaCalibSharingEfficiency(const AliFMDAnaCalibSharingEfficiency& o)
+  : TObject(o), fArray(o.fArray), fArrayTrVtx(o.fArrayTrVtx), fIsInit(o.fIsInit)
+{
+  // Copy ctor 
+}
+//____________________________________________________________________
+AliFMDAnaCalibSharingEfficiency&
+AliFMDAnaCalibSharingEfficiency::operator=(const AliFMDAnaCalibSharingEfficiency& o) 
+{
+  // Assignment operator 
+  
+  fArray       = o.fArray;
+  fArrayTrVtx  = o.fArrayTrVtx;
+  
+  return (*this);
+}
+//____________________________________________________________________
+void AliFMDAnaCalibSharingEfficiency::Init() {
+  
+  fArray.SetOwner();
+  for(Int_t det = 1; det<=3;det++) {
+    TObjArray* detArray = new TObjArray();
+    detArray->SetOwner();
+    fArray.AddAtAndExpand(detArray,det);
+    Int_t nRings = (det == 1 ? 1 : 2);
+    for(Int_t ring = 0;ring<nRings;ring++) {
+      TObjArray* ringArray = new TObjArray();
+      ringArray->SetOwner();
+      detArray->AddAtAndExpand(ringArray,ring);
+      
+    }
+  }
+  fArrayTrVtx.SetOwner();
+  for(Int_t det = 1; det<=3;det++) {
+    TObjArray* detArrayTrVtx = new TObjArray();
+    detArrayTrVtx->SetOwner();
+    fArrayTrVtx.AddAtAndExpand(detArrayTrVtx,det);
+    Int_t nRings = (det == 1 ? 1 : 2);
+    for(Int_t ring = 0;ring<nRings;ring++) {
+      TObjArray* ringArrayTrVtx = new TObjArray();
+      ringArrayTrVtx->SetOwner();
+      detArrayTrVtx->AddAtAndExpand(ringArrayTrVtx,ring);
+      
+    }
+  }
+  fIsInit = kTRUE;
+}
+//____________________________________________________________________
+TObjArray* AliFMDAnaCalibSharingEfficiency::GetRingArrayTrVtx(Int_t det, 
+                                                             Char_t ring) {
+  
+  Int_t ringNumber      = (ring == 'I' ? 0 : 1);
+  TObjArray* detArray  = (TObjArray*)fArrayTrVtx.At(det);
+  TObjArray* ringArray = (TObjArray*)detArray->At(ringNumber);
+  
+  return ringArray;
+}
+//____________________________________________________________________
+void AliFMDAnaCalibSharingEfficiency::SetSharingEffTrVtx(Int_t det, 
+                                                        Char_t ring, 
+                                                        Int_t vtxbin, 
+                                                        TH1F* hCorrection) {
+  if(!fIsInit)
+    Init();
+  
+  TObjArray* ringArray = GetRingArrayTrVtx(det,ring);
+  ringArray->AddAtAndExpand(hCorrection,vtxbin);
+  
+}
+//____________________________________________________________________
+TH1F* AliFMDAnaCalibSharingEfficiency::GetSharingEffTrVtx(Int_t det, 
+                                                         Char_t ring, 
+                                                         Int_t vtxbin) {
+  TObjArray* ringArray = GetRingArrayTrVtx(det,ring);
+  TH1F* hCorrection    = (TH1F*)ringArray->At(vtxbin);
+  return hCorrection;
+}
+
+//____________________________________________________________________
+TObjArray* AliFMDAnaCalibSharingEfficiency::GetRingArray(Int_t det, 
+                                                        Char_t ring) {
+  
+  Int_t ringNumber      = (ring == 'I' ? 0 : 1);
+  TObjArray* detArray  = (TObjArray*)fArray.At(det);
+  TObjArray* ringArray = (TObjArray*)detArray->At(ringNumber);
+  
+  return ringArray;
+}
+//____________________________________________________________________
+void AliFMDAnaCalibSharingEfficiency::SetSharingEff(Int_t det, 
+                                                   Char_t ring, 
+                                                   Int_t vtxbin, 
+                                                   TH1F* hCorrection) {
+  if(!fIsInit)
+    Init();
+  
+  TObjArray* ringArray = GetRingArray(det,ring);
+  ringArray->AddAtAndExpand(hCorrection,vtxbin);
+  
+}
+//____________________________________________________________________
+TH1F* AliFMDAnaCalibSharingEfficiency::GetSharingEff(Int_t det, 
+                                                    Char_t ring, 
+                                                    Int_t vtxbin) {
+  TObjArray* ringArray = GetRingArray(det,ring);
+  TH1F* hCorrection    = (TH1F*)ringArray->At(vtxbin);
+  return hCorrection;
+}
+
+//____________________________________________________________________
+void
+AliFMDAnaCalibSharingEfficiency::Browse(TBrowser* b)
+{
+  b->Add(&fArray, "Array of histograms w/sharing eff corrections");
+}
+
+//____________________________________________________________________
+//
+// EOF
+//
diff --git a/FMD/analysis/AliFMDAnaCalibSharingEfficiency.h b/FMD/analysis/AliFMDAnaCalibSharingEfficiency.h
new file mode 100644 (file)
index 0000000..d731caf
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef ALIFMDANACALIBSHARINGEFFICIENCY_H
+#define ALIFMDANACALIBSHARINGEFFICIENCY_H
+
+#include <TObject.h>
+#include <TAxis.h>
+#include <TObjArray.h>
+class TH2F;
+class TH1F;
+class TBrowser;
+
+/**
+ * @ingroup FMD_ana
+ * @brief Do the background correction
+ * 
+ */
+class AliFMDAnaCalibSharingEfficiency : public TObject
+{
+  
+ public:
+  
+  AliFMDAnaCalibSharingEfficiency();
+  AliFMDAnaCalibSharingEfficiency(const AliFMDAnaCalibSharingEfficiency& o);
+  AliFMDAnaCalibSharingEfficiency& operator=(const AliFMDAnaCalibSharingEfficiency& o);
+
+  void    SetSharingEff(Int_t det, Char_t ring, Int_t vtxbin, TH1F* hCorrection);
+  TH1F*   GetSharingEff(Int_t det, Char_t ring, Int_t vtxbin);
+  void    SetSharingEffTrVtx(Int_t det, Char_t ring, Int_t vtxbin, TH1F* hCorrection);
+  TH1F*   GetSharingEffTrVtx(Int_t det, Char_t ring, Int_t vtxbin);
+  void    Init();
+  Bool_t  IsFolder() const { return kTRUE; }
+  void    Browse(TBrowser* b);
+ protected:
+
+  TObjArray* GetRingArray(Int_t det, Char_t ring);
+  TObjArray* GetRingArrayTrVtx(Int_t det, Char_t ring);
+  
+  TObjArray  fArray;
+  TObjArray  fArrayTrVtx;
+  Bool_t     fIsInit;
+
+  ClassDef(AliFMDAnaCalibSharingEfficiency,1);
+};
+
+#endif
+// Local Variables:
+//   mode: C++
+// End:
index ee4730e..8786bba 100644 (file)
@@ -43,9 +43,10 @@ ClassImp(AliFMDAnaParameters)
 
 //const char* AliFMDAnaParameters::fgkBackgroundCorrection  = "FMD/Correction/Background";
 //const char* AliFMDAnaParameters::fgkEnergyDists = "FMD/Correction/EnergyDistribution";
-const char* AliFMDAnaParameters::fgkBackgroundID = "background";
+const char* AliFMDAnaParameters::fgkBackgroundID         = "background";
 const char* AliFMDAnaParameters::fgkEnergyDistributionID = "energydistributions";
 const char* AliFMDAnaParameters::fgkEventSelectionEffID  = "eventselectionefficiency";
+const char* AliFMDAnaParameters::fgkSharingEffID         = "sharingefficiency";
 //____________________________________________________________________
 AliFMDAnaParameters* AliFMDAnaParameters::fgInstance = 0;
 
@@ -70,6 +71,7 @@ AliFMDAnaParameters::AliFMDAnaParameters() :
   fEnergyPath("$ALICE_ROOT/FMD/Correction/EnergyDistribution"),
   fBackgroundPath("$ALICE_ROOT/FMD/Correction/Background"),
   fEventSelectionEffPath("$ALICE_ROOT/FMD/Correction/EventSelectionEfficiency"),
+  fSharingEffPath("$ALICE_ROOT/FMD/Correction/SharingEfficiency"),
   fProcessPrimary(kFALSE),
   fProcessHits(kFALSE),
   fTrigger(kMB1),
@@ -118,6 +120,16 @@ char* AliFMDAnaParameters::GetPath(const char* species) {
                fSpecies,
                0,
                0);
+  if(species == fgkSharingEffID)
+    path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
+               fSharingEffPath.Data(),
+               fgkSharingEffID,
+               fEnergy,
+               fTrigger,
+               fMagField,
+               fSpecies,
+               0,
+               0);
 
   return path;
 }
@@ -131,7 +143,8 @@ void AliFMDAnaParameters::Init(Bool_t forceReInit, UInt_t what)
   if (what & kBackgroundCorrection)       InitBackground();
   if (what & kEnergyDistributions)        InitEnergyDists();
   if (what & kEventSelectionEfficiency)   InitEventSelectionEff();
-  
+  if (what & kSharingEfficiency)          InitSharingEff();
+
   fIsInit = kTRUE;
 }
 //____________________________________________________________________
@@ -177,6 +190,19 @@ void AliFMDAnaParameters::InitEventSelectionEff() {
   
 }
 //____________________________________________________________________
+
+void AliFMDAnaParameters::InitSharingEff() {
+  
+  //AliCDBEntry*   background = GetEntry(fgkBackgroundCorrection);
+  TFile* fin = TFile::Open(GetPath(fgkSharingEffID));
+                           
+  if (!fin) return;
+  
+  fSharingEfficiency = dynamic_cast<AliFMDAnaCalibSharingEfficiency*>(fin->Get(fgkSharingEffID));
+  if (!fSharingEfficiency) AliFatal("Invalid background object from CDB");
+  
+}
+//____________________________________________________________________
 Float_t AliFMDAnaParameters::GetVtxCutZ() {
   
   if(!fIsInit) {
@@ -340,6 +366,16 @@ Float_t AliFMDAnaParameters::GetEventSelectionEfficiency(Int_t vtxbin) {
 
 }
 //_____________________________________________________________________
+TH1F* AliFMDAnaParameters::GetSharingEfficiency(Int_t det, Char_t ring, Int_t vtxbin) {
+  if(!fIsInit) {
+    AliWarning("Not initialized yet. Call Init() to remedy");
+    return 0;
+  }
+  
+  return fSharingEfficiency->GetSharingEff(det,ring,vtxbin);
+
+}
+//_____________________________________________________________________
 Float_t AliFMDAnaParameters::GetMaxR(Char_t ring) const{
   Float_t radius = 0;
   if(ring == 'I')
index f419dfc..22660af 100644 (file)
@@ -38,6 +38,7 @@
 #include "AliFMDAnaCalibBackgroundCorrection.h"
 #include "AliFMDAnaCalibEnergyDistribution.h"
 #include "AliFMDAnaCalibEventSelectionEfficiency.h"
+#include "AliFMDAnaCalibSharingEfficiency.h"
 #include <TVector2.h>
 #include <TString.h>
 //#include "AliPWG0Helper.h"
@@ -54,7 +55,8 @@ public:
     /** Pulser gain */ 
     kBackgroundCorrection         = 0x1, // Background Correction 
     kEnergyDistributions          = 0x2, // Energy Distributions
-    kEventSelectionEfficiency     = 0x4  // Event Selection Efficiency
+    kEventSelectionEfficiency     = 0x4, // Event Selection Efficiency
+    kSharingEfficiency            = 0x8  // Sharing algorithm efficiency
   };
   
   enum Trigger { kMB1 = 0, kMB2, kSPDFASTOR, kTEST_NOCTP };
@@ -69,7 +71,7 @@ public:
       @return  single to */
   static AliFMDAnaParameters* Instance();
   
-  void Init(Bool_t forceReInit=kTRUE, UInt_t what=kBackgroundCorrection|kEnergyDistributions|kEventSelectionEfficiency);
+  void Init(Bool_t forceReInit=kTRUE, UInt_t what=kBackgroundCorrection|kEnergyDistributions|kEventSelectionEfficiency|kSharingEfficiency);
   Float_t GetVtxCutZ();
   Int_t GetNvtxBins();
   Int_t GetNetaBins();
@@ -84,12 +86,15 @@ public:
   static const char* GetBackgroundID() { return fgkBackgroundID;}
   static const char* GetEdistID()      { return fgkEnergyDistributionID;}
   static const char* GetEventSelectionEffID()      { return fgkEventSelectionEffID;}
+  static const char* GetSharingEffID()      { return fgkSharingEffID;}
   TH2F* GetBackgroundCorrection(Int_t det, Char_t ring, Int_t vtxbin);
   TH1F* GetDoubleHitCorrection(Int_t det, Char_t ring);
   
-  Float_t GetEventSelectionEfficiency(Int_t vtxbin);
-  Float_t GetPhiFromSector(UShort_t det, Char_t ring, UShort_t sec) const;
-  Float_t GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Float_t zvtx) const;
+  TH1F* GetSharingEfficiency(Int_t det, Char_t ring, Int_t vtxbin);
+  
+  Float_t  GetEventSelectionEfficiency(Int_t vtxbin);
+  Float_t  GetPhiFromSector(UShort_t det, Char_t ring, UShort_t sec) const;
+  Float_t  GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Float_t zvtx) const;
   Float_t  GetStripLength(Char_t ring, UShort_t strip)  ;
   Float_t  GetBaseStripLength(Char_t ring, UShort_t strip)  ;
   Float_t  GetMaxR(Char_t ring) const;
@@ -97,6 +102,7 @@ public:
   void     SetBackgroundPath(const Char_t* bgpath) {fBackgroundPath.Form(bgpath);}
   void     SetEnergyPath(const Char_t* epath) {fEnergyPath.Form(epath);}
   void     SetEventSelectionPath(const Char_t* evpath) {fEventSelectionEffPath.Form(evpath);}
+  void     SetSharingEfficiencyPath(const Char_t* sharpath) {fSharingEffPath.Form(sharpath);}
   void     SetProcessPrimary(Bool_t prim=kTRUE) {fProcessPrimary = prim;}
   void     SetProcessHits(Bool_t hits=kTRUE) {fProcessHits = hits;}
   Bool_t   GetProcessPrimary() {return fProcessPrimary;}
@@ -108,6 +114,8 @@ public:
   void     SetEnergy(Energy energy) {fEnergy = energy;}
   void     SetMagField(MagField magfield) {fMagField = magfield;}
   char*    GetPath(const char* species);
+
+
 protected:
   
   AliFMDAnaParameters();
@@ -118,11 +126,13 @@ protected:
       fBackground(o.fBackground),
       fEnergyDistribution(o.fEnergyDistribution),
       fEventSelectionEfficiency(o.fEventSelectionEfficiency),
+      fSharingEfficiency(o.fSharingEfficiency),
       fCorner1(o.fCorner1),
       fCorner2(o.fCorner2),
       fEnergyPath(o.fEnergyPath),
       fBackgroundPath(o.fBackgroundPath),
       fEventSelectionEffPath(o.fEventSelectionEffPath),
+      fSharingEffPath(o.fSharingEffPath),
       fProcessPrimary(o.fProcessPrimary),
       fProcessHits(o.fProcessHits),
       fTrigger(o.fTrigger),
@@ -139,6 +149,7 @@ protected:
   void InitBackground();
   void InitEnergyDists();
   void InitEventSelectionEff();
+  void InitSharingEff();
   
   TH1F* GetEnergyDistribution(Int_t det, Char_t ring, Float_t eta);
   TObjArray* GetBackgroundArray();
@@ -152,18 +163,20 @@ protected:
   AliFMDAnaCalibBackgroundCorrection*         fBackground;
   AliFMDAnaCalibEnergyDistribution*           fEnergyDistribution;
   AliFMDAnaCalibEventSelectionEfficiency*     fEventSelectionEfficiency;
-  
+  AliFMDAnaCalibSharingEfficiency*            fSharingEfficiency;
   //static const char* fgkBackgroundCorrection;
   //static const char* fgkEnergyDists;
   static const char* fgkBackgroundID;
   static const char* fgkEnergyDistributionID ;
   static const char* fgkEventSelectionEffID ;
+  static const char* fgkSharingEffID ;
   
   TVector2 fCorner1;
   TVector2 fCorner2;
   TString  fEnergyPath;
   TString  fBackgroundPath;
   TString  fEventSelectionEffPath;
+  TString  fSharingEffPath;
   Bool_t   fProcessPrimary;
   Bool_t   fProcessHits; 
   Trigger  fTrigger;
index 966f82e..818db9d 100644 (file)
@@ -220,6 +220,12 @@ void AliFMDAnalysisTaskDensity::Exec(Option_t */*option*/)
              correction = correction*hDoubleHitCorrection->GetBinContent(hDoubleHitCorrection->FindBin(eta));
            
          }
+         TH1F* hSharingEff = pars->GetSharingEfficiency(det,ring,vtxbin);
+           
+           if(hSharingEff->GetBinContent(hSharingEff->FindBin(eta)) != 0)
+             correction = correction*hSharingEff->GetBinContent(hSharingEff->FindBin(eta));
+         
+         
          
          if(correction) nParticles = nParticles / correction;
          if(nParticles > 0)
index eb33ee8..9c39ff4 100644 (file)
@@ -4,6 +4,7 @@
 #include "AliLog.h"
 #include "TH1.h"
 #include "AliFMDAnaParameters.h"
+#include "AliFMDAnaCalibSharingEfficiency.h"
 #include "TStyle.h"
 //#include "TObjArray.h"
 #include "TCanvas.h"
@@ -37,6 +38,11 @@ void AliFMDDndeta::SetNames(Analysis what) {
     fEvents.Form("nEvents");
     fPrimdNdeta.Form("hMultvsEtaNoCuts");
     break;
+  case kHitsTrVtx :
+    fPrimEvents.Form("nMCEvents"); 
+    fEvents.Form("nEvents");
+    fPrimdNdeta.Form("hMultvsEtaNoCuts");
+    break;
   case kMult :
     fPrimEvents.Form("nMCEventsNoCuts"); 
     fEvents.Form("nEvents");
@@ -60,6 +66,9 @@ const char* AliFMDDndeta::GetAnalysisName(Analysis what, UShort_t det, Char_t ri
   case kHits :
     name = Form("hits_NoCuts_FMD%d%c_vtxbin%d_proj",det,ring,vtxbin); //NoCuts added
     break;
+  case kHitsTrVtx :
+    name = Form("hits_FMD%d%c_vtxbin%d_proj",det,ring,vtxbin); 
+    break;
   case kMult :
     name = Form("dNdeta_FMD%d%c_vtxbin%d_proj",det,ring,vtxbin);
     break;
@@ -81,6 +90,9 @@ const char* AliFMDDndeta::GetPrimName(Analysis what, UShort_t det, Char_t ring,
   case kHits :
     name = Form("hMCHits_nocuts_FMD%d%c_vtxbin%d",det,ring,vtxbin); //nocuts added
     break;
+  case kHitsTrVtx :
+    name = Form("hMCHits_FMD%d%c_vtxbin%d",det,ring,vtxbin);
+    break;
   case kMult :
     name = Form("primmult_vtxbin%d",vtxbin);
     break;
@@ -268,8 +280,10 @@ void AliFMDDndeta::GenerateMult(Analysis what) {
          if(multhistproj->GetBinContent(i) !=0)
            nNonZero++;
        }
-       //if(det == 2 && ring =='I')
-       //  fNbinsToCut = 1;
+       Int_t nBinsOld = fNbinsToCut;
+       if(det == 2 && ringChar =='I') {
+         fNbinsToCut = 0;
+       }
        TH1F* hRingMult = (TH1F*)fMultList.FindObject(Form("hRingMult_FMD%d%c",det,ringChar));
        
        for(Int_t i=1; i<=hRingMult->GetNbinsX(); i++) {
@@ -283,7 +297,7 @@ void AliFMDDndeta::GenerateMult(Analysis what) {
            if(hRingMult->GetBinError(i)>0) {
              oldweight = 1/TMath::Power(hRingMult->GetBinError(i),2);
              oldwav    = oldweight*hRingMult->GetBinContent(i);
-         }
+           }
            Float_t  weight = 1/TMath::Power(multhistproj->GetBinError(i),2);
            Float_t  wav    = oldwav + weight*multhistproj->GetBinContent(i);
            Float_t  sumofw = oldweight + weight;
@@ -300,14 +314,13 @@ void AliFMDDndeta::GenerateMult(Analysis what) {
        
        TH1F* sumMultHist = (TH1F*)fMultList.FindObject(Form("hMult_vtxbin%d",v));
        for(Int_t i =1;i<=sumMultHist->GetNbinsX();i++) {
-         if(multhistproj->GetBinContent(i) == 0 ) continue;
-         
-         nNonZeroInData++;
+         if(multhistproj->GetBinContent(i) != 0 ) {      
+           nNonZeroInData++;
          
-         if(nNonZeroInData <=fNbinsToCut || nNonZeroInData > (nNonZero - fNbinsToCut)) {
-           continue;
-         }
-         if(sumMultHist->GetBinContent(i) == 0 && multhistproj->GetBinContent(i) != 0){
+           if(nNonZeroInData <=fNbinsToCut || nNonZeroInData > (nNonZero - fNbinsToCut)) {
+             continue;
+           }
+           if(sumMultHist->GetBinContent(i) == 0 && multhistproj->GetBinContent(i) != 0){
              sumMultHist->SetBinContent(i,multhistproj->GetBinContent(i));
              sumMultHist->SetBinError(i,multhistproj->GetBinError(i));
            }
@@ -322,8 +335,11 @@ void AliFMDDndeta::GenerateMult(Analysis what) {
            }
            
        
+         }
        }
+       fNbinsToCut = nBinsOld;
       }
+      
     }
   }
   
@@ -465,6 +481,7 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin) {
          hPrimVtx->SetLabelFont(132,"xyz");
          hPrimVtx->SetStats(0000);
          hPrimVtx->GetXaxis()->SetTitle("#eta");
+         hPrimVtx->GetYaxis()->SetRangeUser(0,15);
          hPrimVtx->DrawCopy("E3");
          l->Draw();
          multhistproj->DrawCopy("same");
@@ -515,8 +532,8 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin) {
   if(nPrimevents > 0)
     hPrim->Scale(1/nPrimevents);
   
-  //  TFile testin("/home/canute/data/oldhome/ALICE/FMDanalysis/GRIDtest/fmd_dNdeta_hits.root","READ");
-  /* TFile testin("/home/canute/ALICE/FMDanalysis/productionData/fmd_dNdeta_hits.root","READ");
+    TFile testin("/home/canute/ALICE/FMDanalysis/GridAnalysis/fmd_dNdeta_hits.root","READ");
+    // TFile testin("/home/canute/ALICE/FMDanalysis/productionData/fmd_dNdeta_hits.root","READ");
   TH1F* hcorrect = (TH1F*)testin.Get("hReldif");
   hcorrect->SetName("djarnis");
   std::cout<<hcorrect<<std::endl;
@@ -526,7 +543,7 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin) {
  
   sumMult->Divide(hcorrect);
   //delete hcorrect;
-  */
+  
   
   sumMult->Rebin(rebin);
   sumMult->Scale(1/rebin);
@@ -571,15 +588,15 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin) {
   
   sumMult->DrawCopy("PE");
   hPrim->DrawCopy("E3same");
-  primMult->DrawCopy("E3same");
+  //primMult->DrawCopy("E3same");
   hPrim->GetXaxis()->SetTitle("#eta");
   
   hPrim->SetMarkerStyle(8);
   
-  hPrim->DrawCopy("Psame");
+  hPrim->DrawCopy("PE3same");
   sumMult->DrawCopy("PEsame");
   std::cout<<"FMD 1 "<<sumMult->Integral(sumMult->FindBin(3),sumMult->FindBin(5),"width")<<std::endl;
-  /* TFile* itsfile = TFile::Open(itsfilename);
+  /*TFile* itsfile = TFile::Open(itsfilename);
   if(itsfile) {
     //itsfile->cd();
     
@@ -601,9 +618,9 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin) {
   */
   
   
-  TLegend* leg = new TLegend(0.35,0.2,0.65,0.45,"");
+  TLegend* leg = new TLegend(0.35,0.2,0.65,0.35,"");
   leg->AddEntry(hPrim,"Primary","pf");
-  leg->AddEntry(primMult,"Analysed prim","f");
+  //leg->AddEntry(primMult,"Analysed prim","f");
   leg->AddEntry(sumMult,"Analysis","p");
   leg->Draw();
   TString species;
@@ -629,6 +646,59 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin) {
   fout.Close();
     
 }
+//_____________________________________________________________________
+void AliFMDDndeta::CreateSharingEfficiency(const Char_t* filename, Bool_t store) {
+
+  Init(filename);
+  AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
+  //pars->Init(kTRUE,AliFMDAnaParameters::kBackgroundCorrection);
+  Int_t nVertexBins = pars->GetNvtxBins();
+  
+  SetNames(kHits);
+  TH1I* hEvents          = (TH1I*)fList->FindObject(fEvents.Data());
+  TH1I* hPrimEvents      = (TH1I*)fList->FindObject(fPrimEvents.Data());
+
+  SetNames(kHitsTrVtx);
+  TH1I* hEventsTrVtx     = (TH1I*)fList->FindObject(fEvents.Data());
+  TH1I* hPrimEventsTrVtx = (TH1I*)fList->FindObject(fPrimEvents.Data());
+  
+  AliFMDAnaCalibSharingEfficiency* sharEff = new AliFMDAnaCalibSharingEfficiency();
+  
+  for(Int_t det = 1; det<=3; det++) {
+    Int_t maxRing = (det == 1 ? 0 : 1);
+    for(Int_t ring = 0;ring<=maxRing;ring++) {
+      Char_t ringChar = (ring == 0 ? 'I' : 'O');
+      for(Int_t v=0; v< nVertexBins; v++) {
+       TH1F* hHits = (TH1F*)fList->FindObject(GetAnalysisName(kHits,det, ringChar, v));
+       TH1F* hHitsTrVtx   = (TH1F*)fList->FindObject(GetAnalysisName(kHitsTrVtx,det, ringChar, v));
+       TH1F* hMCHits      = (TH1F*)fList->FindObject(GetPrimName(kHits,det, ringChar, v));
+       TH1F* hMCHitsTrVtx = (TH1F*)fList->FindObject(GetPrimName(kHitsTrVtx,det, ringChar, v));
+       
+       TH1F* hCorrection  = (TH1F*)hHits->Clone(Form("hCorrection_FMD%d%c_vtx%d"));
+       TH1F* hCorrectionTrVtx  = (TH1F*)hHitsTrVtx->Clone(Form("hCorrection_FMD%d%c_vtx%d"));
+       
+       hCorrection->Scale(1./(Float_t)hEvents->GetBinContent(v+1));
+       hMCHits->Scale(1./(Float_t)hPrimEvents->GetBinContent(v+1));
+       hCorrectionTrVtx->Scale(1./(Float_t)hEventsTrVtx->GetBinContent(v+1));
+       hMCHitsTrVtx->Scale(1./(Float_t)hPrimEventsTrVtx->GetBinContent(v+1));
+       hCorrection->Divide(hMCHits);
+       hCorrectionTrVtx->Divide(hMCHitsTrVtx);
+       
+       sharEff->SetSharingEff(det,ringChar,v,hCorrection);
+       sharEff->SetSharingEffTrVtx(det,ringChar,v,hCorrectionTrVtx);
+       //      std::cout<<hHits<<"  "<<hHitsTrVtx<<"   "<<hPrim<<"    "<<hPrimTrVtx<<std::endl;
+
+       }
+      }
+    }
+
+  if(store) {
+    TFile fsharing(pars->GetPath(pars->GetSharingEffID()),"RECREATE");
+    sharEff->Write(AliFMDAnaParameters::GetSharingEffID());
+    fsharing.Close();
+  }
+  
+}
 
 //_____________________________________________________________________
 //
index 101d754..003fb64 100644 (file)
@@ -11,13 +11,14 @@ class AliFMDDndeta : public TObject
  public:
   AliFMDDndeta();
   
-  enum Analysis {kHits, kMult, kMultTrVtx};
+  enum Analysis {kHits, kHitsTrVtx, kMult, kMultTrVtx};
   
   void Init(const Char_t* filename); 
   void GenerateMult(Analysis what);
   void DrawDndeta(Analysis what, Int_t rebin = 1);
   void SetNbinsToCut(Int_t nbins) {fNbinsToCut = nbins;}
+  void SetVtxCut(Int_t vtxcut) {fVtxCut = vtxcut;}
+  void CreateSharingEfficiency(const Char_t* filename, Bool_t store = kFALSE);
  private:
   void GenerateHits();
   void SetNames(Analysis what);
index cb095f9..4befe5c 100644 (file)
@@ -32,6 +32,7 @@
 #pragma link C++ class AliFMDAnaCalibBackgroundCorrection+;
 #pragma link C++ class AliFMDAnaCalibEnergyDistribution+;
 #pragma link C++ class AliFMDAnaCalibEventSelectionEfficiency+;
+#pragma link C++ class AliFMDAnaCalibSharingEfficiency+;
 #pragma link C++ class AliFMDAnaParameters+;
 #pragma link C++ class AliFMDAnalysisTaskESDReader+;
 #pragma link C++ class AliFMDAnalysisTaskSharing+;
@@ -41,6 +42,7 @@
 #pragma link C++ class AliFMDAnalysisTaskGenerateCorrection+;
 #pragma link C++ class AliFMDDndeta+;
 
+
 #else
 # error Not for compilation 
 #endif
index d83d54b..86ce9a2 100644 (file)
@@ -5,6 +5,7 @@ SRCS            =  analysis/AliFMDAnaParameters.cxx     \
                   analysis/AliFMDAnaCalibEnergyDistribution.cxx \
                   analysis/AliFMDAnaCalibBackgroundCorrection.cxx \
                    analysis/AliFMDAnaCalibEventSelectionEfficiency.cxx \
+                   analysis/AliFMDAnaCalibSharingEfficiency.cxx \
                    analysis/AliFMDAnalysisTaskESDReader.cxx    \
                   analysis/AliFMDAnalysisTaskSharing.cxx       \
                   analysis/AliFMDAnalysisTaskDensity.cxx       \