AtNuResNeugenPdf Class Reference

#include <AtNuResNeugenPdf.h>

List of all members.

Public Member Functions

 AtNuResNeugenPdf (TH1D *pdf, Int_t idnu, Double_t weight=1.0)
 AtNuResNeugenPdf (TH2D *pdf, Int_t idnu, Double_t weight=1.0)
 ~AtNuResNeugenPdf ()
Int_t GetIDnu ()
Int_t GetW2bins ()
Double_t GetW2min ()
Double_t GetW2max ()
Double_t GetW2 (Int_t bin)
Int_t GetYbins ()
Double_t GetYmin ()
Double_t GetYmax ()
Double_t GetY (Int_t bin)
Double_t GetWeight (Int_t ny, Int_t nw2)
Double_t GetWeight (Double_t y, Double_t w2)
TH2D * MakeTH2D ()

Private Attributes

Int_t fIDnu
Int_t fW2bins
Double_t fW2min
Double_t fW2max
Int_t fYbins
Double_t fYmin
Double_t fYmax
Double_t fWeight
Double_t * fPdf
TString fHistName

Detailed Description

Definition at line 10 of file AtNuResNeugenPdf.h.


Constructor & Destructor Documentation

AtNuResNeugenPdf::AtNuResNeugenPdf ( TH1D *  pdf,
Int_t  idnu,
Double_t  weight = 1.0 
)

Definition at line 8 of file AtNuResNeugenPdf.cxx.

00009 {
00010   // std::cout << " *** AtNuResNeugenPdf::AtNuResNeugenPdf(TH1D* pdf, Int_t idnu, Double_t weight) *** " << std::endl;
00011 
00012   // neutrino type
00013   fIDnu = idnu;
00014 
00015   // assume quasi-elastic collision with nucleon
00016   // W^2 = 0.88 GeV^2
00017   fW2bins = 1;
00018   fW2min = 0.87;
00019   fW2max = 0.89;
00020 
00021   fYbins = pdf->GetXaxis()->GetNbins();
00022   fYmin = pdf->GetXaxis()->GetXmin();
00023   fYmax = pdf->GetXaxis()->GetXmax();
00024     
00025   fHistName = pdf->GetName();
00026 
00027   // std::cout << "   reading data from 1D histogram: " << fHistName.Data() << std::endl 
00028   //           << "   histogram binning: " << fYbins << " x " << fW2bins << std::endl
00029   //           << "   normalization: " << weight << std::endl;
00030 
00031   fWeight = weight;
00032 
00033   fPdf = new Double_t[fYbins];
00034 
00035   for( Int_t ny=0; ny<fYbins; ny++ ){
00036     fPdf[ny] = pdf->GetBinContent(ny+1);
00037   }
00038 }

AtNuResNeugenPdf::AtNuResNeugenPdf ( TH2D *  pdf,
Int_t  idnu,
Double_t  weight = 1.0 
)

Definition at line 40 of file AtNuResNeugenPdf.cxx.

References fHistName, fIDnu, fPdf, fW2bins, fW2max, fW2min, fWeight, fYbins, fYmax, and fYmin.

00041 {
00042   // std::cout << " *** AtNuResNeugenPdf::AtNuResNeugenPdf(TH2D* pdf, Int_t idnu, Double_t weight) *** " << std::endl;
00043 
00044   fIDnu = idnu;
00045 
00046   fW2bins = pdf->GetYaxis()->GetNbins();
00047   fW2min = pdf->GetYaxis()->GetXmin();
00048   fW2max = pdf->GetYaxis()->GetXmax();
00049 
00050   fYbins = pdf->GetXaxis()->GetNbins();
00051   fYmin = pdf->GetXaxis()->GetXmin();
00052   fYmax = pdf->GetXaxis()->GetXmax();
00053     
00054   fHistName = pdf->GetName();
00055 
00056   fWeight = weight;
00057 
00058   // std::cout << "   reading data from 1D histogram: " << fHistName.Data() << std::endl
00059   //           << "   histogram binning: " << fYbins << " x " << fW2bins << std::endl
00060   //           << "   normalization: " << weight << std::endl;
00061 
00062   fPdf = new Double_t[fW2bins*fYbins];
00063 
00064   for( Int_t ny=0; ny<fYbins; ny++ ){
00065     for( Int_t nw2=0; nw2<fW2bins; nw2++ ){
00066       fPdf[ny*fW2bins+nw2] = pdf->GetBinContent(ny+1,nw2+1);
00067     }
00068   }
00069 }

AtNuResNeugenPdf::~AtNuResNeugenPdf (  ) 

Definition at line 71 of file AtNuResNeugenPdf.cxx.

References fPdf.

00072 {
00073   delete [] fPdf;
00074 }


Member Function Documentation

Int_t AtNuResNeugenPdf::GetIDnu (  )  [inline]

Definition at line 17 of file AtNuResNeugenPdf.h.

References fIDnu.

Referenced by AtNuResolution::AddToBayesPdf().

00017 { return fIDnu; }

Double_t AtNuResNeugenPdf::GetW2 ( Int_t  bin  )  [inline]

Definition at line 22 of file AtNuResNeugenPdf.h.

References fW2bins, fW2max, and fW2min.

Referenced by AtNuResolution::AddToBayesPdf().

00022 { return fW2min+((bin+0.5)/fW2bins)*(fW2max-fW2min); }

Int_t AtNuResNeugenPdf::GetW2bins (  )  [inline]

Definition at line 19 of file AtNuResNeugenPdf.h.

References fW2bins.

Referenced by AtNuResolution::AddToBayesPdf().

00019 { return fW2bins; }

Double_t AtNuResNeugenPdf::GetW2max (  )  [inline]

Definition at line 21 of file AtNuResNeugenPdf.h.

References fW2max.

00021 { return fW2max; }

Double_t AtNuResNeugenPdf::GetW2min (  )  [inline]

Definition at line 20 of file AtNuResNeugenPdf.h.

References fW2min.

00020 { return fW2min; }

Double_t AtNuResNeugenPdf::GetWeight ( Double_t  y,
Double_t  w2 
)

Definition at line 88 of file AtNuResNeugenPdf.cxx.

References fW2bins, fW2max, fW2min, fYbins, fYmax, fYmin, and GetWeight().

00089 {
00090   Int_t ny = (Int_t)( fYbins*(y-fYmin)/(fYmax-fYmin) );
00091   Int_t nw2 = (Int_t)( fW2bins*(w2-fW2min)/(fW2max-fW2min) );
00092 
00093   return this->GetWeight(ny,nw2);
00094 }

Double_t AtNuResNeugenPdf::GetWeight ( Int_t  ny,
Int_t  nw2 
)

Definition at line 76 of file AtNuResNeugenPdf.cxx.

References fPdf, fW2bins, fWeight, and fYbins.

Referenced by AtNuResolution::AddToBayesPdf(), and GetWeight().

00077 { 
00078   Double_t weight = 0.0;
00079 
00080   if( ny>=0 && ny<fYbins
00081    && nw2>=0 && nw2<fW2bins ){
00082     weight = fPdf[ny*fW2bins+nw2];
00083   }
00084 
00085   return weight*fWeight;
00086 }

Double_t AtNuResNeugenPdf::GetY ( Int_t  bin  )  [inline]

Definition at line 27 of file AtNuResNeugenPdf.h.

References fYbins, fYmax, and fYmin.

Referenced by AtNuResolution::AddToBayesPdf().

00027 { return fYmin+((bin+0.5)/fYbins)*(fYmax-fYmin); }

Int_t AtNuResNeugenPdf::GetYbins (  )  [inline]

Definition at line 24 of file AtNuResNeugenPdf.h.

References fYbins.

Referenced by AtNuResolution::AddToBayesPdf().

00024 { return fYbins; }

Double_t AtNuResNeugenPdf::GetYmax (  )  [inline]

Definition at line 26 of file AtNuResNeugenPdf.h.

References fYmax.

00026 { return fYmax; }

Double_t AtNuResNeugenPdf::GetYmin (  )  [inline]

Definition at line 25 of file AtNuResNeugenPdf.h.

References fYmin.

00025 { return fYmin; }

TH2D * AtNuResNeugenPdf::MakeTH2D (  ) 

Definition at line 96 of file AtNuResNeugenPdf.cxx.

References fHistName, fPdf, fW2bins, fW2max, fW2min, fYbins, fYmax, and fYmin.

00097 {
00098   TString histname = fHistName;
00099   histname.Append("_Copy");
00100 
00101   TH2D* newpdf = new TH2D(histname.Data(),histname.Data(),fYbins,fYmin,fYmax,
00102                                                           fW2bins,fW2min,fW2max);
00103 
00104   // std::cout << "   writing data to 2D histogram: " << histname.Data() << std::endl
00105   //           << "   histogram binning: " << fYbins << " x " << fW2bins << std::endl;
00106 
00107   for( Int_t ny=0; ny<fYbins; ny++ ){
00108     for( Int_t nw2=0; nw2<fW2bins; nw2++ ){
00109       newpdf->SetBinContent(ny+1,nw2+1,fPdf[ny*fW2bins+nw2]);
00110     }
00111   }
00112 
00113   return newpdf;
00114 }


Member Data Documentation

TString AtNuResNeugenPdf::fHistName [private]

Definition at line 49 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), and MakeTH2D().

Int_t AtNuResNeugenPdf::fIDnu [private]

Definition at line 36 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), and GetIDnu().

Double_t* AtNuResNeugenPdf::fPdf [private]

Definition at line 47 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), GetWeight(), MakeTH2D(), and ~AtNuResNeugenPdf().

Int_t AtNuResNeugenPdf::fW2bins [private]

Definition at line 38 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), GetW2(), GetW2bins(), GetWeight(), and MakeTH2D().

Double_t AtNuResNeugenPdf::fW2max [private]

Definition at line 40 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), GetW2(), GetW2max(), GetWeight(), and MakeTH2D().

Double_t AtNuResNeugenPdf::fW2min [private]

Definition at line 39 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), GetW2(), GetW2min(), GetWeight(), and MakeTH2D().

Double_t AtNuResNeugenPdf::fWeight [private]

Definition at line 46 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), and GetWeight().

Int_t AtNuResNeugenPdf::fYbins [private]

Definition at line 42 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), GetWeight(), GetY(), GetYbins(), and MakeTH2D().

Double_t AtNuResNeugenPdf::fYmax [private]

Definition at line 44 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), GetWeight(), GetY(), GetYmax(), and MakeTH2D().

Double_t AtNuResNeugenPdf::fYmin [private]

Definition at line 43 of file AtNuResNeugenPdf.h.

Referenced by AtNuResNeugenPdf(), GetWeight(), GetY(), GetYmin(), and MakeTH2D().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1