From: cholm Date: Thu, 13 Nov 2014 13:54:24 +0000 (+0100) Subject: Override base class scaling function to also smoothen the histograms. X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=92fdfa3196cd677d25475b2c4b2c450b2007596e;p=u%2Fmrichter%2FAliRoot.git Override base class scaling function to also smoothen the histograms. --- diff --git a/PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.cxx b/PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.cxx index 95fa899d9f8..f3768db3622 100644 --- a/PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.cxx +++ b/PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.cxx @@ -231,25 +231,15 @@ AliFMDMCTrackInspector::RingHistos::FillMC(UShort_t flag, Double_t eta, } //____________________________________________________________________ -Bool_t -AliFMDMCTrackInspector::RingHistos::Smooth(const TList* dir, - const char* name) const +void +AliFMDMCTrackInspector::RingHistos::Scale(TH1* dist) const { - TList* l = GetOutputList(dir); - if (!l) return false; - - TH2* h = static_cast(l->FindObject(name)); - if (!h) return false; - - // Smooth distributions looking at 3 bins together. - TH2* orig = static_cast(h->Clone(Form("%s_orig", name))); - l->Add(orig); - - h->Smooth(1, "k3a"); - - return true; + // First scale to bin width + AliFMDEnergyFitter::RingHistos::Scale(dist); + // Then smoothen the histogram + dist->Smooth(2); } - + //____________________________________________________________________ TObjArray* AliFMDMCTrackInspector::RingHistos::Fit(TList* dir, @@ -263,10 +253,6 @@ AliFMDMCTrackInspector::RingHistos::Fit(TList* dir, Double_t regCut, EResidualMethod residuals) const { - if (!Smooth(dir, "eloss")) return 0; - if (!Smooth(dir, "primary")) return 0; - if (!Smooth(dir, "secondary")) return 0; - TObjArray* all = FitSlices(dir, "eloss", lowCut, nParticles, minEntries, minusBins, relErrorCut, chi2nuCut, minWeight, regCut, residuals, false, 0); diff --git a/PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.h b/PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.h index d8029eeddfd..4b8d88fe9ab 100644 --- a/PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.h +++ b/PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.h @@ -159,14 +159,13 @@ protected: */ virtual void FillMC(UShort_t flag, Double_t eta, Double_t mult); /** - * Smooth the selected histogram + * Do scaling of histogram before fitting. This can be + * overwritten to do some smoothing or the like. By default, this + * simply scales to the bin width. * - * @param dir Directory - * @param name Name of histogram - * - * @return true on success - */ - virtual Bool_t Smooth(const TList* dir, const char* name) const; + * @param dist Histogram to scale. + */ + virtual void Scale(TH1* dist) const; /** * Fit the final distributions - called via Terminate *