Adding NSD analysis as well as new features and removing warnings
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Aug 2010 21:38:03 +0000 (21:38 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Aug 2010 21:38:03 +0000 (21:38 +0000)
16 files changed:
PWG2/FORWARD/analysis/AliFMDAnaCalibEventSelectionEfficiency.cxx
PWG2/FORWARD/analysis/AliFMDAnaCalibEventSelectionEfficiency.h
PWG2/FORWARD/analysis/AliFMDAnaParameters.cxx
PWG2/FORWARD/analysis/AliFMDAnaParameters.h
PWG2/FORWARD/analysis/AliFMDAnalysisTaskBackgroundCorrection.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskCollector.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskDndeta.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskDndeta.h
PWG2/FORWARD/analysis/AliFMDAnalysisTaskGenerateCorrection.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskSE.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskSharing.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskSharing.h
PWG2/FORWARD/analysis/AliFMDDndeta.cxx
PWG2/FORWARD/analysis/AliFMDDndeta.h
PWG2/FORWARD/corrections/Background/background_0_0_1_0_0_0.root
PWG2/FORWARD/corrections/EventSelectionEfficiency/eventselectionefficiency_0_0_1_0_0_0.root

index c53974e2238efc21f929299e1752972341fac068..7cc8368560dd1b6ce94475b098081b81d5c41ad4 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <TH1F.h>
 #include <TBrowser.h>
+#include "AliLog.h"
+#include "iostream"
 
 ClassImp(AliFMDAnaCalibEventSelectionEfficiency)
 #if 0
@@ -13,6 +15,7 @@ ClassImp(AliFMDAnaCalibEventSelectionEfficiency)
 AliFMDAnaCalibEventSelectionEfficiency::AliFMDAnaCalibEventSelectionEfficiency() : TObject(),
                                                                                   fCorrection(),
                                                                                   fIsInit(kFALSE),
+                                                                                  fCorrectionList(),
                                                                                   fVtxEff(1)
 {
   
@@ -22,7 +25,12 @@ AliFMDAnaCalibEventSelectionEfficiency::AliFMDAnaCalibEventSelectionEfficiency()
 
 
 //____________________________________________________________________
-AliFMDAnaCalibEventSelectionEfficiency::AliFMDAnaCalibEventSelectionEfficiency(const AliFMDAnaCalibEventSelectionEfficiency& o) : TObject(o),                                                               fCorrection(o.fCorrection),                                                     fIsInit(o.fIsInit)
+AliFMDAnaCalibEventSelectionEfficiency::
+AliFMDAnaCalibEventSelectionEfficiency(const AliFMDAnaCalibEventSelectionEfficiency& o) : TObject(o),                       
+                                                                                         fCorrection(o.fCorrection),
+                                                                                         fIsInit(o.fIsInit),
+                                                                                         fCorrectionList(),
+                                                                                         fVtxEff(o.fVtxEff)
 {
   // Copy ctor 
 }
@@ -56,18 +64,35 @@ void AliFMDAnaCalibEventSelectionEfficiency::SetCorrection(TH1F* hCorrection) {
 
 }
 //____________________________________________________________________
-void AliFMDAnaCalibEventSelectionEfficiency::SetCorrection(Int_t vtxbin, 
+void AliFMDAnaCalibEventSelectionEfficiency::SetCorrection(Char_t* trig,
+                                                          Int_t vtxbin, 
                                                           Char_t ring,
                                                           TH2F* hCorrection) {
-  hCorrection->SetName(Form("correction_%c_%d",ring,vtxbin));
+  if(trig != "INEL" && trig != "NSD")
+    AliWarning("Please choose NSD or INEL!");
+  
+  if(trig == "INEL")
+    hCorrection->SetName(Form("correction_%c_%d",ring,vtxbin));
+  if(trig == "NSD") 
+    hCorrection->SetName(Form("correction%s_%c_%d","NSD",ring,vtxbin));
+  
   fCorrectionList.Add(hCorrection);
   
 }
 //____________________________________________________________________
-TH2F* AliFMDAnaCalibEventSelectionEfficiency::GetCorrection(Int_t vtxbin, 
+TH2F* AliFMDAnaCalibEventSelectionEfficiency::GetCorrection(Char_t* trig,
+                                                           Int_t vtxbin, 
                                                            Char_t ring) {
   
-  TH2F* hCorrection = (TH2F*)fCorrectionList.FindObject(Form("correction_%c_%d",ring,vtxbin));
+  TString name;
+  
+  if(trig == "INEL")
+    name.Form("correction_%c_%d",ring,vtxbin);
+  if(trig == "NSD") 
+    name.Form("correction%s_%c_%d","NSD",ring,vtxbin);
+  
+  TH2F* hCorrection = (TH2F*)fCorrectionList.FindObject(name);
+   
   return hCorrection;
 
 }
index 195bdfa0a09f4b7e0121b98197e86492c4d348b6..c1989171a983c2c0c85bd0beeb2e1db783be98a9 100644 (file)
@@ -24,8 +24,8 @@ class AliFMDAnaCalibEventSelectionEfficiency : public TObject
   void    Browse(TBrowser* b);
   void    SetCorrection(TH1F* hCorrection);
   Float_t GetCorrection(Int_t vtxbin);
-  void    SetCorrection(Int_t vtxbin, Char_t ring, TH2F* hCorrection);
-  TH2F*   GetCorrection(Int_t vtxbin, Char_t ring);
+  void    SetCorrection(Char_t* trig, Int_t vtxbin, Char_t ring, TH2F* hCorrection);
+  TH2F*   GetCorrection(Char_t* trig, Int_t vtxbin, Char_t ring);
   Float_t GetVtxToTriggerRatio() {return fVtxEff; }
   void    SetVtxToTriggerRatio(Float_t vtxEff) {fVtxEff = vtxEff;}
  protected:
index 18f165e826b0415c6bbde8914927597209d60311..7c43376f2bf388794db5dae90280c5523d01d069 100644 (file)
@@ -91,10 +91,15 @@ AliFMDAnaParameters::AliFMDAnaParameters() :
   fSharingObjectPresent(kTRUE),
   fNumberOfEtaBinsToCut(1),
   fEtaLowBinLimits(),
-  fEtaHighBinLimits()
+  fEtaHighBinLimits(),
+  fTriggerInel(kFALSE),
+  fTriggerNSD(kFALSE),
+  fTriggerEmpty(kFALSE)     
 {
   // Default constructor 
   fPhysicsSelection = new AliPhysicsSelection;
+  fPhysicsSelection->SetAnalyzeMC(kTRUE); //For the background correction. This is reset in Init if relevant
+  
   AliBackgroundSelection* backgroundSelection = new AliBackgroundSelection("bg","bg");
   
   fPhysicsSelection->AddBackgroundIdentification(backgroundSelection);
@@ -126,7 +131,7 @@ char* AliFMDAnaParameters::GetPath(const char* species) {
                fTrigger,
                fMagField,
                fSpecies,
-               0,
+               fRealData,
                0);
   if(species == fgkEventSelectionEffID)
     path = Form("%s/%s_%d_%d_%d_%d_%d_%d.root",
@@ -168,7 +173,12 @@ void AliFMDAnaParameters::Init(Bool_t forceReInit, UInt_t what)
   if(fBackground)
     FindEtaLimits();
   
+  if(!fRealData) {
+    fPhysicsSelection->SetAnalyzeMC(kTRUE);
+  }
+  else fPhysicsSelection->SetAnalyzeMC(kFALSE);
   
+    
 }
 //____________________________________________________________________
 
@@ -301,11 +311,21 @@ void AliFMDAnaParameters::PrintStatus() const
     collsystemstring.Form("invalid collision system");   break;
   }
   
-
+  TString datastring;
+  switch(fRealData) {
+  case kTRUE:
+    datastring.Form("Nature"); break;
+  case kFALSE: 
+    datastring.Form("MC"); break;
+  default:
+    datastring.Form("Unknown"); break ;
+  }
+    
   std::cout<<"Energy      = "<<energystring.Data()<<std::endl;
   std::cout<<"Trigger     = "<<triggerstring.Data()<<std::endl;
   std::cout<<"Mag Field   = "<<magstring.Data()<<std::endl;
   std::cout<<"Coll System = "<<collsystemstring.Data()<<std::endl;
+  std::cout<<"Data origin = "<<datastring.Data()<<std::endl;
   
   
   
@@ -537,13 +557,18 @@ Float_t AliFMDAnaParameters::GetVtxSelectionEffFromMC() {
 
 }
 //_____________________________________________________________________
-TH2F* AliFMDAnaParameters::GetEventSelectionEfficiency(Int_t vtxbin, Char_t ring) {
+TH2F* AliFMDAnaParameters::GetEventSelectionEfficiency(Char_t* trig, Int_t vtxbin, Char_t ring) {
   //Get event selection efficiency object
+  
+  if(trig != "NSD" && trig != "INEL") {
+    AliWarning("Event selection efficiency only available for INEL and NSD");
+    return 0;
+  }
   if(!fIsInit) {
     AliWarning("Not initialized yet. Call Init() to remedy");
     return 0;
   }
-  return fEventSelectionEfficiency->GetCorrection(vtxbin,ring);
+  return fEventSelectionEfficiency->GetCorrection(trig,vtxbin,ring);
 
 }
 //_____________________________________________________________________
@@ -685,7 +710,7 @@ Bool_t AliFMDAnaParameters::GetVertex(const AliESDEvent* esd, Double_t* vertexXY
   
   if(vertex)
     vertex->GetXYZ(vertexXYZ);
-    
+
   //if(vertexXYZ[0] == 0 || vertexXYZ[1] == 0 )
   //  return kFALSE;
  
@@ -699,21 +724,9 @@ Bool_t AliFMDAnaParameters::GetVertex(const AliESDEvent* esd, Double_t* vertexXY
   
 }
 //____________________________________________________________________
-Bool_t AliFMDAnaParameters::IsEventTriggered(const AliESDEvent *esd, Trigger trig) {
-  //Did we have trig trigger ?
-  Trigger old = fTrigger;
-  fTrigger = trig;
-  Bool_t retval = IsEventTriggered(esd);
-  fTrigger = old;
-  return retval;
+void AliFMDAnaParameters::SetTriggerStatus(const AliESDEvent *esd) {
 
-}
-//____________________________________________________________________
-Bool_t AliFMDAnaParameters::IsEventTriggered(const AliESDEvent *esd) const {
-  // check if the event was triggered
-  
-  if (fCentralSelection) return kTRUE;
-  ULong64_t triggerMask = esd->GetTriggerMask();
+  //ULong64_t triggerMask = esd->GetTriggerMask();
   
   TString triggers = esd->GetFiredTriggerClasses();
   
@@ -725,27 +738,41 @@ Bool_t AliFMDAnaParameters::IsEventTriggered(const AliESDEvent *esd) const {
   // if(triggers.Contains("CINT1C-ABCE-NOPF-ALL")) return kFALSE;
   
   // definitions from p-p.cfg
-  ULong64_t spdFO = (1 << 14);
-  ULong64_t v0left = (1 << 11);
-  ULong64_t v0right = (1 << 12);
-  AliTriggerAnalysis tAna;
+  //ULong64_t spdFO = (1 << 14);
+  // ULong64_t v0left = (1 << 11);
+  // ULong64_t v0right = (1 << 12);
   
+  AliTriggerAnalysis tAna;
+    
   //REMOVE WHEN FINISHED PLAYING WITH TRIGGERS!
   //fPhysicsSelection->IsCollisionCandidate(esd);
-  if(!fRealData) {
-    fPhysicsSelection->SetAnalyzeMC(kTRUE);
+  
+  //if(!fRealData) {
+  //  fPhysicsSelection->SetAnalyzeMC(kTRUE);
+  // }
+  
+  fTriggerInel  = kFALSE;
+  fTriggerNSD   = kFALSE;
+  fTriggerEmpty = kFALSE;
+  
+  if(fPhysicsSelection->IsCollisionCandidate(esd)) {
+    fTriggerInel = kTRUE;
   }
-  switch (fTrigger) {
+  if(fTriggerInel && tAna.IsOfflineTriggerFired(esd,AliTriggerAnalysis::kNSD1)) {
+    fTriggerNSD = kTRUE;
+  }
+  if(triggers.Contains("CBEAMB-ABCE-NOPF-ALL")) {
+    fTriggerEmpty = kTRUE;
+  }
+  
+  
+  /*switch (fTrigger) {
   case kMB1: {
-    // if(fRealData) {
-      if( fPhysicsSelection->IsCollisionCandidate(esd))
-       return kTRUE;
-      //}
-      //else {
-      // if (triggerMask & spdFO || ((triggerMask & v0left) || (triggerMask & v0right)))
-      //       return kTRUE;
-      break;
-      //}
+    if( fPhysicsSelection->IsCollisionCandidate(esd)) {
+      fTriggerInel = kTRUE;
+    }
+    break;
+    
   }
   case kMB2: { 
     if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right)))
@@ -762,35 +789,59 @@ Bool_t AliFMDAnaParameters::IsEventTriggered(const AliESDEvent *esd) const {
     break;
   }
   case kEMPTY: {
-    /*
-    const AliMultiplicity* testmult = esd->GetMultiplicity();
-    Int_t nTrackLets = testmult->GetNumberOfTracklets();
-    Int_t nClusters  = testmult->GetNumberOfSingleClusters();
-    Int_t fastOR = tAna.SPDFiredChips(esd, 0);
-    
-    const AliESDVertex* vertex = 0;
-    vertex = esd->GetPrimaryVertexSPD();
-    Bool_t vtxstatus = vertex->GetStatus();
-    if(vertex->GetNContributors() <= 0)
-      vtxstatus = kFALSE;
-    
-    if(vertex->GetZRes() > 0.1 ) 
-      vtxstatus = kFALSE;
-    
-    Bool_t v0ABG = tAna.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0ABG);
-    
-    Bool_t v0CBG = tAna.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0CBG);
-    Bool_t v0A = tAna.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0A);
-    Bool_t v0C = tAna.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0C);*/
-    //    if(triggers.Contains("CINT1A-ABCE-NOPF-ALL") || triggers.Contains("CINT1C-ABCE-NOPF-ALL")) 
-    if(triggers.Contains("CBEAMB-ABCE-NOPF-ALL")) 
+  if(triggers.Contains("CBEAMB-ABCE-NOPF-ALL")) 
+  return kTRUE;
+    break;
+  }
+  case kNSD: {
+    if(fPhysicsSelection->IsCollisionCandidate(esd) && tAna.IsOfflineTriggerFired(esd,AliTriggerAnalysis::kNSD1))
       return kTRUE;
     break;
   }
     
   }//switch
+  */
+  
+}
+/*
+//____________________________________________________________________
+Bool_t AliFMDAnaParameters::IsEventTriggered(const AliESDEvent *esd, Trigger trig) {
+  //Did we have trig trigger ?
+  Trigger old = fTrigger;
+  fTrigger = trig;
+  Bool_t retval = IsEventTriggered(esd);
+  fTrigger = old;
+  return retval;
+
+}
+*/
+//____________________________________________________________________
+Bool_t AliFMDAnaParameters::IsEventTriggered(Trigger trigger) {
+  // check if the event was triggered
+  
+  if (fCentralSelection) return kTRUE;
+  switch (trigger) {
   
+  case kMB1:
+    return fTriggerInel;
+    break;
+  case kNSD:
+    return fTriggerNSD;
+    break;
+  case kEMPTY:
+    return fTriggerEmpty;
+    break;
+  case kNOCTP:
+    return kTRUE;
+    break;
+  default:
+    AliWarning("Trigger not implemented!!!");
+    break;
+    
+    
+  }
   return kFALSE;
+  
 }
     
 //____________________________________________________________________
index b302a50e6c838f386091dac8e8d5e1b81ecea668..1899ec2f92119f2001f881120c38ddcb6f919321 100644 (file)
@@ -62,7 +62,7 @@ public:
     kSharingEfficiency            = 0x8  // Sharing algorithm efficiency
   };
   
-  enum Trigger { kMB1 = 0, kMB2, kSPDFASTOR, kNOCTP, kEMPTY };
+  enum Trigger { kMB1 = 0, kMB2, kSPDFASTOR, kNOCTP, kEMPTY , kNSD};
   
   enum Energy { k900 , k10000, k14000 , k7000, k2400, k5500};
   
@@ -102,7 +102,7 @@ public:
   TH1F* GetSharingEfficiency(Int_t det, Char_t ring, Int_t vtxbin);
   TH1F* GetSharingEfficiencyTrVtx(Int_t det, Char_t ring, Int_t vtxbin);
   Float_t  GetEventSelectionEfficiency(Int_t vtxbin);
-  TH2F*    GetEventSelectionEfficiency(Int_t vtxbin, Char_t ring);
+  TH2F*    GetEventSelectionEfficiency(Char_t* trig, Int_t vtxbin, Char_t ring);
   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)  ;
@@ -120,8 +120,9 @@ public:
   Bool_t   GetVertex(const AliESDEvent* esd, Double_t* vertexXYZ);
   void     SetTriggerDefinition(Trigger trigger) {fTrigger = trigger;}
   Trigger  GetTriggerDefinition() const {return fTrigger;}
-  Bool_t   IsEventTriggered(const AliESDEvent *esd) const;
-  Bool_t   IsEventTriggered(const AliESDEvent *esd, Trigger trigger) ;
+  //Bool_t   IsEventTriggered(const AliESDEvent *esd) ;
+  Bool_t   IsEventTriggered(Trigger trigger) ;
+  void     SetTriggerStatus(const AliESDEvent *esd) ;
   void     SetEnergy(Energy energy) {fEnergy = energy;}
   Energy   GetEnergy() {return fEnergy;}
   void     SetMagField(MagField magfield) {fMagField = magfield;}
@@ -180,7 +181,10 @@ protected:
       fSharingObjectPresent(o.fSharingObjectPresent),
       fNumberOfEtaBinsToCut(o.fNumberOfEtaBinsToCut),
       fEtaLowBinLimits(o.fEtaLowBinLimits),
-      fEtaHighBinLimits(o.fEtaHighBinLimits)
+      fEtaHighBinLimits(o.fEtaHighBinLimits),
+      fTriggerInel(o.fTriggerInel),
+      fTriggerNSD(o.fTriggerNSD),
+      fTriggerEmpty(o.fTriggerEmpty)
   {}
   AliFMDAnaParameters& operator=(const AliFMDAnaParameters&) { return *this; }
   virtual ~AliFMDAnaParameters() {}
@@ -197,7 +201,6 @@ protected:
   Int_t    GetFirstEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring) ;
   Int_t    GetLastEtaBinFromMap(Int_t vtxbin, Int_t det, Char_t ring) ;
 
-  
   TObjArray* GetBackgroundArray();
   
   TAxis* GetRefAxis();
@@ -236,8 +239,12 @@ protected:
   Bool_t   fCentralSelection;         //if event selection is done centrally
   Bool_t   fSharingObjectPresent ;    //Do we have a sharing object ? 
   Int_t    fNumberOfEtaBinsToCut;     //Number of eta bins to remove from edge effects
-  TH3F     fEtaLowBinLimits;
-  TH3F     fEtaHighBinLimits;
+  TH3F     fEtaLowBinLimits;          //Histogram of low eta bin limits
+  TH3F     fEtaHighBinLimits;         //Histogram of high eta bin limits
+  Bool_t   fTriggerInel;              //If the selected INEL trigger fired
+  Bool_t   fTriggerNSD;               //If the NSD trigger fired
+  Bool_t   fTriggerEmpty;             //Event should be empty (empty bunches)
+  
   ClassDef(AliFMDAnaParameters,1) // Manager of parameters
 };
 
index 327d07dc6c8d06f2308a2565e120b057ceca30ca..25e84b335477c6acd1276ef9205cf089ebe94e1a 100644 (file)
@@ -79,11 +79,13 @@ void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
   
   
   
-  TH2F* hMult = 0;
-  TH2F* hMultTrVtx = 0;
-  TH2F* hHits = 0;
-  TH2F* hSPDMult = 0;
+  TH2F* hMult         = 0;
+  TH2F* hMultTrVtx    = 0;
+  TH2F* hMultNSD      = 0;
+  TH2F* hHits         = 0;
+  TH2F* hSPDMult      = 0;
   TH2F* hSPDMultTrVtx = 0;
+  TH2F* hSPDMultNSD   = 0;
   // TH2F* hHitsNoCuts = 0;
   Int_t nVtxbins = pars->GetNvtxBins();
   for(Int_t i = 0; i< nVtxbins; i++) {
@@ -104,7 +106,7 @@ 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),
+           hMultTrVtx  = new TH2F(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),
                                   hBg->GetNbinsX(),
                                   hBg->GetXaxis()->GetXmin(),
                                   hBg->GetXaxis()->GetXmax(),
@@ -112,6 +114,16 @@ void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
            hMultTrVtx->Sumw2();
 
            fOutputList->Add(hMultTrVtx);
+           
+           hMultNSD  = new TH2F(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,i),Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,i),
+                                  hBg->GetNbinsX(),
+                                  hBg->GetXaxis()->GetXmin(),
+                                  hBg->GetXaxis()->GetXmax(),
+                                  nSec, 0, 2*TMath::Pi());
+           hMultNSD->Sumw2();
+
+           fOutputList->Add(hMultNSD);
+           
            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(),
@@ -146,6 +158,14 @@ void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
                         20, 0, 2*TMath::Pi());
     hSPDMultTrVtx->Sumw2();
     fOutputList->Add(hSPDMultTrVtx);
+    hSPDMultNSD  = new TH2F(Form("multNSD_SPD_vtxbin%d",i),Form("multNSD_SPD_vtxbin%d",i),
+                        hBg->GetNbinsX(),
+                        hBg->GetXaxis()->GetXmin(),
+                        hBg->GetXaxis()->GetXmax(),
+                        20, 0, 2*TMath::Pi());
+    hSPDMultNSD->Sumw2();
+    fOutputList->Add(hSPDMultNSD);
+    
     
   }
   TH2F* hBg = pars->GetBackgroundCorrection(1, 'I', 5);
@@ -188,17 +208,22 @@ void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
       hMult->Reset();
       TH2F* hMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       hMultTrVtx->Reset();
+      TH2F* hMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
+      hMultNSD->Reset();
     
       TH2F* hSPDMult      = (TH2F*)fOutputList->FindObject(Form("mult_SPD_vtxbin%d",vtxbin));
       hSPDMult->Reset();
       TH2F* hSPDMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin));
       hSPDMultTrVtx->Reset();
+      TH2F* hSPDMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_SPD_vtxbin%d",vtxbin));
+      hSPDMultNSD->Reset();
     }
     
   }
   
-  
-  
+  AliESDInputHandler* eventHandler = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+  AliESDEvent* esd = eventHandler->GetEvent();
+  Bool_t nsd = pars->IsEventTriggered(AliFMDAnaParameters::kNSD);
   for(UShort_t det=1;det<=3;det++) {
     
     Int_t nRings = (det==1 ? 1 : 2);
@@ -207,6 +232,7 @@ void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
       
       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* hMultNSD   = (TH2F*)fOutputList->FindObject(Form("multNSD_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*)fHitList->FindObject(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       
@@ -217,17 +243,25 @@ void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
       
       hMult->Add(hMultInput);
       hMultTrVtx->Add(hMultInput);
+      
       hMult->Divide(hBg);//,"B");
       hMultTrVtx->Divide(hBg);//,"B");
-
+      
+      if(nsd) {
+       hMultNSD->Add(hMultInput);
+       hMultNSD->Divide(hBg);
+      }
+      
       //sharing efficiency correction ?
       if(pars->SharingEffPresent()) {
        TH1F* hSharingEff = pars->GetSharingEfficiencyTrVtx(det,ringChar,vtxbin); 
        TH1F* hSharingEffTrVtx = pars->GetSharingEfficiencyTrVtx(det,ringChar,vtxbin);  
       
        for(Int_t nx=1; nx<hMult->GetNbinsX(); nx++) {
-         Float_t correction = hSharingEff->GetBinContent(nx);
+         Float_t correction      = hSharingEff->GetBinContent(nx);
          Float_t correctionTrVtx = hSharingEffTrVtx->GetBinContent(nx);
+         //FIXME : This should be for NSD events
+         Float_t correctionNSD   = hSharingEff->GetBinContent(nx);
          
          for(Int_t ny=1; ny<hMult->GetNbinsY(); ny++) {
            
@@ -241,6 +275,13 @@ void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
              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);
            }
+           if(correctionNSD != 0 && nsd) {
+             hMultNSD->SetBinContent(nx,ny,hMultNSD->GetBinContent(nx,ny)/correctionNSD);
+             Float_t error = TMath::Sqrt(TMath::Power(hMultNSD->GetBinError(nx,ny),2) + TMath::Power(hMultNSD->GetBinContent(nx,ny)*hSharingEff->GetBinError(nx),2)) / correctionNSD;
+             hMultNSD->SetBinError(nx,ny,error);
+           }
+           
+           
          }
          
        }
@@ -250,7 +291,8 @@ void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
       //       hMult->Scale(1/pars->GetEventSelectionEfficiency(vtxbin));
        //else
        //hMult->Scale(0);
-      hMult->Divide(pars->GetEventSelectionEfficiency(vtxbin,ringChar));
+      hMult->Divide(pars->GetEventSelectionEfficiency("INEL",vtxbin,ringChar));
+      hMultNSD->Divide(pars->GetEventSelectionEfficiency("NSD",vtxbin,ringChar));
       
       
       }
@@ -260,18 +302,18 @@ void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
   
   TH2F* hSPDMult      = (TH2F*)fOutputList->FindObject(Form("mult_SPD_vtxbin%d",vtxbin));
   TH2F* hSPDMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin));
+  TH2F* hSPDMultNSD   = (TH2F*)fOutputList->FindObject(Form("multNSD_SPD_vtxbin%d",vtxbin));
   
-  AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-  AliESDEvent* esd = esdH->GetEvent();
   const AliMultiplicity* spdmult = esd->GetMultiplicity();
   for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++) {
     hSPDMult->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
     hSPDMultTrVtx->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
+    hSPDMultNSD->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
   }
   for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++) {
     hSPDMult->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j));
     hSPDMultTrVtx->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j));
-    
+    hSPDMultNSD->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j));
   }
   
   TH2F* hBgSPD        = pars->GetBackgroundCorrection(0, 'Q', vtxbin);
@@ -297,16 +339,16 @@ void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
        hSPDMultTrVtx->SetBinContent(i,j,correctedMult);
        hSPDMult->SetBinError(i,j,correctedError);
        hSPDMultTrVtx->SetBinError(i,j,correctedError);
+       if(nsd) {
+         hSPDMultNSD->SetBinContent(i,j,correctedMult);
+         hSPDMultNSD->SetBinError(i,j,correctedError);
+       }
+          
       }
     }
   }
-  hSPDMult->Divide(pars->GetEventSelectionEfficiency(vtxbin,'I'));
-  
-  //if(pars->GetEventSelectionEfficiency(vtxbin) > 0)
-     // hSPDMult->Scale(1/pars->GetEventSelectionEfficiency(vtxbin));
-  //else
-  //  hSPDMult->Scale(0);
-  
+  hSPDMult->Divide(pars->GetEventSelectionEfficiency("INEL",vtxbin,'I'));
+  hSPDMultNSD->Divide(pars->GetEventSelectionEfficiency("NSD",vtxbin,'I'));
   }
   else
     AliWarning("No SPD background map found");
index abdf4e18b3e5b6bb33da894347ec0855ad117bb4..c62c6ace82d3e8b4be76712bf04f77121169ae44 100644 (file)
@@ -156,18 +156,20 @@ void AliFMDAnalysisTaskCollector::UserExec(Option_t */*option*/)
     esd->CopyFromOldESD();
   }
   AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
+  pars->SetTriggerStatus(esd);
   TString triggers = esd->GetFiredTriggerClasses();
   //if(!triggers.IsNull()) return;
   //Bool_t trigger = pars->IsEventTriggered(esd);
   
-  Bool_t physics = pars->IsEventTriggered(esd);
-  Bool_t empty   = pars->IsEventTriggered(esd,AliFMDAnaParameters::kEMPTY);
+  Bool_t physics = pars->IsEventTriggered(AliFMDAnaParameters::kMB1);
+  Bool_t empty   = pars->IsEventTriggered(AliFMDAnaParameters::kEMPTY);
   //std::cout<<physics<<"   "<<empty<<std::endl;
   //if(!trigger)
   //  physics = kFALSE;
-  Double_t vertex[3];
+  Double_t vertex[3] ={0,0,0};
   
   Bool_t vtxStatus =   pars->GetVertex(esd,vertex);
+  
   if(!vtxStatus)
     physics = kFALSE;
   
@@ -186,6 +188,7 @@ void AliFMDAnalysisTaskCollector::UserExec(Option_t */*option*/)
   
   if(!physics && !empty)
     return;
+  
   TH1F* Edist = 0;
   TH1F* emptyEdist = 0;
   TH1F* ringEdist = 0;
index 56dde1b06b4aa61fa9eb8f3cdacc3fd7818563b9..4efdef3fd54e6d6adbaedbeedb8564ec616aeb70 100644 (file)
@@ -28,6 +28,7 @@
 //#include "TParticlePDG.h"
 #include "AliFMDStripIndex.h"
 #include "AliESDInputHandler.h"
+
 ClassImp(AliFMDAnalysisTaskDndeta)
 
 
@@ -37,10 +38,13 @@ AliFMDAnalysisTaskDndeta::AliFMDAnalysisTaskDndeta()
   fInputList(0),
   fVertexString(0x0),
   fNevents(),
+  fNNSDevents(),
   fNMCevents(),
+  fNMCNSDevents(),
   fStandalone(kTRUE),
   fLastTrackByStrip(0),
-  fVtxEff(1)
+  fVtxEff(1),
+  fVtxEffNSD(1)
 {
   // Default constructor
   DefineInput (0, TList::Class());
@@ -54,10 +58,13 @@ AliFMDAnalysisTaskDndeta::AliFMDAnalysisTaskDndeta(const char* name, Bool_t SE):
     fInputList(0),
     fVertexString(0x0),
     fNevents(),
+    fNNSDevents(),
     fNMCevents(),
+    fNMCNSDevents(),
     fStandalone(kTRUE),
     fLastTrackByStrip(0),
-    fVtxEff(1)
+    fVtxEff(1),
+    fVtxEffNSD(1)
 {
   fStandalone = SE;
   if(fStandalone) {
@@ -78,10 +85,11 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects()
   
   
   TH2F* hMult = 0;
+  TH2F* hMultNSD = 0;
   TH1F* hHits = 0;
   TH2F* hMultTrVtx = 0;
   TH1F* hPrimVertexBin = 0;
-  
+  TH1F* hPrimVertexBinNSD = 0;
   
   TH2F* hBgTmp   = pars->GetBackgroundCorrection(1, 'I', 0);
   TH1F* hPrimary = new TH1F("hMultvsEta","hMultvsEta",
@@ -90,6 +98,12 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects()
                            hBgTmp->GetXaxis()->GetXmax());
   hPrimary->Sumw2();
   fOutputList->Add(hPrimary);
+  TH1F* hPrimaryNSD = new TH1F("hMultvsEtaNSD","hMultvsEtaNSD",
+                           hBgTmp->GetNbinsX(),
+                           hBgTmp->GetXaxis()->GetXmin(),
+                           hBgTmp->GetXaxis()->GetXmax());
+  hPrimaryNSD->Sumw2();
+  fOutputList->Add(hPrimaryNSD);
   Int_t nVtxbins = pars->GetNvtxBins();
   TH2F* hBg = 0;
   for(Int_t i = 0; i< nVtxbins; i++) {
@@ -110,7 +124,12 @@ 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),
+           hMultTrVtx  = new TH2F(Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),Form("dNdetaTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),
+                                  hBg->GetNbinsX(),
+                                  hBg->GetXaxis()->GetXmin(),
+                                  hBg->GetXaxis()->GetXmax(),
+                                  nSec, 0, 2*TMath::Pi());
+           hMultNSD  = new TH2F(Form("dNdetaNSD_FMD%d%c_vtxbin%d",det,ringChar,i),Form("dNdetaNSD_FMD%d%c_vtxbin%d",det,ringChar,i),
                                   hBg->GetNbinsX(),
                                   hBg->GetXaxis()->GetXmin(),
                                   hBg->GetXaxis()->GetXmax(),
@@ -128,6 +147,9 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects()
            hMultTrVtx->Sumw2();
            fOutputList->Add(hMultTrVtx);
            
+           hMultNSD->Sumw2();
+           fOutputList->Add(hMultNSD);
+           
          }
       } 
   }
@@ -141,6 +163,16 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects()
                              hBgTmp->GetXaxis()->GetXmax());
     hPrimVertexBin->Sumw2();
     fOutputList->Add(hPrimVertexBin);
+    
+    hPrimVertexBinNSD = new TH1F(Form("primmult_NSD_vtxbin%d",i),
+                                Form("primmult_NSD_vtxbin%d",i),
+                                hBgTmp->GetNbinsX(),
+                                hBgTmp->GetXaxis()->GetXmin(),
+                                hBgTmp->GetXaxis()->GetXmax());
+    hPrimVertexBinNSD->Sumw2();
+    fOutputList->Add(hPrimVertexBinNSD);
+    
+
     //SPD part
     TH2F* hSPDMult  = new TH2F(Form("dNdeta_SPD_vtxbin%d",i),Form("dNdeta_SPD_vtxbin%d",i),
                         hBgTmp->GetNbinsX(),
@@ -156,23 +188,38 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects()
                         20, 0, 2*TMath::Pi());
     hSPDMultTrVtx->Sumw2();
     fOutputList->Add(hSPDMultTrVtx);
+
+    TH2F* hSPDMultNSD  = new TH2F(Form("dNdetaNSD_SPD_vtxbin%d",i),Form("dNdetaNSD_SPD_vtxbin%d",i),
+                        hBgTmp->GetNbinsX(),
+                        hBgTmp->GetXaxis()->GetXmin(),
+                        hBgTmp->GetXaxis()->GetXmax(),
+                        20, 0, 2*TMath::Pi());
+    hSPDMultNSD->Sumw2();
+    fOutputList->Add(hSPDMultNSD);
+
   }
   
   //AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
   
-  TH2F* dNdetadphiHistogramTotal = new TH2F("dNdetadphiHistogramTotal","dNdetadphiHistogram;#eta;#Phi",pars->GetNetaBins(),-6,6,20,0,2*TMath::Pi());
+  //  TH2F* dNdetadphiHistogramTotal = new TH2F("dNdetadphiHistogramTotal","dNdetadphiHistogram;#eta;#Phi",pars->GetNetaBins(),-6,6,20,0,2*TMath::Pi());
   //dNdetadphiHistogramTotal->SetErrorOption("g");
-  fOutputList->Add(dNdetadphiHistogramTotal);
+  //fOutputList->Add(dNdetadphiHistogramTotal);
   
   
   
   fNevents.SetBins(nVtxbins,0,nVtxbins);
   fNevents.SetName("nEvents");
+  fNNSDevents.SetBins(nVtxbins,0,nVtxbins);
+  fNNSDevents.SetName("nNSDEvents");
+  
   fNMCevents.SetBins(nVtxbins,0,nVtxbins);
   fNMCevents.SetName("nMCEvents");
+  fNMCNSDevents.SetBins(nVtxbins,0,nVtxbins);
+  fNMCNSDevents.SetName("nMCNSDEvents");
   fOutputList->Add(&fNevents);
+  fOutputList->Add(&fNNSDevents);
   fOutputList->Add(&fNMCevents);
-  
+  fOutputList->Add(&fNMCNSDevents);
 }
 //_____________________________________________________________________
 void AliFMDAnalysisTaskDndeta::ConnectInputData(Option_t */*option*/)
@@ -191,41 +238,55 @@ void AliFMDAnalysisTaskDndeta::Exec(Option_t */*option*/)
   
   fNevents.Fill(vtxbin);
   
+  //AliESDInputHandler* eventHandler = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+  //AliESDEvent* esd = eventHandler->GetEvent();
+  Bool_t nsd = pars->IsEventTriggered(AliFMDAnaParameters::kNSD);
+  if(nsd) fNNSDevents.Fill(vtxbin);
+  
   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("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
+      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* hMultTotalNSD   = (TH2F*)fOutputList->FindObject(Form("dNdetaNSD_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       
-      TH2F* hMultInput = (TH2F*)fInputList->FindObject(Form("mult_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));
+      TH2F* hMultInputNSD   = (TH2F*)fInputList->FindObject(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,vtxbin));
       
       hMultTotal->Add(hMultInput);
       hMultTotalTrVtx->Add(hMultInputTrVtx);
-            
+      if(nsd)
+       hMultTotalNSD->Add(hMultInputNSD);
+      
     }
   }
   
   //SPD code
   TH2F* hMultSPDTotal      = (TH2F*)fOutputList->FindObject(Form("dNdeta_SPD_vtxbin%d",vtxbin));
   TH2F* hMultSPDTotalTrVtx = (TH2F*)fOutputList->FindObject(Form("dNdetaTrVtx_SPD_vtxbin%d",vtxbin));
+  TH2F* hMultSPDTotalNSD   = (TH2F*)fOutputList->FindObject(Form("dNdetaNSD_SPD_vtxbin%d",vtxbin));
   TH2F* hMultSPDInput      = (TH2F*)fInputList->FindObject(Form("mult_SPD_vtxbin%d",vtxbin));
   TH2F* hMultSPDInputTrVtx = (TH2F*)fInputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin));
+  TH2F* hMultSPDInputNSD   = (TH2F*)fInputList->FindObject(Form("multNSD_SPD_vtxbin%d",vtxbin));
+  
   hMultSPDTotal->Add(hMultSPDInput);
   hMultSPDTotalTrVtx->Add(hMultSPDInputTrVtx);
-  
+  if(nsd)
+    hMultSPDTotalNSD->Add(hMultSPDInputNSD);
   
   if(pars->GetProcessPrimary())
     ProcessPrimary();
   
-  TH2F* dNdetadphiHistogram = (TH2F*)fOutputList->FindObject("dNdetadphiHistogramSPDTrVtx");
+  //TH2F* dNdetadphiHistogram = (TH2F*)fOutputList->FindObject("dNdetadphiHistogramSPDTrVtx");
   
-  TH2F* dNdetadphiHistogramTotal = (TH2F*)fOutputList->FindObject("dNdetadphiHistogramTotal");
+  //  TH2F* dNdetadphiHistogramTotal = (TH2F*)fOutputList->FindObject("dNdetadphiHistogramTotal");
   
-  if(vtxbin == 4)
-    dNdetadphiHistogramTotal->Add(dNdetadphiHistogram);
+  //  if(vtxbin == 4)
+  //  dNdetadphiHistogramTotal->Add(dNdetadphiHistogram);
   
   
   
@@ -252,14 +313,21 @@ void AliFMDAnalysisTaskDndeta::Terminate(Option_t */*option*/) {
        if(fVtxEff)
          hMultTotal->Scale(fVtxEff);
        
+       TH2F* hMultTotalNSD = (TH2F*)fOutputList->FindObject(Form("dNdetaNSD_FMD%d%c_vtxbin%d",det,ringChar,i));
+       if(fVtxEffNSD)
+         hMultTotalNSD->Scale(fVtxEffNSD);
+       
        //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));
        
        TH1D* hMultProj   = hMultTotal->ProjectionX(Form("dNdeta_FMD%d%c_vtxbin%d_proj",det,ringChar,i),1,hMultTotal->GetNbinsY());
-       TH1D* hMultProjTrVtx   = hMultTrVtx->ProjectionX(Form("dNdeta_FMD%d%c_TrVtx_vtxbin%d_proj",det,ringChar,i),1,hMultTotal->GetNbinsY());
+       TH1D* hMultProjTrVtx   = hMultTrVtx->ProjectionX(Form("dNdeta_FMD%d%c_TrVtx_vtxbin%d_proj",det,ringChar,i),1,hMultTrVtx->GetNbinsY());
+       TH1D* hMultProjNSD   = hMultTotalNSD->ProjectionX(Form("dNdetaNSD_FMD%d%c_vtxbin%d_proj",det,ringChar,i),1,hMultTotalNSD->GetNbinsY());
+       
        //fOutputList->Add(hMultTrVtx);
        fOutputList->Add(hMultProj);
        fOutputList->Add(hMultProjTrVtx);
+       fOutputList->Add(hMultProjNSD);
       }
     }
   }
@@ -268,20 +336,24 @@ void AliFMDAnalysisTaskDndeta::Terminate(Option_t */*option*/) {
     
     TH2F* hSPDMult = (TH2F*)fOutputList->FindObject(Form("dNdeta_SPD_vtxbin%d",i));
     TH2F* hSPDMultTrVtx = (TH2F*)fOutputList->FindObject(Form("dNdetaTrVtx_SPD_vtxbin%d",i));
+    TH2F* hSPDMultNSD = (TH2F*)fOutputList->FindObject(Form("dNdetaNSD_SPD_vtxbin%d",i));
     
     if(fVtxEff)
       hSPDMult->Scale(fVtxEff);
        
+    if(fVtxEffNSD)
+      hSPDMult->Scale(fVtxEffNSD);
     
     TH1D* hMultProj   = hSPDMult->ProjectionX(Form("dNdeta_SPD_vtxbin%d_proj",i),1,hSPDMult->GetNbinsY());
     TH1D* hMultProjTrVtx   = hSPDMultTrVtx->ProjectionX(Form("dNdetaTrVtx_SPD_vtxbin%d_proj",i),1,hSPDMultTrVtx->GetNbinsY());
-   
+    TH1D* hMultProjNSD   = hSPDMultNSD->ProjectionX(Form("dNdetaNSD_SPD_vtxbin%d_proj",i),1,hSPDMultNSD->GetNbinsY());
     fOutputList->Add(hMultProj);
     fOutputList->Add(hMultProjTrVtx);
+    fOutputList->Add(hMultProjNSD);
   
   }
   
-  std::cout<<"FMD analysis accepted "<<fNevents.GetEntries()<<" events"<<std::endl;
+  std::cout<<"FMD analysis accepted "<<fNevents.GetEntries()<<" INEL events and "<<fNNSDevents.GetEntries()<<" NSD events"<<std::endl;
 }
 //_____________________________________________________________________
 void AliFMDAnalysisTaskDndeta::ProcessPrimary() {
@@ -299,8 +371,15 @@ void AliFMDAnalysisTaskDndeta::ProcessPrimary() {
   AliStack* stack = mcEvent->Stack();
   
   TH1F* hPrimary = (TH1F*)fOutputList->FindObject("hMultvsEta");
+  TH1F* hPrimaryNSD = (TH1F*)fOutputList->FindObject("hMultvsEtaNSD");
   AliHeader* header            = mcEvent->Header();
   AliGenEventHeader* genHeader = header->GenEventHeader();
+  AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
+  
+  Int_t pythiaType = pythiaGenHeader->ProcessType();
+  Bool_t nsd = kTRUE;
+  if(pythiaType==92||pythiaType==93)
+    nsd = kFALSE;
   
   TArrayF vertex;
   genHeader->PrimaryVertex(vertex);
@@ -311,6 +390,9 @@ void AliFMDAnalysisTaskDndeta::ProcessPrimary() {
   Int_t    vertexBin       = (Int_t)vertexBinDouble;
     
   Bool_t firstTrack = kTRUE;
+  Bool_t firstTrackNSD = kTRUE;
+  
+  TH1F* hPrimVtxBin = (TH1F*)fOutputList->FindObject(Form("primmult_NSD_vtxbin%d",vertexBin));
   
   // we loop over the primaries only unless we need the hits (diagnostics running slowly)
   Int_t nTracks = stack->GetNprimary();
@@ -324,8 +406,15 @@ void AliFMDAnalysisTaskDndeta::ProcessPrimary() {
    
     if(stack->IsPhysicalPrimary(i) && particle->Charge() != 0) {
       hPrimary->Fill(particle->Eta());
-      
-
+      if(nsd) {
+       hPrimaryNSD->Fill(particle->Eta());
+       
+       hPrimVtxBin->Fill(particle->Eta());
+       if(firstTrackNSD) {
+         fNMCNSDevents.Fill(vertexBin);
+         firstTrackNSD = kFALSE;
+       }
+      }
       TH1F* hPrimVtxBin = (TH1F*)fOutputList->FindObject(Form("primmult_vtxbin%d",vertexBin));
       hPrimVtxBin->Fill(particle->Eta());
       if(firstTrack) {
index e83a5bea5d9a1287fbd85be324aaffde7f649cd6..67b58a7d41b566bd3a8cbf170a9d73f0f039c3eb 100644 (file)
@@ -28,10 +28,14 @@ class AliFMDAnalysisTaskDndeta : public AliAnalysisTask
                                                               fInputList(0),
                                                               fVertexString(o.fVertexString),
                                                               fNevents(o.fNevents),
+                                                              fNNSDevents(o.fNNSDevents),
                                                               fNMCevents(o.fNMCevents),
+                                                              fNMCNSDevents(o.fNMCNSDevents),
                                                               fStandalone(o.fStandalone),
                                                               fLastTrackByStrip(o.fLastTrackByStrip),
-                                                              fVtxEff(o.fVtxEff) {}
+                                                              fVtxEff(o.fVtxEff),
+                                                              fVtxEffNSD(o.fVtxEffNSD)
+  {}
   AliFMDAnalysisTaskDndeta& operator=(const AliFMDAnalysisTaskDndeta&) { return *this; }
   // Implementation of interface methods
   virtual void ConnectInputData(Option_t *option = "");
@@ -47,17 +51,22 @@ class AliFMDAnalysisTaskDndeta : public AliAnalysisTask
   void ProcessPrimary();
   TList* GetOutputList() {return fOutputList;}
   void SetVtxEfficiency(Float_t vtxeff) {fVtxEff = vtxeff;}
+  void SetVtxEfficiencyNSD(Float_t vtxeff) {fVtxEffNSD = vtxeff;}
   
  private:
-  Int_t         fDebug;        //  Debug flag
-  TList*        fOutputList;
-  TList*        fInputList;
-  TObjString*   fVertexString;
-  TH1I          fNevents;
-  TH1I          fNMCevents;
-  Bool_t        fStandalone;
+  Int_t          fDebug;        //  Debug flag
+  TList*         fOutputList;
+  TList*         fInputList;
+  TObjString*    fVertexString;
+  TH1I           fNevents;
+  TH1I           fNNSDevents;
+  TH1I           fNMCevents;
+  TH1I           fNMCNSDevents;
+  Bool_t         fStandalone;
   AliFMDFloatMap fLastTrackByStrip;
   Float_t        fVtxEff;             //Efficiency of vertex sel.
+  Float_t        fVtxEffNSD;          //Efficiency of vertex sel., NSD
+   
   ClassDef(AliFMDAnalysisTaskDndeta, 0); // Analysis task for FMD analysis
 };
  
index 427506e433dd24367f90ffc7b5674304689df3fd..a04038c11a50a64537219aefac1deac888e245ea 100644 (file)
@@ -17,6 +17,7 @@
 #include "AliHeader.h"
 #include "AliFMDAnaCalibBackgroundCorrection.h"
 #include "AliFMDAnaCalibEventSelectionEfficiency.h"
+#include "AliGenPythiaEventHeader.h"
 //#include "AliCDBManager.h"
 //#include "AliCDBId.h"
 //#include "AliCDBMetaData.h"
@@ -123,9 +124,13 @@ void AliFMDAnalysisTaskGenerateCorrection::UserCreateOutputObjects()
   
   TH1F* hEventsSelected  = new TH1F("EventsSelected","EventsSelected",fNvtxBins,0,fNvtxBins);
   TH1F* hEventsAll    = new TH1F("EventsAll","EventsAll",fNvtxBins,0,fNvtxBins);
+  TH1F* hEventsAllNSD    = new TH1F("EventsAllNSD","EventsAllNSD",fNvtxBins,0,fNvtxBins);
   TH1F* hEventsSelectedVtx  = new TH1F("EventsSelectedVtx","EventsSelectedVtx",fNvtxBins,0,fNvtxBins);  
   TH1F* hEventsSelectedTrigger  = new TH1F("EventsSelectedTrigger","EventsSelectedTrigger",fNvtxBins,0,fNvtxBins);
   
+  TH1F* hEventsSelectedNSDVtx  = new TH1F("EventsSelectedNSDVtx","EventsSelectedNSDVtx",fNvtxBins,0,fNvtxBins);  
+  TH1F* hEventsSelectedNSD     = new TH1F("EventsSelectedNSD","EventsSelectedNSD",fNvtxBins,0,fNvtxBins);
+  
   TH1F* hXvtx = new TH1F("hXvtx","x vertex distribution",100,-2,2);
   TH1F* hYvtx = new TH1F("hYvtx","y vertex distribution",100,-2,2);
   TH1F* hZvtx = new TH1F("hZvtx","z vertex distribution",4*fNvtxBins,-4*fZvtxCut,4*fZvtxCut);
@@ -136,10 +141,17 @@ void AliFMDAnalysisTaskGenerateCorrection::UserCreateOutputObjects()
   
   hEventsSelected->Sumw2();
   hEventsAll->Sumw2();
+  hEventsAllNSD->Sumw2();
+  
   fListOfHits.Add(hEventsSelected);
   fListOfHits.Add(hEventsSelectedVtx);
   fListOfHits.Add(hEventsSelectedTrigger);
+  fListOfHits.Add(hEventsSelectedNSDVtx);
+  fListOfHits.Add(hEventsSelectedNSD);
+  
+  
   fListOfPrimaries.Add(hEventsAll);
+  fListOfPrimaries.Add(hEventsAllNSD);
   
   for(Int_t v=0; v<fNvtxBins;v++) {
     
@@ -153,6 +165,13 @@ void AliFMDAnalysisTaskGenerateCorrection::UserCreateOutputObjects()
       hAnalysed->Sumw2();
       fListOfPrimaries.Add(hAnalysed);
       
+      TH2F* hAnalysedNSD       = new TH2F(Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v),
+                                         Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v),
+                                         fNbinsEta, -4,6, nSec, 0,2*TMath::Pi());
+      
+      hAnalysedNSD->Sumw2();
+      fListOfPrimaries.Add(hAnalysedNSD);
+      
       TH2F* hInel           = new TH2F(Form("Inel_FMD%c_vtx%d",ringChar,v),
                                       Form("Inel_FMD%c_vtx%d",ringChar,v),
                                       fNbinsEta, -4,6, nSec, 0,2*TMath::Pi());
@@ -160,6 +179,13 @@ void AliFMDAnalysisTaskGenerateCorrection::UserCreateOutputObjects()
       hInel->Sumw2();
       fListOfPrimaries.Add(hInel);
       
+      TH2F* hNSD           = new TH2F(Form("NSD_FMD%c_vtx%d",ringChar,v),
+                                     Form("NSD_FMD%c_vtx%d",ringChar,v),
+                                     fNbinsEta, -4,6, nSec, 0,2*TMath::Pi());
+      
+      hNSD->Sumw2();
+      fListOfPrimaries.Add(hNSD);
+      
     }
   }
   
@@ -186,6 +212,9 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
   
   
   AliESDEvent* esdevent = (AliESDEvent*)InputEvent();
+  
+  pars->SetTriggerStatus(esdevent);
+  
   Double_t esdvertex[3];
   Bool_t vtxStatus =  pars->GetVertex(esdevent,esdvertex);
   
@@ -199,6 +228,22 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
   AliHeader* header            = mcevent->Header();
   AliGenEventHeader* genHeader = header->GenEventHeader();
   
+  AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
+  if (!pythiaGenHeader) {
+    std::cout<<" no pythia header!"<<std::endl;
+    return; 
+  }
+  
+  Int_t pythiaType = pythiaGenHeader->ProcessType();
+  Bool_t nsd = kTRUE;
+  if(pythiaType==92 || pythiaType==93)
+    nsd = kFALSE;
+  
+  //if(pythiaType==94){
+  //  std::cout<<"double diffractive"<<std::endl;
+  //  return;
+  //}
+  
   TArrayF vertex;
   genHeader->PrimaryVertex(vertex);
   
@@ -210,8 +255,7 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
   hZvtx->Fill(vertex.At(2));
 
   
-  if(TMath::Abs(vertex.At(2)) > fZvtxCut)
-    return;
+  
   
   Double_t delta           = 2*fZvtxCut/fNvtxBins;
   Double_t vertexBinDouble = (vertex.At(2) + fZvtxCut) / delta;
@@ -221,7 +265,10 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
   TH1F* hEventsSelected           = (TH1F*)fListOfHits.FindObject("EventsSelected");
   TH1F* hEventsSelectedVtx        = (TH1F*)fListOfHits.FindObject("EventsSelectedVtx");
   TH1F* hEventsSelectedTrigger    = (TH1F*)fListOfHits.FindObject("EventsSelectedTrigger");
+  TH1F* hEventsSelectedNSDVtx     = (TH1F*)fListOfHits.FindObject("EventsSelectedNSDVtx");
+  TH1F* hEventsSelectedNSD        = (TH1F*)fListOfHits.FindObject("EventsSelectedNSD");
   TH1F* hEventsAll                = (TH1F*)fListOfPrimaries.FindObject("EventsAll");
+  TH1F* hEventsAllNSD             = (TH1F*)fListOfPrimaries.FindObject("EventsAllNSD");
   
   // TH1F* hTriggered      = (TH1F*)fListOfHits.FindObject("Triggered");
   //  TH1F* hTriggeredAll   = (TH1F*)fListOfPrimaries.FindObject("TriggeredAll");
@@ -230,14 +277,23 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
   if(!vtxStatus)
     vtxFound = kFALSE;
   
-  Bool_t isTriggered = pars->IsEventTriggered(esdevent);
-  
+  if(TMath::Abs(vertex.At(2)) > fZvtxCut) {
+    vtxFound = kFALSE;
+    
+  }
+  Bool_t isTriggered    = pars->IsEventTriggered(AliFMDAnaParameters::kMB1);
+  Bool_t isTriggeredNSD = pars->IsEventTriggered(AliFMDAnaParameters::kNSD);
   if(vtxFound && isTriggered) hEventsSelected->Fill(vertexBin);
   
   if(vtxFound) hEventsSelectedVtx->Fill(vertexBin);
   if(isTriggered) hEventsSelectedTrigger->Fill(vertexBin);
-    
+
+  if(vtxFound && isTriggeredNSD) hEventsSelectedNSDVtx->Fill(vertexBin);
+  if(isTriggeredNSD) hEventsSelectedNSD->Fill(vertexBin);
+
+  
   hEventsAll->Fill(vertexBin);
+  if(nsd) hEventsAllNSD->Fill(vertexBin);
   
   //  if(!vtxFound || !isTriggered) return;
   
@@ -256,11 +312,18 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
       hPrimaryOuter->Fill(particle->Eta(),particle->Phi());
       TH2F* hAnalysedInner = (TH2F*)fListOfPrimaries.FindObject( Form("Analysed_FMD%c_vtx%d",'I',vertexBin));
       TH2F* hAnalysedOuter = (TH2F*)fListOfPrimaries.FindObject( Form("Analysed_FMD%c_vtx%d",'O',vertexBin));
+      TH2F* hAnalysedNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'I',vertexBin));
+      TH2F* hAnalysedNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'O',vertexBin));
       TH2F* hInelInner = (TH2F*)fListOfPrimaries.FindObject( Form("Inel_FMD%c_vtx%d",'I',vertexBin));
       TH2F* hInelOuter = (TH2F*)fListOfPrimaries.FindObject( Form("Inel_FMD%c_vtx%d",'O',vertexBin));
-      
+      TH2F* hNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'I',vertexBin));
+      TH2F* hNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'O',vertexBin));
       
       //if(vtxFound && isTriggered) {
+      if(isTriggeredNSD) {
+       hAnalysedNSDInner->Fill(particle->Eta(),particle->Phi());
+       hAnalysedNSDOuter->Fill(particle->Eta(),particle->Phi());
+      }
       if(isTriggered) {
        hAnalysedInner->Fill(particle->Eta(),particle->Phi());
        hAnalysedOuter->Fill(particle->Eta(),particle->Phi());
@@ -268,7 +331,10 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
       hInelInner->Fill(particle->Eta(),particle->Phi());
       hInelOuter->Fill(particle->Eta(),particle->Phi());
       
-      
+      if(nsd) {
+       hNSDInner->Fill(particle->Eta(),particle->Phi());
+       hNSDOuter->Fill(particle->Eta(),particle->Phi());
+      }
     }
     
     for(Int_t j=0; j<particle->GetNumberOfTrackReferences();j++) {
@@ -344,26 +410,47 @@ void AliFMDAnalysisTaskGenerateCorrection::GenerateCorrection() {
   TH1F* hEventsSelected           = (TH1F*)fListOfHits.FindObject("EventsSelected");
   TH1F* hEventsSelectedVtx        = (TH1F*)fListOfHits.FindObject("EventsSelectedVtx");
   TH1F* hEventsSelectedTrigger    = (TH1F*)fListOfHits.FindObject("EventsSelectedTrigger");
+  TH1F* hEventsSelectedNSDVtx     = (TH1F*)fListOfHits.FindObject("EventsSelectedNSDVtx");
+  TH1F* hEventsSelectedNSD        = (TH1F*)fListOfHits.FindObject("EventsSelectedNSD");
+    
   TH1F* hEventsAll                = (TH1F*)fListOfPrimaries.FindObject("EventsAll");
+  TH1F* hEventsAllNSD             = (TH1F*)fListOfPrimaries.FindObject("EventsAllNSD");
   TH1F* hEventsSelectedVtxDivByTr = (TH1F*)hEventsSelectedVtx->Clone("hEventsSelectedVtxDivByTr");
+  TH1F* hEventsSelectedNSDVtxDivByNSD = (TH1F*)hEventsSelectedNSDVtx->Clone("hEventsSelectedNSDVtxDivByNSD");
+  
   fListOfHits.Add(hEventsSelectedVtxDivByTr);
+  fListOfHits.Add(hEventsSelectedNSDVtxDivByNSD);
+  hEventsSelectedNSDVtxDivByNSD->Divide(hEventsSelectedNSD);
   hEventsSelectedVtxDivByTr->Divide(hEventsSelectedTrigger);
-  for(Int_t v=0;v<fNvtxBins  ;v++) {
+  
+  for(Int_t v=0;v<fNvtxBins ; v++) {
     TH2F* hAnalysedInner = (TH2F*)fListOfPrimaries.FindObject(Form("Analysed_FMD%c_vtx%d",'I',v));
     TH2F* hAnalysedOuter = (TH2F*)fListOfPrimaries.FindObject(Form("Analysed_FMD%c_vtx%d",'O',v));
+    TH2F* hAnalysedNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'I',v));
+    TH2F* hAnalysedNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'O',v));
+    
     TH2F* hInelInner = (TH2F*)fListOfPrimaries.FindObject(Form("Inel_FMD%c_vtx%d",'I',v));
     TH2F* hInelOuter = (TH2F*)fListOfPrimaries.FindObject(Form("Inel_FMD%c_vtx%d",'O',v));
-    
+    TH2F* hNSDInner  = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'I',v));
+    TH2F* hNSDOuter  = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'O',v));
     // hAnalysedInner->Scale((hEventsSelected->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelected->GetBinContent(v+1))); 
     //hAnalysedOuter->Scale((hEventsSelected->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelected->GetBinContent(v+1))); 
 
     hAnalysedInner->Scale((hEventsSelectedTrigger->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedTrigger->GetBinContent(v+1))); 
     
     hAnalysedOuter->Scale((hEventsSelectedTrigger->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedTrigger->GetBinContent(v+1))); 
+    hAnalysedNSDInner->Scale((hEventsSelectedNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedNSD->GetBinContent(v+1))); 
+    
+    hAnalysedNSDOuter->Scale((hEventsSelectedNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedNSD->GetBinContent(v+1))); 
+    
     
+
     hInelInner->Scale((hEventsAll->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAll->GetBinContent(v+1))); 
     hInelOuter->Scale((hEventsAll->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAll->GetBinContent(v+1)));
     
+    hNSDInner->Scale((hEventsAllNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAllNSD->GetBinContent(v+1))); 
+    hNSDOuter->Scale((hEventsAllNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAllNSD->GetBinContent(v+1)));
+    
 
     
     //hAnalysedInner->Scale(1./0.84);  //numbers for real data, run104892
@@ -371,9 +458,17 @@ void AliFMDAnalysisTaskGenerateCorrection::GenerateCorrection() {
     hAnalysedInner->Divide(hInelInner);
     hAnalysedOuter->Divide(hInelOuter);
     
-    fEventSelectionEff->SetCorrection(v,'I',hAnalysedInner);
-    fEventSelectionEff->SetCorrection(v,'O',hAnalysedOuter);
-  }
+    hAnalysedNSDInner->Divide(hNSDInner);
+    hAnalysedNSDOuter->Divide(hNSDOuter);
+    
+    fEventSelectionEff->SetCorrection("INEL",v,'I',hAnalysedInner);
+    fEventSelectionEff->SetCorrection("INEL",v,'O',hAnalysedOuter);
+    //NSD
+    fEventSelectionEff->SetCorrection("NSD",v,'I',hAnalysedNSDInner);
+    fEventSelectionEff->SetCorrection("NSD",v,'O',hAnalysedNSDOuter);
+    
+    
+}
   
   Float_t vtxEff = 1;
   if(hEventsSelectedTrigger->GetEntries())
@@ -384,11 +479,14 @@ void AliFMDAnalysisTaskGenerateCorrection::GenerateCorrection() {
   hEventsSelectedVtx->Divide(hEventsAll);
   hEventsSelectedTrigger->Divide(hEventsAll);
   
+  hEventsSelectedNSDVtx->Divide(hEventsAllNSD);
+  hEventsSelectedNSD->Divide(hEventsAllNSD);
+  
   for(Int_t i = 1; i<=hEventsSelected->GetNbinsX(); i++) {
     if(hEventsSelected->GetBinContent(i) == 0 )
       continue;
-     Float_t b    = hEventsSelected->GetBinContent(i);
-     // Float_t b    = hEventsSelected->GetBinContent(i)*hEventsSelectedTrigger->GetBinContent(i);
+    Float_t b    = hEventsSelected->GetBinContent(i);
+    // Float_t b    = hEventsSelected->GetBinContent(i)*hEventsSelectedTrigger->GetBinContent(i);
     Float_t db   = hEventsSelected->GetBinError(i);
     Float_t sum  = hEventsAll->GetBinContent(i);
     Float_t dsum = hEventsAll->GetBinError(i);
@@ -491,12 +589,18 @@ void AliFMDAnalysisTaskGenerateCorrection::ReadFromFile(const Char_t* filename,
   TH1F* hEventsSelected           = (TH1F*)listOfHits->FindObject("EventsSelected");
   TH1F* hEventsSelectedVtx        = (TH1F*)listOfHits->FindObject("EventsSelectedVtx");
   TH1F* hEventsSelectedTrigger    = (TH1F*)listOfHits->FindObject("EventsSelectedTrigger");
+  TH1F* hEventsSelectedNSDVtx     = (TH1F*)listOfHits->FindObject("EventsSelectedNSDVtx");
+  TH1F* hEventsSelectedNSD        = (TH1F*)listOfHits->FindObject("EventsSelectedNSD");  
   TH1F* hEventsAll                = (TH1F*)listOfPrim->FindObject("EventsAll");
+  TH1F* hEventsAllNSD             = (TH1F*)listOfPrim->FindObject("EventsAllNSD");
   
   fListOfHits.Add(hEventsSelected);
   fListOfHits.Add(hEventsSelectedVtx);
+  fListOfHits.Add(hEventsSelectedNSD);
+  fListOfHits.Add(hEventsSelectedNSDVtx);
   fListOfHits.Add(hEventsSelectedTrigger);
   fListOfPrimaries.Add(hEventsAll);
+  fListOfPrimaries.Add(hEventsAllNSD);
   
   TH1F* hXvtx = (TH1F*)listOfPrim->FindObject("hXvtx");
   TH1F* hYvtx = (TH1F*)listOfPrim->FindObject("hYvtx");
@@ -506,23 +610,23 @@ void AliFMDAnalysisTaskGenerateCorrection::ReadFromFile(const Char_t* filename,
   fListOfPrimaries.Add(hZvtx);  
 
   for(Int_t det =1; det<=3;det++)
-      {
-       Int_t nRings = (det==1 ? 1 : 2);
-       for(Int_t ring = 0;ring<nRings;ring++)
-         {
-           Char_t ringChar = (ring == 0 ? 'I' : 'O');
-           TH1F* allHits = (TH1F*)listOfHits->FindObject(Form("allHits_FMD%d%c",det,ringChar));
-           TH1F* doubleHits = (TH1F*)listOfHits->FindObject(Form("DoubleHits_FMD%d%c",det,ringChar));
-           fListOfHits.Add(allHits);
-           fListOfHits.Add(doubleHits);
-           for(Int_t v=0; v<fNvtxBins;v++)
-             {
-               
-               TH2F* hHits          = (TH2F*)listOfHits->FindObject(Form("hHits_FMD%d%c_vtx%d", det,ringChar,v));
-               fListOfHits.Add(hHits);
-             }
-         }
-      }
+    {
+      Int_t nRings = (det==1 ? 1 : 2);
+      for(Int_t ring = 0;ring<nRings;ring++)
+       {
+         Char_t ringChar = (ring == 0 ? 'I' : 'O');
+         TH1F* allHits = (TH1F*)listOfHits->FindObject(Form("allHits_FMD%d%c",det,ringChar));
+         TH1F* doubleHits = (TH1F*)listOfHits->FindObject(Form("DoubleHits_FMD%d%c",det,ringChar));
+         fListOfHits.Add(allHits);
+         fListOfHits.Add(doubleHits);
+         for(Int_t v=0; v<fNvtxBins;v++)
+           {
+             
+             TH2F* hHits          = (TH2F*)listOfHits->FindObject(Form("hHits_FMD%d%c_vtx%d", det,ringChar,v));
+             fListOfHits.Add(hHits);
+           }
+       }
+    }
   for(Int_t v=0; v<fNvtxBins;v++) {
     TH2F* hSPDHits          = (TH2F*)listOfHits->FindObject(Form("hSPDhits_vtx%d", v));   
     fListOfHits.Add(hSPDHits);
@@ -533,11 +637,15 @@ void AliFMDAnalysisTaskGenerateCorrection::ReadFromFile(const Char_t* filename,
       
       TH2F* hPrimary       = (TH2F*)listOfPrim->FindObject( Form("hPrimary_FMD_%c_vtx%d",ringChar,v));
       TH2F* hAnalysed      = (TH2F*)listOfPrim->FindObject(Form("Analysed_FMD%c_vtx%d",ringChar,v));
+      TH2F* hAnalysedNSD   = (TH2F*)listOfPrim->FindObject(Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v));
       TH2F* hInel          = (TH2F*)listOfPrim->FindObject(Form("Inel_FMD%c_vtx%d",ringChar,v));
+      TH2F* hNSD           = (TH2F*)listOfPrim->FindObject(Form("NSD_FMD%c_vtx%d",ringChar,v));
       
       fListOfPrimaries.Add(hPrimary);      
       fListOfPrimaries.Add(hAnalysed);
       fListOfPrimaries.Add(hInel);      
+      fListOfPrimaries.Add(hAnalysedNSD);
+      fListOfPrimaries.Add(hNSD);      
     }
   }
   GenerateCorrection();
index dbcb80b21665043139ac97e7f5111cca963e449d..8249dd42ea82d6b68e88d971b37d47c0f747543c 100644 (file)
@@ -100,7 +100,11 @@ void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/)
   //
   
   AliESDEvent* fESD = (AliESDEvent*)InputEvent();
+  
   //std::cout<<fESD->GetBeamEnergy()<<"   "<<fESD->GetBeamType()<<"    "<<fESD->GetCurrentL3()<<std::endl;
+  AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
+  
+  pars->SetTriggerStatus(fESD);
   fSharing.SetInputESD(fESD);
   
   fSharing.Exec("");
@@ -109,7 +113,7 @@ void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/)
     if(fDensity.GetEventStatus()) {
       fBackground.Exec("");  
       fDndeta.Exec("");
-      fBFCorrelation.Exec("");
+      //      fBFCorrelation.Exec("");
     }
     else return;
   }
@@ -137,6 +141,11 @@ void AliFMDAnalysisTaskSE::Terminate(Option_t */*option*/)
       fDndeta.SetVtxEfficiency(fSharing.GetVtxEfficiencyFromData());
     else
       fDndeta.SetVtxEfficiency(pars->GetVtxSelectionEffFromMC());
+    std::cout<<fSharing.GetNSDVtxEfficiencyFromData()<<"   "<<fSharing.GetVtxEfficiencyFromData()<<"   "<<pars->GetVtxSelectionEffFromMC()<<std::endl;
+    if(fSharing.GetNSDVtxEfficiencyFromData() > 0)
+      fDndeta.SetVtxEfficiencyNSD(fSharing.GetNSDVtxEfficiencyFromData());
+    else
+      fDndeta.SetVtxEfficiency(pars->GetVtxSelectionEffFromMC());
     
     fDndeta.Terminate("");
     //fBFCorrelation.Terminate("");
@@ -162,11 +171,19 @@ void AliFMDAnalysisTaskSE::Terminate(Option_t */*option*/)
     TList* cloneList3 = (TList*)dNdetalist3->Clone("Hits");
     cloneList3->SetName("Hits");
     outputList->Add(cloneList3);
+    
     t.GenerateMult(AliFMDDndeta::kHitsTrVtx);
     TList* dNdetalist4 = t.GetMultList(AliFMDDndeta::kHits);
     TList* cloneList4 = (TList*)dNdetalist4->Clone("HitsTrVtx");
     cloneList4->SetName("HitsTrVtx");
     outputList->Add(cloneList4);
+    
+    t.GenerateMult(AliFMDDndeta::kMultNSD);
+    TList* dNdetalist5 = t.GetMultList(AliFMDDndeta::kMultNSD);
+    TList* cloneList5 = (TList*)dNdetalist4->Clone("MultNSD");
+    cloneList5->SetName("MultNSD");
+    outputList->Add(cloneList5);
+    
     // TFile file("fmd_ana_histos_tmp.root","RECREATE");
     //  fListOfHistos->Write();
     // file.Close();
index 70a59690b22d14ccc27b7b0304f73d07d022ff89..f79e0f5855515a9f435e80c7ef6381ef5c0c3e01 100644 (file)
@@ -97,6 +97,19 @@ Float_t AliFMDAnalysisTaskSharing::GetVtxEfficiencyFromData(){
   else return -1;
   
 }
+//_____________________________________________________________________
+Float_t AliFMDAnalysisTaskSharing::GetNSDVtxEfficiencyFromData(){
+  
+  TH1F* hEventsNSDVtx = (TH1F*)fDiagList->FindObject("hEventsNSDVtx");
+  TH1F* hEventsNSD  = (TH1F*)fDiagList->FindObject("hEventsNSD");
+  
+  if(hEventsNSD->GetEntries() != 0 && hEventsNSDVtx->GetEntries() !=0 && hEventsNSD->GetEntries() != hEventsNSDVtx->GetEntries())
+    return hEventsNSDVtx->GetEntries() / hEventsNSD->GetEntries();
+  else return -1;
+  
+}
+
+
 //_____________________________________________________________________
 void AliFMDAnalysisTaskSharing::CreateOutputObjects()
 {
@@ -120,6 +133,14 @@ void AliFMDAnalysisTaskSharing::CreateOutputObjects()
                            hBg->GetXaxis()->GetXmax());
   hPrimary->Sumw2();
   fDiagList->Add(hPrimary);
+  
+  TH1F* hPrimaryNSD = new TH1F("hMultvsEtaNSDNoCuts","hMultvsEtaNSDNoCuts",
+                              hBg->GetNbinsX(),
+                              hBg->GetXaxis()->GetXmin(),
+                              hBg->GetXaxis()->GetXmax());
+  hPrimaryNSD->Sumw2();
+  fDiagList->Add(hPrimaryNSD);
+  
   TH1F* hXvtx = new TH1F("hXvtx","x vertex distribution",100,-2,2);
   TH1F* hYvtx = new TH1F("hYvtx","y vertex distribution",100,-2,2);
   TH1F* hZvtx = new TH1F("hZvtx","z vertex distribution",4*pars->GetNvtxBins(),-4*pars->GetVtxCutZ(),4*pars->GetVtxCutZ());
@@ -253,14 +274,18 @@ fDiagList->Add(hCorrelationFMDSPDhits);
   fDiagList->Add(hHitDistributionFMD3I);
   fDiagList->Add(hHitDistributionFMD3O);
   TH1F*  nMCevents = new TH1F("nMCEventsNoCuts","nMCEventsNoCuts",pars->GetNvtxBins(),0,pars->GetNvtxBins());
-  
+  TH1F*  nMCeventsNSD= new TH1F("nMCEventsNSDNoCuts","nMCEventsNSDNoCuts",pars->GetNvtxBins(),0,pars->GetNvtxBins());
   fDiagList->Add(nMCevents);
+  fDiagList->Add(nMCeventsNSD);
   
-  TH1F*  hEventsVtx = new TH1F("hEventsVtx","hEventsVtx",pars->GetNvtxBins(),0,pars->GetNvtxBins());
-  TH1F*  hEventsTr  = new TH1F("hEventsTr","hEventsTr",pars->GetNvtxBins(),0,pars->GetNvtxBins());
+  TH1F*  hEventsVtx     = new TH1F("hEventsVtx","hEventsVtx",pars->GetNvtxBins(),0,pars->GetNvtxBins());
+  TH1F*  hEventsTr      = new TH1F("hEventsTr","hEventsTr",pars->GetNvtxBins(),0,pars->GetNvtxBins());
+  TH1F*  hEventsNSD     = new TH1F("hEventsNSD","hEventsNSD",pars->GetNvtxBins(),0,pars->GetNvtxBins());
+  TH1F*  hEventsNSDVtx  = new TH1F("hEventsNSDVtx","hEventsNSDVtx",pars->GetNvtxBins(),0,pars->GetNvtxBins());
   fDiagList->Add(hEventsVtx);
   fDiagList->Add(hEventsTr);
-  
+  fDiagList->Add(hEventsNSD);
+  fDiagList->Add(hEventsNSDVtx);
   
 }
 //_____________________________________________________________________
@@ -286,10 +311,12 @@ void AliFMDAnalysisTaskSharing::Exec(Option_t */*option*/)
   
   
   AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
-  Double_t vertex[3];
+  Double_t vertex[3]={0,0,0};
   Bool_t vtxStatus = pars->GetVertex(fESD,vertex);
   fEsdVertex->SetXYZ(vertex);
   
+  // std::cout<<vtxStatus<<"  "<<vertex[0]<<"   "<<vertex[1]<<"   "<<vertex[2]<<std::endl;
+  
   // Process primaries here to get true MC distribution
   if(pars->GetProcessPrimary())
     ProcessPrimary();
@@ -300,15 +327,28 @@ void AliFMDAnalysisTaskSharing::Exec(Option_t */*option*/)
   
   
   
-  Bool_t isTriggered = pars->IsEventTriggered(fESD);
+  Bool_t isTriggered = pars->IsEventTriggered(AliFMDAnaParameters::kMB1);
+  Bool_t nsd = pars->IsEventTriggered(AliFMDAnaParameters::kNSD);
+
   Double_t delta2 = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
   Double_t vertexBinDouble = (vertex[2] + pars->GetVtxCutZ()) / delta2;
   Int_t vtxbin = (Int_t)vertexBinDouble;
-  TH1F* hEventsVtx = (TH1F*)fDiagList->FindObject("hEventsVtx");
-  TH1F* hEventsTr  = (TH1F*)fDiagList->FindObject("hEventsTr");
+  TH1F* hEventsVtx    = (TH1F*)fDiagList->FindObject("hEventsVtx");
+  TH1F* hEventsTr     = (TH1F*)fDiagList->FindObject("hEventsTr");
+  TH1F* hEventsNSD    = (TH1F*)fDiagList->FindObject("hEventsNSD");
+  TH1F* hEventsNSDVtx = (TH1F*)fDiagList->FindObject("hEventsNSDVtx");
+  
+  if( TMath::Abs(vertex[2]) > pars->GetVtxCutZ()) {
+    vtxStatus = kFALSE;
+  }
+  
+  
   if(vtxStatus) hEventsVtx->Fill(vtxbin);
   if(isTriggered) hEventsTr->Fill(vtxbin);
   
+  if(vtxStatus && nsd) hEventsNSDVtx->Fill(vtxbin);
+  if(nsd) hEventsNSD->Fill(vtxbin);
+  
   if(!isTriggered || !vtxStatus ) {
     fStatus = kFALSE;
     return;
@@ -317,25 +357,25 @@ void AliFMDAnalysisTaskSharing::Exec(Option_t */*option*/)
     fStatus = kTRUE;
   
   TH1F* hXvtx = (TH1F*)fDiagList->FindObject("hXvtx");
-  if(vertex[0] != 0) hXvtx->Fill(vertex[0]);
+  if(vtxStatus ) hXvtx->Fill(vertex[0]);
   TH1F* hYvtx = (TH1F*)fDiagList->FindObject("hYvtx");
-  if(vertex[1] != 0) hYvtx->Fill(vertex[1]);
+  if(vtxStatus ) hYvtx->Fill(vertex[1]);
   TH1F* hZvtx = (TH1F*)fDiagList->FindObject("hZvtx");
   hZvtx->Fill(vertex[2]);
   //const AliMultiplicity* testmult = fESD->GetMultiplicity();
   //std::cout<<vertex[2]<<std::endl;
   //Int_t nTrackLets = testmult->GetNumberOfTracklets();
   
-  if( TMath::Abs(vertex[2]) > pars->GetVtxCutZ()) {
-    fStatus = kFALSE;
-    return;
-  }
+  // if( TMath::Abs(vertex[2]) > pars->GetVtxCutZ()) {
+  //  fStatus = kFALSE;
+  //  return;
+  // }
     
   if(nTrackLets < 1000) foutputESDFMD->SetUniqueID(kTRUE);
   else foutputESDFMD->SetUniqueID(kFALSE);
   
   AliESDFMD* fmd = fESD->GetFMDData();
-  
+   
   if (!fmd) return;
   Int_t nHits[3][2] = {{0,0},{0,0},{0,0}};
 
@@ -697,8 +737,8 @@ void AliFMDAnalysisTaskSharing::Terminate(Option_t* /* option*/) {
     hTrEtaDistribution2->Scale(1./(Float_t)hZvtx->GetEntries());
   }
   
-  TH1F* hEventsVtx = (TH1F*)fDiagList->FindObject("hEventsVtx");
-  TH1F* hEventsTr  = (TH1F*)fDiagList->FindObject("hEventsTr");
+  //TH1F* hEventsVtx = (TH1F*)fDiagList->FindObject("hEventsVtx");
+  //TH1F* hEventsTr  = (TH1F*)fDiagList->FindObject("hEventsTr");
   //hEventsVtx->Divide(hEventsTr);
   
   
@@ -735,6 +775,7 @@ void AliFMDAnalysisTaskSharing::ProcessPrimary() {
   AliStack* stack = mcEvent->Stack();
   
   TH1F* hPrimary = (TH1F*)fDiagList->FindObject("hMultvsEtaNoCuts");
+  TH1F* hPrimaryNSD = (TH1F*)fDiagList->FindObject("hMultvsEtaNSDNoCuts");
   TH1F* hEnergyOfParticles = (TH1F*)fDiagList->FindObject("hEnergyOfParticles");
   AliHeader* header            = mcEvent->Header();
   AliGenEventHeader* genHeader = header->GenEventHeader();
@@ -748,6 +789,10 @@ void AliFMDAnalysisTaskSharing::ProcessPrimary() {
   
        
   Int_t pythiaType = pythiaGenHeader->ProcessType();
+  Bool_t nsd = kTRUE;
+  if(pythiaType==92||pythiaType==93)
+    nsd = kFALSE;
+  
   
   /*if(pythiaType==92||pythiaType==93){
       std::cout<<"single diffractive"<<std::endl;
@@ -772,11 +817,13 @@ void AliFMDAnalysisTaskSharing::ProcessPrimary() {
   Int_t    vertexBin       = (Int_t)vertexBinDouble;
   
   Bool_t firstTrack = kTRUE;
+  Bool_t firstTrackNSD = kTRUE;
   
   Int_t nTracks = stack->GetNprimary();
   if(pars->GetProcessHits())
     nTracks = stack->GetNtrack();
   TH1F* nMCevents = (TH1F*)fDiagList->FindObject("nMCEventsNoCuts");
+  TH1F* nMCeventsNSD = (TH1F*)fDiagList->FindObject("nMCEventsNSDNoCuts");
   for(Int_t i = 0 ;i<nTracks;i++) {
     particle = (AliMCParticle*) mcEvent->GetTrack(i);
     if(!particle)
@@ -784,7 +831,14 @@ void AliFMDAnalysisTaskSharing::ProcessPrimary() {
     
     if(stack->IsPhysicalPrimary(i) && particle->Charge() != 0) {
       hPrimary->Fill(particle->Eta());
-      
+      if(nsd) {
+       hPrimaryNSD->Fill(particle->Eta());
+       
+       if(firstTrackNSD) {
+         nMCeventsNSD->Fill(vertexBin);
+         firstTrackNSD = kFALSE;
+       }
+      }
 
       TH1F* hPrimVtxBin = (TH1F*)fDiagList->FindObject(Form("primmult_NoCuts_vtxbin%d",vertexBin));
       hPrimVtxBin->Fill(particle->Eta());
index 4193f4264fa4001ade5b703c219e1ab0ae41b706..2b108513fbdf5a0b572bbfa4dbbfb262c77ffbd1 100644 (file)
@@ -58,6 +58,8 @@ class AliFMDAnalysisTaskSharing : public AliAnalysisTask
     void SetInputESD(AliESDEvent* esd) {fESD = esd;}
     Bool_t GetEventStatus() const {return fStatus;}
     Float_t GetVtxEfficiencyFromData() ;
+    Float_t GetNSDVtxEfficiencyFromData() ;
+    
  private:
     Float_t Eta2Theta(Float_t eta) const ;
     Double_t EtaFromStrip(UShort_t det, Char_t ring, UShort_t sector, UShort_t strip, Double_t zvtx);
index 99ab94fd7766ec377d0228922a93e3a75be69821..8c41549cd7f10c83316c2bdacd7da2aad6e790b4 100644 (file)
 #include "TGraphErrors.h"
 #include "TPad.h"
 #include "iostream"
+#include "TH3.h"
 #include "TMath.h"
+#include "TProfile.h"
+#include "TProfile2D.h"
+#include "TProfile3D.h"
 #include "TLegend.h"
+#include "TPad.h"
 #include "TLatex.h"
+#include "TStyle.h"
+#include "TF1.h"
 
 #define SMALLNUMBER 0.0001
 
@@ -32,14 +39,25 @@ AliFMDDndeta::AliFMDDndeta()
   fIsGenerated(),
   fPrimEvents(),
   fEvents(),
-  fPrimdNdeta()
+  fPrimdNdeta(),
+  fDrawAll(kFALSE)
 {
+  AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
+  /* fDataObject = new TProfile3D("dataObject","dataObject",
+                              pars->GetNetaBins(),-6,6,
+                              20,0,2*TMath::Pi(),
+                              pars->GetNvtxBins(),-0.5,pars->GetNvtxBins()-0.5);
+  fDataObject->SetXTitle("#eta");
+  fDataObject->SetYTitle("#varphi [radians]");
+  fDataObject->SetZTitle("v_{z} [cm]");*/
+  
   fAnalysisNames[0] = "Hits";
   fAnalysisNames[1] = "HitsTrVtx";
   fAnalysisNames[2] = "dNdeta";
   fAnalysisNames[3] = "dNdetaTrVtx";
+  fAnalysisNames[4] = "dNdetaNSD";
   
-  for(Int_t i=0; i<4;i++) 
+  for(Int_t i=0; i<5;i++) 
     fMultList[i] = new TList();
 }
 //_____________________________________________________________________
@@ -67,6 +85,12 @@ void AliFMDDndeta::SetNames(Analysis what) {
     fEvents.Form("nEvents");
     fPrimdNdeta.Form("hMultvsEta");
     break;
+  case kMultNSD :
+    fPrimEvents.Form("nMCEventsNSDNoCuts"); 
+    fEvents.Form("nNSDEvents");
+    fPrimdNdeta.Form("hMultvsEtaNSDNoCuts");
+    break;
+    
   default:
     break;
   }
@@ -89,6 +113,10 @@ const char* AliFMDDndeta::GetAnalysisName(Analysis what, UShort_t det, Char_t ri
   case kMultTrVtx :
     name = Form("dNdeta_FMD%d%c_TrVtx_vtxbin%d_proj",det,ring,vtxbin);
     break;
+  case kMultNSD :
+    name = Form("dNdetaNSD_FMD%d%c_vtxbin%d_proj",det,ring,vtxbin);
+    break;
+    
   default:
     break;
   }
@@ -113,6 +141,9 @@ const char* AliFMDDndeta::GetPrimName(Analysis what, UShort_t det, Char_t ring,
   case kMultTrVtx :
     name = Form("primmult_NoCuts_vtxbin%d",vtxbin);
     break;
+  case kMultNSD :
+    name = Form("primmult_NSD_vtxbin%d",vtxbin);
+    break;
   default:
     break;
   }
@@ -128,7 +159,7 @@ void AliFMDDndeta::GenerateHits(Analysis what) {
   Float_t etaMin     =  hTmp->GetXaxis()->GetXmin(); 
   Float_t etaMax     =  hTmp->GetXaxis()->GetXmax();
 
-  for(Int_t i = 0; i<nVertexBins;i++) {
+  for(Int_t i = 0; i<nVertexBins;i++) { // 
     TH1F* hHits = new TH1F(Form("hMCHits_vtxbin%d_%s",i,fAnalysisNames[what]),Form("hHits_vtxbin%d_%s",i,fAnalysisNames[what]),nEtaBins,etaMin,etaMax);
     hHits->Sumw2();
     fMultList[what]->Add(hHits);
@@ -195,8 +226,6 @@ void AliFMDDndeta::Init(const Char_t* filename) {
   if(!list) //an old file ? Perhaps...
     list = (TList*)fin->Get("BackgroundCorrected");
   
-  
   Init(list);
   
 }
@@ -215,6 +244,7 @@ void AliFMDDndeta::Init(TList* list) {
   fIsGenerated[kMult]      = kFALSE;  
   fIsGenerated[kMultTrVtx] = kFALSE;
   fIsGenerated[kHitsTrVtx] = kFALSE;
+  fIsGenerated[kMultNSD]   = kFALSE;
   
   fIsInit = kTRUE;
 }
@@ -258,11 +288,14 @@ void AliFMDDndeta::GenerateMult(Analysis what) {
     Int_t maxRing = (det == 1 ? 0 : 1);
     for(Int_t iring = 0; iring<=maxRing; iring++) {
       Char_t ringChar = (iring == 0 ? 'I' : 'O');
+      //Int_t nsec  = (iring == 0 ? 20 : 40);
       TH1F* hRingMult= new TH1F(Form("hRingMult_FMD%d%c_%s",det,ringChar,fAnalysisNames[what]),Form("hRingMult_FMD%d%c_%s",det,ringChar,fAnalysisNames[what]),nEtaBins,etaMin,etaMax);
       fMultList[what]->Add(hRingMult);
+      //      TProfile* phiprofile     = new TProfile(Form("dNdphiFMD%d%c",det,ringChar), Form("dNdphiFMD%d%c;#Phi",det,ringChar), nsec , 0, 2*TMath::Pi());
+      //fMultList[what]->Add(phiprofile);
     }
   }
-  TH1I* hEvents = (TH1I*)fList->FindObject(fEvents.Data());
+  TH1I*  hEvents  = (TH1I*)fList->FindObject(fEvents.Data());
   TH1F*  hPrimVtx = 0;
   
        
@@ -298,27 +331,54 @@ void AliFMDDndeta::GenerateMult(Analysis what) {
        Float_t nEvents = (Float_t)hEvents->GetBinContent(v+1);
        
        //TH1F* multhistproj = (TH1F*)fList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d_proj",det,ringChar,v));
-               TH1F* multhistproj = (TH1F*)fList->FindObject(GetAnalysisName(what,det,ringChar,v));
+               
+
+       
+       
+       
+       
+       TH1F* multhistproj = (TH1F*)fList->FindObject(GetAnalysisName(what,det,ringChar,v));
        if(nEvents)
          multhistproj->Scale(1/nEvents);
        Float_t xnBins = multhistproj->GetNbinsX();
        Float_t xrange = multhistproj->GetXaxis()->GetXmax() - multhistproj->GetXaxis()->GetXmin(); 
        multhistproj->Scale(xnBins / xrange);
        
+       TH2F* multhist = (TH2F*)fList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,v));
 
        
-       Int_t nNonZero = 0, nNonZeroInData = 0;
-       
+       //if(nEvents)
+       //  multhist->Scale(1/nEvents);
+       /*      for(Int_t i=1;i<=multhist->GetNbinsX();i++) {
+         for(Int_t j=1;j<=multhist->GetNbinsY();j++) {
+           
+           if (multhist->GetBinContent(i,j) <= 0.0001) continue;
+           //std::cout<<multhist->GetBinContent(i,j)<<std::endl;
+           fDataObject->Fill(multhist->GetXaxis()->GetBinCenter(i),
+                             multhist->GetYaxis()->GetBinCenter(j),
+                             v,
+                             multhist->GetBinContent(i,j), multhist->GetBinError(i,j));
+           //fDataObject->SetBinContent(i,j,v,multhist->GetBinContent(i,j));
+           //fDataObject->SetBinError(i,j,v,multhist->GetBinError(i,j));
+         } 
+       }
+       */      
+       //if(nEvents)
+       //  multhist->Scale(1/nEvents);
+       //if(ringChar == 'O')
+       //  multhist->RebinY(2);
        //removing edges
        
+       Int_t nNonZero = 0, nNonZeroInData = 0;
+       
        for(Int_t i =1;i<=multhistproj->GetNbinsX();i++) {
          if(multhistproj->GetBinContent(i) !=0)
            nNonZero++;
        }
        Int_t nBinsOld = fNbinsToCut;
-       //      if(det == 2 && ringChar =='I') {
-       //  fNbinsToCut = 1;
-       //      }
+       if(det == 1 && ringChar =='I') {
+         fNbinsToCut = 0;
+       }
        TH1F* hRingMult = (TH1F*)fMultList[what]->FindObject(Form("hRingMult_FMD%d%c_%s",det,ringChar,fAnalysisNames[what]));
        
        for(Int_t i=1; i<=hRingMult->GetNbinsX(); i++) {
@@ -452,21 +512,74 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
     AliWarning("Not generated - generate first then draw!");
     return;
   }
-    
+  
   SetNames(what);
+  //UA5 data NSD
+  Float_t x[19] = {0.125,0.375,0.625,0.875,1.125,1.375,1.625,1.875,2.125,2.375,
+                  2.625,2.875,3.125,3.375,3.625,3.875,4.125,4.375,4.625};
+  Float_t x2[19] = {-0.125,-0.375,-0.625,-0.875,-1.125,-1.375,-1.625,-1.875,
+                   -2.125,-2.375,-2.625,-2.875,-3.125,-3.375,-3.625,-3.875,
+                   -4.125,-4.375,-4.625};
+  
+  
+  Float_t y[19] = {3.48, 3.38, 3.52, 3.68, 3.71, 3.86, 3.76, 3.66, 3.72 ,3.69,
+                  3.56, 3.41, 3.15, 3.09, 2.74, 2.73, 2.32, 1.99, 1.69};
+  
+  Float_t ey[19] = {0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,
+                   0.07,0.07,0.08,0.08,0.09,0.09,0.1,0.13};
+    
+  TGraphErrors* graph = new TGraphErrors(19,x,y,NULL,ey);
+  TGraphErrors* graph2 = new TGraphErrors(19,x2,y,NULL,ey);
+  //UA5 data INEL
+  Float_t xinel[19] = {0.125, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875, 2.125, 2.375, 2.625, 2.875, 3.125, 3.375, 3.625, 3.875, 4.125, 4.375, 4.625};
+  Float_t xinel2[19] = {-0.125, -0.375, -0.625, -0.875, -1.125, -1.375, -1.625, -1.875, -2.125, -2.375, -2.625, -2.875, -3.125, -3.375, -3.625, -3.875, -4.125, -4.375, -4.625};
+  Float_t yinel[19] = {3.14, 3.04, 3.17, 3.33, 3.33, 3.53, 3.46, 3.41, 3.45, 3.39, 3.07, 3.07, 2.93, 2.93, 2.55, 2.48, 2.18, 1.91, 1.52};
+  Float_t eyinel[19] = {0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.08, 0.08, 0.09, 0.09, 0.1, 0.13};
+ TGraphErrors* graphinel = new TGraphErrors(19,xinel,yinel,NULL,eyinel);
+ TGraphErrors* graphinel2 = new TGraphErrors(19,xinel2,yinel,NULL,eyinel);
+  
+  graph->SetMarkerStyle(22);
+  graph->SetMarkerColor(kBlue);
+  graphinel->SetMarkerStyle(20);
+  graphinel->SetMarkerColor(kGreen);
+  graphinel2->SetMarkerStyle(24);
+  graphinel2->SetMarkerColor(kGreen);
+  //graph->Draw("P");
+  graph2->SetMarkerStyle(26);
+  graph2->SetMarkerColor(kBlue);
+  graphinel->GetHistogram()->SetStats(kFALSE);
+  graphinel2->GetHistogram()->SetStats(kFALSE);
+  
+  
+  //End UA5 data
   
   AliFMDAnaParameters* pars =  AliFMDAnaParameters::Instance();
   TCanvas* c1 = new TCanvas("cvertexbins","Overlaps",1400,800);
   c1->Divide(5,2);
+  TCanvas* cCorrections;
+  TCanvas* cCorrectionsPhi;
+  if(fDrawAll) {
+    cCorrections = new TCanvas("corrections","Correction vs Eta",1400,800);
+    cCorrections->Divide(5,2);
+    
+    cCorrectionsPhi = new TCanvas("correctionsPhi","Correction vs Phi",1400,800);
+    cCorrectionsPhi->Divide(5,2);
+  }
+  //TCanvas* cphi = new TCanvas("dNdphi","dNdphi",1280,1024);
+  // cphi->Divide(3,2);
+  
   Int_t nVertexBins  =  pars->GetNvtxBins();
   
   TH1I* hEvents   = (TH1I*)fList->FindObject(fEvents.Data());
-  TH1I* hMCEvents = (TH1I*)fList->FindObject(fPrimEvents.Data());
   
+  TH1I* hMCEvents = (TH1I*)fList->FindObject(fPrimEvents.Data());
+  //Int_t npadphi = 0;
   TH1F*  hPrimVtx = 0;
   for(Int_t det = 1; det<=3; det++) {
     Int_t maxRing = (det == 1 ? 0 : 1);
     for(Int_t ring = 0;ring<=maxRing;ring++) {
+      //  npadphi++;
+      
       for(Int_t v=0; v< nVertexBins; v++) {
        Char_t ringChar = (ring == 0 ? 'I' : 'O');
        Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
@@ -476,7 +589,71 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
        if(vtxZ1<fVtxCut1 || vtxZ2 >fVtxCut2)
          continue;
        Float_t nEvents = (Float_t)hEvents->GetBinContent(v+1);
-               
+       if(fDrawAll) {
+       TH2F* hBgCor  = pars->GetBackgroundCorrection(det,ringChar,v);
+       if(hBgCor)  {
+         TH1D* hBgProj = hBgCor->ProjectionX(Form("hBgProj_FMD%d%c_vtxbin%d",det,ringChar,v));
+         TH1D* hBgProjPhi = hBgCor->ProjectionY(Form("hBgProjPhi_FMD%d%c_vtxbin%d",det,ringChar,v));
+         
+         hBgProjPhi->SetName(Form("FMD%d%c",det,ringChar));
+         hBgProjPhi->SetTitle("");//Form("FMD%d",det));
+         hBgProj->SetTitle("");
+         //Float_t scalefactor = (hBgProj->GetXaxis()->GetXmax() - hBgProj->GetXaxis()->GetXmin()) / (Float_t)hBgProj->GetNbinsX();
+         Float_t scalefactor = 1/(Float_t)hBgCor->GetNbinsY();
+         
+         Float_t nFilledEtaBins = 0;
+         
+         for(Int_t jj = 1; jj<=hBgProj->GetNbinsX(); jj++) {
+           if(hBgProj->GetBinContent(jj) > 0.01)
+             nFilledEtaBins++;
+         }
+         
+         Float_t scalefactorPhi = 1/nFilledEtaBins;
+         
+         
+         hBgProj->Scale(scalefactor);
+         cCorrections->cd(v+1);
+         
+         hBgProj->SetMarkerColor(det + 2*ring);
+         hBgProj->SetMarkerStyle(19 + det + 2*ring );
+         
+         if((det + 2*ring) == 5)  hBgProj->SetMarkerColor(det + 2*ring+1);
+         if((19 + det + 2*ring ) == 24)  hBgProj->SetMarkerStyle(29 );
+         
+         if(det == 1) {
+           hBgProj->GetYaxis()->SetRangeUser(0,4);
+           hBgProj->SetStats(kFALSE);
+           hBgProj->SetXTitle("#eta");
+           hBgProj->DrawCopy("PE");
+           TLatex* l = new TLatex(0.14,0.92,Form("Vtx range [%.1f, %.1f]",vtxZ1,vtxZ2));
+           l->SetNDC(kTRUE);
+           l->Draw();
+         }
+         else
+           hBgProj->DrawCopy("PEsame");
+       
+         hBgProjPhi->Scale(scalefactorPhi);
+         cCorrectionsPhi->cd(v+1);
+         hBgProjPhi->SetMarkerColor(det + 2*ring);
+         hBgProjPhi->SetMarkerStyle(19 + det + 2*ring );
+         if((det + 2*ring) == 5)  hBgProjPhi->SetMarkerColor(det + 2*ring+1);
+         if((19 + det + 2*ring ) == 24)  hBgProjPhi->SetMarkerStyle(29 );
+         if(det == 1) {
+           hBgProjPhi->GetYaxis()->SetRangeUser(1,5);
+           hBgProjPhi->SetStats(kFALSE);
+           
+           hBgProjPhi->SetXTitle("#Phi");
+           hBgProjPhi->DrawCopy("PE");
+          
+           
+         }
+         else
+           hBgProjPhi->DrawCopy("PEsame");
+         
+       }
+       
+       }
+       
        TH1F* multhistproj = (TH1F*)fList->FindObject(GetAnalysisName(what,det,ringChar,v));
                
        c1->cd(v+1);
@@ -506,10 +683,11 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
        
        if(det == 1) {
          if(what == kHits || what == kHitsTrVtx)
-           hPrimVtx = (TH1F*)fMultList[what]->FindObject(Form("hMCHits_vtxbin%d_%s",v,Form("primary_%s",fAnalysisNames[what])));
+           hPrimVtx = (TH1F*)fMultList[what]->FindObject(Form("hMCHits_vtxbin%d_%s",v,fAnalysisNames[what]));
          else
            hPrimVtx = (TH1F*)fList->FindObject(GetPrimName(what,det,ringChar,v));
-         
+         // std::cout<<hPrimVtx<<"   "<<kHits<<"   "<<kHitsTrVtx<<"   "<<what<<std::endl;
+         //std::cout<<Form("hMCHits_vtxbin%d_%s",v,fAnalysisNames[what])<<std::endl;
          hPrimVtx->SetTitle("");
          TLatex* l = new TLatex(0.14,0.92,Form("Vtx range [%.1f, %.1f], %d events",vtxZ1,vtxZ2,(Int_t)nEvents));
          l->SetNDC(kTRUE);
@@ -517,11 +695,19 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
          hPrimVtx->SetLabelFont(132,"xyz");
          hPrimVtx->SetStats(0000);
          hPrimVtx->GetXaxis()->SetTitle("#eta");
-         hPrimVtx->GetYaxis()->SetRangeUser(0,15);
+         hPrimVtx->GetYaxis()->SetRangeUser(0,6);
          hPrimVtx->DrawCopy("E3");
          l->Draw();
          multhistproj->DrawCopy("same");
-         
+         if(what != kMultNSD) {
+           graphinel->Draw("sameP");
+           graphinel2->Draw("sameP");
+         }
+         else
+          {
+            graph->Draw("sameP");
+            graph2->Draw("sameP");
+          }
        }
        else
          multhistproj->DrawCopy("same");
@@ -531,6 +717,19 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
     }
   }
   
+  //Legends for corrections
+  if(fDrawAll) {
+  for(Int_t v=0; v< nVertexBins; v++) {
+    TPad* pad= (TPad*)cCorrectionsPhi->cd(v+1);
+    pad->BuildLegend(0.15,0.45,0.45,0.9);
+    Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins();
+    Float_t vtxZ1   = (delta*v) - pars->GetVtxCutZ();
+    Float_t vtxZ2   = (delta*(v+1)) - pars->GetVtxCutZ();
+    TLatex* l = new TLatex(0.14,0.92,Form("Vtx range [%.1f, %.1f]",vtxZ1,vtxZ2));
+    l->SetNDC(kTRUE);
+    l->Draw();
+  }
+  }
   for(Int_t v=0; v< nVertexBins; v++) {
     TH1F* sumMultHist = (TH1F*)fMultList[what]->FindObject(Form("hMult_vtxbin%d_%s",v,fAnalysisNames[what]));
     c1->cd(v+1);
@@ -552,6 +751,72 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
     }
   }
   
+  //SPD part
+  TH1D* hSPDana = (TH1D*)fList->FindObject(Form("dNdeta_SPD_vtxbin%d_proj",5));
+  
+  for(Int_t nn = 0; nn < pars->GetNvtxBins() ; nn++) {
+    TH1D* hSPDanalysis = (TH1D*)fList->FindObject(Form("dNdeta_SPD_vtxbin%d_proj",nn));
+    TH1D* hSPDanalysisTrVtx = (TH1D*)fList->FindObject(Form("dNdetaTrVtx_SPD_vtxbin%d_proj",nn));
+    TH1D* hSPDanalysisNSD = (TH1D*)fList->FindObject(Form("dNdetaNSD_SPD_vtxbin%d_proj",nn));
+    
+    Float_t nEventsSPD = (Float_t)hEvents->GetBinContent(nn+1);
+    
+    hSPDanalysis->Scale(1/nEventsSPD);
+    hSPDanalysisTrVtx->Scale(1/nEventsSPD);
+    hSPDanalysisNSD->Scale(1/nEventsSPD);
+  }
+  
+  TH1F* hSPDcombi = new TH1F("SPDcombi","SPDcombi",hSPDana->GetNbinsX(),hSPDana->GetXaxis()->GetXmin(),hSPDana->GetXaxis()->GetXmax());
+  TH1D* hSPDanalysis = 0;
+  for(Int_t kk = 1; kk <=hSPDana->GetNbinsX(); kk++) {
+    Float_t weight = 0, wav=0,sumofw = 0;
+    for(Int_t nn = 0; nn < pars->GetNvtxBins() ; nn++) {
+      if(what != kMultNSD)
+       hSPDanalysis = (TH1D*)fList->FindObject(Form("dNdeta_SPD_vtxbin%d_proj",nn));
+      else
+       hSPDanalysis = (TH1D*)fList->FindObject(Form("dNdetaNSD_SPD_vtxbin%d_proj",nn));
+      if(TMath::Abs(hSPDanalysis->GetBinCenter(kk)) > 2)
+       continue;
+      Float_t mult = hSPDanalysis->GetBinContent(kk);
+      Float_t error = hSPDanalysis->GetBinError(kk);
+      
+      if(mult > 0 && hSPDanalysis->GetBinContent(kk-1) < SMALLNUMBER)
+       continue;
+      if(mult > 0 && hSPDanalysis->GetBinContent(kk-2) < SMALLNUMBER)
+       continue;
+      
+      if(mult > 0 && hSPDanalysis->GetBinContent(kk+1) < SMALLNUMBER)
+       continue;
+      if(mult > 0 && hSPDanalysis->GetBinContent(kk+2) < SMALLNUMBER)
+       continue;
+      
+      if(mult > 0) {
+       weight = 1/TMath::Power(error,2);
+       wav    = wav + weight*mult;
+       sumofw = sumofw + weight;
+      }
+      
+    }
+    
+    if(sumofw && wav) {
+      Float_t errorTotal = 1/TMath::Sqrt(sumofw);
+      hSPDcombi->SetBinContent(kk,wav/sumofw);
+      hSPDcombi->SetBinError(kk,errorTotal);
+    }
+  }
+    
+  
+  Float_t xb1 = hSPDcombi->GetNbinsX();
+  Float_t xr1 = hSPDcombi->GetXaxis()->GetXmax() - hSPDcombi->GetXaxis()->GetXmin(); 
+  hSPDcombi->Scale(xb1 / xr1);
+  //hSPDcombi->Rebin(rebin);
+  //hSPDcombi->Scale(1/(Float_t)rebin);
+  //RebinHistogram(hSPDcombi,rebin);
+  hSPDcombi->SetMarkerStyle(29);
+  hSPDcombi->SetMarkerColor(kBlue);
+  hSPDcombi->DrawCopy("same");
+  // End of SPD
+
   
   //TH1F*  hPrim = (TH1F*)fList->FindObject(fPrimEvents.Data());
   //  TFile testhit("/home/canute/ALICE/Simulations/TestOfAnalysis2/hitsdist.root");
@@ -568,20 +833,6 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
   if(nPrimevents > 0)
     hPrim->Scale(1/nPrimevents);
   
-  /*
-  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;
-  for(Int_t bb = 1;bb<=hcorrect->GetNbinsX();bb++) {
-    hcorrect->SetBinContent(bb,hcorrect->GetBinContent(bb)+1);
-  }
-  sumMult->Divide(hcorrect);
-  //delete hcorrect;
-  */
-  
   
   //  primMult->Rebin(rebin);
   // primMult->Scale(1/rebin);
@@ -593,8 +844,30 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
   //  hReldif->Add(hPrim,-1);
   // hReldif->Divide(hPrim);
   
+
+
+  /////////////*******************New thing!!!
+  
+  //TH3D* hist3d = (TH3D*)fDataObject->ProjectionXYZ("hist3d");
+  // fDataObject->Sumw2();
+  //TH2F* projeta = (TH2F*)fDataObject->Project3D("yx");
+  
+  //  TProfile2D* projeta = fDataObject->Project3DProfile("yx");
+  // projeta->SetSumw2();
+  //TProfile* etaprofile = projeta->ProfileX("dNdeta_profile");
+  //TProfile* etaprofile = projeta->ProfileX("dNdeta_profile");
+  // TH1* etaprofile = projeta->ProjectionX("dNdeta_profile");
+  //TProfile* etaprofile = fDataObject->ProfileX();
+  /*
+  TCanvas* ctest = new TCanvas("test","test",1200,600);
+  ctest->Divide(3);
+  ctest->cd(1);
+  fDataObject->DrawCopy("box");
+  ctest->cd(2);
+  projeta->DrawCopy("colz");
+  ctest->cd(3);
+  etaprofile->DrawCopy();
+  */
   //sumMult->Rebin(rebin);
   TH1F* hReldif = (TH1F*)sumMult->Clone("hReldif");
   if(rebin != 1) {
@@ -620,7 +893,19 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
   hReldif->GetXaxis()->SetTitle("#eta");
   
   hReldif->DrawCopy();
-  TLine* zeroLine = new TLine(-6,0,6,0);
+  //SPD Rel dif
+  TH1F* hReldifSPD = (TH1F*)hSPDcombi->Clone("hReldifSPD");
+  if(rebin != 1) {
+    RebinHistogram(hSPDcombi,rebin);
+    if(!realdata) {
+      RebinHistogram(hReldifSPD,rebin);
+    }
+  }
+  hReldifSPD->Add(primMult,-1);
+  hReldifSPD->Divide(primMult);
+  hReldifSPD->DrawCopy("same");
+  
+  TLine* zeroLine = new TLine(-4,0,6,0);
   zeroLine->SetLineWidth(2);
   zeroLine->SetLineColor(kBlack);
   zeroLine->Draw();
@@ -639,9 +924,45 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
   hPrim->GetXaxis()->SetTitle("#eta");
   sumMult->SetTitle("");
   sumMult->SetStats(kFALSE);
+  sumMult->SetXTitle("#eta");
+  sumMult->SetYTitle("#frac{dN}{d#eta_{ch}}");
   // sumMult->GetYaxis()->SetRangeUser
   //sumMult->Scale(1/(Float_t)rebin);
   sumMult->DrawCopy("PE");
+  //Syst errors
+  TH1F* sumMultSystPos = (TH1F*)sumMult->Clone("systerrorsPos");
+  TH1F* sumMultSystNeg = (TH1F*)sumMult->Clone("systerrorsNeg");
+  for(Int_t jj = 1;jj <=sumMultSystPos->GetNbinsX();jj++) {
+    if(sumMultSystPos->GetBinCenter(jj) < 0) {
+      sumMultSystPos->SetBinError(jj,0);
+      sumMultSystPos->SetBinContent(jj,0);
+      continue;
+    }
+      
+    if(sumMultSystPos->GetBinContent(jj) > 0)
+      sumMultSystPos->SetBinError(jj,TMath::Sqrt(TMath::Power(sumMultSystPos->GetBinError(jj),2)+TMath::Power(0.1*sumMultSystPos->GetBinContent(jj),2)));
+  }
+  for(Int_t jj = 1;jj <=sumMultSystNeg->GetNbinsX();jj++) {
+    if(sumMultSystNeg->GetBinCenter(jj) > 0) {
+      sumMultSystNeg->SetBinError(jj,0);
+      sumMultSystNeg->SetBinContent(jj,0);
+      continue;
+    }
+      
+    if(sumMultSystNeg->GetBinContent(jj) > 0)
+      sumMultSystNeg->SetBinError(jj,TMath::Sqrt(TMath::Power(sumMultSystNeg->GetBinError(jj),2)+TMath::Power(0.1*sumMultSystNeg->GetBinContent(jj),2)));
+  }
+  
+  
+  
+  sumMultSystPos->SetFillColor(18);
+  sumMultSystNeg->SetFillColor(18);
+  sumMultSystPos->DrawCopy("sameE5");
+  sumMultSystNeg->DrawCopy("sameE5");
+  //End syst errors
+  
+  
+  
   if(what != kHits && what != kHitsTrVtx && hPrim->GetEntries())
     hPrim->DrawCopy("E3same");
   if(what == kHits || what == kHitsTrVtx)
@@ -664,54 +985,40 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
   hReldifLR->Divide(hMirror);
   c2->cd(2);
   gPad->cd(1);
-  if(realdata)
-    hReldifLR->DrawCopy("same");
+  hReldifLR->GetYaxis()->SetRangeUser(-0.2,0.2);
+
+  hReldifLR->SetYTitle("Relative difference left-right");
+  hReldifLR->SetLabelSize(2*hReldifLR->GetLabelSize("X"),"X"); 
+  hReldifLR->SetLabelSize(2*hReldifLR->GetLabelSize("Y"),"Y");
+  hReldifLR->SetTitleSize(2*hReldifLR->GetTitleSize("X"),"X");
+  hReldifLR->SetTitleSize(2*hReldifLR->GetTitleSize("Y"),"Y");
+  hReldifLR->SetTitleOffset(0.7*hReldifLR->GetTitleOffset("X"),"X");
+  hReldifLR->SetTitleOffset(0.5*hReldifLR->GetTitleOffset("Y"),"Y");
+  
+  
+  if(realdata) 
+    hReldifLR->DrawCopy();
+  zeroLine->Draw();
   c2->cd(1);
   hMirror->SetMarkerStyle(25);
   
   hPrim->SetMarkerStyle(8);
-  //UA5 data NSD
-  Float_t x[19] = {0.125,0.375,0.625,0.875,1.125,1.375,1.625,1.875,2.125,2.375,
-                  2.625,2.875,3.125,3.375,3.625,3.875,4.125,4.375,4.625};
-  Float_t x2[19] = {-0.125,-0.375,-0.625,-0.875,-1.125,-1.375,-1.625,-1.875,
-                   -2.125,-2.375,-2.625,-2.875,-3.125,-3.375,-3.625,-3.875,
-                   -4.125,-4.375,-4.625};
-  
-  
-  Float_t y[19] = {3.48, 3.38, 3.52, 3.68, 3.71, 3.86, 3.76, 3.66, 3.72 ,3.69,
-                  3.56, 3.41, 3.15, 3.09, 2.74, 2.73, 2.32, 1.99, 1.69};
-  
-  Float_t ey[19] = {0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,0.07,
-                   0.07,0.07,0.08,0.08,0.09,0.09,0.1,0.13};
-    
-  TGraphErrors* graph = new TGraphErrors(19,x,y,NULL,ey);
-  TGraphErrors* graph2 = new TGraphErrors(19,x2,y,NULL,ey);
-  //UA5 data INEL
-  Float_t xinel[19] = {0.125, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875, 2.125, 2.375, 2.625, 2.875, 3.125, 3.375, 3.625, 3.875, 4.125, 4.375, 4.625};
-  Float_t xinel2[19] = {-0.125, -0.375, -0.625, -0.875, -1.125, -1.375, -1.625, -1.875, -2.125, -2.375, -2.625, -2.875, -3.125, -3.375, -3.625, -3.875, -4.125, -4.375, -4.625};
-  Float_t yinel[19] = {3.14, 3.04, 3.17, 3.33, 3.33, 3.53, 3.46, 3.41, 3.45, 3.39, 3.07, 3.07, 2.93, 2.93, 2.55, 2.48, 2.18, 1.91, 1.52};
-  Float_t eyinel[19] = {0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.07, 0.08, 0.08, 0.09, 0.09, 0.1, 0.13};
- TGraphErrors* graphinel = new TGraphErrors(19,xinel,yinel,NULL,eyinel);
- TGraphErrors* graphinel2 = new TGraphErrors(19,xinel2,yinel,NULL,eyinel);
   
-  graph->SetMarkerStyle(22);
-  graph->SetMarkerColor(kBlue);
-  graphinel->SetMarkerStyle(20);
-  graphinel->SetMarkerColor(kGreen);
-  graphinel2->SetMarkerStyle(24);
-  graphinel2->SetMarkerColor(kGreen);
-  //graph->Draw("P");
-  graph2->SetMarkerStyle(26);
-  graph2->SetMarkerColor(kBlue);
   //graph2->Draw("P");
   TH1F* hPythiaMB = 0;
-  TFile fpyt("/home/canute/ALICE/FMDanalysis/FirstAnalysis/pythia_study/pythiahists.root","READ");
-  if(realdata) {
-    
-    hPythiaMB = (TH1F*)fpyt.Get("hPythiaMB");
-    hPythiaMB->DrawCopy("same");
-    
-    std::cout<<hPythiaMB<<std::endl;
+  
+  TFile* fpyt;
+  if(pars->GetEnergy() == AliFMDAnaParameters::k7000)
+    fpyt = TFile::Open("/home/canute/ALICE/FMDanalysis/FirstAnalysis/pythia_study/pythiahists7000.root","READ");
+  else if(pars->GetEnergy() == AliFMDAnaParameters::k900)
+    fpyt = TFile::Open("/home/canute/ALICE/FMDanalysis/FirstAnalysis/pythia_study/pythiahists900.root","READ");
+  
+  if(realdata ) {
+    if(fpyt) {
+      hPythiaMB = (TH1F*)fpyt->Get("hPythiaMB");
+    }
+    else
+      std::cout<<"no pythia for this energy"<<std::endl;
   }
   if(what != kHits && what != kHitsTrVtx) {
     if(hPrim->GetEntries() != 0 && !realdata)
@@ -719,57 +1026,62 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
     if(realdata) {
       //graph->Draw("PEsame");
       //graph2->Draw("PEsame");
-      graphinel->Draw("PEsame");
-      graphinel2->Draw("PEsame");
+      if(what != kMultNSD) {
+       graphinel->Draw("PEsame");
+       graphinel2->Draw("PEsame");
+      }
+      else{
+       graph->Draw("PEsame");
+       graph2->Draw("PEsame");
+
+      }
+       
     }
 
   }
-  sumMult->DrawCopy("PEsame");
-  if(realdata)
-    hMirror->DrawCopy("PEsame");
-  //  std::cout<<"FMD 1 "<<sumMult->Integral(sumMult->FindBin(3),sumMult->FindBin(5),"width")<<std::endl;
   
-  //c2->SaveAs("dNdeta_fmd.png");
-  /*TFile* itsfile = TFile::Open(itsfilename);
-  if(itsfile) {
-    //itsfile->cd();
-    
-    //TList* itslist = (TList*)itsfile->Get("ITS_analysis");
-    //TH1F* itshist0 = (TH1F*)itslist->FindObject("dndeta_check_0");
-    //TH1F* itshist1 = (TH1F*)itslist->FindObject("dndeta_check_1");
-    //TH1F* itshist2 = (TH1F*)itslist->FindObject("dndeta_check_2");
-    TH1F* itshist0 = (TH1F*)itsfile->Get("dndeta/dNdEta");
-    TH1F* itshist1= (TH1F*)itsfile->Get("dndeta/dNdEta_1");
-    TH1F* itshist2 = (TH1F*)itsfile->Get("dndeta/dNdEta_2");
-    itshist0->SetMarkerStyle(27);
-    itshist1->SetMarkerStyle(28);
-    itshist2->SetMarkerStyle(30);
-    itshist0->DrawCopy("same");
-    itshist1->DrawCopy("same");
-    itshist2->DrawCopy("same");
   
-  }
-  */
+  sumMult->DrawCopy("PEsame");
   
   
-  TLegend* leg = new TLegend(0.35,0.2,0.65,0.45,"");
+       
+  hSPDcombi->DrawCopy("same");
+  if(realdata)
+    hMirror->DrawCopy("PEsame");
+    
+  TLegend* leg = new TLegend(0.3,0.2,0.7,0.45,"");
   if(!realdata) {
     if(what != kHits && what != kHitsTrVtx)
       leg->AddEntry(hPrim,"Primary","pf");
     else
       leg->AddEntry(primMult,"Hits","pf");
   }
-  //leg->AddEntry(primMult,"Analysed prim","f");
+  
+  if(what == kMult)
+    leg->AddEntry(sumMult,"FMD INEL","p");
+  else if(what == kMultTrVtx)
+    leg->AddEntry(sumMult,"FMD TrVtx","p");
+  else if(what == kMultNSD)
+    leg->AddEntry(sumMult,"FMD NSD","p");
   
   
-  leg->AddEntry(sumMult,"Analysis","p");
   if(realdata) {
-    leg->AddEntry(hMirror,"Mirror Analysis","p");
-    //leg->AddEntry(graph,"UA5 NSD","p");
-    //leg->AddEntry(graph2,"Mirror UA5 NSD","p");
+  if(what == kMult)
+    leg->AddEntry(hMirror,"FMD INEL","p");
+  else if(what == kMultTrVtx)
+    leg->AddEntry(hMirror,"FMD TrVtx","p");
+  else if(what == kMultNSD)
+    leg->AddEntry(hMirror,"FMD NSD","p");
+   
+  if(what == kMultNSD) {  
+    leg->AddEntry(graph,"UA5 NSD","p");
+    leg->AddEntry(graph2,"Mirror UA5 NSD","p"); }
+  else if(what == kMult) {
     leg->AddEntry(graphinel,"UA5 INEL","p");
     leg->AddEntry(graphinel2,"Mirror UA5 INEL","p");
-    leg->AddEntry(hPythiaMB,"Pythia MB","l");
+  }
+    //leg->AddEntry(hPythiaMB,"Pythia MB","l");
+    leg->AddEntry(hSPDcombi,"HHD SPD clusters","p");
     
   }
   leg->Draw();
@@ -794,8 +1106,8 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
       hPythiaMB->Scale(ratio);
     }
     
-    hRatioMultPythia->Divide(hPythiaMB);
-    
+    //hRatioMultPythia->Divide(hPythiaMB);
+    /*
     for(Int_t j=1;j<=hRatioMultUA5->GetNbinsX(); j++) {
       Float_t data = hRatioMultUA5->GetBinContent(j);
       Float_t errordata = hRatioMultUA5->GetBinError(j);
@@ -839,20 +1151,101 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
        hRatioMultUA5->SetBinContent(j,ratio2);
        hRatioMultUA5->SetBinError(j,errorratio);
       }
-    }
-  
+      
+      */
+    TGraphErrors* tmp1;
+    if(what == kMultNSD)
+      tmp1 = (TGraphErrors*)graph->Clone("UA5tmp");
+    else
+      tmp1 = (TGraphErrors*)graphinel->Clone("UA5tmp");
+    
+    tmp1->Fit("pol8","Q0","Q0",1.5,6);
+      TF1* hFit = tmp1->GetFunction("pol8");
+      for(Int_t ii = hRatioMultUA5->GetNbinsX() / 2; ii<hRatioMultUA5->GetNbinsX();ii++) { 
+       if(hRatioMultUA5->GetBinContent(ii) > 0) {
+         Float_t errorratio = hRatioMultUA5->GetBinError(ii) / hRatioMultUA5->GetBinContent(ii);
+         hRatioMultUA5->SetBinContent(ii,
+                                      hRatioMultUA5->GetBinContent(ii) / 
+                                      ((hRatioMultUA5->GetBinCenter(ii) > 4.8) ? hFit->Eval(hRatioMultUA5->GetBinCenter(ii-1)) : hFit->Eval(hRatioMultUA5->GetBinCenter(ii))));
+         hRatioMultUA5->SetBinError(ii,hRatioMultUA5->GetBinContent(ii) * TMath::Sqrt(0.02*0.02 + TMath::Power(errorratio,2)));
+         
+           
+       }
+         
+      }
+      
+      TGraphErrors* tmp2;
+      if(what == kMultNSD)
+       tmp2 = (TGraphErrors*)graph2->Clone("UA5tmp2");
+      else 
+       tmp2 = (TGraphErrors*)graphinel2->Clone("UA5tmp2");
 
+      //tmp2->Fit("pol8","Q0","Q0",-3.7,-1.5);
+      tmp2->Fit("pol7","Q0","Q0",-3.7,0);
+      hFit = tmp2->GetFunction("pol7");
+      for(Int_t ii = 0; ii<hRatioMultUA5->GetNbinsX()/2;ii++) { 
+       if(hRatioMultUA5->GetBinContent(ii) > 0) {
+         Float_t errorratio = hRatioMultUA5->GetBinError(ii) / hRatioMultUA5->GetBinContent(ii);
+         hRatioMultUA5->SetBinContent(ii,hRatioMultUA5->GetBinContent(ii) / hFit->Eval(hRatioMultUA5->GetBinCenter(ii))  );
+         hRatioMultUA5->SetBinError(ii,hRatioMultUA5->GetBinContent(ii) * TMath::Sqrt(0.02*0.02 + TMath::Power(errorratio,2)));
+         
+       }
+       
+       
+       graphinel->GetHistogram()->SetStats(kFALSE);
+       graphinel2->GetHistogram()->SetStats(kFALSE);
+       
+      }
+      
+      //}
+  
+      
+  
+      gPad->SetGridx();
+      gPad->SetGridy();
+    TLine* oneLine = new TLine(-4,1,6,1);
+    oneLine->SetLineWidth(2);
     
-    gPad->SetGridx();
-    gPad->SetGridy();
-    TLine* oneLine = new TLine(-6,1,6,1);
-    hRatioMultPythia->DrawCopy();
     hRatioMultUA5->SetMarkerColor(kGreen);
     hRatioMultUA5->SetMarkerStyle(20);
-    hRatioMultUA5->DrawCopy("same");
+    hRatioMultUA5->GetYaxis()->SetRangeUser(0.75,1.25);
+    
+    hRatioMultUA5->SetYTitle("Ratio FMD/UA5");
+    hRatioMultUA5->SetLabelSize(2*hRatioMultUA5->GetLabelSize("X"),"X"); 
+    hRatioMultUA5->SetLabelSize(2*hRatioMultUA5->GetLabelSize("Y"),"Y");
+    hRatioMultUA5->SetTitleSize(2*hRatioMultUA5->GetTitleSize("X"),"X");
+    hRatioMultUA5->SetTitleSize(2*hRatioMultUA5->GetTitleSize("Y"),"Y");
+    hRatioMultUA5->SetTitleOffset(0.7*hRatioMultUA5->GetTitleOffset("X"),"X");
+    hRatioMultUA5->SetTitleOffset(0.5*hRatioMultUA5->GetTitleOffset("Y"),"Y");
+    
+    
+    
+    hRatioMultUA5->DrawCopy();
+    //hRatioMultPythia->DrawCopy("same");
     oneLine->Draw("same");
   }
+  
+  TCanvas* cPaper = new TCanvas("FMD_SPD_UA5","FMD_SPD_UA5",800,600);
+  cPaper->cd();
+  
+  sumMult->DrawCopy();
+  sumMultSystPos->DrawCopy("sameE5");
+  sumMultSystNeg->DrawCopy("sameE5");
+  //hTestdNdeta->DrawCopy("same");
+  hSPDcombi->DrawCopy("same");
+  if(what != kMultNSD) {
+    graphinel->Draw("PEsame");
+    graphinel2->Draw("PEsame");
+  }
+  else {
+    graph->Draw("PEsame");
+    graph2->Draw("PEsame");
+  }
+    
+  sumMult->DrawCopy("PEsame");
   c2->cd(1);
+
+  c2->Print("fmdana.png");
   TString species;
   
   switch(what) {
@@ -866,8 +1259,12 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
     species.Form("hits");
     break;
   case kHitsTrVtx:
-    species.Form("hits");
+    species.Form("hits_TrVtx");
     break;
+  case kMultNSD:
+    species.Form("mult_NSD");
+    break;
+    
   default:
     AliWarning("no valid Analysis entry!");
     break;
@@ -876,10 +1273,16 @@ void AliFMDDndeta::DrawDndeta(Analysis what, Int_t rebin, Bool_t realdata) {
   if(hRatioMultPythia)
     hRatioMultPythia->Write();
   hPrim->Write();
+  graph->Write("UA5nsd");
+  graph2->Write("UA5mirrornsd");
+  graphinel->Write("UA5inel");
+  graphinel2->Write("UA5mirrorinel");
   sumMult->Write();
+  hSPDcombi->Write();
   hReldif->Write();
   fMultList[what]->Write();
   c2->Write();
+  //fDataObject->Write();
   fout.Close();
     
 }
@@ -913,16 +1316,22 @@ void AliFMDDndeta::CreateSharingEfficiency(const Char_t* filename, Bool_t store)
        
        TH1F* hCorrection  = (TH1F*)hHits->Clone(Form("hCorrection_FMD%d%c_vtx%d"));
        TH1F* hCorrectionTrVtx  = (TH1F*)hHitsTrVtx->Clone(Form("hCorrection_FMD%d%c_vtx%d"));
+       if(hEvents->GetBinContent(v+1))
+         hCorrection->Scale(1./(Float_t)hEvents->GetBinContent(v+1));
+       if(hPrimEvents->GetBinContent(v+1))
+         hMCHits->Scale(1./(Float_t)hPrimEvents->GetBinContent(v+1));
+       if(hEventsTrVtx->GetBinContent(v+1))
+         hCorrectionTrVtx->Scale(1./(Float_t)hEventsTrVtx->GetBinContent(v+1));
+       if(hPrimEventsTrVtx->GetBinContent(v+1))
+         hMCHitsTrVtx->Scale(1./(Float_t)hPrimEventsTrVtx->GetBinContent(v+1));
        
-       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->SetSharingEff(det,ringChar,v,hCorrection);
        sharEff->SetSharingEffTrVtx(det,ringChar,v,hCorrectionTrVtx);
+       
        //      std::cout<<hHits<<"  "<<hHitsTrVtx<<"   "<<hPrim<<"    "<<hPrimTrVtx<<std::endl;
 
        }
index 313a3238aac295d609a2119b83c71637805c7ff7..cba438fa3a4550bce76a464ff52e9a8f806c8fb1 100644 (file)
@@ -5,7 +5,10 @@
 #include "TList.h"
 #include "TString.h"
 class TH1F;
-
+class TH3F;
+class TProfile3D;
+class TProfile2D;
+class TH3D;
 //
 // This class creates dN/deta for the FMD from the analysis objects.
 // The contents of this class should probably go into a task at some point
@@ -27,7 +30,8 @@ class AliFMDDndeta : public TObject
     fIsGenerated(),
     fPrimEvents(o.fPrimEvents),
     fEvents(o.fEvents),
-    fPrimdNdeta(fPrimdNdeta)
+    fPrimdNdeta(fPrimdNdeta),
+    fDrawAll(kFALSE)
     {}
   
   AliFMDDndeta& operator=(const AliFMDDndeta& /*o*/) 
@@ -37,7 +41,7 @@ class AliFMDDndeta : public TObject
       return (*this);
     }
   
-  enum Analysis {kHits, kHitsTrVtx, kMult, kMultTrVtx};
+  enum Analysis {kHits, kHitsTrVtx, kMult, kMultTrVtx, kMultNSD};
   
   
   
@@ -48,6 +52,7 @@ class AliFMDDndeta : public TObject
   void SetNbinsToCut(Int_t nbins) {fNbinsToCut = nbins;}
   void SetVtxCut1(Int_t vtxcut) {fVtxCut1 = vtxcut;}
   void SetVtxCut2(Int_t vtxcut) {fVtxCut2 = vtxcut;}
+  void SetDrawAll(Bool_t drawall) {fDrawAll = drawall;}
   void CreateSharingEfficiency(const Char_t* filename, Bool_t store = kFALSE);
   TList* GetMultList(Analysis what) {return fMultList[what];}
  private:
@@ -57,16 +62,20 @@ class AliFMDDndeta : public TObject
   const char* GetPrimName(Analysis what, UShort_t det, Char_t ring, Int_t vtxbin);
   void   RebinHistogram(TH1F* hist, Int_t rebin);
   TList*  fList;                         // A list of input histograms
-  TList*  fMultList[4];                  // A list of mult histograms 
+  TList*  fMultList[5];                  // A list of mult histograms 
   Int_t   fNbinsToCut;                   // The number of bins to cut
   Int_t   fVtxCut1;                      // Vtx low
   Int_t   fVtxCut2;                      // Vtx high
   Bool_t  fIsInit;                       // Are we init ? 
-  Bool_t  fIsGenerated[4];               // Have we generated ?
+  Bool_t  fIsGenerated[5];               // Have we generated ?
   TString fPrimEvents;                   // Number of prim events
   TString fEvents;                       // Number of events
   TString fPrimdNdeta;                   // the primary dNdeta from MC
-  Char_t* fAnalysisNames[4];             // Names of analysis
+  Char_t* fAnalysisNames[5];             // Names of analysis
+  // TProfile3D*   fDataObject;                  // New data object
+  Bool_t fDrawAll;                        //Draw relevant or all
+  //TH3D*   fDataObject;                  // New data object
+  
   ClassDef(AliFMDDndeta,2);
 };
 
index 5cea70acaed4f834cc6c64d4d8cdcb095e4069d4..d42a6e8c242a4de74b8538012383b81bd7411ea1 100644 (file)
Binary files a/PWG2/FORWARD/corrections/Background/background_0_0_1_0_0_0.root and b/PWG2/FORWARD/corrections/Background/background_0_0_1_0_0_0.root differ
index f6fdd58e08f6c14e4e0dcf192213e96de5b1245d..9875aa5ddb7046da4d3894ce62dacc13ea5397d5 100644 (file)
Binary files a/PWG2/FORWARD/corrections/EventSelectionEfficiency/eventselectionefficiency_0_0_1_0_0_0.root and b/PWG2/FORWARD/corrections/EventSelectionEfficiency/eventselectionefficiency_0_0_1_0_0_0.root differ