ground. Other minor changes to the overall code.
)
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
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
// --- 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
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;
}
//
#include "AliFMDCorrELossFit.h"
#include "AliForwardUtil.h"
+#include "AliLandauGaus.h"
#include <TF1.h>
#include <TGraph.h>
#include <TBrowser.h>
#include <THStack.h>
#include <TLatex.h>
#include <TLegend.h>
+#include <TLine.h>
#include <TH1D.h>
#include <AliLog.h>
#include <TMath.h>
}
//____________________________________________________________________
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),
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;
// \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:
// 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);
}
//____________________________________________________________________
//
// 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:
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;
}
<< (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]);
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;
}
//____________________________________________________________________
bool good = false;
bool vals = false;
bool legd = false;
+ bool peak = false;
if (opt.Contains("COMP")) {
opt.ReplaceAll("COMP","");
comp = true;
if (!opt.Contains("SAME")) {
gPad->Clear();
}
-
+ if (opt.Contains("PEAK")) {
+ peak = true;
+ }
TLegend* l = 0;
if (legd) {
l = new TLegend(.3, .5, .59, .94);
}
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);
}
+ 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;
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);
void
AliFMDCorrELossFit::CacheBins(UShort_t minQuality) const
{
+ AliLandauGaus::EnableSigmaShift(TestBit(kHasShift));
if (fCache.GetSize() > 0) return;
Int_t nRings = fRings.GetEntriesFast();
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();
class AliFMDCorrELossFit : public TObject
{
public:
+ enum {
+ kHasShift = (1<<14)
+ };
/**
* POD structure to hold data from fits
*
//
#include "AliFMDEnergyFitter.h"
#include "AliForwardUtil.h"
+#include "AliLandauGausFitter.h"
#include <AliESDFMD.h>
#include <TAxis.h>
#include <TList.h>
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;
{
fCentralityAxis.Set(n-1, bins);
}
-
+//____________________________________________________________________
+void
+AliFMDEnergyFitter::SetEnableDeltaShift(Bool_t use)
+{
+ AliLandauGaus::EnableSigmaShift(use ? 1 : 0);
+}
//____________________________________________________________________
Bool_t
// 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) {
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;
AliFMDCorrELossFit* obj = new AliFMDCorrELossFit;
obj->SetEtaAxis(fEtaAxis);
obj->SetLowCut(fLowCut);
+ if (AliLandauGaus::EnableSigmaShift())
+ obj->SetBit(AliFMDCorrELossFit::kHasShift);
TIter next(&fRingHistos);
RingHistos* o = 0;
// 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
}
// Create a fitter object
- AliForwardUtil::ELossFitter f(lowCut, maxRange, minusBins);
+ AliLandauGausFitter f(lowCut, maxRange, minusBins);
f.Clear();
f.SetDebug(fDebug > 2);
#include <TClonesArray.h>
#include "AliFMDCorrELossFit.h"
#include "AliForwardUtil.h"
+#include "AliLandauGaus.h"
class TH1;
class TH2;
class AliESDFMD;
*/
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
* @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);
+
/* @} */
// -----------------------------------------------------------------
/**
* \sigma = \sigma_1
* @f]
*
- * See also AliForwardUtil::ELossFitter
+ * See also AliLandauGausFitter
*/
class AliFMDMCHitEnergyFitterTask : public AliBaseESDTask
{
#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()
fPrimary->Sumw2();
fPrimary->SetStats(0);
fPrimary->SetDirectory(0);
+ DEFINE(MCAOD_SLOT,AliAODForwardMult::Class());
+ DEFINE(PRIM_SLOT, TH2D::Class());
}
//____________________________________________________________________
ah->AddBranch("TH2D", &fPrimary);
}
+//____________________________________________________________________
+Bool_t
+AliForwardMCMultiplicityTask::Book()
+{
+ Bool_t ret = AliForwardMultiplicityBase::Book();
+ POST(MCAOD_SLOT, &fMCAODFMD);
+ POST(PRIM_SLOT, fPrimary);
+ return ret;
+}
//____________________________________________________________________
void
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,
* @{
* @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.
*/
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();
+ /*
* @}
*/
/**
#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)
fHTiming(0)
{
DGUARD(fDebug, 3,"Named CTOR of AliForwardMultiplicityBase %s",name);
+
+ DEFINE(AOD_SLOT);
}
// Parameters:
// dbg debug level
//
- AliBaseESDTask:: SetDebug(dbg);
+ AliBaseESDTask:: SetDebug(dbg);
GetSharingFilter() .SetDebug(dbg);
GetDensityCalculator().SetDebug(dbg);
GetCorrections() .SetDebug(dbg);
xaxis->SetBinLabel(kTimingTotal, "Total");
fList->Add(fHTiming);
}
+
+ POST(AOD_SLOT);
return true;
}
//____________________________________________________________________
}
//____________________________________________________________________
Bool_t
+AliForwardMultiplicityBase::PostEvent()
+{
+ POST(AOD_SLOT);
+ return true;
+}
+//____________________________________________________________________
+Bool_t
AliForwardMultiplicityBase::Finalize()
{
//
* @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
*
#include <TMath.h>
#include <TError.h>
#include <TROOT.h>
-#define FIT_OPTIONS "RNQS"
+#define FIT_OPTIONS "RNS"
//====================================================================
ULong_t AliForwardUtil::AliROOTRevision()
}
//====================================================================
+#if 0 // Moved to separate classes
Int_t AliForwardUtil::fgConvolutionSteps = 100;
Double_t AliForwardUtil::fgConvolutionNSigma = 5;
namespace {
// 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
// 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;
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,
// 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);
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)
// 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);
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] "
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",
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);
{
//
// 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
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"));
#endif
return comp;
}
+#endif
//====================================================================
AliForwardUtil::Histos::~Histos()
/* @} */
//==================================================================
+#if 0 // Moved to separate classes
/**
* @{
* @name Energy stragling functions
virtual ~ELossFitter();
void SetDebug(Bool_t debug=true) { fDebug = debug; }
/**
- * Clear internal arrays
+ * Clear internal arrays
*
*/
void Clear();
Bool_t fDebug;
};
/* @} */
-
+#endif
//==================================================================
/**
{
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);
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);
{
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);
gROOT->GetMacroPath()));
// Always recompile
if (!gROOT->GetClass("RefData"))
- gROOT->LoadMacro("OtherData.C++");
+ gROOT->LoadMacro("OtherData.C+");
gROOT->SetMacroPath(savPath);
// --- Get the central results -----------------------------------
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")) {
{
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);
*/
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
*
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
*
{
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",
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;
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();
}
/**
* @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,
* @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,
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
*/
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();
}
*/
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();
}
*/
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
*
*/
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();
*/
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();
* @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);
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");
ClearCanvas();
TObjArray* ra = fits->GetRingArray(d, r);
if (!ra) continue;
- DrawELossFits(d, r, ra, dists, resis);
+ DrawELossFits(d, r, ra, dists, resis, few);
}
}
}
* @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()));
}
// 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");
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);
Setup(true);
CorrDrawer::Summarize(AliForwardCorrectionManager::kELossFits,
- mc, file, local);
+ mc, file, local, "LANDSCAPE FEW");
}
/**
* Draw the energy loss correction
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"));
CorrDrawer* cd = new CorrDrawer;
cd->fELossExtra = file;
cd->fMinQuality = 8;
+ // cd->fLandscape = true;
cd->Summarize(const_cast<const AliFMDCorrELossFit*>(fits), true);
}
Double_t savY = fParVal->GetY();
fParVal->SetX(.4);
fParVal->SetY(.4);
-
+ // fPause = true;
+
TIter iCut(&fCuts);
TObject* pCut = 0;
while ((pCut = iCut())) {
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()))) {
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());
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);
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,
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);
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}}",
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;
}
*/
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";
outName = input;
outName.ReplaceAll(".root", "_rerun.root");
}
-
+ Bool_t allOk = false;
try {
// --- Open input file ---------------------------------------------
inFile = TFile::Open(input, "READ");
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");
// --- 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");
// 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);
// --- Now do the fits -------------------------------------------
fitter->Print();
+ outFwdSum->ls("R");
fitter->Fit(static_cast<TList*>(outFwdSum));
// --- Copy full result folder -----------------------------------
// --- 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);
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()));
}
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()
# --- 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
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";
}
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");
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");
"#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(),
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);
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);
accI->Scale(scale);
accO->Scale(scale);
accI->SetMinimum(0);
+ accI->SetMaximum(1.3);
}
TH2* lCuts = GetH2(c, "lowCuts");
TH2* maxW = GetH2(c, "maxWeights");
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");
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;
# include <TPad.h>
# include <TRegexp.h>
# include <TGraph.h>
+# include <sstream>
+# include <iomanip>
# else
# ifdef __ACLIC__
class THStack;
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);
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
}
//___________________________________________________________________
/**
- * Get a UShort_t parameter value
+ * Get a ULong_t parameter value
*
* @param c Parent collection
* @param name Name of parameter
* @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
* @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
* @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);
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();
xAxis->Set(nBins, xMin, xMax);
o->GetHistogram()->Rebuild();
}
+ return o;
}
/**
* Draw an object clone
* @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,
* @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);
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);
hh->SetMarkerSize(2);
o.Append("30");
}
- DrawObjClone(h, o, title);
+ TObject* ret = DrawObjClone(h, o, title);
if (flags & kLegend) {
MakeLegend(p, flags, true);
p->Modified();
p->Update();
p->cd();
+
+ return ret;
}
//__________________________________________________________________
/**
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)
{
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)
{
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;
TrainSetup::SaveSetup(asShellScript);
SaveExtract();
SaveSummarize();
+ SaveReFit();
}
void SaveExtract()
{
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();
<< "// 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"
<< " 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"
const TChain* chain)
{
if (!chain) return;
-
+ TDirectory* savDir = gDirectory;
TFile* out = TFile::Open(output, "RECREATE");
TFileCollection* collection = new TFileCollection(chain->GetName());
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();
}
//------------------------------------------------------------------
/**
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");
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;
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);
}
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();
#pragma link off all functions;
#pragma link C++ nestedclasses;
-
// ZDC tasks
#pragma link C++ class AliAnalysisTaskZDCPbPb+;
#pragma link C++ class AliAnalysisTaskZDCTreeMaker+;
#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+;