]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
dN/deta task now configurable through external script.
authorcholm <Christian.Holm.Christensen@cern.ch>
Thu, 5 Jun 2014 21:22:58 +0000 (23:22 +0200)
committercholm <Christian.Holm.Christensen@cern.ch>
Thu, 5 Jun 2014 21:22:58 +0000 (23:22 +0200)
Better drawing of dN/deta and summary of dN/deta

Added possibility to select centrality estimator to
something stored in the AOD header.  In principle we should do
the same for the IPz - however, one has to be a little careful
since we use the IPz in the ESD->AOD creation.  If one then
chooses another kind of vertex determination in the dN/deta pass
it could cause a bias.  Finally, we should also be able to use
trigger information stored in the AOD header, but I should check
that we do have all the needed information there.

PWGLF/FORWARD/analysis2/AddTaskCentraldNdeta.C
PWGLF/FORWARD/analysis2/AddTaskForwarddNdeta.C
PWGLF/FORWARD/analysis2/AddTaskMCTruthdNdeta.C
PWGLF/FORWARD/analysis2/AliBaseAODTask.cxx
PWGLF/FORWARD/analysis2/AliBaseAODTask.h
PWGLF/FORWARD/analysis2/AliBasedNdetaTask.cxx
PWGLF/FORWARD/analysis2/AliBasedNdetaTask.h
PWGLF/FORWARD/analysis2/DrawdNdeta.C
PWGLF/FORWARD/analysis2/scripts/SummarydNdetaDrawer.C
PWGLF/FORWARD/analysis2/trains/MakedNdetaTrain.C

index 9370d29feacb7a333b9c440f9590b8a5eb40e837..d81b8d671cd7579241dddad393b9fa36206fe87a 100644 (file)
  * @ingroup pwglf_forward_dndeta
  */
 AliAnalysisTask*
-AddTaskCentraldNdeta(const char* trig      = "INEL", 
+AddTaskCentraldNdeta(const char* config    = "dNdetaConfig.C",
+                    const char* trig      = "INEL", 
                     Double_t    vzMin     = -10, 
                     Double_t    vzMax     = +10, 
-                    Bool_t      useCent   = false,
+                    const char* cent      = "",
                     const char* scheme    = 0,
-                    Bool_t      cutEdges  = false,
                     Double_t    trigEff   = 1, 
                     Double_t    trigEff0  = 1,
-                    Bool_t      corrEmpty = true,
-                    const char* mcanalysisfilename = "none")
+                    Bool_t      satVtx    = false)
 {
   // --- Load libraries ----------------------------------------------
   gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
@@ -55,7 +54,6 @@ AddTaskCentraldNdeta(const char* trig      = "INEL",
 
   // --- Make our object ---------------------------------------------
   AliCentraldNdetaTask* task = new AliCentraldNdetaTask("Central");
-  task->SetMCFinalCorrFilename(mcanalysisfilename);
   
   // Set the vertex range to use 
   task->SetIpZRange(vzMin, vzMax);
@@ -63,12 +61,7 @@ AddTaskCentraldNdeta(const char* trig      = "INEL",
   task->SetTriggerMask(trig);
   task->SetTriggerEff(trigEff); // 0.997535);
   task->SetTriggerEff0(trigEff0); 
-  // Whether to cut edges when re-binning 
-  task->SetCutEdges(cutEdges);
-  // Whether to correct for empty bins when projecting 
-  task->SetCorrEmpty(corrEmpty);
-  // Whether to use TH2::ProjectionX 
-  task->SetUseROOTProjectX(false);
+
   // Bit mask of 
   // 
   //    kNone               Normalise to accepted events 
@@ -91,10 +84,17 @@ AddTaskCentraldNdeta(const char* trig      = "INEL",
   // Note, that a bin specified as a-b, covers the interval from a,
   // inclusive to b exclusive.  An upper bound of 100 is treated
   // especially, and the upper bound is inclusive in that case .
-  if (useCent) {
-    Short_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100 };
-    task->SetCentralityAxis(10, bins);
+  if (cent) {
+    if (task->SetCentralityMethod(cent)) {
+      Short_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100 };
+      task->SetCentralityAxis(10, bins);
+    }
   }
+
+  // Set-up task using a script 
+  task->Configure(config);
+
+  // Connect to manager 
   task->Connect(0,0);
 
   return task;
index 4e84b99ffbb1e789a416e62576f0b965b56bb7aa..cf3fbf00808af4e706c867f7277add46b70a7e05 100644 (file)
  * @ingroup pwglf_forward_dndeta
  */
 AliAnalysisTask*
-AddTaskForwarddNdeta(const char* trig     = "INEL", 
+AddTaskForwarddNdeta(const char* config   = "dNdetaConfig.C",
+                    const char* trig     = "INEL", 
                     Double_t    vzMin    = -10, 
                     Double_t    vzMax    = +10, 
-                    Bool_t      useCent  = false,
+                    const char* cent     = "none",
                     const char* scheme   = 0,
-                    Bool_t      cutEdges = false,
                     Double_t    trigEff  = 1, 
                     Double_t    trigEff0 = 1,
-                    Bool_t      corrEmpty= false,
-                    Bool_t      satVtx   = false,
-                    const char* mcanalysisfilename = "/home/hehi/alex/work/dispVtxDNdeta/mcCorrectionPos.root")
+                    Bool_t      satVtx   = false)
 {
   // --- Load libraries ----------------------------------------------
   gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
@@ -58,8 +56,6 @@ AddTaskForwarddNdeta(const char* trig     = "INEL",
 
   // --- Make our object ---------------------------------------------
   AliForwarddNdetaTask* task = new AliForwarddNdetaTask("Forward");
-  //Set the filename of the corresponding MC analysis
-  task->SetMCFinalCorrFilename(mcanalysisfilename);
   
   // Set the vertex range to use 
   task->SetIpZRange(vzMin, vzMax);
@@ -68,13 +64,6 @@ AddTaskForwarddNdeta(const char* trig     = "INEL",
   // Set the trigger efficiency 
   task->SetTriggerEff(trigEff); // 0.997535);
   task->SetTriggerEff0(trigEff0); 
-  // Whether to cut edges when re-binning 
-  task->SetCutEdges(cutEdges);
-  // Whether to correct for empty bins when projecting 
-  // task->SetCorrEmpty(true);
-  task->SetCorrEmpty(corrEmpty);
-  // Whether to use TH2::ProjectionX 
-  task->SetUseROOTProjectX(false);
   // Bit mask of 
   // 
   //    kNone           Normalise to accepted events 
@@ -99,14 +88,22 @@ AddTaskForwarddNdeta(const char* trig     = "INEL",
   // Note, that a bin specified as a-b, covers the interval from a,
   // inclusive to b exclusive.  An upper bound of 100 is treated
   // especially, and the upper bound is inclusive in that case .
-  if (useCent) {
-    Short_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100 };
-    task->SetCentralityAxis(10, bins);
+  if (cent) {
+    Info("", "Centrality estimator is %s (AddTask)", cent);
+    if (task->SetCentralityMethod(cent)) {
+      Short_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100 };
+      task->SetCentralityAxis(10, bins);
+    }
   }
   // Set satellite vertex flag
   task->SetSatelliteVertices(satVtx);
 
+  // Set-up task using a script 
+  task->Configure(config);
+  
+  // Connect to manager 
   task->Connect(0,0);
+
   return task;
 }
 
index f4d7f3df96247c14a34b1147b981abd92ddd8e2f..79c27db80d23fbb5ee1850ca71dca2867a7a9707 100644 (file)
  * @ingroup pwglf_forward_dndeta
  */
 AliAnalysisTask*
-AddTaskMCTruthdNdeta(const char* trig      = "INEL", 
+AddTaskMCTruthdNdeta(const char* config    = "dNdetaConfig.C",
+                    const char* trig      = "INEL", 
                     Double_t    vzMin     = -10, 
                     Double_t    vzMax     = +10, 
-                    Bool_t      useCent   = false,
+                    const char* cent      = "",
                     const char* scheme    = 0,
-                    Bool_t      cutEdges  = false,
                     Double_t    trigEff   = 1, 
                     Double_t    trigEff0  = 1,
-                    Bool_t      corrEmpty = false)
+                    Bool_t      satOnly   = false)
 {
   // --- Load libraries ----------------------------------------------
   gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
@@ -52,12 +52,6 @@ AddTaskMCTruthdNdeta(const char* trig      = "INEL",
   // Set the trigger efficiency 
   task->SetTriggerEff(trigEff); // 0.997535);
   task->SetTriggerEff0(trigEff0);
-  // Whether to cut edges when re-binning 
-  task->SetCutEdges(cutEdges);
-  // Whether to correct for empty bins when projecting 
-  task->SetCorrEmpty(corrEmpty);
-  // Whether to use TH2::ProjectionX 
-  task->SetUseROOTProjectX(false);
   // Bit mask of 
   // 
   //    kNone           Normalise to accepted events 
@@ -83,9 +77,18 @@ AddTaskMCTruthdNdeta(const char* trig      = "INEL",
   // inclusive to b exclusive.  An upper bound of 100 is treated
   // especially, and the upper bound is inclusive in that case .
   if (useCent) {
-    Short_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
-    task->SetCentralityAxis(11, bins);
+    if (task->SetCentralityMethod(cent)) {
+      Short_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
+      task->SetCentralityAxis(11, bins);
+    }
   }
+  // Set satellite vertex flag
+  task->SetSatelliteVertices(satOnly);
+
+  // Set-up task using a script 
+  task->Configure(config);
+  
+  // Connect to manager 
   task->Connect(0,0);
 
   return task;
index 976927d1b50af67f8089d819e99351a49d65f767..eb1508990f47455a64ceeb6e10e9c12b73f45ae2 100644 (file)
@@ -6,6 +6,8 @@
 #include <AliLog.h>
 #include <AliAODEvent.h>
 #include <TROOT.h>
+#include <TSystem.h>
+#include <TInterpreter.h>
 
 //____________________________________________________________________
 AliBaseAODTask::AliBaseAODTask()
@@ -27,7 +29,8 @@ AliBaseAODTask::AliBaseAODTask()
 {
 }
 //____________________________________________________________________
-AliBaseAODTask::AliBaseAODTask(const char* name)
+AliBaseAODTask::AliBaseAODTask(const char* name,
+                              const char* title)
   : AliAnalysisTaskSE(name),
     fTriggerMask(0xFFFFFFFF), 
     fMinIpZ(0), 
@@ -44,11 +47,44 @@ AliBaseAODTask::AliBaseAODTask(const char* name)
     fSums(0), 
     fResults(0)
 {
+  SetTitle(title && title[0] != '\0' ? title : this->ClassName());
   fCentAxis.SetName("centAxis");
   fCentAxis.SetTitle("Centrality [%]");
   DefineOutput(1, TList::Class());
   DefineOutput(2, TList::Class());
 }
+
+//____________________________________________________________________
+Bool_t 
+AliBaseAODTask::Configure(const char* macro)
+{
+  // --- Configure the task ------------------------------------------
+  TString macroPath(gROOT->GetMacroPath());
+  if (!macroPath.Contains("$(ALICE_ROOT)/PWGLF/FORWARD/analysis2")) { 
+    macroPath.Append(":$(ALICE_ROOT)/PWGLF/FORWARD/analysis2");
+    gROOT->SetMacroPath(macroPath);
+  }
+  TString mac(macro);
+  if (mac.EqualTo("-default-")) 
+    mac = "$(ALICE_ROOT)/PWGLF/FORWARD/analysis2/dNdetaConfig.C";
+  const char* config = gSystem->Which(gROOT->GetMacroPath(), mac.Data());
+  if (!config) {
+    AliWarningF("%s not found in %s", mac.Data(), gROOT->GetMacroPath());
+    return false;
+  }
+  // if (gInterpreter->IsLoaded(config)) 
+  // gInterpreter->UnloadFile(config);
+
+  AliInfoF("Loading configuration of '%s' from %s",  ClassName(), config);
+  gROOT->Macro(Form("%s((%s*)%p)", config, GetTitle(), this));
+  
+  Info("Configure", "Unloading configuration script");
+  gInterpreter->UnloadFile(config);
+  delete config;
+ return true;
+}
+
 //________________________________________________________________________
 void 
 AliBaseAODTask::SetTriggerMask(const char* mask)
@@ -168,7 +204,7 @@ AliBaseAODTask::UserCreateOutputObjects()
   fVertex->SetFillStyle(3001);
   fVertex->SetLineColor(kRed+2);
   fSums->Add(fVertex);
-  fAccVertex = static_cast<TH1*>(fVertex->Clone("vertexAcc"));
+  fAccVertex = static_cast<TH1D*>(fVertex->Clone("vertexAcc"));
   fAccVertex->SetTitle("IP_{z} of accepted events");
   fAccVertex->SetDirectory(0);
   fAccVertex->SetFillColor(kGreen+2);
@@ -183,7 +219,7 @@ AliBaseAODTask::UserCreateOutputObjects()
   fCent->SetLineColor(kRed+2);
   fCent->SetDirectory(0);
   fSums->Add(fCent);
-  fAccCent = static_cast<TH1*>(fCent->Clone("centAcc"));
+  fAccCent = static_cast<TH1D*>(fCent->Clone("centAcc"));
   fAccCent->SetTitle("Centrality of accepted events");
   fAccCent->SetDirectory(0);
   fAccCent->SetFillColor(kGreen+2);
index 7027cfbbb5a0c93813ce4999cef7b4d9ac9b0de5..7b5da49cc0723325667e608e93eb1a4ed3390dde 100644 (file)
@@ -22,12 +22,22 @@ public:
    * Constructor 
    * 
    * @param name Name of task 
+   * @param title Class name used in configuration script 
    */
-  AliBaseAODTask(const char* name);
+  AliBaseAODTask(const char* name,
+                const char* title);
   /** 
    * Destructor
    */
   virtual ~AliBaseAODTask() {} 
+  /** 
+   * Configure this task via a macro 
+   * 
+   * @param macro Macro to configure va 
+   * 
+   * @return true on success, false otherwise
+   */
+  virtual Bool_t Configure(const char* macro="dNdetaConfig.C");
   /** 
    * @{ 
    * @name Set parameters 
@@ -252,12 +262,12 @@ protected:
   Double_t fMinIpZ;        // Least z--coordiante of interaction point
   Double_t fMaxIpZ;        // Largest z--coordiante of interaction point
   TAxis    fCentAxis;      // Centrality axis 
-  TH1    fTriggers;      // Histogram of triggers
-  TH1    fEventStatus;   // Histogram of event selection 
-  TH1    fVertex;        // Vertex distribution of all events 
-  TH1    fCent;          // Centrality distribution of all events
-  TH1    fAccVertex;     // Vertex distribution of accepted events 
-  TH1    fAccCent;       // Centrality distribution of accepted events
+  TH1I*    fTriggers;      // Histogram of triggers
+  TH1I*    fEventStatus;   // Histogram of event selection 
+  TH1D*    fVertex;        // Vertex distribution of all events 
+  TH1D*    fCent;          // Centrality distribution of all events
+  TH1D*    fAccVertex;     // Vertex distribution of accepted events 
+  TH1D*    fAccCent;       // Centrality distribution of accepted events
   Bool_t   fFirstEvent;    // Information stored or not 
   Bool_t   fCloneList;     // Wether to clone sum list for results
   TList*   fSums;          // Output list of sums
index abf033e8a2061f647f6517770f5644d4920625bf..3d0fc27e1146e84d6d0be518e631e9ebe16bd144 100644 (file)
@@ -31,7 +31,8 @@ AliBasedNdetaTask::AliBasedNdetaTask()
     fFinalMCCorrFile(""),
     fSatelliteVertices(0),
     fEmpiricalCorrection(0),
-    fMeanVsC(0)
+  fMeanVsC(0),
+  fCentMethod("VOM")
 {
   // 
   // Constructor
@@ -41,7 +42,7 @@ AliBasedNdetaTask::AliBasedNdetaTask()
 
 //____________________________________________________________________
 AliBasedNdetaTask::AliBasedNdetaTask(const char* name)
-  : AliBaseAODTask(Form("%sdNdeta", name)), 
+  : AliBaseAODTask(Form("%sdNdeta", name),"AliBasedNdetaTask"), 
     fRebin(5),         // Rebinning factor 
     fCutEdges(false), 
     fSymmetrice(true),
@@ -55,7 +56,8 @@ AliBasedNdetaTask::AliBasedNdetaTask(const char* name)
     fFinalMCCorrFile(""),
     fSatelliteVertices(0),
     fEmpiricalCorrection(0),
-    fMeanVsC(0)        
+    fMeanVsC(0),       
+    fCentMethod("VOM")
 {
   // 
   // Constructor
@@ -231,6 +233,83 @@ AliBasedNdetaTask::SetShapeCorrection(const TH2F* c)
   fShapeCorr = static_cast<TH2F*>(c->Clone());
   fShapeCorr->SetDirectory(0);
 }
+//____________________________________________________________________
+Bool_t
+AliBasedNdetaTask::SetCentralityMethod(const TString& method)
+{
+  TString meth(method);
+  meth.ToUpper();
+
+  // Info("", "Setting centrality estimator to %s", method.Data());
+  // Here, we make sure that the string is well formed, and 
+  // that the requested method exists.  If not, we bark. 
+  if (meth.EqualTo("NONE") || meth.EqualTo("NO") || meth.EqualTo("FALSE")) return false;
+  if      (meth.IsNull()               ||  // Default
+          meth.EqualTo("TRUE")        ||  // If --cent is given w/o arg
+          meth.EqualTo("DEFAULT")     ||  // Stored in Mult AOD object 
+          meth.EqualTo("AOD"))            // Stored in Mult AOD object 
+    meth = "";
+  else if (meth.EqualTo("V0M")         ||  // VZERO multiplicity  
+          meth.EqualTo("V0A")         ||  // VZERO A-side 
+          meth.EqualTo("V0A0")        ||  // VZERO A-side 
+          meth.EqualTo("V0A123")      ||  // VZERO A-side 
+          meth.EqualTo("V0C")         ||  // VZERO C-side 
+          meth.EqualTo("FMD")         ||  // FMD 
+          meth.EqualTo("TRK")         ||  // Tracks
+          meth.EqualTo("TKL")         ||  // Tracklets 
+          meth.EqualTo("CL0")         ||  // Clusters - layer 0 
+          meth.EqualTo("CL1")         ||  // Clusters - layer 1
+          meth.EqualTo("CND")         ||  // ? 
+          meth.EqualTo("ZNA")         ||  // ZDC corr A-side 
+          meth.EqualTo("ZNC")         ||  // ZDC corr C-side 
+          meth.EqualTo("ZPA")         ||  // ZDC protons A-side 
+          meth.EqualTo("ZPC")         ||  // ZDC protons C-side 
+          meth.EqualTo("NPA"))      // ?
+    ; // No-op
+  else if (meth.EqualTo("V0MEQ")       ||  // ? 
+          meth.EqualTo("V0AEQ")       ||  // ? 
+          meth.EqualTo("V0CEQ"))          // 
+    meth.ReplaceAll("EQ", "eq");
+  else if (meth.EqualTo("V0MVSFMD")    ||  // VZERO vs FMD multiplicity 
+          meth.EqualTo("TKLVSV0M")    ||  // Tracklets vs VZERO multiplicty
+          meth.EqualTo("ZEMVSZDC"))       // ZDC neutrons vs proton veto
+    meth.ReplaceAll("VS", "vs");
+  else if (meth.EqualTo("V0MTRUE")     ||  // VZERO multiplicity  
+          meth.EqualTo("V0ATRUE")     ||  // VZERO A-side 
+          meth.EqualTo("V0CTRUE")     ||  // VZERO C-side 
+          meth.EqualTo("FMDTRUE")     ||  // FMD 
+          meth.EqualTo("TRKTRUE")     ||  // Tracks
+          meth.EqualTo("TKLTRUE")     ||  // Tracklets 
+          meth.EqualTo("CL0TRUE")     ||  // Clusters - layer 0 
+          meth.EqualTo("CL1TRUE")     ||  // Clusters - layer 1
+          meth.EqualTo("CNDTRUE")     ||  // ? 
+          meth.EqualTo("ZNATRUE")     ||  // ZDC corr A-side 
+          meth.EqualTo("ZNCTRUE")     ||  // ZDC corr C-side 
+          meth.EqualTo("ZPATRUE")     ||  // ZDC protons A-side 
+          meth.EqualTo("ZPCTRUE"))       // ZDC protons C-side 
+    meth.ReplaceAll("TRUE", "true");
+  else if (meth.EqualTo("V0MEQTRUE")   ||  // VZERO multiplicity  
+          meth.EqualTo("V0AEQTRUE")   ||  // VZERO A-side 
+          meth.EqualTo("V0CEQTRUE"))      // VZERO C-side 
+    meth.ReplaceAll("EQTRUE", "Eqtrue");
+  else { 
+    AliErrorF("Unknown centrality estimator: %s", meth.Data());
+    return false;
+  }
+
+  if (fName.Contains("Forward", TString::kIgnoreCase) && 
+      meth.Contains("FMD")) 
+    AliWarningF("Centrality estimator %s used by %s - beware of auto-corr",
+               meth.Data(), fName.Data());  
+  else if (fName.Contains("Central", TString::kIgnoreCase) && 
+          (meth.Contains("CL0") || meth.Contains("TKL")))
+    AliWarningF("Centrality estimator %s used by %s - beware of auto-corr",
+               meth.Data(), fName.Data());
+
+  fCentMethod = meth;
+  return true;
+}
+
 //________________________________________________________________________
 void 
 AliBasedNdetaTask::InitializeCentBins()
@@ -261,6 +340,7 @@ AliBasedNdetaTask::Book()
   fSums->Add(AliForwardUtil::MakeParameter("empirical", 
                                           fEmpiricalCorrection != 0));
   fSums->Add(AliForwardUtil::MakeParameter("scheme", fNormalizationScheme));
+  fSums->Add(new TNamed("centEstimator", fCentMethod.Data()));
 
   // Make our centrality bins 
   InitializeCentBins();
@@ -326,19 +406,29 @@ AliBasedNdetaTask::Event(AliAODEvent& aod)
   // Loop over centrality bins 
   CentralityBin* allBin = 
     static_cast<CentralityBin*>(fListOfCentralities->At(0));
-  if (allBin->ProcessEvent(forward, fTriggerMask, isZero, 
-                          fMinIpZ, fMaxIpZ, data, dataMC)) taken = true;
+  if (allBin->ProcessEvent(forward, fTriggerMask, isZero, fMinIpZ, fMaxIpZ, 
+                          data, dataMC)) taken = true;
   
   // Find this centrality bin 
   if (HasCentrality()) {
     Double_t       cent    = forward->GetCentrality();
+    if (!fCentMethod.IsNull()) { 
+      AliAODHeader* hdr = aod.GetHeader();
+      if (hdr) { 
+       AliCentrality* cP = hdr->GetCentralityP();
+       if (cP) { 
+         cent = cP->GetCentralityPercentile(fCentMethod);
+       }
+      }
+    }
     Int_t          icent   = fCentAxis.FindBin(cent);
     CentralityBin* thisBin = 0;
     if (icent >= 1 && icent <= fCentAxis.GetNbins()) 
       thisBin = static_cast<CentralityBin*>(fListOfCentralities->At(icent));
     if (thisBin)
       if (thisBin->ProcessEvent(forward, fTriggerMask, isZero, fMinIpZ, 
-                               fMaxIpZ, data, dataMC)) taken = true;
+                               fMaxIpZ, data, dataMC)) 
+       taken = true;
   }
   
   return taken;
@@ -836,6 +926,7 @@ AliBasedNdetaTask::Print(Option_t* option) const
   PFV("Trigger efficiency",     fTriggerEff);
   PFV("Bin-0 Trigger efficiency", fTriggerEff0);
   PFV("Shape correction",       (fShapeCorr?fShapeCorr->GetName():"none"));;
+  PFV("Centrality estimator",    fCentMethod);
   gROOT->DecreaseDirLevel();  
 }
 
index 952011625dfa2010e813093037867d497bccd51f..7fddcb91a3946403e1325561670254dd5f4995b4 100644 (file)
@@ -159,6 +159,27 @@ public:
     * @param satVtx
     */
   void SetSatelliteVertices(Bool_t satVtx) { fSatelliteVertices = satVtx; }
+  /** 
+   * Set which centrality estimator to use - if not set, use the one
+   * from the Forward AOD object.  Note, the string is diagnosed, and
+   * if found not to be valid, then a the program terminates via a
+   * Fatal.
+   *
+   * @param method String definining centrality method (case insensitive)
+   * Typical values are 
+   * - V0M (e.g., PbPb)
+   * - V0A 
+   * - V0C 
+   * - FMD 
+   * - ZNA (e.g., pPb) 
+   * - ZNC (e.g., Pbp)
+   * - ZPA 
+   * - ZPC 
+   * - ZEMvsZDC
+   *
+   * @return true if @a method is valid estimator 
+   */
+  Bool_t SetCentralityMethod(const TString& method);
   /** 
    * Get a string representing the normalization scheme 
    * 
@@ -911,7 +932,8 @@ protected:
   Bool_t          fSatelliteVertices; // satellite vertex flag
   TH2D*           fEmpiricalCorrection; // Empirical correction 
   TH2D*          fMeanVsC;         //mean signal per event vs cent
-  ClassDef(AliBasedNdetaTask,14); // Determine charged particle density
+  TString         fCentMethod;    // Centrality estimator 
+  ClassDef(AliBasedNdetaTask,15); // Determine charged particle density
 };
 
 #endif
index 31bbca10c4237f81511959f9d05d761ad70d3412..4bb9cc6d78b9de45ede4eb9ee626dff89a1fd3d8 100644 (file)
@@ -32,6 +32,7 @@
 #include <TLegend.h>
 #include <TLegendEntry.h>
 #include <TLatex.h>
+#include <TArrow.h>
 #include <TImage.h>
 #include <TRandom.h>
 #include <TParameter.h>
@@ -58,25 +59,25 @@ Double_t myFunc(Double_t* xp, Double_t* pp);
 struct dNdetaDrawer 
 {
   enum EFlags { 
-    kShowRatios    = 0x00001, 
-    kShowLeftRight = 0x00002, 
-    kShowSysError  = 0x00004, 
-    kShowRings     = 0x00008,
-    kCutEdges      = 0x00010,
-    kRemoveOuters  = 0x00020, 
-    kUseFinalMC    = 0x00040,
-    kUseEmpirical  = 0x00080,
-    kForceMB       = 0x00100,
-    kMirror        = 0x00200,
-    kExport        = 0x00400, 
-    kAddExec       = 0x00800,
-    kOldFormat     = 0x01000,
-    kVerbose       = 0x02000,
-    kHiRes         = 0x04000,
-    kExtraWhite    = 0x08000,
-    kLogo          = 0x10000,
-    kNoCentral     = 0x20000,
-    kNoLabels      = 0x40000,
+    kShowRatios     = 0x00001, 
+    kShowLeftRight  = 0x00002, 
+    kShowSysError   = 0x00004, 
+    kShowRings      = 0x00008,
+    kCutEdges       = 0x00010,
+    kRemoveOuters   = 0x00020, 
+    kUseFinalMC     = 0x00040,
+    kUseEmpirical   = 0x00080,
+    kForceMB        = 0x00100,
+    kMirror         = 0x00200,
+    kExport         = 0x00400, 
+    kAddExec        = 0x00800,
+    kOldFormat      = 0x01000,
+    kVerbose        = 0x02000,
+    kHiRes          = 0x04000,
+    kExtraWhite      = 0x08000,
+    kLogo           = 0x10000,
+    kNoCentral      = 0x20000,
+    kNoLabels       = 0x40000,
     kDefaultOptions = 0x1CE07
   };
   enum EOutFormat { 
@@ -397,14 +398,130 @@ struct dNdetaDrawer
    * @{ 
    * @name Main steering functions 
    */
+  void Run(const char* filename="forward_dndeta.root", 
+          const char* title="", 
+          const char* others="all",
+          const char* options="default",
+          const char* formats="all",
+          UShort_t    rebin=5,
+          Float_t     eff=0,
+          UShort_t    centMin=0, 
+          UShort_t    centMax=0, 
+          Float_t     vzMin=+999,
+          Float_t     vzMax=-999, 
+          const char* base="")
+  {
+    TString  ostr(others); ostr.ToUpper();
+    UShort_t obits = 0x0;
+    if (ostr.EqualTo("ALL")) obits = 0xf;
+    else { 
+      if (ostr.Contains("UA5"))   obits |= 0x1;
+      if (ostr.Contains("CMS"))   obits |= 0x2;
+      if (ostr.Contains("ALICE")) obits |= 0x4;
+      if (ostr.Contains("WIP"))   obits |= 0x8;
+    }
+   
+    TString fstr(options);
+    UInt_t fbits  = 0;
+    if (fstr.EqualTo("default", TString::kIgnoreCase)) fbits = kDefaultOptions;
+    else {
+      TObjArray* farr = fstr.Tokenize(" ,");
+      TIter next(farr);
+      TObjString* ftoken = 0;
+      while ((ftoken = static_cast<TObjString*>(next()))) {
+       TString& token = ftoken->String();
+       token.ToLower();
+       if      (token.BeginsWith("ratio"))         fbits |= kShowRatios;
+        else if (token.BeginsWith("asym"))          fbits |= kShowLeftRight;
+        else if (token.BeginsWith("left"))          fbits |= kShowLeftRight;
+        else if (token.BeginsWith("syse"))          fbits |= kShowSysError;
+        else if (token.BeginsWith("rings"))         fbits |= kShowRings;
+        else if (token.BeginsWith("noedge"))        fbits |= kCutEdges;
+        else if (token.BeginsWith("noout"))         fbits |= kRemoveOuters;
+        else if (token.BeginsWith("finalmc"))       fbits |= kUseFinalMC;
+        else if (token.BeginsWith("mb"))            fbits |= kForceMB;
+        else if (token.BeginsWith("mirror"))        fbits |= kMirror;
+        else if (token.BeginsWith("export"))        fbits |= kExport;
+        else if (token.BeginsWith("exec"))          fbits |= kAddExec;
+        else if (token.BeginsWith("old"))           fbits |= kOldFormat;
+        else if (token.BeginsWith("verbose"))       fbits |= kVerbose;
+        else if (token.BeginsWith("hires"))         fbits |= kHiRes;
+        else if (token.BeginsWith("extraw"))        fbits |= kExtraWhite;
+        else if (token.BeginsWith("logo"))          fbits |= kLogo;
+        else if (token.BeginsWith("nocentr"))       fbits |= kNoCentral;
+        else if (token.BeginsWith("nolabels"))      fbits |= kNoLabels;
+        else if (token.BeginsWith("empirical"))  {
+         fbits |= kUseEmpirical;
+         TObjArray* parts=token.Tokenize("=");
+         if (parts->GetEntriesFast() > 1) 
+           SetEmpirical(parts->At(1)->GetName());
+         delete parts;
+       }
+      }  
+      delete farr;
+    }
+    TString estr(formats); estr.ToUpper();
+    UShort_t ebits = 0x0;
+    if (ostr.EqualTo("ALL")) ebits = kAllFormats;
+    else { 
+      if (ostr.Contains("PNG"))  ebits |= kPNG;
+      if (ostr.Contains("PDF"))  ebits |= kPDF;
+      if (ostr.Contains("ROOT")) ebits |= kROOT;
+      if (ostr.Contains("C"))    ebits |= kScript;
+    }
+
+    Run(filename, title, rebin, obits, fbits, 0, 0, 0, eff, 
+       centMin, centMax, vzMin, vzMax, base, ebits);
+  }
   /** 
-   * Run the code to produce the final result. 
+   * Run the job
    * 
-   * @param filename  File containing the data 
+   * @param filename  Input file name  
+   * @param title     Title to put on plot
+   * @param rebin     Rebinning factor 
+   * @param others    Which other to draw 
+   * @param flags     Flags for the drawing 
+   * @param sys       (optional) Collision system
+   * @param sNN       (optional) Collision energy 
+   * @param trg       (optional) Trigger 
+   * @param eff       (optional) Efficiency 
+   * @param centMin   (optional) Least centrality 
+   * @param centMax   (optional) Largest centrality 
+   * @param vzMin     (optional) Least @f$ IP_z@f$ 
+   * @param vzMax     (optional) Largest @f$ IP_z@f$
+   * @param base      Basename for output files
+   * @param formats   Formats to export to 
    */
-  void Run(const char* filename="forward_dndeta.root",
-          UInt_t flags=kDefaultOptions, UInt_t formats=kAllFormats) 
+  void Run(const char* filename, 
+          const char* title, 
+          UShort_t    rebin, 
+          UShort_t    others=0x7, 
+          UInt_t      flags=kDefaultOptions,
+          UShort_t    sys=0,
+          UShort_t    sNN=0, 
+          UShort_t    trg=0, 
+          Float_t     eff=0, 
+          UShort_t    centMin=0, 
+          UShort_t    centMax=0, 
+          Float_t     vzMin=+999, 
+          Float_t     vzMax=-999,
+          const char* base="", 
+          UShort_t    formats=kAllFormats)
   {
+    SetRebin(rebin);
+    SetTitle(title);
+    SetShowOthers(others);
+    SetBase(base);
+    // 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) SetSNN(sNN);     // Collision energy per nucleon pair (GeV)
+    if (sys > 0) SetSys(sys);     // Collision system (1:pp, 2:PbPB)
+    if (trg > 0) SetTrigger(trg); // Collision trigger (1:INEL, 2:INEL>0, 4:NSD)
+    if (eff > 0) SetTriggerEfficiency(eff); // Trigger efficiency
+    if (vzMin < 999 && vzMax > -999) 
+      SetVertexRange(vzMin,vzMax); // Collision vertex range (cm)
+    SetCentralityRange(centMin,centMax); // Collision vertex range (cm)
+
     fOptions          = flags;
     fFormats          = formats;
     SetForwardSysError(flags & kShowSysError ? 0.076 : 0);
@@ -450,12 +567,19 @@ struct dNdetaDrawer
         "   Show ratios:                      %5s\n"
         "   Show Left/right:                  %5s\n"
         "   Show rings:                       %5s\n"
-        "   Export to file:                   %5s\n"
         "   Cut edges when rebinning:         %5s\n"
         "   Remove outer rings:               %5s\n"
-        "   Mirror to un-covered regions:     %5s\n"
         "   Force minimum bias:               %5s\n"
+        "   Mirror to un-covered regions:     %5s\n"
+        "   Export to file:                   %5s\n"
+        "   Add Zoom code:                    %5s\n"
+        "   Assume old format:                %5s\n"
+        "   Be verbose:                       %5s\n"
+        "   Hi-resolution plot:               %5s\n"
+        "   Extra whitespace:                 %5s\n"
+        "   Show logo:                        %5s\n"
         "   Show clusters:                    %5s\n"
+        "   Show y-axis labels:               %5s\n"
         "   Show other results:               0x%03x\n"
         "   Rebinning factor:                 %5d\n"
         "   Forward systematic error:         %5.1f%%\n"
@@ -468,15 +592,27 @@ struct dNdetaDrawer
         ((fOptions & kShowRatios)    ? "yes" : "no"), 
         ((fOptions & kShowLeftRight) ? "yes" : "no"),
         ((fOptions & kShowRings)     ? "yes" : "no"),
-        ((fOptions & kExport)        ? "yes" : "no"), 
         ((fOptions & kCutEdges)      ? "yes" : "no"),
         ((fOptions & kRemoveOuters)  ? "yes" : "no"),
-        ((fOptions & kMirror)        ? "yes" : "no"),
         ((fOptions & kForceMB)       ? "yes" : "no"),
+        ((fOptions & kMirror)        ? "yes" : "no"),
+        ((fOptions & kExport)        ? "yes" : "no"), 
+        ((fOptions & kAddExec)       ? "yes" : "no"), 
+        ((fOptions & kOldFormat)     ? "yes" : "no"), 
+        ((fOptions & kVerbose)       ? "yes" : "no"), 
+        ((fOptions & kHiRes)         ? "yes" : "no"), 
+        ((fOptions & kExtraWhite)    ? "yes" : "no"), 
+        ((fOptions & kLogo)          ? "yes" : "no"), 
         ((fOptions & kNoCentral)     ? "no"  : "yes"),
-        fShowOthers, fRebin, (100*fFwdSysErr), (100*fCenSysErr), 
+        ((fOptions & kNoLabels)      ? "no"  : "yes"),
+        fShowOthers, 
+        fRebin, 
+        (100*fFwdSysErr), 
+        (100*fCenSysErr), 
         (100*fTriggerEff),
-        fTitle.Data(), fClusterScale.Data(), fFinalMC.Data(), 
+        fTitle.Data(), 
+        fClusterScale.Data(), 
+        fFinalMC.Data(), 
         fEmpirical.Data());
 
     // --- Set the macro pathand load other data script --------------
@@ -626,6 +762,21 @@ struct dNdetaDrawer
        TF1* f   = FitMerged(tmp, low, high);
        MakeSysError(tmp, cen, fwd, f);
        delete f;
+
+       if (fOptions & kNoCentral) { 
+         // Split Sys error into two histograms 
+         const char* nme  = tmp->GetName();
+         TH1* tmpp = static_cast<TH1*>(tmp->Clone(Form("%s_a", nme)));
+         tmp->SetName(Form("%s_c", nme));
+         for (Int_t k = 1; k <= tmp->GetNbinsX(); k++) { 
+           Double_t x = tmp->GetXaxis()->GetBinCenter(k);
+           TH1* tmppp = (x < 0 ? tmpp : tmp);
+           tmppp->SetBinError(k, 0);
+           tmppp->SetBinContent(k, 0);
+         }
+         fResults->GetHists()->AddFirst(tmpp, "e5");
+       }
+
        if (fOptions & kVerbose) 
          Info("", "Adding systematic error histogram %s", tmp->GetName());
        fResults->GetHists()->AddFirst(tmp, "e5");
@@ -762,10 +913,15 @@ struct dNdetaDrawer
     UShort_t sys   = (fSysString  ? fSysString->GetUniqueID() : 0);
     UShort_t trg   = (fTrigString ? fTrigString->GetUniqueID() : 0);
     UShort_t snn   = (fSNNString  ? fSNNString->GetUniqueID() : 0);
+    if (centLow < centHigh) {
+      // Possibly modify trg according to method 
+    }
     Long_t   ret   = 
       gROOT->ProcessLine(Form("RefData::GetData(%d,%d,%d,%d,%d,%d);",
                              sys,snn,trg,centLow,centHigh,fShowOthers));
     if (!ret) {
+      Warning("", "RefData::GetData(%d,%d,0x%x,%d,%d,0x%x);",
+             sys,snn,trg,centLow,centHigh,fShowOthers);
       Warning("FetchOthers", 
              "No other data for %s %s %s %3d%%-%3d%% central (0x%x)", 
              fSysString  ? fSysString->GetTitle()  : "unknown", 
@@ -1127,7 +1283,9 @@ struct dNdetaDrawer
     c->SetBorderSize(0);
     c->SetBorderMode(0);
 
-    PlotResults(max, y1);
+    Double_t s = Float_t(h) / 900;
+
+    PlotResults(max, y1, s);
     c->cd();
 
     PlotRatios(rmax, y2, y1);
@@ -1231,7 +1389,8 @@ struct dNdetaDrawer
       if (t.Contains("mirrored")) { mirrorSeen = true; continue; }
       if (n.Contains("syserror")) { sysErrSeen = true; continue; }
       if (unique.FindObject(t.Data())) continue;
-      TObjString* s1 = new TObjString(hist->GetTitle());
+      // TObjString* s1 = new TObjString(hist->GetTitle());
+      TParameter<float>* s1 = new TParameter<float>(t,hist->GetMarkerSize());
       s1->SetUniqueID(((hist->GetMarkerStyle() & 0xFFFF) << 16) |
                      ((hist->GetMarkerColor() & 0xFFFF) <<  0));
       unique.Add(s1);
@@ -1245,7 +1404,8 @@ struct dNdetaDrawer
        TString n(g->GetTitle());
        if (n.Contains("mirrored")) continue;
        if (unique.FindObject(n.Data())) continue;
-       TObjString* s2 = new TObjString(n);
+       // TObjString* s2 = new TObjString(n);
+       TParameter<float>* s2 = new TParameter<float>(n,g->GetMarkerSize());
        s2->SetUniqueID(((g->GetMarkerStyle() & 0xFFFF) << 16) |
                         ((g->GetMarkerColor() & 0xFFFF) <<  0));
        unique.Add(s2);
@@ -1255,9 +1415,10 @@ struct dNdetaDrawer
 
     // Add legend entries for unique items only
     TIter nextu(&unique);
-    TObject* s = 0;
+    // TObject* s = 0;
+    TParameter<float>* s = 0;
     Int_t i = 0;
-    while ((s = nextu())) { 
+    while ((s = static_cast<TParameter<float>*>(nextu()))) { 
       TLegendEntry* dd = l->AddEntry(Form("data%2d", i++), 
                                     s->GetName(), "lp");
       Int_t style = (s->GetUniqueID() >> 16) & 0xFFFF;
@@ -1266,6 +1427,7 @@ struct dNdetaDrawer
       if (HasCent()) dd->SetMarkerColor(kBlack);
       else           dd->SetMarkerColor(color);
       dd->SetMarkerStyle(style);
+      dd->SetMarkerSize(s->GetVal());
     }
     if (sysErrSeen) {
       // Add entry for systematic errors 
@@ -1368,7 +1530,7 @@ struct dNdetaDrawer
    * @param max       Maximum 
    * @param yd        Bottom position of pad 
    */
-  void PlotResults(Double_t max, Double_t yd) 
+  void PlotResults(Double_t max, Double_t yd, Double_t s
   {
     // --- Make a sub-pad for the result itself ----------------------
     TPad* p1 = new TPad("p1", "p1", 0, yd, 1.0, 1.0, 0, 0, 0);
@@ -1396,6 +1558,11 @@ struct dNdetaDrawer
            //"#frac{1}{#it{N}}#kern[.1]{#frac{d#it{N}_{ch}}{d#it{#eta}}}"
            );
 
+    // --- Fix up marker size ---------------------------------------
+    TIter next(fResults->GetHists());
+    TH1*  h = 0;
+    while ((h = static_cast<TH1*>(next()))) 
+      h->SetMarkerSize(h->GetMarkerSize()*s);
     // --- Clear pad and re-draw ------------------------------------
     p1->Clear();
     fResults->DrawClone("nostack e1");
@@ -1404,8 +1571,18 @@ struct dNdetaDrawer
     if (fShowOthers != 0) {
       TGraphAsymmErrors* o      = 0;
       TIter              nextG(fOthers->GetListOfGraphs());
-      while ((o = static_cast<TGraphAsymmErrors*>(nextG())))
+      while ((o = static_cast<TGraphAsymmErrors*>(nextG()))) {
+       Double_t gS = s;
+       switch (o->GetMarkerStyle()) { 
+       case 29: 
+       case 30: gS *= 1.2; break; // Star              
+       case 27: 
+       case 33: gS *= 1.2; break; // Diamond
+       }
+       o->SetMarkerSize(o->GetMarkerSize()*gS);
+         
         o->DrawClone("same p");
+      }
     }
 
     // --- Make a legend in the result pad ---------------------------
@@ -1448,14 +1625,25 @@ struct dNdetaDrawer
     UShort_t    snn = fSNNString->GetUniqueID();
     const char* sys = fSysString->GetTitle();
     if (snn == 2750) snn = 2760;
-    if (snn > 1000) eS = Form("%4.2fTeV", float(snn)/1000);
-    else            eS = Form("%3dGeV", snn);
+    if (snn < 1000)           eS = Form("%3dGeV", snn);
+    else if (snn % 1000 == 0) eS = Form("%dTeV", snn/1000);
+    else                      eS = Form("%.2fTeV", float(snn)/1000);
+    Bool_t nn = (fSysString->GetUniqueID() != 1);
+    TString tS(fTrigString->GetTitle());
+    if (HasCent()) { 
+      tS  = "by centrality";
+      UShort_t trg = fTrigString->GetUniqueID();
+      switch (trg) { 
+      case 0x10: tS.Append(" (V0M)"); break;
+      case 0x20: tS.Append(" (V0A)"); break;
+      case 0x40: tS.Append(" (ZNA)"); break;
+      case 0x80: tS.Append(" (ZNC)"); break;
+      }
+    }
+    
     TLatex* tt = new TLatex(xR, yR, Form("%s #sqrt{s%s}=%s, %s", 
-                                       sys, 
-                                       (HasCent() ? "_{NN}" : ""),
-                                       eS.Data(), 
-                                       HasCent() ? "by centrality" : 
-                                       fTrigString->GetTitle()));
+                                        sys, (nn ? "_{NN}" : ""),
+                                        eS.Data(), tS.Data()));
     tt->SetTextColor(kAliceBlue);
     tt->SetNDC();
     tt->SetTextFont(kFont);
@@ -1463,6 +1651,20 @@ struct dNdetaDrawer
     tt->Draw();
     yR -= tt->GetTextSize() + .01;
     
+    if (fSysString->GetUniqueID() == 3) { 
+      // pPb - put arrow at y_CM
+      UShort_t a1  = 1;
+      UShort_t a2  = 208;
+      UShort_t z1  = 1;
+      UShort_t z2  = 82;
+      Double_t yCM = .5 * TMath::Log(Float_t(z1*a2)/z2/a1);
+      TArrow*  a   = new TArrow(yCM, 0, yCM, 0.05*max, 0.01, "<|");
+      a->SetAngle(30);
+      a->SetFillColor(kAliceBlue);
+      a->SetLineColor(kAliceBlue);
+      a->Draw();
+    }
+
     // --- Put number of accepted events on the plot -----------------
     Int_t nev = 0;
     if (fTriggers) nev = fTriggers->GetBinContent(1);
@@ -1748,7 +1950,7 @@ struct dNdetaDrawer
   {
     if (!h) return;
     if (color < 0) return;
-    // h->SetLineColor(color);
+    h->SetLineColor(color);
     h->SetMarkerColor(color);
     // h->SetFillColor(color);
   }
@@ -2346,6 +2548,7 @@ struct dNdetaDrawer
       Warning("FixAxis", "No stack passed for %s!", ytitle);
       return;
     }
+    Bool_t supLabel = (fResults == stack && ((fOptions & kNoLabels)));
     if (force) stack->Draw("nostack e1");
 
     TH1* h = stack->GetHistogram();
@@ -2385,7 +2588,7 @@ struct dNdetaDrawer
       ya->SetNdivisions(ynDiv);
       ya->SetTitleSize(s*ya->GetTitleSize());
       ya->SetTitleOffset(/*1.15*/1.4*ya->GetTitleOffset()/s);
-      ya->SetLabelSize((fOptions & kNoLabels) ? 0 : s*ya->GetLabelSize());
+      ya->SetLabelSize(supLabel ? 0 : s*ya->GetLabelSize());
     }
   }
   //__________________________________________________________________
@@ -2874,22 +3077,101 @@ DrawdNdeta(const char* filename="forward_dndeta.root",
     return;
   }
   dNdetaDrawer* pd = new dNdetaDrawer;
-  dNdetaDrawer& d = *pd;
-  d.SetRebin(rebin);
-  d.SetTitle(title);
-  d.SetShowOthers(others);
-  d.SetBase(base);
-  d.SetEmpirical("file://../empirical.root#default");
+  pd->SetEmpirical("file://../empirical.root#default");
   // 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)
-  if (sys > 0) d.SetSys(sys);     // Collision system (1:pp, 2:PbPB)
-  if (trg > 0) d.SetTrigger(trg); // Collision trigger (1:INEL, 2:INEL>0, 4:NSD)
-  if (eff > 0) d.SetTriggerEfficiency(eff); // Trigger efficiency
-  if (vzMin < 999 && vzMax > -999) 
-    d.SetVertexRange(vzMin,vzMax); // Collision vertex range (cm)
-  d.SetCentralityRange(centMin,centMax); // Collision vertex range (cm)
-  d.Run(filename, flags, outflg);
+  pd->Run(filename, title, rebin, others, flags, sys, sNN, trg, eff,
+         centMin, centMax, vzMin, vzMax, base, outflg);
+}
+
+/** 
+ * Display usage information
+ * 
+ */
+void
+UsageS()
+{
+  std::ostream& o = std::cout;
+  o << "Usage: DrawdNdeta(FILE,TITLE,OTHERS,OPTIONS,FORMATS,REBIN,EFF,"
+    << "CMIN,CMAX,IPZMIN,IPZMAX,BASE)\n"
+    << "  const char* FILE   File name to open (\"forward_dndeta.root\")\n"
+    << "  const char* TITLE  Title to put on plot (\"\")\n"
+    << "  const char* OTHERS Other data to draw - more below (\"all\")\n"
+    << "  const char* FLAGS  Visualisation flags - more below (\"default\")\n"
+    << "  const char* FMT    (optional) Output formats (\"all\")\n"
+    << "  UShort_t    REBIN  (optional) Rebinning factor (5)\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"
+    << "  UShort_t    CMIN   (optional) Least centrality\n"
+    << "  UShort_t    CMAX   (optional) Largest centrality\n"
+    << "  const char* BASE   (optional) base name of output files\n"
+    << "\n";
+  o << " OTHERS space separated list of\n"
+    << "  UA5     Show UA5 data (INEL,NSD, ppbar, 900GeV)\n"
+    << "  CMS     Show CMS data (NSD, pp)\n"
+    << "  ALICE   Show published ALICE data (INEL,INEL>0,NSD, pp)\n"
+    << "  WIP     Show event genertor data/work-in-progress\n"
+    << "\n";
+  o << " FMT space separated list of \n"
+    << "  PNG     Make PNG output\n"
+    << "  PDF     Make PDF output\n"
+    << "  ROOT    Make ROOT file output\n"
+    << "  C       Make ROOT script output\n"
+    << "\n";
+  o << " FLAGS is a bit mask of\n"
+    << "  ratio           Show ratios of data to other data and possibly MC\n"
+    << "  asymmetry       Show left-right asymmetry\n"
+    << "  syserror        Show systematic error band\n"
+    << "  rings           Show individual ring results (INEL only)\n"
+    << "  noedges         Cut edges when rebinning\n"
+    << "  noouters        Remove FMDxO points\n"
+    << "  finalmc         Apply `final MC' correction\n"
+    << "  empirical[=URL] Apply `Emperical' correction\n"
+    << "  mb              Force use of MB\n"
+    << "  mirror          Mirror data\n"
+    << "  export          Export results to script\n"
+    << "  exec            Add code to do combined zooms on eta axis\n"
+    << "  old             Assume old-style input\n"
+    << "  verbose         Be verbose\n"
+    << "  hires           Hi-res batch output\n"
+    << "  extrawhite      Add aditional white-space above results\n"
+    << "  logo            Add ALICE logo\n"
+    << "  nocentral       Do not plot cluster data\n"
+    << "  nolabels        No labels on y-axis\n"
+    << "\n";
+  o << "finalmc requires the file forward_dndetamc.root\n"
+    << "empirical requires the histogram at URL \n"
+    << std::endl;
+
+}
+
+void 
+Draw(const char* filename,
+     const char* title="",
+     const char* others="ALL",
+     const char* options="DEFAULT",
+     const char* outFlg="ALL",
+     UShort_t    rebin=5,
+     Float_t     eff=0, 
+     UShort_t    centMin=0, 
+     UShort_t    centMax=0, 
+     Float_t     vzMin=+999,
+     Float_t     vzMax=-999,
+     const char* base="")
+{
+  TString fname(filename);
+  fname.ToLower();
+  if (fname.CompareTo("help") == 0 || 
+      fname.CompareTo("--help") == 0) { 
+    UsageS();
+    return;
+  }
+
+  dNdetaDrawer* pd = new dNdetaDrawer;
+  pd->SetEmpirical("file://../empirical.root#default");
+
+  pd->Run(filename, title, others, options, outFlg, rebin, eff, 
+         centMin, centMax, vzMin, vzMax, base);
 }
 //____________________________________________________________________
 //
index c39f5524f9c133eebeb3e956c417880c717a2ff4..9839f9f2fbd0ab77b579f28810b4191a5c867aac 100644 (file)
@@ -516,6 +516,7 @@ protected:
     TH1* dndeta      = GetH1(c, Form("dndeta%s",base.Data()));
     TH2* d2ndetadphi = GetH2(c, Form("d2Ndetadphi%s", base.Data()));
     if (!trig || !norm || !dndeta || !d2ndetadphi) return;
+    if (norm->GetEntries() <= 0) return;
 
     norm->SetFillColor(kGreen+1);
     norm->SetFillStyle(3001);
index 0639a885639ae840fd23d6dad831172971055b67..8f723ebb5794e76868f1cc65324ace1e90019dbb 100644 (file)
@@ -36,12 +36,15 @@ public:
     fOptions.Add("scheme",   "SCHEME", "Normalization scheme", "");
     fOptions.Add("trigEff",  "EFFICENCY", "Trigger effeciency", "1");
     fOptions.Add("trigEff0", "EFFICENCY", "0-bin trigger effeciency", "1");
-    fOptions.Add("cent",     "Use centrality");
-    fOptions.Add("cut-edges", "Cut acceptance edges");
-    fOptions.Add("corr-empty", "Correct for empty bins (deprecated)");
+    fOptions.Add("cent",     "ESTIMATOR", "Use centrality", "none");
     fOptions.Add("mc",       "Also make dN/deta for MC truth");
-    fOptions.Add("mc-corr",  "FILE", "MC corrections file", "");
     fOptions.Add("satellite","Restrict analysis to satellite events", false);
+    fOptions.Add("forward-config", "FILE", "Forward configuration", 
+                "dNdetaConfig.C");
+    fOptions.Add("central-config", "FILE", "Central configuration", 
+                "dNdetaConfig.C");
+    fOptions.Add("truth-config", "FILE", "MC-Truth configuration", 
+                "dNdetaConfig.C");
   }
 protected:
   /** 
@@ -67,27 +70,35 @@ protected:
     Double_t vzMax   = fOptions.AsDouble("vzmax", +10);
     Double_t effT    = fOptions.AsDouble("trigEff", 1);
     Double_t effT0   = fOptions.AsDouble("trigEff0", 1);
-    Bool_t   cent    = fOptions.Has("cent");
-    Bool_t   edges   = fOptions.Has("cut-edges");
-    Bool_t   corrEm  = fOptions.Has("corr-empty");
+    TString  cent    = fOptions.Get("cent");
     Bool_t   mc      = fOptions.Has("mc");
-    TString  mccorr  = fOptions.AsString("mc-corr", "");
     Bool_t   satonly = fOptions.AsBool("satellite");
+    TString  fwdCfg  = fOptions.Get("forward-config");
+    TString  cenCfg  = fOptions.Get("central-config");
+    TString  mcCfg   = fOptions.Get("truth-config");
     if (!mc) mc      = fHelper->IsMC(); 
+    if (!fOptions.Has("cent")) cent="none";
+
+    Info("", "Centrality option is '%s'", cent.Data());
+    fOptions.Show(std::cout);
 
     // --- Form arguments --------------------------------------------
-    TString args;
-    args.Form("\"%s\",%f,%f,%d,\"%s\",%d,%g,%g,%d",
-             trig.Data(), vzMin, vzMax, cent, scheme.Data(),
-             edges, effT, effT0, corrEm);
-    TString fargs(args);
-    fargs.Append(Form(",%d,\"%s\"",satonly, mccorr.Data()));
+    TString fargs;
+    fargs.Form("\"%s\",\"%s\",%f,%f,\"%s\",\"%s\",%g,%g,%d",
+              fwdCfg.Data(), trig.Data(), vzMin, vzMax, cent.Data(), 
+              scheme.Data(), effT, effT0, satonly);
+    TString cargs(fargs);
+    cargs.ReplaceAll(fwdCfg, cenCfg);
+    // Info("", "fargs=\"%s\", cargs=\"%s\"", fargs.Data(), cargs.Data()); 
 
     // --- Add the task ----------------------------------------------
     gROOT->Macro(Form("AddTaskForwarddNdeta.C(%s);", fargs.Data()));
-    gROOT->Macro(Form("AddTaskCentraldNdeta.C(%s);", args.Data()));
-    if (mc) 
-      gROOT->Macro(Form("AddTaskMCTruthdNdeta.C(%s);", args.Data()));
+    gROOT->Macro(Form("AddTaskCentraldNdeta.C(%s);", cargs.Data()));
+    if (mc) {
+      TString margs(fargs);
+      margs.ReplaceAll(fwdCfg, mcCfg);
+      gROOT->Macro(Form("AddTaskMCTruthdNdeta.C(%s);", margs.Data()));
+    }
   }
   //__________________________________________________________________
   /** 
@@ -169,8 +180,21 @@ protected:
     }
 
     o << "// Created by " << ClassName() << "\n"
-      << "// \n"
-      << "// Will draw dN/deta results from produced file\n"
+      << "Bool_t SetupDrawer(const TString& title, Bool_t old)\n"
+      << "{\n"
+      << "  const char* fwd=\"$ALICE_ROOT/PWGLF/FORWARD/analysis2\";\n"
+      << "  gROOT->LoadMacro(Form(\"%s/DrawdNdeta.C+\",fwd));\n"
+      << "  if (title.EqualTo(\"help\",TString::kIgnoreCase)) {\n"
+      << "    if (old)\n"
+      << "      DrawdNdeta(\"help\",\"\",5); // Get the help\n"
+      << "    else\n"
+      << "      DrawdNdeta(\"help\",\"\",\"\"); // Get the help\n"
+      << "    return false;\n"
+      << "  }\n"
+      << "  return true;\n"
+      << "}\n"
+      << std::endl;
+    o << "// Will draw dN/deta results from produced file\n"
       << "// \n"
       << "// Options can be specified as needed. To get help, pass the\n"
       << "// string \"help\" for the title:\n"
@@ -190,12 +214,7 @@ protected:
       << "          Float_t        vzMin=999,\n"
       << "          Float_t        vzMax=-999)\n"
       << "{\n"
-      << "  const char* fwd=\"$ALICE_ROOT/PWGLF/FORWARD/analysis2\";\n"
-      << "  gROOT->LoadMacro(Form(\"%s/DrawdNdeta.C+\",fwd));\n"
-      << "  if (title.EqualTo(\"help\",TString::kIgnoreCase)) {\n"
-      << "    DrawdNdeta(\"help\"); // Get the help\n"
-      << "    return;\n"
-      << "  }\n\n"
+      << "  if (!SetupDrawer(title, true)) return;\n"
       << "  DrawdNdeta(\"forward_dndeta.root\",\n"
       << "             title,\n"
       << "             rebin,\n"
@@ -209,8 +228,28 @@ protected:
       << "             centMax,\n"
       << "             vzMin,\n"
       << "             vzMax,\n"
-      <<"              \"dNdeta_<trig>\");\n"
+      << "              \"dNdeta_<trig>\");\n"
       << "}\n"
+      << std::endl;
+    o << "// Alternative using strings\n"
+      << "void Draw(const TString& title,\n"
+      << "          const TString& others=\"ALL\",\n"
+      << "          const TString& options=\"DEFAULT\",\n"
+      << "          const TString& formats=\"ALL\",\n"
+      << "          UShort_t       rebin=5,\n"
+      << "          Float_t        eff=0,\n"
+      << "          UShort_t       centMin=0,\n"
+      << "          UShort_t       centMax=0,\n"
+      << "          Float_t        vzMin=+999,\n"
+      << "          Float_t        vzMax=-999,\n"
+      << "          const TString& base="")\n"
+      << "{\n"
+      << "  if (!SetupDrawer(title, false)) return;\n"
+      << "  DrawdNdeta(\"forward_dndeta.root\",\n"
+      << "             title,others,options,formats,\n"
+      << "             rebin,eff,centMin,centMax,\n"
+      << "             vzMin,vzMax,\"dNdeta_<trig>\");\n"
+      << "}\n"  
       << "//\n"
       << "// EOF\n"
       << "//" << std::endl;