Christmas cleanup :)
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Dec 2006 14:14:09 +0000 (14:14 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Dec 2006 14:14:09 +0000 (14:14 +0000)
20 files changed:
PWG0/AliPWG0Helper.cxx
PWG0/dNdEta/AliVertexSelector.cxx [new file with mode: 0644]
PWG0/dNdEta/AliVertexSelector.h [new file with mode: 0644]
PWG0/dNdEta/AlidNdEtaAnalysisESDSelector.cxx
PWG0/dNdEta/AlidNdEtaAnalysisESDSelector.h
PWG0/dNdEta/AlidNdEtaAnalysisMCSelector.cxx
PWG0/dNdEta/AlidNdEtaAnalysisMCSelector.h
PWG0/dNdEta/AlidNdEtaCorrectionSelector.cxx
PWG0/dNdEta/AlidNdEtaSystematicsSelector.cxx
PWG0/dNdEta/dNdEtaAnalysis.cxx
PWG0/dNdEta/drawPlots.C
PWG0/dNdEta/drawSystematics.C
PWG0/dNdEta/drawSystematicsNew.C
PWG0/dNdEta/drawVertexRecEff.C [deleted file]
PWG0/dNdEta/makeCorrection.C [deleted file]
PWG0/dNdEta/runSystematicStudies.sh [deleted file]
PWG0/dNdEta/runVertexRecEff.C [deleted file]
PWG0/dNdEta/runVertexSelector.C [new file with mode: 0644]
PWG0/dNdEta/testAnalysis.C [deleted file]
PWG0/dNdEta/testAnalysis2.C

index 13e01024122930435e726d6d90e8a0387dca93e0..6b0f6ff2e66cf2aa30c0e64cbe071816eb217d15 100644 (file)
@@ -56,6 +56,8 @@ Bool_t AliPWG0Helper::IsVertexReconstructed(AliESD* aEsd)
   if (vtx_res[2]==0 || vtx_res[2]>0.1)
     return kFALSE;
 
+  // check Ncontributors, if <0 it means error *gna*
+
   return kTRUE;
 }
 
@@ -176,7 +178,7 @@ void AliPWG0Helper::CreateDividedProjections(TH3* hist, TH3* hist2, const char*
   TH1* division = dynamic_cast<TH1*> (proj->Clone(Form("%s_div_%s", proj->GetName(), proj2->GetName())));
   //printf("doing axis: %s, x axis has %d %d bins, min %f %f max %f %f\n", axis, division->GetNbinsX(), proj2->GetNbinsX(), division->GetXaxis()->GetBinLowEdge(1), proj2->GetXaxis()->GetBinLowEdge(1), division->GetXaxis()->GetBinUpEdge(division->GetNbinsX()), proj2->GetXaxis()->GetBinUpEdge(proj2->GetNbinsX()));
   //printf("doing axis: %s, y axis has %d %d bins, min %f %f max %f %f\n", axis, division->GetNbinsY(), proj2->GetNbinsY(), division->GetYaxis()->GetBinLowEdge(1), proj2->GetYaxis()->GetBinLowEdge(1), division->GetYaxis()->GetBinUpEdge(division->GetNbinsY()), proj2->GetYaxis()->GetBinUpEdge(proj2->GetNbinsY()));
-  division->Divide(proj2);
+  division->Divide(proj, proj2, 1, 1, "B");
   division->SetTitle(Form("%s divided %s", proj->GetTitle(), proj2->GetTitle()));
 
   if (putErrors)
diff --git a/PWG0/dNdEta/AliVertexSelector.cxx b/PWG0/dNdEta/AliVertexSelector.cxx
new file mode 100644 (file)
index 0000000..ab16e5f
--- /dev/null
@@ -0,0 +1,277 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+// The ESD is available as member fESD
+//
+// The Process function is nearly empty. Implement your analysis there and look at the other listed below functions you
+// might need.
+//
+// The following methods can be overrriden. Please do not forgot to call the base class function.
+//
+//    Begin():        called everytime a loop on the tree starts,
+//                    a convenient place to create your histograms.
+//    SlaveBegin():   called after Begin(), when on PROOF called only on the
+//                    slave servers.
+//    Init():         called for each new tree. Enable/Disable branches here.
+//    Process():      called for each event, in this function you decide what
+//                    to read and fill your histograms.
+//    SlaveTerminate: called at the end of the loop on the tree, when on PROOF
+//                    called only on the slave servers.
+//    Terminate():    called at the end of the loop on the tree,
+//                    a convenient place to draw/fit your histograms.
+//
+//  Author: Jan.Fiete.Grosse-Oetringhaus@cern.ch
+
+#include "AliVertexSelector.h"
+
+#include <TH1F.h>
+#include <TH2F.h>
+#include <TFile.h>
+#include <TTree.h>
+#include <TProfile.h>
+#include <TCanvas.h>
+#include <TAxis.h>
+
+#include <AliLog.h>
+#include <AliESD.h>
+#include <AliHeader.h>
+#include <AliGenEventHeader.h>
+
+#include <AliPWG0Helper.h>
+#include "esdTrackCuts/AliESDtrackCuts.h"
+
+ClassImp(AliVertexSelector)
+
+AliVertexSelector::AliVertexSelector() :
+  AliSelectorRL(),
+  fEsdTrackCuts(0),
+  fVertexMC(0),
+  fVertexESD(0),
+  fVertexCorr(0),
+  fVertexCorr2(0),
+  fFakes(0)
+{
+  //
+  // Constructor. Initialization of pointers
+  //
+}
+
+AliVertexSelector::~AliVertexSelector()
+{
+  //
+  // Destructor
+  //
+}
+
+void AliVertexSelector::SlaveBegin(TTree* tree)
+{
+  AliSelectorRL::SlaveBegin(tree);
+
+  fVertexMC = new TH1F("fVertexMC", "fVertexMC;MC vtx-z;Count", 501, -10, 10);
+  fVertexESD = new TH1F("fVertexESD", "fVertexESD;ESD vtx-z;Count", 501, -10, 10);
+  fVertexCorr = new TH2F("fVertexCorr", "fVertexCorr;MC vtx-z;ESD vtx-z - MC vtx-z", 40, -10, 10, 200, -1, 1);
+  fVertexCorr2 = new TH2F("fVertexCorr2", "fVertexCorr2;MC vtx-z;ESD vtx-z - MC vtx-z", 40, -10, 10, 200, -1, 1);
+  fFakes = new TH2F("fFakes", "fFakes;type;label", 5, 0, 5, 1001, -500.5, 500.5);
+
+  if (!fEsdTrackCuts && fInput)
+    fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fInput->FindObject("AliESDtrackCuts"));
+}
+
+void AliVertexSelector::Init(TTree* tree)
+{
+  // read the user objects
+
+  AliSelectorRL::Init(tree);
+
+  // Enable only the needed branches
+  if (tree)
+  {
+    tree->SetBranchStatus("*", 0);
+    tree->SetBranchStatus("fTriggerMask", 1);
+    tree->SetBranchStatus("fSPDVertex*", 1);
+    tree->SetBranchStatus("fTracks.fLabel", 1);
+
+    AliESDtrackCuts::EnableNeededBranches(tree);
+  }
+}
+
+Bool_t AliVertexSelector::Process(Long64_t entry)
+{
+  //
+  // Implement your analysis here. Do not forget to call the parent class Process by
+  // if (AliSelector::Process(entry) == kFALSE)
+  //   return kFALSE;
+  //
+
+  if (AliSelectorRL::Process(entry) == kFALSE)
+    return kFALSE;
+
+  // Check prerequisites
+  if (!fESD)
+  {
+    AliDebug(AliLog::kError, "ESD branch not available");
+    return kFALSE;
+  }
+
+  if (!fEsdTrackCuts)
+  {
+    AliDebug(AliLog::kError, "fESDTrackCuts not available");
+    return kFALSE;
+  }
+
+  if (AliPWG0Helper::IsEventTriggered(fESD) == kFALSE)
+  {
+    AliDebug(AliLog::kDebug+1, Form("Skipping event %d because it was not triggered", (Int_t) entry));
+    return kTRUE;
+  }
+
+  if (AliPWG0Helper::IsVertexReconstructed(fESD) == kFALSE)
+  {
+    AliDebug(AliLog::kDebug+1, Form("Skipping event %d because its vertex was not reconstructed", (Int_t) entry));
+    return kTRUE;
+  }
+
+  AliHeader* header = GetHeader();
+  if (!header)
+  {
+    AliDebug(AliLog::kError, "Header not available");
+    return kFALSE;
+  }
+
+  // get the MC vertex
+  AliGenEventHeader* genHeader = header->GenEventHeader();
+
+  TArrayF vtxMC(3);
+  genHeader->PrimaryVertex(vtxMC);
+
+  // ########################################################
+  // get the ESD vertex
+  const AliESDVertex* vtxESD = fESD->GetVertex();
+  Double_t vtx[3];
+  vtxESD->GetXYZ(vtx);
+
+  fVertexMC->Fill(vtxMC[2]);
+  fVertexESD->Fill(vtx[2]);
+  fVertexCorr->Fill(vtxMC[2], vtx[2] - vtxMC[2]);
+
+  Float_t correctedVertex = vtx[2] + 2.951034e-03 + 6.859620e-04 * vtxMC[2];
+
+  fVertexCorr2->Fill(vtxMC[2], correctedVertex - vtxMC[2]);
+
+  const Int_t max = 10000;
+
+  Bool_t used[max];
+  for (Int_t i=0; i<max; ++i)
+    used[i] = kFALSE;
+
+  Int_t fakeTracks = 0;
+
+  Int_t nTracks = fESD->GetNumberOfTracks();
+  for (Int_t t=0; t<nTracks; t++)
+  {
+    AliESDtrack* esdTrack = fESD->GetTrack(t);
+
+    if (!esdTrack)
+      continue;
+
+
+    if (!fEsdTrackCuts->AcceptTrack(esdTrack))
+      continue;
+
+    UInt_t status = esdTrack->GetStatus();
+    if ((!status & AliESDtrack::kTPCrefit))
+      continue;
+
+    Int_t label = TMath::Abs(esdTrack->GetLabel());
+    if (label < max)
+    {
+      if (used[label])
+      {
+        fFakes->Fill(1.5, esdTrack->GetLabel());
+        fakeTracks++;
+      }
+
+      used[label] = kTRUE;
+    }
+
+    fFakes->Fill(0.5, esdTrack->GetLabel());
+  }
+
+  if (fakeTracks > 10)
+    printf("In event %lld we have %d fake tracks.\n", entry, fakeTracks);
+
+  return kTRUE;
+}
+
+void AliVertexSelector::SlaveTerminate()
+{
+  // The SlaveTerminate() function is called after all entries or objects
+  // have been processed. When running with PROOF SlaveTerminate() is called
+  // on each slave server.
+
+  AliSelectorRL::SlaveTerminate();
+
+  fOutput->Add(fVertexMC);
+  fOutput->Add(fVertexESD);
+  fOutput->Add(fVertexCorr);
+  fOutput->Add(fVertexCorr2);
+  fOutput->Add(fFakes);
+}
+
+void AliVertexSelector::Terminate()
+{
+  // The Terminate() function is the last function to be called during
+  // a query. It always runs on the client, it can be used to present
+  // the results graphically or save the results to file.
+
+  AliSelectorRL::Terminate();
+
+  fVertexMC = dynamic_cast<TH1F*> (fOutput->FindObject("fVertexMC"));
+  fVertexESD = dynamic_cast<TH1F*> (fOutput->FindObject("fVertexESD"));
+  fVertexCorr = dynamic_cast<TH2F*> (fOutput->FindObject("fVertexCorr"));
+  fVertexCorr2 = dynamic_cast<TH2F*> (fOutput->FindObject("fVertexCorr2"));
+  fFakes = dynamic_cast<TH2F*> (fOutput->FindObject("fFakes"));
+
+  if (!fVertexMC || !fVertexESD || !fVertexCorr || !fVertexCorr2 || !fFakes)
+    return;
+
+  TFile* file = TFile::Open("vertex.root", "RECREATE");
+  fVertexMC->Write();
+  fVertexESD->Write();
+  fVertexCorr->Write();
+  fVertexCorr2->Write();
+  fFakes->Write();
+  file->Close();
+
+  TCanvas* canvas = new TCanvas("canvas", "canvas", 1000, 1000);
+  canvas->Divide(2, 2);
+
+  canvas->cd(1);
+  fVertexCorr->DrawCopy("COLZ");
+
+  canvas->cd(2);
+  fVertexCorr->ProfileX()->DrawCopy();
+
+  canvas->cd(3);
+  fVertexCorr2->DrawCopy("COLZ");
+
+  canvas->cd(4);
+  fFakes->DrawCopy();
+
+  printf("%f tracks, %f with label > 0, %f with label == 0, %f with label < 0\n", fFakes->Integral(1, 1, 0, fFakes->GetYaxis()->GetNbins()), fFakes->Integral(1, 1, fFakes->GetYaxis()->FindBin(0.0), fFakes->GetYaxis()->GetNbins()), fFakes->GetBinContent(1, fFakes->GetYaxis()->FindBin(0.0)), fFakes->Integral(1, 1, 0, fFakes->GetYaxis()->FindBin(0.0)));
+  printf("%f tracks, %f with label > 0, %f with label == 0, %f with label < 0\n", fFakes->Integral(2, 2, 0, fFakes->GetYaxis()->GetNbins()), fFakes->Integral(2, 2, fFakes->GetYaxis()->FindBin(0.0), fFakes->GetYaxis()->GetNbins()), fFakes->GetBinContent(2, fFakes->GetYaxis()->FindBin(0.0)), fFakes->Integral(2, 2, 0, fFakes->GetYaxis()->FindBin(0.0)));
+}
diff --git a/PWG0/dNdEta/AliVertexSelector.h b/PWG0/dNdEta/AliVertexSelector.h
new file mode 100644 (file)
index 0000000..e2cd3c9
--- /dev/null
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+#ifndef AliVertexSelector_H
+#define AliVertexSelector_H
+
+#include "AliSelectorRL.h"
+
+class TH1F;
+class TH2F;
+class AliESDtrackCuts;
+
+class AliVertexSelector : public AliSelectorRL {
+  public:
+    AliVertexSelector();
+    virtual ~AliVertexSelector();
+
+    virtual void    SlaveBegin(TTree *tree);
+    virtual void    Init(TTree *tree);
+    virtual Bool_t  Process(Long64_t entry);
+    virtual void    SlaveTerminate();
+    virtual void    Terminate();
+
+ private:
+    AliVertexSelector(const AliVertexSelector&);
+    AliVertexSelector& operator=(const AliVertexSelector&);
+
+    AliESDtrackCuts*  fEsdTrackCuts;     // Object containing the parameters of the esd track cuts
+
+    TH1F* fVertexMC;   // MC vertex distribution
+    TH1F* fVertexESD;  // ESD vertex distribution
+    TH2F* fVertexCorr; // vertex correlation (esd vtx - mc vtx vs. mc vtx)
+    TH2F* fVertexCorr2; // vertex correlation (esd vtx - mc vtx vs. mc vtx)
+
+    TH2F* fFakes; // counts the fakes
+
+  ClassDef(AliVertexSelector, 0);
+};
+
+#endif
index 6a35ba69cc42b8f14c68e9b66da7679d6d30342a..ec12b93b7def60cdd0ff798a23ba0bb225e9179b 100644 (file)
@@ -8,6 +8,7 @@
 #include <TVector3.h>
 #include <TChain.h>
 #include <TFile.h>
+#include <TH1F.h>
 
 #include <AliLog.h>
 #include <AliESDVertex.h>
@@ -27,6 +28,7 @@ ClassImp(AlidNdEtaAnalysisESDSelector)
 AlidNdEtaAnalysisESDSelector::AlidNdEtaAnalysisESDSelector() :
   AliSelectorRL(),
   fdNdEtaAnalysis(0),
+  fMult(0),
   fEsdTrackCuts(0)
 {
   //
@@ -78,6 +80,7 @@ void AlidNdEtaAnalysisESDSelector::SlaveBegin(TTree* tree)
   ReadUserObjects(tree);
 
   fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
+  fMult = new TH1F("fMult", "fMult;Ntracks;Count", 201, -0.5, 200.5);
 }
 
 void AlidNdEtaAnalysisESDSelector::Init(TTree* tree)
@@ -157,7 +160,7 @@ Bool_t AlidNdEtaAnalysisESDSelector::Process(Long64_t entry)
   vtxESD->GetXYZ(vtx);
 
   //vtx[2] = vtxMC[2];
-  //vtx[2] += 0.1;
+  //vtx[2] -= 2.951034e-03 + 6.859620e-04 * vtxMC[2];
 
   // get number of "good" tracks
   TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD);
@@ -210,6 +213,7 @@ Bool_t AlidNdEtaAnalysisESDSelector::Process(Long64_t entry)
 
   // for event count per vertex
   fdNdEtaAnalysis->FillEvent(vtx[2], nGoodTracks);
+  fMult->Fill(nGoodTracks);
 
   return kTRUE;
 }
@@ -232,6 +236,8 @@ void AlidNdEtaAnalysisESDSelector::SlaveTerminate()
   // Add the objects to the output list and set them to 0, so that the destructor does not delete them.
 
   fOutput->Add(fdNdEtaAnalysis);
+  fOutput->Add(fMult);
+
   fdNdEtaAnalysis = 0;
 }
 
@@ -244,6 +250,7 @@ void AlidNdEtaAnalysisESDSelector::Terminate()
   AliSelectorRL::Terminate();
 
   fdNdEtaAnalysis = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta"));
+  fMult = dynamic_cast<TH1F*> (fOutput->FindObject("fMult"));
 
   if (!fdNdEtaAnalysis)
   {
@@ -259,6 +266,9 @@ void AlidNdEtaAnalysisESDSelector::Terminate()
   if (fEsdTrackCuts)
     fEsdTrackCuts->SaveHistograms("esd_tracks_cuts");
 
+  if (fMult)
+    fMult->Write();
+
   fout->Write();
   fout->Close();
 }
index 8ea364a8e9ecfd951d89594cfe6857f047e1b5b3..10a12ea84513a5f6e003b915ddc43f5419683a2b 100644 (file)
@@ -8,6 +8,7 @@
 class AliESDtrackCuts;
 class dNdEtaAnalysis;
 class AlidNdEtaCorrection;
+class TH1F;
 
 class AlidNdEtaAnalysisESDSelector : public AliSelectorRL {
   public:
@@ -25,6 +26,7 @@ class AlidNdEtaAnalysisESDSelector : public AliSelectorRL {
     void ReadUserObjects(TTree* tree);
 
     dNdEtaAnalysis* fdNdEtaAnalysis;        // contains the uncorrected histograms
+    TH1F*           fMult;                  // raw multiplicity histogram (control histogram)
 
     AliESDtrackCuts*  fEsdTrackCuts;     // Object containing the parameters of the esd track cuts
 
index cfe564774b73c2283f21a081a610a441faf094d7..4b57713ffbfbfac95bce7406ad9e1866565bb1bf 100644 (file)
 #include <AliGenEventHeader.h>
 #include <AliHeader.h>
 #include <AliStack.h>
+#include <AliESDtrack.h>
 
 #include "dNdEta/dNdEtaAnalysis.h"
 #include <AliPWG0Helper.h>
 #include <AliCorrection.h>
 #include <AliCorrectionMatrix2D.h>
+#include "esdTrackCuts/AliESDtrackCuts.h"
 
 
 ClassImp(AlidNdEtaAnalysisMCSelector)
 
 AlidNdEtaAnalysisMCSelector::AlidNdEtaAnalysisMCSelector() :
   AliSelectorRL(),
+  fEsdTrackCuts(0),
   fdNdEtaAnalysis(0),
   fdNdEtaAnalysisTr(0),
   fdNdEtaAnalysisTrVtx(0),
+  fdNdEtaAnalysisTracks(0),
   fVertex(0),
   fPartPt(0),
   fEvents(0)
@@ -47,6 +51,27 @@ AlidNdEtaAnalysisMCSelector::~AlidNdEtaAnalysisMCSelector()
   //
 }
 
+void AlidNdEtaAnalysisMCSelector::Begin(TTree* tree)
+{
+  // Begin function
+
+  ReadUserObjects(tree);
+}
+
+void AlidNdEtaAnalysisMCSelector::ReadUserObjects(TTree* tree)
+{
+  // read the user objects, called from slavebegin and begin
+
+  if (!fEsdTrackCuts && fInput)
+    fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fInput->FindObject("AliESDtrackCuts"));
+
+  if (!fEsdTrackCuts && tree)
+    fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (tree->GetUserInfo()->FindObject("AliESDtrackCuts"));
+
+  if (!fEsdTrackCuts)
+     AliDebug(AliLog::kError, "ERROR: Could not read EsdTrackCuts from input list.");
+}
+
 void AlidNdEtaAnalysisMCSelector::SlaveBegin(TTree * tree)
 {
   // The SlaveBegin() function is called after the Begin() function.
@@ -55,9 +80,12 @@ void AlidNdEtaAnalysisMCSelector::SlaveBegin(TTree * tree)
 
   AliSelectorRL::SlaveBegin(tree);
 
+  ReadUserObjects(tree);
+
   fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
   fdNdEtaAnalysisTr = new dNdEtaAnalysis("dndetaTr", "dndetaTr");
   fdNdEtaAnalysisTrVtx = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx");
+  fdNdEtaAnalysisTracks = new dNdEtaAnalysis("dndetaTracks", "dndetaTracks");
   fVertex = new TH3F("vertex_check", "vertex_check", 50, -50, 50, 50, -50, 50, 50, -50, 50);
   for (Int_t i=0; i<3; ++i)
   {
@@ -73,9 +101,18 @@ void AlidNdEtaAnalysisMCSelector::Init(TTree *tree)
 {
   AliSelectorRL::Init(tree);
 
+  if (!tree)
+  {
+    AliDebug(AliLog::kError, "tree not available");
+    return;
+  }
+
   tree->SetBranchStatus("*", 0);
   tree->SetBranchStatus("fTriggerMask", 1);
   tree->SetBranchStatus("fSPDVertex*", 1);
+  tree->SetBranchStatus("fTracks.fLabel", 1);
+
+  AliESDtrackCuts::EnableNeededBranches(tree);
 }
 
 Bool_t AlidNdEtaAnalysisMCSelector::Process(Long64_t entry)
@@ -167,6 +204,43 @@ Bool_t AlidNdEtaAnalysisMCSelector::Process(Long64_t entry)
       fdNdEtaAnalysisTrVtx->FillEvent(vtxMC[2], nAcceptedParticles);
   }
 
+  if (!eventTriggered || !vertexReconstructed)
+    return kTRUE;
+
+  // from tracks is only done for triggered and vertex reconstructed events
+
+  // get number of "good" tracks
+  TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD);
+  Int_t nGoodTracks = list->GetEntries();
+
+  // loop over esd tracks
+  for (Int_t t=0; t<nGoodTracks; t++)
+  {
+    AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (list->At(t));
+    if (!esdTrack)
+    {
+      AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", t));
+      continue;
+    }
+
+    Int_t label = TMath::Abs(esdTrack->GetLabel());
+
+    TParticle* particle = stack->Particle(label);
+    if (!particle)
+    {
+      AliDebug(AliLog::kError, Form("ERROR: Could not retrieve particle %d.", esdTrack->GetLabel()));
+      continue;
+    }
+
+    fdNdEtaAnalysisTracks->FillTrack(vtxMC[2], particle->Eta(), particle->Pt());
+  } // end of track loop
+
+  delete list;
+  list = 0;
+
+  // for event count per vertex
+  fdNdEtaAnalysisTracks->FillEvent(vtxMC[2], nGoodTracks);
+
   return kTRUE;
 }
 
@@ -188,6 +262,8 @@ void AlidNdEtaAnalysisMCSelector::SlaveTerminate()
   fOutput->Add(fdNdEtaAnalysis);
   fOutput->Add(fdNdEtaAnalysisTr);
   fOutput->Add(fdNdEtaAnalysisTrVtx);
+  fOutput->Add(fdNdEtaAnalysisTracks);
+
   fOutput->Add(fPartPt);
   fOutput->Add(fEvents);
   for (Int_t i=0; i<3; ++i)
@@ -203,6 +279,7 @@ void AlidNdEtaAnalysisMCSelector::Terminate()
   fdNdEtaAnalysis = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta"));
   fdNdEtaAnalysisTr = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndetaTr"));
   fdNdEtaAnalysisTrVtx = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndetaTrVtx"));
+  fdNdEtaAnalysisTracks = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndetaTracks"));
   fPartPt = dynamic_cast<TH1F*> (fOutput->FindObject("dndeta_check_pt"));
   fEvents = dynamic_cast<TH1F*> (fOutput->FindObject("dndeta_check_vertex"));
   for (Int_t i=0; i<3; ++i)
@@ -217,6 +294,7 @@ void AlidNdEtaAnalysisMCSelector::Terminate()
   fdNdEtaAnalysis->Finish(0, -1, AlidNdEtaCorrection::kNone);
   fdNdEtaAnalysisTr->Finish(0, -1, AlidNdEtaCorrection::kNone);
   fdNdEtaAnalysisTrVtx->Finish(0, -1, AlidNdEtaCorrection::kNone);
+  fdNdEtaAnalysisTracks->Finish(0, -1, AlidNdEtaCorrection::kNone);
 
   Int_t events = (Int_t) fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram()->Integral();
   fPartPt->Scale(1.0/events);
@@ -247,6 +325,7 @@ void AlidNdEtaAnalysisMCSelector::Terminate()
   fdNdEtaAnalysis->SaveHistograms();
   fdNdEtaAnalysisTr->SaveHistograms();
   fdNdEtaAnalysisTrVtx->SaveHistograms();
+  fdNdEtaAnalysisTracks->SaveHistograms();
   fPartPt->Write();
 
   fout->Write();
index 58b10d3aa20247bafbd94f07af8fa734117fb793..aade0a83fca608c674e111b33f0b805c08b96a0f 100644 (file)
@@ -8,22 +8,30 @@
 class TH3F;
 class TH1F;
 class dNdEtaAnalysis;
+class AliESDtrackCuts;
 
 class AlidNdEtaAnalysisMCSelector : public AliSelectorRL {
   public:
     AlidNdEtaAnalysisMCSelector();
     virtual ~AlidNdEtaAnalysisMCSelector();
 
+    virtual void    Begin(TTree *tree);
     virtual void    SlaveBegin(TTree *tree);
     virtual void    SlaveTerminate();
     virtual void    Init(TTree *tree);
     virtual Bool_t  Process(Long64_t entry);
     virtual void    Terminate();
 
- private:
+  protected:
+    void ReadUserObjects(TTree* tree);
+
+  private:
+    AliESDtrackCuts* fEsdTrackCuts;     // Object containing the parameters of the esd track cuts, needed for fdNdEtaAnalysisTracks
+
     dNdEtaAnalysis* fdNdEtaAnalysis;        // contains the dndeta from the full sample
     dNdEtaAnalysis* fdNdEtaAnalysisTr;      // contains the dndeta from the triggered events
     dNdEtaAnalysis* fdNdEtaAnalysisTrVtx;   // contains the dndeta from the triggered events with vertex
+    dNdEtaAnalysis* fdNdEtaAnalysisTracks;  // contains the dndeta from the triggered events with vertex counted from the mc particles associated to the tracks (comparing this to the raw values from the esd shows the effect of the detector resolution)
 
     // the following are control histograms to check the dNdEtaAnalysis class
     TH3F* fVertex;     // vertex of counted particles
index a0e1079d22f7326dea11f907367f85c33f8d609d..60b53344d0c2a7b08409e822266d99c368cf80ee 100644 (file)
@@ -340,11 +340,6 @@ Bool_t AlidNdEtaCorrectionSelector::Process(Long64_t entry)
     }
   } // end of track loop
 
-  // get the ESD vertex
-  const AliESDVertex* vtxESD = fESD->GetVertex();
-  // FAKE test!
-  //nGoodTracks = vtxESD->GetNContributors();
-
   if (eventTriggered && vertexReconstructed)
     fdNdEtaAnalysisMC->FillEvent(vtxMC[2], nGoodTracks);
 
index 5e967743c253c7b8b9d3d008ce8481d25c3fa73d..4499a02702b7bbf59191579ea82dfffac2ec394d 100644 (file)
@@ -95,6 +95,8 @@ void AlidNdEtaSystematicsSelector::SlaveBegin(TTree* tree)
 
   printf("Running AlidNdEtaSystematicsSelector with options %s\n", option.Data());
 
+  // Options: secondaries particle-composition sigma-vertex vertexreco triggerbias
+
   if (option.Contains("secondaries"))
   {
     fSecondaries = new TH2F("fSecondaries", "fSecondaries;Case;N", 8, 0.5, 8.5, 2001, -0.5, 2000.5);
index 21ae3b6a9b35aa91fce2dcbe166d2c9396b69589..7f2966a15278c1a718194cdb4fa2dbca1383270a 100644 (file)
@@ -337,8 +337,8 @@ void dNdEtaAnalysis::Finish(AlidNdEtaCorrection* correction, Float_t ptCut, Alid
         continue;
       }
 
-      printf("Eta: %d Vertex Range: %d %d, Event Count %f, Track Sum: %f, Track Sum corrected: %f\n", iEta, vertexBinBegin, vertexBinEnd, totalEvents, sum, sum / ptCutOffCorrection);
-      
+      //printf("Eta: %d Vertex Range: %d %d, Event Count %f, Track Sum: %f, Track Sum corrected: %f\n", iEta, vertexBinBegin, vertexBinEnd, totalEvents, sum, sum / ptCutOffCorrection);
+
       Float_t dndeta = sum / totalEvents;
       Float_t error  = TMath::Sqrt(sumError2) / totalEvents;
 
index c59ed764058347106c6fa4b16754bbefffd717c8..0258de61a97294b76cb09b50cb2cdee4433efe13 100644 (file)
@@ -211,8 +211,7 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   TH1* histESDMBNoPt = (TH1*) file->Get("dndetaTr/dNdEta");
   TH1* histESDMBVtx = (TH1*) file->Get("dndetaTrVtx/dNdEta_corrected");
   TH1* histESDMBVtxNoPt = (TH1*) file->Get("dndetaTrVtx/dNdEta");
-
-  TCanvas* canvas = new TCanvas("dNdEta1", "dNdEta1", 500, 500);
+  TH1* histESDMBTracksNoPt = (TH1*) file->Get("dndetaTracks/dNdEta");
 
   Prepare1DPlot(histESD);
   Prepare1DPlot(histESDMB);
@@ -221,6 +220,7 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   Prepare1DPlot(histESDNoPt);
   Prepare1DPlot(histESDMBNoPt);
   Prepare1DPlot(histESDMBVtxNoPt);
+  Prepare1DPlot(histESDMBTracksNoPt);
 
   histESD->SetLineWidth(0);
   histESDMB->SetLineWidth(0);
@@ -230,13 +230,14 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   histESDMBNoPt->SetLineWidth(0);
   histESDMBVtxNoPt->SetLineWidth(0);
 
-  histESD->SetMarkerColor(kRed);
-  histESDMB->SetMarkerColor(kBlue);
-  histESDMBVtx->SetMarkerColor(103);
+  histESD->SetMarkerColor(1);
+  histESDMB->SetMarkerColor(2);
+  histESDMBVtx->SetMarkerColor(3);
 
-  histESDNoPt->SetMarkerColor(kRed);
-  histESDMBNoPt->SetMarkerColor(kBlue);
-  histESDMBVtxNoPt->SetMarkerColor(103);
+  histESDNoPt->SetMarkerColor(1);
+  histESDMBNoPt->SetMarkerColor(2);
+  histESDMBVtxNoPt->SetMarkerColor(3);
+  histESDMBTracksNoPt->SetMarkerColor(4);
 
   histESD->SetMarkerStyle(20);
   histESDMB->SetMarkerStyle(21);
@@ -245,8 +246,9 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   histESDNoPt->SetMarkerStyle(20);
   histESDMBNoPt->SetMarkerStyle(21);
   histESDMBVtxNoPt->SetMarkerStyle(22);
+  histESDMBTracksNoPt->SetMarkerStyle(23);
 
-  TH2F* dummy = new TH2F("dummy", "", 100, -1.5, 1.5, 1000, 0.1, histESDMBVtx->GetMaximum() * 1.1);
+  TH2F* dummy = new TH2F("dummy", "", 100, -1.5, 1.5, 1000, 3.1, histESDMBVtx->GetMaximum() * 1.1);
   Prepare1DPlot(dummy);
   dummy->SetStats(kFALSE);
   dummy->SetXTitle("#eta");
@@ -262,6 +264,9 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   histESDNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
   histESDMBNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
   histESDMBVtxNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
+  histESDMBTracksNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
+
+  /*TCanvas* canvas = new TCanvas("dNdEta1", "dNdEta1", 500, 500);
 
   dummy->DrawCopy();
   histESDMBVtx->Draw("SAME");
@@ -269,7 +274,7 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   histESD->Draw("SAME");
 
   canvas->SaveAs("dNdEta1.gif");
-  canvas->SaveAs("dNdEta1.eps");
+  canvas->SaveAs("dNdEta1.eps");*/
 
   if (onlyESD)
     return;
@@ -296,6 +301,11 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   fdNdEtaAnalysis->Finish(0, 0.3, AlidNdEtaCorrection::kNone);
   TH1* histMCTrVtxPtCut = fdNdEtaAnalysis->GetdNdEtaHistogram(0);
 
+  fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTracks", "dndetaTracks");
+  fdNdEtaAnalysis->LoadHistograms();
+  fdNdEtaAnalysis->Finish(0, 0.3, AlidNdEtaCorrection::kNone);
+  TH1* histMCTracksPtCut = fdNdEtaAnalysis->GetdNdEtaHistogram(0);
+
   TCanvas* canvas2 = new TCanvas("dNdEta2", "dNdEta2", 500, 500);
 
   Prepare1DPlot(histMC);
@@ -305,14 +315,18 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   Prepare1DPlot(histMCPtCut);
   Prepare1DPlot(histMCTrPtCut);
   Prepare1DPlot(histMCTrVtxPtCut);
+  if (histMCTracksPtCut)
+    Prepare1DPlot(histMCTracksPtCut);
 
-  histMC->SetLineColor(kBlue);
-  histMCTr->SetLineColor(kBlue);
-  histMCTrVtx->SetLineColor(kBlue);
+  histMC->SetLineColor(1);
+  histMCTr->SetLineColor(2);
+  histMCTrVtx->SetLineColor(3);
 
-  histMCPtCut->SetLineColor(kBlue);
-  histMCTrPtCut->SetLineColor(kBlue);
-  histMCTrVtxPtCut->SetLineColor(kBlue);
+  histMCPtCut->SetLineColor(1);
+  histMCTrPtCut->SetLineColor(2);
+  histMCTrVtxPtCut->SetLineColor(3);
+  if (histMCTracksPtCut)
+    histMCTracksPtCut->SetLineColor(4);
 
   TH2* dummy2 = (TH2F*) dummy->Clone("dummy2");
   Prepare1DPlot(dummy2);
@@ -328,9 +342,12 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   histESDNoPt->Draw("SAME");
   histESDMBNoPt->Draw("SAME");
   histESDMBVtxNoPt->Draw("SAME");
+  histESDMBTracksNoPt->Draw("SAME");
   histMCPtCut->Draw("SAME");
   histMCTrPtCut->Draw("SAME");
   histMCTrVtxPtCut->Draw("SAME");
+  if (histMCTracksPtCut)
+    histMCTracksPtCut->Draw("SAME");
 
   canvas2->SaveAs("dNdEta2.gif");
   canvas2->SaveAs("dNdEta2.eps");
@@ -346,15 +363,15 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   ratio->SetLineColor(1);
   ratioNoPt->SetLineColor(2);
 
-  TCanvas* canvas3 = new TCanvas("dNdEta", "dNdEta", 700, 700);
+  TCanvas* canvas3 = new TCanvas("dNdEta", "dNdEta", 700, 600);
   canvas3->Range(0, 0, 1, 1);
   //canvas3->Divide(1, 2, 0, 0);
 
   //canvas3->cd(1);
-  TPad* pad1 = new TPad("dNdEta_1", "", 0, 0.4, 0.98, 0.98);
+  TPad* pad1 = new TPad("dNdEta_1", "", 0, 0.5, 0.98, 0.98);
   pad1->Draw();
 
-  TPad* pad2 = new TPad("dNdEta_2", "", 0, 0.02, 0.98, 0.4);
+  TPad* pad2 = new TPad("dNdEta_2", "", 0, 0.02, 0.98, 0.5);
   pad2->Draw();
 
   pad1->SetRightMargin(0.05);
@@ -366,13 +383,18 @@ void dNdEta(Bool_t onlyESD = kFALSE)
 
   pad1->cd();
 
-  TLegend* legend = new TLegend(0.4, 0.2, 0.65, 0.4);
+  TLegend* legend = new TLegend(0.4, 0.05, 0.65, 0.3);
   legend->SetFillColor(0);
   legend->AddEntry(histESDMBVtx, "triggered, vertex");
   legend->AddEntry(histESDMB, "triggered");
   legend->AddEntry(histESD, "all events");
   legend->AddEntry(histMC, "MC prediction");
 
+  dummy->GetXaxis()->SetLabelSize(0.06);
+  dummy->GetYaxis()->SetLabelSize(0.06);
+  dummy->GetXaxis()->SetTitleSize(0.06);
+  dummy->GetYaxis()->SetTitleSize(0.06);
+  dummy->GetYaxis()->SetTitleOffset(0.7);
   dummy->DrawCopy();
   histESDMBVtx->Draw("SAME");
   histESDMB->Draw("SAME");
@@ -384,10 +406,13 @@ void dNdEta(Bool_t onlyESD = kFALSE)
   pad2->cd();
   pad2->SetBottomMargin(0.15);
 
+  Float_t min = TMath::Min(0.961, ratio->GetMinimum() * 0.95);
+  Float_t max = TMath::Max(1.049, ratio->GetMaximum() * 1.05);
+
   TH1F dummy3("dummy3", ";#eta;Ratio: MC / ESD", 1, -1.5, 1.5);
   dummy3.SetStats(kFALSE);
   dummy3.SetBinContent(1, 1);
-  dummy3.GetYaxis()->SetRangeUser(0.961, 1.049);
+  dummy3.GetYaxis()->SetRangeUser(min, max);
   dummy3.SetLineWidth(2);
   dummy3.GetXaxis()->SetLabelSize(0.06);
   dummy3.GetYaxis()->SetLabelSize(0.06);
index 79637463d5bc0165750da758e282411ac3afa178..1399c7c2087976f6677a923ef0ec0ffceac5c2f0 100644 (file)
@@ -1691,3 +1691,75 @@ void PlotErrors(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t
     
     dNdEtaCorrection->GetTrack2ParticleCorrection()->PlotBinErrors(xmin, xmax, ymin, ymax, zmin, zmax)->Draw();
 }
+
+
+void runStudy(const char* baseCorrectionMapFile = "correction_map.root", const char* baseCorrectionMapFolder = "dndeta_correction", const char* changedCorrectionMapFile = "correction_map.root", const char* changedCorrectionMapFolder = "dndeta_correction", const char* dataFile = "analysis_esd_raw.root", const char* output = "analysis_esd_syst.root")
+{
+  gSystem->Load("libPWG0base");
+
+  TFile* file = TFile::Open(output, "RECREATE");
+
+  const Int_t max = 5;
+  dNdEtaAnalysis* fdNdEtaAnalysis[5];
+
+  new TCanvas;
+  TLegend* legend = new TLegend(0.63, 0.73, 0.98, 0.98);
+  legend->SetFillColor(0);
+
+  for (Int_t i = 0; i < max; ++i)
+  {
+    TFile::Open(baseCorrectionMapFile);
+    AlidNdEtaCorrection* baseCorrection = new AlidNdEtaCorrection(baseCorrectionMapFolder, baseCorrectionMapFolder);
+    baseCorrection->LoadHistograms();
+
+    AlidNdEtaCorrection::CorrectionType correctionType = AlidNdEtaCorrection::kNone;
+    const char* name = 0;
+
+    TFile::Open(changedCorrectionMapFile);
+    switch (i)
+    {
+      case 0 :
+        name = "default";
+        break;
+
+      case 1 :
+        baseCorrection->GetTrack2ParticleCorrection()->LoadHistograms(Form("%s/Track2Particle", changedCorrectionMapFolder));
+        name = "Track2Particle";
+        break;
+
+      case 2 :
+        baseCorrection->GetVertexRecoCorrection()->LoadHistograms(Form("%s/VertexReconstruction", changedCorrectionMapFolder));
+        name = "VertexReco";
+        break;
+
+      case 3 :
+        baseCorrection->GetTriggerBiasCorrectionINEL()->LoadHistograms(Form("%s/TriggerBias_MBToINEL", changedCorrectionMapFolder));
+        name = "TriggerBias_MBToINEL";
+        break;
+
+      case 4 :
+        baseCorrection->LoadHistograms(changedCorrectionMapFolder);
+        name = "all";
+        break;
+
+      default: return;
+    }
+
+    TFile::Open(dataFile);
+    fdNdEtaAnalysis[i] = new dNdEtaAnalysis(name, name);
+    fdNdEtaAnalysis[i]->LoadHistograms("dndeta");
+
+    fdNdEtaAnalysis[i]->Finish(baseCorrection, 0.3, AlidNdEtaCorrection::kINEL);
+    file->cd();
+    fdNdEtaAnalysis[i]->SaveHistograms();
+
+    TH1* hist = fdNdEtaAnalysis[i]->GetdNdEtaHistogram(0);
+    hist->SetLineColor(colors[i]);
+    hist->SetMarkerColor(colors[i]);
+    hist->SetMarkerStyle(markers[i]+1);
+    hist->DrawCopy((i == 0) ? "" : "SAME");
+    legend->AddEntry(hist, name);
+  }
+
+  legend->Draw();
+}
index dd7f938efa6a87d1cfcd372cbb11e9dffe1b7eff..11aba807f734e90659e0c8f6c6e623840aed4555 100644 (file)
@@ -1,3 +1,7 @@
+
+Int_t markers[] = {20,21,22,23,28,29};
+Int_t colors[]  = {1,2,3,4,6,8,102};
+
 void DrawpiKpAndCombinedZOnly(Float_t upperPtLimit=0.99)
 {
   //gROOT->ProcessLine(".L drawPlots.C");
@@ -164,3 +168,231 @@ TPad* DrawCanvasAndPad(const Char_t* name, Int_t sizeX=600, Int_t sizeY=500) {
 
   return p1;
 }
+
+void MisalignmentShowRawTrackPlots()
+{
+  gSystem->Load("libPWG0base");
+  TFile* file = TFile::Open("resC-resC/analysis_esd_raw.root");
+  dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
+  fdNdEtaAnalysis->LoadHistograms("dndeta");
+
+  TFile* file2 = TFile::Open("resC-fullA/analysis_esd_raw.root");
+  dNdEtaAnalysis* fdNdEtaAnalysis2 = new dNdEtaAnalysis("dndeta", "dndeta");
+  fdNdEtaAnalysis2->LoadHistograms("dndeta");
+
+  TH3* track1 = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("track1");
+  TH3* track2 = fdNdEtaAnalysis2->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("track2");
+
+  // normalize to number of events;
+  TH2* event1 = fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram();
+  TH2* event2 = fdNdEtaAnalysis2->GetData()->GetEventCorrection()->GetMeasuredHistogram();
+  Int_t event1Count = event1->Integral();
+  Int_t event2Count = event2->Integral();
+  track1->Scale(1.0 / event1Count);
+  track2->Scale(1.0 / event2Count);
+
+  const Float_t innerLimit = 0.49;
+  const Float_t outerLimit = 0.99;
+
+  track1->GetYaxis()->SetRangeUser(-outerLimit, outerLimit);
+  track2->GetYaxis()->SetRangeUser(-outerLimit, outerLimit);
+  AliPWG0Helper::CreateDividedProjections(track1, track2, "ze1");
+  TH1* fullRange = gROOT->FindObject("track1_ze1_div_track2_ze1");
+
+  track1->GetYaxis()->SetRangeUser(-innerLimit, innerLimit);
+  track2->GetYaxis()->SetRangeUser(-innerLimit, innerLimit);
+  AliPWG0Helper::CreateDividedProjections(track1, track2, "ze2");
+  TH1* central = gROOT->FindObject("track1_ze2_div_track2_ze2");
+  central->SetLineColor(1);
+  central->SetMarkerStyle(21);
+
+  for (Int_t x=1; x<track1->GetXaxis()->GetNbins(); ++x)
+    for (Int_t y=track1->GetYaxis()->FindBin(-innerLimit); y<track1->GetYaxis()->FindBin(innerLimit); ++y)
+      for (Int_t z=1; z<track1->GetZaxis()->GetNbins(); ++z)
+      {
+        track1->SetBinContent(x, y, z, 0);
+        track1->SetBinError(x, y, z, 0);
+        track2->SetBinContent(x, y, z, 0);
+        track2->SetBinError(x, y, z, 0);
+      }
+
+  track1->GetYaxis()->SetRangeUser(-outerLimit, outerLimit);
+  track2->GetYaxis()->SetRangeUser(-outerLimit, outerLimit);
+  AliPWG0Helper::CreateDividedProjections(track1, track2, "ze3");
+  TH1* peripheral = gROOT->FindObject("track1_ze3_div_track2_ze3");
+  peripheral->SetLineColor(2);
+  peripheral->SetMarkerStyle(22);
+  peripheral->SetMarkerColor(2);
+
+  TH2* tmp = new TH2F("tmp", ";p_{T} [GeV/c]      ;#frac{tracks residual misalignment}{tracks full misalignment}", 1, 0.1, 10, 1, 0.9, 1.3);
+
+  tmp->SetStats(kFALSE);
+  //tmp->GetXaxis()->SetNoExponent();
+
+  Float_t ptStart = 0.1;
+
+  fullRange->GetXaxis()->SetRangeUser(ptStart, 9.9);
+  central->GetXaxis()->SetRangeUser(ptStart, 9.9);
+  peripheral->GetXaxis()->SetRangeUser(ptStart, 9.9);
+
+  TCanvas* canvas = new TCanvas("MisalignmentShowRawTrackPlots", "MisalignmentShowRawTrackPlots", 700, 400);
+  gPad->SetLogx();
+  gPad->SetGridx();
+  gPad->SetGridy();
+
+  TLegend* legend = new TLegend(0.2, 0.7, 0.4, 0.8);
+
+  legend->AddEntry(central, "|#eta| < 0.5");
+  legend->AddEntry(peripheral, "0.5 < |#eta| < 1.0");
+
+  legend->SetFillColor(0);
+
+  tmp->Draw();
+  //fullRange->Draw("SAME");
+  central->Draw("SAME");
+  peripheral->Draw("SAME");
+
+  legend->Draw();
+
+  canvas->SaveAs("syst_mis_ntracks.eps");
+}
+
+
+void drawdNdEtaRatios(const char* canvasName, Int_t n, const char** files, const char** dirs, const char** names, Int_t* histID)
+{
+  gSystem->Load("libPWG0base");
+
+  TCanvas* canvas = new TCanvas(canvasName, canvasName, 1000, 500);
+  canvas->Divide(2, 1);
+
+  TLegend* legend = new TLegend(0.63, 0.73, 0.98, 0.98);
+  legend->SetFillColor(0);
+
+  TH1* base = 0;
+
+  for (Int_t i = 0; i < n; ++i)
+  {
+    TFile::Open(files[i]);
+
+    dNdEtaAnalysis* tmp = new dNdEtaAnalysis(dirs[i], dirs[i]);
+    tmp->LoadHistograms();
+
+    TH1* hist = tmp->GetdNdEtaPtCutOffCorrectedHistogram(histID[i]);
+
+    if (i == 0)
+      base = hist;
+
+    legend->AddEntry(hist, names[i]);
+
+    hist->SetMarkerColor(colors[i]);
+    hist->SetMarkerStyle(markers[i]);
+
+    canvas->cd(1);
+    hist->DrawCopy((i == 0) ? "" : "SAME");
+
+    if (i != 0)
+    {
+      canvas->cd(2);
+      hist->Divide(hist, base, 1, 1, "B");
+      hist->GetYaxis()->SetRangeUser(0.98, 1.02);
+      hist->DrawCopy((i == 1) ? "" : "SAME");
+    }
+  }
+
+  legend->Draw();
+
+  canvas->SaveAs(Form("%s.eps", canvas->GetName()));
+}
+
+void drawdNdEtaRatios(const char* canvasName, Int_t n, const char** files1, const char** files2, const char** dirs1, const char** dirs2, const char** names, Int_t* histID)
+{
+  gSystem->Load("libPWG0base");
+
+  TCanvas* canvas = new TCanvas(canvasName, canvasName, 700, 400);
+  canvas->SetLeftMargin(0.12);
+
+  TLegend* legend = new TLegend(0.35, 0.7, 0.65, 0.85);
+  legend->SetFillColor(0);
+
+  for (Int_t i = 0; i < n; ++i)
+  {
+    TFile::Open(files1[i]);
+
+    dNdEtaAnalysis* tmp1 = new dNdEtaAnalysis(dirs1[i], dirs1[i]);
+    tmp1->LoadHistograms();
+
+    TFile::Open(files2[i]);
+
+    dNdEtaAnalysis* tmp2 = new dNdEtaAnalysis(dirs2[i], dirs2[i]);
+    tmp2->LoadHistograms();
+
+    TH1* hist1 = tmp1->GetdNdEtaPtCutOffCorrectedHistogram(histID[i]);
+    TH1* hist2 = tmp2->GetdNdEtaPtCutOffCorrectedHistogram(histID[i]);
+
+    TH1* division = hist1->Clone();
+
+    division->Divide(hist1, hist2, 1, 1, "B");
+
+    division->SetMarkerColor(colors[i]);
+    division->SetMarkerStyle(markers[i]);
+
+    legend->AddEntry(division, names[i]);
+
+    division->SetTitle("");
+    division->GetYaxis()->SetTitle("#frac{dN_{ch}/d#eta using MC vtx}{dN_{ch}/d#eta using ESD vtx}");
+    division->SetStats(kFALSE);
+    division->GetYaxis()->SetTitleOffset(1.3);
+    division->GetXaxis()->SetRangeUser(-0.99, 0.99);
+    division->GetYaxis()->SetRangeUser(0.981, 1.02);
+    division->DrawCopy((i == 0) ? "" : "SAME");
+  }
+
+  gPad->SetGridx();
+  gPad->SetGridy();
+
+  legend->Draw();
+
+  canvas->SaveAs(Form("%s.eps", canvas->GetName()));
+}
+
+void vertexShiftStudy(Int_t histID)
+{
+  const char* files[] = { "maps/idealA/mc-vertex/analysis_esd.root", "results/idealC-idealA/analysis_esd.root", "maps/idealA/mc-vertex-shift-0.05/analysis_esd.root", "maps/idealA/mc-vertex-shift-0.1/analysis_esd.root", "maps/idealA/mc-vertex-shift-dep/analysis_esd.root" };
+  const char* dirs[] = { "dndeta", "dndeta", "dndeta", "dndeta", "dndeta" };
+  const char* names[] = { "mc vtx", "esd vtx", "+ 0.05 cm", "+ 0.1 cm", "old vtx shift" };
+  Int_t hist[] = { histID, histID, histID, histID, histID };
+
+  drawdNdEtaRatios("syst_vertex_shift1", 5, files, dirs, names, hist);
+
+  const char* files1[] = { "maps/idealA/mc-vertex/analysis_esd.root", "maps/idealA/mc-vertex/analysis_esd.root", "maps/idealA/mc-vertex/analysis_esd.root" };
+  const char* files2[] = { "results/idealC-idealA/analysis_esd.root", "results/idealC-idealA/analysis_esd.root", "results/idealC-idealA/analysis_esd.root" };
+  const char* dirs1[] = { "dndeta", "dndeta", "dndeta"};
+  const char* names[] = { "|vtx-z| < 10 cm", "-10 cm < vtx-z < 0 cm", "0 cm < vtx-z < 10 cm" };
+  Int_t hist[] = { 0, 1, 2 };
+
+  drawdNdEtaRatios("syst_vertex_shift2", 3, files1, files2, dirs, dirs, names, hist);
+}
+
+void vertexShift()
+{
+  TFile::Open("vertex.root");
+
+  TH2* hist = gFile->Get("fVertexCorr");
+  TProfile* prof = hist->ProfileX();
+
+  prof->SetStats(kFALSE);
+  prof->SetTitle(";MC vtx-z [cm];mean (ESD vtx-z - MC vtx-z) [cm]");
+  prof->GetYaxis()->SetTitleOffset(1.2);
+
+  prof->SetLineWidth(2);
+
+  TCanvas* canvas = new TCanvas("syst_vertex_shift", "syst_vertex_shift", 700, 400);
+
+  gPad->SetGridx();
+  gPad->SetGridy();
+
+  prof->Draw();
+
+  canvas->SaveAs(Form("%s.eps", canvas->GetName()));
+}
+
diff --git a/PWG0/dNdEta/drawVertexRecEff.C b/PWG0/dNdEta/drawVertexRecEff.C
deleted file mode 100644 (file)
index 0b5ae24..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $Id$ */
-
-// draws the result of AlidNdEtaVertexRecEffSelector
-
-void drawVertexRecEff()
-{
-  TFile* fout = TFile::Open("vertexRecEff.root");
-
-  TH1F* dNGen = dynamic_cast<TH1F*> fout->Get("dNGen");
-  TH1F* dNRec = dynamic_cast<TH1F*> fout->Get("dNRec");
-
-  TH1F* vtxGen = dynamic_cast<TH1F*> fout->Get("VtxGen");
-  TH1F* vtxRec = dynamic_cast<TH1F*> fout->Get("VtxRec");
-
-  // calculate ratios
-  TH1F* dNRatiodN = dynamic_cast<TH1F*> (dNRec->Clone("dNRatiodN"));
-  dNRatiodN->SetTitle("Ratio");
-  dNRatiodN->Divide(dNGen);
-
-  //vtxGen->Rebin(4);
-  //vtxRec->Rebin(4);
-
-  // calculate correction ratio number
-  Float_t sumGen = 0;
-  Float_t sumRec = 0;
-  for (Int_t i=1; i<=dNGen->GetNbinsX(); ++i)
-  {
-    sumGen += dNGen->GetBinCenter(i) * dNGen->GetBinContent(i);
-    sumRec += dNRec->GetBinCenter(i) * dNRec->GetBinContent(i);
-  }
-  Float_t ratio = sumRec / dNRec->Integral(1, dNGen->GetNbinsX()) * dNGen->Integral(1, dNGen->GetNbinsX()) / sumGen;
-
-  cout << "Ratio: " << ratio << endl;
-
-  TH1F* dNRatioVtx = dynamic_cast<TH1F*> (vtxRec->Clone("dNRatioVtx"));
-  dNRatioVtx->SetTitle("Ratio");
-  dNRatioVtx->Divide(vtxGen);
-
-  TCanvas* canvas = new TCanvas("dN", "dN", 1000, 1000);
-  canvas->Divide(2, 2);
-
-  canvas->cd(1);
-  dNGen->Draw();
-  dNRec->SetLineColor(kRed);
-  dNRec->Draw("SAME");
-
-  canvas->cd(2);
-  dNRatiodN->Draw();
-
-  canvas->cd(3);
-  vtxGen->Draw();
-  vtxRec->SetLineColor(kRed);
-  vtxRec->Draw("SAME");
-
-  canvas->cd(4);
-  dNRatioVtx->Draw();
-}
diff --git a/PWG0/dNdEta/makeCorrection.C b/PWG0/dNdEta/makeCorrection.C
deleted file mode 100644 (file)
index f8ea491..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-//
-// Script to make correction maps for dndeta measurements using the
-// dNdEtaCorrection class.
-// 
-
-makeCorrection(Char_t* dataDir, Int_t nRuns=20) {
-
-  Char_t str[256];
-
-  gSystem->Load("../libPWG0base.so");
-
-  // ########################################################
-  // selection of esd tracks
-  AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts();    
-  esdTrackCuts->DefineHistograms(1);
-  
-  esdTrackCuts->SetMinNClustersTPC(50);
-  esdTrackCuts->SetMaxChi2PerClusterTPC(3.5);
-  esdTrackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
-  esdTrackCuts->SetRequireTPCRefit(kTRUE);
-  
-  esdTrackCuts->SetMinNsigmaToVertex(3);
-  esdTrackCuts->SetAcceptKingDaughters(kFALSE);
-
-  AliLog::SetClassDebugLevel("AliESDtrackCuts",1);
-
-  // ########################################################
-  // definition of dNdEta correction object
-
-  AlidNdEtaCorrection* dNdEtaMap = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
-
-  // ########################################################
-  // get the data dir  
-  Char_t execDir[256];
-  sprintf(execDir,gSystem->pwd());
-  TSystemDirectory* baseDir = new TSystemDirectory(".",dataDir);
-  TList* dirList            = baseDir->GetListOfFiles();
-  Int_t nDirs               = dirList->GetEntries();
-  // go back to the dir where this script is executed
-  gSystem->cd(execDir);
-
-  // ########################################################
-  // definition of used pointers
-  TFile* esdFile;
-  TTree* esdTree;
-  TBranch* esdBranch;
-
-  AliESD* esd =0;
-
-  // ########################################################
-  // loop over runs
-  Int_t nRunCounter = 0;
-  for (Int_t r=0; r<nDirs; r++) {
-
-    TSystemFile* presentDir = (TSystemFile*)dirList->At(r);
-    if (!presentDir || !presentDir->IsDirectory())
-      continue;
-    // check that the files are there
-    TString currentDataDir;
-    currentDataDir.Form("%s/%s",dataDir, presentDir->GetName());
-    cout << "Processing directory " << currentDataDir.Data() << endl;
-    if ((!gSystem->Which(currentDataDir,"galice.root")) ||
-          (!gSystem->Which(currentDataDir,"AliESDs.root"))) 
-      continue;
-    
-    if (nRunCounter++ >= nRuns)
-      break;    
-    
-    cout << "run #" << nRunCounter << endl;
-
-    // #########################################################
-    // setup galice and runloader
-    if (gAlice) {
-      delete gAlice->GetRunLoader();
-      delete gAlice;
-      gAlice=0;
-    }
-
-    sprintf(str,"%s/galice.root",currentDataDir.Data());
-    AliRunLoader* runLoader = AliRunLoader::Open(str);
-
-    runLoader->LoadgAlice();
-    gAlice = runLoader->GetAliRun();
-    runLoader->LoadKinematics();
-    runLoader->LoadHeader();
-
-    // #########################################################
-    // open esd file and get the tree
-
-    sprintf(str,"%s/AliESDs.root",currentDataDir.Data());
-    // close it first to avoid memory leak
-    if (esdFile)
-      if (esdFile->IsOpen())
-        esdFile->Close();
-
-    esdFile = TFile::Open(str);
-    esdTree = (TTree*)esdFile->Get("esdTree");
-    if (!esdTree)
-      continue;
-    esdBranch = esdTree->GetBranch("ESD");
-    esdBranch->SetAddress(&esd);
-    if (!esdBranch)
-      continue;
-
-    // ########################################################
-    // Magnetic field
-    AliTracker::SetFieldMap(gAlice->Field(),kTRUE); // kTRUE means uniform magnetic field
-    //AliKalmanTrack::SetConvConst(1000/0.299792458/5.);
-
-    // ########################################################
-    // getting number of events
-    Int_t nEvents = (Int_t)runLoader->GetNumberOfEvents();
-    Int_t nESDEvents = esdBranch->GetEntries();
-
-    Int_t nEventsTriggered = 0;
-    Int_t nEventsAll       = 0;
-    
-    if (nEvents!=nESDEvents) {
-      cout << " Different number of events from runloader and esdtree!!!" << nEvents << " / " << nESDEvents << endl;
-      return;
-    }
-   // ########################################################
-    // loop over number of events
-    cout << " looping over events..." << endl;
-    for(Int_t i=0; i<nEvents; i++) {
-
-      esdBranch->GetEntry(i);
-      runLoader->GetEvent(i);              
-
-      // ########################################################
-      // get the EDS vertex
-      AliESDVertex* vtxESD = esd->GetVertex();
-
-      Double_t vtx[3];
-      Double_t vtx_res[3];
-      vtxESD->GetXYZ(vtx);          
-    
-      vtx_res[0] = vtxESD->GetXRes();
-      vtx_res[1] = vtxESD->GetYRes();
-      vtx_res[2] = vtxESD->GetZRes();
-
-      Bool_t vertexReconstructed = kTRUE;
-
-      // the vertex should be reconstructed
-      if (strcmp(vtxESD->GetName(),"default")==0) 
-       vertexReconstructed = kFALSE;
-
-      // the resolution should be reasonable???
-      if (vtx_res[2]==0 || vtx_res[2]>0.01)
-       vertexReconstructed = kFALSE;
-
-      // ########################################################
-      // get the trigger info
-      
-      Bool_t triggered = kFALSE;
-
-      // MB should be 
-      // ITS_SPD_GFO_L0  : 32
-      // VZERO_OR_LEFT   : 1
-      // VZERO_OR_RIGHT  : 2
-
-      ULong64_t triggerMask = esd->GetTriggerMask();
-
-      nEventsAll++;      
-
-      if (triggerMask&32 && ((triggerMask&1) || (triggerMask&2))) {
-       triggered = kTRUE;       
-       nEventsTriggered++;
-      }
-
-      // ########################################################
-      // get the MC vertex
-      AliGenPythiaEventHeader* genHeader =
-        (AliGenPythiaEventHeader*)runLoader->GetHeader()->GenEventHeader();
-      
-      TArrayF vtxMC(3);
-      genHeader->PrimaryVertex(vtxMC);
-      Double_t vtx[3];
-      vtx[0] = vtxMC[0];
-      vtx[1] = vtxMC[1];
-      vtx[2] = vtxMC[2];
-
-      // ########################################################
-      // loop over mc particles
-      AliStack* particleStack = runLoader->Stack();
-      Int_t nPrim    = particleStack->GetNprimary();
-
-      for (Int_t i_mc=0; i_mc<nPrim; i_mc++) {
-      
-       TParticle* part = particleStack->Particle(i_mc);      
-       if (!part || strcmp(part->GetName(),"XXX")==0) 
-         continue;
-      
-       TParticlePDG* pdgPart = part->GetPDG();
-
-       Bool_t prim = kFALSE;
-       // check if it's a primary particle - is there a better way ???
-       if ((part->GetFirstDaughter() >= nPrim) || (part->GetFirstDaughter()==-1)) {
-         if (TMath::Abs(pdgPart->PdgCode())>10 && pdgPart->PdgCode()!=21 && strcmp(pdgPart->ParticleClass(),"Unknown")!=0)
-           prim = kTRUE;
-       }
-       if (!prim)
-         continue;
-
-       if (pdgPart->Charge()==0)
-         continue;     
-
-       Float_t eta = part->Eta();
-       Float_t pt  = part->Pt();
-
-       if (prim) {
-
-         dNdEtaMap->FillParticleAllEvents(eta, pt);              
-
-         if (triggered)
-           dNdEtaMap->FillParticleWhenEventTriggered(eta, pt);
-         
-         if (vertexReconstructed)
-           dNdEtaMap->FillParticle(vtx[2], eta, 1.);   
-       }
-       
-      }// end of mc particle
-      
-      // ########################################################
-      // loop over esd tracks      
-      Int_t nGoodTracks = 0;
-
-      Int_t nTracks = esd->GetNumberOfTracks();            
-      for (Int_t t=0; t<nTracks; t++) {
-       AliESDtrack* esdTrack = esd->GetTrack(t);      
-       
-       // cut the esd track?
-       if (!esdTrackCuts->AcceptTrack(esdTrack))
-         continue;
-       
-       nGoodTracks++;  
-       
-       Double_t p[3];
-       esdTrack->GetPxPyPz(p);
-       Float_t momentum = TMath::Sqrt(TMath::Power(p[0],2) + TMath::Power(p[1],2) + TMath::Power(p[2],2));
-       
-       Float_t eta = -100.;
-       if((momentum != TMath::Abs(p[2]))&&(momentum != 0))
-         eta = 0.5*TMath::Log((momentum + p[2])/(momentum - p[2]));
-       
-       // using the eta of the mc particle
-       Int_t label = TMath::Abs(esdTrack->GetLabel());
-       if (label<0) {
-         cout << " cannot find corresponding mc part !!! " << label << endl;
-         continue;
-       }
-       TParticle* mcPart = particleStack->Particle(label);     
-       eta = mcPart->Eta();
-       Float_t pt = mcPart->Pt();
-       
-       if (vertexReconstructed)
-         dNdEtaMap->FillParticleWhenMeasuredTrack(vtx[2], eta, pt);    
-       
-      } // end of track loop
-      
-      dNdEtaMap->FillEvent(vtxMC[2], nGoodTracks);
-      
-      if (vertexReconstructed)
-       dNdEtaMap->FillEventWithReconstructedVertex(vtxMC[2], nGoodTracks);
-
-    } // end  of event loop
-  } // end of run loop
-  
-  dNdEtaMap->Finish(nEventsAll, nEventsTriggered);  
-
-  TFile* fout = new TFile("correction_map.root","RECREATE");
-  
-  esdTrackCuts->SaveHistograms("esd_track_cuts");
-  dNdEtaMap->SaveHistograms();
-  
-  fout->Write();
-  fout->Close();
-  
-  dNdEtaMap->DrawHistograms();
-
-}
diff --git a/PWG0/dNdEta/runSystematicStudies.sh b/PWG0/dNdEta/runSystematicStudies.sh
deleted file mode 100755 (executable)
index aaf56f9..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-# /* $Id$ */
-
-# This script runs the dN/dEta analysis with different correction maps to gather systematics
-
-function run
-{
-  root -l -q testAnalysis2.C\(\"analysisInputMerged.txt\",10000,0,kFALSE,kFALSE,kTRUE,\"$1\",\"$2\"\)
-  mv analysis_esd.root $3
-
-  if [ "$?" -ne "0" ]
-  then
-    echo "$3 failed"
-    exit
-  fi
-
-  sleep 5
-}
-
-function particleComposition
-{
-  ## this runs particle composition study
-  # It runs with the "normal map", and with 4 other different cases where particle species are enhanced
-  # or reduced.
-  # The normal map is expected in correction_map.root, created by AlidNdEtaCorrectionSelector
-  # The others in new_compositions.root in the folders (K|p)(Boosted|Reduced), created
-  #   by AlidNdEtaSystematicsSelector and Composition() out of drawSystematics.C
-
-  run correction_map.root dndeta_correction systematics_dndeta_reference.root
-  run new_compositions.root KBoosted systematics_dndeta_KBoosted.root
-  run new_compositions.root KReduced systematics_dndeta_KReduced.root
-  run new_compositions.root pBoosted systematics_dndeta_pBoosted.root
-  run new_compositions.root pReduced systematics_dndeta_pReduced.root
-}
-
-function vertexRecoStudy
-{
-  ## this runs vertex reco study
-
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vertexreco_pythia systematics_vtxreco_pythia.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vertexreco_ddmore systematics_vtxreco_ddmore.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vertexreco_ddless systematics_vtxreco_ddless.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vertexreco_sdmore systematics_vtxreco_sdmore.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vertexreco_sdless systematics_vtxreco_sdless.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vertexreco_dmore systematics_vtxreco_dmore.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vertexreco_dless systematics_vtxreco_dless.root
-}
-
-function triggerBiasStudy
-{
-  ## this runs trigger bias study
-
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_trigger_pythia systematics_trigger_pythia.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_trigger_ddmore systematics_trigger_ddmore.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_trigger_ddless systematics_trigger_ddless.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_trigger_sdmore systematics_trigger_sdmore.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_trigger_sdless systematics_trigger_sdless.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_trigger_dmore systematics_trigger_dmore.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_trigger_dless systematics_trigger_dless.root
-}
-
-function vertexRecoTriggerBiasStudy
-{
-  ## this runs trigger bias and vertex reco study
-
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vtxtrigger_pythia systematics_vtxtrigger_pythia.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vtxtrigger_ddmore systematics_vtxtrigger_ddmore.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vtxtrigger_ddless systematics_vtxtrigger_ddless.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vtxtrigger_sdmore systematics_vtxtrigger_sdmore.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vtxtrigger_sdless systematics_vtxtrigger_sdless.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vtxtrigger_dmore systematics_vtxtrigger_dmore.root
-  run systematics_vtxtrigger_compositions.root dndeta_correction_syst_vtxtrigger_dless systematics_vtxtrigger_dless.root
-}
-
-function misalignmentStudy
-{
-  ## runs same analysis with correction build from aligned and misaligned detector
-
-  #run correction_map_aligned.root dndeta_correction systematics_misalignment_aligned.root
-  #run correction_map_misaligned.root dndeta_correction systematics_misalignment_misaligned.root
-  run correction_map_misaligned_single.root dndeta_correction_alignment_track2particle systematics_misalignment_track2particle.root
-  run correction_map_misaligned_single.root dndeta_correction_alignment_vertex systematics_misalignment_vertex.root
-  run correction_map_misaligned_single.root dndeta_correction_alignment_trigger systematics_misalignment_trigger.root
-}
-
-rm analysis_esd.root
-
-#particleComposition
-#vertexRecoStudy
-#triggerBiasStudy
-#vertexRecoTriggerBiasStudy
-misalignmentStudy
diff --git a/PWG0/dNdEta/runVertexRecEff.C b/PWG0/dNdEta/runVertexRecEff.C
deleted file mode 100644 (file)
index 3374e3f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $Id$ */
-
-//
-// Script to test the class AlidNdEtaVertexRecEffSelector that creates
-// a vertex reconstruction efficiency plot
-//
-// implementation with TSelector
-//
-
-#include "../CreateESDChain.C"
-
-runVertexRecEff(Char_t* dataDir, Int_t nRuns=20, Int_t offset=0)
-{
-  gSystem->Load("libPWG0base");
-  gSystem->Load("libPWG0dep");
-
-  TChain* chain = CreateESDChain(dataDir, nRuns, offset);
-
-  TString selectorName = "AlidNdEtaVertexRecEffSelector";
-
-  AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
-
-  TStopwatch timer;
-  timer.Start();
-
-  chain->Process(selectorName + ".cxx+");
-
-  timer.Stop();
-  timer.Print();
-}
diff --git a/PWG0/dNdEta/runVertexSelector.C b/PWG0/dNdEta/runVertexSelector.C
new file mode 100644 (file)
index 0000000..1db53d6
--- /dev/null
@@ -0,0 +1,40 @@
+/* $Id$ */
+
+//
+// script to run the AliVertexSelector
+//
+
+#include "../CreateESDChain.C"
+#include "../PWG0Helper.C"
+
+void runVertexSelector(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aProof = kFALSE)
+{
+  if (aProof)
+    connectProof("jgrosseo@lxb6046");
+
+  TString libraries("libEG;libGeom;libESD;libPWG0base");
+  TString packages("PWG0base");
+
+  //libraries += ";libVMC;libMinuit;libSTEER;libPWG0dep;libEVGEN;libFASTSIM;libmicrocern;libpdf;libpythia6;libEGPythia6;libAliPythia6";
+
+  if (!prepareQuery(libraries, packages, 1))
+    return;
+
+  TChain* chain = CreateESDChain(data, nRuns, offset);
+
+  TList inputList;
+
+  gROOT->ProcessLine(".L CreateCuts.C");
+
+  AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
+  if (!esdTrackCuts)
+  {
+    printf("ERROR: esdTrackCuts could not be created\n");
+    return;
+  }
+
+  inputList.Add(esdTrackCuts);
+
+  executeQuery(chain, &inputList, "AliVertexSelector.cxx+");
+}
+
diff --git a/PWG0/dNdEta/testAnalysis.C b/PWG0/dNdEta/testAnalysis.C
deleted file mode 100644 (file)
index fcb266f..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-//
-// Script to test the dN/dEta analysis using the dNdEtaAnalysis and
-// dNdEtaCorrection classes. Note that there is a cut on the events,
-// so the measurement will be biassed.
-//
-
-testAnalysis(Char_t* dataDir, Int_t nRuns=20) {
-
-  Char_t str[256];
-
-  gSystem->Load("../esdTrackCuts/libESDtrackQuality.so");
-  gSystem->Load("libdNdEta.so");
-
-  // ########################################################
-  // selection of esd tracks
-  ESDtrackQualityCuts* esdTrackCuts = new ESDtrackQualityCuts();    
-  esdTrackCuts->DefineHistograms(1);
-  
-  esdTrackCuts->SetMinNClustersTPC(50);
-  esdTrackCuts->SetMaxChi2PerClusterTPC(3.5);
-  esdTrackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
-  esdTrackCuts->SetRequireTPCRefit(kTRUE);
-  
-  esdTrackCuts->SetMinNsigmaToVertex(3);
-  esdTrackCuts->SetAcceptKingDaughters(kFALSE);
-
-  AliLog::SetClassDebugLevel("ESDtrackQualityCuts",1);
-
-  // ########################################################
-  // definition of dNdEta objects
-
-  dNdEtaCorrection* dNdEtaMap = new dNdEtaCorrection();
-
-  dNdEtaMap->LoadHistograms("correction_map.root","dndeta_correction");
-  dNdEtaMap->RemoveEdges(2,0,2);
-
-  dNdEtaAnalysis* analyse = new dNdEtaAnalysis("dndeta");
-
-  // ########################################################
-  // get the data dir  
-  Char_t execDir[256];
-  sprintf(execDir,gSystem->pwd());
-  TSystemDirectory* baseDir = new TSystemDirectory(".",dataDir);
-  TList* dirList            = baseDir->GetListOfFiles();
-  Int_t nDirs               = dirList->GetEntries();
-  // go back to the dir where this script is executed
-  gSystem->cd(execDir);
-
-
-  // ########################################################
-  // definition of used pointers
-  TFile* esdFile;
-  TTree* esdTree;
-  TBranch* esdBranch;
-
-  AliESD* esd =0;
-
-  // ########################################################
-  // loop over runs
-  Int_t nRunCounter = 0;
-  for (Int_t r=1; r<=nDirs; r++) {
-
-    TSystemFile* presentDir = (TSystemFile*)dirList->At(r);
-    if (!presentDir->IsDirectory())
-      continue;
-    // check that the files are there
-    TString currentDataDir;
-    currentDataDir.Form("%s/%s",dataDir, presentDir->GetName());
-    if ((!gSystem->Which(currentDataDir.Data(),"galice.root")) ||
-        (!gSystem->Which(currentDataDir.Data(),"AliESDs.root")))
-      continue;
-    
-    if (nRunCounter++ >= nRuns)
-      break;    
-    
-    cout << "run #" << nRunCounter << endl;
-    
-    // #########################################################
-    // setup galice and runloader
-    if (gAlice) {
-      delete gAlice->GetRunLoader();
-      delete gAlice;
-      gAlice=0;
-    }
-
-    sprintf(str,"%s/galice.root",currentDataDir.Data());
-    AliRunLoader* runLoader = AliRunLoader::Open(str);
-
-    runLoader->LoadgAlice();
-    gAlice = runLoader->GetAliRun();
-    runLoader->LoadKinematics();
-    runLoader->LoadHeader();
-
-    // #########################################################
-    // open esd file and get the tree
-
-    sprintf(str,"%s/AliESDs.root",currentDataDir.Data());
-    // close it first to avoid memory leak
-    if (esdFile)
-      if (esdFile->IsOpen())
-        esdFile->Close();
-
-    esdFile = TFile::Open(str);
-    esdTree = (TTree*)esdFile->Get("esdTree");
-    if (!esdTree)
-      continue;
-    esdBranch = esdTree->GetBranch("ESD");
-    esdBranch->SetAddress(&esd);
-    if (!esdBranch)
-      continue;
-
-    // ########################################################
-    // Magnetic field
-    AliTracker::SetFieldMap(gAlice->Field(),kTRUE); // kTRUE means uniform magnetic field
-    //AliKalmanTrack::SetConvConst(1000/0.299792458/5.);
-
-    // ########################################################
-    // getting number of events
-    Int_t nEvents = (Int_t)runLoader->GetNumberOfEvents();
-    Int_t nESDEvents = esdBranch->GetEntries();
-    
-    if (nEvents!=nESDEvents) {
-      cout << " Different number of events from runloader and esdtree!!!" << nEvents << " / " << nESDEvents << endl;
-      return;
-    }
-    // ########################################################
-    // loop over number of events
-    cout << " looping over events..." << endl;
-    for(Int_t i=1; i<nEvents; i++) {
-
-      esdBranch->GetEntry(i);
-      runLoader->GetEvent(i);            
-  
-
-      // ########################################################
-      // get the EDS vertex
-      AliESDVertex* vtxESD = esd->GetVertex();
-
-      Double_t vtx[3];
-      Double_t vtx_res[3];
-      vtxESD->GetXYZ(vtx);          
-    
-      vtx_res[0] = vtxESD->GetXRes();
-      vtx_res[1] = vtxESD->GetYRes();
-      vtx_res[2] = vtxESD->GetZRes();
-
-      // we need a good vertex 
-      //  => there will be a bias on the measurement, since this cuts away some events
-      if (strcmp(vtxESD->GetName(),"default")==0) 
-       continue;
-      if (vtx_res[2]==0 || vtx_res[2]>0.1)
-       continue;
-
-      // ########################################################
-      // loop over esd tracks      
-      Int_t nTracks = esd->GetNumberOfTracks();            
-      for (Int_t t=0; t<nTracks; t++) {
-       AliESDtrack* esdTrack = esd->GetTrack(t);      
-       
-       if (!esdTrackCuts->AcceptTrack(esdTrack))
-         continue;
-       
-       AliTPCtrack* tpcTrack = new AliTPCtrack(*esdTrack);
-       
-       if (tpcTrack->GetAlpha()==0) {
-         cout << " Warning esd track alpha = 0" << endl;
-         continue;
-       }
-
-       Float_t theta = tpcTrack->Theta();
-       Float_t eta   = -TMath::Log(TMath::Tan(theta/2.));
-       Float_t correction = dNdEtaMap->GetCorrection(vtx[2], eta);
-       
-       dNdEtaMap->FillMeas(vtx[2], eta);
-
-       analyse   ->FillTrack(vtx[2], eta, correction);
-       
-      } // end of track loop
-      analyse->FillEvent(vtx[2]);
-
-    } // end  of event loop
-  } // end of run loop
-
-  analyse->Finish();
-
-  TFile* fout = new TFile("out.root","RECREATE");
-  
-  esdTrackCuts->SaveHistograms("esd_tracks_cuts");
-  dNdEtaMap->SaveHistograms();
-  analyse   ->SaveHistograms();
-  
-  fout->Write();
-  fout->Close();
-
-}
index 5eb13c7d9db891cb31f4ae443ab5f8b0b1a6f19a..b2d03a24edb8a4b6d5e59e123a12fe975fdbc9b2 100644 (file)
@@ -34,19 +34,16 @@ void testAnalysis2(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aMC = kF
 
   TList inputList;
 
-  if (aMC == kFALSE)
+  // selection of esd tracks
+  AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
+  if (!esdTrackCuts)
   {
-    // selection of esd tracks
-    AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
-    if (!esdTrackCuts)
-    {
-      printf("ERROR: esdTrackCuts could not be created\n");
-      return;
-    }
-
-    inputList.Add(esdTrackCuts);
+    printf("ERROR: esdTrackCuts could not be created\n");
+    return;
   }
 
+  inputList.Add(esdTrackCuts);
+
   TString selectorName = ((aMC == kFALSE) ? "AlidNdEtaAnalysisESDSelector" : "AlidNdEtaAnalysisMCSelector");
   AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
 
@@ -116,6 +113,14 @@ void FinishAnalysisAll(const char* dataInput = "analysis_esd_raw.root", const ch
   fdNdEtaAnalysis->DrawHistograms(kTRUE);
   file2->cd();
   fdNdEtaAnalysis->SaveHistograms();
+
+  file->cd();
+  fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTracks", "dndetaTracks");
+  fdNdEtaAnalysis->LoadHistograms("dndeta");
+  fdNdEtaAnalysis->Finish(0, 0.3, AlidNdEtaCorrection::kNone);
+  fdNdEtaAnalysis->DrawHistograms(kTRUE);
+  file2->cd();
+  fdNdEtaAnalysis->SaveHistograms();
 }
 
 void FinishAnalysis(const char* analysisFile = "analysis_esd.root", const char* analysisDir = "dndeta", const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction", Bool_t useUncorrected = kFALSE, Bool_t simple = kFALSE)