NuMatrixMethod Class Reference

#include <NuMatrixMethod.h>

List of all members.

Public Member Functions

 NuMatrixMethod ()
 NuMatrixMethod (const Int_t NbinsX, const Double_t LowX, const Double_t UppX, const Double_t NDPoT, const Double_t FDPoT, const Double_t FluxPoT, const Double_t NDFidMass, const Double_t FDFidMass, const std::string helperfilename, const std::string xsecfilename, const std::string NDDatafilename, const std::string outputFileName, const NuXMLConfig *xmlConfig=0)
 NuMatrixMethod (const NuBinningScheme::NuBinningScheme_t binningScheme, const Double_t NDPoT, const Double_t FDPoT, const Double_t FluxPoT, const Double_t NDFidMass, const Double_t FDFidMass, const std::string helperfilename, const std::string xsecfilename, const std::string NDDatafilename, const std::string outputFileName, const NuXMLConfig *xmlConfig=0)
 NuMatrixMethod (const NuMatrixInput &mmInput, const NuMMExtrapolation::NuMMScheme_t extrpScheme)
virtual ~NuMatrixMethod ()
virtual void PredictFDFluxUnosc ()
virtual const TH1D * PredictFDSpectrumBackgroundNoOsc (const Double_t dm2, const Double_t sn2)
virtual const TH1D * PredictFDDecaySpectrumBackgroundNoOsc (const Double_t alpha, const Double_t sn2)
virtual const TH1D * PredictFDDecoherenceSpectrumBackgroundNoOsc (const Double_t mu2, const Double_t sn2, const Double_t dm2=0)
virtual const TH1D * PredictFDSpectrumBackgroundOscUncombined (const Double_t dm2, const Double_t sn2, const Double_t backdm2, const Double_t backsn2)
virtual void SetFDCCTrueUnoscBackground (const TH1D &hFDCCTrueUnoscBack)
virtual const TH1D GetFDOtherCCTrueUnoscBackground ()
virtual const TH1D * PredictFDSpectrumBackgroundOscCombined (const Double_t dm2, const Double_t sn2, const Double_t backdm2, const Double_t backsn2)
virtual const TH1D * PredictFDDecaySpectrumBackgroundDecayCombined (const Double_t alpha, const Double_t sn2, const Double_t backalpha, const Double_t backsn2)
virtual const TH1D * PredictFDDecoherenceSpectrumBackgroundDecohereCombined (const Double_t mu2, const Double_t sn2, const Double_t backmu2, const Double_t backsn2, const Double_t dm2=0, const Double_t backdm2=0)
virtual void SetExtrapolationScheme (const NuMMExtrapolation::NuMMScheme_t scheme)
void WriteFilesForFitter (std::string sPrefix)
void WriteInputForFitter (NuMatrixInput *mmInput)
virtual void SetFDAppearedFidFlux (const TH1D &hFDAppearedFidFlux)
virtual const TH1D GetFDPotentialAppearanceFidFlux () const
virtual const TH1D * PredictFDSpectrumAppearance (const Double_t dm2, const Double_t sn2, const Double_t backdm2, const Double_t backsn2, const Double_t appearanceFraction)

Private Member Functions

virtual void ResetUnoscHistograms ()
virtual void PurityCorrectND ()
virtual void RecoToTrueND ()
virtual void EfficiencyCorrectND ()
virtual void XSecCorrectND ()
virtual void ExtrapolateNDToFD ()
virtual void XSecCorrectFD ()
virtual void EfficiencyCorrectFD ()
virtual void UnoscTrueToRecoFD ()
virtual void UnoscPurityCorrectFD ()
virtual void CalculateNCContamination ()
virtual void OscillateFD (const Double_t dm2, const Double_t sn2)
virtual void DecayFD (const Double_t alpha, const Double_t sn2)
virtual void DecohereFD (const Double_t mu2, const Double_t sn2, const Double_t dm2=0)
virtual void TrueToRecoFD ()
virtual void PurityCorrectFDBackgroundNoOsc ()
virtual void PurityCorrectFDBackgroundOscUncombined (Double_t dm2Back, Double_t sn2Back)
virtual void PurityCorrectFDBackgroundOscCombined (Double_t dm2Back, Double_t sn2Back)
virtual void PurityCorrectFDBackgroundDecohereCombined (Double_t mu2Back, Double_t sn2Back, Double_t dm2Back=0)
virtual void PurityCorrectFDBackgroundDecayCombined (Double_t alphaBack, Double_t sn2Back)
virtual void AddInAppearedEvents (const Double_t otherDm2, const Double_t otherSn2, const Double_t appearanceFraction)
virtual void ShiftXSecGraph ()
virtual void PotentialTausTrueEnergy ()
const TH1D TauXSecCorrectFD (const TH1D &tauFlux) const
const TH1D MultiplyInInefficiencies (const TH1D &inputSpectrum, const TH1D &efficiencyPlot) const
const TH1D InverseOscillate (const TH1D &inputSpectrum, const Double_t dm2, const Double_t sn2) const
const TH1D TrueToReco (const TH1D &inputSpectrum, const TH2D &recoVsTrueHistogram) const
const TH1D AddInImpurity (const TH1D &inputSpectrum, const TH1D &impuritySpectrum) const

Private Attributes

Bool_t fDoXSecStep
Int_t fNRecoBins
Int_t fNTrueBins
Double_t * fRecoBinEdges
Double_t * fTrueBinEdges
Double_t fNDPoT
Double_t fFDPoT
Double_t fFluxPoT
Double_t fNDFidMass
Double_t fFDFidMass
Double_t fFDDistance
std::string fOutName
std::string fhelperfilename
std::string fxsecfilename
std::string fndDataFilename
NuMMExtrapolation::NuMMScheme_t fextrpScheme
const NuXMLConfigfxmlConfig
TH1D * fRecoEnergyMeas_ND
TH1D * fRecoEnergyMeas_FD
TH1D * fPurity_ND
TH2D * fRecoVsTrueEnergy_ND
TH1D * fEfficiency_ND
TGraph * fXSec_CC_Graph
TGraph * fTau_XSec_CC_Graph
TH2D * fFDVsNDMatrixRW
TH1D * fEfficiency_FD
TH2D * fRecoVsTrueEnergy_FD
TH1D * fPurity_FD
TH1D * fCCContamination_FD
TH1D * fNCContamination_FD
TH2D * fRecoToTrueCCContamination_FD
TH2D * fTrueToRecoCCContamination_FD
TH1D * fSuppliedTrueUnoscCCBackground_FD
TH1D * fOtherEfficiency_FD
TH1D * fEfficiencyTau_FD
TH2D * fRecoVsTrueEnergyTau_FD
TH1D * fRecoEnergyPurCor_ND
TH1D * fTrueEnergyPurCor_ND
TH1D * fTrueEnergyEffCor_ND
TH1D * fTrueEnergyFlux_ND
TH1D * fTrueEnergyMatrix_FD
TH1D * fTrueEnergyCC_FD
TH1D * fTrueEnergyEffCor_FD
TH1D * fRecoEnergyNoOsc_FD
TH1D * fRecoEnergyNoOscPred_FD
TH1D * fRecoUnoscNCBackground_FD
TH1D * fTrueEnergyOsc_FD
TH1D * fRecoEnergyOsc_FD
TH1D * fRecoEnergyPred_FD
TH1D * fAppearedTrueEffCor_FD
TH1D * fEffCorTau_FD

Detailed Description

Definition at line 172 of file NuMatrixMethod.h.


Constructor & Destructor Documentation

NuMatrixMethod::NuMatrixMethod (  ) 

Definition at line 212 of file NuMatrixMethod.cxx.

References NuBinningScheme::kUnknown, NuUtilities::RecoBins(), and NuUtilities::TrueBins().

00213   : fDoXSecStep(true),
00214     fNDPoT(1.0),
00215     fFDPoT(1.0),
00216     fFluxPoT(1.0),
00217     fNDFidMass(1.0),
00218     fFDFidMass(1.0),
00219     fFDDistance(735.0*Munits::km)
00220 {
00221   fxmlConfig = 0;
00222   
00223   const NuUtilities utils;
00224   const vector<Double_t> recoBins = utils.RecoBins(NuBinningScheme::kUnknown);
00225   fNRecoBins = recoBins.size()-1;
00226   fRecoBinEdges = new Double_t[fNRecoBins+1];
00227   {
00228     Int_t i=0;
00229     for (vector<Double_t>::const_iterator itBin = recoBins.begin();
00230          itBin != recoBins.end();
00231          ++itBin, ++i){
00232       fRecoBinEdges[i] = *itBin;
00233     }
00234   }
00235   
00236   const vector<Double_t> trueBins = utils.TrueBins(NuBinningScheme::kUnknown);
00237   fNTrueBins = trueBins.size()-1;
00238   fTrueBinEdges = new Double_t[fNTrueBins+1];
00239   {
00240     Int_t i=0;
00241     for (vector<Double_t>::const_iterator itBin = trueBins.begin();
00242          itBin != trueBins.end();
00243          ++itBin, ++i){
00244       fTrueBinEdges[i] = *itBin;
00245     }
00246   }
00247 
00248   fRecoEnergyPurCor_ND = new
00249     TH1D("RecoEnergyPurCor_ND",
00250          "ND Reconstructed Energy After Purity Correction",
00251          fNRecoBins,fRecoBinEdges);
00252   fTrueEnergyPurCor_ND = new
00253     TH1D("TrueEnergyPurCor_ND",
00254          "ND True Energy After Purity Correction",
00255          fNTrueBins,fTrueBinEdges);
00256   fTrueEnergyEffCor_ND = new
00257     TH1D("TrueEnergyEffCor_ND",
00258          "ND True Energy After Purity & Efficiency Corrections",
00259          fNTrueBins,fTrueBinEdges);
00260   fTrueEnergyFlux_ND = new
00261     TH1D("TrueEnergyFlux_ND",
00262          "ND True Energy After XSec Corrections (flux)",
00263          fNTrueBins,fTrueBinEdges);
00264   fTrueEnergyMatrix_FD = new
00265     TH1D("TrueEnergyMatrix_FD",
00266          "FD True Energy After Matrix Application (flux)",
00267          fNTrueBins,fTrueBinEdges);
00268   fTrueEnergyCC_FD = new
00269     TH1D("TrueEnergyCC_FD",
00270          "FD True CC Energy After XSec Application",
00271          fNTrueBins,fTrueBinEdges);
00272   fTrueEnergyEffCor_FD = new
00273     TH1D("TrueEnergyEffCor_FD",
00274          "FD True Energy After Efficiency Correction",
00275          fNTrueBins,fTrueBinEdges);
00276   //Two special case histos for FD no oscillations:
00277   fRecoEnergyNoOsc_FD = new
00278     TH1D("RecoEnergyNoOsc_FD",
00279          "FD CC Reco Energy Without Oscillations (no background)",
00280          fNRecoBins,fRecoBinEdges);
00281   fRecoEnergyNoOscPred_FD = new
00282     TH1D("RecoEnergyNoOscPred_FD",
00283          "FD Predicted Reco Energy Without Oscillations",
00284          fNRecoBins,fRecoBinEdges);
00285   fRecoUnoscNCBackground_FD=new 
00286     TH1D("UnoscNCBackground_FD",
00287          "Reco energy unoscillated NC background prediction",
00288          fNRecoBins,fRecoBinEdges);
00289   //After the digression:
00290   fTrueEnergyOsc_FD = new
00291     TH1D("TrueEnergyOsc_FD",
00292          "FD True Energy With Oscillations",
00293          fNTrueBins,fTrueBinEdges);
00294   fRecoEnergyOsc_FD = new
00295     TH1D("RecoEnergyOsc_FD",
00296          "FD Reco Energy With Oscillations",
00297          fNRecoBins,fRecoBinEdges);
00298   fRecoEnergyPred_FD = new
00299     TH1D("RecoEnergyPred_FD",
00300          "FD Predicted Reco Energy",
00301          fNRecoBins,fRecoBinEdges);
00302   
00303   fRecoEnergyMeas_ND = 0;
00304   fRecoEnergyMeas_FD = 0;
00305   fEffCorTau_FD = 0;
00306 
00307   fPurity_ND = 0;          
00308   fRecoVsTrueEnergy_ND = 0;
00309   fEfficiency_ND = 0;      
00310   fXSec_CC_Graph = 0;
00311   fTau_XSec_CC_Graph = 0;
00312   fFDVsNDMatrixRW = 0;     
00313   fEfficiency_FD = 0;
00314   fRecoVsTrueEnergy_FD = 0;
00315   fPurity_FD = 0;          
00316   fCCContamination_FD = 0;
00317   fNCContamination_FD = 0;
00318   fRecoToTrueCCContamination_FD = 0;
00319   fTrueToRecoCCContamination_FD = 0;
00320   fSuppliedTrueUnoscCCBackground_FD = 0;
00321   fOtherEfficiency_FD = 0;
00322 
00323   fAppearedTrueEffCor_FD = new
00324     TH1D("AppearedTrueEffCor_FD",
00325          "FD appearance spectrum, true energy, efficiency corrected",
00326          fNTrueBins,fTrueBinEdges);
00327 
00328   fEfficiencyTau_FD = 0;
00329   fRecoVsTrueEnergyTau_FD = 0;
00330 }

NuMatrixMethod::NuMatrixMethod ( const Int_t  NbinsX,
const Double_t  LowX,
const Double_t  UppX,
const Double_t  NDPoT,
const Double_t  FDPoT,
const Double_t  FluxPoT,
const Double_t  NDFidMass,
const Double_t  FDFidMass,
const std::string  helperfilename,
const std::string  xsecfilename,
const std::string  NDDatafilename,
const std::string  outputFileName,
const NuXMLConfig xmlConfig = 0 
)
NuMatrixMethod::NuMatrixMethod ( const NuBinningScheme::NuBinningScheme_t  binningScheme,
const Double_t  NDPoT,
const Double_t  FDPoT,
const Double_t  FluxPoT,
const Double_t  NDFidMass,
const Double_t  FDFidMass,
const std::string  helperfilename,
const std::string  xsecfilename,
const std::string  NDDatafilename,
const std::string  outputFileName,
const NuXMLConfig xmlConfig = 0 
)
NuMatrixMethod::NuMatrixMethod ( const NuMatrixInput mmInput,
const NuMMExtrapolation::NuMMScheme_t  extrpScheme 
) [explicit]

Definition at line 624 of file NuMatrixMethod.cxx.

References Msg::kError, Msg::kFatal, NuMMExtrapolation::kModularNoChargeCutFit, NuMMExtrapolation::kModularNuMuBarCPTFit, NuMMExtrapolation::kModularNuMuBarTransitionFit, NuMMExtrapolation::kModularNuMuCPTFit, NuMMExtrapolation::kModularPRLCCFit, MSG, NuMatrixInput::NoChargeCutRecoEnNCBkgFD(), NuMatrixInput::NoChargeCutTrueEnFD(), NuMatrixInput::NoChargeCutTrueToRecoFD(), NuMatrixInput::NuMuBarRecoEnNCBkgFD(), NuMatrixInput::NuMuBarTrueEnCCBkgFD(), NuMatrixInput::NuMuBarTrueEnFD(), NuMatrixInput::NuMuBarTrueEnPotentialAppearanceEffCorFD(), NuMatrixInput::NuMuBarTrueToRecoCCBkgFD(), NuMatrixInput::NuMuBarTrueToRecoFD(), NuMatrixInput::NuMuEffCorTaus_FD(), NuMatrixInput::NuMuRecoEnNCBkgFD(), NuMatrixInput::NuMuRecoVsTrueTaus_FD(), NuMatrixInput::NuMuTrueEnCCBkgFD(), NuMatrixInput::NuMuTrueEnFD(), NuMatrixInput::NuMuTrueEnPotentialAppearanceEffCorFD(), NuMatrixInput::NuMuTrueToRecoCCBkgFD(), and NuMatrixInput::NuMuTrueToRecoFD().

00626   : fDoXSecStep(true),
00627     fFDDistance(735.0*Munits::km)
00628 {
00629   fxmlConfig = 0;//Shouldn't need this for FD only steps.
00630   if (NuMMExtrapolation::kModularNuMuCPTFit == extrpScheme){
00631     //M numu(bar)
00632     fRecoVsTrueEnergy_FD = new
00633       TH2D(*mmInput.NuMuTrueToRecoFD());
00634     //M-squigle numu(bar) for WS
00635     fTrueToRecoCCContamination_FD = new
00636       TH2D(*mmInput.NuMuTrueToRecoCCBkgFD());
00637     //T
00638     fTrueEnergyEffCor_FD = new
00639       TH1D(*mmInput.NuMuTrueEnFD());
00640     //K
00641     fSuppliedTrueUnoscCCBackground_FD = new
00642       TH1D(*mmInput.NuMuTrueEnCCBkgFD());
00643     //Z
00644     fRecoUnoscNCBackground_FD = new
00645       TH1D(*mmInput.NuMuRecoEnNCBkgFD());
00646     //numubar->numu appearance spectrum
00647     fAppearedTrueEffCor_FD = new
00648       TH1D(*mmInput.NuMuTrueEnPotentialAppearanceEffCorFD());
00649   }
00650   else if (NuMMExtrapolation::kModularNuMuBarCPTFit == extrpScheme){
00651     //M numu(bar)
00652     fRecoVsTrueEnergy_FD = new
00653       TH2D(*mmInput.NuMuBarTrueToRecoFD());
00654     //M-squigle numu(bar) for WS
00655     fTrueToRecoCCContamination_FD = new
00656       TH2D(*mmInput.NuMuBarTrueToRecoCCBkgFD());
00657     //T
00658     fTrueEnergyEffCor_FD = new
00659       TH1D(*mmInput.NuMuBarTrueEnFD());
00660     //K
00661     fSuppliedTrueUnoscCCBackground_FD = new
00662       TH1D(*mmInput.NuMuBarTrueEnCCBkgFD());
00663     //Z
00664     fRecoUnoscNCBackground_FD = new
00665       TH1D(*mmInput.NuMuBarRecoEnNCBkgFD());
00666     //numu->numubar appearance spectrum
00667     fAppearedTrueEffCor_FD = new
00668       TH1D(*mmInput.NuMuBarTrueEnPotentialAppearanceEffCorFD());
00669   }
00670   else if (NuMMExtrapolation::kModularNuMuBarTransitionFit == extrpScheme){
00671     //M numu(bar)
00672     fRecoVsTrueEnergy_FD = new
00673       TH2D(*mmInput.NuMuBarTrueToRecoFD());
00674     //M-squigle numu(bar) for WS
00675     fTrueToRecoCCContamination_FD = new
00676       TH2D(*mmInput.NuMuBarTrueToRecoCCBkgFD());
00677     //T
00678     fTrueEnergyEffCor_FD = new
00679       TH1D(*mmInput.NuMuBarTrueEnFD());
00680     //K
00681     fSuppliedTrueUnoscCCBackground_FD = new
00682       TH1D(*mmInput.NuMuBarTrueEnCCBkgFD());
00683     //Z
00684     fRecoUnoscNCBackground_FD = new
00685       TH1D(*mmInput.NuMuBarRecoEnNCBkgFD());
00686     //numu->numubar appearance spectrum
00687     fAppearedTrueEffCor_FD = new
00688       TH1D(*mmInput.NuMuBarTrueEnPotentialAppearanceEffCorFD());
00689   }
00690   else if (NuMMExtrapolation::kModularNoChargeCutFit == extrpScheme){
00691     //M numu(bar)
00692     fRecoVsTrueEnergy_FD = new
00693       TH2D(*mmInput.NoChargeCutTrueToRecoFD());
00694 //     //M-squigle numu(bar) for WS
00695 //     fTrueToRecoCCContamination_FD = new
00696 //       TH2D(*mmInput.NoChargeCutTrueToRecoCCBkgFD());
00697     //T
00698     fTrueEnergyEffCor_FD = new
00699       TH1D(*mmInput.NoChargeCutTrueEnFD());
00700 //     //K
00701 //     fSuppliedTrueUnoscCCBackground_FD = new
00702 //       TH1D(*mmInput.NoChargeCutTrueEnCCBkgFD());
00703     //Z
00704     fRecoUnoscNCBackground_FD = new
00705       TH1D(*mmInput.NoChargeCutRecoEnNCBkgFD());
00706     //numu->numubar appearance spectrum
00707 //     fAppearedTrueEffCor_FD = new
00708 //       TH1D(*mmInput.NuMuBarTrueEnPotentialAppearanceEffCorFD());
00709     fAppearedTrueEffCor_FD = 0;
00710   }
00711   else if (NuMMExtrapolation::kModularPRLCCFit == extrpScheme){
00712     //M numu(bar)
00713     fRecoVsTrueEnergy_FD = new
00714       TH2D(*mmInput.NuMuTrueToRecoFD());
00715     //T
00716     fTrueEnergyEffCor_FD = new
00717       TH1D(*mmInput.NuMuTrueEnFD());
00718     //Z
00719     fRecoUnoscNCBackground_FD = new
00720       TH1D(*mmInput.NuMuRecoEnNCBkgFD());
00721     fAppearedTrueEffCor_FD = 0;
00722     fEffCorTau_FD = new
00723       TH1D(*mmInput.NuMuEffCorTaus_FD());
00724     fRecoVsTrueEnergyTau_FD = new
00725       TH2D(*mmInput.NuMuRecoVsTrueTaus_FD());
00726   }
00727   else{
00728     try {
00729       MSG("NuMatrixMethod.cxx", Msg::kFatal) 
00730         << "Not a valid extrapolation scheme for a modular "
00731         << "UK matrix method fit"
00732         << endl;
00733     }
00734     catch(MSGException) {
00735       MSG("NuMatrixMethod.cxx", Msg::kError)
00736         << "Not a valid extrapolation scheme for a modular "
00737         << "UK matrix method fit"
00738         << endl;
00739     }
00740     
00741     
00742   }
00743   //Create the other histograms we need, using existing ones to get binning
00744   fTrueEnergyOsc_FD = new TH1D(*fTrueEnergyEffCor_FD);
00745   fTrueEnergyOsc_FD->Reset();
00746   
00747   fRecoEnergyOsc_FD = new TH1D(*fRecoUnoscNCBackground_FD);
00748   fRecoEnergyOsc_FD->Reset();
00749   
00750   fRecoEnergyPred_FD = new TH1D(*fRecoUnoscNCBackground_FD);
00751   fRecoEnergyPred_FD->Reset();
00752 
00753   fNRecoBins = fRecoEnergyPred_FD->GetNbinsX();
00754   const TArrayD* recoBinEdges = fRecoEnergyPred_FD->GetXaxis()->GetXbins();
00755   fRecoBinEdges = new Double_t[recoBinEdges->GetSize()];
00756   for (Int_t i=0; i<recoBinEdges->GetSize(); ++i){
00757     fRecoBinEdges[i] = recoBinEdges->At(i);
00758   }
00759 
00760   fNTrueBins = fTrueEnergyEffCor_FD->GetNbinsX();
00761   const TArrayD* trueBinEdges = fTrueEnergyEffCor_FD->GetXaxis()->GetXbins();
00762   fTrueBinEdges = new Double_t[trueBinEdges->GetSize()];
00763   for (Int_t i=0; i<trueBinEdges->GetSize(); ++i){
00764     fTrueBinEdges[i] = trueBinEdges->At(i);
00765   }
00766 
00767   fOutName = "";
00768   
00769   fextrpScheme = extrpScheme;
00770 
00771   fEfficiencyTau_FD = 0;
00772   //  fRecoVsTrueEnergyTau_FD = 0;
00773 
00774   //Zero all the histograms we don't need.
00775   fRecoEnergyMeas_ND = 0;  
00776   fRecoEnergyMeas_FD = 0;  
00777   fPurity_ND = 0;          
00778   fRecoVsTrueEnergy_ND = 0;
00779   fEfficiency_ND = 0;      
00780   fXSec_CC_Graph = 0;
00781   fTau_XSec_CC_Graph = 0;
00782   fFDVsNDMatrixRW = 0;     
00783   fEfficiency_FD = 0;
00784   fPurity_FD = 0;
00785   fCCContamination_FD = 0;
00786   fNCContamination_FD = 0;
00787   fRecoToTrueCCContamination_FD = 0;
00788   fOtherEfficiency_FD = 0;
00789   fRecoEnergyPurCor_ND = 0;
00790   fTrueEnergyPurCor_ND = 0;
00791   fTrueEnergyEffCor_ND = 0;
00792   fTrueEnergyFlux_ND = 0;
00793   fTrueEnergyMatrix_FD = 0;
00794   fTrueEnergyCC_FD = 0;
00795   fRecoEnergyNoOsc_FD = 0;
00796   fRecoEnergyNoOscPred_FD = 0;
00797 }

NuMatrixMethod::~NuMatrixMethod (  )  [virtual]

Definition at line 800 of file NuMatrixMethod.cxx.

References fEffCorTau_FD, fOutName, fRecoEnergyMeas_ND, fRecoEnergyNoOsc_FD, fRecoEnergyNoOscPred_FD, fRecoEnergyOsc_FD, fRecoEnergyPred_FD, fRecoEnergyPurCor_ND, fTrueEnergyCC_FD, fTrueEnergyEffCor_FD, fTrueEnergyEffCor_ND, fTrueEnergyFlux_ND, fTrueEnergyMatrix_FD, fTrueEnergyOsc_FD, and fTrueEnergyPurCor_ND.

00801 {
00802   if (""!=fOutName){
00803     TFile *sfile = new TFile(fOutName.c_str(),"UPDATE");
00804     sfile->cd();
00805     fRecoEnergyPurCor_ND->Write();
00806     fTrueEnergyPurCor_ND->Write();
00807     fTrueEnergyEffCor_ND->Write();
00808     fTrueEnergyFlux_ND->Write();
00809     fTrueEnergyMatrix_FD->Write();
00810     fTrueEnergyCC_FD->Write();
00811     fTrueEnergyEffCor_FD->Write();
00812     fTrueEnergyOsc_FD->Write();
00813     fRecoEnergyOsc_FD->Write();
00814     fRecoEnergyPred_FD->Write();  
00815     fRecoEnergyNoOsc_FD->Write();
00816     fRecoEnergyNoOscPred_FD->Write();
00817     
00818     fRecoEnergyMeas_ND->Write("NDData");
00819     // fRecoEnergyMeas_FD->Write("FDData");
00820     
00821     sfile->Close();
00822   }
00823 
00824   if (fRecoEnergyPurCor_ND){
00825     delete fRecoEnergyPurCor_ND;
00826     fRecoEnergyPurCor_ND = 0;
00827   }
00828   if (fTrueEnergyPurCor_ND){
00829     delete fTrueEnergyPurCor_ND;
00830     fTrueEnergyPurCor_ND = 0;
00831   }
00832   if (fTrueEnergyEffCor_ND){
00833     delete fTrueEnergyEffCor_ND;
00834     fTrueEnergyEffCor_ND = 0;
00835   }
00836   if (fTrueEnergyFlux_ND){
00837     delete fTrueEnergyFlux_ND;
00838     fTrueEnergyFlux_ND = 0;
00839   }
00840   if (fTrueEnergyMatrix_FD){
00841     delete fTrueEnergyMatrix_FD;
00842     fTrueEnergyMatrix_FD = 0;
00843   }
00844   if (fTrueEnergyCC_FD){
00845     delete fTrueEnergyCC_FD;
00846     fTrueEnergyCC_FD = 0;
00847   }
00848   if (fTrueEnergyEffCor_FD){
00849     delete fTrueEnergyEffCor_FD;
00850     fTrueEnergyEffCor_FD = 0;
00851   }
00852   if (fRecoEnergyNoOsc_FD){
00853     delete fRecoEnergyNoOsc_FD;
00854     fRecoEnergyNoOsc_FD = 0;
00855   }
00856   if (fRecoEnergyNoOscPred_FD){
00857     delete fRecoEnergyNoOscPred_FD;
00858     fRecoEnergyNoOscPred_FD = 0;
00859   }
00860   if (fEffCorTau_FD){
00861     delete fEffCorTau_FD;
00862     fEffCorTau_FD = 0;
00863   }
00864 }


Member Function Documentation

void NuMatrixMethod::AddInAppearedEvents ( const Double_t  otherDm2,
const Double_t  otherSn2,
const Double_t  appearanceFraction 
) [private, virtual]

Definition at line 1755 of file NuMatrixMethod.cxx.

References NuOscProbCalc::OscillationWeight().

01758 {
01759   for(int i=1;i<=fTrueEnergyOsc_FD->GetNbinsX();i++) {
01760    
01761     Double_t energy = fTrueEnergyOsc_FD->GetBinCenter(i);
01762     Double_t transProb = otherSn2*(1-NuOscProbCalc::OscillationWeight(energy, otherDm2, otherSn2));
01763     transProb *= appearanceFraction;
01764     
01765     fTrueEnergyOsc_FD->
01766       AddBinContent(i,
01767                     fAppearedTrueEffCor_FD->GetBinContent(i)*transProb);
01768 
01769     Double_t binError =
01770       TMath::Power(fTrueEnergyOsc_FD->GetBinError(i),2);
01771     binError += TMath::Power
01772       (fAppearedTrueEffCor_FD->GetBinContent(i)*transProb,2);
01773     if (binError>0){binError = TMath::Sqrt(binError);}
01774     else{binError = 0;}
01775     fTrueEnergyOsc_FD->SetBinError(i,binError);
01776 
01777   }
01778   return;
01779 }

const TH1D NuMatrixMethod::AddInImpurity ( const TH1D &  inputSpectrum,
const TH1D &  impuritySpectrum 
) const [private]

Definition at line 2141 of file NuMatrixMethod.cxx.

02143 {
02144   TH1D outputSpectrum(inputSpectrum);
02145   outputSpectrum.Reset();
02146   
02147   for(int i=1;i<=outputSpectrum.GetNbinsX()+1;i++){
02148     outputSpectrum.
02149       SetBinContent(i,
02150                     inputSpectrum.GetBinContent(i) +
02151                     impuritySpectrum.GetBinContent(i)
02152                     );
02153     Double_t error = 0.0;
02154     error +=
02155       TMath::Power(inputSpectrum.GetBinError(i),2);
02156     error +=
02157       TMath::Power(impuritySpectrum.GetBinError(i),2);
02158     if (error > 0){
02159       outputSpectrum.SetBinError(i, TMath::Sqrt(error));
02160     }
02161     else{
02162       outputSpectrum.SetBinError(i, 0);
02163     }
02164   }
02165   
02166   return outputSpectrum;
02167 }

void NuMatrixMethod::CalculateNCContamination (  )  [private, virtual]

Definition at line 2981 of file NuMatrixMethod.cxx.

References fextrpScheme, fNCContamination_FD, fNRecoBins, fPurity_FD, fRecoEnergyNoOscPred_FD, fRecoUnoscNCBackground_FD, NuMMExtrapolation::kCCNuMuNoOscBackground, and NuMMExtrapolation::kPRLCCAnalysis.

Referenced by PredictFDFluxUnosc().

02982 {
02983   if (NuMMExtrapolation::kPRLCCAnalysis == fextrpScheme ||
02984       NuMMExtrapolation::kCCNuMuNoOscBackground == fextrpScheme){
02985     for(int i=1;i<=fNRecoBins+1;i++){
02986       fRecoUnoscNCBackground_FD->
02987       SetBinContent(i,
02988                     fRecoEnergyNoOscPred_FD->GetBinContent(i)*
02989                     (1.0-fPurity_FD->GetBinContent(i))
02990                     );
02991       
02992       if(fRecoEnergyNoOscPred_FD->GetBinContent(i)>0 &&
02993          1.0-fPurity_FD->GetBinContent(i)>0) {
02994         Double_t error =
02995           TMath::Power(fRecoEnergyNoOscPred_FD->GetBinError(i) / 
02996                        fRecoEnergyNoOscPred_FD->GetBinContent(i),2);
02997         error += TMath::Power((fPurity_FD->GetBinError(i)) / 
02998                               (1.0-fPurity_FD->GetBinContent(i)),2);
02999         error =
03000           TMath::Sqrt(error)*fRecoUnoscNCBackground_FD->GetBinContent(i);
03001         fRecoUnoscNCBackground_FD->SetBinError(i,error);        
03002       }
03003       else fRecoUnoscNCBackground_FD->SetBinError(i,0);
03004     }
03005   }
03006   else{
03007     for(int i=1;i<=fNRecoBins+1;i++){
03008       fRecoUnoscNCBackground_FD->
03009       SetBinContent(i,
03010                     fRecoEnergyNoOscPred_FD->GetBinContent(i)*
03011                     fNCContamination_FD->GetBinContent(i)
03012                     );
03013       
03014       if(fRecoEnergyNoOscPred_FD->GetBinContent(i)>0 &&
03015          fNCContamination_FD->GetBinContent(i)>0) {
03016         Double_t error =
03017           TMath::Power(fRecoEnergyNoOscPred_FD->GetBinError(i) / 
03018                        fRecoEnergyNoOscPred_FD->GetBinContent(i),2);
03019         error += TMath::Power(fNCContamination_FD->GetBinError(i) / 
03020                               fNCContamination_FD->GetBinContent(i),2);
03021         error =
03022           TMath::Sqrt(error)*fRecoUnoscNCBackground_FD->GetBinContent(i);
03023         fRecoUnoscNCBackground_FD->SetBinError(i,error);        
03024       }
03025       else fRecoUnoscNCBackground_FD->SetBinError(i,0);
03026     }
03027   }
03028 }

void NuMatrixMethod::DecayFD ( const Double_t  alpha,
const Double_t  sn2 
) [private, virtual]

Definition at line 1967 of file NuMatrixMethod.cxx.

References fFDDistance, fTrueEnergyEffCor_FD, fTrueEnergyOsc_FD, and Munits::km.

01969 {
01970   //8: decay FD spectrum:
01971   for(int i=1;i<=fTrueEnergyOsc_FD->GetNbinsX();i++) {
01972     Double_t energy = fTrueEnergyOsc_FD->GetBinCenter(i);
01973     Double_t decayProb =
01974       TMath::Power
01975       (sn2 + (1.0-sn2)*exp(-(alpha*fFDDistance/Munits::km)/(2*energy)),
01976        2);
01977     fTrueEnergyOsc_FD->
01978       SetBinContent(i,fTrueEnergyEffCor_FD->GetBinContent(i)*decayProb);
01979     fTrueEnergyOsc_FD->
01980       SetBinError(i,fTrueEnergyEffCor_FD->GetBinError(i)*decayProb);
01981   }
01982 }

void NuMatrixMethod::DecohereFD ( const Double_t  mu2,
const Double_t  sn2,
const Double_t  dm2 = 0 
) [private, virtual]

Definition at line 1985 of file NuMatrixMethod.cxx.

References NuOscProbCalc::DecoherenceWeight(), fTrueEnergyEffCor_FD, and fTrueEnergyOsc_FD.

01988 {
01989   //8: Oscillate FD spectrum:
01990   for(int i=1;i<=fTrueEnergyOsc_FD->GetNbinsX();i++) {
01991     Double_t energy = fTrueEnergyOsc_FD->GetBinCenter(i);
01992     Double_t decoherenceProb = NuOscProbCalc::DecoherenceWeight(energy, mu2, sn2, dm2);
01993     fTrueEnergyOsc_FD->
01994       SetBinContent(i,fTrueEnergyEffCor_FD->GetBinContent(i)*decoherenceProb);
01995     fTrueEnergyOsc_FD->
01996       SetBinError(i,fTrueEnergyEffCor_FD->GetBinError(i)*decoherenceProb);
01997   }
01998 }

void NuMatrixMethod::EfficiencyCorrectFD (  )  [private, virtual]

Definition at line 2900 of file NuMatrixMethod.cxx.

References fEfficiency_FD, fNTrueBins, fTrueEnergyCC_FD, and fTrueEnergyEffCor_FD.

Referenced by PredictFDFluxUnosc().

02901 { 
02902   //7: Apply FD efficiencies:
02903   for(int i=1;i<=fNTrueBins;i++) {
02904     fTrueEnergyEffCor_FD->SetBinContent(i,fTrueEnergyCC_FD->GetBinContent(i) *
02905                                         fEfficiency_FD->GetBinContent(i));
02906     if(fTrueEnergyCC_FD->GetBinContent(i)>0 &&
02907        fEfficiency_FD->GetBinContent(i)>0) {
02908       Double_t error = TMath::Power(fTrueEnergyCC_FD->GetBinError(i)/
02909                                     fTrueEnergyCC_FD->GetBinContent(i),2);
02910       error += TMath::Power(fEfficiency_FD->GetBinError(i)/
02911                             fEfficiency_FD->GetBinContent(i),2);
02912       error = TMath::Sqrt(error)*fTrueEnergyEffCor_FD->GetBinContent(i);
02913       fTrueEnergyEffCor_FD->SetBinError(i,error);
02914     }
02915     else fTrueEnergyEffCor_FD->SetBinError(i,0);
02916   }
02917   return;
02918 }

void NuMatrixMethod::EfficiencyCorrectND (  )  [private, virtual]

Definition at line 2716 of file NuMatrixMethod.cxx.

References fEfficiency_ND, fNTrueBins, fTrueEnergyEffCor_ND, and fTrueEnergyPurCor_ND.

Referenced by PredictFDFluxUnosc().

02717 {
02718   //3: Correct ND true energy spectrum for efficiencies:
02719   for(int i=1;i<=fNTrueBins;i++) {
02720     if(fEfficiency_ND->GetBinContent(i)>0 &&
02721        fTrueEnergyPurCor_ND->GetBinContent(i)>0) {
02722       fTrueEnergyEffCor_ND->
02723         SetBinContent(i,
02724                       fTrueEnergyPurCor_ND->GetBinContent(i) /
02725                       fEfficiency_ND->GetBinContent(i));        
02726       Double_t error =
02727         TMath::Power(fTrueEnergyPurCor_ND->GetBinError(i)/
02728                      fTrueEnergyPurCor_ND->GetBinContent(i),2);
02729       error += TMath::Power(fEfficiency_ND->GetBinError(i)/
02730                             fEfficiency_ND->GetBinContent(i),2);
02731       error =
02732         TMath::Sqrt(error) * fTrueEnergyEffCor_ND->GetBinContent(i);
02733       fTrueEnergyEffCor_ND->SetBinError(i,error);
02734     }
02735     else {
02736       fTrueEnergyEffCor_ND->SetBinContent(i,0);
02737       fTrueEnergyEffCor_ND->SetBinError(i,0);
02738     }
02739   }
02740   return;
02741 }

void NuMatrixMethod::ExtrapolateNDToFD (  )  [private, virtual]

Definition at line 2779 of file NuMatrixMethod.cxx.

References fFDVsNDMatrixRW, fNTrueBins, fTrueEnergyFlux_ND, and fTrueEnergyMatrix_FD.

Referenced by PredictFDFluxUnosc().

02780 {
02781   //working space:
02782   Double_t *val = new Double_t[fNTrueBins+1];
02783   Double_t *valerr = new Double_t[fNTrueBins+1];
02784 
02785   //5: Get FD spectrum:
02786   for(int i=1;i<=fNTrueBins;i++) { val[i-1] = 0; valerr[i-1] = 0; }
02787   for(int i=1;i<=fNTrueBins;i++) { //loop over ND bins
02788     for(int j=1;j<=fNTrueBins;j++) { //loop over FD bins
02789       val[j-1] += ( fTrueEnergyFlux_ND->GetBinContent(i) *
02790                     fFDVsNDMatrixRW->GetBinContent(i,j));
02791       Double_t error = 0;
02792       if(fTrueEnergyFlux_ND->GetBinContent(i)>0 &&
02793          fFDVsNDMatrixRW->GetBinContent(i,j)>0) {
02794         error = TMath::Power(fTrueEnergyFlux_ND->GetBinError(i)/
02795                              fTrueEnergyFlux_ND->GetBinContent(i),2);
02796         error += TMath::Power(fFDVsNDMatrixRW->GetBinError(i,j)/
02797                               fFDVsNDMatrixRW->GetBinContent(i,j),2);
02798         error *= TMath::Power(fTrueEnergyFlux_ND->GetBinContent(i) * 
02799                               fFDVsNDMatrixRW->GetBinContent(i,j),2);
02800       }
02801       valerr[j-1] += error;
02802     }
02803   }
02804   for(int i=1;i<=fNTrueBins;i++) {
02805     fTrueEnergyMatrix_FD->SetBinContent(i,val[i-1]);
02806     fTrueEnergyMatrix_FD->SetBinError(i,TMath::Sqrt(valerr[i-1]));
02807   }
02808   return;
02809 }

const TH1D NuMatrixMethod::GetFDOtherCCTrueUnoscBackground (  )  [virtual]

Definition at line 2921 of file NuMatrixMethod.cxx.

References fNTrueBins, fOtherEfficiency_FD, fTrueBinEdges, and fTrueEnergyCC_FD.

Referenced by NuMatrixFitter::AppearanceAnalysis(), NuMatrixFitter::CPTAnalysis(), and NuMatrixFitter::WriteHistosForFitter().

02922 { 
02923   TH1D hTrueEnergyOtherCCTrueUnoscBack
02924     ("hTrueEnergyOtherCCTrueUnoscBack",
02925      "True energy unoscillated CC background for the other neutrinos",
02926      fNTrueBins,fTrueBinEdges);
02927 
02928   for(int i=1;i<=fNTrueBins;i++) {
02929     hTrueEnergyOtherCCTrueUnoscBack.
02930       SetBinContent(i,fTrueEnergyCC_FD->GetBinContent(i) *
02931                     fOtherEfficiency_FD->GetBinContent(i));
02932     if(fTrueEnergyCC_FD->GetBinContent(i)>0 &&
02933        fOtherEfficiency_FD->GetBinContent(i)>0) {
02934       Double_t error = TMath::Power(fTrueEnergyCC_FD->GetBinError(i)/
02935                                     fTrueEnergyCC_FD->GetBinContent(i),2);
02936       error += TMath::Power(fOtherEfficiency_FD->GetBinError(i)/
02937                             fOtherEfficiency_FD->GetBinContent(i),2);
02938       error = TMath::Sqrt(error)*hTrueEnergyOtherCCTrueUnoscBack.GetBinContent(i);
02939       hTrueEnergyOtherCCTrueUnoscBack.SetBinError(i,error);
02940     }
02941     else hTrueEnergyOtherCCTrueUnoscBack.SetBinError(i,0);
02942   }
02943   return hTrueEnergyOtherCCTrueUnoscBack;
02944 }

const TH1D NuMatrixMethod::GetFDPotentialAppearanceFidFlux (  )  const [virtual]

Definition at line 1819 of file NuMatrixMethod.cxx.

References err(), fEfficiency_FD, fNTrueBins, fTrueBinEdges, fTrueEnergyEffCor_FD, and fXSec_CC_Graph.

Referenced by NuMatrixFitter::AppearanceAnalysis(), and NuMatrixFitter::WriteHistosForFitter().

01820 {
01821   TH1D hPotential("hTrueEnergyPotentialAppearance",
01822                  "True energy potential appearance spectrum",
01823                  fNTrueBins,fTrueBinEdges);
01824   double val, err, energy;
01825   double newval, newerr;
01826   double eff, efferr, xsec;
01827 
01828   for(int i = 1; i <= hPotential.GetNbinsX(); i++) {
01829     val = fTrueEnergyEffCor_FD->GetBinContent(i);
01830     err = fTrueEnergyEffCor_FD->GetBinError(i);
01831     energy = hPotential.GetBinCenter(i);
01832     
01833     xsec = fXSec_CC_Graph->Eval(energy,0,"");
01834     eff = fEfficiency_FD->GetBinContent(i);
01835     efferr = fEfficiency_FD->GetBinError(i);
01836     
01837     // Remove xsec, eff: Events => Flux
01838     if (eff == 0 || xsec == 0) newval = 0;
01839     else newval = val / xsec / eff;
01840     
01841     newerr = TMath::Power(err/val,2) + TMath::Power(efferr/eff,2);
01842     newerr = TMath::Sqrt(newerr) * newval;
01843     
01844     hPotential.SetBinContent(i,newval);
01845     hPotential.SetBinError(i,newerr);
01846   }
01847   return hPotential;
01848 }

const TH1D NuMatrixMethod::InverseOscillate ( const TH1D &  inputSpectrum,
const Double_t  dm2,
const Double_t  sn2 
) const [private]

Definition at line 1917 of file NuMatrixMethod.cxx.

References NuOscProbCalc::OscillationWeight().

01920 {
01921   TH1D outputSpectrum(inputSpectrum);
01922   outputSpectrum.Reset();
01923 
01924   for(int i=1;i<=outputSpectrum.GetNbinsX();i++) {
01925     Double_t energy = outputSpectrum.GetBinCenter(i);
01926     Double_t oscProb = 1-NuOscProbCalc::OscillationWeight(energy, dm2, sn2);
01927     outputSpectrum.
01928       SetBinContent(i,inputSpectrum.GetBinContent(i)*oscProb);
01929     outputSpectrum.
01930       SetBinError(i,inputSpectrum.GetBinError(i)*oscProb);
01931   }
01932 
01933   return outputSpectrum;
01934 }

const TH1D NuMatrixMethod::MultiplyInInefficiencies ( const TH1D &  inputSpectrum,
const TH1D &  efficiencyPlot 
) const [private]

Definition at line 2876 of file NuMatrixMethod.cxx.

Referenced by PotentialTausTrueEnergy().

02878 {
02879   TH1D outputSpectrum(inputSpectrum);
02880   outputSpectrum.Reset();
02881 
02882   for(int i=1;i<=inputSpectrum.GetNbinsX();i++) {
02883     outputSpectrum.SetBinContent(i,inputSpectrum.GetBinContent(i) *
02884                                  efficiencyPlot.GetBinContent(i));
02885     if(inputSpectrum.GetBinContent(i)>0 &&
02886        efficiencyPlot.GetBinContent(i)>0) {
02887       Double_t error = TMath::Power(inputSpectrum.GetBinError(i)/
02888                                     inputSpectrum.GetBinContent(i),2);
02889       error += TMath::Power(efficiencyPlot.GetBinError(i)/
02890                             efficiencyPlot.GetBinContent(i),2);
02891       error = TMath::Sqrt(error)*outputSpectrum.GetBinContent(i);
02892       outputSpectrum.SetBinError(i,error);
02893     }
02894     else outputSpectrum.SetBinError(i,0);
02895   }
02896   return outputSpectrum;
02897 }

void NuMatrixMethod::OscillateFD ( const Double_t  dm2,
const Double_t  sn2 
) [private, virtual]

Definition at line 1937 of file NuMatrixMethod.cxx.

References fTrueEnergyEffCor_FD, fTrueEnergyOsc_FD, and NuOscProbCalc::OscillationWeight().

Referenced by PredictFDSpectrumBackgroundOscUncombined().

01939 {
01940   //8: Oscillate FD spectrum:
01941   for(int i=1;i<=fTrueEnergyOsc_FD->GetNbinsX();i++) {
01942     Double_t energy = fTrueEnergyOsc_FD->GetBinCenter(i);
01943     Double_t oscProb = NuOscProbCalc::OscillationWeight(energy, dm2, sn2);
01944     fTrueEnergyOsc_FD->
01945       SetBinContent(i,fTrueEnergyEffCor_FD->GetBinContent(i)*oscProb);
01946     fTrueEnergyOsc_FD->
01947       SetBinError(i,fTrueEnergyEffCor_FD->GetBinError(i)*oscProb);
01948   }
01949 }

void NuMatrixMethod::PotentialTausTrueEnergy (  )  [private, virtual]

Definition at line 2838 of file NuMatrixMethod.cxx.

References fEffCorTau_FD, fEfficiencyTau_FD, fTrueEnergyMatrix_FD, MultiplyInInefficiencies(), and TauXSecCorrectFD().

Referenced by PredictFDFluxUnosc().

02839 {
02840   TH1D hTrueEnergyTau_FD(this->TauXSecCorrectFD(*fTrueEnergyMatrix_FD));
02841   if (fEffCorTau_FD){delete fEffCorTau_FD; fEffCorTau_FD = 0;}
02842   fEffCorTau_FD = new TH1D(this->MultiplyInInefficiencies(hTrueEnergyTau_FD,
02843                                                           *fEfficiencyTau_FD));
02844 }

const TH1D * NuMatrixMethod::PredictFDDecaySpectrumBackgroundDecayCombined ( const Double_t  alpha,
const Double_t  sn2,
const Double_t  backalpha,
const Double_t  backsn2 
) [virtual]

Definition at line 1872 of file NuMatrixMethod.cxx.

Referenced by NuMatrixFitter::DoCCFitChargeCut().

01876 {
01877   //sn2 is now sin^{2}theta, not sin^{2}2theta
01878 
01879   //applies osc to "T"
01880   this->DecayFD(alpha,sn2);
01881 
01882   //does true to reco on osc true spectrum
01883   this->TrueToRecoFD();
01884 
01885   this->PurityCorrectFDBackgroundDecayCombined(backalpha,backsn2);
01886 
01887   //give back the final oscillated reco energy spectrum with all
01888   //contaminations
01889   return fRecoEnergyPred_FD;
01890 }

const TH1D * NuMatrixMethod::PredictFDDecaySpectrumBackgroundNoOsc ( const Double_t  alpha,
const Double_t  sn2 
) [virtual]

Definition at line 1704 of file NuMatrixMethod.cxx.

Referenced by NuMatrixFitter::DoNoChargeCutFit(), and NuMatrixFitter::DoPRLCCFit().

01706 {
01707   this->DecayFD(alpha,sn2);
01708   this->TrueToRecoFD();
01709   this->PurityCorrectFDBackgroundNoOsc();
01710   return fRecoEnergyPred_FD;
01711 }

const TH1D * NuMatrixMethod::PredictFDDecoherenceSpectrumBackgroundDecohereCombined ( const Double_t  mu2,
const Double_t  sn2,
const Double_t  backmu2,
const Double_t  backsn2,
const Double_t  dm2 = 0,
const Double_t  backdm2 = 0 
) [virtual]

Definition at line 1894 of file NuMatrixMethod.cxx.

Referenced by NuMatrixFitter::DoCCFitChargeCut().

01900 {
01901   //sn2 is now sin^{2}theta, not sin^{2}2theta
01902 
01903   //applies osc to "T"
01904   this->DecohereFD(mu2,sn2,dm2);
01905 
01906   //does true to reco on osc true spectrum
01907   this->TrueToRecoFD();
01908 
01909   this->PurityCorrectFDBackgroundDecohereCombined(backmu2,backsn2,backdm2);
01910 
01911   //give back the final oscillated reco energy spectrum with all
01912   //contaminations
01913   return fRecoEnergyPred_FD;
01914 }

const TH1D * NuMatrixMethod::PredictFDDecoherenceSpectrumBackgroundNoOsc ( const Double_t  mu2,
const Double_t  sn2,
const Double_t  dm2 = 0 
) [virtual]

Definition at line 1715 of file NuMatrixMethod.cxx.

Referenced by NuMatrixFitter::DoNoChargeCutFit(), and NuMatrixFitter::DoPRLCCFit().

01718 {
01719   this->DecohereFD(mu2,sn2,dm2);
01720   this->TrueToRecoFD();
01721   this->PurityCorrectFDBackgroundNoOsc();
01722   return fRecoEnergyPred_FD;
01723 }

void NuMatrixMethod::PredictFDFluxUnosc (  )  [virtual]

This gets the FD true EVENT spectrum (reco is done later)

Definition at line 1614 of file NuMatrixMethod.cxx.

References CalculateNCContamination(), EfficiencyCorrectFD(), EfficiencyCorrectND(), ExtrapolateNDToFD(), fextrpScheme, NuMMExtrapolation::kPRLCCAnalysis, PotentialTausTrueEnergy(), PurityCorrectND(), RecoToTrueND(), ResetUnoscHistograms(), UnoscPurityCorrectFD(), UnoscTrueToRecoFD(), XSecCorrectFD(), and XSecCorrectND().

Referenced by NuMatrixFitter::AppearanceAnalysis(), NuMatrixFitter::CCAnalysis(), NuMatrixFitter::CPTAnalysis(), NuMatrixFitter::WriteHistosForFitter(), NuMatrixFitter::WriteNoChargeCutHistosForFitter(), and NuMatrixFitter::WritePRLCCHistosForFitter().

01615 {
01617 
01618   //just zero everything
01619   this->ResetUnoscHistograms();
01620 
01621   //subtract background
01622   this->PurityCorrectND();
01623 
01624   //convert ND reco spectrum into true spectrum
01625   this->RecoToTrueND();
01626 
01627   //correct for eff. in true energy
01628   //numerator is true CC events reco'd in the fid vol that pass all cuts
01629   //denominator is true CC events with true vtx in fid vol
01630   //hence efficiency can be >1 if more leak-in than leak-out
01631   this->EfficiencyCorrectND();
01632 
01633   //convert to flux (divide by NDmass, NDpot, xsec (xsec only if not
01634   //doing combined extrapolation))
01635   this->XSecCorrectND();
01636 
01637   //APPLY THE BEAM MATRIX
01638   this->ExtrapolateNDToFD();
01639 
01640   //covert from flux to events (times by FDmass, FDpot and xsec). Only
01641   //if fDoXSecStep == true are the cross sections included: for a
01642   //combined numu+numubar extrapolation, the cross sections are
01643   //included in the beam matrix.
01644   this->XSecCorrectFD();
01645 
01646   //correct for eff. in true energy
01647   //numerator is true CC events reco'd in the fid vol that pass all cuts
01648   //denominator is true CC events with true vtx in fid vol
01649   //hence efficiency can be >1 if more leak-in than leak-out
01650   //The "T" spectrum to pass out to external fitter is now created
01651   this->EfficiencyCorrectFD();
01652 
01654   //Now create the Z spectrum (NC events)
01655   //apply true to reco matrix to get pure reco CC spectrum
01656   this->UnoscTrueToRecoFD();
01657 
01658   //divide by overall purity to get the actual unoscillated FD spectrum
01659   this->UnoscPurityCorrectFD();
01660 
01661   //take unoscillated FD spectrum and times by NC contamination
01662   //to get the NC spectrum
01663   //The "Z" spectrum to pass out to external fitter is now created
01664   this->CalculateNCContamination();
01665   
01667   //Calculate the true energy tau spectrum as if every numu has turned
01668   //into a tau (only do for PRL-style analysis so far)
01669   if (NuMMExtrapolation::kPRLCCAnalysis == fextrpScheme){
01670     this->PotentialTausTrueEnergy();
01671   }
01672 }

const TH1D * NuMatrixMethod::PredictFDSpectrumAppearance ( const Double_t  dm2,
const Double_t  sn2,
const Double_t  backdm2,
const Double_t  backsn2,
const Double_t  appearanceFraction 
) [virtual]

Definition at line 1740 of file NuMatrixMethod.cxx.

Referenced by NuMatrixFitter::AppearanceAnalysis().

01745 {
01746   this->OscillateFD(dm2,sn2);
01747   this->AddInAppearedEvents(backdm2,backsn2,appearanceFraction);
01748   this->TrueToRecoFD();
01749   this->PurityCorrectFDBackgroundOscCombined(backdm2,backsn2);
01750   return fRecoEnergyPred_FD;
01751 }

const TH1D * NuMatrixMethod::PredictFDSpectrumBackgroundNoOsc ( const Double_t  dm2,
const Double_t  sn2 
) [virtual]

Definition at line 1676 of file NuMatrixMethod.cxx.

Referenced by NuMatrixFitter::CCAnalysis(), NuMatrixFitter::DoNoChargeCutFit(), and NuMatrixFitter::DoPRLCCFit().

01678 {
01679   this->OscillateFD(dm2,sn2);
01680   //Get the true tau spectrum
01681   TH1D trueTauSpectrum = this->InverseOscillate(*fEffCorTau_FD,dm2,sn2);
01682   //true to reco the numus:
01683   this->TrueToRecoFD();
01684   //true to reco the taus:
01685   TH1D recoTauSpectrum = this->TrueToReco(trueTauSpectrum,
01686                                           *fRecoVsTrueEnergyTau_FD);
01687   //Add in the NCs
01688   this->PurityCorrectFDBackgroundNoOsc();
01689   //Add in the taus
01690   TH1D finalPrediction = this->AddInImpurity(*fRecoEnergyPred_FD,
01691                                              recoTauSpectrum);
01692   
01693   //This line is if I don't want taus:
01694   //       TH1D finalPrediction = *fRecoEnergyPred_FD;
01695   
01696   //Put the answer somewhere I can get to it later
01697   if (fRecoEnergyPred_FD){delete fRecoEnergyPred_FD; fRecoEnergyPred_FD=0;}
01698   fRecoEnergyPred_FD = new TH1D(finalPrediction);
01699   return fRecoEnergyPred_FD;
01700 }

const TH1D * NuMatrixMethod::PredictFDSpectrumBackgroundOscCombined ( const Double_t  dm2,
const Double_t  sn2,
const Double_t  backdm2,
const Double_t  backsn2 
) [virtual]

Definition at line 1852 of file NuMatrixMethod.cxx.

Referenced by NuMatrixFitter::CPTAnalysis(), NuMatrixFitter::DoCCFitChargeCut(), and NuMatrixFitter::WriteHistosForFitter().

01856 {
01857   //applies osc to "T"
01858   this->OscillateFD(dm2,sn2);
01859 
01860   //does true to reco on osc true spectrum
01861   this->TrueToRecoFD();
01862 
01863   this->PurityCorrectFDBackgroundOscCombined(backdm2,backsn2);
01864 
01865   //give back the final oscillated reco energy spectrum with all
01866   //contaminations
01867   return fRecoEnergyPred_FD;
01868 }

const TH1D * NuMatrixMethod::PredictFDSpectrumBackgroundOscUncombined ( const Double_t  dm2,
const Double_t  sn2,
const Double_t  backdm2,
const Double_t  backsn2 
) [virtual]

Definition at line 1727 of file NuMatrixMethod.cxx.

References fRecoEnergyPred_FD, OscillateFD(), PurityCorrectFDBackgroundOscUncombined(), and TrueToRecoFD().

01731 {
01732   this->OscillateFD(dm2,sn2);
01733   this->TrueToRecoFD();
01734   this->PurityCorrectFDBackgroundOscUncombined(backdm2,backsn2);
01735   return fRecoEnergyPred_FD;
01736 }

void NuMatrixMethod::PurityCorrectFDBackgroundDecayCombined ( Double_t  alphaBack,
Double_t  sn2Back 
) [private, virtual]

Definition at line 2469 of file NuMatrixMethod.cxx.

References fFDDistance, fNRecoBins, fNTrueBins, fRecoBinEdges, fRecoEnergyOsc_FD, fRecoEnergyPred_FD, fRecoUnoscNCBackground_FD, fSuppliedTrueUnoscCCBackground_FD, fTrueBinEdges, fTrueToRecoCCContamination_FD, and Munits::km.

02471 {
02472   //10: Correct for purity assuming the background can oscillate.
02473   //Use true CC background calculated from the extrapolation of the
02474   //other spectrum.
02475 
02476   //working space:
02477   Double_t *val = new Double_t[fNRecoBins+1];
02478   Double_t *valerr = new Double_t[fNRecoBins+1];
02479 
02480   //C: Oscillated CC background:
02481   TH1D hTrueOscCCBackground_FD
02482     ("hTrueOscCCBackground_FD",
02483      "True energy oscillated CC background prediction",
02484      fNTrueBins,fTrueBinEdges);
02485   for(int i=1;i<=fNTrueBins;i++) {
02486     Double_t energy = hTrueOscCCBackground_FD.GetBinCenter(i);
02487     Double_t oscProb =
02488       TMath::Power
02489       (sn2Back + (1.0-sn2Back)*exp(-(alphaBack*fFDDistance/Munits::km)/(2*energy)),
02490        2);
02491     hTrueOscCCBackground_FD.
02492       SetBinContent(i,fSuppliedTrueUnoscCCBackground_FD->GetBinContent(i)*oscProb);
02493     hTrueOscCCBackground_FD.
02494       SetBinError(i,fSuppliedTrueUnoscCCBackground_FD->GetBinError(i)*oscProb);
02495   }
02496 
02497   //D: True->Reco CC background:
02498   TH1D hRecoOscCCBackground_FD
02499     ("hRecoOscCCBackground_FD",
02500      "Reco energy oscillated CC background prediction",
02501      fNRecoBins,fRecoBinEdges);
02502   
02503   for(int i=1;i<=fNRecoBins;i++) { val[i-1] = 0; valerr[i-1] = 0; }
02504   for(int i=1;i<=fNTrueBins;i++){ //loop over true
02505     for(int j=1;j<=fNRecoBins+1;j++){ //loop over reco
02506       val[j-1] += ( hTrueOscCCBackground_FD.GetBinContent(i) *
02507                     fTrueToRecoCCContamination_FD->GetBinContent(i,j));
02508       
02509       Double_t error = 0;
02510       if(hTrueOscCCBackground_FD.GetBinContent(i)>0 &&
02511          fTrueToRecoCCContamination_FD->GetBinContent(i,j)>0) {
02512         error = TMath::Power(hTrueOscCCBackground_FD.GetBinError(i)/
02513                              hTrueOscCCBackground_FD.GetBinContent(i),2);
02514         error += TMath::Power(fTrueToRecoCCContamination_FD->GetBinError(i,j)/
02515                               fTrueToRecoCCContamination_FD->GetBinContent(i,j),2);
02516         error *= TMath::Power(hTrueOscCCBackground_FD.GetBinContent(i) * 
02517                               fTrueToRecoCCContamination_FD->GetBinContent(i,j),2);
02518       }
02519       valerr[j-1] += error;
02520       
02521     }
02522   }
02523   for(int i=1;i<=fNRecoBins+1;i++) {
02524     hRecoOscCCBackground_FD.SetBinContent(i,val[i-1]);
02525     if(valerr[i-1]>0) hRecoOscCCBackground_FD.SetBinError(i,TMath::Sqrt(valerr[i-1]));
02526     else hRecoOscCCBackground_FD.SetBinError(i,0);
02527   }
02528 
02529   //F: Add the NC & oscillated CC backgrounds to the FD prediction:
02530   for(int i=1;i<=fNRecoBins+1;i++){
02531     fRecoEnergyPred_FD->
02532       SetBinContent(i,
02533                     fRecoEnergyOsc_FD->GetBinContent(i) +
02534                     fRecoUnoscNCBackground_FD->GetBinContent(i) +
02535                     hRecoOscCCBackground_FD.GetBinContent(i)
02536                     );
02537     Double_t error = 0.0;
02538     error +=
02539       TMath::Power(fRecoEnergyOsc_FD->GetBinError(i),2);
02540     error +=
02541       TMath::Power(fRecoUnoscNCBackground_FD->GetBinError(i),2);
02542     error +=
02543       TMath::Power(hRecoOscCCBackground_FD.GetBinError(i),2);
02544     if (error > 0){
02545       fRecoEnergyPred_FD->SetBinError(i, TMath::Sqrt(error));
02546     }
02547     else{
02548       fRecoEnergyPred_FD->SetBinError(i, 0);
02549     }
02550   }
02551 }

void NuMatrixMethod::PurityCorrectFDBackgroundDecohereCombined ( Double_t  mu2Back,
Double_t  sn2Back,
Double_t  dm2Back = 0 
) [private, virtual]

Definition at line 2555 of file NuMatrixMethod.cxx.

References NuOscProbCalc::DecoherenceWeight(), fNRecoBins, fNTrueBins, fRecoBinEdges, fRecoEnergyOsc_FD, fRecoEnergyPred_FD, fRecoUnoscNCBackground_FD, fSuppliedTrueUnoscCCBackground_FD, fTrueBinEdges, and fTrueToRecoCCContamination_FD.

02558 {
02559   //10: Correct for purity assuming the background can oscillate.
02560   //Use true CC background calculated from the extrapolation of the
02561   //other spectrum.
02562 
02563   //working space:
02564   Double_t *val = new Double_t[fNRecoBins+1];
02565   Double_t *valerr = new Double_t[fNRecoBins+1];
02566 
02567   //C: Oscillated CC background:
02568   TH1D hTrueOscCCBackground_FD
02569     ("hTrueOscCCBackground_FD",
02570      "True energy oscillated CC background prediction",
02571      fNTrueBins,fTrueBinEdges);
02572   for(int i=1;i<=fNTrueBins;i++) {
02573     Double_t energy = hTrueOscCCBackground_FD.GetBinCenter(i);
02574     Double_t oscProb = NuOscProbCalc::DecoherenceWeight(energy, mu2Back, sn2Back, dm2Back);
02575     hTrueOscCCBackground_FD.
02576       SetBinContent(i,fSuppliedTrueUnoscCCBackground_FD->GetBinContent(i)*oscProb);
02577     hTrueOscCCBackground_FD.
02578       SetBinError(i,fSuppliedTrueUnoscCCBackground_FD->GetBinError(i)*oscProb);
02579   }
02580 
02581   //D: True->Reco CC background:
02582   TH1D hRecoOscCCBackground_FD
02583     ("hRecoOscCCBackground_FD",
02584      "Reco energy oscillated CC background prediction",
02585      fNRecoBins,fRecoBinEdges);
02586   
02587   for(int i=1;i<=fNRecoBins;i++) { val[i-1] = 0; valerr[i-1] = 0; }
02588   for(int i=1;i<=fNTrueBins;i++){ //loop over true
02589     for(int j=1;j<=fNRecoBins+1;j++){ //loop over reco
02590       val[j-1] += ( hTrueOscCCBackground_FD.GetBinContent(i) *
02591                     fTrueToRecoCCContamination_FD->GetBinContent(i,j));
02592       
02593       Double_t error = 0;
02594       if(hTrueOscCCBackground_FD.GetBinContent(i)>0 &&
02595          fTrueToRecoCCContamination_FD->GetBinContent(i,j)>0) {
02596         error = TMath::Power(hTrueOscCCBackground_FD.GetBinError(i)/
02597                              hTrueOscCCBackground_FD.GetBinContent(i),2);
02598         error += TMath::Power(fTrueToRecoCCContamination_FD->GetBinError(i,j)/
02599                               fTrueToRecoCCContamination_FD->GetBinContent(i,j),2);
02600         error *= TMath::Power(hTrueOscCCBackground_FD.GetBinContent(i) * 
02601                               fTrueToRecoCCContamination_FD->GetBinContent(i,j),2);
02602       }
02603       valerr[j-1] += error;
02604       
02605     }
02606   }
02607   for(int i=1;i<=fNRecoBins+1;i++) {
02608     hRecoOscCCBackground_FD.SetBinContent(i,val[i-1]);
02609     if(valerr[i-1]>0) hRecoOscCCBackground_FD.SetBinError(i,TMath::Sqrt(valerr[i-1]));
02610     else hRecoOscCCBackground_FD.SetBinError(i,0);
02611   }
02612 
02613   //F: Add the NC & oscillated CC backgrounds to the FD prediction:
02614   for(int i=1;i<=fNRecoBins+1;i++){
02615     fRecoEnergyPred_FD->
02616       SetBinContent(i,
02617                     fRecoEnergyOsc_FD->GetBinContent(i) +
02618                     fRecoUnoscNCBackground_FD->GetBinContent(i) +
02619                     hRecoOscCCBackground_FD.GetBinContent(i)
02620                     );
02621     Double_t error = 0.0;
02622     error +=
02623       TMath::Power(fRecoEnergyOsc_FD->GetBinError(i),2);
02624     error +=
02625       TMath::Power(fRecoUnoscNCBackground_FD->GetBinError(i),2);
02626     error +=
02627       TMath::Power(hRecoOscCCBackground_FD.GetBinError(i),2);
02628     if (error > 0){
02629       fRecoEnergyPred_FD->SetBinError(i, TMath::Sqrt(error));
02630     }
02631     else{
02632       fRecoEnergyPred_FD->SetBinError(i, 0);
02633     }
02634   }
02635 }

void NuMatrixMethod::PurityCorrectFDBackgroundNoOsc (  )  [private, virtual]

Definition at line 2081 of file NuMatrixMethod.cxx.

References fextrpScheme, fPurity_FD, fRecoEnergyNoOscPred_FD, fRecoEnergyOsc_FD, fRecoEnergyPred_FD, fRecoUnoscNCBackground_FD, NuMMExtrapolation::kModularNoChargeCutFit, and NuMMExtrapolation::kModularPRLCCFit.

02082 {
02083   //10: Correct for purity (need to use noosc histogram to add 
02084   //    back in background otherwise it will be underestimated!):
02085   // THIS ONLY WORKS UNDER THE ASSUMPTION THAT YOUR BACKGROUND
02086   // DOES NOT OSCILLATE!
02087   // Background = ND, nutau CC, numubar CC, nue CC
02088   
02089   if (NuMMExtrapolation::kModularNoChargeCutFit == fextrpScheme ||
02090       NuMMExtrapolation::kModularPRLCCFit == fextrpScheme){
02091     for(int i=1;i<=fRecoEnergyPred_FD->GetNbinsX()+1;i++){
02092       fRecoEnergyPred_FD->
02093         SetBinContent(i,
02094                       fRecoEnergyOsc_FD->GetBinContent(i) +
02095                       fRecoUnoscNCBackground_FD->GetBinContent(i)
02096                       );
02097       Double_t error = 0.0;
02098       error +=
02099         TMath::Power(fRecoEnergyOsc_FD->GetBinError(i),2);
02100       error +=
02101         TMath::Power(fRecoUnoscNCBackground_FD->GetBinError(i),2);
02102       if (error > 0){
02103         fRecoEnergyPred_FD->SetBinError(i, TMath::Sqrt(error));
02104       }
02105       else{
02106         fRecoEnergyPred_FD->SetBinError(i, 0);
02107       }
02108     }
02109   }
02110   else{
02111     for(int i=1;i<=fRecoEnergyPred_FD->GetNbinsX()+1;i++){
02112       fRecoEnergyPred_FD->
02113         SetBinContent(i,fRecoEnergyOsc_FD->GetBinContent(i) +
02114                       fRecoEnergyNoOscPred_FD->GetBinContent(i) *
02115                       (1. - fPurity_FD->GetBinContent(i)));
02116       
02117       
02118       Double_t error = 0;
02119       if(fRecoEnergyNoOscPred_FD->GetBinContent(i)>0 &&
02120          (1.-fPurity_FD->GetBinContent(i))>0) {
02121         
02122         Double_t error =
02123           TMath::Power(fRecoEnergyNoOscPred_FD->GetBinError(i)/
02124                        fRecoEnergyNoOscPred_FD->GetBinContent(i),
02125                        2);
02126         error += TMath::Power(fPurity_FD->GetBinError(i) /
02127                               (1. - fPurity_FD->GetBinContent(i)),
02128                               2);
02129         error = error*TMath::Power(fRecoEnergyNoOscPred_FD->GetBinContent(i) *
02130                                    (1. - fPurity_FD->GetBinContent(i)),
02131                                    2);
02132       }
02133       error += TMath::Power(fRecoEnergyOsc_FD->GetBinError(i),2);
02134       if(error>0) fRecoEnergyPred_FD->SetBinError(i,TMath::Sqrt(error));
02135       else fRecoEnergyPred_FD->SetBinError(i,0);   
02136     }
02137   }
02138 }

void NuMatrixMethod::PurityCorrectFDBackgroundOscCombined ( Double_t  dm2Back,
Double_t  sn2Back 
) [private, virtual]

Definition at line 2356 of file NuMatrixMethod.cxx.

References fNRecoBins, fNTrueBins, fRecoBinEdges, fRecoEnergyOsc_FD, fRecoEnergyPred_FD, fRecoUnoscNCBackground_FD, fSuppliedTrueUnoscCCBackground_FD, fTrueBinEdges, fTrueToRecoCCContamination_FD, and NuOscProbCalc::OscillationWeight().

02358 {
02359   //10: Correct for purity assuming the background can oscillate.
02360   //Use true CC background calculated from the extrapolation of the
02361   //other spectrum.
02362 
02363   //working space:
02364   Double_t *val = new Double_t[fNRecoBins+1];
02365   Double_t *valerr = new Double_t[fNRecoBins+1];
02366 
02367   //C: Oscillated CC background:
02368   TH1D hTrueOscCCBackground_FD
02369     ("hTrueOscCCBackground_FD",
02370      "True energy oscillated CC background prediction",
02371      fNTrueBins,fTrueBinEdges);
02372   for(int i=1;i<=fNTrueBins;i++) {
02373     Double_t energy = hTrueOscCCBackground_FD.GetBinCenter(i);
02374     Double_t oscProb = NuOscProbCalc::OscillationWeight(energy, dm2Back, sn2Back);
02375     hTrueOscCCBackground_FD.
02376       SetBinContent(i,fSuppliedTrueUnoscCCBackground_FD->GetBinContent(i)*oscProb);
02377     hTrueOscCCBackground_FD.
02378       SetBinError(i,fSuppliedTrueUnoscCCBackground_FD->GetBinError(i)*oscProb);
02379   }
02380 
02381   //D: True->Reco CC background:
02382   TH1D hRecoOscCCBackground_FD
02383     ("hRecoOscCCBackground_FD",
02384      "Reco energy oscillated CC background prediction",
02385      fNRecoBins,fRecoBinEdges);
02386   
02387   for(int i=1;i<=fNRecoBins;i++) { val[i-1] = 0; valerr[i-1] = 0; }
02388   for(int i=1;i<=fNTrueBins;i++){ //loop over true
02389     for(int j=1;j<=fNRecoBins+1;j++){ //loop over reco
02390       val[j-1] += ( hTrueOscCCBackground_FD.GetBinContent(i) *
02391                     fTrueToRecoCCContamination_FD->GetBinContent(i,j));
02392       
02393       Double_t error = 0;
02394       if(hTrueOscCCBackground_FD.GetBinContent(i)>0 &&
02395          fTrueToRecoCCContamination_FD->GetBinContent(i,j)>0) {
02396         error = TMath::Power(hTrueOscCCBackground_FD.GetBinError(i)/
02397                              hTrueOscCCBackground_FD.GetBinContent(i),2);
02398         error += TMath::Power(fTrueToRecoCCContamination_FD->GetBinError(i,j)/
02399                               fTrueToRecoCCContamination_FD->GetBinContent(i,j),2);
02400         error *= TMath::Power(hTrueOscCCBackground_FD.GetBinContent(i) * 
02401                               fTrueToRecoCCContamination_FD->GetBinContent(i,j),2);
02402       }
02403       valerr[j-1] += error;
02404       
02405     }
02406   }
02407   for(int i=1;i<=fNRecoBins+1;i++) {
02408     hRecoOscCCBackground_FD.SetBinContent(i,val[i-1]);
02409     if(valerr[i-1]>0) hRecoOscCCBackground_FD.SetBinError(i,TMath::Sqrt(valerr[i-1]));
02410     else hRecoOscCCBackground_FD.SetBinError(i,0);
02411   }
02412 
02413   //E: Calculate unoscillated FD NC contamination:
02414   /*
02415     //moved to CalculateNCContamination()
02416   TH1D hRecoUnoscNCBackground_FD
02417     ("hUnoscNCBackground_FD",
02418      "Reco energy unoscillated NC background prediction",
02419      fNRecoBins,fRecoBinEdges);
02420 
02421   for(int i=1;i<=fNRecoBins+1;i++){
02422     fRecoUnoscNCBackground_FD->
02423       SetBinContent(i,
02424                     fRecoEnergyNoOscPred_FD->GetBinContent(i)*
02425                     fNCContamination_FD->GetBinContent(i)
02426                     );
02427 
02428     if(fRecoEnergyNoOscPred_FD->GetBinContent(i)>0 &&
02429        fNCContamination_FD->GetBinContent(i)>0) {
02430       Double_t error =
02431         TMath::Power(fRecoEnergyNoOscPred_FD->GetBinError(i) / 
02432                      fRecoEnergyNoOscPred_FD->GetBinContent(i),2);
02433       error += TMath::Power(fNCContamination_FD->GetBinError(i) / 
02434                             fNCContamination_FD->GetBinContent(i),2);
02435       error =
02436         TMath::Sqrt(error) * fRecoUnoscNCBackground_FD->GetBinContent(i);
02437       fRecoUnoscNCBackground_FD->SetBinError(i,error);  
02438     }
02439     else fRecoUnoscNCBackground_FD->SetBinError(i,0);
02440   }
02441   */
02442 
02443   //F: Add the NC & oscillated CC backgrounds to the FD prediction:
02444   for(int i=1;i<=fNRecoBins+1;i++){
02445     fRecoEnergyPred_FD->
02446       SetBinContent(i,
02447                     fRecoEnergyOsc_FD->GetBinContent(i) +
02448                     fRecoUnoscNCBackground_FD->GetBinContent(i) +
02449                     hRecoOscCCBackground_FD.GetBinContent(i)
02450                     );
02451     Double_t error = 0.0;
02452     error +=
02453       TMath::Power(fRecoEnergyOsc_FD->GetBinError(i),2);
02454     error +=
02455       TMath::Power(fRecoUnoscNCBackground_FD->GetBinError(i),2);
02456     error +=
02457       TMath::Power(hRecoOscCCBackground_FD.GetBinError(i),2);
02458     if (error > 0){
02459       fRecoEnergyPred_FD->SetBinError(i, TMath::Sqrt(error));
02460     }
02461     else{
02462       fRecoEnergyPred_FD->SetBinError(i, 0);
02463     }
02464   }
02465 }

void NuMatrixMethod::PurityCorrectFDBackgroundOscUncombined ( Double_t  dm2Back,
Double_t  sn2Back 
) [private, virtual]

Definition at line 2171 of file NuMatrixMethod.cxx.

References fCCContamination_FD, fNRecoBins, fNTrueBins, fRecoBinEdges, fRecoEnergyNoOscPred_FD, fRecoEnergyOsc_FD, fRecoEnergyPred_FD, fRecoToTrueCCContamination_FD, fRecoUnoscNCBackground_FD, fTrueBinEdges, fTrueToRecoCCContamination_FD, and NuOscProbCalc::OscillationWeight().

Referenced by PredictFDSpectrumBackgroundOscUncombined().

02173 {
02174   //10: Correct for purity assuming the background can oscillate.
02175   //Perform reco->true->oscillate->reco on the CC background.
02176 
02177   //working space:
02178   Double_t *val = new Double_t[fNTrueBins+1];
02179   Double_t *valerr = new Double_t[fNTrueBins+1];
02180 
02181   //A: Calculate unoscillated FD CC contamination:
02182   TH1D hRecoUnoscCCBackground_FD
02183     ("hUnoscCCBackground_FD",
02184      "Reco energy unoscillated CC background prediction",
02185      fNRecoBins,fRecoBinEdges);
02186 
02187   for(int i=1;i<=fNRecoBins+1;i++){
02188     hRecoUnoscCCBackground_FD.
02189       SetBinContent(i,
02190                     fRecoEnergyNoOscPred_FD->GetBinContent(i)*
02191                     fCCContamination_FD->GetBinContent(i)
02192                     );
02193 
02194     if(fRecoEnergyNoOscPred_FD->GetBinContent(i)>0 &&
02195        fCCContamination_FD->GetBinContent(i)>0) {
02196       Double_t error =
02197         TMath::Power(fRecoEnergyNoOscPred_FD->GetBinError(i) / 
02198                      fRecoEnergyNoOscPred_FD->GetBinContent(i),2);
02199       error += TMath::Power(fCCContamination_FD->GetBinError(i) / 
02200                             fCCContamination_FD->GetBinContent(i),2);
02201       error =
02202         TMath::Sqrt(error) * hRecoUnoscCCBackground_FD.GetBinContent(i);
02203       hRecoUnoscCCBackground_FD.SetBinError(i,error);   
02204     }
02205     else hRecoUnoscCCBackground_FD.SetBinError(i,0);
02206   }
02207   
02208   //B: Get true energy spectrum of FD unoscillated CC contamination:
02209   TH1D hTrueUnoscCCBackground_FD
02210     ("fTrueUnoscCCBackground_FD",
02211      "True energy unoscillated CC background prediction",
02212      fNTrueBins,fTrueBinEdges);
02213 
02214   for(int i=1;i<=fNTrueBins;i++) { val[i-1] = 0; valerr[i-1] = 0; }
02215   for(int i=1;i<=fNRecoBins+1;i++){
02216     //loop over reco dimension
02217     //include overflow
02218     for(int j=1;j<=fNTrueBins;j++){
02219       //loop over true dimension
02220       val[j-1] += ( hRecoUnoscCCBackground_FD.GetBinContent(i) * 
02221                     fRecoToTrueCCContamination_FD->GetBinContent(j,i) );
02222       Double_t error = 0;
02223       if(hRecoUnoscCCBackground_FD.GetBinContent(i)>0 &&
02224          fRecoToTrueCCContamination_FD->GetBinContent(j,i)>0) {
02225         error =
02226           TMath::Power(hRecoUnoscCCBackground_FD.GetBinError(i)/
02227                        hRecoUnoscCCBackground_FD.GetBinContent(i),2);
02228         error +=
02229           TMath::Power(fRecoToTrueCCContamination_FD->GetBinError(j,i)/
02230                        fRecoToTrueCCContamination_FD->GetBinContent(j,i),2);
02231         error *=
02232           TMath::Power(hRecoUnoscCCBackground_FD.GetBinContent(i) * 
02233                        fRecoToTrueCCContamination_FD->GetBinContent(j,i),2);
02234       }
02235       valerr[j-1] += error;
02236     }
02237   }
02238   for(int i=1;i<=fNTrueBins;i++) {
02239     hTrueUnoscCCBackground_FD.SetBinContent(i,val[i-1]);
02240     hTrueUnoscCCBackground_FD.SetBinError(i,TMath::Sqrt(valerr[i-1]));
02241   }
02242 
02243   //C: Oscillated CC background:
02244   TH1D hTrueOscCCBackground_FD
02245     ("hTrueOscCCBackground_FD",
02246      "True energy oscillated CC background prediction",
02247      fNTrueBins,fTrueBinEdges);
02248   for(int i=1;i<=fNTrueBins;i++) {
02249     Double_t energy = hTrueOscCCBackground_FD.GetBinCenter(i);
02250     Double_t oscProb = NuOscProbCalc::OscillationWeight(energy, dm2Back, sn2Back);
02251     hTrueOscCCBackground_FD.
02252       SetBinContent(i,hTrueUnoscCCBackground_FD.GetBinContent(i)*oscProb);
02253     hTrueOscCCBackground_FD.
02254       SetBinError(i,hTrueUnoscCCBackground_FD.GetBinError(i)*oscProb);
02255   }
02256 
02257   //D: True->Reco CC background:
02258   TH1D hRecoOscCCBackground_FD
02259     ("hRecoOscCCBackground_FD",
02260      "Reco energy oscillated CC background prediction",
02261      fNRecoBins,fRecoBinEdges);
02262   
02263   for(int i=1;i<=fNRecoBins;i++) { val[i-1] = 0; valerr[i-1] = 0; }
02264   for(int i=1;i<=fNTrueBins;i++){ //loop over true
02265     for(int j=1;j<=fNRecoBins+1;j++){ //loop over reco
02266       val[j-1] += ( hTrueOscCCBackground_FD.GetBinContent(i) *
02267                     fTrueToRecoCCContamination_FD->GetBinContent(i,j));
02268       
02269       Double_t error = 0;
02270       if(hTrueOscCCBackground_FD.GetBinContent(i)>0 &&
02271          fTrueToRecoCCContamination_FD->GetBinContent(i,j)>0) {
02272         error = TMath::Power(hTrueOscCCBackground_FD.GetBinError(i)/
02273                              hTrueOscCCBackground_FD.GetBinContent(i),2);
02274         error += TMath::Power(fTrueToRecoCCContamination_FD->GetBinError(i,j)/
02275                               fTrueToRecoCCContamination_FD->GetBinContent(i,j),2);
02276         error *= TMath::Power(hTrueOscCCBackground_FD.GetBinContent(i) * 
02277                               fTrueToRecoCCContamination_FD->GetBinContent(i,j),2);
02278       }
02279       valerr[j-1] += error;
02280       
02281     }
02282   }
02283   for(int i=1;i<=fNRecoBins+1;i++) {
02284     hRecoOscCCBackground_FD.SetBinContent(i,val[i-1]);
02285     if(valerr[i-1]>0) hRecoOscCCBackground_FD.SetBinError(i,TMath::Sqrt(valerr[i-1]));
02286     else hRecoOscCCBackground_FD.SetBinError(i,0);
02287   }
02288 
02289   //E: Calculate unoscillated FD NC contamination:
02290   /*
02291   TH1D hRecoUnoscNCBackground_FD
02292     ("hUnoscNCBackground_FD",
02293      "Reco energy unoscillated NC background prediction",
02294      fNRecoBins,fRecoBinEdges);
02295 
02296   for(int i=1;i<=fNRecoBins+1;i++){
02297     fRecoUnoscNCBackground_FD->
02298       SetBinContent(i,
02299                     fRecoEnergyNoOscPred_FD->GetBinContent(i)*
02300                     fNCContamination_FD->GetBinContent(i)
02301                     );
02302 
02303     if(fRecoEnergyNoOscPred_FD->GetBinContent(i)>0 &&
02304        fNCContamination_FD->GetBinContent(i)>0) {
02305       Double_t error =
02306         TMath::Power(fRecoEnergyNoOscPred_FD->GetBinError(i) / 
02307                      fRecoEnergyNoOscPred_FD->GetBinContent(i),2);
02308       error += TMath::Power(fNCContamination_FD->GetBinError(i) / 
02309                             fNCContamination_FD->GetBinContent(i),2);
02310       error =
02311         TMath::Sqrt(error) * fRecoUnoscNCBackground_FD->GetBinContent(i);
02312       fRecoUnoscNCBackground_FD->SetBinError(i,error);  
02313     }
02314     else fRecoUnoscNCBackground_FD->SetBinError(i,0);
02315   }
02316   */
02317   //F: Add the NC & oscillated CC backgrounds to the FD prediction:
02318   for(int i=1;i<=fNRecoBins+1;i++){
02319     fRecoEnergyPred_FD->
02320       SetBinContent(i,
02321                     fRecoEnergyOsc_FD->GetBinContent(i) +
02322                     fRecoUnoscNCBackground_FD->GetBinContent(i) +
02323                     hRecoOscCCBackground_FD.GetBinContent(i)
02324                     );
02325     Double_t error = 0.0;
02326     error +=
02327       TMath::Power(fRecoEnergyOsc_FD->GetBinError(i),2);
02328     error +=
02329       TMath::Power(fRecoUnoscNCBackground_FD->GetBinError(i),2);
02330     error +=
02331       TMath::Power(hRecoOscCCBackground_FD.GetBinError(i),2);
02332     if (error > 0){
02333       fRecoEnergyPred_FD->SetBinError(i, TMath::Sqrt(error));
02334     }
02335     else{
02336       fRecoEnergyPred_FD->SetBinError(i, 0);
02337     }
02338   }
02339 }

void NuMatrixMethod::PurityCorrectND (  )  [private, virtual]

Definition at line 2653 of file NuMatrixMethod.cxx.

References fNRecoBins, fPurity_ND, fRecoEnergyMeas_ND, and fRecoEnergyPurCor_ND.

Referenced by PredictFDFluxUnosc().

02654 { 
02655   //1: Correct ND reco spectrum for purity
02656   for(int i=1;i<=fNRecoBins+1;i++){
02657     fRecoEnergyPurCor_ND->
02658       SetBinContent(i,fRecoEnergyMeas_ND->GetBinContent(i) *
02659                     fPurity_ND->GetBinContent(i));
02660     if(fRecoEnergyMeas_ND->GetBinContent(i)>0 &&
02661        fPurity_ND->GetBinContent(i)>0) {
02662       Double_t error =
02663         TMath::Power(fRecoEnergyMeas_ND->GetBinError(i) / 
02664                      fRecoEnergyMeas_ND->GetBinContent(i),2);
02665       error += TMath::Power(fPurity_ND->GetBinError(i) / 
02666                             fPurity_ND->GetBinContent(i),2);
02667       error =
02668         TMath::Sqrt(error) * fRecoEnergyPurCor_ND->GetBinContent(i);
02669       fRecoEnergyPurCor_ND->SetBinError(i,error);       
02670     }
02671     else fRecoEnergyPurCor_ND->SetBinError(i,0);
02672   }
02673   return;
02674 }

void NuMatrixMethod::RecoToTrueND (  )  [private, virtual]

Definition at line 2677 of file NuMatrixMethod.cxx.

References fNRecoBins, fNTrueBins, fRecoEnergyPurCor_ND, fRecoVsTrueEnergy_ND, and fTrueEnergyPurCor_ND.

Referenced by PredictFDFluxUnosc().

02678 { 
02679   //working space:
02680   Double_t *val = new Double_t[fNTrueBins+1];
02681   Double_t *valerr = new Double_t[fNTrueBins+1];
02682 
02683   //2: Convert ND spectrum to true energies:
02684   for(int i=1;i<=fNTrueBins;i++) { val[i-1] = 0; valerr[i-1] = 0; }
02685   for(int i=1;i<=fNTrueBins;i++){
02686     //loop over reco dimension
02687     //include overflow
02688     for(int j=1;j<=fNRecoBins;j++){
02689       //loop over true dimension
02690       val[j-1] += ( fRecoEnergyPurCor_ND->GetBinContent(i) * 
02691                     fRecoVsTrueEnergy_ND->GetBinContent(j,i) );
02692       Double_t error = 0;
02693       if(fRecoEnergyPurCor_ND->GetBinContent(i)>0 &&
02694          fRecoVsTrueEnergy_ND->GetBinContent(j,i)>0) {
02695         error =
02696           TMath::Power(fRecoEnergyPurCor_ND->GetBinError(i)/
02697                        fRecoEnergyPurCor_ND->GetBinContent(i),2);
02698         error +=
02699           TMath::Power(fRecoVsTrueEnergy_ND->GetBinError(j,i)/
02700                        fRecoVsTrueEnergy_ND->GetBinContent(j,i),2);
02701         error *=
02702           TMath::Power(fRecoEnergyPurCor_ND->GetBinContent(i) * 
02703                        fRecoVsTrueEnergy_ND->GetBinContent(j,i),2);
02704       }
02705       valerr[j-1] += error;
02706     }
02707   }
02708   for(int i=1;i<=fNTrueBins;i++) {
02709     fTrueEnergyPurCor_ND->SetBinContent(i,val[i-1]);
02710     fTrueEnergyPurCor_ND->SetBinError(i,TMath::Sqrt(valerr[i-1]));
02711   }
02712   return;
02713 }

void NuMatrixMethod::ResetUnoscHistograms (  )  [private, virtual]

Definition at line 2638 of file NuMatrixMethod.cxx.

References fRecoEnergyNoOsc_FD, fRecoEnergyNoOscPred_FD, fRecoEnergyPurCor_ND, fTrueEnergyCC_FD, fTrueEnergyEffCor_FD, fTrueEnergyEffCor_ND, fTrueEnergyFlux_ND, fTrueEnergyMatrix_FD, and fTrueEnergyPurCor_ND.

Referenced by PredictFDFluxUnosc().

02639 {
02640   fRecoEnergyPurCor_ND->Reset();
02641   fTrueEnergyPurCor_ND->Reset();
02642   fTrueEnergyEffCor_ND->Reset();
02643   fTrueEnergyFlux_ND->Reset();
02644   fTrueEnergyMatrix_FD->Reset();
02645   fTrueEnergyCC_FD->Reset();
02646   fTrueEnergyEffCor_FD->Reset();
02647   fRecoEnergyNoOsc_FD->Reset();
02648   fRecoEnergyNoOscPred_FD->Reset();
02649   return;
02650 }

void NuMatrixMethod::SetExtrapolationScheme ( const NuMMExtrapolation::NuMMScheme_t  scheme  )  [virtual]

Definition at line 955 of file NuMatrixMethod.cxx.

References NuMMExtrapolation::kCCNoChargeCut, NuMMExtrapolation::kCCNuMuBarOscBackgroundCombined, NuMMExtrapolation::kCCNuMuBarOscBackgroundUncombined, NuMMExtrapolation::kCCNuMuNoOscBackground, NuMMExtrapolation::kCCNuMuOscBackgroundCombined, NuMMExtrapolation::kCCNuMuOscBackgroundUncombined, and NuMMExtrapolation::kPRLCCAnalysis.

Referenced by NuMatrixFitter::AppearanceAnalysis(), NuMatrixFitter::CCAnalysis(), NuMatrixFitter::CPTAnalysis(), NuMatrixFitter::WriteHistosForFitter(), NuMatrixFitter::WriteMultiRunHistosForFitter(), NuMatrixFitter::WriteNoChargeCutHistosForFitter(), and NuMatrixFitter::WritePRLCCHistosForFitter().

00956 {
00957   fextrpScheme = scheme;
00958   switch (scheme){
00959   case kCCNuMuNoOscBackground:
00960     {
00961       //Get the helper histograms:
00962       TFile* helperFile = new TFile(fhelperfilename.c_str(),"READ");
00963       fRecoVsTrueEnergy_ND = (TH2D*) helperFile->Get("RecoVsTrueEnergy_ND");
00964       fRecoVsTrueEnergy_ND->SetDirectory(0);
00965       fRecoVsTrueEnergy_FD = (TH2D*) helperFile->Get("RecoVsTrueEnergy_FD");
00966       fRecoVsTrueEnergy_FD->SetDirectory(0);
00967       
00968       fFDVsNDMatrixRW = (TH2D*) helperFile->Get("FDVsNDMatrixRW");
00969       if(fFDVsNDMatrixRW) fFDVsNDMatrixRW->SetDirectory(0);
00970       fDoXSecStep = true;
00971       
00972       fEfficiency_ND = (TH1D*) helperFile->Get("Efficiency_ND");
00973       fEfficiency_ND->SetDirectory(0);
00974       fEfficiency_FD = (TH1D*) helperFile->Get("Efficiency_FD");
00975       fEfficiency_FD->SetDirectory(0);
00976       fPurity_ND = (TH1D*) helperFile->Get("Purity_ND");
00977       fPurity_ND->SetDirectory(0);
00978       fPurity_FD = (TH1D*) helperFile->Get("Purity_FD");
00979       fPurity_FD->SetDirectory(0);
00980       
00981       helperFile->Close();
00982       if (helperFile) {delete helperFile; helperFile = 0;}
00983       
00984       //Get cross-sections (numu)
00985       TFile *xsecfile = new TFile(fxsecfilename.c_str(),"READ");
00986       TH1F* XSec_CC = (TH1F*) xsecfile->Get("h_numu_cc_tot");
00987       XSec_CC->SetDirectory(0);
00988       xsecfile->Close();
00989       if (xsecfile){delete xsecfile; xsecfile = 0;}
00990       Float_t *x = new Float_t[XSec_CC->GetNbinsX()];
00991       Float_t *y = new Float_t[XSec_CC->GetNbinsX()];
00992       for(int i=0;i<XSec_CC->GetNbinsX();i++) {
00993         x[i] = XSec_CC->GetBinCenter(i+1);
00994         y[i] = XSec_CC->GetBinContent(i+1);
00995       }
00996       fXSec_CC_Graph = new TGraph(XSec_CC->GetNbinsX(),x,y);
00997       if (x) {delete[] x; x = 0;}
00998       if (y) {delete[] y; y = 0;}
00999       
01000       //Get cross-sections (tau)
01001       xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01002       TH1F* tau_XSec_CC = (TH1F*) xsecfile->Get("h_nutau_cc_tot");
01003       tau_XSec_CC->SetDirectory(0);
01004       xsecfile->Close();
01005       if (xsecfile){delete xsecfile; xsecfile = 0;}
01006       x = new Float_t[tau_XSec_CC->GetNbinsX()];
01007       y = new Float_t[tau_XSec_CC->GetNbinsX()];
01008       for(int i=0;i<tau_XSec_CC->GetNbinsX();i++) {
01009         x[i] = tau_XSec_CC->GetBinCenter(i+1);
01010         y[i] = tau_XSec_CC->GetBinContent(i+1);
01011       }
01012       fTau_XSec_CC_Graph = new TGraph(fNTrueBins,x,y);
01013       if (x) {delete[] x; x = 0;}
01014       if (y) {delete[] y; y = 0;}
01015 
01016       //Get the data:
01017       TFile* ndDataFile = new TFile(fndDataFilename.c_str(), "READ");
01018       fRecoEnergyMeas_ND = (TH1D*) ndDataFile->Get("RecoEnergy_ND");
01019       fRecoEnergyMeas_ND->SetDirectory(0);
01020       ndDataFile->Close();
01021       if (ndDataFile){delete ndDataFile; ndDataFile = 0;}
01022     }
01023     break;
01024   case kCCNuMuOscBackgroundUncombined:
01025     {
01026       //Get the helper histograms:
01027       TFile* helperFile = new TFile(fhelperfilename.c_str(),"READ");
01028       fRecoVsTrueEnergy_ND = (TH2D*) helperFile->Get("RecoVsTrueEnergy_ND");
01029       fRecoVsTrueEnergy_ND->SetDirectory(0);
01030       fRecoVsTrueEnergy_FD = (TH2D*) helperFile->Get("RecoVsTrueEnergy_FD");
01031       fRecoVsTrueEnergy_FD->SetDirectory(0);
01032       
01033       fFDVsNDMatrixRW = (TH2D*) helperFile->Get("FDVsNDMatrixRW");
01034       if(fFDVsNDMatrixRW) fFDVsNDMatrixRW->SetDirectory(0);
01035       fDoXSecStep = true;
01036       
01037       fEfficiency_ND = (TH1D*) helperFile->Get("Efficiency_ND");
01038       fEfficiency_ND->SetDirectory(0);
01039       fEfficiency_FD = (TH1D*) helperFile->Get("Efficiency_FD");
01040       fEfficiency_FD->SetDirectory(0);
01041       fPurity_ND = (TH1D*) helperFile->Get("Purity_ND");
01042       fPurity_ND->SetDirectory(0);
01043       fPurity_FD = (TH1D*) helperFile->Get("Purity_FD");
01044       fPurity_FD->SetDirectory(0);
01045       
01046       fCCContamination_FD = (TH1D*) helperFile->Get("CCContamination_FD");
01047       fCCContamination_FD->SetDirectory(0);
01048       fNCContamination_FD = (TH1D*) helperFile->Get("NCContamination_FD");
01049       fNCContamination_FD->SetDirectory(0);
01050       fRecoToTrueCCContamination_FD = (TH2D*)
01051         helperFile->Get("CCContaminationRecoVsTrue_FD");
01052       fRecoToTrueCCContamination_FD->SetDirectory(0);
01053       fTrueToRecoCCContamination_FD = new TH2D(*fRecoToTrueCCContamination_FD);
01054       fTrueToRecoCCContamination_FD->SetDirectory(0);
01055       fSuppliedTrueUnoscCCBackground_FD = 0;
01056       
01057       helperFile->Close();
01058       if (helperFile) {delete helperFile; helperFile = 0;}
01059       
01060       //Get cross-sections (numu)
01061       TFile *xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01062       TH1F* XSec_CC = (TH1F*) xsecfile->Get("h_numu_cc_tot");
01063       XSec_CC->SetDirectory(0);
01064       xsecfile->Close();
01065       if (xsecfile){delete xsecfile; xsecfile = 0;}
01066       Float_t *x = new Float_t[XSec_CC->GetNbinsX()];
01067       Float_t *y = new Float_t[XSec_CC->GetNbinsX()];
01068       for(int i=0;i<XSec_CC->GetNbinsX();i++) {
01069         x[i] = XSec_CC->GetBinCenter(i+1);
01070         y[i] = XSec_CC->GetBinContent(i+1);
01071       }
01072       fXSec_CC_Graph = new TGraph(XSec_CC->GetNbinsX(),x,y);
01073       if (x) {delete[] x; x = 0;}
01074       if (y) {delete[] y; y = 0;}
01075       
01076       //Get cross-sections (tau)
01077       xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01078       TH1F* tau_XSec_CC = (TH1F*) xsecfile->Get("h_nutau_cc_tot");
01079       tau_XSec_CC->SetDirectory(0);
01080       xsecfile->Close();
01081       if (xsecfile){delete xsecfile; xsecfile = 0;}
01082       x = new Float_t[tau_XSec_CC->GetNbinsX()];
01083       y = new Float_t[tau_XSec_CC->GetNbinsX()];
01084       for(int i=0;i<tau_XSec_CC->GetNbinsX();i++) {
01085         x[i] = tau_XSec_CC->GetBinCenter(i+1);
01086         y[i] = tau_XSec_CC->GetBinContent(i+1);
01087       }
01088       fTau_XSec_CC_Graph = new TGraph(fNTrueBins,x,y);
01089       if (x) {delete[] x; x = 0;}
01090       if (y) {delete[] y; y = 0;}
01091 
01092       //Get the data:
01093       TFile* ndDataFile = new TFile(fndDataFilename.c_str(), "READ");
01094       fRecoEnergyMeas_ND = (TH1D*) ndDataFile->Get("RecoEnergy_ND");
01095       fRecoEnergyMeas_ND->SetDirectory(0);
01096       ndDataFile->Close();
01097       if (ndDataFile){delete ndDataFile; ndDataFile = 0;}
01098     }
01099     break;
01100   case kCCNuMuBarOscBackgroundUncombined:
01101     {
01102       //Get the helper histograms:
01103       TFile* helperFile = new TFile(fhelperfilename.c_str(),"READ");
01104       fRecoVsTrueEnergy_ND = (TH2D*) helperFile->Get("RecoVsTrueEnergyPQ_ND");
01105       fRecoVsTrueEnergy_ND->SetDirectory(0);
01106       fRecoVsTrueEnergy_FD = (TH2D*) helperFile->Get("RecoVsTrueEnergyPQ_FD");
01107       fRecoVsTrueEnergy_FD->SetDirectory(0);
01108       
01109       fFDVsNDMatrixRW = (TH2D*) helperFile->Get("FDVsNDMatrixRWPQ");
01110       if(fFDVsNDMatrixRW) fFDVsNDMatrixRW->SetDirectory(0);
01111       fDoXSecStep = true;
01112       
01113       fEfficiency_ND = (TH1D*) helperFile->Get("EfficiencyPQ_ND");
01114       fEfficiency_ND->SetDirectory(0);
01115       fEfficiency_FD = (TH1D*) helperFile->Get("EfficiencyPQ_FD");
01116       fEfficiency_FD->SetDirectory(0);
01117       fPurity_ND = (TH1D*) helperFile->Get("PurityPQ_ND");
01118       fPurity_ND->SetDirectory(0);
01119       fPurity_FD = (TH1D*) helperFile->Get("PurityPQ_FD");
01120       fPurity_FD->SetDirectory(0);
01121       
01122       fCCContamination_FD = (TH1D*) helperFile->Get("CCContaminationPQ_FD");
01123       fCCContamination_FD->SetDirectory(0);
01124       fNCContamination_FD = (TH1D*) helperFile->Get("NCContaminationPQ_FD");
01125       fNCContamination_FD->SetDirectory(0);
01126       fRecoToTrueCCContamination_FD = (TH2D*)
01127         helperFile->Get("CCContaminationRecoVsTruePQ_FD");
01128       fRecoToTrueCCContamination_FD->SetDirectory(0);
01129       fTrueToRecoCCContamination_FD = new TH2D(*fRecoToTrueCCContamination_FD);
01130       fTrueToRecoCCContamination_FD->SetDirectory(0);
01131       fSuppliedTrueUnoscCCBackground_FD = 0;
01132       
01133       helperFile->Close();
01134       if (helperFile) {delete helperFile; helperFile = 0;}
01135       
01136       //Get cross-sections (numubar)
01137       TFile *xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01138       TH1F* XSec_CC = (TH1F*) xsecfile->Get("h_numubar_cc_tot");
01139       XSec_CC->SetDirectory(0);
01140       xsecfile->Close();
01141       if (xsecfile){delete xsecfile; xsecfile = 0;}
01142       Float_t *x = new Float_t[XSec_CC->GetNbinsX()];
01143       Float_t *y = new Float_t[XSec_CC->GetNbinsX()];
01144       for(int i=0;i<XSec_CC->GetNbinsX();i++) {
01145         x[i] = XSec_CC->GetBinCenter(i+1);
01146         y[i] = XSec_CC->GetBinContent(i+1);
01147       }
01148       fXSec_CC_Graph = new TGraph(XSec_CC->GetNbinsX(),x,y);
01149       if (x) {delete[] x; x = 0;}
01150       if (y) {delete[] y; y = 0;}
01151       
01152       //Get cross-sections (taubar)
01153       xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01154       TH1F* tau_XSec_CC = (TH1F*) xsecfile->Get("h_nutaubar_cc_tot");
01155       tau_XSec_CC->SetDirectory(0);
01156       xsecfile->Close();
01157       if (xsecfile){delete xsecfile; xsecfile = 0;}
01158       x = new Float_t[tau_XSec_CC->GetNbinsX()];
01159       y = new Float_t[tau_XSec_CC->GetNbinsX()];
01160       for(int i=0;i<tau_XSec_CC->GetNbinsX();i++) {
01161         x[i] = tau_XSec_CC->GetBinCenter(i+1);
01162         y[i] = tau_XSec_CC->GetBinContent(i+1);
01163       }
01164       fTau_XSec_CC_Graph = new TGraph(fNTrueBins,x,y);
01165       if (x) {delete[] x; x = 0;}
01166       if (y) {delete[] y; y = 0;}
01167 
01168       //Get the data:
01169       TFile* ndDataFile = new TFile(fndDataFilename.c_str(), "READ");
01170       fRecoEnergyMeas_ND = (TH1D*) ndDataFile->Get("RecoEnergyPQ_ND");
01171       fRecoEnergyMeas_ND->SetDirectory(0);
01172       ndDataFile->Close();
01173       if (ndDataFile){delete ndDataFile; ndDataFile = 0;}
01174     }
01175     break;
01176   case kCCNuMuOscBackgroundCombined:
01177     {
01178       //Get the helper histograms:
01179       TFile* helperFile = new TFile(fhelperfilename.c_str(),"READ");
01180       fRecoVsTrueEnergy_ND = (TH2D*) helperFile->Get("RecoVsTrueEnergy_ND");
01181       fRecoVsTrueEnergy_ND->SetDirectory(0);
01182       fRecoVsTrueEnergy_FD = (TH2D*) helperFile->Get("RecoVsTrueEnergy_FD");
01183       fRecoVsTrueEnergy_FD->SetDirectory(0);
01184       
01185       fFDVsNDMatrixRW = (TH2D*) helperFile->Get("FDVsNDMatrixRW");
01186       if(fFDVsNDMatrixRW) fFDVsNDMatrixRW->SetDirectory(0);
01187       fDoXSecStep = true;
01188       
01189       fEfficiency_ND = (TH1D*) helperFile->Get("Efficiency_ND");
01190       fEfficiency_ND->SetDirectory(0);
01191       fEfficiency_FD = (TH1D*) helperFile->Get("Efficiency_FD");
01192       fEfficiency_FD->SetDirectory(0);
01193       fPurity_ND = (TH1D*) helperFile->Get("Purity_ND");
01194       fPurity_ND->SetDirectory(0);
01195       fPurity_FD = (TH1D*) helperFile->Get("Purity_FD");
01196       fPurity_FD->SetDirectory(0);
01197       
01198       fCCContamination_FD = (TH1D*) helperFile->Get("CCContamination_FD");
01199       fCCContamination_FD->SetDirectory(0);
01200       fNCContamination_FD = (TH1D*) helperFile->Get("NCContamination_FD");
01201       fNCContamination_FD->SetDirectory(0);
01202       fRecoToTrueCCContamination_FD = (TH2D*)
01203         helperFile->Get("CCContaminationRecoVsTrue_FD");
01204       fRecoToTrueCCContamination_FD->SetDirectory(0);
01205       fTrueToRecoCCContamination_FD = new TH2D(*fRecoToTrueCCContamination_FD);
01206       fTrueToRecoCCContamination_FD->SetDirectory(0);
01207       fSuppliedTrueUnoscCCBackground_FD = 0;
01208       fOtherEfficiency_FD = (TH1D*)
01209         helperFile->Get("OtherEfficiency_FD");
01210       fOtherEfficiency_FD->SetDirectory(0);
01211       
01212       helperFile->Close();
01213       if (helperFile) {delete helperFile; helperFile = 0;}
01214       
01215       //Get cross-sections (numu)
01216       TFile *xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01217       TH1F* XSec_CC = (TH1F*) xsecfile->Get("h_numu_cc_tot");
01218       XSec_CC->SetDirectory(0);
01219       xsecfile->Close();
01220       if (xsecfile){delete xsecfile; xsecfile = 0;}
01221       Float_t *x = new Float_t[XSec_CC->GetNbinsX()];
01222       Float_t *y = new Float_t[XSec_CC->GetNbinsX()];
01223       for(int i=0;i<XSec_CC->GetNbinsX();i++) {
01224         x[i] = XSec_CC->GetBinCenter(i+1);
01225         y[i] = XSec_CC->GetBinContent(i+1);
01226       }
01227       fXSec_CC_Graph = new TGraph(XSec_CC->GetNbinsX(),x,y);
01228       if (x) {delete[] x; x = 0;}
01229       if (y) {delete[] y; y = 0;}
01230       
01231       //Get cross-sections (tau)
01232       xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01233       TH1F* tau_XSec_CC = (TH1F*) xsecfile->Get("h_nutau_cc_tot");
01234       tau_XSec_CC->SetDirectory(0);
01235       xsecfile->Close();
01236       if (xsecfile){delete xsecfile; xsecfile = 0;}
01237       x = new Float_t[tau_XSec_CC->GetNbinsX()];
01238       y = new Float_t[tau_XSec_CC->GetNbinsX()];
01239       for(int i=0;i<tau_XSec_CC->GetNbinsX();i++) {
01240         x[i] = tau_XSec_CC->GetBinCenter(i+1);
01241         y[i] = tau_XSec_CC->GetBinContent(i+1);
01242       }
01243       fTau_XSec_CC_Graph = new TGraph(fNTrueBins,x,y);
01244       if (x) {delete[] x; x = 0;}
01245       if (y) {delete[] y; y = 0;}
01246 
01247       //Get the data:
01248       TFile* ndDataFile = new TFile(fndDataFilename.c_str(), "READ");
01249       fRecoEnergyMeas_ND = (TH1D*) ndDataFile->Get("RecoEnergy_ND");
01250       fRecoEnergyMeas_ND->SetDirectory(0);
01251       ndDataFile->Close();
01252       if (ndDataFile){delete ndDataFile; ndDataFile = 0;}
01253     }
01254     break;
01255   case kCCNuMuBarOscBackgroundCombined:
01256     {
01257       //Get the helper histograms:
01258       TFile* helperFile = new TFile(fhelperfilename.c_str(),"READ");
01259       fRecoVsTrueEnergy_ND = (TH2D*) helperFile->Get("RecoVsTrueEnergyPQ_ND");
01260       fRecoVsTrueEnergy_ND->SetDirectory(0);
01261       fRecoVsTrueEnergy_FD = (TH2D*) helperFile->Get("RecoVsTrueEnergyPQ_FD");
01262       fRecoVsTrueEnergy_FD->SetDirectory(0);
01263       
01264       fFDVsNDMatrixRW = (TH2D*) helperFile->Get("FDVsNDMatrixRWPQ");
01265       if(fFDVsNDMatrixRW) fFDVsNDMatrixRW->SetDirectory(0);
01266       fDoXSecStep = true;
01267       
01268       fEfficiency_ND = (TH1D*) helperFile->Get("EfficiencyPQ_ND");
01269       fEfficiency_ND->SetDirectory(0);
01270       fEfficiency_FD = (TH1D*) helperFile->Get("EfficiencyPQ_FD");
01271       fEfficiency_FD->SetDirectory(0);
01272       fPurity_ND = (TH1D*) helperFile->Get("PurityPQ_ND");
01273       fPurity_ND->SetDirectory(0);
01274       fPurity_FD = (TH1D*) helperFile->Get("PurityPQ_FD");
01275       fPurity_FD->SetDirectory(0);
01276       
01277       fCCContamination_FD = (TH1D*) helperFile->Get("CCContaminationPQ_FD");
01278       fCCContamination_FD->SetDirectory(0);
01279       fNCContamination_FD = (TH1D*) helperFile->Get("NCContaminationPQ_FD");
01280       fNCContamination_FD->SetDirectory(0);
01281       fRecoToTrueCCContamination_FD = (TH2D*)
01282         helperFile->Get("CCContaminationRecoVsTruePQ_FD");
01283       fRecoToTrueCCContamination_FD->SetDirectory(0);
01284       fTrueToRecoCCContamination_FD = new TH2D(*fRecoToTrueCCContamination_FD);
01285       fTrueToRecoCCContamination_FD->SetDirectory(0);
01286       fSuppliedTrueUnoscCCBackground_FD = 0;
01287       fOtherEfficiency_FD = (TH1D*)
01288         helperFile->Get("OtherEfficiencyPQ_FD");
01289       fOtherEfficiency_FD->SetDirectory(0);
01290       
01291       helperFile->Close();
01292       if (helperFile) {delete helperFile; helperFile = 0;}
01293       
01294       //Get cross-sections (numubar)
01295       TFile *xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01296       TH1F* XSec_CC = (TH1F*) xsecfile->Get("h_numubar_cc_tot");
01297       XSec_CC->SetDirectory(0);
01298       xsecfile->Close();
01299       if (xsecfile){delete xsecfile; xsecfile = 0;}
01300       Float_t *x = new Float_t[XSec_CC->GetNbinsX()];
01301       Float_t *y = new Float_t[XSec_CC->GetNbinsX()];
01302       for(int i=0;i<XSec_CC->GetNbinsX();i++) {
01303         x[i] = XSec_CC->GetBinCenter(i+1);
01304         y[i] = XSec_CC->GetBinContent(i+1);
01305       }
01306       fXSec_CC_Graph = new TGraph(XSec_CC->GetNbinsX(),x,y);
01307       if (x) {delete[] x; x = 0;}
01308       if (y) {delete[] y; y = 0;}
01309       
01310       //Get cross-sections (taubar)
01311       xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01312       TH1F* tau_XSec_CC = (TH1F*) xsecfile->Get("h_nutaubar_cc_tot");
01313       tau_XSec_CC->SetDirectory(0);
01314       xsecfile->Close();
01315       if (xsecfile){delete xsecfile; xsecfile = 0;}
01316       x = new Float_t[tau_XSec_CC->GetNbinsX()];
01317       y = new Float_t[tau_XSec_CC->GetNbinsX()];
01318       for(int i=0;i<tau_XSec_CC->GetNbinsX();i++) {
01319         x[i] = tau_XSec_CC->GetBinCenter(i+1);
01320         y[i] = tau_XSec_CC->GetBinContent(i+1);
01321       }
01322       fTau_XSec_CC_Graph = new TGraph(fNTrueBins,x,y);
01323       if (x) {delete[] x; x = 0;}
01324       if (y) {delete[] y; y = 0;}
01325 
01326       //Get the data:
01327       TFile* ndDataFile = new TFile(fndDataFilename.c_str(), "READ");
01328       fRecoEnergyMeas_ND = (TH1D*) ndDataFile->Get("RecoEnergyPQ_ND");
01329       fRecoEnergyMeas_ND->SetDirectory(0);
01330       ndDataFile->Close();
01331       if (ndDataFile){delete ndDataFile; ndDataFile = 0;}
01332     }
01333     break;
01334   case kCCNoChargeCut:
01335     {
01336       //Get the helper histograms:
01337       TFile* helperFile = new TFile(fhelperfilename.c_str(),"READ");
01338       fRecoVsTrueEnergy_ND = (TH2D*) helperFile->Get("RecoVsTrueEnergyAll_ND");
01339       fRecoVsTrueEnergy_ND->SetDirectory(0);
01340       fRecoVsTrueEnergy_FD = (TH2D*) helperFile->Get("RecoVsTrueEnergyAll_FD");
01341       fRecoVsTrueEnergy_FD->SetDirectory(0);
01342       
01343       fFDVsNDMatrixRW = (TH2D*) helperFile->Get("FDVsNDMatrixXSecRWAllCC");
01344       if(fFDVsNDMatrixRW) fFDVsNDMatrixRW->SetDirectory(0);
01345       fDoXSecStep = false;
01346       
01347       fEfficiency_ND = (TH1D*) helperFile->Get("EfficiencyAll_ND");
01348       fEfficiency_ND->SetDirectory(0);
01349       fEfficiency_FD = (TH1D*) helperFile->Get("EfficiencyAll_FD");
01350       fEfficiency_FD->SetDirectory(0);
01351       fPurity_ND = (TH1D*) helperFile->Get("PurityAll_ND");
01352       fPurity_ND->SetDirectory(0);
01353       fPurity_FD = (TH1D*) helperFile->Get("PurityAll_FD");
01354       fPurity_FD->SetDirectory(0);
01355       
01356       fNCContamination_FD = new TH1D(*fPurity_FD);
01357       fNCContamination_FD->Reset();
01358       for(int i=1;i<=fNCContamination_FD->GetNbinsX();i++) {
01359         fNCContamination_FD->SetBinContent(i,1.0);
01360       }
01361       fNCContamination_FD->Add(fPurity_FD,-1.0);
01362       fNCContamination_FD->SetDirectory(0);
01363       
01364       helperFile->Close();
01365       if (helperFile) {delete helperFile; helperFile = 0;}
01366       
01367       //Get cross-sections (numu; unused, I belive)
01368       TFile *xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01369       TH1F* XSec_CC = (TH1F*) xsecfile->Get("h_numu_cc_tot");
01370       XSec_CC->SetDirectory(0);
01371       xsecfile->Close();
01372       if (xsecfile){delete xsecfile; xsecfile = 0;}
01373       Float_t *x = new Float_t[XSec_CC->GetNbinsX()];
01374       Float_t *y = new Float_t[XSec_CC->GetNbinsX()];
01375       for(int i=0;i<XSec_CC->GetNbinsX();i++) {
01376         x[i] = XSec_CC->GetBinCenter(i+1);
01377         y[i] = XSec_CC->GetBinContent(i+1);
01378       }
01379       fXSec_CC_Graph = new TGraph(XSec_CC->GetNbinsX(),x,y);
01380       if (x) {delete[] x; x = 0;}
01381       if (y) {delete[] y; y = 0;}
01382       
01383       //Get cross-sections (tau; again: unused at present)
01384       xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01385       TH1F* tau_XSec_CC = (TH1F*) xsecfile->Get("h_nutau_cc_tot");
01386       tau_XSec_CC->SetDirectory(0);
01387       xsecfile->Close();
01388       if (xsecfile){delete xsecfile; xsecfile = 0;}
01389       x = new Float_t[tau_XSec_CC->GetNbinsX()];
01390       y = new Float_t[tau_XSec_CC->GetNbinsX()];
01391       for(int i=0;i<tau_XSec_CC->GetNbinsX();i++) {
01392         x[i] = tau_XSec_CC->GetBinCenter(i+1);
01393         y[i] = tau_XSec_CC->GetBinContent(i+1);
01394       }
01395       fTau_XSec_CC_Graph = new TGraph(fNTrueBins,x,y);
01396       if (x) {delete[] x; x = 0;}
01397       if (y) {delete[] y; y = 0;}
01398 
01399       //Get the data:
01400       TFile* ndDataFile = new TFile(fndDataFilename.c_str(), "READ");
01401       fRecoEnergyMeas_ND = (TH1D*) ndDataFile->Get("RecoEnergyAll_ND");
01402       fRecoEnergyMeas_ND->SetDirectory(0);
01403       ndDataFile->Close();
01404       if (ndDataFile){delete ndDataFile; ndDataFile = 0;}
01405     }
01406     break;
01407   case kPRLCCAnalysis:
01408     {
01409       //Get the helper histograms:
01410       TFile* helperFile = new TFile(fhelperfilename.c_str(),"READ");
01411       fRecoVsTrueEnergy_ND = (TH2D*) helperFile->Get("RecoVsTrueEnergy_ND");
01412       fRecoVsTrueEnergy_ND->SetDirectory(0);
01413       fRecoVsTrueEnergy_FD = (TH2D*) helperFile->Get("RecoVsTrueEnergy_FD");
01414       fRecoVsTrueEnergy_FD->SetDirectory(0);
01415       
01416       fFDVsNDMatrixRW = (TH2D*) helperFile->Get("FDVsNDMatrixRW");
01417       if(fFDVsNDMatrixRW) fFDVsNDMatrixRW->SetDirectory(0);
01418       fDoXSecStep = true;
01419       
01420       fEfficiency_ND = (TH1D*) helperFile->Get("Efficiency_ND");
01421       fEfficiency_ND->SetDirectory(0);
01422       fEfficiency_FD = (TH1D*) helperFile->Get("Efficiency_FD");
01423       fEfficiency_FD->SetDirectory(0);
01424       //The purity histograms in the helper file remove both the ND
01425       //background and the wrong sign CCs: the PRL analysis doesn't
01426       //remove the latter.
01427       
01428        fPurity_FD = (TH1D*) helperFile->Get("NCContamination_FD");
01429        fPurity_FD->SetDirectory(0);
01430        fPurity_ND = (TH1D*) helperFile->Get("NCContamination_ND");
01431        fPurity_ND->SetDirectory(0);
01432        for (int i=1; i<=fPurity_ND->GetNbinsX(); ++i){
01433         fPurity_ND->SetBinContent(i, 1.0 -
01434                                   fPurity_ND->GetBinContent(i));
01435         fPurity_FD->SetBinContent(i, 1.0 -
01436                                   fPurity_FD->GetBinContent(i));
01437        }
01438     
01439        fNCContamination_FD = (TH1D*) helperFile->Get("NCContamination_FD");
01440        fNCContamination_FD->SetDirectory(0);
01441       
01442        /*
01443       fPurity_ND = (TH1D*) helperFile->Get("Purity_ND");
01444       fPurity_ND->SetDirectory(0);
01445       fPurity_FD = (TH1D*) helperFile->Get("Purity_FD");
01446       fPurity_FD->SetDirectory(0);
01447        */
01448       //Tau helpers
01449       fEfficiencyTau_FD = (TH1D*) helperFile->Get("EfficiencyTau_FD");
01450       fEfficiencyTau_FD->SetDirectory(0);
01451       fRecoVsTrueEnergyTau_FD = (TH2D*)
01452         helperFile->Get("RecoVsTrueEnergyTau_FD");
01453       fRecoVsTrueEnergyTau_FD->SetDirectory(0);
01454       
01455       helperFile->Close();
01456       if (helperFile) {delete helperFile; helperFile = 0;}
01457       
01458       //Get cross-sections (numu)
01459       TFile *xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01460       TH1F* XSec_CC = (TH1F*) xsecfile->Get("h_numu_cc_tot");
01461       XSec_CC->SetDirectory(0);
01462       xsecfile->Close();
01463       if (xsecfile){delete xsecfile; xsecfile = 0;}
01464       Float_t *x = new Float_t[XSec_CC->GetNbinsX()];
01465       Float_t *y = new Float_t[XSec_CC->GetNbinsX()];
01466       for(int i=0;i<XSec_CC->GetNbinsX();i++) {
01467         x[i] = XSec_CC->GetBinCenter(i+1);
01468         y[i] = XSec_CC->GetBinContent(i+1);
01469       }
01470       fXSec_CC_Graph = new TGraph(XSec_CC->GetNbinsX(),x,y);
01471       if (x) {delete[] x; x = 0;}
01472       if (y) {delete[] y; y = 0;}
01473       
01474       //Get cross-sections (tau)
01475       xsecfile = new TFile(fxsecfilename.c_str(),"READ");
01476       TH1F* tau_XSec_CC = (TH1F*) xsecfile->Get("h_nutau_cc_tot");
01477       tau_XSec_CC->SetDirectory(0);
01478       xsecfile->Close();
01479       if (xsecfile){delete xsecfile; xsecfile = 0;}
01480       x = new Float_t[tau_XSec_CC->GetNbinsX()];
01481       y = new Float_t[tau_XSec_CC->GetNbinsX()];
01482       for(int i=0;i<tau_XSec_CC->GetNbinsX();i++) {
01483         x[i] = tau_XSec_CC->GetBinCenter(i+1);
01484         y[i] = tau_XSec_CC->GetBinContent(i+1);
01485       }
01486       fTau_XSec_CC_Graph = new TGraph(fNTrueBins,x,y);
01487       if (x) {delete[] x; x = 0;}
01488       if (y) {delete[] y; y = 0;}
01489 
01490       //Get the data:
01491       TFile* ndDataFile = new TFile(fndDataFilename.c_str(), "READ");
01492       fRecoEnergyMeas_ND = (TH1D*) ndDataFile->Get("RecoEnergy_ND");
01493       fRecoEnergyMeas_ND->SetDirectory(0);
01494       ndDataFile->Close();
01495       if (ndDataFile){delete ndDataFile; ndDataFile = 0;}
01496     }
01497     break;
01498   default:
01499     {
01500     }
01501     break;
01502   }
01503       
01504   if (fRecoToTrueCCContamination_FD){
01505     //Normalise the FD CC contamination reco to true CC matrix
01506     //First loop over true axis:
01507     for (Int_t j=1; j<=fRecoToTrueCCContamination_FD->GetNbinsY(); ++j){
01508       //Find out the total number of reco events in this row:
01509       Double_t recoEvents = 0.0;
01510       for (Int_t i=1; i<=fRecoToTrueCCContamination_FD->GetNbinsX(); ++i){
01511         recoEvents += fRecoToTrueCCContamination_FD->GetBinContent(i,j);
01512       }
01513       //Loop again, this time normalise.
01514       for (Int_t i=1; i<=fRecoToTrueCCContamination_FD->GetNbinsX(); ++i){
01515         if (recoEvents>0){
01516           Double_t oldContent =
01517             fRecoToTrueCCContamination_FD->GetBinContent(i,j);
01518           Double_t oldError =
01519             fRecoToTrueCCContamination_FD->GetBinError(i,j);
01520           fRecoToTrueCCContamination_FD->SetBinContent
01521             (i,j,oldContent/recoEvents);
01522           fRecoToTrueCCContamination_FD->SetBinError
01523             (i,j,oldError/recoEvents);
01524         }
01525         else{
01526           fRecoToTrueCCContamination_FD->SetBinContent(i,j,0);
01527           
01528           fRecoToTrueCCContamination_FD->SetBinError(i,j,0);
01529         }
01530       }
01531     }
01532   }
01533   
01534   if (fTrueToRecoCCContamination_FD){ 
01535     //Normalise the FD CC contamination true to reco CC matrix
01536     //First loop over reco axis:
01537     for (Int_t i=1; i<=fTrueToRecoCCContamination_FD->GetNbinsX(); ++i){
01538       //Find out the total number of true events in this column:
01539       Double_t trueEvents = 0.0;
01540       for (Int_t j=1; j<=fTrueToRecoCCContamination_FD->GetNbinsY(); ++j){
01541         trueEvents += fTrueToRecoCCContamination_FD->GetBinContent(i,j);
01542       }
01543       //Loop again, this time normalise.
01544       for (Int_t j=1; j<=fTrueToRecoCCContamination_FD->GetNbinsY(); ++j){
01545         if (trueEvents>0){
01546           Double_t oldContent =
01547             fTrueToRecoCCContamination_FD->GetBinContent(i,j);
01548           Double_t oldError =
01549             fTrueToRecoCCContamination_FD->GetBinError(i,j);
01550           fTrueToRecoCCContamination_FD->SetBinContent
01551             (i,j,oldContent/trueEvents);
01552           fTrueToRecoCCContamination_FD->SetBinError
01553             (i,j,oldError/trueEvents);
01554         }
01555         else{
01556           fTrueToRecoCCContamination_FD->SetBinContent(i,j,0);
01557           
01558           fTrueToRecoCCContamination_FD->SetBinError(i,j,0);
01559         }
01560       }
01561     }
01562   }
01563 //   if (fxmlConfig){
01564 //     this->ShiftXSecGraph();
01565 //   }
01566 }

void NuMatrixMethod::SetFDAppearedFidFlux ( const TH1D &  hFDAppearedFidFlux  )  [virtual]

Definition at line 1783 of file NuMatrixMethod.cxx.

References err(), fAppearedTrueEffCor_FD, fEfficiency_FD, and fXSec_CC_Graph.

Referenced by NuMatrixFitter::AppearanceAnalysis(), and NuMatrixFitter::WriteHistosForFitter().

01784 {
01785   if (fAppearedTrueEffCor_FD){
01786     delete fAppearedTrueEffCor_FD;
01787     fAppearedTrueEffCor_FD = 0;
01788   }
01789   fAppearedTrueEffCor_FD = new TH1D(hFDAppearedFidFlux);
01790   fAppearedTrueEffCor_FD->SetDirectory(0);
01791 
01792   double val, err, energy;
01793   double newval, newerr;
01794   double eff, efferr, xsec;
01795 
01796   for(int i = 1; i <= fAppearedTrueEffCor_FD->GetNbinsX(); i++) {
01797     val = fAppearedTrueEffCor_FD->GetBinContent(i);
01798     err = fAppearedTrueEffCor_FD->GetBinError(i);
01799     energy = fAppearedTrueEffCor_FD->GetBinCenter(i);
01800 
01801     xsec = fXSec_CC_Graph->Eval(energy,0,"");
01802     eff = fEfficiency_FD->GetBinContent(i);
01803     efferr = fEfficiency_FD->GetBinError(i);
01804     
01805     // Add in xsec, eff Flux => Events
01806     newval = val * xsec * eff;
01807     
01808     newerr = TMath::Power(err/val,2) + TMath::Power(efferr/eff,2);
01809     newerr = TMath::Sqrt(newerr) * newval;
01810     
01811     fAppearedTrueEffCor_FD->SetBinContent(i,newval);
01812     fAppearedTrueEffCor_FD->SetBinError(i,newerr);
01813   }
01814   return;
01815 }

void NuMatrixMethod::SetFDCCTrueUnoscBackground ( const TH1D &  hFDCCTrueUnoscBack  )  [virtual]
void NuMatrixMethod::ShiftXSecGraph (  )  [private, virtual]

Definition at line 1569 of file NuMatrixMethod.cxx.

References fextrpScheme, fxmlConfig, fXSec_CC_Graph, NuMMExtrapolation::kCCNoChargeCut, NuMMExtrapolation::kCCNuMuBarOscBackgroundCombined, NuMMExtrapolation::kCCNuMuBarOscBackgroundUncombined, NuMMExtrapolation::kCCNuMuNoOscBackground, NuMMExtrapolation::kCCNuMuOscBackgroundCombined, NuMMExtrapolation::kCCNuMuOscBackgroundUncombined, Msg::kInfo, NuMMExtrapolation::kModularNoChargeCutFit, NuMMExtrapolation::kModularNuMuBarCPTFit, NuMMExtrapolation::kModularNuMuBarTransitionFit, NuMMExtrapolation::kModularNuMuCPTFit, NuMMExtrapolation::kModularPRLCCFit, NuParticle::kNuMu, NuParticle::kNuMuBar, NuParticle::kUndefined, Msg::kWarning, MSG, and NuSystematic::XSecShiftScale().

01570 {
01571   NuSystematic nuSyst(*fxmlConfig);
01572   NuParticle::NuParticleType_t particle = NuParticle::kUndefined;
01573   if (NuMMExtrapolation::kCCNuMuNoOscBackground == fextrpScheme ||
01574       NuMMExtrapolation::kCCNuMuOscBackgroundUncombined == fextrpScheme ||
01575       NuMMExtrapolation::kCCNuMuOscBackgroundCombined == fextrpScheme ||
01576       NuMMExtrapolation::kModularNuMuCPTFit == fextrpScheme ||
01577       NuMMExtrapolation::kModularPRLCCFit == fextrpScheme){
01578     particle = NuParticle::kNuMu;
01579   }
01580   else if (NuMMExtrapolation::kCCNuMuBarOscBackgroundUncombined == fextrpScheme ||
01581       NuMMExtrapolation::kCCNuMuBarOscBackgroundCombined == fextrpScheme ||
01582       NuMMExtrapolation::kModularNuMuBarCPTFit == fextrpScheme ||
01583       NuMMExtrapolation::kModularNuMuBarTransitionFit == fextrpScheme){
01584     particle = NuParticle::kNuMuBar;
01585   }
01586   else if (NuMMExtrapolation::kCCNoChargeCut == fextrpScheme ||
01587            NuMMExtrapolation::kModularNoChargeCutFit == fextrpScheme){
01588     MSG("NuMatrixMethod.cxx",Msg::kInfo)
01589       << "Cross section file isn't used by NuMatrixMethod for this fitting mode"
01590       << endl;
01591     particle = NuParticle::kUndefined;
01592     return;
01593   }
01594   else {
01595     MSG("NuMatrixMethod.cxx",Msg::kWarning)
01596       << "I don't know what I'm extrapolaing!"
01597       << endl;
01598     particle = NuParticle::kUndefined;
01599   }
01600   if (NuParticle::kUndefined != particle){
01601     //Loop over graph
01602     for (Int_t point = 0; point < fXSec_CC_Graph->GetN(); ++point){
01603       //Get energy & nominal cross section
01604       Double_t energy = 0;
01605       Double_t xSec = 0;
01606       fXSec_CC_Graph->GetPoint(point,energy,xSec);
01607       xSec *= nuSyst.XSecShiftScale(energy,particle);
01608       fXSec_CC_Graph->SetPoint(point,energy,xSec);
01609     }
01610   }
01611 }

const TH1D NuMatrixMethod::TauXSecCorrectFD ( const TH1D &  tauFlux  )  const [private]

Definition at line 2847 of file NuMatrixMethod.cxx.

References fDoXSecStep, fFDFidMass, fFDPoT, fFluxPoT, fNTrueBins, fTau_XSec_CC_Graph, and fTrueBinEdges.

Referenced by PotentialTausTrueEnergy().

02848 { 
02849   TH1D hTrueEnergyTau_FD("hTrueEnergyTau_FD","hTrueEnergyTau_FD",
02850                          fNTrueBins,fTrueBinEdges);
02851   //6: Apply x-sec to get CC flux
02852   if (fDoXSecStep){
02853     for(int i=1;i<=fNTrueBins;i++) {
02854       hTrueEnergyTau_FD.SetBinContent(i,tauFlux.GetBinContent(i) *
02855                                       fTau_XSec_CC_Graph->Eval(hTrueEnergyTau_FD.
02856                                                            GetBinCenter(i),0,"")*
02857                                       fFDFidMass * (fFDPoT/fFluxPoT));
02858       hTrueEnergyTau_FD.SetBinError(i,tauFlux.GetBinError(i) *
02859                                     fTau_XSec_CC_Graph->Eval(hTrueEnergyTau_FD.
02860                                                          GetBinCenter(i),0,"")*
02861                                     fFDFidMass * (fFDPoT/fFluxPoT));
02862     }
02863   }
02864   else{
02865     for(int i=1;i<=fNTrueBins;i++) {
02866       hTrueEnergyTau_FD.SetBinContent(i,tauFlux.GetBinContent(i) *
02867                                       fFDFidMass * (fFDPoT/fFluxPoT));
02868       hTrueEnergyTau_FD.SetBinError(i,tauFlux.GetBinError(i) *
02869                                     fFDFidMass * (fFDPoT/fFluxPoT));
02870     }
02871   }
02872   return hTrueEnergyTau_FD;
02873 }

const TH1D NuMatrixMethod::TrueToReco ( const TH1D &  inputSpectrum,
const TH2D &  recoVsTrueHistogram 
) const [private]

Definition at line 2001 of file NuMatrixMethod.cxx.

02003 {
02004   TH1D outputSpectrum(inputSpectrum);
02005   outputSpectrum.Reset();
02006 
02007   //working space:
02008   Double_t *val = new Double_t[outputSpectrum.GetNbinsX()+1];
02009   Double_t *valerr = new Double_t[outputSpectrum.GetNbinsX()+1];
02010   
02011   //9: Convert to reco:
02012   for(int i=1;i<=outputSpectrum.GetNbinsX();i++){
02013     val[i-1] = 0; valerr[i-1] = 0;
02014   }
02015   for(int i=1;i<=inputSpectrum.GetNbinsX();i++){ //loop over true
02016     for(int j=1;j<=outputSpectrum.GetNbinsX()+1;j++){ //loop over reco
02017       val[j-1] += ( inputSpectrum.GetBinContent(i) *
02018                     recoVsTrueHistogram.GetBinContent(i,j));
02019       
02020       Double_t error = 0;
02021       if(inputSpectrum.GetBinContent(i)>0 &&
02022          recoVsTrueHistogram.GetBinContent(i,j)>0) {
02023         error = TMath::Power(inputSpectrum.GetBinError(i)/
02024                              inputSpectrum.GetBinContent(i),2);
02025         error += TMath::Power(recoVsTrueHistogram.GetBinError(i,j)/
02026                               recoVsTrueHistogram.GetBinContent(i,j),2);
02027         error *= TMath::Power(inputSpectrum.GetBinContent(i) * 
02028                               recoVsTrueHistogram.GetBinContent(i,j),2);
02029       }
02030       valerr[j-1] += error;
02031       
02032     }
02033   }
02034   for(int i=1;i<=outputSpectrum.GetNbinsX()+1;i++) {
02035     outputSpectrum.SetBinContent(i,val[i-1]);
02036     if(valerr[i-1]>0) outputSpectrum.SetBinError(i,TMath::Sqrt(valerr[i-1]));
02037     else outputSpectrum.SetBinError(i,0);
02038   }
02039 
02040   return outputSpectrum;
02041 }

void NuMatrixMethod::TrueToRecoFD (  )  [private, virtual]

Definition at line 2044 of file NuMatrixMethod.cxx.

References fRecoEnergyOsc_FD, fRecoVsTrueEnergy_FD, and fTrueEnergyOsc_FD.

Referenced by PredictFDSpectrumBackgroundOscUncombined().

02045 {
02046   //working space:
02047   Double_t *val = new Double_t[fRecoEnergyOsc_FD->GetNbinsX()+1];
02048   Double_t *valerr = new Double_t[fRecoEnergyOsc_FD->GetNbinsX()+1];
02049   
02050   //9: Convert to reco:
02051   for(int i=1;i<=fRecoEnergyOsc_FD->GetNbinsX();i++){
02052     val[i-1] = 0; valerr[i-1] = 0;
02053   }
02054   for(int i=1;i<=fTrueEnergyOsc_FD->GetNbinsX();i++){ //loop over true
02055     for(int j=1;j<=fRecoEnergyOsc_FD->GetNbinsX()+1;j++){ //loop over reco
02056       val[j-1] += ( fTrueEnergyOsc_FD->GetBinContent(i) *
02057                     fRecoVsTrueEnergy_FD->GetBinContent(i,j));
02058       
02059       Double_t error = 0;
02060       if(fTrueEnergyOsc_FD->GetBinContent(i)>0 &&
02061          fRecoVsTrueEnergy_FD->GetBinContent(i,j)>0) {
02062         error = TMath::Power(fTrueEnergyOsc_FD->GetBinError(i)/
02063                              fTrueEnergyOsc_FD->GetBinContent(i),2);
02064         error += TMath::Power(fRecoVsTrueEnergy_FD->GetBinError(i,j)/
02065                               fRecoVsTrueEnergy_FD->GetBinContent(i,j),2);
02066         error *= TMath::Power(fTrueEnergyOsc_FD->GetBinContent(i) * 
02067                               fRecoVsTrueEnergy_FD->GetBinContent(i,j),2);
02068       }
02069       valerr[j-1] += error;
02070       
02071     }
02072   }
02073   for(int i=1;i<=fRecoEnergyOsc_FD->GetNbinsX()+1;i++) {
02074     fRecoEnergyOsc_FD->SetBinContent(i,val[i-1]);
02075     if(valerr[i-1]>0) fRecoEnergyOsc_FD->SetBinError(i,TMath::Sqrt(valerr[i-1]));
02076     else fRecoEnergyOsc_FD->SetBinError(i,0);
02077   }
02078 }

void NuMatrixMethod::UnoscPurityCorrectFD (  )  [private, virtual]

Definition at line 3031 of file NuMatrixMethod.cxx.

References MuELoss::e, fNRecoBins, fPurity_FD, fRecoEnergyNoOsc_FD, and fRecoEnergyNoOscPred_FD.

Referenced by PredictFDFluxUnosc().

03032 { 
03033   // Correct for purity:
03034   for(int i=1;i<=fNRecoBins+1;i++){
03035     if(fRecoEnergyNoOsc_FD->GetBinContent(i)>1e-5 &&
03036        fPurity_FD->GetBinContent(i)>1e-5) {
03037       fRecoEnergyNoOscPred_FD->SetBinContent(i,fRecoEnergyNoOsc_FD->GetBinContent(i)/
03038                                              fPurity_FD->GetBinContent(i));
03039       Double_t error = TMath::Power(fRecoEnergyNoOsc_FD->GetBinError(i) / 
03040                                     fRecoEnergyNoOsc_FD->GetBinContent(i),2);
03041       error += TMath::Power(fPurity_FD->GetBinError(i) / 
03042                             fPurity_FD->GetBinContent(i),2);
03043       error = TMath::Sqrt(error) * fRecoEnergyNoOscPred_FD->GetBinContent(i);
03044       fRecoEnergyNoOscPred_FD->SetBinError(i,error);
03045     }
03046     else {
03047       fRecoEnergyNoOscPred_FD->SetBinContent(i,0);
03048       fRecoEnergyNoOscPred_FD->SetBinError(i,0);
03049     }
03050   }
03051   return;
03052 }

void NuMatrixMethod::UnoscTrueToRecoFD (  )  [private, virtual]

Definition at line 2947 of file NuMatrixMethod.cxx.

References fNRecoBins, fNTrueBins, fRecoEnergyNoOsc_FD, fRecoVsTrueEnergy_FD, and fTrueEnergyEffCor_FD.

Referenced by PredictFDFluxUnosc().

02948 {
02949   //working space:
02950   Double_t *val = new Double_t[fNRecoBins+1];
02951   Double_t *valerr = new Double_t[fNRecoBins+1];
02952 
02953   // Now we are going to digress in order to make the unoscillated FD spectrum:
02954   for(int i=1;i<=fNRecoBins+1;i++) { val[i-1] = 0; valerr[i-1] = 0; }
02955   for(int i=1;i<=fNTrueBins;i++){ //loop over true
02956     for(int j=1;j<=fNRecoBins+1;j++){ //loop over reco
02957       val[j-1] += ( fTrueEnergyEffCor_FD->GetBinContent(i) *
02958                     fRecoVsTrueEnergy_FD->GetBinContent(i,j) );
02959       Double_t error = 0;
02960       if(fTrueEnergyEffCor_FD->GetBinContent(i)>0 &&
02961          fRecoVsTrueEnergy_FD->GetBinContent(i,j)>0) {
02962         error = TMath::Power(fTrueEnergyEffCor_FD->GetBinError(i)/
02963                              fTrueEnergyEffCor_FD->GetBinContent(i),2);
02964         error += TMath::Power(fRecoVsTrueEnergy_FD->GetBinError(i,j)/
02965                               fRecoVsTrueEnergy_FD->GetBinContent(i,j),2);
02966         error *= TMath::Power(fTrueEnergyEffCor_FD->GetBinContent(i) * 
02967                               fRecoVsTrueEnergy_FD->GetBinContent(i,j),2);
02968       }
02969       valerr[j-1] += error;
02970     }
02971   }
02972   for(int i=1;i<=fNRecoBins+1;i++) {
02973     fRecoEnergyNoOsc_FD->SetBinContent(i,val[i-1]);
02974     fRecoEnergyNoOsc_FD->SetBinError(i,TMath::Sqrt(valerr[i-1]));
02975   }
02976   return;
02977 }

void NuMatrixMethod::WriteFilesForFitter ( std::string  sPrefix  ) 

write out files

Definition at line 868 of file NuMatrixMethod.cxx.

References fAppearedTrueEffCor_FD, fEffCorTau_FD, fRecoUnoscNCBackground_FD, fRecoVsTrueEnergy_FD, fRecoVsTrueEnergyTau_FD, fSuppliedTrueUnoscCCBackground_FD, fTrueEnergyEffCor_FD, and fTrueToRecoCCContamination_FD.

Referenced by NuMatrixFitter::WriteHistosForFitter(), NuMatrixFitter::WriteNoChargeCutHistosForFitter(), and NuMatrixFitter::WritePRLCCHistosForFitter().

00869 {
00871   
00872   //helper files
00873   //M numu(bar)
00874   fRecoVsTrueEnergy_FD->
00875     Write((sPrefix+"TrueToRecoFD").c_str());
00876   //M-squigle numu(bar) for WS
00877   if (fTrueToRecoCCContamination_FD){
00878     fTrueToRecoCCContamination_FD->
00879       Write((sPrefix+"TrueToRecoCCBkgFD").c_str());
00880   }
00881   
00882   //data or mock data
00883   //T
00884   fTrueEnergyEffCor_FD->
00885   Write((sPrefix+"TrueEnFD").c_str());
00886   //K
00887   if (fSuppliedTrueUnoscCCBackground_FD){
00888     fSuppliedTrueUnoscCCBackground_FD->
00889       Write((sPrefix+"TrueEnCCBkgFD").c_str());
00890   }
00891   //Z
00892   if (fRecoVsTrueEnergy_FD){
00893     fRecoUnoscNCBackground_FD->
00894       Write((sPrefix+"RecoEnNCBkgFD").c_str());
00895   }
00896 
00897   //Appeared spectrum for numu->nubar analysis, efficiency corrected
00898   if (fAppearedTrueEffCor_FD){
00899     fAppearedTrueEffCor_FD->
00900       Write((sPrefix+"TrueEnPotentialAppearanceEffCor").c_str());
00901   }
00902 
00903   //Potential taus (efficiency corrected)
00904   if (fEffCorTau_FD){
00905     fEffCorTau_FD->Write((sPrefix+"EffCorTau_FD").c_str());
00906   }
00907   //Tau reco v. true energy matrix
00908   if (fRecoVsTrueEnergyTau_FD){
00909     fRecoVsTrueEnergyTau_FD->Write((sPrefix+"RecoVsTrueEnergyTau_FD").c_str());
00910   }
00911 }

void NuMatrixMethod::WriteInputForFitter ( NuMatrixInput mmInput  ) 

Definition at line 915 of file NuMatrixMethod.cxx.

References NuMatrixInput::Appear(), fAppearedTrueEffCor_FD, fextrpScheme, fRecoUnoscNCBackground_FD, fRecoVsTrueEnergy_FD, fSuppliedTrueUnoscCCBackground_FD, fTrueEnergyEffCor_FD, fTrueToRecoCCContamination_FD, NuMatrixInput::K(), NuMMExtrapolation::kCCNuMuBarOscBackgroundCombined, NuMMExtrapolation::kCCNuMuBarOscBackgroundUncombined, NuMMExtrapolation::kCCNuMuNoOscBackground, NuMMExtrapolation::kCCNuMuOscBackgroundCombined, NuMMExtrapolation::kCCNuMuOscBackgroundUncombined, Msg::kError, Msg::kFatal, NuMMExtrapolation::kModularNuMuBarCPTFit, NuMMExtrapolation::kModularNuMuBarTransitionFit, NuMMExtrapolation::kModularNuMuCPTFit, NuMatrixInput::M(), MSG, NuMatrixInput::Mtilde(), NuMatrixInput::T(), and NuMatrixInput::Z().

00916 {
00917   bool charge = false;
00918   if (NuMMExtrapolation::kCCNuMuNoOscBackground == fextrpScheme ||
00919       NuMMExtrapolation::kCCNuMuOscBackgroundUncombined == fextrpScheme ||
00920       NuMMExtrapolation::kCCNuMuOscBackgroundCombined == fextrpScheme   ||
00921       NuMMExtrapolation::kModularNuMuCPTFit == fextrpScheme
00922       )
00923     charge = true;
00924   else if (NuMMExtrapolation::kCCNuMuBarOscBackgroundUncombined == fextrpScheme ||
00925            NuMMExtrapolation::kCCNuMuBarOscBackgroundCombined == fextrpScheme ||
00926            NuMMExtrapolation::kModularNuMuBarCPTFit == fextrpScheme ||
00927            NuMMExtrapolation::kModularNuMuBarTransitionFit == fextrpScheme
00928            )
00929     charge = false;
00930   else{
00931     try {
00932       MSG("NuMatrixMethod.cxx", Msg::kFatal) 
00933         << "Not a valid extrapolation scheme for a modular "
00934         << "UK matrix method fit"
00935         << endl;
00936     }
00937     catch(MSGException) {
00938       MSG("NuMatrixMethod.cxx", Msg::kError)
00939         << "Not a valid extrapolation scheme for a modular "
00940         << "UK matrix method fit"
00941         << endl;
00942     }
00943   }
00944   
00945   mmInput->M(fRecoVsTrueEnergy_FD, charge);
00946   mmInput->Mtilde(fTrueToRecoCCContamination_FD, charge);
00947   mmInput->T(fTrueEnergyEffCor_FD, charge);
00948   mmInput->K(fSuppliedTrueUnoscCCBackground_FD, charge);
00949   mmInput->Z(fRecoUnoscNCBackground_FD, charge);
00950   mmInput->Appear(fAppearedTrueEffCor_FD, charge);
00951 }

void NuMatrixMethod::XSecCorrectFD (  )  [private, virtual]

Definition at line 2811 of file NuMatrixMethod.cxx.

References fDoXSecStep, fFDFidMass, fFDPoT, fFluxPoT, fNTrueBins, fTrueEnergyCC_FD, fTrueEnergyMatrix_FD, and fXSec_CC_Graph.

Referenced by PredictFDFluxUnosc().

02812 { 
02813   //6: Apply x-sec to get CC flux
02814   if (fDoXSecStep){
02815     for(int i=1;i<=fNTrueBins;i++) {
02816       fTrueEnergyCC_FD->SetBinContent(i,fTrueEnergyMatrix_FD->GetBinContent(i) *
02817                                       fXSec_CC_Graph->Eval(fTrueEnergyCC_FD->
02818                                                            GetBinCenter(i),0,"")*
02819                                       fFDFidMass * (fFDPoT/fFluxPoT));
02820       fTrueEnergyCC_FD->SetBinError(i,fTrueEnergyMatrix_FD->GetBinError(i) *
02821                                     fXSec_CC_Graph->Eval(fTrueEnergyCC_FD->
02822                                                          GetBinCenter(i),0,"")*
02823                                     fFDFidMass * (fFDPoT/fFluxPoT));
02824     }
02825   }
02826   else{
02827     for(int i=1;i<=fNTrueBins;i++) {
02828       fTrueEnergyCC_FD->SetBinContent(i,fTrueEnergyMatrix_FD->GetBinContent(i) *
02829                                       fFDFidMass * (fFDPoT/fFluxPoT));
02830       fTrueEnergyCC_FD->SetBinError(i,fTrueEnergyMatrix_FD->GetBinError(i) *
02831                                     fFDFidMass * (fFDPoT/fFluxPoT));
02832     }
02833   }
02834   return;
02835 }

void NuMatrixMethod::XSecCorrectND (  )  [private, virtual]

Definition at line 2744 of file NuMatrixMethod.cxx.

References fDoXSecStep, fFluxPoT, fNDFidMass, fNDPoT, fNTrueBins, fTrueEnergyEffCor_ND, fTrueEnergyFlux_ND, and fXSec_CC_Graph.

Referenced by PredictFDFluxUnosc().

02745 {
02746   //4: Get ND neutrino flux:
02747   if (fDoXSecStep){
02748     for(int i=1;i<=fNTrueBins;i++) {
02749       fTrueEnergyFlux_ND->
02750         SetBinContent(i,fTrueEnergyEffCor_ND->GetBinContent(i) *
02751                       (fFluxPoT/fNDPoT) / 
02752                       ( fNDFidMass *
02753                         fXSec_CC_Graph->Eval(fTrueEnergyFlux_ND->
02754                                              GetBinCenter(i),0,"") ) ); 
02755       fTrueEnergyFlux_ND->
02756         SetBinError(i,fTrueEnergyEffCor_ND->GetBinError(i) *
02757                     (fFluxPoT/fNDPoT) /
02758                     ( fNDFidMass *
02759                       fXSec_CC_Graph->Eval(fTrueEnergyFlux_ND->
02760                                            GetBinCenter(i),0,"") ) );
02761     }
02762   }
02763   else{
02764     for(int i=1;i<=fNTrueBins;i++) {
02765       fTrueEnergyFlux_ND->
02766         SetBinContent(i,fTrueEnergyEffCor_ND->GetBinContent(i) *
02767                       (fFluxPoT/fNDPoT) / 
02768                       ( fNDFidMass ) ); 
02769       fTrueEnergyFlux_ND->
02770         SetBinError(i,fTrueEnergyEffCor_ND->GetBinError(i) *
02771                     (fFluxPoT/fNDPoT) /
02772                     ( fNDFidMass ) );
02773     }
02774   }
02775   return;
02776 }


Member Data Documentation

Definition at line 294 of file NuMatrixMethod.h.

Referenced by PurityCorrectFDBackgroundOscUncombined().

Bool_t NuMatrixMethod::fDoXSecStep [private]

Definition at line 259 of file NuMatrixMethod.h.

Referenced by TauXSecCorrectFD(), XSecCorrectFD(), and XSecCorrectND().

Definition at line 341 of file NuMatrixMethod.h.

Referenced by PotentialTausTrueEnergy(), WriteFilesForFitter(), and ~NuMatrixMethod().

Definition at line 287 of file NuMatrixMethod.h.

Referenced by EfficiencyCorrectND().

Definition at line 301 of file NuMatrixMethod.h.

Referenced by PotentialTausTrueEnergy().

Double_t NuMatrixMethod::fFDDistance [private]

Definition at line 270 of file NuMatrixMethod.h.

Referenced by DecayFD(), and PurityCorrectFDBackgroundDecayCombined().

Double_t NuMatrixMethod::fFDFidMass [private]

Definition at line 269 of file NuMatrixMethod.h.

Referenced by TauXSecCorrectFD(), and XSecCorrectFD().

Double_t NuMatrixMethod::fFDPoT [private]

Definition at line 266 of file NuMatrixMethod.h.

Referenced by TauXSecCorrectFD(), and XSecCorrectFD().

Definition at line 290 of file NuMatrixMethod.h.

Referenced by ExtrapolateNDToFD().

Double_t NuMatrixMethod::fFluxPoT [private]

Definition at line 267 of file NuMatrixMethod.h.

Referenced by TauXSecCorrectFD(), XSecCorrectFD(), and XSecCorrectND().

std::string NuMatrixMethod::fhelperfilename [private]

Definition at line 273 of file NuMatrixMethod.h.

Definition at line 295 of file NuMatrixMethod.h.

Referenced by CalculateNCContamination().

std::string NuMatrixMethod::fndDataFilename [private]

Definition at line 275 of file NuMatrixMethod.h.

Double_t NuMatrixMethod::fNDFidMass [private]

Definition at line 268 of file NuMatrixMethod.h.

Referenced by XSecCorrectND().

Double_t NuMatrixMethod::fNDPoT [private]

Definition at line 265 of file NuMatrixMethod.h.

Referenced by XSecCorrectND().

Int_t NuMatrixMethod::fNRecoBins [private]
Int_t NuMatrixMethod::fNTrueBins [private]

Definition at line 299 of file NuMatrixMethod.h.

Referenced by GetFDOtherCCTrueUnoscBackground().

std::string NuMatrixMethod::fOutName [private]

Definition at line 272 of file NuMatrixMethod.h.

Referenced by ~NuMatrixMethod().

TH1D* NuMatrixMethod::fPurity_FD [private]
TH1D* NuMatrixMethod::fPurity_ND [private]

Definition at line 285 of file NuMatrixMethod.h.

Referenced by PurityCorrectND().

Double_t* NuMatrixMethod::fRecoBinEdges [private]

Definition at line 282 of file NuMatrixMethod.h.

Definition at line 281 of file NuMatrixMethod.h.

Referenced by PurityCorrectND(), and ~NuMatrixMethod().

Definition at line 296 of file NuMatrixMethod.h.

Referenced by PurityCorrectFDBackgroundOscUncombined().

Definition at line 286 of file NuMatrixMethod.h.

Referenced by RecoToTrueND().

Definition at line 302 of file NuMatrixMethod.h.

Referenced by WriteFilesForFitter().

Definition at line 289 of file NuMatrixMethod.h.

Referenced by TauXSecCorrectFD().

Double_t* NuMatrixMethod::fTrueBinEdges [private]

Definition at line 333 of file NuMatrixMethod.h.

Referenced by DecayFD(), DecohereFD(), OscillateFD(), TrueToRecoFD(), and ~NuMatrixMethod().

Definition at line 278 of file NuMatrixMethod.h.

Referenced by ShiftXSecGraph().

TGraph* NuMatrixMethod::fXSec_CC_Graph [private]
std::string NuMatrixMethod::fxsecfilename [private]

Definition at line 274 of file NuMatrixMethod.h.


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1