more plots
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Jun 2006 10:23:59 +0000 (10:23 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Jun 2006 10:23:59 +0000 (10:23 +0000)
bugfix while saving histograms

PWG0/AliCorrectionMatrix3D.cxx
PWG0/AliPWG0Helper.cxx
PWG0/AliPWG0Helper.h
PWG0/dNdEta/AlidNdEtaCorrection.cxx
PWG0/dNdEta/drawPlots.C

index f69ea50..f40c4a3 100644 (file)
@@ -148,9 +148,6 @@ void AliCorrectionMatrix3D::SaveHistograms()
 
   AliCorrectionMatrix::SaveHistograms();
 
-  //AliPWG0Helper::CreateProjections(GetMeasuredHistogram());
-  //AliPWG0Helper::CreateProjections(GetGeneratedHistogram());
-
-  if (GetCorrectionHistogram())
-    AliPWG0Helper::CreateDividedProjections(GetMeasuredHistogram(), GetGeneratedHistogram());
+  if (GetGeneratedHistogram() && GetMeasuredHistogram())
+    AliPWG0Helper::CreateDividedProjections(GetGeneratedHistogram(), GetMeasuredHistogram());
 }
index 8f488a0..9d02715 100644 (file)
@@ -137,14 +137,28 @@ void AliPWG0Helper::CreateDividedProjections(TH3F* hist, TH3F* hist2, const char
   }
 
   TH1* proj = hist->Project3D(axis);
-  proj->SetXTitle(hist->GetXaxis()->GetTitle());
-  proj->SetYTitle(hist->GetYaxis()->GetTitle());
+  proj->SetXTitle(GetAxisTitle(hist, axis[0]));
+  proj->SetYTitle(GetAxisTitle(hist, axis[1]));
 
   TH1* proj2 = hist2->Project3D(axis);
-  proj2->SetXTitle(hist2->GetXaxis()->GetTitle());
-  proj2->SetYTitle(hist2->GetYaxis()->GetTitle());
+  proj2->SetXTitle(GetAxisTitle(hist2, axis[0]));
+  proj2->SetYTitle(GetAxisTitle(hist2, axis[1]));
 
   TH1* division = dynamic_cast<TH1*> (proj->Clone(Form("%s_div_%s", proj->GetName(), proj2->GetName())));
   division->Divide(proj2);
 }
 
+//____________________________________________________________________
+const char* AliPWG0Helper::GetAxisTitle(TH3F* hist, const char axis)
+{
+  // returns the title of the axis given in axis (x, y, z)
+
+  if (axis == 'x')
+    return hist->GetXaxis()->GetTitle();
+  else if (axis == 'y')
+    return hist->GetYaxis()->GetTitle();
+  else if (axis == 'z')
+    return hist->GetZaxis()->GetTitle();
+
+  return 0;
+}
index 8b45163..d558db7 100644 (file)
@@ -20,7 +20,8 @@ class AliPWG0Helper : public TObject
 
     static void CreateProjections(TH3F* hist);
     static void CreateDividedProjections(TH3F* hist, TH3F* hist2, const char* axis = 0);
-
+    static const char* GetAxisTitle(TH3F* hist, const char axis);
+    
   protected:
     ClassDef(AliPWG0Helper, 0)
 };
index 545ca2b..10ede25 100644 (file)
@@ -31,9 +31,9 @@ AlidNdEtaCorrection::AlidNdEtaCorrection(Char_t* name)
 
   fTriggerBiasCorrection       = new AliCorrectionMatrix2D("triggerBias",   "triggerBias",120,-6,6,100, 0, 10);
 
-  fTrack2ParticleCorrection ->SetAxisTitles("vtx z [cm]", "#eta", "p_{T}");
-  fVertexRecoCorrection        ->SetAxisTitles("vtx z [cm]", "n particles/tracks/tracklets?");
-  fTriggerCorrection        ->SetAxisTitles("vtx z [cm]", "n particles/tracks/tracklets?");
+  fTrack2ParticleCorrection ->SetAxisTitles("vtx z [cm]", "#eta", "p_{T} [GeV/c]");
+  fVertexRecoCorrection        ->SetAxisTitles("vtx z [cm]", "Ntracks");
+  fTriggerCorrection        ->SetAxisTitles("vtx z [cm]", "Ntracks");
 
   fTriggerBiasCorrection       ->SetAxisTitles("#eta", "p_{T} [GeV/c]");
 }
@@ -191,7 +191,7 @@ Float_t AlidNdEtaCorrection::GetMeasuredFraction(Float_t ptCutOff, Float_t eta,
   Int_t vertexBegin = generated->GetXaxis()->FindBin(-10);
   Int_t vertexEnd = generated->GetXaxis()->FindBin(10);
 
-  TH1D* ptProj = dynamic_cast<TH1D*> (generated->ProjectionZ(Form("%s_pt", GetName()), vertexBegin, vertexEnd, etaBegin, etaEnd));
+  TH1D* ptProj = dynamic_cast<TH1D*> (generated->ProjectionZ(Form("%s_pt", generated->GetName()), vertexBegin, vertexEnd, etaBegin, etaEnd));
   ptProj->GetXaxis()->SetTitle(generated->GetZaxis()->GetTitle());
 
   Int_t ptBin = ptProj->FindBin(ptCutOff);
@@ -208,6 +208,8 @@ Float_t AlidNdEtaCorrection::GetMeasuredFraction(Float_t ptCutOff, Float_t eta,
     new TCanvas;
     ptProj->Draw();
   }
+  else
+    delete ptProj;
 
   return fraction;
 }
index 2065574..6495e98 100644 (file)
@@ -1,23 +1,94 @@
 /* $Id$ */
 
 void drawPlots()
-//void Track2Particle2D()
+{
+}
+
+void ptCutoff()
+{
+  gSystem->Load("libPWG0base");
+
+  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection();
+  dNdEtaCorrection->LoadHistograms("correction_map.root","dndeta_correction");
+
+  dNdEtaCorrection->GetMeasuredFraction(0.3, -1, kTRUE);
+
+  TH1* hist = dynamic_cast<TH1*> (gROOT->FindObject("gene_nTrackToNPart_pt"));
+
+  hist->GetXaxis()->SetRangeUser(0, 0.9999);
+  hist->SetMinimum(0);
+  hist->SetStats(kFALSE);
+
+  hist->SetTitle("Generated Particles");
+
+  TCanvas* canvas = new TCanvas("ptCutoff", "ptCutoff", 500, 500);
+  hist->Draw();
+
+  TLine* line = new TLine(0.3, 0 - hist->GetMaximum() * 0.05, 0.3, hist->GetMaximum() * 1.1);
+  line->SetLineWidth(3);
+  line->Draw();
+
+  canvas->SaveAs("ptCutoff.gif");
+}
+
+void TriggerBias()
+{
+  TFile* file = TFile::Open("correction_map.root");
+
+  TH2* corr = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_trigger"));
+
+  Prepare2DPlot(corr);
+  corr->SetTitle("Trigger bias correction");
+
+  TCanvas* canvas = new TCanvas("TriggerBias", "TriggerBias", 500, 500);
+  InitPadCOLZ();
+  corr->DrawCopy("COLZ");
+
+  canvas->SaveAs("TriggerBias.gif");
+
+  corr->GetYaxis()->SetRangeUser(0, 5);
+
+  canvas = new TCanvas("TriggerBiasZoom", "TriggerBiasZoom", 500, 500);
+  InitPadCOLZ();
+  corr->DrawCopy("COLZ");
+
+  canvas->SaveAs("TriggerBiasZoom.gif");
+}
+
+void VtxRecon()
+{
+  TFile* file = TFile::Open("correction_map.root");
+
+  TH2* corr = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_vtxReco"));
+
+  Prepare2DPlot(corr);
+  corr->SetTitle("Vertex reconstruction correction");
+
+  TCanvas* canvas = new TCanvas("VtxRecon", "VtxRecon", 500, 500);
+  InitPadCOLZ();
+  corr->Draw("COLZ");
+
+  canvas->SaveAs("VtxRecon.gif");
+}
+
+void Track2Particle2D()
 {
   TFile* file = TFile::Open("correction_map.root");
 
-  TH2* corrYX = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_nTrackToNPart_yx"));
-  TH2* corrZX = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_nTrackToNPart_zx"));
-  TH2* corrZY = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_nTrackToNPart_zy"));
+  TH2* corrYX = dynamic_cast<TH2*> (file->Get("dndeta_correction/meas_nTrackToNPart_yx_div_gene_nTrackToNPart_yx"));
+  TH2* corrZX = dynamic_cast<TH2*> (file->Get("dndeta_correction/meas_nTrackToNPart_zx_div_gene_nTrackToNPart_zx"));
+  TH2* corrZY = dynamic_cast<TH2*> (file->Get("dndeta_correction/meas_nTrackToNPart_zy_div_gene_nTrackToNPart_zy"));
 
   Prepare2DPlot(corrYX);
   Prepare2DPlot(corrZX);
   Prepare2DPlot(corrZY);
 
-  SetRanges(corrYX);
-  SetRanges(corrZX);
-  SetRanges(corrZY);
+  const char* title = "Track2Particle Correction";
+  corrYX->SetTitle(title);
+  corrZX->SetTitle(title);
+  corrZY->SetTitle(title);
 
-  TCanvas* canvas = new TCanvas("Track2Particle2D", "Track2Particle2D", 1200, 400);
+  TCanvas* canvas = new TCanvas("Track2Particle2D", "Track2Particle2D", 1500, 500);
   canvas->Divide(3, 1);
 
   canvas->cd(1);
@@ -31,6 +102,8 @@ void drawPlots()
   canvas->cd(3);
   InitPadCOLZ();
   corrZY->Draw("COLZ");
+
+  canvas->SaveAs("Track2Particle2D.gif");
 }
 
 void Track2Particle3D()
@@ -51,7 +124,7 @@ void Track2Particle3D()
   Prepare3DPlot(meas);
   Prepare3DPlot(corr);
 
-  TCanvas* canvas = new TCanvas("Track2Particle3D", "Track2Particle3D", 1200, 400);
+  TCanvas* canvas = new TCanvas("Track2Particle3D", "Track2Particle3D", 1500, 500);
   canvas->Divide(3, 1);
 
   canvas->cd(1);
@@ -76,10 +149,12 @@ void SetRanges(TAxis* axis)
 {
   if (strcmp(axis->GetTitle(), "#eta") == 0)
     axis->SetRangeUser(-0.8, 0.79999);
-  if (strcmp(axis->GetTitle(), "p_{T}") == 0)
+  if (strcmp(axis->GetTitle(), "p_{T} [GeV/c]") == 0)
     axis->SetRangeUser(0, 9.9999);
   if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0)
     axis->SetRangeUser(-10, 9.9999);
+  if (strcmp(axis->GetTitle(), "Ntracks") == 0)
+    axis->SetRangeUser(0, 99.9999);
 }
 
 void Prepare3DPlot(TH3* hist)
@@ -92,6 +167,12 @@ void Prepare3DPlot(TH3* hist)
 void Prepare2DPlot(TH2* hist)
 {
   hist->SetStats(kFALSE);
+  hist->GetYaxis()->SetTitleOffset(1.4);
+
+  hist->SetMinimum(0);
+  hist->SetMaximum(10);
+
+  SetRanges(hist);
 }
 
 void InitPad()