]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Coding Rules (Zaida)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Oct 2010 07:55:44 +0000 (07:55 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Oct 2010 07:55:44 +0000 (07:55 +0000)
PWG3/vertexingHF/AliHFPtSpectrum.cxx
PWG3/vertexingHF/AliHFPtSpectrum.h

index 728c94ed1f8b321939480518516eee9cb413c519..1699dcb5c229d7cb14de37cb5cc3ccff716e536e 100644 (file)
 //***********************************************************************
 
 #include <Riostream.h>
-
-#include "TMath.h"
-#include "TH1.h"
-#include "TH1D.h"
-#include "TGraphAsymmErrors.h"
 #include "TNamed.h"
-#include "TCanvas.h"
 
 #include "AliLog.h"
 #include "AliHFPtSpectrum.h"
@@ -285,7 +279,7 @@ void AliHFPtSpectrum::SetMCptSpectra(TH1D *hDirect, TH1D *hFeedDown){
   //
   // If the predictions shape do not have the same
   //  bin width (check via number of bins) as the reconstructed spectra, change them 
-  if (hDirect->GetBinWidth(1) == fhRECpt->GetBinWidth(1)) {
+  if ( TMath::Abs(hDirect->GetBinWidth(1) - fhRECpt->GetBinWidth(1))< 0.0001 ) {
 
     fhDirectMCpt = (TH1D*)hDirect->Clone();
     fhDirectMCpt->SetNameTitle("fhDirectMCpt"," direct theoretical prediction");
@@ -319,7 +313,7 @@ void AliHFPtSpectrum::SetFeedDownMCptSpectra(TH1D *hFeedDown){
   //
   // If the predictions shape do not have the same
   //  bin width (check via number of bins) as the reconstructed spectra, change them 
-  if (hFeedDown->GetBinWidth(1) == fhRECpt->GetBinWidth(1)) {
+  if ( TMath::Abs(hFeedDown->GetBinWidth(1) - fhRECpt->GetBinWidth(1))< 0.0001 ) {
 
     fhFeedDownMCpt = (TH1D*)hFeedDown->Clone();
     fhFeedDownMCpt->SetNameTitle("fhFeedDownMCpt"," feed-down theoretical prediction");
@@ -360,7 +354,7 @@ void AliHFPtSpectrum::SetMCptDistributionsBounds(TH1D *hDirectMax, TH1D *hDirect
   //
   // If the predictions shape do not have the same
   //  bin width (check via number of bins) as the reconstructed spectra, change them 
-  if (hFeedDownMax->GetBinWidth(1) == fhRECpt->GetBinWidth(1)) {
+  if ( TMath::Abs(hFeedDownMax->GetBinWidth(1) - fhRECpt->GetBinWidth(1))< 0.0001 ) {
     
     fhDirectMCptMax = (TH1D*)hDirectMax->Clone();
     fhDirectMCptMin = (TH1D*)hDirectMin->Clone();
@@ -411,7 +405,7 @@ void AliHFPtSpectrum::SetFeedDownMCptDistributionsBounds(TH1D *hFeedDownMax, TH1
   //
   // If the predictions shape do not have the same
   //  bin width (check via number of bins) as the reconstructed spectra, change them 
-  if (hFeedDownMax->GetBinWidth(1) == fhRECpt->GetBinWidth(1)) {
+  if ( TMath::Abs(hFeedDownMax->GetBinWidth(1) - fhRECpt->GetBinWidth(1))< 0.0001 ) {
     
     fhFeedDownMCptMax = (TH1D*)hFeedDownMax->Clone();
     fhFeedDownMCptMin = (TH1D*)hFeedDownMin->Clone(); 
@@ -498,7 +492,7 @@ void AliHFPtSpectrum::SetReconstructedSpectrumSystematics(TGraphAsymmErrors *gRe
   Double_t gxbincenter=0., gybincenter=0.;
   fgRECSystematics->GetPoint(1,gxbincenter,gybincenter);
   Double_t hbincenter = fhRECpt->GetBinCenter(1);
-  if ( (gbinwidth != hbinwidth) || (gxbincenter!=hbincenter) ) {
+  if ( TMath::Abs(gbinwidth - hbinwidth)>0.0001 || TMath::Abs(gxbincenter - hbincenter)>0.0001 ) {
     AliError(" The reconstructed spectrum and its systematics don't seem compatible");
     return;
   }
@@ -586,7 +580,7 @@ void AliHFPtSpectrum::ComputeHFPtSpectrum(Double_t deltaY, Double_t branchingRat
   if (fAsymUncertainties & !fgSigmaCorrConservative) fgSigmaCorrConservative = new TGraphAsymmErrors(nbins+1);
 
   // protect against null denominator
-  if (deltaY==0. || fLuminosity[0]==0. || fTrigEfficiency[0]==0. || branchingRatioC==0.) {
+  if (deltaY<0.01 || fLuminosity[0]<0.0000001 || fTrigEfficiency[0]<0.0000001 || branchingRatioC<0.000000001) {
     AliError(" Hey you ! Why luminosity or trigger-efficiency or the c-BR or delta_y are set to zero ?! ");
     return ;
   }
@@ -1145,9 +1139,9 @@ void AliHFPtSpectrum::CalculateFeedDownCorrectedSpectrumNb(Double_t deltaY, Doub
     kfactor = deltaY*branchingRatioBintoFinalDecay*fLuminosity[0]*fTrigEfficiency[0]*fhFeedDownEffpt->GetBinContent(ibin)*fhFeedDownMCpt->GetBinContent(ibin) ;
     //
     if (fAsymUncertainties) {
-      Double_t Nb =  fhFeedDownMCpt->GetBinContent(ibin);
-      Double_t NbDmax = fhFeedDownMCptMax->GetBinContent(ibin) - fhFeedDownMCpt->GetBinContent(ibin);
-      Double_t NbDmin = fhFeedDownMCpt->GetBinContent(ibin) - fhFeedDownMCptMin->GetBinContent(ibin);
+      Double_t nb =  fhFeedDownMCpt->GetBinContent(ibin);
+      Double_t nbDmax = fhFeedDownMCptMax->GetBinContent(ibin) - fhFeedDownMCpt->GetBinContent(ibin);
+      Double_t nbDmin = fhFeedDownMCpt->GetBinContent(ibin) - fhFeedDownMCptMin->GetBinContent(ibin);
 
       // Systematics but feed-down
       if (fgRECSystematics){
@@ -1159,13 +1153,13 @@ void AliHFPtSpectrum::CalculateFeedDownCorrectedSpectrumNb(Double_t deltaY, Doub
       // min value with the maximum Nb
       errvalueExtremeMin = TMath::Sqrt( ( (kfactor*fLuminosity[1]/fLuminosity[0])*(kfactor*fLuminosity[1]/fLuminosity[0]) ) +
                                        ( (kfactor*fTrigEfficiency[1]/fTrigEfficiency[0])*(kfactor*fTrigEfficiency[1]/fTrigEfficiency[0]) ) +
-                                       ( (kfactor*NbDmax/Nb)*(kfactor*NbDmax/Nb) )  +
+                                       ( (kfactor*nbDmax/nb)*(kfactor*nbDmax/nb) )  +
                                        ( (kfactor*fhFeedDownEffpt->GetBinError(ibin)/fhFeedDownEffpt->GetBinContent(ibin))*(kfactor*fhFeedDownEffpt->GetBinError(ibin)/fhFeedDownEffpt->GetBinContent(ibin)) ) ) 
                                        / fhRECpt->GetBinWidth(ibin);
       // max value with the minimum Nb
       errvalueExtremeMax =  TMath::Sqrt( ( (kfactor*fLuminosity[1]/fLuminosity[0])*(kfactor*fLuminosity[1]/fLuminosity[0]) ) +
                                         ( (kfactor*fTrigEfficiency[1]/fTrigEfficiency[0])*(kfactor*fTrigEfficiency[1]/fTrigEfficiency[0]) ) +
-                                        ( (kfactor*NbDmin/Nb)*(kfactor*NbDmin/Nb) )  +
+                                        ( (kfactor*nbDmin/nb)*(kfactor*nbDmin/nb) )  +
                                         ( (kfactor*fhFeedDownEffpt->GetBinError(ibin)/fhFeedDownEffpt->GetBinContent(ibin))*(kfactor*fhFeedDownEffpt->GetBinError(ibin)/fhFeedDownEffpt->GetBinContent(ibin))  ) ) 
                                         / fhRECpt->GetBinWidth(ibin);
     }
index daa16e68770dd9125c8fee22a30cf3686ad48c46..349dd2344233be88d37cd915335fd8b3b7b77343 100644 (file)
@@ -85,46 +85,46 @@ class AliHFPtSpectrum: public TNamed
   // Getters
   //
   // Return the theoretical predictions used for the calculation (rebinned if needed)
-  TH1D * GetDirectTheoreticalSpectrum() { return (fhDirectMCpt ? (TH1D*)fhDirectMCpt : NULL); }
-  TH1D * GetDirectTheoreticalUpperLimitSpectrum() { return (fhDirectMCptMax ? (TH1D*)fhDirectMCptMax : NULL); }
-  TH1D * GetDirectTheoreticalLowerLimitSpectrum() { return (fhDirectMCptMin ? (TH1D*)fhDirectMCptMin : NULL); }
-  TH1D * GetFeedDownTheoreticalSpectrum() { return (fhFeedDownMCpt ? (TH1D*)fhFeedDownMCpt : NULL); }
-  TH1D * GetFeedDownTheoreticalUpperLimitSpectrum() { return (fhFeedDownMCptMax ? (TH1D*)fhFeedDownMCptMax : NULL); }
-  TH1D * GetFeedDownTheoreticalLowerLimitSpectrum() { return (fhFeedDownMCptMin ? (TH1D*)fhFeedDownMCptMin : NULL); }
+  TH1D * GetDirectTheoreticalSpectrum() const { return (fhDirectMCpt ? (TH1D*)fhDirectMCpt : NULL); }
+  TH1D * GetDirectTheoreticalUpperLimitSpectrum() const { return (fhDirectMCptMax ? (TH1D*)fhDirectMCptMax : NULL); }
+  TH1D * GetDirectTheoreticalLowerLimitSpectrum() const { return (fhDirectMCptMin ? (TH1D*)fhDirectMCptMin : NULL); }
+  TH1D * GetFeedDownTheoreticalSpectrum() const { return (fhFeedDownMCpt ? (TH1D*)fhFeedDownMCpt : NULL); }
+  TH1D * GetFeedDownTheoreticalUpperLimitSpectrum() const { return (fhFeedDownMCptMax ? (TH1D*)fhFeedDownMCptMax : NULL); }
+  TH1D * GetFeedDownTheoreticalLowerLimitSpectrum() const { return (fhFeedDownMCptMin ? (TH1D*)fhFeedDownMCptMin : NULL); }
   // Return the acceptance and efficiency corrections (rebinned if needed)
-  TH1D * GetDirectAccEffCorrection() { return (fhDirectEffpt ? (TH1D*)fhDirectEffpt : NULL); }
-  TH1D * GetFeedDownAccEffCorrection() { return (fhFeedDownEffpt ? (TH1D*)fhFeedDownEffpt : NULL); }
+  TH1D * GetDirectAccEffCorrection() const { return (fhDirectEffpt ? (TH1D*)fhDirectEffpt : NULL); }
+  TH1D * GetFeedDownAccEffCorrection() const { return (fhFeedDownEffpt ? (TH1D*)fhFeedDownEffpt : NULL); }
   // Return the TGraphAsymmErrors of the feed-down correction (extreme systematics)
-  TGraphAsymmErrors * GetFeedDownCorrectionFcExtreme() { return (fgFcExtreme ?  fgFcExtreme : NULL); }
+  TGraphAsymmErrors * GetFeedDownCorrectionFcExtreme() const { return (fgFcExtreme ?  fgFcExtreme : NULL); }
   // Return the TGraphAsymmErrors of the feed-down correction (conservative systematics)
-  TGraphAsymmErrors * GetFeedDownCorrectionFcConservative() { return (fgFcConservative ?  fgFcConservative : NULL); }
+  TGraphAsymmErrors * GetFeedDownCorrectionFcConservative() const { return (fgFcConservative ?  fgFcConservative : NULL); }
   // Return the histogram of the feed-down correction
-  TH1D * GetHistoFeedDownCorrectionFc() { return (fhFc ?  (TH1D*)fhFc : NULL); }
+  TH1D * GetHistoFeedDownCorrectionFc() const { return (fhFc ?  (TH1D*)fhFc : NULL); }
   // Return the histograms of the feed-down correction bounds
-  TH1D * GetHistoUpperLimitFeedDownCorrectionFc() { return (fhFcMax ? (TH1D*)fhFcMax : NULL); }
-  TH1D * GetHistoLowerLimitFeedDownCorrectionFc() { return (fhFcMin ? (TH1D*)fhFcMin : NULL); }
+  TH1D * GetHistoUpperLimitFeedDownCorrectionFc() const { return (fhFcMax ? (TH1D*)fhFcMax : NULL); }
+  TH1D * GetHistoLowerLimitFeedDownCorrectionFc() const { return (fhFcMin ? (TH1D*)fhFcMin : NULL); }
   // Return the TGraphAsymmErrors of the yield after feed-down correction (systematics but feed-down) 
-  TGraphAsymmErrors * GetFeedDownCorrectedSpectrum() { return (fgYieldCorr ? fgYieldCorr : NULL); }
+  TGraphAsymmErrors * GetFeedDownCorrectedSpectrum() const { return (fgYieldCorr ? fgYieldCorr : NULL); }
   // Return the TGraphAsymmErrors of the yield after feed-down correction (feed-down extreme systematics)
-  TGraphAsymmErrors * GetFeedDownCorrectedSpectrumExtreme() { return (fgYieldCorrExtreme ? fgYieldCorrExtreme : NULL); }
+  TGraphAsymmErrors * GetFeedDownCorrectedSpectrumExtreme() const { return (fgYieldCorrExtreme ? fgYieldCorrExtreme : NULL); }
   // Return the TGraphAsymmErrors of the yield after feed-down correction (feed-down conservative systematics)
-  TGraphAsymmErrors * GetFeedDownCorrectedSpectrumConservative() { return (fgYieldCorrConservative ? fgYieldCorrConservative : NULL); }
+  TGraphAsymmErrors * GetFeedDownCorrectedSpectrumConservative() const { return (fgYieldCorrConservative ? fgYieldCorrConservative : NULL); }
   // Return the histogram of the yield after feed-down correction 
-  TH1D * GetHistoFeedDownCorrectedSpectrum() { return (fhYieldCorr ? (TH1D*)fhYieldCorr : NULL); }
+  TH1D * GetHistoFeedDownCorrectedSpectrum() const { return (fhYieldCorr ? (TH1D*)fhYieldCorr : NULL); }
   // Return the histogram of the yield after feed-down correction bounds
-  TH1D * GetHistoUpperLimitFeedDownCorrectedSpectrum() { return (fhYieldCorrMax ? (TH1D*)fhYieldCorrMax : NULL); }
-  TH1D * GetHistoLowerLimitFeedDownCorrectedSpectrum() { return (fhYieldCorrMin ? (TH1D*)fhYieldCorrMin : NULL); }
+  TH1D * GetHistoUpperLimitFeedDownCorrectedSpectrum() const { return (fhYieldCorrMax ? (TH1D*)fhYieldCorrMax : NULL); }
+  TH1D * GetHistoLowerLimitFeedDownCorrectedSpectrum() const { return (fhYieldCorrMin ? (TH1D*)fhYieldCorrMin : NULL); }
   // Return the equivalent invariant cross-section TGraphAsymmErrors (systematics but feed-down) 
-  TGraphAsymmErrors * GetCrossSectionFromYieldSpectrum() { return (fgSigmaCorr ? fgSigmaCorr : NULL); }
+  TGraphAsymmErrors * GetCrossSectionFromYieldSpectrum() const { return (fgSigmaCorr ? fgSigmaCorr : NULL); }
   // Return the equivalent invariant cross-section TGraphAsymmErrors (feed-down extreme systematics)
-  TGraphAsymmErrors * GetCrossSectionFromYieldSpectrumExtreme() { return (fgSigmaCorrExtreme ? fgSigmaCorrExtreme : NULL); }
+  TGraphAsymmErrors * GetCrossSectionFromYieldSpectrumExtreme() const { return (fgSigmaCorrExtreme ? fgSigmaCorrExtreme : NULL); }
   // Return the equivalent invariant cross-section TGraphAsymmErrors (feed-down conservative systematics)
-  TGraphAsymmErrors * GetCrossSectionFromYieldSpectrumConservative() { return (fgSigmaCorrConservative ? fgSigmaCorrConservative : NULL); }
+  TGraphAsymmErrors * GetCrossSectionFromYieldSpectrumConservative() const { return (fgSigmaCorrConservative ? fgSigmaCorrConservative : NULL); }
   // Return the equivalent invariant cross-section histogram
-  TH1D * GetHistoCrossSectionFromYieldSpectrum() { return (fhSigmaCorr ? (TH1D*)fhSigmaCorr : NULL); }
+  TH1D * GetHistoCrossSectionFromYieldSpectrum() const { return (fhSigmaCorr ? (TH1D*)fhSigmaCorr : NULL); }
   // Return the equivalent invariant cross-section histogram bounds
-  TH1D * GetHistoUpperLimitCrossSectionFromYieldSpectrum() { return (fhSigmaCorrMax ? (TH1D*)fhSigmaCorrMax : NULL); }
-  TH1D * GetHistoLowerLimitCrossSectionFromYieldSpectrum() { return (fhSigmaCorrMin ? (TH1D*)fhSigmaCorrMin : NULL); }
+  TH1D * GetHistoUpperLimitCrossSectionFromYieldSpectrum() const { return (fhSigmaCorrMax ? (TH1D*)fhSigmaCorrMax : NULL); }
+  TH1D * GetHistoLowerLimitCrossSectionFromYieldSpectrum() const { return (fhSigmaCorrMin ? (TH1D*)fhSigmaCorrMin : NULL); }
 
   //
   // Main function: