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 46 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 1424 of file NuUtilities.cxx.

References CheckBinLimits().

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

01425 {
01426   if(h1->GetNbinsX() != h2->GetNbinsX() ||
01427      h1->GetNbinsY() != h2->GetNbinsY() ||
01428      h1->GetNbinsZ() != h2->GetNbinsZ())
01429     return false;
01430 
01431   if(h1->GetXaxis()->GetXmin() != h2->GetXaxis()->GetXmin() ||
01432      h1->GetXaxis()->GetXmax() != h2->GetXaxis()->GetXmax() ||
01433      h1->GetYaxis()->GetXmin() != h2->GetYaxis()->GetXmin() ||
01434      h1->GetYaxis()->GetXmax() != h2->GetYaxis()->GetXmax() ||
01435      h1->GetZaxis()->GetXmin() != h2->GetZaxis()->GetXmin() ||
01436      h1->GetZaxis()->GetXmax() != h2->GetZaxis()->GetXmax())
01437     return false;
01438 
01439   if(!CheckBinLimits(h1->GetXaxis()->GetXbins(), h2->GetXaxis()->GetXbins()) ||
01440      !CheckBinLimits(h1->GetYaxis()->GetXbins(), h2->GetYaxis()->GetXbins()) ||
01441      !CheckBinLimits(h1->GetZaxis()->GetXbins(), h2->GetZaxis()->GetXbins()))
01442     return false;
01443 
01444   return true;
01445 }

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::kL010z185i_rev, BeamType::kL010z185i_rev_i277, BeamType::kL010z185i_rev_i306, BeamType::kL010z185i_rev_i312, BeamType::kL010z185i_rev_i314, BeamType::kL010z185i_rev_i348, BeamType::kL010z185i_rev_i349, BeamType::kL010z185i_rev_i353, BeamType::kL250z200i, BeamType::kL250z200i_i100, BeamType::kL250z200i_i114, BeamType::kL250z200i_i130, BeamType::kL250z200i_i152, BeamType::kL250z200i_i165, BeamType::kL250z200i_i194, BeamType::kL250z200i_i232, BeamType::kM000z200i_i090, BeamType::kM000z200i_i250, BeamType::kM000z200i_i490, BeamType::kM000z200i_nova, 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   if(BeamType::kL010z185i_rev == originalBeamType){
00474     if(277 == intensity){
00475       return BeamType::kL010z185i_rev_i277;
00476     }
00477     else if(314 == intensity){
00478       return BeamType::kL010z185i_rev_i314;
00479     }
00480     else if(349 == intensity){
00481       return BeamType::kL010z185i_rev_i349;
00482     }
00483     else if(312 == intensity){
00484       return BeamType::kL010z185i_rev_i312;
00485     }
00486     else if(348 == intensity){
00487       return BeamType::kL010z185i_rev_i348;
00488     }
00489     else if(306 == intensity){
00490       return BeamType::kL010z185i_rev_i306;
00491     }
00492     else if(353 == intensity){
00493       return BeamType::kL010z185i_rev_i353;
00494     }
00495     else {
00496       MSG("NuUtilities",Msg::kWarning)
00497         << "Received an L010z185i_rev beam type with unrecognized intensity."
00498         << endl;
00499       return BeamType::kUnknown;
00500     }
00501   }
00502 
00503   if(BeamType::kM000z200i_nova == originalBeamType){
00504     if(90 == intensity){
00505       return BeamType::kM000z200i_i090;
00506     }
00507     else if(250 == intensity){
00508       return BeamType::kM000z200i_i250;
00509     }
00510     else if(490 == intensity){
00511       return BeamType::kM000z200i_i490;
00512     }
00513     else {
00514       MSG("NuUtilities",Msg::kWarning)
00515         << "Received an L010z185i_rev beam type with unrecognized intensity."
00516         << endl;
00517       return BeamType::kUnknown;
00518     }
00519   }
00520 
00521   MSG("NuUtilities",Msg::kWarning)
00522     << "Received a non-zero intensity flag, along with a beam "
00523     << "type not configured for intensity weighting."
00524     << endl;
00525   return BeamType::kUnknown;
00526 
00527 }

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

Definition at line 54 of file NuUtilities.h.

References Munits::km.

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

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

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

Definition at line 1257 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().

01258 {
01259   // Only need to fix dogwood NuEvent's
01260   if (!ReleaseType::IsDogwood(nu.recoVersion)) {
01261     MAXMSG("NuUtilities",Msg::kInfo,5) << "Not correcting q/p for "
01262     << PrintRelease(nu.recoVersion) << endl;
01263     return;
01264   }
01265   MAXMSG("NuUtilities",Msg::kInfo,5) << "Correcting "
01266   << PrintRelease(nu.recoVersion) << " q/p from "
01267   << nu.qp << " to " << nu.qp_rangebiased << endl;
01268 
01269   nu.qp = nu.qp_rangebiased;
01270   if (nu.sigqp == 0) nu.qp_sigqp = 0;
01271   else               nu.qp_sigqp = nu.qp_rangebiased / nu.sigqp;
01272 
01273   for(int trkIdx = 1; trkIdx <= 3; ++trkIdx){
01274     get_qp(nu, trkIdx) = get_qp_rangebiased(nu, trkIdx);
01275     if(get_sigqp(nu, trkIdx) != 0){
01276       get_qp_sigqp(nu, trkIdx) =
01277         get_qp_rangebiased(nu, trkIdx) / get_sigqp(nu, trkIdx);
01278     }
01279   }
01280 
01281   if (nu.qp_sigqp == 0) nu.sigqp_qp = 0;
01282   else                  nu.sigqp_qp = 1./nu.qp_sigqp;
01283 
01284   NuLibrary& lib=NuLibrary::Instance();
01285   lib.reco.GetEvtEnergy(nu, false);
01286 
01287   if (nu.qp_rangebiased > 0) nu.charge = 1;
01288   else                       nu.charge = -1;
01289 }

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

Definition at line 530 of file NuUtilities.cxx.

References Munits::g.

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

00531 {
00532     vector<Double_t> bins;
00533     for (int g = 0; g < ngroups; g++) {
00534         Double_t lowEdge = edges[g];
00535         Double_t highEdge = edges[g+1];
00536         Double_t binWidth = steps[g];
00537         for (Double_t binEdge = lowEdge;
00538              binEdge < highEdge - (binWidth/2.0);
00539              binEdge += binWidth){
00540             bins.push_back(binEdge);
00541         }
00542     }
00543     bins.push_back(edges[ngroups]);
00544     return bins;
00545 }

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

Definition at line 1355 of file NuUtilities.cxx.

Referenced by GetChisqFromSigma().

01356 {
01357 
01358   if(n<2) return 2*pow(TMath::ErfInverse(cl),2);
01359 
01360    // Create the function and wrap it
01361    TF1 f("C.L. from Chisq", "TMath::Gamma(0.5*[0],0.5*x)", 0, 2*n+50);
01362    f.SetParameter(0,n);
01363    f.SetNpx(4);
01364  
01365    return f.GetX(cl);
01366 
01367 }

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

Definition at line 1371 of file NuUtilities.cxx.

References GetChisqFromCL(), and Munits::s.

01372 {
01373 
01374   if(n<2) return s*s;
01375 
01376   double cl = TMath::Erf(s/sqrt(2));
01377   
01378   return GetChisqFromCL(cl,n);
01379 
01380 }

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

Definition at line 1402 of file NuUtilities.cxx.

Referenced by NuExtraction::ExtractCoilInfo().

01403 {
01404   int pow1 = static_cast<int>(TMath::Power(10, d));
01405   int pow2 = pow1 / 10;
01406   return (num % pow1 - num % pow2) / pow2;
01407 }

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

Definition at line 1293 of file NuUtilities.cxx.

References Munits::g.

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

01294 {
01295   std::vector<TString> fileList;
01296 
01297   glob_t g;
01298   glob(wildcardString.Data(),
01299        // GLOB_NOCHECK | // If no match return pattern
01300        GLOB_TILDE, // Expand ~'s
01301        0, &g);
01302   for(unsigned int i = 0; i < g.gl_pathc; ++i)
01303     fileList.push_back(g.gl_pathv[i]);
01304   globfree(&g);
01305 
01306   // glob output is sorted by default
01307 
01308   return fileList;
01309 }

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

Definition at line 1448 of file NuUtilities.cxx.

References Msg::kError, and MSG.

01449 {
01450   bool doY;
01451   if (axis == 'y' || axis == 'Y')  doY = true;
01452   else if (axis == 'x' || axis == 'X') doY = false;
01453   else {
01454     MSG("NuUtilities",Msg::kError) << "Axis " << axis << "not recognized. Only x, X, y, Y are allowed axes." << endl;
01455     TH1D blank;    return blank;
01456   }
01457 
01458   TH1D * marginSurf;
01459   TString name = surf->GetName();
01460 
01461   // Use root's built in projections to do the integrals, excluding Under/overflow
01462   if (doY) {
01463     marginSurf = surf->ProjectionY(name+"_intMarginY", 1, surf->GetNbinsX());
01464     marginSurf->Scale(1./surf->GetNbinsX());
01465   }
01466   else {
01467     marginSurf = surf->ProjectionX(name+"_intMarginX", 1, surf->GetNbinsY());
01468     marginSurf->Scale(1./surf->GetNbinsY());
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   double allMin = marginSurf->GetMinimum();
01475   for (int b = 0; b <= marginSurf->GetNbinsX()+1; b++) {
01476     double val = marginSurf->GetBinContent(b) - allMin;
01477     marginSurf->SetBinContent(b, val);
01478   }
01479 
01480   return *marginSurf;
01481 }

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

Definition at line 1312 of file NuUtilities.cxx.

References MuELoss::e.

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

01313 {
01314 
01315   if( isnan(mnu) || isnan(dnu) || dnu < 0 ){
01316     cout << "Error: MC or Data are not valid numbers!!!" << endl;
01317     return 1e12;
01318   }
01319 
01320   const Double_t MCError = 1e-12;
01321   if (dnu) {
01322     // Protection against cases where there is data but no MC?
01323     // This should not normally be possible, other than highly contrived
01324     // unphysical oscillation values.
01325     // Set the value to something lower than POT_Data / POT_MC, which at the
01326     // moment is usually 1e-3. We can justify this as an error on the MC
01327     // Set to a 2nd order expansion around MCError.
01328     // Also protects against negative MC events
01329 
01330     if (mnu < MCError){
01331       //cout << "MC Error: MC = " << mnu << endl;
01332       return 2*(mnu-dnu+dnu*log(dnu/MCError)) + dnu*(3-4*mnu/MCError+pow(mnu/MCError,2));
01333     }
01334 
01335     // We have both values. Do the proper lnL!
01336     return 2*(mnu - dnu + dnu*log(dnu/mnu));
01337   }
01338   else {
01339     // dnu is zero, mnu may or may not be zero
01340     // Protect against negative numbers by setting to a
01341     // quadratic function that matches Loglikelihood up
01342     // to 1st order at MCError and has minimum at mnu=0
01343 
01344     if (mnu < MCError){
01345       //cout << "MC Error: MC = " << mnu << endl;
01346       return mnu*mnu/MCError + MCError;
01347     }
01348 
01349     return 2*mnu;
01350   }
01351 }

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

Definition at line 1485 of file NuUtilities.cxx.

References Msg::kError, min, and MSG.

01486 {
01487   bool doY;
01488   if (axis == 'y' || axis == 'Y')  doY = true;
01489   else if (axis == 'x' || axis == 'X') doY = false;
01490   else {
01491     MSG("NuUtilities",Msg::kError) << "Axis " << axis << "not recognized. Only x, X, y, Y are allowed axes." << endl;
01492     TH1D blank;    return blank;
01493   }
01494 
01495   TH1D * marginSurf;
01496   TString name = surf->GetName();
01497 
01498   int bKeepMax;
01499   int bMargMax;
01500   // Use root's built in projections to define the axis ranges, reset contents
01501   if (doY) {
01502     marginSurf = surf->ProjectionY(name+"_minMarginY", 1, surf->GetNbinsX());
01503     bKeepMax = surf->GetNbinsY(); // Keep Y
01504     bMargMax = surf->GetNbinsX(); // Marginalize X
01505   }
01506   else {
01507     marginSurf = surf->ProjectionX(name+"_minMarginX", 1, surf->GetNbinsY());
01508     bKeepMax = surf->GetNbinsX(); // Keep X
01509     bMargMax = surf->GetNbinsY(); // Marginalize Y
01510   }
01511   marginSurf->Reset();
01512 
01513   double allMin = 1.e10;
01514   double rowMin;
01515   int bx, by;
01516   for (int bk = 1; bk < bKeepMax; bk++) {
01517     rowMin = 1.e10;
01518     for (int bm = 1; bm < bMargMax; bm++) {
01519       if (doY) {
01520         bx = bm; // Marginalize X
01521         by = bk; // Keep Y
01522       }
01523       else {
01524         bx = bk; // Keep X
01525         by = bm; // Marginalize Y
01526       }
01527       rowMin = min(surf->GetBinContent(bx, by), rowMin);
01528       allMin = min(rowMin, allMin);
01529     }
01530     marginSurf->SetBinContent(bk, rowMin);
01531   }
01532 
01533   // Subtract off the minimum bin to get a deltaChisquared
01534   // Not *exactly* correct but should be pretty close in bins are
01535   // relatively small
01536   for (int bk = 1; bk < bKeepMax; bk++) {
01537     double val = marginSurf->GetBinContent(bk) - allMin;
01538     marginSurf->SetBinContent(bk, val);
01539   }
01540 
01541   return *marginSurf;
01542 }

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

Definition at line 1383 of file NuUtilities.cxx.

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

01384 {
01385   const int Nx = h->GetNbinsX();
01386   const int Ny = h->GetNbinsY();
01387 
01388   TH1D one("", "", Nx, h->GetXaxis()->GetXbins()->GetArray());
01389   for(int n = 0; n < Nx+2; ++n) one.SetBinContent(n, 1);
01390 
01391   NuMatrixSpectrum osc(one);
01392   osc.Oscillate(dm2, sn2);
01393 
01394   for(int x = 0; x < Nx+2; ++x){
01395     for(int y = 0; y < Ny+2; ++y){
01396       h->SetBinContent(x, y, h->GetBinContent(x, y)*osc.Spectrum()->GetBinContent(x));
01397     }
01398   }
01399 }

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 1678 of file NuUtilities.cxx.

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

Referenced by NuFCEventManager::AddFile(), FeldmanSterile::CalculateChi2Best2D(), 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().

01679 {
01680   Int_t nEntries = (Int_t)nEntriesF;
01681 
01682   // Are we streaming to a file? If so, show the old style
01683   struct stat buf;
01684   fstat(fileno(stdout), &buf);
01685   // Check if we are a file, or a pipe (i.e. in case the user tees)
01686   const bool isFile = buf.st_mode & (S_IFREG | S_IFIFO) ;
01687   if (isFile) {
01688     Float_t fract = ceil(nEntries/20.);
01689     if (ceil(((Float_t)entry)/fract)==((Float_t)entry)/fract)
01690     {
01691         MSG("NuUtilities",Msg::kInfo)
01692           <<"Fraction of loop complete: "<<entry
01693           <<"/"<<nEntries<<"  ("
01694           <<(Int_t)(100.*entry/nEntries)<<"%)"<<endl;
01695     }
01696     return;
01697   }
01698 
01699 
01700   // How wide should we make the progress bar?
01701   const Int_t width = 70;
01702   // How long is the string for entries?
01703   static Int_t countlen = -1;
01704   // How long is our progress bar?
01705   static Int_t barlen = -1;
01706   // The entry number of the next bar entry
01707   static Int_t nextbar = -1;
01708   // When did we start?
01709   static time_t starttime = 0;
01710   // when do we next update?
01711   static time_t nextupdate = 0;
01712   // If we are processing the first entry, reset everything
01713   if (entry <= 1)
01714   {
01715     // Get the new length of the entry string
01716     countlen = (Int_t)TMath::Ceil(TMath::Log10(nEntries)) + 1;
01717     nextbar = -1;
01718     starttime = time(NULL);
01719 
01720     barlen = width - 14 - countlen*2 - 1;
01721 
01722     // Don't update until we get to the minimum time
01723     nextupdate = starttime + mintime;
01724   }
01725 
01726   // Check here to see if we should update; otherwise, return
01727   // Check to see if the bar would update
01728   // or, alternatively, it is time to refresh.
01729   if ((time(NULL) < nextupdate) && (entry < nextbar || (nextbar == -1)))return;
01730   nextupdate = time(NULL) + 10;
01731 
01732   // Because this is used in several places, make it here
01733   Float_t frac = (Float_t)entry / (Float_t)nEntries;
01734 
01735   // Prepare the progress bar string
01736   TString bar;
01737   if (entry <= nEntries)
01738   {
01739     // Work out how many characters we are in
01740     Int_t numeq = TMath::FloorNint(frac*barlen);
01741 
01742     // Work out when the next bar will occur
01743     nextbar = (Int_t)((Float_t)(numeq+1)/(Float_t)barlen*nEntries);
01744     //cout << "Next bar at: " << nextbar << "        " << endl;
01745     bar = TString('=', numeq);
01746     bar += TString(' ', barlen - numeq);
01747   } else if (entry > nEntries) {
01748     // We have gone over. Oh no!
01749     bar = TString('+', barlen);
01750   } else if (entry < 0) {
01751     // Somehow, we are below zero. Handle it nonetheless
01752     bar = TString('-', barlen);
01753   }
01754 
01755 
01756   // Prepare the ETA
01757   Float_t elapsed_time = (Float_t)(time(NULL) - starttime);
01758   Float_t time_left = -60;
01759   if (frac > 1e-6) {
01760     time_left = (elapsed_time / frac) - elapsed_time;
01761   }
01762   Int_t mins, seconds;
01763   mins    = (Int_t)TMath::Floor(time_left / 60.0f);
01764   seconds = (Int_t)TMath::Floor(time_left - (Float_t)(mins*60.0f));
01765   // TString ETA;
01766   ostringstream ETA;
01767 
01768   ETA << "ETA ";
01769   if ((mins < 0 || seconds < 0) || (mins == 0 && seconds == 0)) {
01770     ETA << "--:--";
01771   } else {
01772     ETA << setfill('0') << setw(2) << mins << ":" << setw(2) << seconds;
01773   }
01774 
01775   cout << " Progress: [" << bar << "] "
01776        << setw(countlen) << entry << "/" << nEntries
01777        << " " << ETA.str()
01778        << '\r'
01779        << flush;
01780   // Move to the next line, if this is the final entry!
01781   if (entry == nEntries) {
01782     cout << endl;
01783   }
01784 }

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

Definition at line 1250 of file NuUtilities.cxx.

References RebinHistogram(), and RecoBins().

01251 {
01252   vector<Double_t> bins = RecoBins(scheme);
01253   return RebinHistogram(old, bins);
01254 }

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

Definition at line 1244 of file NuUtilities.cxx.

References RebinHistogram().

01245 {
01246   return RebinHistogram(old, bins.size()-1, &(bins[0]));
01247 }

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

Definition at line 1182 of file NuUtilities.cxx.

References count, and MuELoss::e.

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

01183 {
01184   static int count = 0;
01185   TString scount = "";
01186   scount += count++;
01187 
01188   TH1D* newh = new TH1D(old->GetName() + TString("_rebin") + scount, 
01189                         old->GetTitle(), nbins, binedges);
01190   bool ouwarn = true;
01191 
01192   // Floating point comparisons of bin edges don't go well otherwise
01193   const double epsilon = 1e-10;
01194 
01195   // Now, loop over the old histogram and fill the new one
01196   for(Int_t bin = 1; bin <= old->GetNbinsX(); bin++) {
01197 
01198     double oldCent = old->GetBinCenter(bin);
01199     int newbin = newh->GetXaxis()->FindFixBin(oldCent);
01200 
01201     // Make sure that bins do not cross boundaries.
01202     if (newbin > newh->GetNbinsX() || newbin == 0) {
01203       if (ouwarn) {
01204         cout << "Old bin: " << old->GetBinLowEdge(bin) << " - " << old->GetBinLowEdge(bin+1)
01205         << " and maybe others have become under/overflow" << endl;
01206         ouwarn = false;
01207       }
01208     } else if ( old->GetBinLowEdge(bin) + epsilon < newh->GetBinLowEdge(newbin) ||
01209                 old->GetBinLowEdge(bin + 1) > newh->GetBinLowEdge(newbin + 1) + epsilon) {
01210       cout << "Bin edge conflict in bin no's " << bin << ", " << newbin 
01211            << ".  No rebinning performed."
01212            << "  old bin: " << old->GetBinLowEdge(bin) << " - " << old->GetBinLowEdge(bin + 1)
01213            << ", new bin: " << newh->GetBinLowEdge(newbin) << " - " 
01214            << newh->GetBinLowEdge(newbin + 1)
01215            << endl;
01216       TH1D* old_ret = new TH1D(*old);
01217       return old_ret;
01218     }
01219 
01220     double oldCon = old->GetBinContent(bin);
01221     double oldErr = old->GetBinError(bin);
01222     double newCon = newh->GetBinContent(newbin);
01223     double newErr = newh->GetBinError(newbin);
01224 
01225     newCon += oldCon;
01226     newErr = sqrt(newErr*newErr + oldErr*oldErr);
01227     newh->SetBinContent(newbin, newCon);
01228     newh->SetBinError(newbin, newErr);
01229   }
01230 
01231   // Validate
01232   double oldint = old->Integral();
01233   double newint = newh->Integral() + newh->GetBinContent(0)
01234                  + newh->GetBinContent(newh->GetNbinsX()+1);
01235   if (abs(oldint - newint) > 1e-5) {
01236     cout << "Rebinning report: " << oldint << " entries have become " << newint << " events" << endl;
01237   }
01238   //newh->Sumw2();
01239   return newh;
01240 }

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

Definition at line 550 of file NuUtilities.cxx.

References GenerateBins(), NuBinningScheme::k0_1GeVTo20, NuBinningScheme::k0_5GeVTo200, NuBinningScheme::kCC0325Std, NuBinningScheme::kCC3flav, NuBinningScheme::kDisplay1GevTo20, NuBinningScheme::kDisplayFD, NuBinningScheme::kDisplayFD2010, NuBinningScheme::kDisplayFD2014, 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().

00551 {
00552   if (NuBinningScheme::kUnknown == binningScheme ||
00553       NuBinningScheme::k0_5GeVTo200 == binningScheme){
00554     MAXMSG("NuUtilities",Msg::kInfo,5)
00555       << "Binning reco energy in 0.5 GeV up to 200 GeV" << endl;
00556     vector<Double_t> bins;
00557     Double_t lowEdge = 0.0;
00558     Double_t highEdge = 200.0;
00559     Double_t binWidth = 0.5;
00560     for (Double_t binEdge = lowEdge;
00561          binEdge <= highEdge + (binWidth/2.0);
00562          binEdge += binWidth){
00563       bins.push_back(binEdge);
00564     }
00565     return bins;
00566   } else if (NuBinningScheme::kCC0325Std == binningScheme) {
00567     MAXMSG("NuUtilities",Msg::kInfo,5)
00568       << "Reco energy: one bin from 0.0--0.5, "
00569       << "then 0.25 GeV bins up to 200.0 GeV"
00570       << endl;
00571     vector<Double_t> bins;
00572     bins.push_back(0.0);
00573     Double_t lowEdge = 0.5;
00574     Double_t highEdge = 200.0;
00575     Double_t binWidth = 0.25;
00576     for (Double_t binEdge = lowEdge;
00577          binEdge <= highEdge + (binWidth/2.0);
00578          binEdge += binWidth){
00579       bins.push_back(binEdge);
00580     }
00581     return bins;
00582   } else if (NuBinningScheme::kNuMuBar0325Std == binningScheme) {
00583     MAXMSG("NuUtilities",Msg::kInfo,5)
00584       << "Reco energy: 0.5 GeV up to 30 GeV; 2 GeV up to 50 GeV; "
00585       << "1 bin up to 200 GeV"
00586       << endl;
00587     vector<Double_t> bins;
00588     Double_t lowEdge = 0.0;
00589     Double_t highEdge = 30.0;
00590     Double_t binWidth = 0.5;
00591     for (Double_t binEdge = lowEdge;
00592          binEdge < highEdge - (binWidth/2.0);
00593          binEdge += binWidth){
00594       bins.push_back(binEdge);
00595     }
00596     lowEdge = 30.0;
00597     highEdge = 50.0;
00598     binWidth = 2.0;
00599     for (Double_t binEdge = lowEdge;
00600          binEdge < highEdge - (binWidth/2.0);
00601          binEdge += binWidth){
00602       bins.push_back(binEdge);
00603     }
00604     bins.push_back(50.0);
00605     bins.push_back(200.0);
00606     return bins;
00607   } else if (NuBinningScheme::kNuMuBar0325Std2 == binningScheme) {
00608     MAXMSG("NuUtilities",Msg::kInfo,5)
00609       << "Reco Energy: One 0.5 GeV, then 0.25 GeV up to 20 GeV; "
00610       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00611       << endl;
00612     vector<Double_t> bins;
00613     bins.push_back(0.0);
00614     Double_t lowEdge = 0.5;
00615     Double_t highEdge = 20.0;
00616     Double_t binWidth = 0.25;
00617     for (Double_t binEdge = lowEdge;
00618           binEdge < highEdge -(binWidth/2.0);
00619           binEdge += binWidth) {
00620       bins.push_back(binEdge);
00621     }
00622     lowEdge = 20.0;
00623     highEdge = 30.0;
00624     binWidth = 1.0;
00625     for (Double_t binEdge = lowEdge;
00626           binEdge < highEdge -(binWidth/2.0);
00627           binEdge += binWidth) {
00628       bins.push_back(binEdge);
00629     }
00630     lowEdge = 30.0;
00631     highEdge = 50.0;
00632     binWidth = 2.0;
00633     for (Double_t binEdge = lowEdge;
00634           binEdge < highEdge -(binWidth/2.0);
00635           binEdge += binWidth) {
00636       bins.push_back(binEdge);
00637     }
00638     bins.push_back(50.0);
00639     bins.push_back(200.0);
00640     return bins;
00641   } else if (NuBinningScheme::kCC3flav == binningScheme) {
00642     MAXMSG("NuUtilities",Msg::kInfo,5)
00643       << "Reco Energy: One 1.0 GeV, then 0.25 GeV up to 20 GeV; "
00644       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00645       << endl;
00646     vector<Double_t> bins;
00647     bins.push_back(0.0);
00648     Double_t lowEdge = 1.0;
00649     Double_t highEdge = 20.0;
00650     Double_t binWidth = 0.25;
00651     for (Double_t binEdge = lowEdge;
00652           binEdge < highEdge -(binWidth/2.0);
00653           binEdge += binWidth) {
00654       bins.push_back(binEdge);
00655     }
00656     lowEdge = 20.0;
00657     highEdge = 30.0;
00658     binWidth = 1.0;
00659     for (Double_t binEdge = lowEdge;
00660           binEdge < highEdge -(binWidth/2.0);
00661           binEdge += binWidth) {
00662       bins.push_back(binEdge);
00663     }
00664     lowEdge = 30.0;
00665     highEdge = 50.0;
00666     binWidth = 2.0;
00667     for (Double_t binEdge = lowEdge;
00668           binEdge < highEdge -(binWidth/2.0);
00669           binEdge += binWidth) {
00670       bins.push_back(binEdge);
00671     }
00672     bins.push_back(50.0);
00673     bins.push_back(200.0);
00674     return bins;
00675   }else if (NuBinningScheme::kSterile == binningScheme) { //A.Devan 8/29/2012
00676     MAXMSG("NuUtilities",Msg::kInfo,5)
00677       << "Reco Energy: 0.05GeV bin between 0 and 5 GeV, then 0.25 GeV up to 20 GeV; "
00678       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00679       << endl;
00680     vector<Double_t> bins;
00681     bins.push_back(0.0);
00682         Double_t lowEdge = 0.05;
00683         Double_t highEdge = 5.0;
00684         Double_t binWidth = 0.05;
00685         for (Double_t binEdge = lowEdge;
00686                   binEdge < highEdge - (binWidth/2.0);
00687                   binEdge += binWidth) {
00688           bins.push_back(binEdge);
00689         }
00690         lowEdge = 5.0;
00691     highEdge = 20.0;
00692     binWidth = 0.25;
00693     for (Double_t binEdge = lowEdge;
00694           binEdge < highEdge -(binWidth/2.0);
00695           binEdge += binWidth) {
00696       bins.push_back(binEdge);
00697     }
00698     lowEdge = 20.0;
00699     highEdge = 30.0;
00700     binWidth = 1.0;
00701     for (Double_t binEdge = lowEdge;
00702           binEdge < highEdge -(binWidth/2.0);
00703           binEdge += binWidth) {
00704       bins.push_back(binEdge);
00705     }
00706     lowEdge = 30.0;
00707     highEdge = 50.0;
00708     binWidth = 2.0;
00709     for (Double_t binEdge = lowEdge;
00710           binEdge < highEdge -(binWidth/2.0);
00711           binEdge += binWidth) {
00712       bins.push_back(binEdge);
00713     }
00714     bins.push_back(50.0);
00715     bins.push_back(200.0);
00716     return bins;
00717   } else if (NuBinningScheme::kDisplayFD == binningScheme) {
00718     MAXMSG("NuUtilities",Msg::kInfo,5)
00719     << "Reco Energy: 4 GeV Bins up to 20 GeV, then 20, 30, 50, 200"
00720     << endl;
00721     vector<Double_t> bins;
00722     Double_t lowEdge = 0.0;
00723     Double_t highEdge = 20.0;
00724     Double_t binWidth = 4;
00725     for (Double_t binEdge = lowEdge;
00726          binEdge < highEdge -(binWidth/2.0);
00727          binEdge += binWidth) {
00728       bins.push_back(binEdge);
00729     }
00730     bins.push_back(20.0);
00731     bins.push_back(30.0);
00732     bins.push_back(50.0);
00733     bins.push_back(200.0);
00734     return bins;
00735   } else if (NuBinningScheme::kDisplayND == binningScheme) {
00736     MAXMSG("NuUtilities",Msg::kInfo,5)
00737     << "Reco Energy: 1 Gev to 30 GeV, 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00738     << endl;
00739     vector<Double_t> bins;
00740     Double_t lowEdge = 0.0;
00741     Double_t highEdge = 20.0;
00742     Double_t binWidth = 1.0;
00743     for (Double_t binEdge = lowEdge;
00744          binEdge < highEdge -(binWidth/2.0);
00745          binEdge += binWidth) {
00746       bins.push_back(binEdge);
00747     }
00748     lowEdge = 20.0;
00749     highEdge = 30.0;
00750     binWidth = 2.0;
00751     for (Double_t binEdge = lowEdge;
00752          binEdge < highEdge -(binWidth/2.0);
00753          binEdge += binWidth) {
00754       bins.push_back(binEdge);
00755     }
00756     lowEdge = 30.0;
00757     highEdge = 50.0;
00758     binWidth = 4.0;
00759     for (Double_t binEdge = lowEdge;
00760          binEdge < highEdge -(binWidth/2.0);
00761          binEdge += binWidth) {
00762       bins.push_back(binEdge);
00763     }
00764     bins.push_back(50.0);
00765     bins.push_back(200.0);
00766     return bins;
00767   } else if (NuBinningScheme::kDisplayFDRHC == binningScheme) {
00768       double edges[] = {0, 10, 20, 30,  50, 200};
00769       double steps[] = {  1, 5, 10, 20, 150};
00770       int ng = 5;
00771 
00772       std::vector<Double_t> bins = NuUtilities::GenerateBins(ng, edges, steps);
00773       return bins;
00774   } else if(NuBinningScheme::kDisplayFD2010 == binningScheme){
00775     double edges[] = {0, 1, 5, 10, 20, 30, 50, 200};
00776     double steps[] = {1/*.5*/, .25, .5, 1, 10, 20, 130};
00777     int ng = 7;
00778 
00779     vector<double> bins = NuUtilities::GenerateBins(ng, edges, steps);
00780     return bins;
00781   } else if(NuBinningScheme::kDisplayFD2014 == binningScheme){
00782     double edges[] = {0, 1.5, 10, 20, 30, 50, 200};
00783     double steps[] = {1.5, 0.5, 2, 10, 20, 130};
00784     int ng = 6;
00785 
00786     vector<double> bins = NuUtilities::GenerateBins(ng, edges, steps);
00787     return bins;
00788   } else if(NuBinningScheme::kDisplayFD2014 == binningScheme){
00789     double edges[] = {0, 1.5, 10, 20, 30, 50, 200};
00790     double steps[] = {1.5, 0.5, 2, 10, 20, 130};
00791     int ng = 6;
00792 
00793     vector<double> bins = NuUtilities::GenerateBins(ng, edges, steps);
00794     return bins;
00795   } else if(NuBinningScheme::kDisplayFD7e20 == binningScheme){
00796       double edges[] = {0, 20, 30, 50, 200};
00797       double steps[] = {  2, 5, 20, 150};
00798       int ng = 4;
00799 
00800     vector<double> bins = NuUtilities::GenerateBins(ng, edges, steps);
00801     return bins;
00802   } else if(NuBinningScheme::kDisplay1GevTo20 == binningScheme) {
00803     MAXMSG("NuUtilities", Msg::kInfo, 5)
00804     << "Reco Energy: 0 Gev to 20 GeV in 1 GeV bins, plus a single 20--200 GeV bin"
00805     << endl;
00806     vector<Double_t> bins;
00807     Double_t lowEdge = 0.0;
00808     Double_t highEdge = 20.0;
00809     Double_t binWidth = 1.0;
00810     for (Double_t binEdge = lowEdge;
00811          binEdge < highEdge - (binWidth / 2.0);
00812          binEdge += binWidth) {
00813       bins.push_back(binEdge);
00814     }
00815     bins.push_back(20.0);
00816     bins.push_back(50.0);
00817     bins.push_back(200.0);
00818 
00819     return bins;
00820   } else if (NuBinningScheme::k0_1GeVTo20 == binningScheme) {
00821     MAXMSG("NuUtilities",Msg::kInfo,5)
00822       << "Reco Energy: 0.10 GeV up to 20 GeV; "
00823       << "1 Gev to 30 GeV, 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00824       << endl;
00825     vector<Double_t> bins;
00826     Double_t lowEdge = 0.0;
00827     Double_t highEdge = 20.0;
00828     Double_t binWidth = 0.1;
00829     for (Double_t binEdge = lowEdge;
00830           binEdge < highEdge -(binWidth/2.0);
00831           binEdge += binWidth) {
00832       bins.push_back(binEdge);
00833     }
00834     lowEdge = 20.0;
00835     highEdge = 30.0;
00836     binWidth = 1.0;
00837     for (Double_t binEdge = lowEdge;
00838           binEdge < highEdge -(binWidth/2.0);
00839           binEdge += binWidth) {
00840       bins.push_back(binEdge);
00841     }
00842     lowEdge = 30.0;
00843     highEdge = 50.0;
00844     binWidth = 2.0;
00845     for (Double_t binEdge = lowEdge;
00846           binEdge < highEdge -(binWidth/2.0);
00847           binEdge += binWidth) {
00848       bins.push_back(binEdge);
00849     }
00850     bins.push_back(50.0);
00851     bins.push_back(200.0);
00852     return bins;
00853   } else {
00854     MAXMSG("NuUtilities",Msg::kInfo,100)
00855     << "!!Invalid binning scheme (" << binningScheme << ") requested.!!" << endl
00856     << "Binning reco energy in 0.5 GeV up to 200 GeV" << endl;
00857     vector<Double_t> bins;
00858     Double_t lowEdge = 0.0;
00859     Double_t highEdge = 200.0;
00860     Double_t binWidth = 0.5;
00861     for (Double_t binEdge = lowEdge;
00862          binEdge <= highEdge + (binWidth/2.0);
00863          binEdge += binWidth){
00864       bins.push_back(binEdge);
00865     }
00866     return bins;
00867   }
00868 } // 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 872 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().

00873 {
00874   if (NuBinningScheme::kUnknown == binningScheme ||
00875       NuBinningScheme::k0_5GeVTo200 == binningScheme){
00876     MAXMSG("NuUtilities",Msg::kInfo,5)
00877       << "Binning true energy in 0.5 GeV up to 200 GeV" << endl;
00878     vector<Double_t> bins;
00879     Double_t lowEdge = 0.0;
00880     Double_t highEdge = 200.0;
00881     Double_t binWidth = 0.5;
00882     for (Double_t binEdge = lowEdge;
00883          binEdge <= highEdge + (binWidth/2.0);
00884          binEdge += binWidth){
00885       bins.push_back(binEdge);
00886     }
00887     return bins;
00888   }
00889   else if (NuBinningScheme::kCC0325Std == binningScheme){
00890     MAXMSG("NuUtilities",Msg::kInfo,5)
00891       << "True energy: one bin from 0.0--0.5, "
00892       << "then 0.25 GeV bins up to 200.0 GeV"
00893       << endl;
00894     vector<Double_t> bins;
00895     bins.push_back(0.0);
00896     Double_t lowEdge = 0.5;
00897     Double_t highEdge = 200.0;
00898     Double_t binWidth = 0.25;
00899     for (Double_t binEdge = lowEdge;
00900          binEdge <= highEdge + (binWidth/2.0);
00901          binEdge += binWidth){
00902       bins.push_back(binEdge);
00903     }
00904     return bins;
00905   }
00906   else if (NuBinningScheme::kCC3flav == binningScheme) {
00907     MAXMSG("NuUtilities",Msg::kInfo,5)
00908       << "True Energy: 0.05 GeV up to 5 GeV, then 0.25 GeV up to 20 GeV; "
00909       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
00910       << endl;
00911     vector<Double_t> bins;
00912     Double_t lowEdge = 0;
00913     Double_t highEdge = 0.5;
00914     Double_t binWidth = 0.05;
00915     for (Double_t binEdge = lowEdge;
00916           binEdge < highEdge -(binWidth/2.0);
00917           binEdge += binWidth) {
00918       bins.push_back(binEdge);
00919     }
00920     lowEdge = 0.5;
00921     highEdge = 5.0;
00922     binWidth = 0.05;
00923     for (Double_t binEdge = lowEdge;
00924           binEdge < highEdge -(binWidth/2.0);
00925           binEdge += binWidth) {
00926       bins.push_back(binEdge);
00927     }
00928     lowEdge = 5;
00929     highEdge = 20.0;
00930     binWidth = 0.25;
00931     for (Double_t binEdge = lowEdge;
00932           binEdge < highEdge -(binWidth/2.0);
00933           binEdge += binWidth) {
00934       bins.push_back(binEdge);
00935     }
00936     lowEdge = 20.0;
00937     highEdge = 30.0;
00938     binWidth = 1.0;
00939     for (Double_t binEdge = lowEdge;
00940           binEdge < highEdge -(binWidth/2.0);
00941           binEdge += binWidth) {
00942       bins.push_back(binEdge);
00943     }
00944     lowEdge = 30.0;
00945     highEdge = 50.0;
00946     binWidth = 2.0;
00947     for (Double_t binEdge = lowEdge;
00948           binEdge < highEdge -(binWidth/2.0);
00949           binEdge += binWidth) {
00950       bins.push_back(binEdge);
00951     }
00952     bins.push_back(50.0);
00953     bins.push_back(200.0);
00954     return bins;
00955   }
00956   else if (NuBinningScheme::kDisplayFD == binningScheme) {
00957     MAXMSG("NuUtilities",Msg::kInfo,5)
00958     << "True Energy: 4 GeV Bins up to 20 GeV, then 20, 30, 50, 200"
00959     << endl;
00960     vector<Double_t> bins;
00961     Double_t lowEdge = 0.0;
00962     Double_t highEdge = 20.0;
00963     Double_t binWidth = 4;
00964     for (Double_t binEdge = lowEdge;
00965          binEdge < highEdge -(binWidth/2.0);
00966          binEdge += binWidth) {
00967       bins.push_back(binEdge);
00968     }
00969     bins.push_back(20.0);
00970     bins.push_back(30.0);
00971     bins.push_back(50.0);
00972     bins.push_back(200.0);
00973     return bins;
00974   }
00975   else if (NuBinningScheme::kNuMuBar0325Std == binningScheme){
00976     MAXMSG("NuUtilities",Msg::kInfo,5)
00977       << "True energy: 0.5 GeV up to 30 GeV; 2 GeV up to 50 GeV; "
00978       << "1 bin up to 200 GeV"
00979       << endl;
00980     vector<Double_t> bins;
00981     Double_t lowEdge = 0.0;
00982     Double_t highEdge = 30.0;
00983     Double_t binWidth = 0.5;
00984     for (Double_t binEdge = lowEdge;
00985          binEdge < highEdge - (binWidth/2.0);
00986          binEdge += binWidth){
00987       bins.push_back(binEdge);
00988     }
00989     lowEdge = 30.0;
00990     highEdge = 50.0;
00991     binWidth = 2.0;
00992     for (Double_t binEdge = lowEdge;
00993          binEdge < highEdge - (binWidth/2.0);
00994          binEdge += binWidth){
00995       bins.push_back(binEdge);
00996     }
00997     bins.push_back(50.0);
00998     bins.push_back(200.0);
00999     return bins;
01000   }
01001   else if (NuBinningScheme::kNuMuBar0325Std2 == binningScheme) {
01002     MAXMSG("NuUtilities",Msg::kInfo,5)
01003       << "True Energy: One 0.5 GeV, then 0.25 GeV up to 20 GeV; "
01004       << "1 Gev to 30 GeV,\n 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
01005       << endl;
01006     vector<Double_t> bins;
01007     bins.push_back(0.0);
01008     Double_t lowEdge = 0.5;
01009     Double_t highEdge = 20.0;
01010     Double_t binWidth = 0.25;
01011     for (Double_t binEdge = lowEdge;
01012           binEdge < highEdge -(binWidth/2.0);
01013           binEdge += binWidth) {
01014       bins.push_back(binEdge);
01015     }
01016     lowEdge = 20.0;
01017     highEdge = 30.0;
01018     binWidth = 1.0;
01019     for (Double_t binEdge = lowEdge;
01020           binEdge < highEdge -(binWidth/2.0);
01021           binEdge += binWidth) {
01022       bins.push_back(binEdge);
01023     }
01024     lowEdge = 30.0;
01025     highEdge = 50.0;
01026     binWidth = 2.0;
01027     for (Double_t binEdge = lowEdge;
01028           binEdge < highEdge -(binWidth/2.0);
01029           binEdge += binWidth) {
01030       bins.push_back(binEdge);
01031     }
01032     bins.push_back(50.0);
01033     bins.push_back(200.0);
01034     return bins;
01035   }
01036   else if (NuBinningScheme::kDisplayFD == binningScheme) {
01037     MAXMSG("NuUtilities",Msg::kInfo,5)
01038     << "True Energy: 4 GeV Bins up to 20 GeV, then 20, 30, 50, 200"
01039     << endl;
01040     vector<Double_t> bins;
01041     Double_t lowEdge = 0.0;
01042     Double_t highEdge = 20.0;
01043     Double_t binWidth = 4;
01044     for (Double_t binEdge = lowEdge;
01045          binEdge < highEdge -(binWidth/2.0);
01046          binEdge += binWidth) {
01047       bins.push_back(binEdge);
01048     }
01049     bins.push_back(20.0);
01050     bins.push_back(30.0);
01051     bins.push_back(50.0);
01052     bins.push_back(200.0);
01053     return bins;
01054   }
01055   else if (NuBinningScheme::kDisplayND == binningScheme) {
01056     MAXMSG("NuUtilities",Msg::kInfo,5)
01057     << "Reco Energy: 1 Gev to 30 GeV, 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
01058     << endl;
01059     vector<Double_t> bins;
01060     Double_t lowEdge = 0.0;
01061     Double_t highEdge = 20.0;
01062     Double_t binWidth = 1.0;
01063     for (Double_t binEdge = lowEdge;
01064          binEdge < highEdge -(binWidth/2.0);
01065          binEdge += binWidth) {
01066       bins.push_back(binEdge);
01067     }
01068     lowEdge = 20.0;
01069     highEdge = 30.0;
01070     binWidth = 2.0;
01071     for (Double_t binEdge = lowEdge;
01072          binEdge < highEdge -(binWidth/2.0);
01073          binEdge += binWidth) {
01074       bins.push_back(binEdge);
01075     }
01076     lowEdge = 30.0;
01077     highEdge = 50.0;
01078     binWidth = 4.0;
01079     for (Double_t binEdge = lowEdge;
01080          binEdge < highEdge -(binWidth/2.0);
01081          binEdge += binWidth) {
01082       bins.push_back(binEdge);
01083     }
01084     bins.push_back(50.0);
01085     bins.push_back(200.0);
01086     return bins;
01087   } else if (NuBinningScheme::k0_1GeVTo20 == binningScheme) {
01088     MAXMSG("NuUtilities",Msg::kInfo,5)
01089       << "True Energy: 0.10 GeV up to 20 GeV; "
01090       << "1 Gev to 30 GeV, 2 GeV from 30 to 50 GeV; One 150 GeV bin to 200 GeV"
01091       << endl;
01092     vector<Double_t> bins;
01093     Double_t lowEdge = 0.0;
01094     Double_t highEdge = 20.0;
01095     Double_t binWidth = 0.1;
01096     for (Double_t binEdge = lowEdge;
01097           binEdge < highEdge -(binWidth/2.0);
01098           binEdge += binWidth) {
01099       bins.push_back(binEdge);
01100     }
01101     lowEdge = 20.0;
01102     highEdge = 30.0;
01103     binWidth = 1.0;
01104     for (Double_t binEdge = lowEdge;
01105           binEdge < highEdge -(binWidth/2.0);
01106           binEdge += binWidth) {
01107       bins.push_back(binEdge);
01108     }
01109     lowEdge = 30.0;
01110     highEdge = 50.0;
01111     binWidth = 2.0;
01112     for (Double_t binEdge = lowEdge;
01113           binEdge < highEdge -(binWidth/2.0);
01114           binEdge += binWidth) {
01115       bins.push_back(binEdge);
01116     }
01117     bins.push_back(50.0);
01118     bins.push_back(200.0);
01119     return bins;
01120  } else {
01121     MAXMSG("NuUtilities",Msg::kInfo,100)
01122     << "!!Invalid binning scheme requested.!!" << endl
01123     << "Binning true energy in 0.5 GeV up to 200 GeV" << endl;
01124     vector<Double_t> bins;
01125     Double_t lowEdge = 0.0;
01126     Double_t highEdge = 200.0;
01127     Double_t binWidth = 0.5;
01128     for (Double_t binEdge = lowEdge;
01129          binEdge <= highEdge + (binWidth/2.0);
01130          binEdge += binWidth){
01131       bins.push_back(binEdge);
01132     }
01133     return bins;
01134   }
01135 }

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

Definition at line 65 of file NuUtilities.h.

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

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

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

Definition at line 1172 of file NuUtilities.cxx.

01174 {
01175   file.cd();
01176   vHistos.first.Spectrum()->Write();
01177   vHistos.second.Spectrum()->Write();
01178 }

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

Definition at line 1155 of file NuUtilities.cxx.

01157 {
01158   file.cd();
01159   for (vector<NuMatrixSpectrum>::const_iterator it = vHistos.begin();
01160        it != vHistos.end();
01161        ++it){
01162     (*it).Spectrum()->Write();
01163     if(!Quiet) cout << "Written " << (*it).GetName() << endl;
01164   }
01165 
01166   cout << "Written " << vHistos.size() << " histograms to " 
01167        << file.GetName() << endl;
01168 
01169 }

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

Definition at line 1138 of file NuUtilities.cxx.

01140 {
01141   file.cd();
01142   for (vector<TH1D>::const_iterator it = vHistos.begin();
01143        it != vHistos.end();
01144        ++it){
01145     (*it).Write();
01146     if(!Quiet) cout << "Written " << (*it).GetName() << endl;
01147   }
01148 
01149   cout << "Written " << vHistos.size() << " histograms to " 
01150        << file.GetName() << endl;
01151 
01152 }


Member Data Documentation

VldTimeStamp NuUtilities::vtsRunIEnd [static]

Definition at line 101 of file NuUtilities.h.

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

VldTimeStamp NuUtilities::vtsRunIIEnd [static]

Definition at line 102 of file NuUtilities.h.

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

VldTimeStamp NuUtilities::vtsRunIIIEnd [static]

Definition at line 103 of file NuUtilities.h.

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

VldTimeStamp NuUtilities::vtsRunIVEnd [static]

Definition at line 104 of file NuUtilities.h.

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

VldTimeStamp NuUtilities::vtsRunIXEnd [static]

Definition at line 109 of file NuUtilities.h.

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

VldTimeStamp NuUtilities::vtsRunVEnd [static]

Definition at line 105 of file NuUtilities.h.

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

VldTimeStamp NuUtilities::vtsRunVIEnd [static]

Definition at line 106 of file NuUtilities.h.

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

VldTimeStamp NuUtilities::vtsRunVIIEnd [static]

Definition at line 107 of file NuUtilities.h.

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

VldTimeStamp NuUtilities::vtsRunVIIIEnd [static]

Definition at line 108 of file NuUtilities.h.

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

VldTimeStamp NuUtilities::vtsRunXEnd [static]

Definition at line 110 of file NuUtilities.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Sep 1 22:47:00 2015 for loon by  doxygen 1.4.7