]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Scripts to draw corrections
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 30 Jan 2011 00:12:28 +0000 (00:12 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 30 Jan 2011 00:12:28 +0000 (00:12 +0000)
PWG2/FORWARD/analysis2/scripts/DrawCorrAcc.C [new file with mode: 0644]
PWG2/FORWARD/analysis2/scripts/DrawCorrELoss.C
PWG2/FORWARD/analysis2/scripts/DrawCorrSecMap.C [new file with mode: 0644]
PWG2/FORWARD/analysis2/scripts/DrawCorrVtxBias.C [new file with mode: 0644]

diff --git a/PWG2/FORWARD/analysis2/scripts/DrawCorrAcc.C b/PWG2/FORWARD/analysis2/scripts/DrawCorrAcc.C
new file mode 100644 (file)
index 0000000..c9f3ee4
--- /dev/null
@@ -0,0 +1,144 @@
+/**
+ * @file 
+ * 
+ * Scripts to draw energy loss fits from correction object file 
+ *
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+/** 
+ * Clear canvas 
+ * 
+ * @param c Canvas to clear 
+ *
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+void
+ClearCanvas(TCanvas* c)
+{
+  c->SetLeftMargin(.1);
+  c->SetRightMargin(.05);
+  c->SetBottomMargin(.1);
+  c->SetTopMargin(.05);
+  c->Clear();
+}
+
+/** 
+ * Draw energy loss fits to a multi-page PDF. 
+ *
+ * @par Input: 
+ * The input file is expected to contain a AliFMDCorrELossFit object
+ * named @i elossfits in the top level directory.
+ * 
+ * @para Output: 
+ * A multi-page PDF.  Note, that the PDF generated by ROOT in this way
+ * is broken (cannot be read by Acrobat Reader on Windows and MacOSX)
+ * and one should pass it through a filter to correct these problems.
+ * 
+ * @param fname   File name 
+ * @param option  Drawing options 
+ *
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+void
+DrawCorrAcc(const char* fname, const char* option="colz")
+{
+  //__________________________________________________________________
+  // Load libraries and object 
+  gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
+
+  TFile* file = TFile::Open(fname, "READ");
+  if (!file) { 
+    Error("DrawCorrAcc", "Failed to open %s", fname);
+    return;
+  }
+  TString pname(fname);
+  pname.ReplaceAll(".root", ".pdf");
+
+  const char* objName = 
+    AliForwardCorrectionManager::Instance()
+    .GetObjectName(AliForwardCorrectionManager::kAcceptance);
+  AliFMDCorrAcceptance* corr = 
+    static_cast<AliFMDCorrAcceptance*>(file->Get(objName));
+  if (!corr) { 
+    Error("DrawCorrAcc", "Object '%s' not found in %s", objName, fname);
+    return;
+  }
+
+  //__________________________________________________________________
+  // Create a canvas
+  TCanvas* c = new TCanvas("c", "c", 800 / TMath::Sqrt(2), 800);
+  c->SetFillColor(0);
+  c->SetBorderSize(0);
+  c->SetBorderMode(0);
+  c->Print(Form("%s[", pname.Data()));
+  
+  gStyle->SetOptStat(0);
+  gStyle->SetTitleColor(0);
+  gStyle->SetTitleStyle(0);
+  gStyle->SetTitleBorderSize(0);
+  gStyle->SetTitleX(.1);
+  gStyle->SetTitleY(1);
+  gStyle->SetTitleW(.8);
+  gStyle->SetTitleH(.09);
+  gStyle->SetFrameFillColor(kWhite);
+  gStyle->SetFrameBorderSize(1);
+  gStyle->SetFrameBorderMode(1);
+  gStyle->SetPalette(1);
+
+  ClearCanvas(c);
+  //__________________________________________________________________
+  // Create a title page 
+  TLatex* ll = new TLatex(.5,.8, fname);
+  ll->SetTextAlign(22);
+  ll->SetTextSize(0.03);
+  ll->SetNDC();
+  ll->Draw();
+
+  TLatex* l = new TLatex(.5,.8, fname);
+  l->SetNDC();
+  l->SetTextSize(0.03);
+  l->SetTextFont(132);
+  l->SetTextAlign(12);
+  l->DrawLatex(0.2, 0.70, "Acceptance due to dead channels");
+  l->SetTextAlign(22);
+  l->DrawLatex(0.5, 0.60, "c_{v,r}(#eta,#phi)=#frac{"
+              "#sum active strips#in(#eta,#phi)}{"
+              "#sum strips#in(#eta,#phi)}");
+  
+  c->Print(pname.Data(), "Title:Title page");
+
+  ClearCanvas(c);
+
+  //__________________________________________________________________
+  // Draw all corrections
+  const TAxis& vtxAxis = corr->GetVertexAxis();
+  Int_t        nVtx    = vtxAxis.GetNbins();
+  for (UShort_t d = 1; d <= 3; d++) {
+    UShort_t     nQ = (d == 1 ? 1 : 2);
+    for (UShort_t q = 0; q < nQ; q++) { 
+      Char_t r = (q == 0 ? 'I' : 'O');
+
+      ClearCanvas(c);
+      c->Divide(2, (nVtx+1)/2);
+      for (UShort_t v=1; v <= nVtx; v++) { 
+       TVirtualPad* p = c->cd(v);
+      
+      
+       TH2* h1 = corr->GetCorrection(d, r, v);
+       if (!h1) { 
+         Warning("DrawCorrAcc", "No correction for r=%c, v=%d", r, v);
+         continue;
+       }
+       h1->Draw(option);
+      }
+      c->Print(pname.Data(), Form("Title:FMD%d%c", d, r));
+    }
+  }
+
+  //__________________________________________________________________
+  // Close output file 
+  c->Print(Form("%s]", pname.Data()));
+}
+//
+// EOF
+//
index f86bee1ca7cdfd8aecf865c71f12928234118ebc..1470ccf2c9d1f09848d44541d72d69b9952a05f5 100644 (file)
@@ -48,7 +48,7 @@ DrawCorrELoss(const char* fname, const char* option="err")
 
   TFile* file = TFile::Open(fname, "READ");
   if (!file) { 
-    Error("DrawELossFits", "Failed to open %s", fname);
+    Error("DrawCorrELoss", "Failed to open %s", fname);
     return;
   }
   TString pname(fname);
@@ -57,7 +57,7 @@ DrawCorrELoss(const char* fname, const char* option="err")
   AliFMDCorrELossFit* fits = 
     static_cast<AliFMDCorrELossFit*>(file->Get("elossfits"));
   if (!fits) { 
-    Error("DrawELossFits", "Object 'elossfits' not found in %s", fname);
+    Error("DrawCorrELoss", "Object 'elossfits' not found in %s", fname);
     return;
   }
 
diff --git a/PWG2/FORWARD/analysis2/scripts/DrawCorrSecMap.C b/PWG2/FORWARD/analysis2/scripts/DrawCorrSecMap.C
new file mode 100644 (file)
index 0000000..70c0749
--- /dev/null
@@ -0,0 +1,151 @@
+/**
+ * @file 
+ * 
+ * Scripts to draw energy loss fits from correction object file 
+ *
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+/** 
+ * Clear canvas 
+ * 
+ * @param c Canvas to clear 
+ *
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+void
+ClearCanvas(TCanvas* c)
+{
+  c->SetLeftMargin(.1);
+  c->SetRightMargin(.05);
+  c->SetBottomMargin(.1);
+  c->SetTopMargin(.05);
+  c->Clear();
+}
+
+/** 
+ * Draw energy loss fits to a multi-page PDF. 
+ *
+ * @par Input: 
+ * The input file is expected to contain a AliFMDCorrELossFit object
+ * named @i elossfits in the top level directory.
+ * 
+ * @para Output: 
+ * A multi-page PDF.  Note, that the PDF generated by ROOT in this way
+ * is broken (cannot be read by Acrobat Reader on Windows and MacOSX)
+ * and one should pass it through a filter to correct these problems.
+ * 
+ * @param fname   File name 
+ * @param option  Drawing options 
+ *
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+void
+DrawCorrSecMap(const char* fname, const char* option="colz")
+{
+  //__________________________________________________________________
+  // Load libraries and object 
+  gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
+
+  TFile* file = TFile::Open(fname, "READ");
+  if (!file) { 
+    Error("DrawCorrSecMap", "Failed to open %s", fname);
+    return;
+  }
+  TString pname(fname);
+  pname.ReplaceAll(".root", ".pdf");
+
+  const char* objName = 
+    AliForwardCorrectionManager::Instance()
+    .GetObjectName(AliForwardCorrectionManager::kSecondaryMap);
+  AliFMDCorrSecondaryMap* corr = 
+    static_cast<AliFMDCorrSecondaryMap*>(file->Get(objName));
+  if (!corr) { 
+    Error("DrawCorrSecMap", "Object '%s' not found in %s", objName, fname);
+    return;
+  }
+
+  //__________________________________________________________________
+  // Create a canvas
+  TCanvas* c = new TCanvas("c", "c", 800 / TMath::Sqrt(2), 800);
+  c->SetFillColor(0);
+  c->SetBorderSize(0);
+  c->SetBorderMode(0);
+  c->Print(Form("%s[", pname.Data()));
+  
+  gStyle->SetOptStat(0);
+  gStyle->SetTitleColor(0);
+  gStyle->SetTitleStyle(0);
+  gStyle->SetTitleBorderSize(0);
+  gStyle->SetTitleX(.1);
+  gStyle->SetTitleY(1);
+  gStyle->SetTitleW(.8);
+  gStyle->SetTitleH(.09);
+  gStyle->SetFrameFillColor(kWhite);
+  gStyle->SetFrameBorderSize(1);
+  gStyle->SetFrameBorderMode(1);
+  gStyle->SetPalette(1);
+
+  ClearCanvas(c);
+  //__________________________________________________________________
+  // Create a title page 
+  TLatex* ll = new TLatex(.5,.8, fname);
+  ll->SetTextAlign(22);
+  ll->SetTextSize(0.03);
+  ll->SetNDC();
+  ll->Draw();
+
+  TLatex* l = new TLatex(.5,.8, fname);
+  l->SetNDC();
+  l->SetTextSize(0.03);
+  l->SetTextFont(132);
+  l->SetTextAlign(12);
+  l->DrawLatex(0.2, 0.70, "Secondary map");
+  l->SetTextAlign(22);
+  l->DrawLatex(0.5, 0.60, "c_{v,r}(#eta,#phi)=#frac{"
+              "#sum N_{ch,primary,i}(#eta,#phi)}{"
+              "#sum N_{ch,FMD,i}(#eta,#phi)}");
+  l->SetTextAlign(12);
+  l->DrawLatex(0.2, 0.50, "N: Number of events");
+  l->DrawLatex(0.2, 0.45, "N_{ch,primary,i}(#eta,#phi): Number of charged, "
+              "primary particles in (#eta,#phi) bin");
+  l->DrawLatex(0.2, 0.40, "N_{ch,primary,i}(#eta,#phi): Number of charged, "
+              "particles that hit the FMD in (#eta,#phi) bin");
+  l->DrawLatex(0.2, 0.35, "All quantities determined in MC");
+  
+  c->Print(pname.Data(), "Title:Title page");
+
+  ClearCanvas(c);
+
+  //__________________________________________________________________
+  // Draw all corrections
+  const TAxis& vtxAxis = corr->GetVertexAxis();
+  Int_t        nVtx    = vtxAxis.GetNbins();
+  for (UShort_t d = 1; d <= 3; d++) {
+    UShort_t     nQ = (d == 1 ? 1 : 2);
+    for (UShort_t q = 0; q < nQ; q++) { 
+      Char_t r = (q == 0 ? 'I' : 'O');
+
+      ClearCanvas(c);
+      c->Divide(2, (nVtx+1)/2);
+      for (UShort_t v=1; v <= nVtx; v++) { 
+       TVirtualPad* p = c->cd(v);
+      
+      
+       TH2* h1 = corr->GetCorrection(d, r, v);
+       if (!h1) { 
+         Warning("DrawCorrSecMap", "No correction for r=%c, v=%d", r, v);
+         continue;
+       }
+       h1->Draw(option);
+      }
+      c->Print(pname.Data(), Form("Title:FMD%d%c", d, r));
+    }
+  }
+
+  //__________________________________________________________________
+  // Close output file 
+  c->Print(Form("%s]", pname.Data()));
+}
+//
+// EOF
+//
diff --git a/PWG2/FORWARD/analysis2/scripts/DrawCorrVtxBias.C b/PWG2/FORWARD/analysis2/scripts/DrawCorrVtxBias.C
new file mode 100644 (file)
index 0000000..8a3dee4
--- /dev/null
@@ -0,0 +1,150 @@
+/**
+ * @file 
+ * 
+ * Scripts to draw energy loss fits from correction object file 
+ *
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+/** 
+ * Clear canvas 
+ * 
+ * @param c Canvas to clear 
+ *
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+void
+ClearCanvas(TCanvas* c)
+{
+  c->SetLeftMargin(.1);
+  c->SetRightMargin(.05);
+  c->SetBottomMargin(.1);
+  c->SetTopMargin(.05);
+  c->Clear();
+}
+
+/** 
+ * Draw energy loss fits to a multi-page PDF. 
+ *
+ * @par Input: 
+ * The input file is expected to contain a AliFMDCorrELossFit object
+ * named @i elossfits in the top level directory.
+ * 
+ * @para Output: 
+ * A multi-page PDF.  Note, that the PDF generated by ROOT in this way
+ * is broken (cannot be read by Acrobat Reader on Windows and MacOSX)
+ * and one should pass it through a filter to correct these problems.
+ * 
+ * @param fname   File name 
+ * @param option  Drawing options 
+ *
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+void
+DrawCorrVtxBias(const char* fname, const char* option="colz")
+{
+  //__________________________________________________________________
+  // Load libraries and object 
+  gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
+
+  TFile* file = TFile::Open(fname, "READ");
+  if (!file) { 
+    Error("DrawCorrVtxBias", "Failed to open %s", fname);
+    return;
+  }
+  TString pname(fname);
+  pname.ReplaceAll(".root", ".pdf");
+
+  const char* objName = 
+    AliForwardCorrectionManager::Instance()
+    .GetObjectName(AliForwardCorrectionManager::kVertexBias);
+  AliFMDCorrVertexBias* corr = 
+    static_cast<AliFMDCorrVertexBias*>(file->Get(objName));
+  if (!corr) { 
+    Error("DrawCorrVtxBias", "Object '%s' not found in %s", objName, fname);
+    return;
+  }
+
+  //__________________________________________________________________
+  // Create a canvas
+  TCanvas* c = new TCanvas("c", "c", 800 / TMath::Sqrt(2), 800);
+  c->SetFillColor(0);
+  c->SetBorderSize(0);
+  c->SetBorderMode(0);
+  c->Print(Form("%s[", pname.Data()));
+  
+  gStyle->SetOptStat(0);
+  gStyle->SetTitleColor(0);
+  gStyle->SetTitleStyle(0);
+  gStyle->SetTitleBorderSize(0);
+  gStyle->SetTitleX(.1);
+  gStyle->SetTitleY(1);
+  gStyle->SetTitleW(.8);
+  gStyle->SetTitleH(.09);
+  gStyle->SetFrameFillColor(kWhite);
+  gStyle->SetFrameBorderSize(1);
+  gStyle->SetFrameBorderMode(1);
+  gStyle->SetPalette(1);
+
+  ClearCanvas(c);
+  //__________________________________________________________________
+  // Create a title page 
+  TLatex* ll = new TLatex(.5,.8, fname);
+  ll->SetTextAlign(22);
+  ll->SetTextSize(0.03);
+  ll->SetNDC();
+  ll->Draw();
+
+  TLatex* l = new TLatex(.5,.8, fname);
+  l->SetNDC();
+  l->SetTextSize(0.03);
+  l->SetTextFont(132);
+  l->SetTextAlign(12);
+  l->DrawLatex(0.2, 0.70, "Vertex Bias Corrections");
+  l->SetTextAlign(22);
+  l->DrawLatex(0.5, 0.60,  "c_{v}(#eta,#phi)=#frac{1/N_{t}}{1/N_{v}}"
+              "#sum_{i}^{N_{tv}}N_{ch,i}(#eta,#phi) / "
+              "#sum_{i}^{N_{v}}N_{ch,i}(#eta,#phi)");
+  l->SetTextAlign(12);
+  l->DrawLatex(0.2, 0.50, "N_{t}: Number of events w/triggers");
+  l->DrawLatex(0.2, 0.45, "N_{v}: Number of events w/vertex");
+  l->DrawLatex(0.2, 0.40, "N_{tv}: Number of events w/trigger and vertex");
+  l->DrawLatex(0.2, 0.35, "N_{ch,i}(#eta,#phi): Number of charged, "
+              "particles in (#eta,#phi) bin");
+  l->DrawLatex(0.2, 0.30, "All quantities determined in MC");
+  
+  c->Print(pname.Data(), "Title:Title page");
+
+  ClearCanvas(c);
+
+  //__________________________________________________________________
+  // Draw all corrections
+  const TAxis& vtxAxis = corr->GetVertexAxis();
+  Int_t        nVtx    = vtxAxis.GetNbins();
+  UShort_t     nQ      = 2;
+  UShort_t     d       = 0;
+  for (UShort_t q = 0; q < nQ; q++) { 
+    Char_t r = (q == 0 ? 'I' : 'O');
+
+    ClearCanvas(c);
+    c->Divide(2, (nVtx+1)/2);
+    for (UShort_t v=1; v <= nVtx; v++) { 
+      TVirtualPad* p = c->cd(v);
+      
+      
+      TH2* h1 = corr->GetCorrection(r, v);
+      if (!h1) { 
+       Warning("DrawCorrVtxBias", "No correction for r=%c, v=%d", r, v);
+       continue;
+      }
+      h1->Draw(option);
+    }
+    c->Print(pname.Data(), Form("Title:FMDX%c", r));
+  }
+
+  //__________________________________________________________________
+  // Close output file 
+  c->Print(Form("%s]", pname.Data()));
+}
+//
+// EOF
+//