AtNuFlux Namespace Reference

Typedefs

typedef enum AtNuFlux::EFluxType FluxType_t

Enumerations

enum  EFluxType {
  kUnknown = 0, kBartol1D = 1, kBartol3D = 2, kFluka3D = 3,
  kHonda3D = 4, kBartol = kBartol3D, kFluka = kFluka3D, kHonda = kHonda3D
}

Functions

Double_t LookupFlux (TH2D *hFlux2D, Double_t energy, Double_t angle)
Double_t LookupFluxAtEnergy (TH2D *hFlux2D, Double_t energy)
Double_t LookupFluxAtAngle (TH2D *hFlux2D, Double_t angle)
TH1D * IntegrateFluxOverAngle (TH2D *hFlux2D)
TH1D * IntegrateFluxOverEnergy (TH2D *hFlux2D)
TH1D * MakeAngleSpectrum (TH2D *hFlux2D, Int_t bin)
TH1D * MakeAngleSpectrum (TH2D *hFlux2D, Double_t energy)
TH1D * MakeAngleSpectrum (TH2D *hFlux2D)
TH1D * MakeEnergySpectrum (TH2D *hFlux2D, Int_t bin)
TH1D * MakeEnergySpectrum (TH2D *hFlux2D, Double_t angle)
TH1D * MakeEnergySpectrum (TH2D *hFlux2D)
TH1D * MakeAngleHistogram (TH2D *hFlux2D, const char *histname)
TH1D * MakeEnergyHistogram (TH2D *hFlux2D, const char *histname)
TH2D * RebinHistogramByAngle (TH2D *hFlux2D, TAxis *NewAxis)

Typedef Documentation


Enumeration Type Documentation

Enumerator:
kUnknown 
kBartol1D 
kBartol3D 
kFluka3D 
kHonda3D 
kBartol 
kFluka 
kHonda 

Definition at line 6 of file AtNuFluxType.h.

00006                          {
00007     kUnknown  = 0,
00008     kBartol1D = 1,
00009     kBartol3D = 2,
00010     kFluka3D  = 3,
00011     kHonda3D  = 4,
00012     kBartol   = kBartol3D,
00013     kFluka    = kFluka3D,
00014     kHonda    = kHonda3D
00015   } FluxType_t;


Function Documentation

TH1D * AtNuFlux::IntegrateFluxOverAngle ( TH2D *  hFlux2D  ) 

Definition at line 68 of file AtNuFluxUtil.cxx.

References MakeEnergySpectrum().

00069 {
00070   return AtNuFlux::MakeEnergySpectrum(hFlux2D);
00071 }

TH1D * AtNuFlux::IntegrateFluxOverEnergy ( TH2D *  hFlux2D  ) 

Definition at line 63 of file AtNuFluxUtil.cxx.

References MakeAngleSpectrum().

00064 {
00065   return AtNuFlux::MakeAngleSpectrum(hFlux2D);
00066 }

Double_t AtNuFlux::LookupFlux ( TH2D *  hFlux2D,
Double_t  energy,
Double_t  angle 
)

Definition at line 8 of file AtNuFluxUtil.cxx.

00009 {
00010   if( hFlux2D==0 ) return 0.0;
00011 
00012   Int_t binEnergy = hFlux2D->GetXaxis()->FindBin(energy);
00013   Int_t binAngle = hFlux2D->GetYaxis()->FindBin(angle);
00014   
00015   return hFlux2D->GetBinContent(binEnergy,binAngle);
00016 }

Double_t AtNuFlux::LookupFluxAtAngle ( TH2D *  hFlux2D,
Double_t  angle 
)

Definition at line 41 of file AtNuFluxUtil.cxx.

00042 {
00043   if( hFlux2D==0 ) return 0.0;
00044   
00045   Double_t dN_dSdE = 0.0;
00046   Double_t dN_dS = 0.0;
00047   Double_t dE = 0.0;
00048 
00049   Int_t binAngle = hFlux2D->GetYaxis()->FindBin(angle); // y-axis: angle
00050 
00051   for( Int_t binEnergy=0; binEnergy<hFlux2D->GetXaxis()->GetNbins(); binEnergy++ ){ // x-axis: energy
00052     dN_dSdE = hFlux2D->GetBinContent(binEnergy+1,binAngle);
00053 
00054     dE = hFlux2D->GetXaxis()->GetBinUpEdge(binEnergy+1)
00055         - hFlux2D->GetXaxis()->GetBinLowEdge(binEnergy+1);
00056 
00057     dN_dS += dN_dSdE*dE;
00058   }
00059 
00060   return dN_dS;
00061 }

Double_t AtNuFlux::LookupFluxAtEnergy ( TH2D *  hFlux2D,
Double_t  energy 
)

Definition at line 18 of file AtNuFluxUtil.cxx.

00019 {
00020   if( hFlux2D==0 ) return 0.0;
00021   
00022   Double_t dN_dEdS = 0.0;
00023   Double_t dN_dE = 0.0;
00024   Double_t dS = 0.0;
00025 
00026   Int_t binEnergy = hFlux2D->GetXaxis()->FindBin(energy); // x-axis: energy
00027 
00028   for( Int_t binAngle=0; binAngle<hFlux2D->GetYaxis()->GetNbins(); binAngle++ ){ // y-axis: angle
00029     dN_dEdS = hFlux2D->GetBinContent(binEnergy,binAngle+1);
00030   
00031     dS = 2.0*TMath::Pi()
00032          * ( hFlux2D->GetYaxis()->GetBinUpEdge(binAngle+1)
00033             - hFlux2D->GetYaxis()->GetBinLowEdge(binAngle+1) );
00034 
00035     dN_dE += dN_dEdS*dS;
00036   }
00037 
00038   return dN_dE;
00039 }

TH1D * AtNuFlux::MakeAngleHistogram ( TH2D *  hFlux2D,
const char *  histname 
)

Definition at line 260 of file AtNuFluxUtil.cxx.

Referenced by MakeAngleSpectrum().

00261 {
00262   // sanity check
00263   if( hFlux2D==0 ) return 0;
00264 
00265   // make new histogram
00266   TAxis* Axis = hFlux2D->GetYaxis(); // y-axis: angle
00267   Int_t numBins = Axis->GetNbins();
00268   const Double_t* binEdges = Axis->GetXbins()->GetArray();  
00269   
00270   TH1D* hFlux1D = new TH1D(histname,"",numBins,binEdges);
00271 
00272   hFlux1D->GetXaxis()->SetTitle("cos #theta_{z} ");
00273   hFlux1D->GetXaxis()->SetTitleOffset(1.2);
00274   hFlux1D->GetYaxis()->SetTitleOffset(1.2);
00275 
00276   hFlux1D->SetLineWidth(2);
00277 
00278   return hFlux1D;
00279 }

TH1D * AtNuFlux::MakeAngleSpectrum ( TH2D *  hFlux2D  ) 

Definition at line 131 of file AtNuFluxUtil.cxx.

References MakeAngleHistogram().

00132 {
00133   // sanity check
00134   if( hFlux2D==0 ) return 0;
00135   
00136   // make histogram name
00137   TString histname = hFlux2D->GetName();
00138   histname.Append("_AngleSpectrum");  
00139 
00140   // make histogram
00141   TH1D* hFlux1D = AtNuFlux::MakeAngleHistogram(hFlux2D,histname.Data());
00142 
00143   // perform integral
00144   Double_t dN_dEdS = 0.0;
00145   Double_t dN_dS = 0.0;
00146   Double_t dE = 0.0;
00147 
00148   for( Int_t ny=0; ny<hFlux2D->GetYaxis()->GetNbins(); ny++ ){ // y-axis: angle
00149 
00150     dN_dS = 0.0;
00151     for( Int_t nx=0; nx<hFlux2D->GetXaxis()->GetNbins(); nx++ ){ // x-axis: energy
00152       dN_dEdS = hFlux2D->GetBinContent(nx+1,ny+1);
00153       dE = hFlux2D->GetXaxis()->GetBinUpEdge(nx+1)
00154          -hFlux2D->GetXaxis()->GetBinLowEdge(nx+1) ;
00155       dN_dS += dN_dEdS*dE;
00156     }
00157 
00158     hFlux1D->SetBinContent(ny+1,dN_dS);
00159   }
00160 
00161   // return histogram
00162   return hFlux1D;
00163 }

TH1D * AtNuFlux::MakeAngleSpectrum ( TH2D *  hFlux2D,
Double_t  energy 
)

Definition at line 98 of file AtNuFluxUtil.cxx.

References MakeAngleHistogram().

00099 {
00100   // sanity check
00101   if( hFlux2D==0 ) return 0;
00102 
00103   // make histogram name
00104   TString histname = hFlux2D->GetName();
00105   histname.Append("_AngleProfile_");  
00106 
00107   // append energy
00108   Int_t energy_int = (Int_t)(fabs(energy));
00109   Int_t energy_int_frac = (Int_t)(100.0*(fabs(energy)-energy_int));
00110   histname += energy_int;
00111   histname.Append("_");
00112   if( energy_int_frac<10 ) histname.Append("0");
00113   histname += energy_int_frac;
00114 
00115   // make histogram
00116   TH1D* hFlux1D = AtNuFlux::MakeAngleHistogram(hFlux2D,histname.Data());
00117 
00118   // create profile
00119   Int_t bin = hFlux2D->GetXaxis()->FindBin(energy); // x-axis: energy
00120   Double_t dN_dEdS = 0.0;
00121 
00122   for( Int_t ny=0; ny<hFlux2D->GetYaxis()->GetNbins(); ny++ ){ // y-axis: angle
00123     dN_dEdS = hFlux2D->GetBinContent(bin,ny+1);
00124     hFlux1D->SetBinContent(ny+1,dN_dEdS);
00125   }
00126 
00127   // return histogram
00128   return hFlux1D;
00129 }

TH1D * AtNuFlux::MakeAngleSpectrum ( TH2D *  hFlux2D,
Int_t  bin 
)

Definition at line 73 of file AtNuFluxUtil.cxx.

References MakeAngleHistogram().

Referenced by IntegrateFluxOverEnergy().

00074 {
00075   // sanity check
00076   if( hFlux2D==0 ) return 0;
00077   
00078   // make histogram name
00079   TString histname = hFlux2D->GetName();
00080   histname.Append("_AngleProfile_");  
00081   histname += bin;
00082 
00083   // make histogram
00084   TH1D* hFlux1D = AtNuFlux::MakeAngleHistogram(hFlux2D,histname.Data());
00085 
00086   // create profile
00087   Double_t dN_dEdS = 0.0;
00088 
00089   for( Int_t ny=0; ny<hFlux2D->GetYaxis()->GetNbins(); ny++ ){ // y-axis: angle
00090     dN_dEdS = hFlux2D->GetBinContent(bin,ny+1);
00091     hFlux1D->SetBinContent(ny+1,dN_dEdS);
00092   }
00093 
00094   // return histogram
00095   return hFlux1D;
00096 }

TH1D * AtNuFlux::MakeEnergyHistogram ( TH2D *  hFlux2D,
const char *  histname 
)

Definition at line 281 of file AtNuFluxUtil.cxx.

Referenced by MakeEnergySpectrum().

00282 {
00283   // sanity check
00284   if( hFlux2D==0 ) return 0;
00285 
00286   // make new histogram
00287   TAxis* Axis = hFlux2D->GetXaxis(); // x-axis: energy
00288   Int_t numBins = Axis->GetNbins();
00289   const Double_t* binEdges = Axis->GetXbins()->GetArray();  
00290   
00291   TH1D* hFlux1D = new TH1D(histname,"",numBins,binEdges);
00292 
00293   hFlux1D->GetXaxis()->SetTitle("E_{#nu} / GeV");
00294   hFlux1D->GetXaxis()->SetTitleOffset(1.2);
00295   hFlux1D->GetYaxis()->SetTitleOffset(1.2);
00296 
00297   hFlux1D->SetLineWidth(2);
00298 
00299   return hFlux1D;
00300 }

TH1D * AtNuFlux::MakeEnergySpectrum ( TH2D *  hFlux2D  ) 

Definition at line 226 of file AtNuFluxUtil.cxx.

References MakeEnergyHistogram().

00227 {
00228   // sanity check
00229   if( hFlux2D==0 ) return 0;
00230   
00231   // make histogram name
00232   TString histname = hFlux2D->GetName();
00233   histname.Append("_EnergySpectrum");
00234   
00235   // make histogram
00236   TH1D* hFlux1D = AtNuFlux::MakeEnergyHistogram(hFlux2D,histname.Data());
00237 
00238   // perform integral
00239   Double_t dN_dEdS = 0.0;
00240   Double_t dN_dE = 0.0;
00241   Double_t dS = 0.0;
00242 
00243   for( Int_t nx=0; nx<hFlux2D->GetXaxis()->GetNbins(); nx++ ){ // x-axis: energy
00244 
00245     dN_dE = 0.0;
00246     for( Int_t ny=0; ny<hFlux2D->GetYaxis()->GetNbins(); ny++ ){ // y-axis: angle
00247       dN_dEdS = hFlux2D->GetBinContent(nx+1,ny+1);
00248       dS = 2.0*TMath::Pi()*( hFlux2D->GetYaxis()->GetBinUpEdge(ny+1)
00249                             -hFlux2D->GetYaxis()->GetBinLowEdge(ny+1) );
00250       dN_dE += dN_dEdS*dS;
00251     }
00252 
00253     hFlux1D->SetBinContent(nx+1,dN_dE);
00254   }
00255 
00256   // return histogram
00257   return hFlux1D;
00258 }

TH1D * AtNuFlux::MakeEnergySpectrum ( TH2D *  hFlux2D,
Double_t  angle 
)

Definition at line 190 of file AtNuFluxUtil.cxx.

References MakeEnergyHistogram().

00191 {
00192   // sanity check
00193   if( hFlux2D==0 ) return 0;
00194   
00195   // make histogram name
00196   TString histname = hFlux2D->GetName();
00197   histname.Append("_EnergyProfile_");
00198 
00199   // append positive/negative
00200   if( angle<0.0 ) histname.Append("M");
00201   else histname.Append("P");
00202 
00203   // append angle
00204   Int_t angle_int = (Int_t)(fabs(angle));
00205   Int_t angle_int_frac = (Int_t)(100.0*(fabs(angle)-angle_int));
00206   histname += angle_int;
00207   if( angle_int_frac<10 ) histname.Append("0");
00208   histname+=angle_int_frac;
00209 
00210   // make histogram
00211   TH1D* hFlux1D = AtNuFlux::MakeEnergyHistogram(hFlux2D,histname.Data());
00212 
00213   // create profile
00214   Int_t bin = hFlux2D->GetYaxis()->FindBin(angle); // y-axis: angle
00215   Double_t dN_dEdS = 0.0;
00216 
00217   for( Int_t nx=0; nx<hFlux2D->GetXaxis()->GetNbins(); nx++ ){ // x-axis: energy
00218     dN_dEdS = hFlux2D->GetBinContent(nx+1,bin);
00219     hFlux1D->SetBinContent(nx+1,dN_dEdS);
00220   }
00221 
00222   // return histogram
00223   return hFlux1D;
00224 }

TH1D * AtNuFlux::MakeEnergySpectrum ( TH2D *  hFlux2D,
Int_t  bin 
)

Definition at line 165 of file AtNuFluxUtil.cxx.

References MakeEnergyHistogram().

Referenced by IntegrateFluxOverAngle().

00166 {
00167   // sanity check
00168   if( hFlux2D==0 ) return 0;
00169   
00170   // make histogram name
00171   TString histname = hFlux2D->GetName();
00172   histname.Append("_EnergyProfile_");
00173   histname += bin;
00174 
00175   // make histogram
00176   TH1D* hFlux1D = AtNuFlux::MakeEnergyHistogram(hFlux2D,histname.Data());
00177 
00178   // create profile
00179   Double_t dN_dEdS = 0.0;
00180 
00181   for( Int_t nx=0; nx<hFlux2D->GetXaxis()->GetNbins(); nx++ ){ // x-axis: energy
00182     dN_dEdS = hFlux2D->GetBinContent(nx+1,bin);
00183     hFlux1D->SetBinContent(nx+1,dN_dEdS);
00184   }
00185 
00186   // return histogram
00187   return hFlux1D;
00188 }

TH2D * AtNuFlux::RebinHistogramByAngle ( TH2D *  hFlux2D,
TAxis *  NewAxis 
)

Definition at line 302 of file AtNuFluxUtil.cxx.

00303 {
00304   // sanity check
00305   if( hFlux2D==0 ) return 0;
00306 
00307   // make histogram name
00308   TString histname = hFlux2D->GetName();
00309   histname.Append("_RebinByAngle");
00310 
00311   // make new histogram
00312   Int_t AngleBins = NewAxis->GetNbins();   // y-axis: angle
00313   const Double_t* AngleEdges = NewAxis->GetXbins()->GetArray();
00314 
00315   TAxis* EnergyAxis = hFlux2D->GetXaxis(); // x-axis: energy
00316   Int_t EnergyBins = EnergyAxis->GetNbins();
00317   const Double_t* EnergyEdges = EnergyAxis->GetXbins()->GetArray();
00318 
00319   TH2D* hNewFlux2D = new TH2D(histname,"",
00320                                EnergyBins,EnergyEdges,
00321                                 AngleBins,AngleEdges);
00322 
00323   hNewFlux2D->GetXaxis()->SetTitle("E_{#nu} / GeV");
00324   hNewFlux2D->GetYaxis()->SetTitle("cos #theta_{z}");
00325 
00326   // get old axis
00327   TAxis* OldAxis = hFlux2D->GetYaxis(); // y-axis: angle
00328 
00329   Double_t oldMin = 0.0;
00330   Double_t oldMax = 0.0;
00331   Double_t oldWidth = 0.0;
00332   Double_t oldContent = 0.0;
00333 
00334   Double_t newMin = 0.0;
00335   Double_t newMax = 0.0;
00336   Double_t newWidth = 0.0;
00337   Double_t newContent = 0.0;
00338 
00339   Double_t deltaMin = 0.0;
00340   Double_t deltaMax = 0.0;
00341   Double_t deltaWidth = 0.0;
00342 
00343   for( Int_t nEnergy=0; nEnergy<EnergyAxis->GetNbins(); nEnergy++ ){
00344     for( Int_t nNew=0; nNew<NewAxis->GetNbins(); nNew++ ){
00345       newContent = 0.0;
00346       newMin = NewAxis->GetBinLowEdge(nNew+1);
00347       newMax = NewAxis->GetBinUpEdge(nNew+1);
00348       newWidth = newMax-newMin;
00349 
00350       for( Int_t nOld=0; nOld<OldAxis->GetNbins(); nOld++ ){
00351         oldContent = hFlux2D->GetBinContent(nEnergy+1,nOld+1);
00352         oldMin = OldAxis->GetBinLowEdge(nOld+1);
00353         oldMax = OldAxis->GetBinUpEdge(nOld+1);
00354         oldWidth = oldMax-oldMin;
00355 
00356         if( oldMax>newMin && newMax>oldMin ){
00357           if( oldMin>newMin ) deltaMin = oldMin; else deltaMin = newMin;
00358           if( oldMax<newMax ) deltaMax = oldMax; else deltaMax = newMax;
00359           deltaWidth = deltaMax-deltaMin;
00360 
00361           newContent += (deltaWidth/newWidth)*oldContent;
00362         }
00363       }
00364     
00365       hNewFlux2D->SetBinContent(nEnergy+1,nNew+1,newContent);
00366     }
00367   }
00368 
00369   return hNewFlux2D;
00370 }


Generated on 3 Oct 2018 for loon by  doxygen 1.6.1