NuUtilities Class Reference

#include <NuUtilities.h>

List of all members.

Public Member Functions

 NuUtilities ()
virtual ~NuUtilities ()
 ClassDef (NuUtilities, 0)

Static Public Member Functions

static TGraph ConvertLikelihoodSurfaceToContour (TH2D *hLikelihood, Double_t upValue)
static Double_t DistanceTargetToND ()
static void CalcFiducialMass ()
static TString PrintRelease (int releaseType)
static BeamType::BeamType_t ReturnConventionsBeamType (const NuConfig &config)
static BeamType::BeamType_t ConvertToConventionsBeamType (const Int_t beamType, const Int_t intensity)
static std::vector< Double_t > GenerateBins (int ngroups, double edges[], double steps[])
static std::vector< Double_t > RecoBins (const NuBinningScheme::NuBinningScheme_t binningScheme)
static std::vector< Double_t > TrueBins (const NuBinningScheme::NuBinningScheme_t binningScheme)
static Double_t ValueAt (TH1 *h, Double_t val)
static void WriteHistosToFile (const std::vector< TH1D > &vHistos, TFile &file, bool Quiet=false)
static void WriteHistosToFile (const std::vector< NuMatrixSpectrum > &vHistos, TFile &file, bool Quiet=false)
static void WriteHistosToFile (const std::pair< NuMatrixSpectrum, NuMatrixSpectrum > &vHistos, TFile &file)
static TH1D * RebinHistogram (const TH1D *old, int nbins, const double binedges[999])
static TH1D * RebinHistogram (const TH1D *old, std::vector< Double_t > &bins)
static TH1D * RebinHistogram (const TH1D *old, NuBinningScheme::NuBinningScheme_t scheme)
static Double_t LogLikelihood (Double_t data, Double_t MC)
static Double_t GetChisqFromCL (double cl=0.6827, int n=1)
static Double_t GetChisqFromSigma (double s=1, int n=1)
static void OscillateJesstogram (TH2D *h, double dm2, double sn2)
static void FixDogwoodQP (NuEvent &nu)
static std::vector< TString > GetListOfFilesInDir (const TString &wildcardString)
static int GetDigit (int num, int d)
static bool CheckConsistency (const TH1 *h1, const TH1 *h2)
 Checks two histograms have the same binning.
static const TH1D IntegralMarginalize (const TH2D *surf, const char axis= 'y')
static const TH1D MinimumMarginalize (const TH2D *surf, const char axis= 'y')
static void ProgressBar (Int_t entry, Float_t nEntriesF, Int_t mintime=0)

Static Public Attributes

static VldTimeStamp vtsRunIEnd
static VldTimeStamp vtsRunIIEnd
static VldTimeStamp vtsRunIIIEnd
static VldTimeStamp vtsRunIVEnd
static VldTimeStamp vtsRunVEnd
static VldTimeStamp vtsRunVIEnd
static VldTimeStamp vtsRunVIIEnd
static VldTimeStamp vtsRunVIIIEnd
static VldTimeStamp vtsRunIXEnd
static VldTimeStamp vtsRunXEnd


Detailed Description

Definition at line 45 of file NuUtilities.h.


Constructor & Destructor Documentation

NuUtilities::NuUtilities (  ) 

Definition at line 55 of file NuUtilities.cxx.

00056 {
00057 }

NuUtilities::~NuUtilities (  )  [virtual]

Definition at line 60 of file NuUtilities.cxx.

00061 {
00062 }


Member Function Documentation

void NuUtilities::CalcFiducialMass (  )  [static]

Definition at line 82 of file NuUtilities.cxx.

References Munits::cm, Munits::cm3, Munits::g, Munits::kilotonne, Munits::m, and Munits::m2.

00083 {
00084 
00085 
00086   const Float_t avPlSteelDensityNDData=7.847*(Munits::g/Munits::cm3);
00087   const Float_t avPlSteelThicknessNDData=2.563*(Munits::cm);
00088   const Float_t avPlScintDensityNDData=1.0457*(Munits::g/Munits::cm3);
00089   const Float_t avPlScintThicknessNDData=1.02*(Munits::cm);
00090   const Float_t avPlAlumDensityNDData=2.7*(Munits::g/Munits::cm3);
00091   const Float_t avPlAlumThicknessNDData=0.1*(Munits::cm);
00092 
00093   const Float_t avPlSteelDensityFDData=avPlSteelDensityNDData;
00094   const Float_t avPlSteelThicknessFDData=2.559*(Munits::cm);
00095   const Float_t avPlScintDensityFDData=avPlScintDensityNDData;
00096   const Float_t avPlScintThicknessFDData=avPlScintThicknessNDData;
00097   const Float_t avPlAlumDensityFDData=avPlAlumDensityNDData;
00098   const Float_t avPlAlumThicknessFDData=avPlAlumThicknessNDData;
00099 
00100   //MC
00101   const Float_t avPlSteelDensityNDMC=avPlSteelDensityNDData;
00102   const Float_t avPlSteelThicknessNDMC=2.54*(Munits::cm);
00103   const Float_t avPlScintDensityNDMC=avPlScintDensityNDData;
00104   const Float_t avPlScintThicknessNDMC=1.0*(Munits::cm);
00105   const Float_t avPlAlumDensityNDMC=avPlAlumDensityNDData;
00106   const Float_t avPlAlumThicknessNDMC=avPlAlumThicknessNDData;
00107 
00108   const Float_t avPlSteelDensityFDMC=avPlSteelDensityNDMC;
00109   const Float_t avPlSteelThicknessFDMC=avPlSteelThicknessNDMC;
00110   const Float_t avPlScintDensityFDMC=avPlScintDensityNDMC;
00111   const Float_t avPlScintThicknessFDMC=avPlScintThicknessNDMC;
00112   const Float_t avPlAlumDensityFDMC=avPlAlumDensityNDMC;
00113   const Float_t avPlAlumThicknessFDMC=avPlAlumThicknessNDMC;
00114 
00115   cout<<"************** Thickness and Density ******************"<<endl;
00116   cout<<"Thickness ND Data:"
00117       <<" steel="<<avPlSteelThicknessNDData
00118       <<", scint="<<avPlScintThicknessNDData
00119       <<", alum="<<avPlAlumThicknessNDData<<endl;
00120   cout<<"Density ND Data:"
00121       <<" steel="<<avPlSteelDensityNDData
00122       <<", scint="<<avPlScintDensityNDData
00123       <<", alum="<<avPlAlumDensityNDData<<endl;
00124   cout<<endl;
00125     cout<<"Thickness ND MC:"
00126       <<" steel="<<avPlSteelThicknessNDMC
00127       <<", scint="<<avPlScintThicknessNDMC
00128       <<", alum="<<avPlAlumThicknessNDMC<<endl;
00129   cout<<"Density ND MC:"
00130       <<" steel="<<avPlSteelDensityNDMC
00131       <<", scint="<<avPlScintDensityNDMC
00132       <<", alum="<<avPlAlumDensityNDMC<<endl;
00133 
00134   cout<<endl<<endl;
00135   cout<<"Thickness FD Data:"
00136       <<" steel="<<avPlSteelThicknessFDData
00137       <<", scint="<<avPlScintThicknessFDData
00138       <<", alum="<<avPlAlumThicknessFDData<<endl;
00139   cout<<"Density FD Data:"
00140       <<" steel="<<avPlSteelDensityFDData
00141   <<", scint="<<avPlScintDensityFDData
00142       <<", alum="<<avPlAlumDensityFDData<<endl;
00143   cout<<endl;
00144     cout<<"Thickness FD MC:"
00145       <<" steel="<<avPlSteelThicknessFDMC
00146       <<", scint="<<avPlScintThicknessFDMC
00147       <<", alum="<<avPlAlumThicknessFDMC<<endl;
00148   cout<<"Density FD MC:"
00149       <<" steel="<<avPlSteelDensityFDMC
00150       <<", scint="<<avPlScintDensityFDMC
00151       <<", alum="<<avPlAlumDensityFDMC<<endl;
00152 
00153   const Float_t avPlSteelStPwNDData=
00154     avPlSteelThicknessNDData*avPlSteelDensityNDData;
00155   const Float_t avPlScintStPwNDData=
00156     avPlScintThicknessNDData*avPlScintDensityNDData;
00157   const Float_t avPlAlumStPwNDData=
00158     avPlAlumThicknessNDData*avPlAlumDensityNDData;
00159 
00160   const Float_t avPlSteelStPwFDData=
00161     avPlSteelThicknessFDData*avPlSteelDensityFDData;
00162   const Float_t avPlScintStPwFDData=
00163     avPlScintThicknessFDData*avPlScintDensityFDData;
00164   const Float_t avPlAlumStPwFDData=
00165     avPlAlumThicknessFDData*avPlAlumDensityFDData;
00166 
00167   const Float_t avPlSteelStPwNDMC=
00168     avPlSteelThicknessNDMC*avPlSteelDensityNDMC;
00169   const Float_t avPlScintStPwNDMC=
00170     avPlScintThicknessNDMC*avPlScintDensityNDMC;
00171   const Float_t avPlAlumStPwNDMC=
00172     avPlAlumThicknessNDMC*avPlAlumDensityNDMC;
00173 
00174   const Float_t avPlSteelStPwFDMC=
00175     avPlSteelThicknessFDMC*avPlSteelDensityFDMC;
00176   const Float_t avPlScintStPwFDMC=
00177     avPlScintThicknessFDMC*avPlScintDensityFDMC;
00178   const Float_t avPlAlumStPwFDMC=
00179     avPlAlumThicknessFDMC*avPlAlumDensityFDMC;
00180 
00181   cout<<endl<<endl;
00182   cout<<"**************** Stopping Power ********************"<<endl;
00183   cout<<"StPw ND Data:"
00184       <<" steel="<<avPlSteelStPwNDData
00185       <<", scint="<<avPlScintStPwNDData
00186       <<", alum="<<avPlAlumStPwNDData<<endl;
00187   cout<<endl;
00188   cout<<"StPw ND MC:"
00189       <<" steel="<<avPlSteelStPwNDMC
00190       <<", scint="<<avPlScintStPwNDMC
00191       <<", alum="<<avPlAlumStPwNDMC<<endl;
00192   cout<<endl<<endl;
00193   cout<<"StPw FD Data:"
00194       <<" steel="<<avPlSteelStPwFDData
00195       <<", scint="<<avPlScintStPwFDData
00196       <<", alum="<<avPlAlumStPwFDData<<endl;
00197   cout<<endl;
00198   cout<<"StPw FD MC:"
00199       <<" steel="<<avPlSteelStPwFDMC
00200       <<", scint="<<avPlScintStPwFDMC
00201       <<", alum="<<avPlAlumStPwFDMC<<endl;
00202 
00203 
00204   //NOW CALC AREAS
00205   Float_t areaPlND=3.142*pow(0.8*Munits::m,2);
00206   Float_t areaPlFD=3.142*(14*Munits::m2-pow(0.4*Munits::m,2));
00207   cout<<endl<<endl;
00208   cout<<"Area ND = "<<areaPlND<<endl;
00209   cout<<"Area FD = "<<areaPlFD<<endl;
00210 
00211   //NOW CALC MASS
00212   const Float_t avPlSteelMassNDData=avPlSteelStPwNDData*areaPlND;
00213   const Float_t avPlScintMassNDData=avPlScintStPwNDData*areaPlND;
00214   const Float_t avPlAlumMassNDData=avPlAlumStPwNDData*areaPlND;
00215 
00216   const Float_t avPlSteelMassNDMC=avPlSteelStPwNDMC*areaPlND;
00217   const Float_t avPlScintMassNDMC=avPlScintStPwNDMC*areaPlND;
00218   const Float_t avPlAlumMassNDMC=avPlAlumStPwNDMC*areaPlND;
00219 
00220   const Float_t avPlSteelMassFDData=avPlSteelStPwFDData*areaPlFD;
00221   const Float_t avPlScintMassFDData=avPlScintStPwFDData*areaPlFD;
00222   const Float_t avPlAlumMassFDData=avPlAlumStPwFDData*areaPlFD;
00223 
00224   const Float_t avPlSteelMassFDMC=avPlSteelStPwFDMC*areaPlFD;
00225   const Float_t avPlScintMassFDMC=avPlScintStPwFDMC*areaPlFD;
00226   const Float_t avPlAlumMassFDMC=avPlAlumStPwFDMC*areaPlFD;
00227 
00228   cout<<endl<<endl;
00229   cout<<"**************** MASS ********************"<<endl;
00230   cout<<"Mass ND Data:"
00231       <<" steel="<<avPlSteelMassNDData
00232       <<", scint="<<avPlScintMassNDData
00233       <<", alum="<<avPlAlumMassNDData<<endl;
00234   cout<<endl;
00235   cout<<"Mass ND MC:"
00236       <<" steel="<<avPlSteelMassNDMC
00237       <<", scint="<<avPlScintMassNDMC
00238       <<", alum="<<avPlAlumMassNDMC<<endl;
00239   cout<<endl<<endl;
00240   cout<<"Mass FD Data:"
00241       <<" steel="<<avPlSteelMassFDData
00242       <<", scint="<<avPlScintMassFDData
00243       <<", alum="<<avPlAlumMassFDData<<endl;
00244   cout<<endl;
00245   cout<<"Mass FD MC:"
00246       <<" steel="<<avPlSteelMassFDMC
00247       <<", scint="<<avPlScintMassFDMC
00248       <<", alum="<<avPlAlumMassFDMC<<endl;
00249 
00250 
00251 
00252   const Float_t avPlTotalMassNDData=
00253     avPlSteelMassNDData+avPlScintMassNDData+avPlAlumMassNDData;
00254   const Float_t avPlTotalMassNDMC=
00255     avPlSteelMassNDMC+avPlScintMassNDMC+avPlAlumMassNDMC;
00256   const Float_t avPlTotalMassFDData=
00257     avPlSteelMassFDData+avPlScintMassFDData+avPlAlumMassFDData;
00258   const Float_t avPlTotalMassFDMC=
00259     avPlSteelMassFDMC+avPlScintMassFDMC+avPlAlumMassFDMC;
00260 
00261   const Float_t massSumND=avPlTotalMassNDData+avPlTotalMassNDMC;
00262   const Float_t massSumFD=avPlTotalMassFDData+avPlTotalMassFDMC;
00263   const Float_t massDiffND=avPlTotalMassNDData-avPlTotalMassNDMC;
00264   const Float_t massDiffFD=avPlTotalMassFDData-avPlTotalMassFDMC;
00265 
00266   const Float_t massRelDiffND=massDiffND/(0.5*massSumND);
00267   const Float_t massRelDiffFD=massDiffFD/(0.5*massSumFD);
00268 
00269   cout<<endl<<endl;
00270   cout<<"Mass ND Data Total: "<<avPlTotalMassNDData<<endl;
00271   cout<<"Mass ND MC Total: "<<avPlTotalMassNDMC<<endl;
00272   cout<<"Mass ND Data-MC="<<massDiffND<<endl;
00273   cout<<"Mass ND Data-MC/(0.5*Data+MC)="<<massRelDiffND<<endl;
00274   cout<<endl;
00275   cout<<"Mass FD Data Total: "<<avPlTotalMassFDData<<endl;
00276   cout<<"Mass FD MC Total: "<<avPlTotalMassFDMC<<endl;
00277   cout<<"Mass FD Data-MC="<<massDiffFD<<endl;
00278   cout<<"Mass FD Data-MC/(0.5*Data+MC)="<<massRelDiffFD<<endl;
00279   cout<<endl;
00280 
00281   //Considering events from STEEL planes
00282   //ND: 14->68 inclusive = 55 planes of steel
00283   cout<<endl<<endl;
00284   cout<<"55 planes in ND Data="
00285       <<55*avPlTotalMassNDData/(Munits::kilotonne)<<" kilotonnes"<<endl;
00286   cout<<"55 planes in ND MC  ="
00287       <<55*avPlTotalMassNDMC/(Munits::kilotonne)<<" kilotonnes"<<endl;
00288 
00289   //FD: 4->239 inclusive + 253->464 inclusive = 236 + 212 = 448 planes
00290   cout<<endl<<endl;
00291   cout<<"448 planes in FD Data="
00292       <<448*avPlTotalMassFDData/(Munits::kilotonne)<<" kilotonnes"
00293       <<endl;
00294   cout<<"448 planes in FD MC  ="
00295       <<448*avPlTotalMassFDMC/(Munits::kilotonne)<<" kilotonnes"
00296       <<endl;
00297 
00298 
00299 //Table 5 of minos-doc-3134v2 has updated numbers
00300 //Both detectors have the same densities in MC
00301 //steel = 7.847
00302 //scint = 1.0457, thickness=1.0cm
00303 //The pitches of ND and FD are slightly different
00304 
00305 //Peter Litchfield's email of 20/06/07 22:27 GMT
00306 //Real detectors
00307 //Plane pitch  FD (average) 5.946cm,  ND 5.94cm (3134)
00308 //Steel density  Both Detectors 7.847gm/cc (1431)
00309 //Steel thickness FD 2.559cm, ND 2.563cm (1529)
00310 //Scintillator 1.02cm density 1.0457gm/cc (scint+coating, 3134)
00311 //Aluminium    0.1cm  density 2.7gm/cc (PDG book)
00312 //FD average density = 3.602gm/cc
00313 //ND average density = 3.611gm/cc
00314 
00315 //In the Birch MC (3134)
00316 //Plane pitch  FD (average) 5.946cm,  ND 5.94cm
00317 //Steel density 7.87gm/cc
00318 //Steel thickness 2.54cm
00319 //Scintillator 1.02cm density 1.032gm/cc
00320 //Aluminium 0.1cm air, negligible density
00321 //FD avearge density = 3.539gm/cc
00322 //ND average density = 3.542gm/cc
00323 }

bool NuUtilities::CheckConsistency ( const TH1 *  h1,
const TH1 *  h2 
) [static]

Checks two histograms have the same binning.

This is a static function on TH1, but for some reason it's private Copied the implemention here (and made it saner) as the lesser of two evils.

(The greater of two evils, preserved for posterity, is as follows)

define CheckConsistency fgHackVar; public: static bool CheckConsistency include "TH1D.h" undef CheckConsistency

Definition at line 1362 of file NuUtilities.cxx.

References CheckBinLimits().

Referenced by NuMatrixSpectrum::FillOscCache(), and NuMatrix1D::FillOscCache().

01363 {
01364   if(h1->GetNbinsX() != h2->GetNbinsX() ||
01365      h1->GetNbinsY() != h2->GetNbinsY() ||
01366      h1->GetNbinsZ() != h2->GetNbinsZ())
01367     return false;
01368 
01369   if(h1->GetXaxis()->GetXmin() != h2->GetXaxis()->GetXmin() ||
01370      h1->GetXaxis()->GetXmax() != h2->GetXaxis()->GetXmax() ||
01371      h1->GetYaxis()->GetXmin() != h2->GetYaxis()->GetXmin() ||
01372      h1->GetYaxis()->GetXmax() != h2->GetYaxis()->GetXmax() ||
01373      h1->GetZaxis()->GetXmin() != h2->GetZaxis()->GetXmin() ||
01374      h1->GetZaxis()->GetXmax() != h2->GetZaxis()->GetXmax())
01375     return false;
01376 
01377   if(!CheckBinLimits(h1->GetXaxis()->GetXbins(), h2->GetXaxis()->GetXbins()) ||
01378      !CheckBinLimits(h1->GetYaxis()->GetXbins(), h2->GetYaxis()->GetXbins()) ||
01379      !CheckBinLimits(h1->GetZaxis()->GetXbins(), h2->GetZaxis()->GetXbins()))
01380     return false;
01381 
01382   return true;
01383 }

NuUtilities::ClassDef ( NuUtilities  ,
 
)

TGraph NuUtilities::ConvertLikelihoodSurfaceToContour ( TH2D *  hLikelihood,
Double_t  upValue 
) [static]

Definition at line 65 of file NuUtilities.cxx.

00067 {
00068   Double_t minimumLike = hLikelihood->GetMinimum();
00069   hLikelihood->SetContour(1);
00070   hLikelihood->SetContourLevel(0, minimumLike + upValue);
00071   TCanvas canvas;
00072   hLikelihood->Draw("contlist same");
00073   canvas.Update(); //This line of code embodies everything I hate about Root
00074 
00075   TObjArray* contArr = (TObjArray*) gROOT->GetListOfSpecials()->FindObject("contours"); //What was Rene Brun thinking?
00076   TList* contList = (TList*) contArr->At(0);
00077   //  TGraph* contGraph68 = new TGraph(*((TGraph*)contList->First()));
00078   return *((TGraph*)contList->First());
00079 }

BeamType::BeamType_t NuUtilities::ConvertToConventionsBeamType ( const Int_t  beamType,
const Int_t  intensity 
) [static]

Definition at line 360 of file NuUtilities.cxx.

References BeamType::kL010z000i, BeamType::kL010z000i_i209, BeamType::kL010z000i_i225, BeamType::kL010z000i_i232, BeamType::kL010z000i_i259, BeamType::kL010z000i_i300, BeamType::kL010z000i_i317, BeamType::kL010z000i_i326, BeamType::kL010z000i_i380, BeamType::kL010z185i, BeamType::kL010z185i_i124, BeamType::kL010z185i_i191, BeamType::kL010z185i_i213, BeamType::kL010z185i_i224, BeamType::kL010z185i_i232, BeamType::kL010z185i_i243, BeamType::kL010z185i_i257, BeamType::kL010z185i_i282, BeamType::kL010z185i_i303, BeamType::kL010z185i_i324, BeamType::kL010z185i_i361, BeamType::kL250z200i, BeamType::kL250z200i_i100, BeamType::kL250z200i_i114, BeamType::kL250z200i_i130, BeamType::kL250z200i_i152, BeamType::kL250z200i_i165, BeamType::kL250z200i_i194, BeamType::kL250z200i_i232, BeamType::kUnknown, Msg::kWarning, and MSG.

Referenced by ReturnConventionsBeamType().

00361 {
00362   BeamType::BeamType_t originalBeamType =
00363     static_cast<BeamType::BeamType_t>(beamType);
00364   if (0==intensity){
00365     return originalBeamType;
00366   }
00367   if (BeamType::kL010z185i == originalBeamType){
00368     if (124==intensity){
00369       return BeamType::kL010z185i_i124;
00370     }
00371     else if (191==intensity){
00372       return BeamType::kL010z185i_i191;
00373     }
00374     else if (213==intensity){
00375       return BeamType::kL010z185i_i213;
00376     }
00377     else if (224==intensity){
00378       return BeamType::kL010z185i_i224;
00379     }
00380     else if (232==intensity){
00381       return BeamType::kL010z185i_i232;
00382     }
00383     else if (243==intensity){
00384       return BeamType::kL010z185i_i243;
00385     }
00386     else if (257==intensity){
00387       return BeamType::kL010z185i_i257;
00388     }
00389     else if (282==intensity){
00390       return BeamType::kL010z185i_i282;
00391     }
00392     else if (303==intensity){
00393       return BeamType::kL010z185i_i303;
00394     }
00395     else if (324==intensity){
00396       return BeamType::kL010z185i_i324;
00397     }
00398     else if (361==intensity){
00399       return BeamType::kL010z185i_i361;
00400     }
00401     else {
00402       MSG("NuUtilities",Msg::kWarning)
00403         << "Received an L010z185i beam type with unrecognized intensity. Intensity = "
00404         << intensity
00405         << endl;
00406       return BeamType::kUnknown;
00407     }
00408   }
00409 
00410   if (BeamType::kL010z000i == originalBeamType){
00411     if (209 == intensity){
00412       return BeamType::kL010z000i_i209;
00413     }
00414     else if (225 == intensity){
00415       return BeamType::kL010z000i_i225;
00416     }
00417     else if (232 == intensity){
00418       return BeamType::kL010z000i_i232;
00419     }
00420     else if (259 == intensity){
00421       return BeamType::kL010z000i_i259;
00422     }
00423     else if (300 == intensity){
00424       return BeamType::kL010z000i_i300;
00425     }
00426     else if (317 == intensity){
00427       return BeamType::kL010z000i_i317;
00428     }
00429     else if (326 == intensity){
00430       return BeamType::kL010z000i_i326;
00431     }
00432     else if (380 == intensity){
00433       return BeamType::kL010z000i_i380;
00434     }
00435     else {
00436       MSG("NuUtilities",Msg::kWarning)
00437         << "Received an L010z000i beam type with unrecognized intensity."
00438         << endl;
00439       return BeamType::kUnknown;
00440     }
00441   }
00442 
00443   if (BeamType::kL250z200i == originalBeamType){
00444     if (100 == intensity){
00445       return BeamType::kL250z200i_i100;
00446     }
00447     else if (114 == intensity){
00448       return BeamType::kL250z200i_i114;
00449     }
00450     else if (130 == intensity){
00451       return BeamType::kL250z200i_i130;
00452     }
00453     else if (152 == intensity){
00454       return BeamType::kL250z200i_i152;
00455     }
00456     else if (165 == intensity){
00457       return BeamType::kL250z200i_i165;
00458     }
00459     else if (194 == intensity){
00460       return BeamType::kL250z200i_i194;
00461     }
00462     else if (232 == intensity){
00463       return BeamType::kL250z200i_i232;
00464     }
00465     else {
00466       MSG("NuUtilities",Msg::kWarning)
00467         << "Received an L250z200i beam type with unrecognized intensity."
00468         << endl;
00469       return BeamType::kUnknown;
00470     }
00471   }
00472 
00473   MSG("NuUtilities",Msg::kWarning)
00474     << "Received a non-zero intensity flag, along with a beam "
00475     << "type not configured for intensity weighting."
00476     << endl;
00477   return BeamType::kUnknown;
00478 
00479 }

static Double_t NuUtilities::DistanceTargetToND (  )  [inline, static]

Definition at line 53 of file NuUtilities.h.

References Munits::km.

Referenced by NuOscProb::FourFlavourDisappearanceWeight(), NuOscProb::FourFlavourNuESurvivalProbability(), NuOscProb::FourFlavourNuMuToNuEProbability(), NuOscProb::FourFlavourNuMuToNuSProbability(), NuOscProb::FourFlavourNuMuToNuTauProbability(), and NuMatrix1D::OscillatedNDRecoToTrue().

00053 {return 1.04*Munits::km;};

void NuUtilities::FixDogwoodQP ( NuEvent nu  )  [static]

Definition at line 1195 of file NuUtilities.cxx.

References NuReco::GetEvtEnergy(), NuLibrary::Instance(), ReleaseType::IsDogwood(), Msg::kInfo, MAXMSG, PrintRelease(), NuEvent::qp, NuEvent::qp_rangebiased, NuEvent::qp_sigqp, NuLibrary::reco, NuEvent::recoVersion, NuEvent::sigqp, and NuEvent::sigqp_qp.

Referenced by NuDSTAna::QPStudy(), and NuDSTAna::SelectorTable().

01196 {
01197   // Only need to fix dogwood NuEvent's
01198   if (!ReleaseType::IsDogwood(nu.recoVersion)) {
01199     MAXMSG("NuUtilities",Msg::kInfo,5) << "Not correcting q/p for "
01200     << PrintRelease(nu.recoVersion) << endl;
01201     return;
01202   }
01203   MAXMSG("NuUtilities",Msg::kInfo,5) << "Correcting "
01204   << PrintRelease(nu.recoVersion) << " q/p from "
01205   << nu.qp << " to " << nu.qp_rangebiased << endl;
01206 
01207   nu.qp = nu.qp_rangebiased;
01208   if (nu.sigqp == 0) nu.qp_sigqp = 0;
01209   else               nu.qp_sigqp = nu.qp_rangebiased / nu.sigqp;
01210 
01211   for(int trkIdx = 1; trkIdx <= 3; ++trkIdx){
01212     get_qp(nu, trkIdx) = get_qp_rangebiased(nu, trkIdx);
01213     if(get_sigqp(nu, trkIdx) != 0){
01214       get_qp_sigqp(nu, trkIdx) =
01215         get_qp_rangebiased(nu, trkIdx) / get_sigqp(nu, trkIdx);
01216     }
01217   }
01218 
01219   if (nu.qp_sigqp == 0) nu.sigqp_qp = 0;
01220   else                  nu.sigqp_qp = 1./nu.qp_sigqp;
01221 
01222   NuLibrary& lib=NuLibrary::Instance();
01223   lib.reco.GetEvtEnergy(nu, false);
01224 
01225   if (nu.qp_rangebiased > 0) nu.charge = 1;
01226   else                       nu.charge = -1;
01227 }

vector< Double_t > NuUtilities::GenerateBins ( int  ngroups,
double  edges[],
double  steps[] 
) [static]

Definition at line 482 of file NuUtilities.cxx.

References Munits::g.

Referenced by NuMatrixSpectrum::RebinForFit(), NuMatrixSpectrum::RebinForPlotAsFit(), NuMatrixSpectrum::RebinForPlots(), NuMatrixSpectrum::RebinToGeV(), and RecoBins().

00483 {
00484     vector<Double_t> bins;
00485     for (int g = 0; g < ngroups; g++) {
00486         Double_t lowEdge = edges[g];
00487         Double_t highEdge = edges[g+1];
00488         Double_t binWidth = steps[g];
00489         for (Double_t binEdge = lowEdge;
00490              binEdge < highEdge - (binWidth/2.0);
00491              binEdge += binWidth){
00492             bins.push_back(binEdge);
00493         }
00494     }
00495     bins.push_back(edges[ngroups]);
00496     return bins;
00497 }

Double_t NuUtilities::GetChisqFromCL ( double  cl = 0.6827,
int  n = 1 
) [static]

Definition at line 1293 of file NuUtilities.cxx.

Referenced by GetChisqFromSigma().

01294 {
01295 
01296   if(n<2) return 2*pow(TMath::ErfInverse(cl),2);
01297 
01298    // Create the function and wrap it
01299    TF1 f("C.L. from Chisq", "TMath::Gamma(0.5*[0],0.5*x)", 0, 2*n+50);
01300    f.SetParameter(0,n);
01301    f.SetNpx(4);
01302  
01303    return f.GetX(cl);
01304 
01305 }

Double_t NuUtilities::GetChisqFromSigma ( double  s = 1,
int  n = 1 
) [static]

Definition at line 1309 of file NuUtilities.cxx.

References GetChisqFromCL(), and Munits::s.

01310 {
01311 
01312   if(n<2) return s*s;
01313 
01314   double cl = TMath::Erf(s/sqrt(2));
01315   
01316   return GetChisqFromCL(cl,n);
01317 
01318 }

int NuUtilities::GetDigit ( int  num,
int  d 
) [static]

Definition at line 1340 of file NuUtilities.cxx.

Referenced by NuExtraction::ExtractCoilInfo().

01341 {
01342   int pow1 = static_cast<int>(TMath::Power(10, d));
01343   int pow2 = pow1 / 10;
01344   return (num % pow1 - num % pow2) / pow2;
01345 }

std::vector< TString > NuUtilities::GetListOfFilesInDir ( const TString &  wildcardString  )  [static]

Definition at line 1231 of file NuUtilities.cxx.

References Munits::g.

Referenced by NuFluxHelper::ConcatenateHelpers(), and NuFluxHelper::MakeHelperHistos().

01232 {
01233   std::vector<TString> fileList;
01234 
01235   glob_t g;
01236   glob(wildcardString.Data(),
01237        // GLOB_NOCHECK | // If no match return pattern
01238        GLOB_TILDE, // Expand ~'s
01239        0, &g);
01240   for(unsigned int i = 0; i < g.gl_pathc; ++i)
01241     fileList.push_back(g.gl_pathv[i]);
01242   globfree(&g);
01243 
01244   // glob output is sorted by default
01245 
01246   return fileList;
01247 }

const TH1D NuUtilities::IntegralMarginalize ( const TH2D *  surf,
const char  axis = 'y' 
) [static]

Definition at line 1386 of file NuUtilities.cxx.

References Msg::kError, and MSG.

01387 {
01388   bool doY;
01389   if (axis == 'y' || axis == 'Y')  doY = true;
01390   else if (axis == 'x' || axis == 'X') doY = false;
01391   else {
01392     MSG("NuUtilities",Msg::kError) << "Axis " << axis << "not recognized. Only x, X, y, Y are allowed axes." << endl;
01393     TH1D blank;    return blank;
01394   }
01395 
01396   TH1D * marginSurf;
01397   TString name = surf->GetName();
01398 
01399   // Use root's built in projections to do the integrals, excluding Under/overflow
01400   if (doY) {
01401     marginSurf = surf->ProjectionY(name+"_intMarginY", 1, surf->GetNbinsX());
01402     marginSurf->Scale(1./surf->GetNbinsX());
01403   }
01404   else {
01405     marginSurf = surf->ProjectionX(name+"_intMarginX", 1, surf->GetNbinsY());
01406     marginSurf->Scale(1./surf->GetNbinsY());
01407   }
01408 
01409   // Subtract off the minimum bin to get a deltaChisquared
01410   // Not *exactly* correct but should be pretty close in bins are
01411   // relatively small
01412   double allMin = marginSurf->GetMinimum();
01413   for (int b = 0; b <= marginSurf->GetNbinsX()+1; b++) {
01414     double val = marginSurf->GetBinContent(b) - allMin;
01415     marginSurf->SetBinContent(b, val);
01416   }
01417 
01418   return *marginSurf;
01419 }

Double_t NuUtilities::LogLikelihood ( Double_t  data,
Double_t  MC 
) [static]

Definition at line 1250 of file NuUtilities.cxx.

References MuELoss::e.

Referenced by NuMMRun::StatsLikelihood(), NuMatrix2D::StatsLikelihood(), and NuMatrix1D::StatsLikelihood().

01251 {
01252 
01253   if( isnan(mnu) || isnan(dnu) || dnu < 0 ){
01254     cout << "Error: MC or Data are not valid numbers!!!" << endl;
01255     return 1e12;
01256   }
01257 
01258   const Double_t MCError = 1e-12;
01259   if (dnu) {
01260     // Protection against cases where there is data but no MC?
01261     // This should not normally be possible, other than highly contrived
01262     // unphysical oscillation values.
01263     // Set the value to something lower than POT_Data / POT_MC, which at the
01264     // moment is usually 1e-3. We can justify this as an error on the MC
01265     // Set to a 2nd order expansion around MCError.
01266     // Also protects against negative MC events
01267 
01268     if (mnu < MCError){
01269       //cout << "MC Error: MC = " << mnu << endl;
01270       return 2*(mnu-dnu+dnu*log(dnu/MCError)) + dnu*(3-4*mnu/MCError+pow(mnu/MCError,2));
01271     }
01272 
01273     // We have both values. Do the proper lnL!
01274     return 2*(mnu - dnu + dnu*log(dnu/mnu));
01275   }
01276   else {
01277     // dnu is zero, mnu may or may not be zero
01278     // Protect against negative numbers by setting to a
01279     // quadratic function that matches Loglikelihood up
01280     // to 1st order at MCError and has minimum at mnu=0
01281 
01282     if (mnu < MCError){
01283       //cout << "MC Error: MC = " << mnu << endl;
01284       return mnu*mnu/MCError + MCError;
01285     }
01286 
01287     return 2*mnu;
01288   }
01289 }

const TH1D NuUtilities::MinimumMarginalize ( const TH2D *  surf,
const char  axis = 'y' 
) [static]

Definition at line 1423 of file NuUtilities.cxx.

References Msg::kError, min, and MSG.

01424 {
01425   bool doY;
01426   if (axis == 'y' || axis == 'Y')  doY = true;
01427   else if (axis == 'x' || axis == 'X') doY = false;
01428   else {
01429     MSG("NuUtilities",Msg::kError) << "Axis " << axis << "not recognized. Only x, X, y, Y are allowed axes." << endl;
01430     TH1D blank;    return blank;
01431   }
01432 
01433   TH1D * marginSurf;
01434   TString name = surf->GetName();
01435 
01436   int bKeepMax;
01437   int bMargMax;
01438   // Use root's built in projections to define the axis ranges, reset contents
01439   if (doY) {
01440     marginSurf = surf->ProjectionY(name+"_minMarginY", 1, surf->GetNbinsX());
01441     bKeepMax = surf->GetNbinsY(); // Keep Y
01442     bMargMax = surf->GetNbinsX(); // Marginalize X
01443   }
01444   else {
01445     marginSurf = surf->ProjectionX(name+"_minMarginX", 1, surf->GetNbinsY());
01446     bKeepMax = surf->GetNbinsX(); // Keep X
01447     bMargMax = surf->GetNbinsY(); // Marginalize Y
01448   }
01449   marginSurf->Reset();
01450 
01451   double allMin = 1.e10;
01452   double rowMin;
01453   int bx, by;
01454   for (int bk = 1; bk < bKeepMax; bk++) {
01455     rowMin = 1.e10;
01456     for (int bm = 1; bm < bMargMax; bm++) {
01457       if (doY) {
01458         bx = bm; // Marginalize X
01459         by = bk; // Keep Y
01460       }
01461       else {
01462         bx = bk; // Keep X
01463         by = bm; // Marginalize Y
01464       }
01465       rowMin = min(surf->GetBinContent(bx, by), rowMin);
01466       allMin = min(rowMin, allMin);
01467     }
01468     marginSurf->SetBinContent(bk, rowMin);
01469   }
01470 
01471   // Subtract off the minimum bin to get a deltaChisquared
01472   // Not *exactly* correct but should be pretty close in bins are
01473   // relatively small
01474   for (int bk = 1; bk < bKeepMax; bk++) {
01475     double val = marginSurf->GetBinContent(bk) - allMin;
01476     marginSurf->SetBinContent(bk, val);
01477   }
01478 
01479   return *marginSurf;
01480 }

void NuUtilities::OscillateJesstogram ( TH2D *  h,
double  dm2,
double  sn2 
) [static]

Definition at line 1321 of file NuUtilities.cxx.

References one(), NuMatrixSpectrum::Oscillate(), and NuMatrixSpectrum::Spectrum().

01322 {
01323   const int Nx = h->GetNbinsX();
01324   const int Ny = h->GetNbinsY();
01325 
01326   TH1D one("", "", Nx, h->GetXaxis()->GetXbins()->GetArray());
01327   for(int n = 0; n < Nx+2; ++n) one.SetBinContent(n, 1);
01328 
01329   NuMatrixSpectrum osc(one);
01330   osc.Oscillate(dm2, sn2);
01331 
01332   for(int x = 0; x < Nx+2; ++x){
01333     for(int y = 0; y < Ny+2; ++y){
01334       h->SetBinContent(x, y, h->GetBinContent(x, y)*osc.Spectrum()->GetBinContent(x));
01335     }
01336   }
01337 }

TString NuUtilities::PrintRelease ( int  releaseType  )  [static]

Definition at line 326 of file NuUtilities.cxx.

References ReleaseType::AsString().

Referenced by NuAnalysis::ExtractConfig(), FixDogwoodQP(), NuPIDInterface::GetFileNameAbID(), NuPIDInterface::GetFileNamekNNID(), NuZBeamReweight::GetWeightHelium(), NuAnalysis::LIRejectionTest(), NuDSTAna::MakeMicroDstHe(), NuPIDInterface::PrintReleaseTypeEtc(), and NuAnalysis::SetAnaFlags().

00327 {
00328   char hexnum[20];
00329   sprintf(hexnum, "%x", releaseType);
00330   TString ret = ReleaseType::AsString(releaseType);
00331   ret += " (0x";
00332   ret += hexnum;
00333   ret += ", ";
00334   ret += releaseType;
00335   ret += ")";
00336   return ret;
00337 }

void NuUtilities::ProgressBar ( Int_t  entry,
Float_t  nEntriesF,
Int_t  mintime = 0 
) [static]

Prints a progress bar with ETA. Not fully finished yet, still has issues with printing when the output is directed somewhere other than the console

Definition at line 1616 of file NuUtilities.cxx.

References Munits::bar, MuELoss::e, Msg::kInfo, and MSG.

Referenced by NuFCEventManager::AddFile(), NuSystFitter::Chi2ValleyDm2(), NuSystFitter::Chi2ValleySn2(), NuSystFitter::FillAlphaBeta(), NuSystFitter::FillCPT(), NuSystFitter::FillLikelihoodSurfaceCPT(), NuSystFitter::FillLikelihoodSurfaceGeneric(), NuSystFitter::FillLikelihoodSurfaceNSIDm2Eps(), NuSystFitter::FillLikelihoodSurfaceNSIDm2Sn2(), NuSystFitter::FillLikelihoodSurfaceNSISn2Eps(), NuSystFitter::FillLikelihoodSurfaceTransDm2BarGMu(), NuSystFitter::FillLikelihoodSurfaceTransDm2BarSn2Bar(), NuSystFitter::FillLikelihoodSurfaceTransDm2GMu(), NuSystFitter::FillLikelihoodSurfaceTransDm2GMuBoth(), NuSystFitter::FillLikelihoodSurfaceTransDm2Sn2(), NuSystFitter::FillLikelihoodSurfaceTransDm2Sn2Both(), NuSystFitter::FillLikelihoodSurfaceTransSn2BarGMu(), NuSystFitter::FillLikelihoodSurfaceTransSn2GMu(), NuSystFitter::FillLikelihoodSurfaceTransSn2GMuBoth(), ToFPlotter::MakeDataPlots(), FoverNHistos::MakeDataPlots(), DataMCPlots::MakeDataPlots(), TemplateAnalysisClass::MakePlots(), FitTree::MakeVectors(), NuDSTAna::MMRereco(), and NuDSTAna::MMTransSME().

01617 {
01618   Int_t nEntries = (Int_t)nEntriesF;
01619 
01620   // Are we streaming to a file? If so, show the old style
01621   struct stat buf;
01622   fstat(fileno(stdout), &buf);
01623   // Check if we are a file, or a pipe (i.e. in case the user tees)
01624   const bool isFile = buf.st_mode & (S_IFREG | S_IFIFO) ;
01625   if (isFile) {
01626     Float_t fract = ceil(nEntries/20.);
01627     if (ceil(((Float_t)entry)/fract)==((Float_t)entry)/fract)
01628     {
01629         MSG("NuUtilities",Msg::kInfo)
01630           <<"Fraction of loop complete: "<<entry
01631           <<"/"<<nEntries<<"  ("
01632           <<(Int_t)(100.*entry/nEntries)<<"%)"<<endl;
01633     }
01634     return;
01635   }
01636 
01637 
01638   // How wide should we make the progress bar?
01639   const Int_t width = 70;
01640   // How long is the string for entries?
01641   static Int_t countlen = -1;
01642   // How long is our progress bar?
01643   static Int_t barlen = -1;
01644   // The entry number of the next bar entry
01645   static Int_t nextbar = -1;
01646   // When did we start?
01647   static time_t starttime = 0;
01648   // when do we next update?
01649   static time_t nextupdate = 0;
01650   // If we are processing the first entry, reset everything
01651   if (entry <= 1)
01652   {
01653     // Get the new length of the entry string
01654     countlen = (Int_t)TMath::Ceil(TMath::Log10(nEntries)) + 1;
01655     nextbar = -1;
01656     starttime = time(NULL);
01657 
01658     barlen = width - 14 - countlen*2 - 1;
01659 
01660     // Don't update until we get to the minimum time
01661     nextupdate = starttime + mintime;
01662   }
01663 
01664   // Check here to see if we should update; otherwise, return
01665   // Check to see if the bar would update
01666   // or, alternatively, it is time to refresh.
01667   if ((time(NULL) < nextupdate) && (entry < nextbar || (nextbar == -1)))return;
01668   nextupdate = time(NULL) + 10;
01669 
01670   // Because this is used in several places, make it here
01671   Float_t frac = (Float_t)entry / (Float_t)nEntries;
01672 
01673   // Prepare the progress bar string
01674   TString bar;
01675   if (entry <= nEntries)
01676   {
01677     // Work out how many characters we are in
01678     Int_t numeq = TMath::FloorNint(frac*barlen);
01679 
01680     // Work out when the next bar will occur
01681     nextbar = (Int_t)((Float_t)(numeq+1)/(Float_t)barlen*nEntries);
01682     //cout << "Next bar at: " << nextbar << "        " << endl;
01683     bar = TString('=', numeq);
01684     bar += TString(' ', barlen - numeq);
01685   } else if (entry > nEntries) {
01686     // We have gone over. Oh no!
01687     bar = TString('+', barlen);
01688   } else if (entry < 0) {
01689     // Somehow, we are below zero. Handle it nonetheless
01690     bar = TString('-', barlen);
01691   }
01692 
01693 
01694   // Prepare the ETA
01695   Float_t elapsed_time = (Float_t)(time(NULL) - starttime);
01696   Float_t time_left = -60;
01697   if (frac > 1e-6) {
01698     time_left = (elapsed_time / frac) - elapsed_time;
01699   }
01700   Int_t mins, seconds;
01701   mins    = (Int_t)TMath::Floor(time_left / 60.0f);
01702   seconds = (Int_t)TMath::Floor(time_left - (Float_t)(mins*60.0f));
01703   // TString ETA;
01704   ostringstream ETA;
01705 
01706   ETA << "ETA ";
01707   if ((mins < 0 || seconds < 0) || (mins == 0 && seconds == 0)) {
01708     ETA << "--:--";
01709   } else {
01710     ETA << setfill('0') << setw(2) << mins << ":" << setw(2) << seconds;
01711   }
01712 
01713   cout << " Progress: [" << bar << "] "
01714        << setw(countlen) << entry << "/" << nEntries
01715        << " " << ETA.str()
01716        << '\r'
01717        << flush;
01718   // Move to the next line, if this is the final entry!
01719   if (entry == nEntries) {
01720     cout << endl;
01721   }
01722 }

TH1D * NuUtilities::RebinHistogram ( const TH1D *  old,
NuBinningScheme::NuBinningScheme_t  scheme 
) [static]

Definition at line 1188 of file NuUtilities.cxx.

References RebinHistogram(), and RecoBins().

01189 {
01190   vector<Double_t> bins = RecoBins(scheme);
01191   return RebinHistogram(old, bins);
01192 }

TH1D * NuUtilities::RebinHistogram ( const TH1D *  old,
std::vector< Double_t > &  bins 
) [static]

Definition at line 1182 of file NuUtilities.cxx.

References RebinHistogram().

01183 {
01184   return RebinHistogram(old, bins.size()-1, &(bins[0]));
01185 }

TH1D * NuUtilities::RebinHistogram ( const TH1D *  old,
int  nbins,
const double  binedges[999] 
) [static]

Definition at line 1120 of file NuUtilities.cxx.

References count, and MuELoss::e.

Referenced by RebinHistogram(), NuMatrixSpectrum::RebinToArray(), and NuMatrixSpectrum::RebinToScheme().

01121 {
01122   static int count = 0;
01123   TString scount = "";
01124   scount += count++;
01125 
01126   TH1D* newh = new TH1D(old->GetName() + TString("_rebin") + scount, 
01127                         old->GetTitle(), nbins, binedges);
01128   bool ouwarn = true;
01129 
01130   // Floating point comparisons of bin edges don't go well otherwise
01131   const double epsilon = 1e-10;
01132 
01133   // Now, loop over the old histogram and fill the new one
01134   for(Int_t bin = 1; bin <= old->GetNbinsX(); bin++) {
01135 
01136     double oldCent = old->GetBinCenter(bin);
01137     int newbin = newh->GetXaxis()->FindFixBin(oldCent);
01138 
01139     // Make sure that bins do not cross boundaries.
01140     if (newbin > newh->GetNbinsX() || newbin == 0) {
01141       if (ouwarn) {
01142         cout << "Old bin: " << old->GetBinLowEdge(bin) << " - " << old->GetBinLowEdge(bin+1)
01143         << " and maybe others have become under/overflow" << endl;
01144         ouwarn = false;
01145       }
01146     } else if ( old->GetBinLowEdge(bin) + epsilon < newh->GetBinLowEdge(newbin) ||
01147                 old->GetBinLowEdge(bin + 1) > newh->GetBinLowEdge(newbin + 1) + epsilon) {
01148       cout << "Bin edge conflict in bin no's " << bin << ", " << newbin 
01149            << ".  No rebinning performed."
01150            << "  old bin: " << old->GetBinLowEdge(bin) << " - " << old->GetBinLowEdge(bin + 1)
01151            << ", new bin: " << newh->GetBinLowEdge(newbin) << " - " 
01152            << newh->GetBinLowEdge(newbin + 1)
01153            << endl;
01154       TH1D* old_ret = new TH1D(*old);
01155       return old_ret;
01156     }
01157 
01158     double oldCon = old->GetBinContent(bin);
01159     double oldErr = old->GetBinError(bin);
01160     double newCon = newh->GetBinContent(newbin);
01161     double newErr = newh->GetBinError(newbin);
01162 
01163     newCon += oldCon;
01164     newErr = sqrt(newErr*newErr + oldErr*oldErr);
01165     newh->SetBinContent(newbin, newCon);
01166     newh->SetBinError(newbin, newErr);
01167   }
01168 
01169   // Validate
01170   double oldint = old->Integral();
01171   double newint = newh->Integral() + newh->GetBinContent(0)
01172                  + newh->GetBinContent(newh->GetNbinsX()+1);
01173   if (abs(oldint - newint) > 1e-5) {
01174     cout << "Rebinning report: " << oldint << " entries have become " << newint << " events" << endl;
01175   }
01176   //newh->Sumw2();
01177   return newh;
01178 }

vector< Double_t > NuUtilities::RecoBins ( const NuBinningScheme::NuBinningScheme_t  binningScheme  )  [static]

Definition at line 502 of file NuUtilities.cxx.

References GenerateBins(), NuBinningScheme::k0_1GeVTo20, NuBinningScheme::k0_5GeVTo200, NuBinningScheme::kCC0325Std, NuBinningScheme::kCC3flav, NuBinningScheme::kDisplay1GevTo20, NuBinningScheme::kDisplayFD, NuBinningScheme::kDisplayFD2010, NuBinningScheme::kDisplayFD7e20, NuBinningScheme::kDisplayFDRHC, NuBinningScheme::kDisplayND, Msg::kInfo, NuBinningScheme::kNuMuBar0325Std, NuBinningScheme::kNuMuBar0325Std2, NuBinningScheme::kSterile, NuBinningScheme::kUnknown, and MAXMSG.

Referenced by NuDSTAna::Contamination(), NuDSTAna::ContaminationNQ(), ToFPlotter::CreateCCHistograms(), FoverNHistos::CreateHistograms(), ToFPlotter::CreateNCHistograms(), ToFPlotter::CreateRAFHistograms(), NuHistos::FillMatrixMethodHistos(), NuHistos::FillMatrixMethodNCHistos(), NuDSTAna::MakeResolutionBins(), NuDSTAna::NDOsc(), NuFCExperimentFactory::NuFCExperimentFactory(), NuFCExperimentFactoryNSI::NuFCExperimentFactoryNSI(), NuMatrixMethod::NuMatrixMethod(), NuTransition::NuTransition(), RebinHistogram(), and NuShiftableUnbinnedSpectrum::Spectrum().

00503 {
00504   if (NuBinningScheme::kUnknown == binningScheme ||
00505       NuBinningScheme::k0_5GeVTo200 == binningScheme){
00506     MAXMSG("NuUtilities",Msg::kInfo,5)
00507       << "Binning reco energy in 0.5 GeV up to 200 GeV" << endl;
00508     vector<Double_t> bins;
00509     Double_t lowEdge = 0.0;
00510     Double_t highEdge = 200.0;
00511     Double_t binWidth = 0.5;
00512     for (Double_t binEdge = lowEdge;
00513          binEdge <= highEdge + (binWidth/2.0);
00514          binEdge += binWidth){
00515       bins.push_back(binEdge);
00516     }
00517     return bins;
00518   } else if (NuBinningScheme::kCC0325Std == binningScheme) {
00519     MAXMSG("NuUtilities",Msg::kInfo,5)
00520       << "Reco energy: one bin from 0.0--0.5, "
00521       << "then 0.25 GeV bins up to 200.0 GeV"
00522       << endl;
00523     vector<Double_t> bins;
00524     bins.push_back(0.0);
00525     Double_t lowEdge = 0.5;
00526     Double_t highEdge = 200.0;
00527     Double_t binWidth = 0.25;
00528     for (Double_t binEdge = lowEdge;
00529          binEdge <= highEdge + (binWidth/2.0);
00530          binEdge += binWidth){
00531       bins.push_back(binEdge);
00532     }
00533     return bins;
00534   } else if (NuBinningScheme::kNuMuBar0325Std == binningScheme) {
00535     MAXMSG("NuUtilities",Msg::kInfo,5)
00536       << "Reco energy: 0.5 GeV up to 30 GeV; 2 GeV up to 50 GeV; "
00537       << "1 bin up to 200 GeV"
00538       << endl;
00539     vector<Double_t> bins;
00540     Double_t lowEdge = 0.0;
00541     Double_t highEdge = 30.0;
00542     Double_t binWidth = 0.5;
00543     for (Double_t binEdge = lowEdge;
00544          binEdge < highEdge - (binWidth/2.0);
00545          binEdge += binWidth){
00546       bins.push_back(binEdge);
00547     }
00548     lowEdge = 30.0;
00549     highEdge = 50.0;
00550     binWidth = 2.0;
00551     for (Double_t binEdge = lowEdge;
00552          binEdge < highEdge - (binWidth/2.0);
00553          binEdge += binWidth){
00554       bins.push_back(binEdge);
00555     }
00556     bins.push_back(50.0);
00557     bins.push_back(200.0);
00558     return bins;
00559   } else if (NuBinningScheme::kNuMuBar0325Std2 == binningScheme) {
00560     MAXMSG("NuUtilities",Msg::kInfo,5)
00561       << "Reco Energy: One 0.5 GeV, then 0.25 GeV up to 20 GeV; "
00562       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00563       << endl;
00564     vector<Double_t> bins;
00565     bins.push_back(0.0);
00566     Double_t lowEdge = 0.5;
00567     Double_t highEdge = 20.0;
00568     Double_t binWidth = 0.25;
00569     for (Double_t binEdge = lowEdge;
00570           binEdge < highEdge -(binWidth/2.0);
00571           binEdge += binWidth) {
00572       bins.push_back(binEdge);
00573     }
00574     lowEdge = 20.0;
00575     highEdge = 30.0;
00576     binWidth = 1.0;
00577     for (Double_t binEdge = lowEdge;
00578           binEdge < highEdge -(binWidth/2.0);
00579           binEdge += binWidth) {
00580       bins.push_back(binEdge);
00581     }
00582     lowEdge = 30.0;
00583     highEdge = 50.0;
00584     binWidth = 2.0;
00585     for (Double_t binEdge = lowEdge;
00586           binEdge < highEdge -(binWidth/2.0);
00587           binEdge += binWidth) {
00588       bins.push_back(binEdge);
00589     }
00590     bins.push_back(50.0);
00591     bins.push_back(200.0);
00592     return bins;
00593   } else if (NuBinningScheme::kCC3flav == binningScheme) {
00594     MAXMSG("NuUtilities",Msg::kInfo,5)
00595       << "Reco Energy: One 0.5 GeV, then 0.25 GeV up to 20 GeV; "
00596       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00597       << endl;
00598     vector<Double_t> bins;
00599     bins.push_back(0.0);
00600     Double_t lowEdge = 0.5;
00601     Double_t highEdge = 20.0;
00602     Double_t binWidth = 0.25;
00603     for (Double_t binEdge = lowEdge;
00604           binEdge < highEdge -(binWidth/2.0);
00605           binEdge += binWidth) {
00606       bins.push_back(binEdge);
00607     }
00608     lowEdge = 20.0;
00609     highEdge = 30.0;
00610     binWidth = 1.0;
00611     for (Double_t binEdge = lowEdge;
00612           binEdge < highEdge -(binWidth/2.0);
00613           binEdge += binWidth) {
00614       bins.push_back(binEdge);
00615     }
00616     lowEdge = 30.0;
00617     highEdge = 50.0;
00618     binWidth = 2.0;
00619     for (Double_t binEdge = lowEdge;
00620           binEdge < highEdge -(binWidth/2.0);
00621           binEdge += binWidth) {
00622       bins.push_back(binEdge);
00623     }
00624     bins.push_back(50.0);
00625     bins.push_back(200.0);
00626     return bins;
00627   }else if (NuBinningScheme::kSterile == binningScheme) { //A.Devan 8/29/2012
00628     MAXMSG("NuUtilities",Msg::kInfo,5)
00629       << "Reco Energy: 0.05GeV bin between 0 and 5 GeV, then 0.25 GeV up to 20 GeV; "
00630       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00631       << endl;
00632     vector<Double_t> bins;
00633     bins.push_back(0.0);
00634         Double_t lowEdge = 0.05;
00635         Double_t highEdge = 5.0;
00636         Double_t binWidth = 0.05;
00637         for (Double_t binEdge = lowEdge;
00638                   binEdge < highEdge - (binWidth/2.0);
00639                   binEdge += binWidth) {
00640           bins.push_back(binEdge);
00641         }
00642         lowEdge = 5.0;
00643     highEdge = 20.0;
00644     binWidth = 0.25;
00645     for (Double_t binEdge = lowEdge;
00646           binEdge < highEdge -(binWidth/2.0);
00647           binEdge += binWidth) {
00648       bins.push_back(binEdge);
00649     }
00650     lowEdge = 20.0;
00651     highEdge = 30.0;
00652     binWidth = 1.0;
00653     for (Double_t binEdge = lowEdge;
00654           binEdge < highEdge -(binWidth/2.0);
00655           binEdge += binWidth) {
00656       bins.push_back(binEdge);
00657     }
00658     lowEdge = 30.0;
00659     highEdge = 50.0;
00660     binWidth = 2.0;
00661     for (Double_t binEdge = lowEdge;
00662           binEdge < highEdge -(binWidth/2.0);
00663           binEdge += binWidth) {
00664       bins.push_back(binEdge);
00665     }
00666     bins.push_back(50.0);
00667     bins.push_back(200.0);
00668     return bins;
00669   } else if (NuBinningScheme::kDisplayFD == binningScheme) {
00670     MAXMSG("NuUtilities",Msg::kInfo,5)
00671     << "Reco Energy: 4 GeV Bins up to 20 GeV, then 20, 30, 50, 200"
00672     << endl;
00673     vector<Double_t> bins;
00674     Double_t lowEdge = 0.0;
00675     Double_t highEdge = 20.0;
00676     Double_t binWidth = 4;
00677     for (Double_t binEdge = lowEdge;
00678          binEdge < highEdge -(binWidth/2.0);
00679          binEdge += binWidth) {
00680       bins.push_back(binEdge);
00681     }
00682     bins.push_back(20.0);
00683     bins.push_back(30.0);
00684     bins.push_back(50.0);
00685     bins.push_back(200.0);
00686     return bins;
00687   } else if (NuBinningScheme::kDisplayND == binningScheme) {
00688     MAXMSG("NuUtilities",Msg::kInfo,5)
00689     << "Reco Energy: 1 Gev to 30 GeV, 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00690     << endl;
00691     vector<Double_t> bins;
00692     Double_t lowEdge = 0.0;
00693     Double_t highEdge = 20.0;
00694     Double_t binWidth = 1.0;
00695     for (Double_t binEdge = lowEdge;
00696          binEdge < highEdge -(binWidth/2.0);
00697          binEdge += binWidth) {
00698       bins.push_back(binEdge);
00699     }
00700     lowEdge = 20.0;
00701     highEdge = 30.0;
00702     binWidth = 2.0;
00703     for (Double_t binEdge = lowEdge;
00704          binEdge < highEdge -(binWidth/2.0);
00705          binEdge += binWidth) {
00706       bins.push_back(binEdge);
00707     }
00708     lowEdge = 30.0;
00709     highEdge = 50.0;
00710     binWidth = 4.0;
00711     for (Double_t binEdge = lowEdge;
00712          binEdge < highEdge -(binWidth/2.0);
00713          binEdge += binWidth) {
00714       bins.push_back(binEdge);
00715     }
00716     bins.push_back(50.0);
00717     bins.push_back(200.0);
00718     return bins;
00719   } else if (NuBinningScheme::kDisplayFDRHC == binningScheme) {
00720       double edges[] = {0, 10, 20, 30,  50, 200};
00721       double steps[] = {  1, 5, 10, 20, 150};
00722       int ng = 5;
00723 
00724       std::vector<Double_t> bins = NuUtilities::GenerateBins(ng, edges, steps);
00725       return bins;
00726   } else if(NuBinningScheme::kDisplayFD2010 == binningScheme){
00727     double edges[] = {0, 1, 5, 10, 20, 30, 50, 200};
00728     double steps[] = {1/*.5*/, .25, .5, 1, 10, 20, 130};
00729     int ng = 7;
00730 
00731     vector<double> bins = NuUtilities::GenerateBins(ng, edges, steps);
00732     return bins;
00733   } else if(NuBinningScheme::kDisplayFD7e20 == binningScheme){
00734       double edges[] = {0, 20, 30, 50, 200};
00735       double steps[] = {  2, 5, 20, 150};
00736       int ng = 4;
00737 
00738     vector<double> bins = NuUtilities::GenerateBins(ng, edges, steps);
00739     return bins;
00740   } else if(NuBinningScheme::kDisplay1GevTo20 == binningScheme) {
00741     MAXMSG("NuUtilities", Msg::kInfo, 5)
00742     << "Reco Energy: 0 Gev to 20 GeV in 1 GeV bins, plus a single 20--200 GeV bin"
00743     << endl;
00744     vector<Double_t> bins;
00745     Double_t lowEdge = 0.0;
00746     Double_t highEdge = 20.0;
00747     Double_t binWidth = 1.0;
00748     for (Double_t binEdge = lowEdge;
00749          binEdge < highEdge - (binWidth / 2.0);
00750          binEdge += binWidth) {
00751       bins.push_back(binEdge);
00752     }
00753     bins.push_back(20.0);
00754     bins.push_back(50.0);
00755     bins.push_back(200.0);
00756 
00757     return bins;
00758   } else if (NuBinningScheme::k0_1GeVTo20 == binningScheme) {
00759     MAXMSG("NuUtilities",Msg::kInfo,5)
00760       << "Reco Energy: 0.10 GeV up to 20 GeV; "
00761       << "1 Gev to 30 GeV, 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00762       << endl;
00763     vector<Double_t> bins;
00764     Double_t lowEdge = 0.0;
00765     Double_t highEdge = 20.0;
00766     Double_t binWidth = 0.1;
00767     for (Double_t binEdge = lowEdge;
00768           binEdge < highEdge -(binWidth/2.0);
00769           binEdge += binWidth) {
00770       bins.push_back(binEdge);
00771     }
00772     lowEdge = 20.0;
00773     highEdge = 30.0;
00774     binWidth = 1.0;
00775     for (Double_t binEdge = lowEdge;
00776           binEdge < highEdge -(binWidth/2.0);
00777           binEdge += binWidth) {
00778       bins.push_back(binEdge);
00779     }
00780     lowEdge = 30.0;
00781     highEdge = 50.0;
00782     binWidth = 2.0;
00783     for (Double_t binEdge = lowEdge;
00784           binEdge < highEdge -(binWidth/2.0);
00785           binEdge += binWidth) {
00786       bins.push_back(binEdge);
00787     }
00788     bins.push_back(50.0);
00789     bins.push_back(200.0);
00790     return bins;
00791   } else {
00792     MAXMSG("NuUtilities",Msg::kInfo,100)
00793     << "!!Invalid binning scheme (" << binningScheme << ") requested.!!" << endl
00794     << "Binning reco energy in 0.5 GeV up to 200 GeV" << endl;
00795     vector<Double_t> bins;
00796     Double_t lowEdge = 0.0;
00797     Double_t highEdge = 200.0;
00798     Double_t binWidth = 0.5;
00799     for (Double_t binEdge = lowEdge;
00800          binEdge <= highEdge + (binWidth/2.0);
00801          binEdge += binWidth){
00802       bins.push_back(binEdge);
00803     }
00804     return bins;
00805   }
00806 } // RecoBins

BeamType::BeamType_t NuUtilities::ReturnConventionsBeamType ( const NuConfig config  )  [static]

Definition at line 342 of file NuUtilities.cxx.

References NuConfig::beamType, ConvertToConventionsBeamType(), NuConfig::detector, NuConfig::intensity, SimFlag::kData, Detector::kFar, Msg::kInfo, MAXMSG, and NuConfig::simFlag.

Referenced by NuBeam::IsGoodSpillAndFillPot().

00343 {
00344   if (Detector::kFar==config.detector && SimFlag::kData==config.simFlag){
00345     MAXMSG("NuUtilities",Msg::kInfo,1)
00346       << "Detected FD data, so not combining intensity with beamType"
00347       << endl;
00348     BeamType::BeamType_t originalBeamType =
00349       static_cast<BeamType::BeamType_t>(config.beamType);
00350     return originalBeamType;
00351   }
00352   else{
00353     return NuUtilities::ConvertToConventionsBeamType(config.beamType,
00354                                                      config.intensity);
00355   }
00356 }

vector< Double_t > NuUtilities::TrueBins ( const NuBinningScheme::NuBinningScheme_t  binningScheme  )  [static]

Definition at line 810 of file NuUtilities.cxx.

References NuBinningScheme::k0_1GeVTo20, NuBinningScheme::k0_5GeVTo200, NuBinningScheme::kCC0325Std, NuBinningScheme::kCC3flav, NuBinningScheme::kDisplayFD, NuBinningScheme::kDisplayND, Msg::kInfo, NuBinningScheme::kNuMuBar0325Std, NuBinningScheme::kNuMuBar0325Std2, NuBinningScheme::kUnknown, and MAXMSG.

Referenced by FoverNHistos::CreateHistograms(), NuHistos::FillMatrixMethodHistos(), NuHistos::FillMatrixMethodNCHistos(), NuPlots::FillTrueFidEnergySpect(), NuFCExperimentFactory::NuFCExperimentFactory(), NuFCExperimentFactoryNSI::NuFCExperimentFactoryNSI(), NuFluxHelper::NuFluxHelper(), NuMatrixMethod::NuMatrixMethod(), and NuTransition::NuTransition().

00811 {
00812   if (NuBinningScheme::kUnknown == binningScheme ||
00813       NuBinningScheme::k0_5GeVTo200 == binningScheme){
00814     MAXMSG("NuUtilities",Msg::kInfo,5)
00815       << "Binning true energy in 0.5 GeV up to 200 GeV" << endl;
00816     vector<Double_t> bins;
00817     Double_t lowEdge = 0.0;
00818     Double_t highEdge = 200.0;
00819     Double_t binWidth = 0.5;
00820     for (Double_t binEdge = lowEdge;
00821          binEdge <= highEdge + (binWidth/2.0);
00822          binEdge += binWidth){
00823       bins.push_back(binEdge);
00824     }
00825     return bins;
00826   }
00827   else if (NuBinningScheme::kCC0325Std == binningScheme){
00828     MAXMSG("NuUtilities",Msg::kInfo,5)
00829       << "True energy: one bin from 0.0--0.5, "
00830       << "then 0.25 GeV bins up to 200.0 GeV"
00831       << endl;
00832     vector<Double_t> bins;
00833     bins.push_back(0.0);
00834     Double_t lowEdge = 0.5;
00835     Double_t highEdge = 200.0;
00836     Double_t binWidth = 0.25;
00837     for (Double_t binEdge = lowEdge;
00838          binEdge <= highEdge + (binWidth/2.0);
00839          binEdge += binWidth){
00840       bins.push_back(binEdge);
00841     }
00842     return bins;
00843   }
00844   else if (NuBinningScheme::kCC3flav == binningScheme) {
00845     MAXMSG("NuUtilities",Msg::kInfo,5)
00846       << "True Energy: 0.05 GeV up to 5 GeV, then 0.25 GeV up to 20 GeV; "
00847       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00848       << endl;
00849     vector<Double_t> bins;
00850     Double_t lowEdge = 0;
00851     Double_t highEdge = 0.5;
00852     Double_t binWidth = 0.05;
00853     for (Double_t binEdge = lowEdge;
00854           binEdge < highEdge -(binWidth/2.0);
00855           binEdge += binWidth) {
00856       bins.push_back(binEdge);
00857     }
00858     lowEdge = 0.5;
00859     highEdge = 5.0;
00860     binWidth = 0.05;
00861     for (Double_t binEdge = lowEdge;
00862           binEdge < highEdge -(binWidth/2.0);
00863           binEdge += binWidth) {
00864       bins.push_back(binEdge);
00865     }
00866     lowEdge = 5;
00867     highEdge = 20.0;
00868     binWidth = 0.25;
00869     for (Double_t binEdge = lowEdge;
00870           binEdge < highEdge -(binWidth/2.0);
00871           binEdge += binWidth) {
00872       bins.push_back(binEdge);
00873     }
00874     lowEdge = 20.0;
00875     highEdge = 30.0;
00876     binWidth = 1.0;
00877     for (Double_t binEdge = lowEdge;
00878           binEdge < highEdge -(binWidth/2.0);
00879           binEdge += binWidth) {
00880       bins.push_back(binEdge);
00881     }
00882     lowEdge = 30.0;
00883     highEdge = 50.0;
00884     binWidth = 2.0;
00885     for (Double_t binEdge = lowEdge;
00886           binEdge < highEdge -(binWidth/2.0);
00887           binEdge += binWidth) {
00888       bins.push_back(binEdge);
00889     }
00890     bins.push_back(50.0);
00891     bins.push_back(200.0);
00892     return bins;
00893   }
00894   else if (NuBinningScheme::kDisplayFD == binningScheme) {
00895     MAXMSG("NuUtilities",Msg::kInfo,5)
00896     << "True Energy: 4 GeV Bins up to 20 GeV, then 20, 30, 50, 200"
00897     << endl;
00898     vector<Double_t> bins;
00899     Double_t lowEdge = 0.0;
00900     Double_t highEdge = 20.0;
00901     Double_t binWidth = 4;
00902     for (Double_t binEdge = lowEdge;
00903          binEdge < highEdge -(binWidth/2.0);
00904          binEdge += binWidth) {
00905       bins.push_back(binEdge);
00906     }
00907     bins.push_back(20.0);
00908     bins.push_back(30.0);
00909     bins.push_back(50.0);
00910     bins.push_back(200.0);
00911     return bins;
00912   }
00913   else if (NuBinningScheme::kNuMuBar0325Std == binningScheme){
00914     MAXMSG("NuUtilities",Msg::kInfo,5)
00915       << "True energy: 0.5 GeV up to 30 GeV; 2 GeV up to 50 GeV; "
00916       << "1 bin up to 200 GeV"
00917       << endl;
00918     vector<Double_t> bins;
00919     Double_t lowEdge = 0.0;
00920     Double_t highEdge = 30.0;
00921     Double_t binWidth = 0.5;
00922     for (Double_t binEdge = lowEdge;
00923          binEdge < highEdge - (binWidth/2.0);
00924          binEdge += binWidth){
00925       bins.push_back(binEdge);
00926     }
00927     lowEdge = 30.0;
00928     highEdge = 50.0;
00929     binWidth = 2.0;
00930     for (Double_t binEdge = lowEdge;
00931          binEdge < highEdge - (binWidth/2.0);
00932          binEdge += binWidth){
00933       bins.push_back(binEdge);
00934     }
00935     bins.push_back(50.0);
00936     bins.push_back(200.0);
00937     return bins;
00938   }
00939   else if (NuBinningScheme::kNuMuBar0325Std2 == binningScheme) {
00940     MAXMSG("NuUtilities",Msg::kInfo,5)
00941       << "True Energy: One 0.5 GeV, then 0.25 GeV up to 20 GeV; "
00942       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00943       << endl;
00944     vector<Double_t> bins;
00945     bins.push_back(0.0);
00946     Double_t lowEdge = 0.5;
00947     Double_t highEdge = 20.0;
00948     Double_t binWidth = 0.25;
00949     for (Double_t binEdge = lowEdge;
00950           binEdge < highEdge -(binWidth/2.0);
00951           binEdge += binWidth) {
00952       bins.push_back(binEdge);
00953     }
00954     lowEdge = 20.0;
00955     highEdge = 30.0;
00956     binWidth = 1.0;
00957     for (Double_t binEdge = lowEdge;
00958           binEdge < highEdge -(binWidth/2.0);
00959           binEdge += binWidth) {
00960       bins.push_back(binEdge);
00961     }
00962     lowEdge = 30.0;
00963     highEdge = 50.0;
00964     binWidth = 2.0;
00965     for (Double_t binEdge = lowEdge;
00966           binEdge < highEdge -(binWidth/2.0);
00967           binEdge += binWidth) {
00968       bins.push_back(binEdge);
00969     }
00970     bins.push_back(50.0);
00971     bins.push_back(200.0);
00972     return bins;
00973   }
00974   else if (NuBinningScheme::kDisplayFD == binningScheme) {
00975     MAXMSG("NuUtilities",Msg::kInfo,5)
00976     << "True Energy: 4 GeV Bins up to 20 GeV, then 20, 30, 50, 200"
00977     << endl;
00978     vector<Double_t> bins;
00979     Double_t lowEdge = 0.0;
00980     Double_t highEdge = 20.0;
00981     Double_t binWidth = 4;
00982     for (Double_t binEdge = lowEdge;
00983          binEdge < highEdge -(binWidth/2.0);
00984          binEdge += binWidth) {
00985       bins.push_back(binEdge);
00986     }
00987     bins.push_back(20.0);
00988     bins.push_back(30.0);
00989     bins.push_back(50.0);
00990     bins.push_back(200.0);
00991     return bins;
00992   }
00993   else if (NuBinningScheme::kDisplayND == binningScheme) {
00994     MAXMSG("NuUtilities",Msg::kInfo,5)
00995     << "Reco Energy: 1 Gev to 30 GeV, 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00996     << endl;
00997     vector<Double_t> bins;
00998     Double_t lowEdge = 0.0;
00999     Double_t highEdge = 20.0;
01000     Double_t binWidth = 1.0;
01001     for (Double_t binEdge = lowEdge;
01002          binEdge < highEdge -(binWidth/2.0);
01003          binEdge += binWidth) {
01004       bins.push_back(binEdge);
01005     }
01006     lowEdge = 20.0;
01007     highEdge = 30.0;
01008     binWidth = 2.0;
01009     for (Double_t binEdge = lowEdge;
01010          binEdge < highEdge -(binWidth/2.0);
01011          binEdge += binWidth) {
01012       bins.push_back(binEdge);
01013     }
01014     lowEdge = 30.0;
01015     highEdge = 50.0;
01016     binWidth = 4.0;
01017     for (Double_t binEdge = lowEdge;
01018          binEdge < highEdge -(binWidth/2.0);
01019          binEdge += binWidth) {
01020       bins.push_back(binEdge);
01021     }
01022     bins.push_back(50.0);
01023     bins.push_back(200.0);
01024     return bins;
01025   } else if (NuBinningScheme::k0_1GeVTo20 == binningScheme) {
01026     MAXMSG("NuUtilities",Msg::kInfo,5)
01027       << "True Energy: 0.10 GeV up to 20 GeV; "
01028       << "1 Gev to 30 GeV, 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
01029       << endl;
01030     vector<Double_t> bins;
01031     Double_t lowEdge = 0.0;
01032     Double_t highEdge = 20.0;
01033     Double_t binWidth = 0.1;
01034     for (Double_t binEdge = lowEdge;
01035           binEdge < highEdge -(binWidth/2.0);
01036           binEdge += binWidth) {
01037       bins.push_back(binEdge);
01038     }
01039     lowEdge = 20.0;
01040     highEdge = 30.0;
01041     binWidth = 1.0;
01042     for (Double_t binEdge = lowEdge;
01043           binEdge < highEdge -(binWidth/2.0);
01044           binEdge += binWidth) {
01045       bins.push_back(binEdge);
01046     }
01047     lowEdge = 30.0;
01048     highEdge = 50.0;
01049     binWidth = 2.0;
01050     for (Double_t binEdge = lowEdge;
01051           binEdge < highEdge -(binWidth/2.0);
01052           binEdge += binWidth) {
01053       bins.push_back(binEdge);
01054     }
01055     bins.push_back(50.0);
01056     bins.push_back(200.0);
01057     return bins;
01058  } else {
01059     MAXMSG("NuUtilities",Msg::kInfo,100)
01060     << "!!Invalid binning scheme requested.!!" << endl
01061     << "Binning true energy in 0.5 GeV up to 200 GeV" << endl;
01062     vector<Double_t> bins;
01063     Double_t lowEdge = 0.0;
01064     Double_t highEdge = 200.0;
01065     Double_t binWidth = 0.5;
01066     for (Double_t binEdge = lowEdge;
01067          binEdge <= highEdge + (binWidth/2.0);
01068          binEdge += binWidth){
01069       bins.push_back(binEdge);
01070     }
01071     return bins;
01072   }
01073 }

static Double_t NuUtilities::ValueAt ( TH1 *  h,
Double_t  val 
) [inline, static]

Definition at line 64 of file NuUtilities.h.

Referenced by NuTransSME::Reweight(), and NuTransition::Reweight().

00065     {return h->GetBinContent(h->GetXaxis()->FindFixBin(val));};

void NuUtilities::WriteHistosToFile ( const std::pair< NuMatrixSpectrum, NuMatrixSpectrum > &  vHistos,
TFile &  file 
) [static]

Definition at line 1110 of file NuUtilities.cxx.

01112 {
01113   file.cd();
01114   vHistos.first.Spectrum()->Write();
01115   vHistos.second.Spectrum()->Write();
01116 }

void NuUtilities::WriteHistosToFile ( const std::vector< NuMatrixSpectrum > &  vHistos,
TFile &  file,
bool  Quiet = false 
) [static]

Definition at line 1093 of file NuUtilities.cxx.

01095 {
01096   file.cd();
01097   for (vector<NuMatrixSpectrum>::const_iterator it = vHistos.begin();
01098        it != vHistos.end();
01099        ++it){
01100     (*it).Spectrum()->Write();
01101     if(!Quiet) cout << "Written " << (*it).GetName() << endl;
01102   }
01103 
01104   cout << "Written " << vHistos.size() << " histograms to " 
01105        << file.GetName() << endl;
01106 
01107 }

void NuUtilities::WriteHistosToFile ( const std::vector< TH1D > &  vHistos,
TFile &  file,
bool  Quiet = false 
) [static]

Definition at line 1076 of file NuUtilities.cxx.

01078 {
01079   file.cd();
01080   for (vector<TH1D>::const_iterator it = vHistos.begin();
01081        it != vHistos.end();
01082        ++it){
01083     (*it).Write();
01084     if(!Quiet) cout << "Written " << (*it).GetName() << endl;
01085   }
01086 
01087   cout << "Written " << vHistos.size() << " histograms to " 
01088        << file.GetName() << endl;
01089 
01090 }


Member Data Documentation

VldTimeStamp NuUtilities::vtsRunIEnd [static]

Definition at line 100 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

VldTimeStamp NuUtilities::vtsRunIIEnd [static]

Definition at line 101 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

VldTimeStamp NuUtilities::vtsRunIIIEnd [static]

Definition at line 102 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

VldTimeStamp NuUtilities::vtsRunIVEnd [static]

Definition at line 103 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

VldTimeStamp NuUtilities::vtsRunIXEnd [static]

Definition at line 108 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

VldTimeStamp NuUtilities::vtsRunVEnd [static]

Definition at line 104 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

VldTimeStamp NuUtilities::vtsRunVIEnd [static]

Definition at line 105 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

VldTimeStamp NuUtilities::vtsRunVIIEnd [static]

Definition at line 106 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

VldTimeStamp NuUtilities::vtsRunVIIIEnd [static]

Definition at line 107 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

VldTimeStamp NuUtilities::vtsRunXEnd [static]

Definition at line 109 of file NuUtilities.h.

Referenced by NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().


The documentation for this class was generated from the following files:
Generated on Mon Sep 1 00:52:25 2014 for loon by  doxygen 1.4.7