]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Override base class scaling function to also smoothen the histograms.
authorcholm <Christian.Holm.Christensen@cern.ch>
Thu, 13 Nov 2014 13:54:24 +0000 (14:54 +0100)
committercholm <Christian.Holm.Christensen@cern.ch>
Thu, 13 Nov 2014 13:54:24 +0000 (14:54 +0100)
PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.cxx
PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.h

index 95fa899d9f8343050441f96ad95788f448659ee7..f3768db36220b1972ff95cec7c6ff31b219b3e42 100644 (file)
@@ -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<TH2*>(l->FindObject(name));
-  if (!h) return false;
-  
-  // Smooth distributions looking at 3 bins together. 
-  TH2* orig = static_cast<TH2*>(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);
index d8029eeddfdee21a50edc41f79daf1bc6c1eaf27..4b8d88fe9abd4da9c3b4769d01fdfc8defe6ca95 100644 (file)
@@ -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 
      *