]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/DrawdNdeta.C
changed name of add task macro. git test.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / DrawdNdeta.C
index e6393f7a81a2294c9286cfdb7a04f7a68a8bf645..4288e7258ab3d06634df0b3d2f304068aba3ad9a 100644 (file)
@@ -80,11 +80,16 @@ struct dNdetaDrawer
     fMirror(false), 
     fForceMB(false),    
     fAddExec(false),
+    fSaveAsPDF(false), 
+    fSaveAsPNG(false), 
+    fSaveAsROOT(false),
+    fSaveAsScript(false),
     // Settings 
     fRebin(0),             // Rebinning factor 
     fFwdSysErr(0.076),     // Systematic error in forward range
     fCenSysErr(0),         // Systematic error in central range 
     fTitle(""),            // Title on plot
+    fBase(""),             // Optional base name of output files
     fClusterScale(""),     // Scaling of clusters to tracklets      
     // Read (or set) information 
     fTrigString(0),        // Trigger string (read, or set)
@@ -94,6 +99,7 @@ struct dNdetaDrawer
     fVtxAxis(0),           // Vertex cuts (read or set)
     fCentAxis(0),          // Centrality axis
     fTriggerEff(1),        // Trigger efficency 
+    fExtTriggerEff(false), // True if fTriggerEff was read 
     // Resulting plots 
     fResults(0),           // Stack of results 
     fRatios(0),            // Stack of ratios 
@@ -207,6 +213,17 @@ struct dNdetaDrawer
    */
   void SetTitle(TString x)        { fTitle = x; }
   //__________________________________________________________________
+  /** 
+   * Set the base name of the output files 
+   * 
+   * @param x Base name 
+   */
+  void SetBase(TString x) { fBase = x; }
+  void SetSaveAsPNG(Bool_t x) { fSaveAsPNG = x; }
+  void SetSaveAsPDF(Bool_t x) { fSaveAsPDF = x; }
+  void SetSaveAsROOT(Bool_t x) { fSaveAsROOT = x; }
+  void SetSaveAsScript(Bool_t x) { fSaveAsScript = x; }
+  //__________________________________________________________________
   /** 
    * Set the systematic error in the forward region
    * 
@@ -322,7 +339,11 @@ struct dNdetaDrawer
    * 
    * @param eff @f$\varepsilon_{T}@f$ 
    */
-  void SetTriggerEfficiency(Float_t eff)  { fTriggerEff = eff; }
+  void SetTriggerEfficiency(Float_t eff)  
+  { 
+    fTriggerEff = eff; 
+    fExtTriggerEff = false;
+  }
 
   //==================================================================
   /** 
@@ -349,14 +370,14 @@ struct dNdetaDrawer
     Info("Run", "Drawing results from %s", file->GetName());
 
     // --- Get forward list ------------------------------------------
-    TList* forward = static_cast<TList*>(file->Get("ForwardResults"));
+    TList* forward = static_cast<TList*>(file->Get("ForwarddNdetaResults"));
     if (!forward) { 
-      Error("Run", "Couldn't find list ForwardResults");
+      Error("Run", "Couldn't find list ForwarddNdetaResults");
       return;
     }
-    TList* sums = static_cast<TList*>(file->Get("ForwardSums"));
+    TList* sums = static_cast<TList*>(file->Get("ForwarddNdetaSums"));
     if (!sums) { 
-      Error("Run", "Couldn't find list ForwardSums");
+      Error("Run", "Couldn't find list ForwarddNdetaSums");
       return;
     }
     TParameter<bool>* p = 
@@ -399,18 +420,21 @@ struct dNdetaDrawer
         fEmpirical.Data());
 
     // --- Set the macro pathand load other data script --------------
+    TString savPath(gROOT->GetMacroPath());
     gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
                             gROOT->GetMacroPath()));
     // Always recompile 
-    gROOT->LoadMacro("OtherData.C++");
+    if (!gROOT->GetClass("RefData"))
+      gROOT->LoadMacro("OtherData.C++");
+    gROOT->SetMacroPath(savPath);
 
     // --- Get the central results -----------------------------------
-    TList* clusters = static_cast<TList*>(file->Get("CentralResults"));
-    if (!clusters) Warning("Run", "Couldn't find list CentralResults");
+    TList* clusters = static_cast<TList*>(file->Get("CentraldNdetaResults"));
+    if (!clusters) Warning("Run", "Couldn't find list CentraldNdetaResults");
 
     // --- Get the central results -----------------------------------
-    TList* mcTruth = static_cast<TList*>(file->Get("MCTruthResults"));
-    if (!mcTruth) Warning("Run", "Couldn't find list MCTruthResults");
+    TList* mcTruth = static_cast<TList*>(file->Get("MCTruthdNdetaResults"));
+    if (!mcTruth) Warning("Run", "Couldn't find list MCTruthdNdetaResults");
 
     // --- Make our containtes ---------------------------------------
     fResults   = new THStack("results", "Results");
@@ -428,13 +452,13 @@ struct dNdetaDrawer
                fFinalMC.Data());
       }
       else { 
-       forwardMC = static_cast<TList*>(finalMC->Get("ForwardResults"));
+       forwardMC = static_cast<TList*>(finalMC->Get("ForwarddNdetaResults"));
        if (!forwardMC) 
-         Warning("Run", "Couldn't find list ForwardResults for final MC");
+         Warning("Run","Couldn't find list ForwarddNdetaResults for final MC");
 #if 0
-       centralMC = static_cast<TList*>(finalMC->Get("CentralResults"));
+       centralMC = static_cast<TList*>(finalMC->Get("CentradNdetalResults"));
        if (!centralMC) 
-         Warning("Run", "Couldn't find list CentralResults for final MC");
+         Warning("Run","Couldn't find list CentraldNdetaResults for final MC");
 #endif
       }
     }
@@ -581,6 +605,15 @@ struct dNdetaDrawer
       fVtxAxis    = static_cast<TAxis*>(results->FindObject("vtxAxis"));
     if (!fCentAxis) 
       fCentAxis   = static_cast<TAxis*>(results->FindObject("centAxis"));
+    if (fTriggerEff <= 0 || (1-fTriggerEff)<1e-6) {
+      TParameter<double>* eff = 
+       static_cast<TParameter<double>*>(results->FindObject("triggerEff"));
+      if (eff) {
+       fTriggerEff = eff->GetVal();
+       fExtTriggerEff = true;
+      }
+      if (fTriggerEff <= 0) SetTriggerEfficiency(1);
+    }
 
     TNamed* options = static_cast<TAxis*>(results->FindObject("options"));
     if (!fTrigString) fTrigString = new TNamed("trigger", "unknown");
@@ -604,6 +637,7 @@ struct dNdetaDrawer
     Info("FetchInformation", 
         "Initialized for\n"
         "   Trigger:       %-30s  (0x%x)\n"
+        "   Efficiency:    %-6.4f\n"
         "   sqrt(sNN):     %-30s  (%dGeV)\n"
         "   System:        %-30s  (%d)\n"
         "   Vz range:      %-30s  (%f,%f)\n"
@@ -611,6 +645,7 @@ struct dNdetaDrawer
         "   Centrality:    %s\n"
         "   Options:       %s",
         fTrigString->GetTitle(), fTrigString->GetUniqueID(), 
+        fTriggerEff,
         fSNNString->GetTitle(),  fSNNString->GetUniqueID(), 
         fSysString->GetTitle(),  fSysString->GetUniqueID(), 
         fVtxAxis->GetTitle(), fVtxAxis->GetXmin(), fVtxAxis->GetXmax(),
@@ -634,10 +669,9 @@ struct dNdetaDrawer
     UShort_t sys   = (fSysString  ? fSysString->GetUniqueID() : 0);
     UShort_t trg   = (fTrigString ? fTrigString->GetUniqueID() : 0);
     UShort_t snn   = (fSNNString  ? fSNNString->GetUniqueID() : 0);
-    Long_t   ret   = gROOT->ProcessLine(Form("GetData(%d,%d,%d,%d,%d,%d);",
-                                            sys,snn,trg,
-                                            centLow,centHigh,
-                                            fShowOthers));
+    Long_t   ret   = 
+      gROOT->ProcessLine(Form("RefData::GetData(%d,%d,%d,%d,%d,%d);",
+                             sys,snn,trg,centLow,centHigh,fShowOthers));
     if (!ret) return 0;
 
     thisOther = reinterpret_cast<TMultiGraph*>(ret);    
@@ -777,9 +811,9 @@ struct dNdetaDrawer
     TString title(h->GetTitle());
     title.ReplaceAll("ALICE ","");
     if (title.Contains("Central")) 
-      title.ReplaceAll("Central", "SPD clusters");
+      title.ReplaceAll("CentraldNdeta", "SPD clusters");
     if (title.Contains("Forward"))
-      title.ReplaceAll("Forward", "FMD");
+      title.ReplaceAll("ForwarddNdeta", "FMD");
     h->SetTitle(title);
     
     
@@ -981,6 +1015,7 @@ struct dNdetaDrawer
   //__________________________________________________________________
   void CorrectTriggerEff(TH1* dndeta)
   {
+    if (fExtTriggerEff) return;
     if (!dndeta) return;
     if (fTriggerEff <= 0 || fTriggerEff >= 1) return;
     dndeta->Scale(fTriggerEff);
@@ -997,8 +1032,8 @@ struct dNdetaDrawer
            Double_t     amax)
   {
     gStyle->SetOptTitle(0);
-    gStyle->SetTitleFont(132, "xyz");
-    gStyle->SetLabelFont(132, "xyz");
+    gStyle->SetTitleFont(kFont, "xyz");
+    gStyle->SetLabelFont(kFont, "xyz");
     
     Int_t    h  = 800;
     Int_t    w  = 800; // h / TMath::Sqrt(2);
@@ -1038,19 +1073,21 @@ struct dNdetaDrawer
     trg.ReplaceAll(">", "Gt");
     trg.ReplaceAll("&", "AND");
     trg.ReplaceAll("|", "OR");
-    TString base(Form("dndeta_%s_%s_%s_%c%02d%c%02dcm_%09dev",
-                     fSysString->GetTitle(), 
-                     fSNNString->GetTitle(), 
-                     trg.Data(),
-                     vMin < 0 ? 'm' : 'p',  TMath::Abs(vMin),
-                     vMax < 0 ? 'm' : 'p',  TMath::Abs(vMax),
-                     nev));
-    c->SaveAs(Form("%s.png",  base.Data()));
-    c->SaveAs(Form("%s.root", base.Data()));
-    c->SaveAs(Form("%s.C",    base.Data()));
-    c->SaveAs(Form("%s.pdf",  base.Data()));
-    base.ReplaceAll("dndeta", "export");
-    Export(base);
+    if (fBase.IsNull()) 
+      fBase = "dndeta_<sys>_<snn>_<trig>_<ipmin><ipmax>cm_<nev>ev";
+    fBase.ReplaceAll("<sys>",   fSysString->GetTitle());
+    fBase.ReplaceAll("<snn>",   fSNNString->GetTitle());
+    fBase.ReplaceAll("<trig>",  trg.Data());
+    fBase.ReplaceAll("<ipmin>", Form("%c%02d",vMin<0?'m':'p',TMath::Abs(vMin)));
+    fBase.ReplaceAll("<ipmax>", Form("%c%02d",vMax<0?'m':'p',TMath::Abs(vMax)));
+    fBase.ReplaceAll("<nev>",   Form("%09d",  nev));
+    if (fSaveAsPNG)   c->SaveAs(Form("%s.png",  fBase.Data()));
+    if (fSaveAsROOT)  c->SaveAs(Form("%s.root", fBase.Data()));
+    if (fSaveAsScript)c->SaveAs(Form("%s.C",    fBase.Data()));
+    if (fSaveAsPDF)   c->SaveAs(Form("%s.pdf",  fBase.Data()));
+    TString exp(fBase);
+    exp.ReplaceAll("dndeta", "export");
+    Export(exp);
   }
   //__________________________________________________________________
   /** 
@@ -1075,7 +1112,8 @@ struct dNdetaDrawer
     l->SetFillColor(0);
     l->SetFillStyle(0);
     l->SetBorderSize(0);
-    l->SetTextFont(132);
+    l->SetTextFont(kFont);
+    l->SetTextColor(kAliceBlue);
 
     // Loop over items in stack and get unique items, while ignoring
     // mirrored data and systematic error bands 
@@ -1184,7 +1222,8 @@ struct dNdetaDrawer
     l->SetFillColor(0);
     l->SetFillStyle(0);
     l->SetBorderSize(0);
-    l->SetTextFont(132);
+    l->SetTextFont(kFont);
+    l->SetTextColor(kAliceBlue);
 
     Int_t n = fCentAxis->GetNbins();
     for (Int_t i = 1; i <= n; i++) { 
@@ -1212,7 +1251,7 @@ struct dNdetaDrawer
     p1->SetBorderSize(0);
     p1->SetBorderMode(0);
     p1->SetBottomMargin(yd > 0.001 ? 0.001 : 0.1);
-    p1->SetRightMargin(0.03);
+    p1->SetRightMargin(kRightMargin);
     if (fShowLeftRight || fShowRatios) p1->SetGridx();
     p1->SetTicks(1,1);
     p1->SetNumber(1);
@@ -1253,14 +1292,16 @@ struct dNdetaDrawer
 
     // Put a title on top
     fTitle.ReplaceAll("@", " ");
-    TLatex* tit = new TLatex(0.10, 0.95, fTitle.Data());
+    TLatex* tit = new TLatex(0.10, .99, fTitle.Data());
     tit->SetNDC();
-    tit->SetTextFont(132);
-    tit->SetTextSize(0.05);
+    tit->SetTextFont(kFont);
+    tit->SetTextAlign(13);
+    tit->SetTextSize(0.045);
+    tit->SetTextColor(kAlicePurple);
     tit->Draw();
 
-    Int_t    aliceBlue = TColor::GetColor(41,73,156);
-    Double_t x         = .93;
+    // TColor::GetColor(41,73,156);
+    Double_t x         = .95;
     Double_t y         = .93;
     // Put a nice label in the plot
     TString     eS;
@@ -1275,9 +1316,9 @@ struct dNdetaDrawer
                                       eS.Data(), 
                                       HasCent() ? "by centrality" : 
                                       fTrigString->GetTitle()));
-    tt->SetTextColor(aliceBlue);
+    tt->SetTextColor(kAliceBlue);
     tt->SetNDC();
-    tt->SetTextFont(132);
+    tt->SetTextFont(kFont);
     tt->SetTextAlign(33);
     tt->Draw();
     y -= tt->GetTextSize() + .01;
@@ -1286,9 +1327,9 @@ struct dNdetaDrawer
     Int_t nev = 0;
     if (fTriggers) nev = fTriggers->GetBinContent(1);
     TLatex* et = new TLatex(x, y, Form("%d events", nev));
-    et->SetTextColor(aliceBlue);
+    et->SetTextColor(kAliceBlue);
     et->SetNDC();
-    et->SetTextFont(132);
+    et->SetTextFont(kFont);
     et->SetTextAlign(33);
     et->Draw();
     y -= et->GetTextSize() + .01;
@@ -1297,9 +1338,9 @@ struct dNdetaDrawer
     if (fVtxAxis) { 
       TLatex* vt = new TLatex(x, y, fVtxAxis->GetTitle());
       vt->SetNDC();
-      vt->SetTextFont(132);
+      vt->SetTextFont(kFont);
       vt->SetTextAlign(33);
-      vt->SetTextColor(aliceBlue);
+      vt->SetTextColor(kAliceBlue);
       vt->Draw();
       y -= vt->GetTextSize() + .01;
     }
@@ -1317,9 +1358,9 @@ struct dNdetaDrawer
       if (corrs.Index("+") != kNPOS) corrs.Append("s");
       TLatex* em = new TLatex(x, y, corrs);
       em->SetNDC();
-      em->SetTextFont(132);
+      em->SetTextFont(kFont);
       em->SetTextAlign(33);
-      em->SetTextColor(aliceBlue);
+      em->SetTextColor(kAliceBlue);
       em->Draw();
       y -= em->GetTextSize() + .01;
     }
@@ -1329,9 +1370,9 @@ struct dNdetaDrawer
                                         fTrigString->GetTitle(), 
                                         fTriggerEff));
       ef->SetNDC();
-      ef->SetTextFont(132);
+      ef->SetTextFont(kFont);
       ef->SetTextAlign(33);
-      ef->SetTextColor(aliceBlue);
+      ef->SetTextColor(kAliceBlue);
       ef->Draw();
       y -= ef->GetTextSize() + .01;
     }
@@ -1343,27 +1384,33 @@ struct dNdetaDrawer
     // Mark the plot as preliminary
     TLatex* pt = new TLatex(.12, .93, "Work in progress");
     pt->SetNDC();
-    pt->SetTextFont(22);
+    pt->SetTextFont(62);
     // pt->SetTextSize();
-    pt->SetTextColor(TColor::GetColor(234,26,46));
+    pt->SetTextColor(kAliceRed);
     pt->SetTextAlign(13);
     pt->Draw();
+    TDatime now;
+    TLatex* dt = new TLatex(.12, .88, now.AsSQLString());
+    dt->SetNDC();
+    dt->SetTextFont(42);
+    dt->SetTextSize(0.04);
+    dt->SetTextColor(kAliceBlue); // kAliceRed);
+    dt->SetTextAlign(13);
+    dt->Draw();
+
+    TString savPath(gROOT->GetMacroPath());
+    gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2/scripts",
+                            gROOT->GetMacroPath()));
+    // Always recompile 
+    if (!gROOT->GetClass("AliceLogo"))
+      gROOT->LoadMacro("AliceLogo.C++");
+    gROOT->SetMacroPath(savPath);
 
-    const char*  logos[] = { "ALICE.png", "FMD.png", 0 };
-    const char** logo    = logos;
-    while (*logo) {
-      if (gSystem->AccessPathName(*logo)) {
-       logo++;
-       continue;
-      }
-      TPad* pad = new TPad("logo", "logo", .12, .7, .25, .9, 0, 0, 0);
-      pad->SetFillStyle(0);
-      pad->Draw();
-      pad->cd();
-      TImage* i = TImage::Create();
-      i->ReadImage(*logo);
-      i->Draw();
-      break;
+    if (gROOT->GetClass("AliceLogo")) {
+      p1->cd();
+      p1->Range(0,0,1,1);
+      gROOT->ProcessLine("AliceLogo* al = new AliceLogo();");
+      gROOT->ProcessLine("al->Draw(0,.88,.5,.2, 0, 0);");
     }
     p1->cd();
   }
@@ -1384,7 +1431,7 @@ struct dNdetaDrawer
     // Make a sub-pad for the result itself
     TPad* p2 = new TPad("p2", "p2", 0, y1, 1.0, y2, 0, 0, 0);
     p2->SetTopMargin(0.001);
-    p2->SetRightMargin(0.03);
+    p2->SetRightMargin(kRightMargin);
     p2->SetBottomMargin(isBottom ? 1/yd * 0.07 : 0.0001);
     p2->SetGridx();
     p2->SetTicks(1,1);
@@ -1411,7 +1458,7 @@ struct dNdetaDrawer
     l2->SetFillColor(0);
     l2->SetFillStyle(0);
     l2->SetBorderSize(0);
-    l2->SetTextFont(132);
+    l2->SetTextFont(kFont);
 #endif
     // Make a nice band from 0.9 to 1.1
     TGraphErrors* band = new TGraphErrors(2);
@@ -1458,7 +1505,7 @@ struct dNdetaDrawer
     // Make a sub-pad for the result itself
     TPad* p3 = new TPad("p3", "p3", 0, y1, 1.0, y2, 0, 0, 0);
     p3->SetTopMargin(0.001);
-    p3->SetRightMargin(0.03);
+    p3->SetRightMargin(kRightMargin);
     p3->SetBottomMargin(isBottom ? 1/yd * 0.07 : 0.0001);
     p3->SetGridx();
     p3->SetTicks(1,1);
@@ -1863,8 +1910,8 @@ struct dNdetaDrawer
       }
     }
     if (!r) {
-      Warning("Ratio", "Don't know how to divide a %s (%s) with a %s (%s)", 
-             o1->ClassName(), o1->GetName(), o2->ClassName(), o2->GetName());
+      // Warning("Ratio", "Don't know how to divide a %s (%s) with a %s (%s)", 
+      //         o1->ClassName(),o1->GetName(),o2->ClassName(),o2->GetName());
       return 0;
     }
     // Check that the histogram isn't empty
@@ -1933,7 +1980,23 @@ struct dNdetaDrawer
   TH1* RatioHH(const TH1* h1, const TH1* h2) const
   {
     if (!h1 || !h2) return 0;
+    Bool_t bad = false;
+    if (h1->GetNbinsX() != h2->GetNbinsX()) {
+      Error("RatioHH", "They have differnet number of bins");
+      bad = true;
+    }
+    for (Int_t i = 1; i <= h1->GetNbinsX(); i++) {
+      if (h1->GetXaxis()->GetBinLowEdge(i) != 
+         h2->GetXaxis()->GetBinLowEdge(i)) {
+       // Error("RatioHH", "They have incompatible variable bins");
+       bad = true;
+       break;
+      }
+    }
+    if (bad) return 0;
+    
     TH1* t1 = static_cast<TH1*>(h1->Clone("tmp"));
+    // Printf("Dividing %s with %s", h1->GetName(), h2->GetName());
     t1->Divide(h2);
     return t1;
   }
@@ -2046,7 +2109,7 @@ struct dNdetaDrawer
     Double_t s = 1/yd/1.2;
     // Info("FixAxis", "for %s, s=1/%f=%f", stack->GetName(), yd, s);
 
-    h->SetXTitle("#font[152]{#eta}");
+    h->SetXTitle("#it{#eta}");
     h->SetYTitle(ytitle);
     TAxis* xa = h->GetXaxis();
     TAxis* ya = h->GetYaxis();
@@ -2074,7 +2137,7 @@ struct dNdetaDrawer
       // ya->SetTicks("+-");
       ya->SetNdivisions(ynDiv);
       ya->SetTitleSize(s*ya->GetTitleSize());
-      ya->SetTitleOffset(ya->GetTitleOffset()/s);
+      ya->SetTitleOffset(1.15*ya->GetTitleOffset()/s);
       ya->SetLabelSize(s*ya->GetLabelSize());
     }
   }
@@ -2284,7 +2347,10 @@ struct dNdetaDrawer
    * 
    * @return True if we should do centrality dependent ploting 
    */
-  Bool_t HasCent() const { return fCentAxis && !fForceMB; }
+  Bool_t HasCent() const 
+  { 
+    return fCentAxis && fCentAxis->GetNbins() > 0 && !fForceMB; 
+  }
 
 
 
@@ -2303,6 +2369,10 @@ struct dNdetaDrawer
   Bool_t       fMirror;       // Whether to mirror 
   Bool_t       fForceMB;      // Force min-bias
   Bool_t       fAddExec;      // Add code to do combined zooms
+  Bool_t       fSaveAsPDF;    // Flag whether to save as PDF
+  Bool_t       fSaveAsPNG;    // Flag whether to save as PNG
+  Bool_t       fSaveAsROOT;   // Flag whether to save as ROOT file
+  Bool_t       fSaveAsScript; // Flag whether to save as ROOT script
   /* @} */
   /** 
    * @{ 
@@ -2312,6 +2382,7 @@ struct dNdetaDrawer
   Double_t     fFwdSysErr;    // Systematic error in forward range
   Double_t     fCenSysErr;    // Systematic error in central range 
   TString      fTitle;        // Title on plot
+  TString      fBase;         // Base name of output 
   TString      fClusterScale; // Scaling of clusters to tracklets      
   TString      fFinalMC;      // Final MC correction file name
   TString      fEmpirical;    // Empirical correction file name
@@ -2327,6 +2398,7 @@ struct dNdetaDrawer
   TAxis*       fVtxAxis;      // Vertex cuts (read or set)
   TAxis*       fCentAxis;     // Centrality axis
   Float_t      fTriggerEff;   // Trigger efficiency 
+  Bool_t       fExtTriggerEff;// True if read externally 
   /* @} */
   /** 
    * @{ 
@@ -2341,8 +2413,23 @@ struct dNdetaDrawer
   /* @} */
   RangeParam*  fRangeParam;   // Parameter object for range zoom 
   Bool_t       fOld;
+
+  static const Float_t kRightMargin;
+  static const Int_t   kFont;
+  static const Int_t   kAliceBlue;
+  static const Int_t   kAliceRed;
+  static const Int_t   kAlicePurple;
+  static const Int_t   kAliceYellow;
 };
 
+const Float_t dNdetaDrawer::kRightMargin = 0.02;
+const Int_t   dNdetaDrawer::kFont        = 42; // 132 for serif
+const Int_t   dNdetaDrawer::kAliceBlue   = TColor::GetColor(40,   58, 68);
+const Int_t   dNdetaDrawer::kAliceRed    = TColor::GetColor(226,   0, 26);
+const Int_t   dNdetaDrawer::kAlicePurple = TColor::GetColor(202,  71, 67);
+const Int_t   dNdetaDrawer::kAliceYellow = TColor::GetColor(238, 125, 17);
+
+
 //____________________________________________________________________
 /** 
  * Function to calculate 
@@ -2442,7 +2529,7 @@ void
 Usage()
 {
   printf("Usage: DrawdNdeta(FILE,TITLE,REBIN,OTHERS,FLAGS,"
-        "SNN,SYS,TRIG,IPZMIN,IPZMAX)\n\n"
+        "SNN,SYS,TRIG,IPZMIN,IPZMAX,BASE,FMT)\n"
         "  const char* FILE   File name to open (\"forward_dndeta.root\")\n"
         "  const char* TITLE  Title to put on plot (\"\")\n"
         "  UShort_t    REBIN  Rebinning factor (1)\n"
@@ -2453,13 +2540,17 @@ Usage()
         "  UShort_t    TRIG   (optional) 1: INEL, 2: INEL>0, 4: NSD, ...\n"
         "  Float_t     EFF    (optional) Trigger efficiency\n"
         "  Float_t     IPZMIN (optional) Least z coordinate of IP\n"
-        "  Float_t     IPZMAX (optional) Largest z coordinate of IP\n\n"
-        " OTHERS is a bit mask of\n\n"
+        "  Float_t     IPZMAX (optional) Largest z coordinate of IP\n"
+        "  const char* BASE   (optional) base name of output files\n"
+        "  UShort_t    FMT    (optional) Output formats\n"
+        "\n"
+        " OTHERS is a bit mask of\n"
         "  0x1     Show UA5 data (INEL,NSD, ppbar, 900GeV)\n"
         "  0x2     Show CMS data (NSD, pp)\n"
         "  0x4     Show published ALICE data (INEL,INEL>0,NSD, pp)\n"
-        "  0x8     Show event genertor data\n\n"
-        " FLAGS is a bit mask of\n\n"
+        "  0x8     Show event genertor data\n"
+        "\n"
+        " FLAGS is a bit mask of\n"
         "  0x1     Show ratios of data to other data and possibly MC\n"
         "  0x2     Show left-right asymmetry\n"
         "  0x4     Show systematic error band\n"
@@ -2473,7 +2564,14 @@ Usage()
         "  0x400   Apply `Emperical' correction\n"
         "  0x800   Export results to script\n"
         "  0x1000  Add code to do combined zooms on eta axis\n"
-        "  0x2000  Assume old-style input\n\n"
+        "  0x2000  Assume old-style input\n"
+        "\n"
+        " FMD is a bit mask of\n"
+        "  0x1     Make PNG output\n"
+        "  0x2     Make PDF output\n"
+        "  0x4     Make ROOT file output\n"
+        "  0x8     Make ROOT script output\n"
+        "\n"
         "0x200 requires the file forward_dndetamc.root\n"
         "0x400 requires the file EmpiricalCorrection.root\n"
         "To specify that you want ratios, force MB, apply empirical "
@@ -2494,8 +2592,11 @@ Usage()
  * @param sNN       (optional) Collision energy [GeV]
  * @param sys       (optional) Collision system (1: pp, 2: PbPb)
  * @param trg       (optional) Trigger (1: INEL, 2: INEL>0, 4: NSD)   
+ * @param eff       (optional) Trigger efficiency 
  * @param vzMin     Least @f$ v_z@f$
  * @param vzMax     Largest @f$ v_z@f$
+ * @param base      Base name 
+ * @param outflg    Output flags 
  *
  * @ingroup pwglf_forward_dndeta
  */
@@ -2510,7 +2611,9 @@ DrawdNdeta(const char* filename="forward_dndeta.root",
           UShort_t    trg=0,
           Float_t     eff=0,
           Float_t     vzMin=999, 
-          Float_t     vzMax=-999)
+          Float_t     vzMax=-999,
+          const char* base="", 
+          UShort_t    outflg=0xf)
 {
   TString fname(filename);
   fname.ToLower();
@@ -2538,6 +2641,11 @@ DrawdNdeta(const char* filename="forward_dndeta.root",
   d.SetExport(flags & 0x800);
   d.SetAddExec(flags & 0x1000);
   d.SetOld(flags & 0x2000);
+  d.SetBase(base);
+  d.SetSaveAsPNG(outflg & 0x1);
+  d.SetSaveAsPDF(outflg & 0x2);
+  d.SetSaveAsROOT(outflg & 0x4);
+  d.SetSaveAsScript(outflg & 0x8);
   // d.fClusterScale = "1.06 -0.003*x +0.0119*x*x";
   // Do the below if your input data does not contain these settings 
   if (sNN > 0) d.SetSNN(sNN);     // Collision energy per nucleon pair (GeV)