]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Segregated the Landau+Gaus function from the AliForwardUtil dumping
authorcholm <Christian.Holm.Christensen@cern.ch>
Fri, 11 Apr 2014 12:01:44 +0000 (14:01 +0200)
committercholm <Christian.Holm.Christensen@cern.ch>
Fri, 11 Apr 2014 15:10:21 +0000 (17:10 +0200)
ground.  Other minor changes to the overall code.

33 files changed:
PWGLF/CMakelibPWGLFforward2.pkg
PWGLF/FORWARD/analysis2/AddTaskForwardQA.C
PWGLF/FORWARD/analysis2/AliFMDCorrELossFit.cxx
PWGLF/FORWARD/analysis2/AliFMDCorrELossFit.h
PWGLF/FORWARD/analysis2/AliFMDEnergyFitter.cxx
PWGLF/FORWARD/analysis2/AliFMDEnergyFitter.h
PWGLF/FORWARD/analysis2/AliFMDMCHitEnergyFitterTask.h
PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.cxx
PWGLF/FORWARD/analysis2/AliForwardMCMultiplicityTask.h
PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.cxx
PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.h
PWGLF/FORWARD/analysis2/AliForwardUtil.cxx
PWGLF/FORWARD/analysis2/AliForwardUtil.h
PWGLF/FORWARD/analysis2/DrawAODSummary.C
PWGLF/FORWARD/analysis2/DrawMCCorrSummary.C
PWGLF/FORWARD/analysis2/DrawMultDistsSummary.C
PWGLF/FORWARD/analysis2/DrawdNdeta.C
PWGLF/FORWARD/analysis2/DrawdNdetaSummary.C
PWGLF/FORWARD/analysis2/corrs/CorrDrawer.C
PWGLF/FORWARD/analysis2/corrs/DrawCorrELoss.C
PWGLF/FORWARD/analysis2/corrs/MultCutDrawer.C
PWGLF/FORWARD/analysis2/corrs/RerunELossFits.C
PWGLF/FORWARD/analysis2/qa/RunQAMT.sh
PWGLF/FORWARD/analysis2/scripts/SummaryAODDrawer.C
PWGLF/FORWARD/analysis2/scripts/SummaryDrawer.C
PWGLF/FORWARD/analysis2/scripts/SummarydNdetaDrawer.C
PWGLF/FORWARD/analysis2/trains/MakeFMDELossTrain.C
PWGLF/FORWARD/analysis2/trains/MakedNdetaTrain.C
PWGLF/FORWARD/trains/ChainBuilder.C
PWGLF/FORWARD/trains/CreateFileCollection.C
PWGLF/FORWARD/trains/CreateIndex.C
PWGLF/FORWARD/trains/Helper.C
PWGLF/PWGLFforward2LinkDef.h

index 930cc9741f7adbcec00c245109b7370aca6e8714..30e848900eadbbfad9983842b83efc95e86408ea 100644 (file)
@@ -115,7 +115,11 @@ set ( SRCS
 )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
-set ( HDRS ${HDRS} FORWARD/analysis2/AliFMDStripIndex.h )
+set ( HDRS ${HDRS} 
+  FORWARD/analysis2/AliFMDStripIndex.h 
+  FORWARD/analysis2/AliLandauGaus.h 
+  FORWARD/analysis2/AliLandauGausFitter.h 
+  )
 
 set ( EINCLUDE  
   ANALYSIS 
@@ -131,6 +135,8 @@ set ( EXPORT FORWARD/analysis2/AliAODForwardMult.h
              FORWARD/analysis2/AliAODCentralMult.h 
             FORWARD/analysis2/AliOADBForward.h
              FORWARD/analysis2/AliForwardUtil.h  
+            FORWARD/analysis2/AliLandauGaus.h 
+            FORWARD/analysis2/AliLandauGausFitter.h 
             FORWARD/analysis2/AliFMDEventInspector.h
             FORWARD/analysis2/AliFMDMCEventInspector.h
             FORWARD/analysis2/AliForwardCorrectionManager.h
index 10f9705d1fa5c7680de7fd17385efd882c64b152..20463f77532c4fe1a3e7bd1b9897a4c6eaa31501 100644 (file)
@@ -30,38 +30,13 @@ AddTaskForwardQA(Bool_t mc=false, Bool_t useCent=false)
   // --- Load libraries ----------------------------------------------
   gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
 
-  // --- Get analysis manager ----------------------------------------
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  if (!mgr) {
-    Error("AddTaskForwardQA", "No analysis manager to connect to.");
-    return NULL;
-  }   
-  
   // --- Make the task and add it to the manager ---------------------
   AliForwardQATask* task = new AliForwardQATask("forwardQA");
-  mgr->AddTask(task);
-
 
   // --- Cuts --------------------------------------------------------
-  // Old style cuts
-  // Double_t nXi = mc ? 2 : 2;   //HHD test
-  // Bool_t   includeSigma = false; //true;
-  // High cuts for sharing filter
-  AliFMDMultCuts cHigh;
-  cHigh.SetMPVFraction(0.7);
-  cHigh.SetMultCuts(-1);
-  cHigh.SetNXi(2);
-  // cHigh.SetMultCuts(100);
-  // Low cuts for sharing and density calculator
-  AliFMDMultCuts cLow;
-  // cLow.SetMultCuts(0.1, 0.1, 0.12, 0.1, 0.12);
-  cLow.SetMultCuts(0.3, 0.3, 0.3, 0.3, 0.3);
-  // Density cuts
-  AliFMDMultCuts cDensity;
-  // cDensity.SetMPVFraction(0.7);
-  // cDensity.SetMultCuts(100);
-  cDensity.SetMultCuts(0.3, 0.3, 0.3, 0.3, 0.3);
-
+  AliFMDMultCuts cHigh(AliFMDMultCuts::kLandauWidth, 2,2,2,2,2);
+  AliFMDMultCuts cLow(AliFMDMultCuts::kFixed,0.15);
+  AliFMDMultCuts cDensity(AliFMDMultCuts::kLandauWidth, 4,4,4,4,4);
   
   // --- Set parameters on the algorithms ----------------------------
   // Set the number of SPD tracklets for which we consider the event a
@@ -103,61 +78,48 @@ AddTaskForwardQA(Bool_t mc=false, Bool_t useCent=false)
   task->GetSharingFilter().SetZeroSharedHitsBelowThreshold(false);
   // Enable use of angle corrected signals in the algorithm 
   task->GetSharingFilter().SetHCuts(cHigh);
-  // Multiplicity cut 
-  // task->GetSharingFilter().GetHCuts().SetMultCuts(-1);
-  // Set the number of xi's (width of landau peak) to stop at 
-  // task->GetSharingFilter().GetHCuts().SetNXi(nXi);
-  // Set whether or not to include sigma in cut
-  // task->GetSharingFilter().GetHCuts().SetIncludeSigma(includeSigma);
   // Lower cuts from object
   task->GetSharingFilter().SetLCuts(cLow);
-  // Use simplified sharing algorithm 
-  task->GetSharingFilter().SetUseSimpleSharing(kTRUE);
+  // Whether to use simple merging algorithm
+  task->GetSharingFilter().SetUseSimpleSharing(true);
+  // Whether to allow for 3 strip hits - deprecated
+  task->GetSharingFilter().SetAllow3Strips(false);
 
   // --- Density calculator ------------------------------------------
+  // Least acceptable quality of ELoss fits
+  task->GetDensityCalculator().SetMinQuality(8);
   // Set the maximum number of particle to try to reconstruct 
   task->GetDensityCalculator().SetMaxParticles(3);
   // Wet whether to use poisson statistics to estimate N_ch
   task->GetDensityCalculator().SetUsePoisson(true);
   // How to lump for Poisson calculator - 64 strips, 4 regions
-  task->GetDensityCalculator().SetLumping(64,4);
+  task->GetDensityCalculator().SetLumping(32,4);
   // Set whether or not to include sigma in cut
   task->GetDensityCalculator().SetCuts(cDensity);
+  // Set the maximum ratio of outlier bins to the total number of bins
+  // task->GetDensityCalculator().SetMaxOutliers(.10);
+  task->GetDensityCalculator().SetMaxOutliers(1.0);//Disable filter
   // Set whether or not to use the phi acceptance
   //   AliFMDDensityCalculator::kPhiNoCorrect
   //   AliFMDDensityCalculator::kPhiCorrectNch
   //   AliFMDDensityCalculator::kPhiCorrectELoss
-  task->GetDensityCalculator().
-    SetUsePhiAcceptance(AliFMDDensityCalculator::kPhiNoCorrect);
+  task->GetDensityCalculator()
+    .SetUsePhiAcceptance(AliFMDDensityCalculator::kPhiCorrectNch);
 
   // --- Set limits on fits the energy -------------------------------
   // Maximum relative error on parameters 
-  AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
+  // AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
   // Least weight to use 
-  AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
+  // AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
   // Maximum value of reduced chi^2 
-  AliFMDCorrELossFit::ELossFit::fgMaxChi2nu   = 20;
+  // AliFMDCorrELossFit::ELossFit::fgMaxChi2nu   = 20;
 
   // --- Debug -------------------------------------------------------
   // Set the overall debug level (1: some output, 3: a lot of output)
-  task->SetDebug(3);
+  task->SetDebug(1);
     
   // --- Make the output container and connect it --------------------
-  // TString outputfile = ;
-  // outputfile += ":PWGLFforwardDnDeta"; 
-  // Form(":%s",pars->GetDndetaAnalysisName());
-  AliAnalysisDataContainer* histOut = 
-    mgr->CreateContainer("Forward", TList::Class(), 
-                        AliAnalysisManager::kOutputContainer,
-                        AliAnalysisManager::GetCommonFileName());
-  AliAnalysisDataContainer *output = 
-    mgr->CreateContainer("ForwardResults", TList::Class(), 
-                        AliAnalysisManager::kParamContainer, 
-                        "trending.root");
-                        // AliAnalysisManager::GetCommonFileName());
-  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
-  mgr->ConnectOutput(task, 1, histOut);
-  mgr->ConnectOutput(task, 2, output);
+  task->Connect(AliAnalysisManager::GetCommonFileName(), "trending.root");
 
   return task;
 }
index 0315c74e98ff981b36b7f41eaefad3f09bce2f72..602be8b87e5cd591bfcd059ce4490247855d3a22 100644 (file)
@@ -4,6 +4,7 @@
 //
 #include "AliFMDCorrELossFit.h"
 #include "AliForwardUtil.h"
+#include "AliLandauGaus.h"
 #include <TF1.h>
 #include <TGraph.h>
 #include <TBrowser.h>
@@ -11,6 +12,7 @@
 #include <THStack.h>
 #include <TLatex.h>
 #include <TLegend.h>
+#include <TLine.h>
 #include <TH1D.h>
 #include <AliLog.h>
 #include <TMath.h>
@@ -55,22 +57,22 @@ AliFMDCorrELossFit::ELossFit::ELossFit()
 }
 //____________________________________________________________________
 AliFMDCorrELossFit::ELossFit::ELossFit(Int_t quality, const TF1& f)
-  : fN(f.GetNpar() > AliForwardUtil::ELossFitter::kN ? 
-       Int_t(f.GetParameter(AliForwardUtil::ELossFitter::kN)) : 
+  : fN(f.GetNpar() > AliLandauGaus::kN ? 
+       Int_t(f.GetParameter(AliLandauGaus::kN)) : 
        1),
     fNu(f.GetNDF()),
     fChi2(f.GetChisquare()),
-    fC(f.GetParameter(AliForwardUtil::ELossFitter::kC)),
-    fDelta(f.GetParameter(AliForwardUtil::ELossFitter::kDelta)),
-    fXi(f.GetParameter(AliForwardUtil::ELossFitter::kXi)),
-    fSigma(f.GetParameter(AliForwardUtil::ELossFitter::kSigma)),
-    fSigmaN(f.GetParameter(AliForwardUtil::ELossFitter::kSigmaN)),
+    fC(f.GetParameter(AliLandauGaus::kC)),
+    fDelta(f.GetParameter(AliLandauGaus::kDelta)),
+    fXi(f.GetParameter(AliLandauGaus::kXi)),
+    fSigma(f.GetParameter(AliLandauGaus::kSigma)),
+    fSigmaN(f.GetParameter(AliLandauGaus::kSigmaN)),
     fA(0),
-    fEC(f.GetParError(AliForwardUtil::ELossFitter::kC)),
-    fEDelta(f.GetParError(AliForwardUtil::ELossFitter::kDelta)),
-    fEXi(f.GetParError(AliForwardUtil::ELossFitter::kXi)),
-    fESigma(f.GetParError(AliForwardUtil::ELossFitter::kSigma)),
-    fESigmaN(f.GetParError(AliForwardUtil::ELossFitter::kSigmaN)),
+    fEC(f.GetParError(AliLandauGaus::kC)),
+    fEDelta(f.GetParError(AliLandauGaus::kDelta)),
+    fEXi(f.GetParError(AliLandauGaus::kXi)),
+    fESigma(f.GetParError(AliLandauGaus::kSigma)),
+    fESigmaN(f.GetParError(AliLandauGaus::kSigmaN)),
     fEA(0),
     fQuality(quality),
     fDet(0), 
@@ -89,8 +91,8 @@ AliFMDCorrELossFit::ELossFit::ELossFit(Int_t quality, const TF1& f)
   fA  = new Double_t[fN];
   fEA = new Double_t[fN];
   for (Int_t i = 0; i < fN-1; i++) { 
-    fA[i]  = f.GetParameter(AliForwardUtil::ELossFitter::kA+i);
-    fEA[i] = f.GetParError(AliForwardUtil::ELossFitter::kA+i);
+    fA[i]  = f.GetParameter(AliLandauGaus::kA+i);
+    fEA[i] = f.GetParError(AliLandauGaus::kA+i);
   }
   fA[fN-1]  = -9999;
   fEA[fN-1] = -9999;
@@ -302,7 +304,7 @@ AliFMDCorrELossFit::ELossFit::Evaluate(Double_t x,
   //     \sum_{i=1}^{n} a_i f(x;\Delta_i,\xi_i,\sigma_i')
   // @f] 
   //
-  // (see AliForwardUtil::NLandauGaus) for the maximum @f$ N @f$
+  // (see AliLandauGaus::NLandauGaus) for the maximum @f$ N @f$
   // that fulfills the requirements 
   // 
   // Parameters:
@@ -312,8 +314,8 @@ AliFMDCorrELossFit::ELossFit::Evaluate(Double_t x,
   // Return:
   //    @f$ f_N(x;\Delta,\xi,\sigma')@f$ 
   //
-  return AliForwardUtil::NLandauGaus(x, fDelta, fXi, fSigma, fSigmaN, 
-                                    TMath::Min(maxN, UShort_t(fN)), fA);
+  return AliLandauGaus::Fn(x, fDelta, fXi, fSigma, fSigmaN, 
+                          TMath::Min(maxN, UShort_t(fN)), fA);
 }
 
 //____________________________________________________________________
@@ -334,7 +336,7 @@ AliFMDCorrELossFit::ELossFit::EvaluateWeighted(Double_t x,
   //
   // If the denominator is zero, then 1 is returned. 
   //
-  // See also AliForwardUtil::ILandauGaus and AliForwardUtil::NLandauGaus
+  // See also AliLandauGaus::Fi and AliLandauGaus::NLandauGaus
   // for more information on the evaluated functions. 
   // 
   // Parameters:
@@ -350,7 +352,7 @@ AliFMDCorrELossFit::ELossFit::EvaluateWeighted(Double_t x,
   for (Int_t i = 1; i <= n; i++) {
     Double_t a = (i == 1 ? 1 : fA[i-1]);
     if (fA[i-1] < 0) break;
-    Double_t f = AliForwardUtil::ILandauGaus(x,fDelta,fXi,fSigma,fSigmaN,i);
+    Double_t f = AliLandauGaus::Fi(x,fDelta,fXi,fSigma,fSigmaN,i);
     num += i * a * f;
     den += a * f;
   }
@@ -416,9 +418,9 @@ AliFMDCorrELossFit::ELossFit::Print(Option_t* option) const
            << (fNu == 0 ? 999 : fChi2 / fNu) << "\n"
            << "     Quality:   " << fQuality << "\n" 
            << "  NParticles:   " << fN << "  (" << FindMaxWeight() << ")\n"
-           << OUTPAR("Delta", fDelta, fEDelta) 
-           << OUTPAR("xi", fXi, fEXi)
-           << OUTPAR("sigma", fSigma, fESigma)
+           << OUTPAR("Delta",   fDelta,  fEDelta) 
+           << OUTPAR("xi",      fXi,     fEXi)
+           << OUTPAR("sigma",   fSigma,  fESigma)
            << OUTPAR("sigma_n", fSigmaN, fESigmaN);
   for (Int_t i = 0; i < fN-1; i++) 
     std::cout << OUTPAR(Form("a%d", i+2), fA[i], fEA[i]);
@@ -434,14 +436,14 @@ AliFMDCorrELossFit::ELossFit::GetF1(Int_t i, Double_t max) const
   TF1*           ret  = 0;
   
   if (i <= 0)
-    ret = AliForwardUtil::MakeNLandauGaus(fC * 1, fDelta, fXi, 
-                                         fSigma, fSigmaN, maxW/*fN*/,
-                                         fA,  lowX, upX);
+    ret = AliLandauGaus::MakeFn(fC * 1, fDelta, fXi, 
+                               fSigma, fSigmaN, maxW/*fN*/, fA,  lowX, upX);
+  else if (i == 1) 
+    ret = AliLandauGaus::MakeF1(fC, fDelta, fXi, fSigma, fSigmaN, lowX, upX);
   else if (i <= maxW) 
-    ret = AliForwardUtil::MakeILandauGaus(fC*(i == 1 ? 1 : fA[i-2]), 
-                                         fDelta, fXi, 
-                                         fSigma, fSigmaN, i, lowX, upX);
-
+    ret = AliLandauGaus::MakeFi(fC*(i == 1 ? 1 : fA[i-2]), 
+                               fDelta, fXi, fSigma, fSigmaN, i, lowX, upX);
+  
   return ret;
 }
 //____________________________________________________________________
@@ -527,6 +529,7 @@ AliFMDCorrELossFit::ELossFit::Draw(Option_t* option)
   bool good = false;
   bool vals = false;
   bool legd = false;
+  bool peak = false;
   if (opt.Contains("COMP")) { 
     opt.ReplaceAll("COMP","");
     comp = true;
@@ -546,7 +549,9 @@ AliFMDCorrELossFit::ELossFit::Draw(Option_t* option)
   if (!opt.Contains("SAME")) { 
     gPad->Clear();
   }
-
+  if (opt.Contains("PEAK")) { 
+    peak = true;
+  }
   TLegend* l = 0;
   if (legd) { 
     l = new TLegend(.3, .5, .59, .94);
@@ -556,11 +561,8 @@ AliFMDCorrELossFit::ELossFit::Draw(Option_t* option)
   }
   TObjArray cleanup;
   Int_t maxW = FindMaxWeight();
-  TF1* tot = AliForwardUtil::MakeNLandauGaus(fC * 1, 
-                                            fDelta, fXi, 
-                                            fSigma, fSigmaN, 
-                                            maxW/*fN*/,     fA, 
-                                            0.01,   10);
+  TF1* tot = AliLandauGaus::MakeFn(fC * 1, fDelta, fXi, fSigma, fSigmaN, 
+                                  maxW/*fN*/,     fA,  0.01,   10);
   tot->SetLineColor(kBlack);
   tot->SetLineWidth(2);
   tot->SetLineStyle(1);
@@ -626,6 +628,12 @@ AliFMDCorrELossFit::ELossFit::Draw(Option_t* option)
 
   }
 
+  if (peak) { 
+    TLine* pl = new TLine(fDelta, 0.01*max, fDelta, 1.5*max);
+    pl->SetLineStyle(2);
+    pl->SetLineColor(kBlack);
+    pl->Draw();
+  }
   if (!comp) { 
     gPad->cd();
     return;
@@ -635,7 +643,7 @@ AliFMDCorrELossFit::ELossFit::Draw(Option_t* option)
   opt.Append(" same");
   for (Int_t i=1; i <= fN; i++) { 
     if (good && i > maxW) break;
-    TF1* f = AliForwardUtil::MakeILandauGaus(fC*(i == 1 ? 1 : fA[i-2]), 
+    TF1* f = AliLandauGaus::MakeFi(fC*(i == 1 ? 1 : fA[i-2]), 
                                             fDelta, fXi, 
                                             fSigma, fSigmaN, 
                                             i,      0.01, 10);
@@ -786,6 +794,7 @@ AliFMDCorrELossFit::operator=(const AliFMDCorrELossFit& o)
 void
 AliFMDCorrELossFit::CacheBins(UShort_t minQuality) const
 {
+  AliLandauGaus::EnableSigmaShift(TestBit(kHasShift));
   if (fCache.GetSize() > 0) return;
 
   Int_t nRings = fRings.GetEntriesFast();
@@ -1454,7 +1463,10 @@ AliFMDCorrELossFit::Draw(Option_t* option)
 
 
     THStack* stack = static_cast<THStack*>(stacks->At(i));
-
+    if (!stack->GetHists() || stack->GetHists()->GetEntries() <= 0) { 
+      AliWarningF("No histograms in %s", stack->GetName());
+      continue;
+    }
     // Double_t powMax = TMath::Log10(max[i]);
     // Double_t powMin = min[i] <= 0 ? powMax : TMath::Log10(min[i]);
     // if (powMax-powMin > 2. && min[i] != 0) p->SetLogy();
index ffd47d1316dc458c0ea850a51024231b680b475b..de38a8968338cba5fe13c16c43f173ac571dcaac 100644 (file)
@@ -39,6 +39,9 @@ class TBrowser;
 class AliFMDCorrELossFit : public TObject 
 {
 public:
+  enum { 
+    kHasShift = (1<<14)
+  };
   /** 
    * POD structure to hold data from fits 
    * 
index e50486697456af900c250440cf3ba31b9a7e3ed4..6e889f14dd9c4c95c86d994b64c32054ccd74c99 100644 (file)
@@ -3,6 +3,7 @@
 //
 #include "AliFMDEnergyFitter.h"
 #include "AliForwardUtil.h"
+#include "AliLandauGausFitter.h"
 #include <AliESDFMD.h>
 #include <TAxis.h>
 #include <TList.h>
@@ -199,7 +200,8 @@ AliFMDEnergyFitter::CreateOutputObjects(TList* dir)
   d->Add(AliForwardUtil::MakeParameter("maxChi2PerNDF", fMaxChi2PerNDF));
   d->Add(AliForwardUtil::MakeParameter("minWeight",     fMinWeight));
   d->Add(AliForwardUtil::MakeParameter("regCut",        fRegularizationCut));
-
+  d->Add(AliForwardUtil::MakeParameter("deltaShift", 
+                                      AliLandauGaus::EnableSigmaShift()));
   if (fRingHistos.GetEntries() <= 0) { 
     AliFatal("No ring histograms where defined - giving up!");
     return;
@@ -280,7 +282,12 @@ AliFMDEnergyFitter::SetCentralityAxis(UShort_t n, Double_t* bins)
 {
   fCentralityAxis.Set(n-1, bins);
 }
-
+//____________________________________________________________________
+void
+AliFMDEnergyFitter::SetEnableDeltaShift(Bool_t use) 
+{
+  AliLandauGaus::EnableSigmaShift(use ? 1 : 0);
+}
 
 //____________________________________________________________________
 Bool_t
@@ -350,7 +357,10 @@ AliFMDEnergyFitter::Fit(const TList* dir)
   //    dir Where the histograms are  
   //
   DGUARD(fDebug, 1, "Fit distributions in AliFMDEnergyFitter");
-  if (!fDoFits) return;
+  if (!fDoFits) {
+    AliInfo("Not asked to do fits, returning");
+    return;
+  }
 
   TList* d = static_cast<TList*>(dir->FindObject(GetName()));
   if (!d) {
@@ -376,9 +386,11 @@ AliFMDEnergyFitter::Fit(const TList* dir)
   for (Int_t i = 0; i < nStack; i++) 
     d->Add(stack[i]);
 
+  AliInfoF("Will do fits for %d rings", fRingHistos.GetEntries());
   TIter    next(&fRingHistos);
   RingHistos* o = 0;
   while ((o = static_cast<RingHistos*>(next()))) {
+    AliInfoF("Fill fit for FMD%d%c", o->fDet, o->fRing);
     if (CheckSkip(o->fDet, o->fRing, fSkips)) {
       AliWarningF("Skipping FMD%d%c for fitting", o->fDet, o->fRing);
       continue;
@@ -415,6 +427,8 @@ AliFMDEnergyFitter::MakeCorrectionsObject(TList* d)
   AliFMDCorrELossFit* obj = new AliFMDCorrELossFit;
   obj->SetEtaAxis(fEtaAxis);
   obj->SetLowCut(fLowCut);
+  if (AliLandauGaus::EnableSigmaShift()) 
+    obj->SetBit(AliFMDCorrELossFit::kHasShift);
 
   TIter    next(&fRingHistos);
   RingHistos* o = 0;
@@ -471,10 +485,11 @@ AliFMDEnergyFitter::ReadParameters(const TCollection* col)
   //   true on success, false otherwise 
   //
   if (!col) return false;
-  Bool_t ret = true;
-  TAxis* axis = static_cast<TAxis*>(col->FindObject("etaAxis"));
-  if (!axis) ret = false;
+  Bool_t ret  = true;
+  TH1*   hist = static_cast<TH1*>(col->FindObject("etaAxis"));
+  if (!hist) ret = false;
   else {
+    TAxis* axis = hist->GetXaxis();
     if (axis->GetXbins()->GetArray()) 
       fEtaAxis.Set(axis->GetNbins(), axis->GetXbins()->GetArray());
    else 
@@ -1233,7 +1248,7 @@ AliFMDEnergyFitter::RingHistos::FitHist(TH1*      dist,
   }
 
   // Create a fitter object 
-  AliForwardUtil::ELossFitter f(lowCut, maxRange, minusBins); 
+  AliLandauGausFitter f(lowCut, maxRange, minusBins); 
   f.Clear();
   f.SetDebug(fDebug > 2); 
 
index 696d10987476d9d4c77d93f7d2776aa6dc0b0571..00ae2bc314ee900b34b54baa7299f8ea3d56e6f4 100644 (file)
@@ -21,6 +21,7 @@
 #include <TClonesArray.h>
 #include "AliFMDCorrELossFit.h"
 #include "AliForwardUtil.h"
+#include "AliLandauGaus.h"
 class TH1;
 class TH2;
 class AliESDFMD;
@@ -54,20 +55,20 @@ public:
    */
   enum { 
     /** Index of pre-constant @f$ C@f$ */
-    kC         = AliForwardUtil::ELossFitter::kC,
+    kC         = AliLandauGaus::kC,
     /** Index of most probable value @f$ \Delta_p@f$ */
-    kDelta     = AliForwardUtil::ELossFitter::kDelta, 
+    kDelta     = AliLandauGaus::kDelta, 
     /** Index of Landau width @f$ \xi@f$ */
-    kXi                = AliForwardUtil::ELossFitter::kXi, 
+    kXi                = AliLandauGaus::kXi, 
     /** Index of Gaussian width @f$ \sigma@f$ */
-    kSigma     = AliForwardUtil::ELossFitter::kSigma, 
+    kSigma     = AliLandauGaus::kSigma, 
     /** Index of Gaussian additional width @f$ \sigma_n@f$ */
-    kSigmaN    = AliForwardUtil::ELossFitter::kSigmaN,
+    kSigmaN    = AliLandauGaus::kSigmaN,
     /** Index of Number of particles @f$ N@f$ */
-    kN         = AliForwardUtil::ELossFitter::kN, 
+    kN         = AliLandauGaus::kN, 
     /** Base index of particle strengths @f$ a_i@f$ for 
        @f$i=2,\ldots,N@f$ */
-    kA         = AliForwardUtil::ELossFitter::kA
+    kA         = AliLandauGaus::kA
   };
   /** 
    * Enumeration of residual methods 
@@ -292,6 +293,13 @@ public:
    * @param dbg Debug level 
    */
   void SetDebug(Int_t dbg=1);
+  /**
+   * Whether to enable the extra shift in the MPV from @f$ \sigma/\xi@f$ 
+   *
+   * @param use If true, enable extra shift @f$\delta\Delta_p(\sigma/\xi)@f$  
+   */
+  void SetEnableDeltaShift(Bool_t use=true);
+
   /* @} */
   // -----------------------------------------------------------------
   /** 
index 6a1f653932a93766020a188d1aff852d2b2c99b4..2dc3d20dd7666ae9fb68dcabac01e5f15225da5d 100644 (file)
@@ -44,7 +44,7 @@ class AliMCAuxHandler;
  *     \sigma   = \sigma_1
  * @f]
  *
- * See also AliForwardUtil::ELossFitter
+ * See also AliLandauGausFitter 
  */
 class AliFMDMCHitEnergyFitterTask : public AliBaseESDTask
 {
index d5fdd98288f6d5416528f7f0ed538b44884466db..670d3ec3dc3c350c8d4dcaac9b15284938f324c6 100644 (file)
 #include <TDirectory.h>
 #include <TTree.h>
 #include <TROOT.h>
+#define MCAOD_SLOT 4
+#define PRIMARY_SLOT 5
+#ifdef POST_AOD
+# define DEFINE(N,C) DefineOutput(N,C)
+# define POST(N,O)   PostData(N,O)
+#else
+# define DEFINE(N,C) do { } while(false)
+# define POST(N,O)   do { } while(false)
+#endif
 
 //====================================================================
 AliForwardMCMultiplicityTask::AliForwardMCMultiplicityTask()
@@ -78,6 +87,8 @@ AliForwardMCMultiplicityTask::AliForwardMCMultiplicityTask(const char* name)
   fPrimary->Sumw2();
   fPrimary->SetStats(0);
   fPrimary->SetDirectory(0);
+  DEFINE(MCAOD_SLOT,AliAODForwardMult::Class());
+  DEFINE(PRIM_SLOT, TH2D::Class());
 }
 
 //____________________________________________________________________
@@ -103,6 +114,15 @@ AliForwardMCMultiplicityTask::CreateBranches(AliAODHandler* ah)
   ah->AddBranch("TH2D", &fPrimary);
 }
 
+//____________________________________________________________________
+Bool_t
+AliForwardMCMultiplicityTask::Book()
+{
+  Bool_t ret = AliForwardMultiplicityBase::Book();
+  POST(MCAOD_SLOT, &fMCAODFMD);
+  POST(PRIM_SLOT,  fPrimary);
+  return ret;
+}
 
 //____________________________________________________________________
 void
@@ -319,6 +339,16 @@ AliForwardMCMultiplicityTask::Event(AliESDEvent& esd)
   return true;
 }
 
+//____________________________________________________________________
+Bool_t
+AliForwardMCMultiplicityTask::PostEvent()
+{
+  Bool_t ret = AliForwardMultiplicityBase::PostEvent();
+  POST(MCAOD_SLOT, &fMCAODFMD);
+  POST(PRIMARY_SLOT, fPrimary);
+  return ret;
+}
+
 //____________________________________________________________________
 void
 AliForwardMCMultiplicityTask::EstimatedNdeta(const TList* input, 
index bba25528815b108c6cf15c379b6b8d89843516e5..a17b2e8b1b41a9e4e79a5defea60dc79ad10a53f 100644 (file)
@@ -63,6 +63,18 @@ public:
    * @{ 
    * @name Interface methods 
    */
+  /** 
+   * Book output objects. Derived class should define this to book
+   * output objects on the processing output list @c fList before the
+   * actual event processing.  This is called on the master and on
+   * each slave.
+   * 
+   * If this member function returns false, the execution is stopped
+   * with a fatal signal.
+   *
+   * @return true on success. 
+   */
+  virtual Bool_t Book();
   /** 
    * Called before processing a single event - should not do anything
    * but clear data, etc.
@@ -77,6 +89,13 @@ public:
    */  
   virtual Bool_t Event(AliESDEvent& esd);
   /** 
+   * Called after processing a single event - should not do anything
+   * but clear data, etc.
+   * 
+   * @return true on success
+   */
+  virtual Bool_t PostEvent();
+  /* 
    * @} 
    */
   /** 
index d71a4ff1e60f42eedbafa6ebc7f686c6fba629de..ddf7cd5e713b128706e91ae3cbc80ff94149ba50 100644 (file)
 #include <THStack.h>
 #include <iostream>
 #include <iomanip>
+#define AOD_SLOT 3
+#ifdef POST_AOD
+# define DEFINE(N) DefineOutput(N,AliAODForwardMult::Class())
+# define POST(N)   PostData(N,fAODFMD)
+#else
+# define DEFINE(N) do { } while(false)
+# define POST(N)   do { } while(false)
+#endif
 
 //====================================================================
 AliForwardMultiplicityBase::AliForwardMultiplicityBase(const char* name) 
@@ -50,6 +58,8 @@ AliForwardMultiplicityBase::AliForwardMultiplicityBase(const char* name)
     fHTiming(0)
 {
   DGUARD(fDebug, 3,"Named CTOR of AliForwardMultiplicityBase %s",name);
+
+  DEFINE(AOD_SLOT);
 }
 
 
@@ -63,7 +73,7 @@ AliForwardMultiplicityBase::SetDebug(Int_t dbg)
   // Parameters:
   //    dbg debug level
   //
-  AliBaseESDTask::        SetDebug(dbg);
+  AliBaseESDTask::       SetDebug(dbg);
   GetSharingFilter()   .SetDebug(dbg);
   GetDensityCalculator().SetDebug(dbg);
   GetCorrections()     .SetDebug(dbg);
@@ -129,6 +139,8 @@ AliForwardMultiplicityBase::Book()
     xaxis->SetBinLabel(kTimingTotal, "Total");
     fList->Add(fHTiming);
   }
+
+  POST(AOD_SLOT);
   return true;
 }
 //____________________________________________________________________
@@ -261,6 +273,13 @@ AliForwardMultiplicityBase::InitMembers(const TAxis& eta, const TAxis& /*pv*/)
 }
 //____________________________________________________________________
 Bool_t
+AliForwardMultiplicityBase::PostEvent()
+{
+  POST(AOD_SLOT);
+  return true;
+}
+//____________________________________________________________________
+Bool_t
 AliForwardMultiplicityBase::Finalize()
 {
   // 
index a3b92ac4b770f9aa73832185e28bdb585cfa2974..86417cb258f54ba426093d29268ec4566babd666 100644 (file)
@@ -108,6 +108,13 @@ public:
    * @return false on errors 
    */
   virtual Bool_t PreData(const TAxis& vertex, const TAxis& eta);
+  /** 
+   * Called after processing a single event - should not do anything
+   * but clear data, etc.
+   * 
+   * @return true on success
+   */
+  virtual Bool_t PostEvent();
   /** 
    * End of job
    * 
index 9a77c4ac1278a4f58a45328c1a92cbbb107b4f04..9d57766e986f0c716dc54cfae939af9748b1b034 100644 (file)
@@ -24,7 +24,7 @@
 #include <TMath.h>
 #include <TError.h>
 #include <TROOT.h>
-#define FIT_OPTIONS "RNQS"
+#define FIT_OPTIONS "RNS"
 
 //====================================================================
 ULong_t AliForwardUtil::AliROOTRevision()
@@ -687,6 +687,7 @@ AliForwardUtil::PrintField(const char* name, const char* value, ...)
 }
 
 //====================================================================
+#if 0 // Moved to separate classes 
 Int_t    AliForwardUtil::fgConvolutionSteps  = 100;
 Double_t AliForwardUtil::fgConvolutionNSigma = 5;
 namespace {
@@ -787,7 +788,8 @@ AliForwardUtil::Landau(Double_t x, Double_t delta, Double_t xi)
   // Return:
   //    @f$ f'_{L}(x;\Delta,\xi) @f$
   //
-  return TMath::Landau(x, delta - xi * mpshift, xi);
+  Double_t deltaP = delta - xi * mpshift;
+  return TMath::Landau(x, deltaP, xi, true);
 }
 //____________________________________________________________________
 Double_t 
@@ -827,7 +829,9 @@ AliForwardUtil::LandauGaus(Double_t x, Double_t delta, Double_t xi,
   // Return:
   //    @f$ f@f$ evaluated at @f$ x@f$.  
   //
-  Double_t deltap = delta - xi * mpshift;
+  if (xi <= 0) return 0;
+
+  Double_t deltaP = delta; // - sigma * sigmaShift; // + sigma * mpshift;
   Double_t sigma2 = sigmaN*sigmaN + sigma*sigma;
   Double_t sigma1 = sigmaN == 0 ? sigma : TMath::Sqrt(sigma2);
   Double_t xlow   = x - fgConvolutionNSigma * sigma1;
@@ -839,12 +843,35 @@ AliForwardUtil::LandauGaus(Double_t x, Double_t delta, Double_t xi,
     Double_t x1 = xlow  + (i - .5) * step;
     Double_t x2 = xhigh - (i - .5) * step;
     
-    sum += TMath::Landau(x1, deltap, xi, kTRUE) * TMath::Gaus(x, x1, sigma1);
-    sum += TMath::Landau(x2, deltap, xi, kTRUE) * TMath::Gaus(x, x2, sigma1);
+    //sum += TMath::Landau(x1, deltap, xi, kTRUE) * TMath::Gaus(x, x1, sigma1);
+    //sum += TMath::Landau(x2, deltap, xi, kTRUE) * TMath::Gaus(x, x2, sigma1);
+    sum += Landau(x1, deltaP, xi) * TMath::Gaus(x, x1, sigma1);
+    sum += Landau(x2, deltaP, xi) * TMath::Gaus(x, x2, sigma1);
   }
   return step * sum * invSq2pi / sigma1;
 }
 
+namespace { 
+  const Double_t sigmaShift = 0.36390; // TMath::Log(TMath::Sqrt(2.));
+  double deltaSigmaShift(Int_t i, Double_t sigma)
+  {
+    return 0; // - sigma * sigmaShift;
+  }
+  void getIPars(Int_t i, Double_t& delta, Double_t& xi, Double_t& sigma)
+  {
+    Double_t dsig = deltaSigmaShift(i, sigma);
+    if (i == 1) { 
+      delta += dsig;
+      return; // { delta = delta + xi*mpshift; return; } // Do nothing 
+    }
+    
+    delta = i * (delta + xi * TMath::Log(i)) + dsig;
+    xi    = i * xi;
+    sigma = TMath::Sqrt(Double_t(i)) * sigma;
+  }
+}
+    
+    
 //____________________________________________________________________
 Double_t 
 AliForwardUtil::ILandauGaus(Double_t x, Double_t delta, Double_t xi, 
@@ -874,9 +901,10 @@ AliForwardUtil::ILandauGaus(Double_t x, Double_t delta, Double_t xi,
   // Return:
   //    @f$ f_i @f$ evaluated
   //  
-  Double_t deltaI =  (i == 1 ? delta : i * (delta + xi * TMath::Log(i)));
-  Double_t xiI    =  i * xi;
-  Double_t sigmaI =  (i == 1 ? sigma : TMath::Sqrt(Double_t(i))*sigma);
+  Double_t deltaI = delta;
+  Double_t xiI    = xi;
+  Double_t sigmaI = sigma;
+  getIPars(i, deltaI, xiI, sigmaI);
   if (sigmaI < 1e-10) { 
     // Fall back to landau 
     return AliForwardUtil::Landau(x, deltaI, xiI);
@@ -1161,6 +1189,19 @@ AliForwardUtil::ELossFitter::Clear()
   fFitResults.Clear();
   fFunctions.Clear();
 }
+namespace { 
+  void setParLimit(TF1* f, Int_t iPar, Bool_t debug,
+                  Double_t test, Double_t low, Double_t high)
+  {
+    if (test >= low && test <= high) { 
+      if (debug) 
+       printf("Fit: Set par limits on %s: %f, %f\n", 
+              f->GetParName(iPar), low, high);
+      f->SetParLimits(iPar, low, high);
+    }
+  }
+}
+
 //____________________________________________________________________
 TF1*
 AliForwardUtil::ELossFitter::Fit1Particle(TH1* dist, Double_t sigman)
@@ -1194,6 +1235,7 @@ AliForwardUtil::ELossFitter::Fit1Particle(TH1* dist, Double_t sigman)
   // Get the bin with maximum 
   Int_t    peakBin = dist->GetMaximumBin();
   Double_t peakE   = dist->GetBinLowEdge(peakBin);
+  Double_t rmsE    = dist->GetRMS();
   
   // Get the low edge 
   // dist->GetXaxis()->SetRangeUser(fLowCut, peakE);
@@ -1218,31 +1260,22 @@ AliForwardUtil::ELossFitter::Fit1Particle(TH1* dist, Double_t sigman)
   TF1* landau1 = new TF1("landau1", landauGaus1, minE,maxE,kSigmaN+1);
 
   // Set initial guesses, parameter names, and limits  
-  landau1->SetParameters(1,peakE,peakE/10,peakE/5,sigman);
+  landau1->SetParameters(intg,peakE,peakE/10,peakE/5,sigman);
   landau1->SetParNames("C","#Delta_{p}","#xi", "#sigma", "#sigma_{n}");
   landau1->SetNpx(500);
-  if (peakE >= minE && peakE <= fMaxRange) {
-    // printf("Fit1: Set par limits on Delta: %f, %f\n", minE, fMaxRange);
-    landau1->SetParLimits(kDelta, minE, fMaxRange);
-  }
-  if (peakE/10 >= 0 && peakE <= 0.1) {
-    // printf("Fit1: Set par limits on xi: %f, %f\n", 0., 0.1);
-    landau1->SetParLimits(kXi,    0.00, 0.1); // Was fMaxRange - too wide
-  }
-  if (peakE/5 >= 0 && peakE/5 <= 0.1) {
-    // printf("Fit1: Set par limits on sigma: %f, %f\n", 0., 0.1);
-    landau1->SetParLimits(kSigma, 1e-5, 0.1); // Was fMaxRange - too wide
-  }
+  setParLimit(landau1, kDelta, fDebug, peakE,   minE, fMaxRange);
+  setParLimit(landau1, kXi,    fDebug, peakE,   0,    rmsE); // 0.1
+  setParLimit(landau1, kSigma, fDebug, peakE/5, 1e-5, rmsE); // 0.1
   if (sigman <= 0)  landau1->FixParameter(kSigmaN, 0);
-  else {
-    // printf("Fit1: Set par limits on sigmaN: %f, %f\n", 0., fMaxRange);
-    landau1->SetParLimits(kSigmaN, 0, fMaxRange);
-  }
+  else 
+    setParLimit(landau1, kSigmaN, fDebug, peakE, 0, rmsE);
+  
 
+  TString opts(Form("%s%s", FIT_OPTIONS, fDebug ? "" : "Q"));
   // Do the fit, getting the result object 
   if (fDebug) 
     ::Info("Fit1Particle", "Fitting in the range %f,%f", minE, maxE);
-  TFitResultPtr r = dist->Fit(landau1, FIT_OPTIONS, "", minE, maxE);
+  TFitResultPtr r = dist->Fit(landau1, opts, "", minE, maxE);
   if (!r.Get()) { 
     ::Warning("Fit1Particle", 
              "No fit returned when processing %s in the range [%f,%f] "
@@ -1296,6 +1329,7 @@ AliForwardUtil::ELossFitter::FitNParticle(TH1* dist, UShort_t n,
 
   Int_t    minEb = dist->GetXaxis()->FindBin(minE);
   Int_t    maxEb = dist->GetXaxis()->FindBin(maxEi);
+  Double_t rmsE  = dist->GetRMS();
   Double_t intg  = dist->Integral(minEb, maxEb);
   if (intg <= 0) {
     ::Warning("FitNParticle",
@@ -1315,39 +1349,23 @@ AliForwardUtil::ELossFitter::FitNParticle(TH1* dist, UShort_t n,
                                 r->Parameter(kSigma),
                                 r->Parameter(kSigmaN),
                                 n, a.fArray, minE, maxEi);
-  if (minE      <= r->Parameter(kDelta) &&
-      fMaxRange >= r->Parameter(kDelta)) {
-    // Protect against warning from ParameterSettings
-    // printf("FitN: Set par limits on Delta: %f, %f\n", minE, fMaxRange);
-    landaun->SetParLimits(kDelta,  minE, fMaxRange);       // Delta
-  }
-  if (r->Parameter(kXi) >= 0 && r->Parameter(kXi) <= 0.1) {
-    // printf("FitN: Set par limits on xi: %f, %f\n", 0., 0.1);
-    landaun->SetParLimits(kXi,     0.00, 0.1);  // was fMaxRange - too wide
-  }
-  if (r->Parameter(kSigma) >= 1e-5 && r->Parameter(kSigma) <= 0.1) {
-    // printf("FitN: Set par limits on sigma: %f, %f\n", 1e-5, 0.1);
-    landaun->SetParLimits(kSigma,  1e-5, 0.1);  // was fMaxRange - too wide
-  }
-  // Check if we're using the noise sigma 
+  setParLimit(landaun, kDelta, fDebug, r->Parameter(kDelta), minE, fMaxRange);
+  setParLimit(landaun, kXi,    fDebug, r->Parameter(kXi),    0,    rmsE); // 0.1
+  setParLimit(landaun, kSigma, fDebug, r->Parameter(kSigma), 1e-5, rmsE); // 0.1
   if (sigman <= 0)  landaun->FixParameter(kSigmaN, 0);
-  else {
-    // printf("FitN: Set par limits on sigmaN: %f, %f\n", 0., fMaxRange);
-    landaun->SetParLimits(kSigmaN, 0, fMaxRange);
-  }
+  else 
+    setParLimit(landaun, kSigmaN, fDebug, r->Parameter(kSigmaN), 0, rmsE);
 
   // Set the range and name of the scale parameters 
   for (UShort_t i = 2; i <= n; i++) {// Take parameters from last fit 
-    if (a[i-2] >= 0 && a[i-2] <= 1) {
-      // printf("FitN: Set par limits on a_%d: %f, %f\n", i, 0., 1.);
-      landaun->SetParLimits(kA+i-2, 0,1);
-    }
+    setParLimit(landaun, kA+i-2, fDebug, a[i-2], 0, 1);
   }
 
   // Do the fit 
+  TString opts(Form("%s%s", FIT_OPTIONS, fDebug ? "" : "Q"));
   if (fDebug) 
     ::Info("FitNParticle", "Fitting in the range %f,%f (%d)", minE, maxEi, n);
-  TFitResultPtr tr = dist->Fit(landaun, FIT_OPTIONS, "", minE, maxEi);
+  TFitResultPtr tr = dist->Fit(landaun, opts, "", minE, maxEi);
   
   // landaun->SetRange(minE, fMaxRange);
   fFitResults.AddAtAndExpand(new TFitResult(*tr), n-1);
@@ -1361,8 +1379,7 @@ AliForwardUtil::ELossFitter::FitComposite(TH1* dist, Double_t sigman)
 {
   // 
   // Fit a composite particle signal to the passed energy loss
-  // distribution
-  // 
+  // distribution  // 
   // Parameters:
   //    dist    Data to fit the function to 
   //    sigman If larger than zero, the initial guess of the
@@ -1465,9 +1482,10 @@ AliForwardUtil::ELossFitter::FitComposite(TH1* dist, Double_t sigman)
   comp->SetLineWidth(3);
   
   // Do the fit, getting the result object 
+  TString opts(Form("%s%s", FIT_OPTIONS, fDebug ? "" : "Q"));
   if (fDebug) 
     ::Info("FitComposite", "Fitting composite in the range %f,%f", minE, maxE);
-  /* TFitResultPtr r = */ dist->Fit(comp, FIT_OPTIONS, "", minE, maxE);
+  /* TFitResultPtr r = */ dist->Fit(comp, opts, "", minE, maxE);
 
 #if 0
   TF1* part1 = static_cast<TF1*>(seed->Clone("part1"));
@@ -1496,6 +1514,7 @@ AliForwardUtil::ELossFitter::FitComposite(TH1* dist, Double_t sigman)
 #endif
   return comp;
 }
+#endif
 
 //====================================================================
 AliForwardUtil::Histos::~Histos()
index 297a3e90d12d8463bb24add934840b5c1abc554c..030362c0ebfc599a9d07a812c272f99835f3905b 100644 (file)
@@ -293,6 +293,7 @@ public:
   /* @} */
 
   //==================================================================
+#if 0 // Moved to separate classes
   /** 
    * @{ 
    * @name Energy stragling functions 
@@ -531,7 +532,7 @@ public:
     virtual ~ELossFitter();
     void SetDebug(Bool_t debug=true) { fDebug = debug; }
     /** 
-     * Clear internal arrays 
+     * Clear internal arrays
      * 
      */
     void Clear();
@@ -625,7 +626,7 @@ public:
     Bool_t    fDebug;
   };
   /* @} */
-      
+#endif      
 
   //==================================================================
   /** 
index 4300a9a3f141bb5d0356d65d2520cc88d9ab4c29..2a9b8b20cb036f16f4eda83b2adf5408eaaff31b 100644 (file)
@@ -12,7 +12,7 @@ void DrawAODSummary(const char* fname="forward.root", UShort_t what=0x27F)
 {
   gROOT->SetMacroPath(Form("%s:$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts",
                           gROOT->GetMacroPath()));
-  gROOT->LoadMacro("SummaryAODDrawer.C++g");
+  gROOT->LoadMacro("SummaryAODDrawer.C+g");
   
   SummaryAODDrawer d;
   d.Run(fname, what);
index a19ad7d53ba9551216b6771c4a0a86e547bcc710..1ad083300cf9dc611f36eb36253c2adbeee09cb5 100644 (file)
@@ -15,7 +15,7 @@ void DrawMCCorrSummary(const char* fname="forward_mccorr.root",
   gROOT->SetMacroPath(Form("%s:%s/scripts",
                           gROOT->GetMacroPath(), fwd));
   gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
-  gROOT->LoadMacro(Form("%s/scripts/SummaryMCCorrDrawer.C++g",fwd));
+  gROOT->LoadMacro(Form("%s/scripts/SummaryMCCorrDrawer.C+g",fwd));
   
   SummaryMCCorrDrawer d;
   d.Run(fname, what);
index 7734f68d4aa608f2985ce6fa7c5abe5b84b42365..e635229ded955bca6b8c238872f3f1164d6e63c2 100644 (file)
@@ -13,7 +13,7 @@ void DrawMultDistsSummary(const char* fname="forward_multdists.root",
 {
   gROOT->SetMacroPath(Form("%s:$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts",
                           gROOT->GetMacroPath()));
-  gROOT->LoadMacro("SummaryMultDistsDrawer.C++g");
+  gROOT->LoadMacro("SummaryMultDistsDrawer.C+g");
   
   SummaryMultDistsDrawer d;
   d.Run(fname, what);
index 0395af49e21ee3de5310d902c39b31b9dc5ae66e..9f007e35e3257a0959c07d699e659a37ee986937 100644 (file)
@@ -476,7 +476,7 @@ struct dNdetaDrawer
                             gROOT->GetMacroPath()));
     // Always recompile 
     if (!gROOT->GetClass("RefData"))
-      gROOT->LoadMacro("OtherData.C++");
+      gROOT->LoadMacro("OtherData.C+");
     gROOT->SetMacroPath(savPath);
 
     // --- Get the central results -----------------------------------
@@ -1472,7 +1472,7 @@ struct dNdetaDrawer
                               gROOT->GetMacroPath(), fwd.Data()));
       // Always recompile 
       if (!gROOT->GetClass("AliceLogo"))
-       gROOT->LoadMacro("AliceLogo.C++");
+       gROOT->LoadMacro("AliceLogo.C+");
       gROOT->SetMacroPath(savPath);
       
       if (gROOT->GetClass("AliceLogo")) {
index d77d01ecbc140cd5f50476a0fb28963534a12996..ebd403e4398c23304d092709ac3cf7bd09feee76 100644 (file)
@@ -13,7 +13,7 @@ void DrawdNdetaSummary(const char* fname="forward_dndeta.root",
 {
   gROOT->SetMacroPath(Form("%s:$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts",
                           gROOT->GetMacroPath()));
-  gROOT->LoadMacro("SummarydNdetaDrawer.C++g");
+  gROOT->LoadMacro("SummarydNdetaDrawer.C+g");
   
   SummarydNdetaDrawer d;
   d.Run(fname, what);
index 283db8bce38e16d10f9451d908df6d6b02737bf3..7d529a80b9c463bb7d818102f1b7a42d33e13654 100644 (file)
@@ -46,32 +46,51 @@ public:
    */
   static void MakeFileName(TString&        out,
                           const TString&  prefix)
-  /*
-   * @param runNo  Run Number
-   * @param sys    Collision system 
-   * @param sNN    Center of mass energy 
-   * @param field  L3 Field 
-   * @param mc     Simulations or not
-   * @param sat    Satellite interactions or not 
-                          ULong_t         runNo, 
-                          UShort_t        sys, 
-                          UShort_t        sNN, 
-                          Short_t         field,
-                          Bool_t          mc=false, 
-                          Bool_t          sat=false) */
   {
     out = TString::Format("forward_%s.pdf", prefix.Data());
-#if 0
-    out = TString::Format("%s_run%09lu_%s_%04dGeV_%c%dkG_%s_%s.pdf",
-                         prefix.Data(), runNo, 
-                         (sys == 1 ? "pp" : 
-                          sys == 2 ? "PbPb" : 
-                          sys == 3 ? "pPb" : "unknown"), sNN, 
-                         (field >= 0 ? 'p' : 'm'), TMath::Abs(field), 
-                         (mc ? "MC" : "real"),
-                         (sat ? "satellite" : "nominal"));
-#endif
   }
+
+  /** 
+   * Run the correction drawer, fetching information from extra file
+   * 
+   * @param what     What to draw
+   * @param extra    Extra file 
+   * @param options  Options
+   * @param local    Local DB
+   */
+  void Run(const Char_t* what, 
+          const Char_t* extra, 
+          Option_t*     options="",
+          const Char_t* local="") 
+  { 
+    Run(AliForwardCorrectionManager::ParseFields(what), 
+       extra, options, local);
+  }
+  /** 
+   * Run the correction drawer, fetching information from extra file
+   * 
+   * @param what     What to draw
+   * @param extra    Extra file 
+   * @param options  Options
+   * @param local    Local DB
+   */
+  void Run(UShort_t      what, 
+          const Char_t* extra, 
+          Option_t*     options="",
+          const Char_t* local="") 
+  { 
+    fELossExtra    = extra;
+    ULong_t  runNo = 0;
+    UShort_t sys   = 0;
+    UShort_t sNN   = 0;
+    Short_t  fld   = 0;
+    Bool_t   mc    = false;
+    Bool_t   sat   = false;
+    if (!GetInformation(runNo, sys, sNN, fld, mc, sat)) return;
+    
+    Run(what, runNo, sys, sNN, fld, mc, sat, options, local);
+  }
+
   /** 
    * Draw corrections using the correction manager to get them 
    *  
@@ -99,20 +118,6 @@ public:
        runNo, AliForwardUtil::ParseCollisionSystem(sys), 
        sNN, field, mc, sat, options, local);
   }
-  void AppendName(TString& what, UShort_t which)
-  {
-    if (!what.IsNull()) what.Append("_");
-    switch (which) {
-    case AliForwardCorrectionManager::kSecondaryMap:
-      what.Append("secondary"); break;
-    case AliForwardCorrectionManager::kAcceptance:
-      what.Append("acceptance"); break;
-    case AliForwardCorrectionManager::kELossFits:                
-      what.Append("elossfits"); break;
-    default:
-      what.Append("unknown"); break;
-    }
-  }
   /** 
    * Draw corrections using the correction manager to get them 
    *  
@@ -137,31 +142,29 @@ public:
   {
     AliForwardCorrectionManager& mgr = AliForwardCorrectionManager::Instance();
     mgr.SetDebug(true);
-    UShort_t flags = 0;
 
-    TString name;
-    if (what & AliForwardCorrectionManager::kSecondaryMap) {
-      flags |= AliForwardCorrectionManager::kSecondaryMap;
-      if (local) mgr.SetSecondaryMapPath(local);
+    // Set local prefix 
+    if (local) mgr.SetPrefix(gSystem->DirName(local));
+
+    // Get output file name 
+    TString  name;
+    if (what & AliForwardCorrectionManager::kSecondaryMap)
       AppendName(name, AliForwardCorrectionManager::kSecondaryMap);
-    }
-    if (what & AliForwardCorrectionManager::kAcceptance) {
-      flags |= AliForwardCorrectionManager::kAcceptance;
-      if (local) mgr.SetAcceptancePath(local);
+    if (what & AliForwardCorrectionManager::kAcceptance) 
       AppendName(name, AliForwardCorrectionManager::kAcceptance);
-    }
-    if (what & AliForwardCorrectionManager::kELossFits) {
-      flags |= AliForwardCorrectionManager::kELossFits;
-      if (local) mgr.SetELossFitsPath(local);
+    if (what & AliForwardCorrectionManager::kELossFits) 
       AppendName(name, AliForwardCorrectionManager::kELossFits);
-    }
     if (what & AliForwardCorrectionManager::kVertexBias) 
       Warning("CorrDrawer","Vertex bias not implemented yet");
     if (what & AliForwardCorrectionManager::kDoubleHit) 
       Warning("CorrDrawer","Double hit not implemented yet");    
     if (what & AliForwardCorrectionManager::kMergingEfficiency) 
       Warning("CorrDrawer","Merging efficiency not implemented yet");
-    
+
+    // Filter the ones we can handle 
+    UShort_t flags = what & (AliForwardCorrectionManager::kELossFits|
+                            AliForwardCorrectionManager::kAcceptance|
+                            AliForwardCorrectionManager::kSecondaryMap);
     if (!mgr.Init(runNo, sys, sNN, field, mc, sat, flags, true)) {
       Error("CorrDrawer", "Failed to initialize for flags=0x%02x"
                "run=%lu, sys=%hu, sNN=%hu, field=%hd, mc=%d, sat=%d",
@@ -175,7 +178,9 @@ public:
     TString opts(options);
     opts.ToUpper();
     Bool_t landscape = opts.Contains("LANDSCAPE");
+    Bool_t few       = opts.Contains("FEW");
     CreateCanvas(out, landscape);
+    
 
     fBody->cd();
     Double_t y = .8;
@@ -188,27 +193,15 @@ public:
     DrawParameter(y, "Satellite", Form("%s", sat ? "yes" : "no"));
     PrintCanvas("Title");
       
-    if (what & AliForwardCorrectionManager::kSecondaryMap) {
-      const AliFMDCorrSecondaryMap* sec = mgr.GetSecondaryMap();
-      if (!sec) 
-       Warning("CorrDrawer","No secondary map available");
-      else 
-       DrawIt(sec, true);
-    }
-    if (what & AliForwardCorrectionManager::kAcceptance) {
-      const AliFMDCorrAcceptance* acc = mgr.GetAcceptance();
-      if (!acc) 
-       Warning("CorrDrawer","No acceptance available");
-      else 
-       DrawIt(acc, true);
-    }
-    if (what & AliForwardCorrectionManager::kELossFits) {
-      const AliFMDCorrELossFit* fit = mgr.GetELossFit();
-      if (!fit) 
-       Warning("CorrDrawer","No energy loss fits available");
-      else 
-       DrawIt(fit, true);
-    }
+    Bool_t details = !opts.Contains("SINGLE");
+    if (what & AliForwardCorrectionManager::kSecondaryMap) 
+      DrawIt(mgr.GetSecondaryMap(), details);
+    if (what & AliForwardCorrectionManager::kAcceptance) 
+      DrawIt(mgr.GetAcceptance(), details);
+    if (what & AliForwardCorrectionManager::kELossFits)
+      DrawIt(mgr.GetELossFit(), details, few);
+
+    // Done
     CloseCanvas();
   }
   /** 
@@ -252,6 +245,8 @@ public:
    * @param sat     Satellite interaction flag
    * @param options Options 
    * @param local   Local storage
+   *
+   * @deprecated See Run instead 
    */
   virtual void Summarize(const TString& what, 
                         ULong_t        runNo, 
@@ -278,6 +273,8 @@ public:
    * @param mc      Simulation flag
    * @param sat     Satellite interaction flag
    * @param local   Local storage
+   *
+   * @deprecated See Run instead 
    */
   virtual void Summarize(UShort_t    what, 
                         ULong_t     runNo, 
@@ -286,84 +283,10 @@ public:
                         Short_t     field,
                         Bool_t      mc=false, 
                         Bool_t      sat=false,
-                        Option_t*   /*options*/="",
+                        Option_t*   options="",
                         const char* local="")
   {
-    AliForwardCorrectionManager& mgr = AliForwardCorrectionManager::Instance();
-    mgr.SetDebug(true);
-    if (local) mgr.SetPrefix(gSystem->DirName(local));
-    UShort_t flag = 0;
-    
-    if (what & AliForwardCorrectionManager::kSecondaryMap) 
-      flag = AliForwardCorrectionManager::kSecondaryMap;
-    if (what & AliForwardCorrectionManager::kAcceptance) 
-      flag = AliForwardCorrectionManager::kAcceptance;
-    if (what & AliForwardCorrectionManager::kELossFits) 
-      flag = AliForwardCorrectionManager::kELossFits;
-    if (what & AliForwardCorrectionManager::kVertexBias) 
-      Warning("CorrDrawer","Vertex bias not implemented yet");
-    if (what & AliForwardCorrectionManager::kDoubleHit) 
-      Warning("CorrDrawer","Double hit not implemented yet");    
-    if (what & AliForwardCorrectionManager::kMergingEfficiency) 
-      Warning("CorrDrawer","Merging efficiency not implemented yet");
-    if (flag == 0) { 
-      Warning("CorrDrawer", "Nothing to draw");
-      return;
-    }
-    
-    if (!mgr.Init(runNo, sys, sNN, field, mc, sat, flag, true)) {
-      Error("CorrDrawer", "Failed to initialize for flags=0x%02x "
-           "run=%lu, sys=%hu, sNN=%hu, field=%hd, mc=%d, sat=%d",
-           flag, runNo, sys, sNN, field, mc, sat);
-      return;
-    }
-
-    TString prefix;
-    if      (flag == AliForwardCorrectionManager::kSecondaryMap) 
-      prefix = "secondarymap";
-    else if (flag == AliForwardCorrectionManager::kAcceptance)
-      prefix = "acceptance";
-    else if (flag == AliForwardCorrectionManager::kELossFits) 
-      prefix = "elossfits";
-    else 
-      prefix = "unknown";
-    TString out;
-    MakeFileName(out, prefix); // , runNo, sys, sNN, field, mc, sat);
-    CreateCanvas(out);
-
-    fBody->cd();
-    Double_t y = .8;
-    DrawParameter(y, "Run #", Form("%lu", runNo));
-    DrawParameter(y, "System", AliForwardUtil::CollisionSystemString(sys));
-    DrawParameter(y, "#sqrt{s_{NN}}", 
-                 AliForwardUtil::CenterOfMassEnergyString(sys));
-    DrawParameter(y, "L3 field", AliForwardUtil::MagneticFieldString(field));
-    DrawParameter(y, "Simulation", Form("%s", mc ? "yes" : "no"));
-    DrawParameter(y, "Satellite", Form("%s", sat ? "yes" : "no"));
-    PrintCanvas("Title");
-      
-    if (flag == AliForwardCorrectionManager::kSecondaryMap) {
-      const AliFMDCorrSecondaryMap* sec = mgr.GetSecondaryMap();
-      if (!sec) 
-       Warning("CorrDrawer","No secondary map available");
-      else 
-       DrawIt(sec, true);
-    }
-    else if (flag == AliForwardCorrectionManager::kAcceptance) {
-      const AliFMDCorrAcceptance* acc = mgr.GetAcceptance();
-      if (!acc) 
-       Warning("CorrDrawer","No acceptance available");
-      else 
-       DrawIt(acc, true);
-    }
-    if (flag == AliForwardCorrectionManager::kELossFits) {
-      const AliFMDCorrELossFit* fit = mgr.GetELossFit();
-      if (!fit) 
-       Warning("CorrDrawer","No energy loss fits available");
-      else 
-       DrawIt(fit, true);
-    }
-    CloseCanvas();
+    Run(what, runNo, sys, sNN, field, mc, sat, options, local);
   }
   /** 
    * Fall-back method
@@ -386,7 +309,7 @@ public:
    */
   virtual void Summarize(const AliFMDCorrAcceptance* acc, Bool_t pdf=true) 
   { 
-    CreateCanvas("acceptance.pdf", false, pdf);
+    CreateCanvas(CanvasName("acceptance.pdf"), false, pdf);
     DrawIt(acc, pdf); 
     if (pdf) CloseCanvas();
   }
@@ -399,7 +322,7 @@ public:
    */
   virtual void Summarize(const AliFMDCorrSecondaryMap* sec, Bool_t pdf=true) 
   { 
-    CreateCanvas("secondarymap.pdf", false, pdf);
+    CreateCanvas(CanvasName("secondarymap.pdf"), false, pdf);
     DrawIt(sec, pdf); 
     if (pdf) CloseCanvas();
   }
@@ -412,53 +335,140 @@ public:
    */
   virtual void Summarize(const AliFMDCorrELossFit* fits, Bool_t pdf=true) 
   { 
-    CreateCanvas("elossfits.pdf", false, pdf);
+    CreateCanvas(CanvasName("elossfits.pdf"), true, pdf);
     DrawIt(fits, pdf); 
     if (pdf) CloseCanvas();
   }
-
+  /** 
+   * Draw a single summary plot/multiple plots of the correction.
+   * A new canvas is created for this.
+   * 
+   * @param what     What to plot
+   * @param mc       MC input or not
+   * @param output   Output of correction pass (must exist)
+   * @param local    Local storage of correction
+   * @param options  Various options
+   *
+   * @deprecated Use Run instead 
+   */
   static void Summarize(const TString& what   = TString(""), 
-                       Bool_t         mc     = false,
+                       Bool_t         /*mc*/ = false,
                        const TString& output = TString("forward_eloss.root"), 
                        const TString& local  = TString("fmd_corrections.root"),
                        Option_t*      options= "")
   {
-    Summarize(AliForwardCorrectionManager::ParseFields(what), mc, 
-             output, local, options);
+    CorrDrawer* drawer = new CorrDrawer;
+    drawer->Run(AliForwardCorrectionManager::ParseFields(what), 
+               output, local, options);
   }
+  /** 
+   * Draw a single summary plot/multiple plots of the correction.
+   * A new canvas is created for this.
+   * 
+   * @param what     What to plot
+   * @param mc       MC input or not
+   * @param output   Output of correction pass (must exist)
+   * @param local    Local storage of correction
+   * @param options  Various options
+   *
+   * @deprecated Use Run instead 
+   */
   static void Summarize(UShort_t       what, 
-                       Bool_t         mc     = false,
+                       Bool_t         /*mc*/ = false,
                        const TString& output = "forward_eloss.root", 
                        const TString& local  = "fmd_corrections.root",
                        Option_t*      options= "")
   {
-    TFile* fout = TFile::Open(output, "READ");
-    if (!fout) { 
-      Warning("SummarizeELoss", "Energy loss task output %s not found",
-             output.Data());
-      return;
-    }
-    TCollection* forward = GetCollection(fout, "ForwardELossSums");
-    if (!forward) return;
-    
-    TCollection* eventInsp = GetCollection(forward, "fmdEventInspector");
-    if (!eventInsp) return;
-
-    UShort_t sys   = 0, sNN = 0;
-    Int_t    field = 0;
-    ULong_t  runNo = 0; 
-    Bool_t satellite;
-    if (!GetParameter(eventInsp, "sys",       sys))       return;
-    if (!GetParameter(eventInsp, "sNN",       sNN))       return;
-    if (!GetParameter(eventInsp, "field",     field))     return;
-    if (!GetParameter(eventInsp, "satellite", satellite)) return;
-    if (!GetParameter(eventInsp, "runNo",     runNo))     return;
-    
     CorrDrawer* drawer = new CorrDrawer;
-    drawer->Run(what, runNo, sys, sNN, field, mc, satellite,
-               options, local);
+    drawer->Run(what, output, options, local);
   }
 protected:
+  /** 
+   * Append a name to output prefix 
+   * 
+   * @param what  What to append to 
+   * @param which Which string to append
+   */
+  void AppendName(TString& what, UShort_t which)
+  {
+    if (!what.IsNull()) what.Append("_");
+    switch (which) {
+    case AliForwardCorrectionManager::kSecondaryMap:
+      what.Append("secondary"); break;
+    case AliForwardCorrectionManager::kAcceptance:
+      what.Append("acceptance"); break;
+    case AliForwardCorrectionManager::kELossFits:                
+      what.Append("elossfits"); break;
+    default:
+      what.Append("unknown"); break;
+    }
+  }
+
+  /** 
+   * Get information from auxillary file 
+   * 
+   * @param runNo  On return, the run number
+   * @param sys    On return, the collision system
+   * @param sNN    On return, the collision energy 
+   * @param fld    On return, the L3 magnetic field   
+   * @param mc     On return, true for MC input 
+   * @param sat    On return, true for satellite input enabled
+   * 
+   * @return true on success, false otherwise 
+   */
+  virtual Bool_t GetInformation(ULong_t&  runNo,
+                               UShort_t& sys,
+                               UShort_t& sNN,
+                               Short_t&  fld, 
+                               Bool_t&   mc, 
+                               Bool_t&   sat)
+  { 
+    TFile* fout = TFile::Open(fELossExtra, "READ");
+    if (!fout) { 
+      Warning("SummarizeELoss", "Correction task output \"%s\" not found",
+             fELossExtra.Data());
+      return false;
+    }
+    Bool_t ret = false;
+    try {
+      TCollection* forward = GetCollection(fout, "ForwardELossSums");
+      if (!forward) throw false;
+      
+      TCollection* eventInsp = GetCollection(forward, "fmdEventInspector");
+      if (!eventInsp) throw false;
+
+      if (!GetParameter(eventInsp, "sys",       sys))   throw false;
+      if (!GetParameter(eventInsp, "sNN",       sNN))   throw false;
+      if (!GetParameter(eventInsp, "field",     fld))   throw false;
+      if (!GetParameter(eventInsp, "satellite", sat))   throw false;
+      if (!GetParameter(eventInsp, "runNo",     runNo)) throw false;
+      if (!GetParameter(eventInsp, "mc",        mc))    throw false;
+
+      ret = true;
+    }
+    catch (bool e) {
+      ret = e;
+    }
+    if (fout) fout->Close();
+    return ret;
+  }
+  /** 
+   * Get the canvas name.  If the auxillary file has been set, use
+   * that as the base of the canvas name.  Otherwise use @a def.
+   * 
+   * @param def Default value 
+   * 
+   * @return Canvas name 
+   */
+  virtual TString CanvasName(const char* def) 
+  { 
+    TString canName(def);
+    if (!fELossExtra.IsNull()) { 
+      canName = gSystem->BaseName(fELossExtra.Data());
+      canName.ReplaceAll(".root", ".pdf");
+    }
+    return canName;
+  }
   /** 
    * Fall-back method
    * 
@@ -478,7 +488,15 @@ protected:
    */
   virtual void DrawIt(const AliFMDCorrAcceptance* corr, Bool_t details=true)
   {
-    if (!corr || !fCanvas) return;
+    if (!corr) {
+      Warning("CorrDrawer","No acceptance available");
+      return;
+    }
+
+    if (!fCanvas) {
+      Warning("CorrDrawer", "No canvas");
+      return;
+    }
 
     // --- Get vertex axis ---------------------------------------------
     const TAxis& vtxAxis = corr->GetVertexAxis();
@@ -593,7 +611,15 @@ protected:
    */
   virtual void DrawIt(const AliFMDCorrSecondaryMap* corr, bool details) 
   {
-    if (!corr || !fCanvas) return;
+    if (!corr) {
+      Warning("CorrDrawer","No secondary map available");
+      return;
+    }
+
+    if (!fCanvas) {
+      Warning("CorrDrawer", "No canvas");
+      return;
+    }
     
     const TAxis& vtxAxis = corr->GetVertexAxis();
     Int_t        nVtx    = vtxAxis.GetNbins();
@@ -682,9 +708,18 @@ protected:
    * @param details If true, make a multipage PDF, 
    *                   otherwise plot the parameters. 
    */
-  virtual void DrawIt(const AliFMDCorrELossFit* corr, bool details) 
+  virtual void DrawIt(const AliFMDCorrELossFit* corr, bool details,
+                     bool few=true) 
   {
-    if (!corr || !fCanvas) return;
+    if (!corr) {
+      Warning("CorrDrawer","No energy loss fits available");
+      return;
+    }
+
+    if (!fCanvas) {
+      Warning("CorrDrawer", "No canvas");
+      return;
+    }
 
     AliFMDCorrELossFit* fits = const_cast<AliFMDCorrELossFit*>(corr);
     fits->CacheBins(8);
@@ -710,46 +745,87 @@ protected:
        savDir->cd();
       }
       fBody->cd();
-      TLatex* ll = new TLatex(.5,.8, "ESD #rightarrow #Delta-fits"
+      TLatex* ll = new TLatex(.5,.9, "ESD #rightarrow #Delta-fits"
                              /* fCanvas->GetTitle() */);
       ll->SetTextAlign(22);
       ll->SetTextSize(0.05);
       ll->SetNDC();
       ll->Draw();
-      
+
+      const Double_t fontSize = 0.03;
+#define DL(X,Y,T) do { l->DrawLatex(X,Y,T); Y -= fontSize; } while (false)
       TLatex* l = new TLatex(.5,.8, "");
       l->SetNDC();
-      l->SetTextSize(0.03);
+      l->SetTextSize(fontSize);
       l->SetTextFont(132);
       l->SetTextAlign(12);
-      l->DrawLatex(0.2, 0.70, "1^{st} page is a summary of fit parameters");
-      l->DrawLatex(0.2, 0.67, "2^{nd} page is a summary of relative errors");
-      l->DrawLatex(0.2, 0.64, "Subsequent pages shows the fitted functions");
-      l->DrawLatex(0.3, 0.60, "Black line is the full fitted function");
-      l->DrawLatex(0.3, 0.57, "Coloured lines are the individual N-mip comp.");
-      //l->DrawLatex(0.3, 0.54, "Full drawn lines correspond to used components");
-      //l->DrawLatex(0.3, 0.51, "Dashed lines correspond to ignored components");
-      l->DrawLatex(0.2, 0.54, "Each component has the form");
-      l->DrawLatex(0.3, 0.49, "f_{n}(x; #Delta, #xi, #sigma') = "
-                  "#int_{-#infty}^{+#infty}d#Delta' "
-                  "landau(x; #Delta', #xi)gaus(#Delta'; #Delta, #sigma')");
-      l->DrawLatex(0.2, 0.44, "The full function is given by");
-      l->DrawLatex(0.3, 0.41, "f_{N}(x; #Delta, #xi, #sigma', #bf{a}) = "
-                "C #sum_{i=1}^{N} a_{i} "
-                  "f_{i}(x; #Delta_{i}, #xi_{i}, #sigma_{i}')");
-      l->DrawLatex(0.3, 0.35, "#Delta_{i} = i (#Delta_{1} + #xi_{1} log(i))");
-      l->DrawLatex(0.3, 0.32, "#xi_{i} = i #xi_{1}");
-      l->DrawLatex(0.3, 0.29, "#sigma_{i} = #sqrt{i} #sigma_{1}");
-      l->DrawLatex(0.3, 0.26, "#sigma_{n} #dot{=} 0");
-      l->DrawLatex(0.3, 0.23, "#sigma_{i}'^{2} = #sigma^{2}_{n} + #sigma_{i}^{2}");
-      l->DrawLatex(0.3, 0.20, "a_{1} #dot{=} 1");
-      l->DrawLatex(0.3, 0.15, Form("Least quality: %d", fMinQuality));
+      Double_t y = 0.80;
+      Double_t x = 0.20;
+      Double_t z = 0.30;
+      DL(x,y,"1^{st} page is a summary of fit parameters");
+      DL(x,y,"2^{nd} page is a summary of relative errors");
+      DL(x,y,"Subsequent pages shows the fitted functions");
+      y -= 0.01;
+      DL(z,y,"Black line is the full fitted function");
+      DL(z,y,"Coloured lines are the individual N-mip comp.");
+      DL(x,y,"Each component has the form");
+      y -= 0.02;
+      DL(z,y,"f_{n}(x; #Delta, #xi, #sigma') = "
+        "#int_{-#infty}^{+#infty}dx' "
+        "landau(x'; #Delta, #xi)gaus(x'; x, #sigma')");
+      y -= 0.02;
+      DL(x,y,"The full function is given by");
+      y -= 0.02;
+      DL(z,y,"f_{N}(x; #Delta, #xi, #sigma', #bf{a}) = "
+        "C #sum_{i=1}^{N} a_{i} "
+        "f_{i}(x; #Delta_{i}, #xi_{i}, #sigma_{i}')");
+      y -= 0.03;
+      DL(z,y,"#Delta_{i} = i (#Delta_{1} + #xi_{1} log(i)) +#delta_{i}");
+      DL(z,y,"#xi_{i} = i #xi_{1}");
+      DL(z,y,"#sigma_{i} = #sqrt{i} #sigma_{1}");
+      DL(z,y,"#sigma_{n} #dot{=} 0");
+      DL(z,y,"#sigma_{i}'^{2} = #sigma^{2}_{n} + #sigma_{i}^{2}");
+      DL(z,y,"#delta_{i} = c#sigmau/(1+1/i)^{pu#sqrt{u}}");
+      DL(z,y,"u = #sigma/#xi");
+      DL(z,y,"a_{1} #dot{=} 1");
+      y -= 0.02;
+      DL(z,y,Form("Least quality: %d", fMinQuality));
+      y -= 0.02;
       if (fitter) {
        TObject* refit = fitter->FindObject("refitted");
-       if (refit) l->DrawLatex(0.3, .10, "Refitted distributions");
+       if (refit) DL(z,y, "Refitted distributions");//.10
       }
       PrintCanvas("Energy loss fits");
     }
+    
+    if (details && fitter) { 
+      // Draw parameter from the fitter 
+      fBody->cd();
+      Double_t y = 0.90;
+      Double_t s = fParName->GetTextSize();
+      Double_t t = fParVal->GetTextSize();
+      fParName->SetTextSize(0.04);
+      fParVal->SetTextSize(0.04);
+      DrawTParameter<double>(y, fitter, "lowCut");
+      DrawTParameter<int>   (y, fitter, "nParticles");
+      DrawTParameter<int>   (y, fitter, "minEntries");
+      DrawTParameter<int>   (y, fitter, "subtractBins");
+      DrawTParameter<bool>  (y, fitter, "doFits");
+      DrawTParameter<double>(y, fitter, "maxE");
+      DrawTParameter<int>   (y, fitter, "nEbins");
+      DrawTParameter<bool>  (y, fitter, "increasingBins");
+      DrawTParameter<double>(y, fitter, "maxRelPerError");
+      DrawTParameter<double>(y, fitter, "maxChi2PerNDF");
+      DrawTParameter<double>(y, fitter, "minWeight");
+      DrawTParameter<double>(y, fitter, "regCut");
+      DrawParameter(y,"Use #delta#Delta(#sigma/#xi)",
+                   Form("%s", 
+                        fits->TestBit(AliFMDCorrELossFit::kHasShift) 
+                        ? "yes" : "no"));
+      PrintCanvas("Fitter settings");
+      fParName->SetTextSize(s);
+      fParVal->SetTextSize(t);
+    }
 
     fBody->cd();
     fits->Draw("error good");
@@ -788,7 +864,7 @@ protected:
        ClearCanvas();
        TObjArray*  ra = fits->GetRingArray(d, r);
        if (!ra) continue;
-       DrawELossFits(d, r, ra, dists, resis);
+       DrawELossFits(d, r, ra, dists, resis, few);
       }
     }
   }
@@ -803,21 +879,27 @@ protected:
    * @param resis Residuals (optional)   
    */
   void DrawELossFits(UShort_t d, Char_t r, TObjArray* ra, 
-                    TList* dists, TList* resis)
+                    TList* dists, TList* resis, bool few)
   {
-    Int_t nPad = 6;
+    Int_t nRow = 3;
+    Int_t nCol = (few ? 1 : 2);
+    Int_t nPad = nRow * nCol;
     AliFMDCorrELossFit::ELossFit* fit = 0;
     TIter next(ra);
     Int_t i = 0;
     Int_t j = 0;
+    DividedPad divided(fBody, fLandscape, nCol, nRow);
     while ((fit = static_cast<AliFMDCorrELossFit::ELossFit*>(next()))) {
       j           = i % nPad;
       Bool_t last = j == nPad-1;
-      if (j == 0) DivideForRings(true, true);
+      if (j == 0) divided.Divide(true, true);
 
       Bool_t        same    = false;
-      TVirtualPad*  drawPad = fBody->GetPad(j+1);
+      TVirtualPad*  drawPad = divided.GetPad(j); // fBody->GetPad(j+1);
       Int_t         subPad  = 0;
+      // fBody->ls();
+      // Info("", "Now in sub-pad %d of %d: %p", j, nPad, drawPad);
+      // Info("", "Pad %s", drawPad->GetName());
       if (dists) { 
        // Info("", "Distributions: %s", dists->GetName());
        TString hName(Form("FMD%d%c_etabin%03d", d,r,fit->GetBin()));
@@ -871,7 +953,7 @@ protected:
       }
       // if (same)
       DrawInPad(drawPad, subPad, fit, 
-               Form("comp good values legend %s", (same ? "same" : "")),
+               Form("comp good values legend peak %s", (same ? "same" : "")),
                kLogy);
       if (fit->GetQuality() < fMinQuality) { 
        TLatex* ltx = new TLatex(.2, .2, "NOT USED");
index 192779eac12623457112cffca3c1e87b5580d109..6867ce453ac9703d473839d104fc9fd7101068b4 100644 (file)
@@ -45,7 +45,6 @@ DrawCorrELoss(ULong_t runNo, UShort_t sys, UShort_t sNN, Short_t field,
              Bool_t mc=false, Bool_t sat=false, 
              const char* fname=0, Bool_t details=true)
 {
-  //__________________________________________________________________
   // Load libraries and object 
   // const char* fwd = "$ALICE_ROOT/PWGLF/FORWARD/analysis2";
   Setup(false);
@@ -69,7 +68,7 @@ DrawCorrELoss(Bool_t      mc,
   Setup(true);
 
   CorrDrawer::Summarize(AliForwardCorrectionManager::kELossFits, 
-                       mc, file, local);
+                       mc, file, local, "LANDSCAPE FEW");
 }
 /** 
  * Draw the energy loss correction
@@ -90,9 +89,9 @@ DrawCorrELoss(Bool_t mc, Bool_t dummy,
     Error("DrawCorrELoss", "Failed to open %s", file);
     return;
   }
-  TList* res = static_cast<TList*>(hist->Get("ForwardResults"));
+  TList* res = static_cast<TList*>(hist->Get("ForwardELossResults"));
   if (!res) { 
-    Error("DrawCorrEloss", "Failed to get ForwardResults from %s", file);
+    Error("DrawCorrEloss", "Failed to get ForwardELossResults from %s", file);
     return;
   }
   TList* ef = static_cast<TList*>(res->FindObject("fmdEnergyFitter"));
@@ -113,6 +112,7 @@ DrawCorrELoss(Bool_t mc, Bool_t dummy,
   CorrDrawer* cd = new CorrDrawer;
   cd->fELossExtra = file;
   cd->fMinQuality = 8;
+  // cd->fLandscape = true;
   cd->Summarize(const_cast<const AliFMDCorrELossFit*>(fits), true);
 }
 
index e7ccfca06c9f0e6a1907b4844a3394230410e9ec..208b81c76cf2318711cd43c15900fc25728993a9 100644 (file)
@@ -117,7 +117,8 @@ struct MultCutDrawer : public SummaryDrawer
     Double_t savY = fParVal->GetY();
     fParVal->SetX(.4);
     fParVal->SetY(.4);
-    
+    // fPause = true;
+
     TIter    iCut(&fCuts);
     TObject* pCut = 0;
     while ((pCut = iCut())) { 
@@ -126,7 +127,9 @@ struct MultCutDrawer : public SummaryDrawer
       TObjArray*              aP = sP.Tokenize(" ");
       TIter                   iP(aP);
       TObjString*             pP = 0;
+      TString                 tM;
+      fBody->SetBottomMargin(0.20);
+      fBody->SetLeftMargin(0.06);
       fBody->Divide(1, aP->GetEntries(), 0, 0);
       Int_t iPad = 1;
       while ((pP = static_cast<TObjString*>(iP()))) {
@@ -134,28 +137,70 @@ struct MultCutDrawer : public SummaryDrawer
        Double_t p     = pP->String().Atof();
        Double_t vP[]  = { p, p, p, p, p };
        THStack* stack = CutStack(method, vP, all);
-
+       if (tM.IsNull()) tM = stack->GetTitle();
        // Kill title on all but first sub-panel
-       if (iPad != 1) stack->SetTitle("");
-
+       stack->SetTitle("");
        DrawInPad(fBody, iPad, stack, "nostack p");
+       stack->GetYaxis()->SetTitleSize(0.12);
+       stack->GetYaxis()->SetTitleOffset(0.2);
+       stack->GetYaxis()->SetLabelSize(0.07);
+       if (iPad == 1) stack->GetYaxis()->SetTitle(tM);
+       stack->GetXaxis()->SetTitle("#eta");
+       stack->GetXaxis()->SetTitleSize(0.12);
+       stack->GetXaxis()->SetTitleOffset(0.6);
+       stack->GetXaxis()->SetTitleColor(kBlack);
+       stack->GetXaxis()->SetLabelSize(0.07);
+       stack->GetXaxis()->Dump();
+
+
+       if (iPad == 1) {
+         Color_t    col   = kBlack;
+         Double_t   hLtx  = 0.07;
+         Double_t   yLtx  = 7*(hLtx+.005)+0.01;
+         TLatex*    nLtx  = new TLatex(-0.75, yLtx, "Ring");
+         TLatex*    pLtx  = new TLatex(-0.7,  yLtx, "Param");
+         TLatex*    vLtx  = new TLatex(+0, yLtx, "Mean#pmVar_{min}^{max}");
+         nLtx->SetTextAlign(31);pLtx->SetTextAlign(11);
+         nLtx->SetTextSize(hLtx);
+         pLtx->SetTextSize(hLtx);
+         vLtx->SetTextSize(hLtx);
+         nLtx->SetTextColor(col);
+         pLtx->SetTextColor(col);
+         vLtx->SetTextColor(col);
+         nLtx->Draw();
+         pLtx->Draw();
+         vLtx->Draw();
+       }
        // if (iPad == 1) { 
        //   fBody->cd(1);
        //   DrawRingLegend(0.4, 0.4, 0.7, 0.9);
        // }
        iPad++;
       }
-      PrintCanvas(Form("%s %s", method.Data(), sP.Data()));
+      PrintCanvas(Form("%s   X={%s}", tM.Data(), sP.Data()));
     }
+
     Int_t nAll = fStacks.GetEntries();
+    fBody->SetBottomMargin(0.20);
+    fBody->SetLeftMargin(0.06);
     fBody->Divide(1, nAll, 0, 0);
     for (Int_t iAll = 0; iAll < nAll; iAll++) {
       THStack* all = AllStack(iAll);
       DrawInPad(fBody, iAll+1, all, "nostack hist p");
+      all->GetYaxis()->SetTitleSize(0.12);
+      all->GetYaxis()->SetTitleOffset(0.2);
+      all->GetYaxis()->SetLabelSize(0.07);
+      if (iAll == 0) all->GetYaxis()->SetTitle("c");
+      all->GetXaxis()->SetTitle("#eta");
+      all->GetXaxis()->SetTitleSize(0.12);
+      all->GetXaxis()->SetTitleOffset(0.6);
+      all->GetXaxis()->SetTitleColor(kBlack);
+      all->GetXaxis()->SetLabelSize(0.07);
+      
       TVirtualPad* p = fBody->GetPad(iAll+1);
       p->cd();
       Double_t yT = 1-p->GetTopMargin();
-      if      (iAll == 0) DrawRingLegend(0.4, 0.4, 0.7, yT);
+      if      (iAll == 0) DrawRingLegend(p, kNorth|kCenter); 
       else if (iAll == 1) DrawMethodLegend(0.35, 0.4, 0.55,yT);
       
       Double_t y1 = ((iAll + 2 >= nAll) ? yT - .3 : p->GetBottomMargin());
@@ -386,6 +431,8 @@ struct MultCutDrawer : public SummaryDrawer
       if (!first) first = h;
       h->SetName(method);
       h->SetTitle(Form("%f", param[i-1]));
+      h->SetYTitle(cut->GetMethodString(true));
+      h->SetXTitle("#eta");
       h->SetMarkerColor(col);
       h->SetFillColor(col);
       h->SetLineColor(col);
@@ -397,13 +444,19 @@ struct MultCutDrawer : public SummaryDrawer
       rMin = TMath::Min(min, rMin);
       rMax = TMath::Max(max, rMax);
       all->Add(h);
-      TLatex* ltx = new TLatex(-1.7, i*0.075+0.01, 
-                              Form("%s %7g: %5.3f#pm%6.4f_{%6.4f}^{%6.4f}",
-                                   n.Data(), param[i-1], avg, var,
-                                   max-avg, avg-min));
-      ltx->SetTextSize(0.07);
-      ltx->SetTextColor(col);
-      h->GetListOfFunctions()->Add(ltx);
+      Double_t   hLtx  = 0.07;
+      Double_t   yLtx  = i*(hLtx+.005)+0.01;
+      TObjArray* lines = new TObjArray(3);
+      TLatex*    nLtx  = new TLatex(-0.75, yLtx, n);
+      TLatex*    pLtx  = new TLatex(-0.7,  yLtx, Form("X=%g", param[i-1]));
+      TLatex*    vLtx  = new TLatex(+0, yLtx, 
+                                   Form("%5.3f#pm%6.4f_{%6.4f}^{%6.4f}",
+                                        avg, var, max-avg, avg-min));
+      nLtx->SetTextAlign(31);pLtx->SetTextAlign(11);
+      nLtx->SetTextSize(hLtx);pLtx->SetTextSize(hLtx),vLtx->SetTextSize(hLtx);
+      nLtx->SetTextColor(col);pLtx->SetTextColor(col);vLtx->SetTextColor(col);
+      lines->Add(nLtx);lines->Add(pLtx);lines->Add(vLtx);
+      h->GetListOfFunctions()->Add(lines);
       printf("%5.3f+/-%6.4f ", avg, var);
     }
     TLatex* rLtx = new TLatex(6, fMC ? 0.65 : 0.55, 
@@ -413,7 +466,7 @@ struct MultCutDrawer : public SummaryDrawer
     rLtx->SetTextAlign(31);
     first->GetListOfFunctions()->Add(rLtx);
     Printf("-> %5.3f+/-%6.4f", rAvg, rVar);
-    stack->SetTitle(hist->GetTitle());
+    stack->SetTitle(cut->GetMethodString(true)); // hist->GetTitle());
     stack->SetMinimum(0); // 0.98*min);
     stack->SetMaximum(fMC ? 0.7 : 0.6); // 1.02*max);
     all->SetMinimum(0);
@@ -461,11 +514,18 @@ struct MultCutDrawer : public SummaryDrawer
     AliFMDCorrELossFit*       fit  = const_cast<AliFMDCorrELossFit*>(cFit);
     fit->CacheBins(8);
 
-    CreateCanvas("multCuts.pdf");
+    CreateCanvas("multCuts.pdf", true);
 
     fBody->cd();
     
-    Double_t y = .8;
+    Double_t y = .85;
+    TLatex* title = new TLatex(.5, y, "#Delta Cuts");
+    title->SetTextAlign(23);
+    title->SetTextFont(42);
+    title->SetTextSize(0.1);
+    title->Draw();
+    
+    y -= 0.11;
     DrawParameter(y, "Run #", Form("%lu", runNo));
     DrawParameter(y, "System", AliForwardUtil::CollisionSystemString(sys));
     DrawParameter(y, "#sqrt{s_{NN}}", 
@@ -473,7 +533,7 @@ struct MultCutDrawer : public SummaryDrawer
     DrawParameter(y, "L3 field", AliForwardUtil::MagneticFieldString(field));
     DrawParameter(y, "Simulation", Form("%s", mc ? "yes" : "no"));
     DrawParameter(y, "Satellite", Form("%s", sat ? "yes" : "no"));
-    PrintCanvas("Title");
+    PrintCanvas("Delta cuts");
 
     return true;
   }
index 5b42eee2c2ac9ed0ee91ee9da30afca394e198b0..a1a54789c14c14b2b5170f233faabd391d52b5e5 100644 (file)
@@ -80,6 +80,7 @@ TCollection* GetCollection(const TCollection* parent, const TString& name)
  */
 void RerunELossFits(Bool_t forceSet=false, 
                    const TString& input="forward_eloss.root", 
+                   Bool_t shift=true,
                    const TString& output="")
 {
   const char* fwd = "$ALICE_ROOT/PWGLF/FORWARD/analysis2";
@@ -92,7 +93,7 @@ void RerunELossFits(Bool_t forceSet=false,
     outName = input;
     outName.ReplaceAll(".root", "_rerun.root");
   }
-
+  Bool_t  allOk = false;
   try {
     // --- Open input file ---------------------------------------------
     inFile = TFile::Open(input, "READ");
@@ -100,10 +101,10 @@ void RerunELossFits(Bool_t forceSet=false,
       throw TString::Format("Failed to open %s", input.Data());
 
     // --- InFiled input collections --------------------------------------
-    TCollection* inFwdSum = GetCollection(inFile, "Forward");
+    TCollection* inFwdSum = GetCollection(inFile, "ForwardELossSums");
     if (!inFwdSum) throw TString("Cannot proceed without sums");
 
-    TCollection* inFwdRes = GetCollection(inFile, "ForwardResults");
+    TCollection* inFwdRes = GetCollection(inFile, "ForwardELossResults");
     if (!inFwdRes) throw TString("Cannot proceed with merged list");
 
     TCollection* inEFSum = GetCollection(inFwdRes, "fmdEnergyFitter");
@@ -120,11 +121,15 @@ void RerunELossFits(Bool_t forceSet=false,
     // --- Write copy of sum collection to output --------------------
     TCollection* outFwdSum = static_cast<TCollection*>(inFwdSum->Clone());
     outFile->cd();
-    outFwdSum->Write("Forward", TObject::kSingleKey);
+    outFwdSum->Write(inFwdSum->GetName(), TObject::kSingleKey);
     
     // --- Make our fitter object ------------------------------------
     AliFMDEnergyFitter* fitter = new AliFMDEnergyFitter("energy");
+    fitter->SetDoFits(true);
+    fitter->SetEnableDeltaShift(shift);
+    fitter->Init();
     if (forceSet || !fitter->ReadParameters(inEFSum)) {
+      Printf("Forced settings");
 
       const TAxis* etaAxis = static_cast<TAxis*>(GetObject(inEFSum,"etaAxis"));
       if (!etaAxis) throw TString("Cannot proceed without eta axis");
@@ -153,9 +158,9 @@ void RerunELossFits(Bool_t forceSet=false,
       // fitter->SetMaxChi2PerNDF(10);
       // Enable debug 
     }
-    fitter->SetDebug(1);
+    fitter->SetDebug(3);
     fitter->SetStoreResiduals(AliFMDEnergyFitter::kResidualSquareDifference);
-    // fitter->SetRegularizationCut(3e6);
+    fitter->SetRegularizationCut(1e6); // Lower by factor 3
     // Set the number of bins to subtract from maximum of distributions
     // to get the lower bound of the fit range
     // fitter->SetFitRangeBinWidth(2);
@@ -164,6 +169,7 @@ void RerunELossFits(Bool_t forceSet=false,
 
     // --- Now do the fits -------------------------------------------
     fitter->Print();
+    outFwdSum->ls("R");
     fitter->Fit(static_cast<TList*>(outFwdSum));
     
     // --- Copy full result folder -----------------------------------
@@ -179,8 +185,9 @@ void RerunELossFits(Bool_t forceSet=false,
 
     // --- Write out new results folder ------------------------------
     outFile->cd();
-    outFwdRes->Write("ForwardResults", TObject::kSingleKey);
+    outFwdRes->Write(inFwdRes->GetName(), TObject::kSingleKey);
     Printf("Wrote results to \"%s\" (%s)", outName.Data(), outFile->GetName());
+    allOk = true;
   }
   catch (const TString& e) {
     Error("RerunELossFits", e);
@@ -191,8 +198,9 @@ void RerunELossFits(Bool_t forceSet=false,
     outFile->Close();
   }
     
-  gROOT->Macro(Form("%s/corrs/DrawCorrELoss.C(false,false,\"%s\")", 
-                   fwd, outName.Data()));
+  if (allOk)
+    gROOT->Macro(Form("%s/corrs/DrawCorrELoss.C(false,false,\"%s\")", 
+                     fwd, outName.Data()));
 }
 
 
index f0264d88d1ed3d23b63acf6f401c63bd1ff1d306..038e2c6e79223d95e58448cfc6f559b518214cdf 100755 (executable)
@@ -9,6 +9,8 @@
 style=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/style.css 
 favicon=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/fmd_favicon.png
 logo=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/fmd_logo.png
+script=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/script.js
+topmk=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/makeIndex.sh
 
 # --- Help output ----------------------------------------------
 usage()
@@ -744,8 +746,15 @@ make_trend ${top}/$store
 
 # --- Make index files -----------------------------------------------
 make_index ${top}/${proddir} ${proddir}
-make_index ${top} "QA for the FMD" \
-    "For more information see <a href='https://twiki.cern.ch/twiki/bin/viewauth/ALICE/FMDQA'>TWiki pages</a>."
+# make_index ${top} "QA for the FMD" \
+#    "For more information see <a href='https://twiki.cern.ch/twiki/bin/viewauth/ALICE/FMDQA'>TWiki pages</a>."
+$topmk --title "QA for the FMD" \
+    --description "For more information see <a href='https://twiki.cern.ch/twiki/bin/viewauth/ALICE/FMDQA'>TWiki pages</a>." \
+    --link \
+    --max-depth 2 \
+    --output index.html 
+fix_perm index.html
+copy_aliroot_file $script
 
 chmod -R g+rwX ${top}/${proddir} >> ${redir} 2>&1
 
index e6dc1c450c3c78dbc4e0022934dc82ddf8ccf287..ae8ca287a902518e387616eb890b66b4f7ec8c5e 100644 (file)
@@ -210,12 +210,12 @@ protected:
   const Char_t* CutMethodName(Int_t lm) const
   {
     switch (lm) {
-    case 0: return "fixed";
-    case 1: return "X#times#Delta_{p}";
-    case 2: return "Fit range";
-    case 3: return "N#times#xi";
-    case 4: return "N#times(#xi+#sigma)";
-    case 5: return "P(#Delta<c)<X";
+    case 0: return "c=X";
+    case 1: return "c=X#times#Delta_{p}";
+    case 2: return "c:Lower bound of fit range";
+    case 3: return "c=#Delta_{p}-X#times#xi";
+    case 4: return "c=#Delta_{p}-X#times(#xi+#sigma)";
+    case 5: return "c:P(#Delta<c)<X";
     }
     return "unknown";
   }
@@ -243,6 +243,30 @@ protected:
     return method;
   }
   //____________________________________________________________________
+  void DrawCut(TVirtualPad* parent, Int_t sub, TH2* cuts)
+  {
+    if (!cuts) return;
+    THStack* stack = new THStack(cuts,"x");
+    stack->SetTitle(cuts->GetTitle());
+    for (Int_t i = 1; i <= cuts->GetNbinsY(); i++) {
+      TH1*     hist = static_cast<TH1*>(stack->GetHists()->At(i-1));
+      TString  name(cuts->GetYaxis()->GetBinLabel(i));
+      UShort_t det = UShort_t(name[3]-48);
+      Char_t   rng = name[4];
+      Color_t  col = RingColor(det, rng);
+      hist->SetTitle(name);
+      hist->SetMarkerStyle(20);
+      hist->SetMarkerColor(col);
+      hist->SetLineColor(col);
+      hist->SetFillColor(col);
+      hist->SetLineWidth(0);
+      hist->SetFillStyle(0);
+      hist->SetXTitle("#eta");
+      hist->SetYTitle(cuts->GetZaxis()->GetTitle());
+    }
+    DrawInPad(parent, sub, stack, "nostack p", kLegend|kCenter|kSouth);
+  }
+  //____________________________________________________________________
   void DrawSharingFilter()
   {
     Info("DrawSharingFilter", "Drawing sharing filter");
@@ -288,8 +312,8 @@ protected:
       hHigh           = GetH2(c, "highCuts");
       // if (hLow  && nFiles) hLow->Scale(1. / nFiles->GetVal());
       // if (hHigh && nFiles) hHigh->Scale(1. / nFiles->GetVal());
-      DrawInPad(fBody, 2, hLow,  "colz");
-      DrawInPad(fBody, 3, hHigh, "colz");
+      DrawCut(fBody, 2, hLow);
+      DrawCut(fBody, 3, hHigh);
     }
     PrintCanvas("Sharing filter");
 
@@ -321,7 +345,7 @@ protected:
                  "#Delta/#Delta_{mip} reconstructed and merged");
        DrawInPad(fBody, 1, anaELoss, "same");
        DrawInPad(fBody, 1, lowCut,  "lf same"); 
-       DrawInPad(fBody, 1, highCut, "lf same", kLogy|kLegend); 
+       DrawInPad(fBody, 1, highCut, "lf same", kLogy|kLegend|kNorth|kWest); 
        TVirtualPad* p = fBody->GetPad(1);
        p->cd();
        TLatex* l = new TLatex(1-p->GetRightMargin(), 
@@ -329,12 +353,38 @@ protected:
        l->SetNDC();
        l->SetTextAlign(32);
        l->Draw();
-       
-       DrawInPad(fBody, 2, GetH1(sc, "singleEloss"),    "",    kLogy,
+
+       TH1*     singles  = GetH1(sc, "singleEloss");
+       TH1*     doubles  = GetH1(sc, "doubleEloss");
+       TH1*     tripples = GetH1(sc, "tripleEloss");
+       Double_t int1     = singles->Integral(0,singles->GetNbinsX()+1);
+       Double_t int2     = doubles->Integral(0,doubles->GetNbinsX()+1);
+       Double_t int3     = tripples->Integral(0,tripples->GetNbinsX()+1);
+       Double_t intT     = int1 + int2 + int3;
+       Double_t f1       = intT > 0 ? int1 / intT : 0;
+       Double_t f2       = intT > 0 ? int2 / intT : 0;
+       Double_t f3       = intT > 0 ? int3 / intT : 0;
+
+       singles->GetXaxis()->SetRangeUser(-.1, 2);
+       DrawInPad(fBody, 2, singles,    "",    kLogy,
                  "#Delta/#Delta_{mip} for single, double, and tripple hits");
-       DrawInPad(fBody, 2, GetH1(sc, "doubleEloss"),    "same",kLogy);
-       DrawInPad(fBody, 2, GetH1(sc, "tripleEloss"),    "same",kLogy|kLegend);
+       DrawInPad(fBody, 2, doubles,    "same",    kLogy);
+       DrawInPad(fBody, 2, tripples,   "same",    kLogy);
+       DrawInPad(fBody, 2, lowCut,     "lf same", kLogy); 
+       DrawInPad(fBody, 2, highCut,    "lf same", kLogy|kLegend|kNorth|kWest); 
        
+       fBody->cd(2);
+       Double_t nameX = fParName->GetX();
+       Double_t valX  = fParVal->GetX();
+       Double_t intY  = 0.4;
+       fParName->SetX(0.5);
+       fParVal->SetX(0.7);
+       DrawParameter(intY, "Singles",  Form("%5.1f%%", 100*f1), 0.05);
+       DrawParameter(intY, "Doubles",  Form("%5.1f%%", 100*f2), 0.05);
+       DrawParameter(intY, "Tripples", Form("%5.1f%%", 100*f3), 0.05);
+       fParName->SetX(nameX);
+       fParVal->SetX(valX);
+
        DrawInPad(fBody, 3, GetH2(sc, "singlePerStrip"), "colz",kLogz);
        // DrawInPad(fBody, 4, GetH1(sc, "distanceBefore"), "",     0x2);
        // DrawInPad(fBody, 4, GetH1(sc, "distanceAfter"),  "same", 0x12);
@@ -342,11 +392,11 @@ protected:
        
        TH2* nB = GetH2(sc, "neighborsBefore");
        if (nB) { 
-         nB->GetXaxis()->SetRangeUser(0,8); 
-         nB->GetYaxis()->SetRangeUser(0,8); 
+         nB->GetXaxis()->SetRangeUser(0,2); 
+         nB->GetYaxis()->SetRangeUser(0,2); 
        }
        DrawInPad(fBody, 5, nB, "colz", kLogz);
-       DrawInPad(fBody, 5, GetH2(sc, "neighborsAfter"), "p same", kLogz,
+       DrawInPad(fBody, 5, GetH2(sc, "neighborsAfter"), "col same", kLogz,
                  "Correlation of neighbors before and after merging");
        DrawInPad(fBody, 6, GetH2(sc, "beforeAfter"),    "colz",   kLogz);
        
@@ -539,6 +589,7 @@ protected:
       accI->Scale(scale); 
       accO->Scale(scale);
       accI->SetMinimum(0); 
+      accI->SetMaximum(1.3);
     }
     TH2* lCuts = GetH2(c, "lowCuts");
     TH2* maxW  = GetH2(c, "maxWeights");
@@ -546,9 +597,11 @@ protected:
     if (nFiles && lCuts) lCuts->Scale(1. / nFiles->GetVal());
     if (nFiles && maxW)  maxW->Scale(1. / nFiles->GetVal());
     DrawInPad(p, 2, accI); 
-    DrawInPad(p, 2, accO,  "same", kLegend); 
-    DrawInPad(p, 3, lCuts, "colz");
-    DrawInPad(p, 4, maxW,  "colz");
+    DrawInPad(p, 2, accO,  "same", kLegend|kNorth|kCenter); 
+    DrawCut(p, 3, lCuts);
+    // DrawInPad(p, 3, lCuts, "colz");
+    DrawCut(p, 4, maxW);
+    // DrawInPad(p, 4, maxW,  "colz");
   
     PrintCanvas("Density calculator");
 
@@ -570,18 +623,18 @@ protected:
       TH1* occ       = GetH1(sc, "occupancy");
       if (eloss)     eloss    ->SetLineWidth(1);
       if (elossUsed) elossUsed->SetLineWidth(1);
-      if (eloss)     eloss->GetXaxis()->SetRangeUser(-.1, 2);
+      if (eloss)     eloss->GetXaxis()->SetRangeUser(0.05, 2);
       
       DrawInPad(fBody, 1, corr,    "colz",        kLogz);
       DrawInPad(fBody, 1, corrOut, "same",        kLogz);
       DrawInPad(fBody, 2, diff,    "HIST E",      kLogy);
-      DrawInPad(fBody, 2, diffOut, "HIST E SAME", kLogy|kLegend);
+      DrawInPad(fBody, 2, diffOut, "HIST E SAME", kLogy|kLegend|kNorth|kWest);
       DrawInPad(fBody, 3, occ,      "",           kLogy);
       DrawInPad(fBody, 4, eloss,    "",           kLogy, 
                "#Delta/#Delta_{mip} before and after cuts");
       DrawInPad(fBody, 4, elossUsed, "same",      kLogy);
       TGraph* thres = CreateCutGraph(tm, iq,  lCuts,  eloss, kYellow+1);
-      DrawInPad(fBody, 4, thres, "lf same", kLogy|kLegend); 
+      DrawInPad(fBody, 4, thres, "lf same", kLogy|kLegend|kNorth|kWest); 
 
       if (eloss && elossUsed) {
        Int_t    lowBin    = eloss->GetXaxis()->FindBin(0.)+1;
index d3df68368ab712a4a56d800dc58de6be446be3ee..b1d38b2397c57b3464614fe179cd325811eb8eaf 100644 (file)
@@ -31,6 +31,8 @@
 #  include <TPad.h>
 #  include <TRegexp.h>
 #  include <TGraph.h>
+#  include <sstream>
+#  include <iomanip>
 # else 
 #  ifdef __ACLIC__
 class THStack;
@@ -133,7 +135,7 @@ protected:
 
     for (UShort_t i = 0; i < 5; i++) {
       UShort_t      d = (i+1)/2+1;
-      Char_t        r = (i/2 == 1) ? 'i' : 'o';
+      Char_t        r = (i/2 == 1) ? 'o' : 'i';
       TLegendEntry* e = l->AddEntry("dummy", Form("FMD%d%c", d, r), "f");
       e->SetFillColor(RingColor(d, r));
       e->SetFillStyle(1001);
@@ -336,6 +338,25 @@ protected:
     return true;
   }
     
+  //___________________________________________________________________
+  /** 
+   * Get a Short_t parameter value 
+   * 
+   * @param c      Parent collection
+   * @param name   Name of parameter
+   * @param value  On return the value
+   * @param verb   If true, complain if not found 
+   */
+  static Bool_t GetParameter(const TObject*  c, 
+                            const TString&  name, 
+                            Short_t&        value,
+                            Bool_t          verb=true)
+  {
+    int v;
+    Bool_t r = DoGetParameter(GetObject(c, name, verb), c, v); 
+    value = v;
+    return r;
+  }
   //___________________________________________________________________
   /** 
    * Get a UShort_t parameter value 
@@ -357,7 +378,7 @@ protected:
   }
   //___________________________________________________________________
   /** 
-   * Get a UShort_t parameter value 
+   * Get a ULong_t parameter value 
    * 
    * @param c      Parent collection
    * @param name   Name of parameter
@@ -750,20 +771,22 @@ protected:
    * @param opts    Options
    * @param flags   Flags
    * @param title   Title on plot
+   *
+   * @return Drawn object - if any
    */
-  void DrawInPad(TVirtualPad* c, 
-                Int_t        padNo, 
-                TObject*     h, 
-                Option_t*    opts="",
-                UInt_t       flags=0x0,
-                const char*  title="")
+  TObject* DrawInPad(TVirtualPad* c, 
+                    Int_t        padNo, 
+                    TObject*     h, 
+                    Option_t*    opts="",
+                    UInt_t       flags=0x0,
+                    const char*  title="")
   {
     TVirtualPad* p = c->GetPad(padNo);
     if (!p) { 
       Warning("DrawInPad", "Pad # %d not found in %s", padNo, c->GetName());
-      return;
+      return 0;
     }
-    DrawInPad(p, h, opts, flags, title);
+    return DrawInPad(p, h, opts, flags, title);
   }
   /** 
    * Draw a clone of an object
@@ -771,17 +794,21 @@ protected:
    * @param o       Object
    * @param options Draw options
    * @param title   Title of object
+   *
+   * @return Drawn object - if any
    */
-  virtual void DrawObjClone(TObject* o, Option_t* options, const char* title)
+  virtual TObject* DrawObjClone(TObject* o, Option_t* options, 
+                               const char* title)
   {
     if (o->IsA()->InheritsFrom(TH1::Class())) 
-      DrawObjClone(static_cast<TH1*>(o), options, title);
+      return DrawObjClone(static_cast<TH1*>(o), options, title);
     else if (o->IsA()->InheritsFrom(THStack::Class())) 
-      DrawObjClone(static_cast<THStack*>(o), options, title);
+      return DrawObjClone(static_cast<THStack*>(o), options, title);
     else if (o->IsA()->InheritsFrom(TGraph::Class()))
-      o->DrawClone(options);
+      return o->DrawClone(options);
     else 
       o->Draw(options);
+    return o;
   }
   /** 
    * Draw an object clone 
@@ -789,8 +816,11 @@ protected:
    * @param o        Stack object
    * @param options  Draw options 
    * @param title    Title on plot
+   *
+   * @return Drawn object - if any
    */
-  virtual void DrawObjClone(THStack* o, Option_t* options, const char* title)
+  virtual TObject* DrawObjClone(THStack* o, Option_t* options, 
+                               const char* title)
   {
     // THStack* tmp = static_cast<THStack*>(o->Clone());
     o->Draw(options);
@@ -798,7 +828,7 @@ protected:
     TAxis*   xAxis = o->GetXaxis();
     if (!xAxis) {
       Warning("DrawObjClone", "No X-axis for drawn stack %s", o->GetName());
-      return;
+      return o;
     }
     TH1*     h     = 0;
     Int_t    nBins = xAxis->GetNbins();
@@ -817,6 +847,7 @@ protected:
       xAxis->Set(nBins, xMin, xMax);
       o->GetHistogram()->Rebuild();
     }
+    return o;
   }
   /** 
    * Draw an object clone 
@@ -824,11 +855,14 @@ protected:
    * @param o        Histogram
    * @param options  Draw options 
    * @param title    Title on plot 
+   *
+   * @return Drawn object - if any
    */
-  virtual void DrawObjClone(TH1* o, Option_t* options, const char* title)
+  virtual TObject* DrawObjClone(TH1* o, Option_t* options, const char* title)
   {
     TH1* tmp = o->DrawCopy(options);
     if (title && title[0] != '\0') tmp->SetTitle(title);
+    return tmp;
   }    
   //__________________________________________________________________
   static void GetLegendPosition(UInt_t    flags, TVirtualPad* p, 
@@ -885,16 +919,18 @@ protected:
    * @param opts    Options
    * @param flags   Flags
    * @param title   Title on plot
+   *
+   * @return Drawn object - if any
    */
-  void DrawInPad(TVirtualPad* p, 
-                TObject*     h, 
-                Option_t*    opts="",
-                UInt_t       flags=0x0,
-                const char*  title="")
+  TObject* DrawInPad(TVirtualPad* p, 
+                    TObject*     h, 
+                    Option_t*    opts="",
+                    UInt_t       flags=0x0,
+                    const char*  title="")
   {
     if (!p) { 
       Warning("DrawInPad", "No pad specified");
-      return;
+      return 0;
     }
     p->cd();
     // Info("DrawInPad", "Drawing in pad %p", p);
@@ -912,7 +948,7 @@ protected:
     if (!h) {
       if (!(flags & kSilent))
        Warning("DrawInPad", "Nothing to draw in pad # %s", p->GetName());
-      return;
+      return 0;
     }
     if (o.Contains("text", TString::kIgnoreCase)) {
       TH1* hh = static_cast<TH1*>(h);
@@ -920,7 +956,7 @@ protected:
       hh->SetMarkerSize(2);
       o.Append("30");
     }
-    DrawObjClone(h, o, title);
+    TObject* ret = DrawObjClone(h, o, title);
     
     if (flags & kLegend) {
       MakeLegend(p, flags, true);
@@ -928,6 +964,8 @@ protected:
     p->Modified();
     p->Update();
     p->cd();
+
+    return ret;
   }
   //__________________________________________________________________
   /** 
@@ -1035,6 +1073,121 @@ protected:
     fParName->SetTextSize(s);
     fParVal->SetTextSize(t);
   }  
+  template <typename T>
+  void DrawTParameter(Double_t&      y,
+                     TList*         list, 
+                     const TString& name) {
+    T value;
+    if (!GetParameter(list, name, value)) 
+      return;
+    std::stringstream s;
+    s << std::boolalpha << value;
+    DrawParameter(y, name, s.str().c_str(), 0);
+  }
+      
+  //__________________________________________________________________
+  /**
+   * Structure to hold a dived pad 
+   */
+  struct DividedPad { 
+    TVirtualPad*  fParent;
+    TVirtualPad** fSubs;
+    Bool_t        fLandscape;
+    Int_t         fNCol;
+    Int_t         fNRow;
+
+    DividedPad(TVirtualPad* p, Bool_t landscape, Int_t nCol, Int_t nRow) 
+      : fParent(p), 
+       fSubs(0),
+       fLandscape(landscape),
+       fNCol(landscape ? nRow : nCol),
+       fNRow(landscape ? nCol : nRow)
+    {
+      Int_t nPad = fNCol * fNRow;
+      fSubs      = new TVirtualPad*[nPad];
+    }
+    void Divide(Bool_t commonX, Bool_t commonY) {
+      if ((!commonX && !commonY) || (commonX && commonY)) {
+       // In case we have no common axis or do have both to be common,
+       // we directly use the TVirtualPad::Divide member function 
+       fParent->Divide(fNCol, fNRow, commonX ? 0 : 0.01, commonY ? 0 : 0.01);
+       for (Int_t iPad = 1; iPad <= fNRow*fNCol; iPad++) 
+         fSubs[iPad-1] = fParent->GetPad(iPad);
+      }
+      else if (commonX && !commonY) {
+       // We need to have common X axis, but not common Y axis. We first
+       // divide the pad in fNCol columns, and then each in to fNRow rows
+       fParent->Divide(fNCol, 1);
+       for (Int_t iCol = 1; iCol <= fNCol; iCol++) { 
+         TVirtualPad* q = fParent->GetPad(iCol);
+
+         if (fNRow == 1) {
+           fSubs[GetIdx(iCol,0)] = q;
+           continue;
+         }
+
+         q->Divide(1,fNRow,0,0);
+         for (Int_t iRow = 1; iRow <= fNRow; iRow++) 
+           fSubs[GetIdx(iCol, iRow)] = q->GetPad(iRow);
+       }
+      }
+      else if (!commonX && commonY) { 
+       // We need to have common Y axis, but not common X axis. We first
+       // divide the pad in fNRow rows, and then each in to fNCol columns
+       fParent->Divide(1, fNRow);
+       for (Int_t iRow = 1; iRow <= fNRow; iRow++) { 
+         TVirtualPad* q = fParent->GetPad(iRow);
+
+         if (fNCol == 1) {
+           fSubs[GetIdx(0,iRow)] = q;
+           continue;
+         }
+         
+         q->Divide(fNCol,1,0,0);
+         for (Int_t iCol = 1; iCol <= fNCol; iCol++) 
+           fSubs[GetIdx(iCol, iRow)] = q->GetPad(iCol);
+       }
+      }
+    }
+    virtual ~DividedPad() { if (fSubs) delete [] fSubs; }
+    /** 
+     * Get a sub-pad 
+     * 
+     * @param idx Index (0 based)
+     * 
+     * @return Pad or null
+     */
+    TVirtualPad* GetPad(Int_t idx) {
+      if (!fSubs) {
+       ::Warning("GetPad","No sub-pads");
+       return 0;
+      }
+      if (idx < 0 || idx >= (fNRow*fNCol)) {
+       ::Warning("GetPad", "Inded %d out of bounds [%d,%d]", 
+                 idx, 0, fNRow*fNCol);
+       return 0;
+      }
+      return fSubs[idx];
+    }
+    Int_t GetIdx(Int_t iCol, Int_t iRow) const 
+    {
+      return (iRow-1) * fNCol + iCol;
+    }
+    /** 
+     * Get a sub-pad 
+     * 
+     * @param iRow  Row number (1-based)
+     * @param iCol  Column number (1-based)
+     * 
+     * @return Pad or null
+     */
+    TVirtualPad* GetPad(Int_t iCol, Int_t iRow) { 
+      if (iRow < 0 || iRow > fNRow) return 0;
+      if (iCol < 0 || iRow > fNCol) return 0;
+      return GetPad(GetIdx(iCol, iRow));
+    }
+  };
+    
   //__________________________________________________________________
   void DivideForRings(Bool_t commonX, Bool_t commonY)
   {
@@ -1279,7 +1432,35 @@ protected:
     printf("Press enter to continue");
     std::cin.get();
   }
+  static void CompileScript(const TString& name, 
+                           const TString& sub, 
+                           const TString& check,
+                           Bool_t         force)
+  {
+    if (!check.IsNull() && gROOT->GetClass(check)) return;
 
+    TString fwd =gSystem->ExpandPathName("$ALICE_ROOT/PWGLF/FORWARD/analysis2");
+    TString macPath(gROOT->GetMacroPath());
+    TString incPath(gSystem->GetIncludePath());
+    if (!macPath.Contains(fwd)) macPath.Append(Form(":%s", fwd.Data()));
+    if (!incPath.Contains(fwd)) gSystem->AddIncludePath(Form("-I%s",
+                                                            fwd.Data()));
+    if (!sub.IsNull()) { 
+      TObjArray* subs = sub.Tokenize(": ");
+      TObject*   pSub = 0;
+      TIter      iSub(subs);
+      while ((pSub = iSub())) {
+       TString subDir = gSystem->ConcatFileName(fwd, pSub->GetName());
+       if (!macPath.Contains(subDir))
+         macPath.Append(Form(":%s", subDir.Data()));
+       if (!incPath.Contains(subDir)) 
+         gSystem->AddIncludePath(Form("-I%s", subDir.Data()));
+      }
+    }
+    
+    gROOT->LoadMacro(Form("%s%s", name.Data(), (force ? "++g" : "+")));
+    
+  }
   //____________________________________________________________________
   virtual void DrawEventInspector(TCollection* parent)
   {
index 74b6c3b02a21f6b77b6de2cb5a819298af280809..c39f5524f9c133eebeb3e956c417880c717a2ff4 100644 (file)
@@ -187,13 +187,7 @@ protected:
     UShort_t cLow  = centAxis && !onlyMB ? centAxis->GetXmin() : 0;
     UShort_t cHigh = centAxis && !onlyMB ? centAxis->GetXmax() : 100;
 
-    TString savPath(gROOT->GetMacroPath());
-    gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
-                            gROOT->GetMacroPath()));
-    // Always recompile 
-    if (!gROOT->GetClass("RefData"))
-      gROOT->LoadMacro("OtherData.C++");
-    gROOT->SetMacroPath(savPath);
+    CompileScript("OtherData.C", "", "RefData", false);
 
     // If we have V0AND trigger, get NSD other data
     TMultiGraph* other = 0;
index 170fcab6e22f17bfed6f6d4766f30602d3c9312e..1988169a031dc4daeca5f76d84edf2796c6b2eeb 100644 (file)
@@ -117,6 +117,7 @@ protected:
     TrainSetup::SaveSetup(asShellScript);
     SaveExtract();
     SaveSummarize();
+    SaveReFit();
   }
   void SaveExtract()
   {
@@ -126,11 +127,12 @@ protected:
       return;
     }
     f << "// Generated by " << ClassName() << "\n"
-      << "void Extract(Bool_t mc=" << HasMCHandler() << ")\n"
+      << "void Extract(Bool_t mc=" << HasMCHandler() << ",\n"
+      << "             const char* file=\"forward_eloss.root\")\n"
       << "{\n"
       << "  const char* fwd=\"$ALICE_ROOT/PWGLF/FORWARD/analysis2\";\n"
       << "  gROOT->LoadMacro(Form(\"%s/corrs/ExtractELoss.C\",fwd));\n"
-      << "  ExtractELoss(\"forward_eloss.root\",mc);\n" 
+      << "  ExtractELoss(file,mc);\n" 
       << "}\n"
       << "// EOF" << std::endl;
     f.close();
@@ -155,6 +157,29 @@ protected:
       << "// EOF" << std::endl;
     f.close();
   }
+  void SaveReFit()
+  {
+    std::ofstream f("ReFit.C");
+    if (!f) { 
+      Error("SaveRerun", "Failed to open ReFit.C script");
+      return;
+    }
+    f << std::boolalpha 
+      << "// Generated by " << ClassName() << "\n"
+      << "// If force=true, then force set parameters\n"
+      << "// If shift=true, enable extra shift in Delta from \sigma/xi
+      << "//\n"
+      << "void ReFit(Bool_t      force=false,\n"
+      << "           Bool_t      shift=true,\n"
+      << "           const char* filename=\"forward_eloss.root\")\n"
+      << "{\n"
+      << "  const char* fwd=\"$ALICE_ROOT/PWGLF/FORWARD/analysis2\";\n"
+      << "  gROOT->LoadMacro(Form(\"%s/corrs/RerunELossFits.C\",fwd));\n"
+      << "  RerunELossFits(force,filename);\n"
+      << "}\n"
+      << "// EOF" << std::endl;
+    f.close();
+  }
   void PostShellCode(std::ostream& f)
   {
     f << "  mc=" << std::boolalpha << HasMCHandler() << "\n"
index 9181c9d2b4a6ba5b562616cbb252a7668609ec2b..0639a885639ae840fd23d6dad831172971055b67 100644 (file)
@@ -191,7 +191,7 @@ protected:
       << "          Float_t        vzMax=-999)\n"
       << "{\n"
       << "  const char* fwd=\"$ALICE_ROOT/PWGLF/FORWARD/analysis2\";\n"
-      << "  gROOT->LoadMacro(Form(\"%s/DrawdNdeta.C++\",fwd));\n"
+      << "  gROOT->LoadMacro(Form(\"%s/DrawdNdeta.C+\",fwd));\n"
       << "  if (title.EqualTo(\"help\",TString::kIgnoreCase)) {\n"
       << "    DrawdNdeta(\"help\"); // Get the help\n"
       << "    return;\n"
index b1ff38594ca1c11d0a4a74716626dff12acba8a4..c5ad9e48da85587049982d37ef6c1446ce1c6b2f 100644 (file)
@@ -346,7 +346,7 @@ struct ChainBuilder
                               const TChain* chain)
   {
     if (!chain) return;
-    
+    TDirectory* savDir = gDirectory;
     TFile* out = TFile::Open(output, "RECREATE");
     
     TFileCollection* collection = new TFileCollection(chain->GetName());
@@ -377,10 +377,12 @@ struct ChainBuilder
     TFileInfoMeta* cMeta = new TFileInfoMeta(chain->GetName(), 
                                             "TTree", nEntries);
     collection->AddMetaData(cMeta);
+    out->cd();
     collection->Write();
     Printf("A total of %lld entries", nEntries);
     // collection->Print("MFL");
     out->Close();
+    savDir->cd();
   }
   //------------------------------------------------------------------
   /** 
index 37a438d46cf5921deb81b34a778565f190b68f40..f89e22ed5de614f91b0e6885e4ff1ad12101fdff 100644 (file)
@@ -23,7 +23,8 @@ CreateFileCollection(const TString& dir="/data/alice/data/ppb/LHC12g/pass1/18835
   if (recursive) flags |= ChainBuilder::kRecursive;
   if (mc)        flags |= ChainBuilder::kMC;
   UShort_t type = ChainBuilder::CheckSource(dir, flags);
-  Info("", "type=%d", type);
+  Info("", "type=%d, dir=%s tN=%s pa=%s, flags=0x%x", type,
+       dir.Data(), tN.Data(), pa.Data(), flags);
   TChain* chain = ChainBuilder::Create(type, dir, tN, pa, flags);
   if (!chain) { 
     Error("CreateFileCollection", "Failed to make chain");
index 3112977765d24bd12d56eb0ee5ad5a91f2427844..438171744dba315d982f2065a722051391ff1819 100644 (file)
@@ -15,7 +15,10 @@ CreateIndex(const TString& dir, const TString& tree="esdTree")
   if      (tree.EqualTo("esdTree", TString::kIgnoreCase)) pat="AliESDs*";
   else if (tree.EqualTo("aodTree", TString::kIgnoreCase)) pat="AliAOD*";
   else    Warning("", "Unknown tree: %s, pattern set to *.root", tree.Data());
-  if (mc) pat.Prepend("root_archive.zip@");
+  if (mc) {
+    pat.Prepend("root_archive.zip@");
+    pat.ReplaceAll("*", ".root");
+  }
 
 
   TString opts;
@@ -25,16 +28,18 @@ CreateIndex(const TString& dir, const TString& tree="esdTree")
   opts.Append("&recursive");
   if (mc) opts.Append("&mc");
 
+  TString realDir(gSystem->ExpandPathName(dir.Data()));
+
   TUrl url;
   url.SetProtocol("local");
   url.SetPort(0);
-  url.SetFile(dir);
+  url.SetFile(realDir);
   url.SetAnchor(tree);
   url.SetOptions(opts);
   
   Printf("Running ChainBuilder::CreateCollection(\"%s/index.root\",\"%s\")",
-        dir.Data(), url.GetUrl());
-  ChainBuilder::CreateCollection(Form("%s/index.root", dir.Data()), url);
+        realDir.Data(), url.GetUrl());
+  ChainBuilder::CreateCollection(Form("%s/index.root", realDir.Data()), url);
 }
 
                                 
index 0e2de91f83275b0f46b6ef56860d28dca6034fea..95cf967a241135f2f184a7b7cc91440268e8b893 100644 (file)
@@ -249,7 +249,9 @@ struct Helper
     u.SetFile(path);
     u.SetAnchor("aodTree");
     TString opt(u.GetOptions());
+    // if (opt.Contains("AliESDs")) 
     opt.ReplaceAll("AliESDs", "AliAOD");
+    // else                         opt.Append("&pattern=AliAOD*.root");
     u.SetOptions(opt);
 
     return u.GetUrl();
index 68e637e581376528a149136a2e0313e2c9eeafcf..6e261e70fa48ed294cf96fc8327c13ec2961bf5b 100644 (file)
@@ -29,7 +29,6 @@
 #pragma link off all functions;
 
 #pragma link C++ nestedclasses;
-
 // ZDC tasks 
 #pragma link C++ class AliAnalysisTaskZDCPbPb+;
 #pragma link C++ class AliAnalysisTaskZDCTreeMaker+;
@@ -96,6 +95,7 @@
 #pragma link C++ class AliForwardUtil+;
 #pragma link C++ class AliForwardUtil::Histos+;
 #pragma link C++ class AliForwardUtil::RingHistos+;
+// #pragma link C++ class AliForwardUtil::ELossFitter+;
 
 // FMD corrections
 #pragma link C++ class AliFMDCorrAcceptance+;