NuMMRunNSINubar Class Reference

#include <NuMMRunNSINubar.h>

Inheritance diagram for NuMMRunNSINubar:
NuMMRun

List of all members.

Public Member Functions

 NuMMRunNSINubar (NuMMHelperPRL *helper, NuMatrixSpectrum *ndCCData, NuMatrixSpectrum *fdCCData)
virtual Double_t ComparePredWithData (const NuMMParameters &pars)
virtual vector< NuMatrixSpectrumMakeFDPred (const NuMMParameters &pars)
NuMatrixSpectrum TrueComponents (const NuMMParameters &pars, Sample_t s) const
 Return the individual true energy prediction of the far detector sub sample s with oscillation parameters described in pars. Default implementation just drops an error.
virtual std::vector< TH1D > WriteFDPredHistos (const NuMMParameters &pars) const
virtual const NuMatrixSpectrumGetNDDataNSI () const
 Get a const pointer to the ND data spectrum.
virtual const NuMatrixSpectrumGetFDDataNSI () const
 Get a const pointer to the FD data spectrum.
virtual void PrecalculateWSFlux (NuMMHelperPRL *helper, const NuMatrixSpectrum *ndOtherData)
virtual void SetFDData (NuMatrixSpectrum *fdData)

Private Member Functions

virtual vector< NuMatrixSpectrumCalculateFDFlux (const Double_t ncScale=1.0) const
virtual vector< NuMatrixSpectrumCalculateFDTauFlux (const Double_t ncScale=1.0) const
virtual vector< NuMatrixSpectrumCalculateFDNCBackground (const Double_t ncScale=1.0) const
void OscillateNuMu (NuMatrixSpectrum &numu, const NuMMParameters &pars) const
 Helper. Oscillates, decays or decoheres a true energy numu spectrum.
void OscillateNuBar (NuMatrixSpectrum &numu, const NuMMParameters &pars) const
void InverseOscillateNuTau (NuMatrixSpectrum &nutau, const NuMMParameters &pars) const
 Helper. Inverse oscillates a true energy nutau spectrum.
void InverseOscillateTauBar (NuMatrixSpectrum &nutau, const NuMMParameters &pars) const
virtual void SanityCheckSpecialWSFiles (NuMMHelperPRL *helper, const NuMatrixSpectrum *ndOtherData) const
virtual void WriteToJess (NuMatrixSpectrum spectrum, const std::string name, bool osc)

Private Attributes

Bool_t fSpecialWSMode
NuMatrixSpectrumfNDCCData
NuMatrixSpectrumfFDCCData
vector< NuMatrixSpectrumfFDFlux
vector< NuMatrixSpectrumfFDTauFlux
vector< NuMatrixSpectrumfFDNCBackground
vector< NuMatrixSpectrumfSpecialWSBackgroundFlux
NuMMHelperPRLfHelper

Detailed Description

Definition at line 16 of file NuMMRunNSINubar.h.


Constructor & Destructor Documentation

NuMMRunNSINubar::NuMMRunNSINubar ( NuMMHelperPRL helper,
NuMatrixSpectrum ndCCData,
NuMatrixSpectrum fdCCData 
)

Definition at line 21 of file NuMMRunNSINubar.cxx.

00024   : NuMMRun(),
00025     fSpecialWSMode(false),
00026     fNDCCData(ndCCData),
00027     fFDCCData(fdCCData),
00028     fHelper(helper)
00029 {
00030   assert(helper);
00031   assert(ndCCData);
00032   assert(fdCCData);
00033   
00034   //Independent of fit parameters for a stats-only fit
00035   fFDFlux = this->CalculateFDFlux();
00036   fFDTauFlux = this->CalculateFDTauFlux();
00037   fFDNCBackground = this->CalculateFDNCBackground();
00038 }


Member Function Documentation

vector< NuMatrixSpectrum > NuMMRunNSINubar::CalculateFDFlux ( const Double_t  ncScale = 1.0  )  const [private, virtual]

Definition at line 118 of file NuMMRunNSINubar.cxx.

References NuMMHelperPRL::BeamMatrixNuMuCCXSec(), NuMatrixSpectrum::Divide(), NuMatrixSpectrum::ExtrapolateNDToFD(), fFDCCData, NuMMRun::fFDFidMass, fHelper, fNDCCData, NuMMRun::fNDFidMass, NuMatrix::GetPOT(), NuMatrixSpectrum::Multiply(), NuMMHelperPRL::NDCCContamination(), NuMMHelperPRL::NDEfficiency(), NuMMHelperPRL::NDPurity(), NuMMHelperPRL::NDRecoVsTrue(), NuMatrixSpectrum::RecoToTrue(), and NuMatrix1D::Subtract().

Referenced by MakeFDPred().

00119 {
00120   //  cout << "Calculating FD Flux..." << endl;
00121   NuMatrixSpectrum prediction(*fNDCCData);
00122   NuMatrixSpectrum wsBackground(prediction);
00123 //   cout << "Got ND, integral: " << prediction.Spectrum()->Integral() << endl
00124 //        << "POT" << fNDCCData->GetPOT() << endl;
00125   
00126   NuMatrixSpectrum signal(prediction);
00127   signal.Multiply(fHelper->NDPurity());
00128   NuMatrixSpectrum ncBackground(prediction);
00129   ncBackground.Subtract(signal);
00130   ncBackground.Multiply(ncScale);
00131   prediction.Subtract(ncBackground);
00132   //   cout << "Subtract NC, integral: " << prediction.Spectrum()->Integral() << endl;
00133  //    prediction.Multiply(fHelper->NDPurity());
00134   
00135   wsBackground.Multiply(fHelper->NDCCContamination());
00136   prediction.Subtract(wsBackground);
00137   //  cout << "Subtract WS, integral: " << prediction.Spectrum()->Integral() << endl;
00138   
00139   prediction.RecoToTrue(fHelper->NDRecoVsTrue());
00140   prediction.Divide(fHelper->NDEfficiency());
00141   prediction.Divide(fNDCCData->GetPOT());
00142   prediction.Divide(fNDFidMass);
00143   //  cout << "Eff-POT-Mass, integral: " << prediction.Spectrum()->Integral() << endl;
00144   prediction.ExtrapolateNDToFD(fHelper->BeamMatrixNuMuCCXSec());
00145   //  cout << "Extrapolated, integral: " << prediction.Spectrum()->Integral() << endl;
00146   prediction.Multiply(fFDFidMass);
00147   //  cout << "FD Fid Mass, integral: " << prediction.Spectrum()->Integral() << endl;
00148   prediction.Multiply(fFDCCData->GetPOT());
00149 //   cout << "FD POT= " << fFDCCData->GetPOT() << endl
00150 //        << "FD POT, integral final: " << prediction.Spectrum()->Integral() << endl;
00151   
00152   vector<NuMatrixSpectrum> predictions;
00153   predictions.push_back(prediction);
00154   return predictions;
00155 }

vector< NuMatrixSpectrum > NuMMRunNSINubar::CalculateFDNCBackground ( const Double_t  ncScale = 1.0  )  const [private, virtual]

Definition at line 190 of file NuMMRunNSINubar.cxx.

References NuMatrix1D::Add(), NuMMHelperPRL::BeamMatrixNuMuCCXSec(), NuMatrixSpectrum::Divide(), NuMatrixSpectrum::ExtrapolateNDToFD(), NuMMHelperPRL::FDCCContamination(), NuMMHelperPRL::FDCCContaminationRecoVsTrue(), NuMMHelperPRL::FDEfficiency(), NuMMHelperPRL::FDPurity(), NuMMHelperPRL::FDRecoVsTrue(), fFDCCData, NuMMRun::fFDFidMass, fHelper, fNDCCData, NuMMRun::fNDFidMass, NuMatrix::GetPOT(), NuMatrixSpectrum::Multiply(), NuMMHelperPRL::NDCCContamination(), NuMMHelperPRL::NDEfficiency(), NuMMHelperPRL::NDPurity(), NuMMHelperPRL::NDRecoVsTrue(), NuMatrixSpectrum::RecoToTrue(), NuMatrix1D::Subtract(), and NuMatrixSpectrum::TrueToReco().

Referenced by MakeFDPred().

00191 {
00192     NuMatrixSpectrum prediction(*fNDCCData);
00193     NuMatrixSpectrum wsBackground(prediction);
00194 
00195     NuMatrixSpectrum signal(prediction);
00196     signal.Multiply(fHelper->NDPurity());
00197     NuMatrixSpectrum ndncBackground(prediction);
00198     ndncBackground.Subtract(signal);
00199     ndncBackground.Multiply(ncScale);
00200     prediction.Subtract(ndncBackground);
00201     //    prediction.Multiply(fHelper->NDPurity());
00202 
00203     wsBackground.Multiply(fHelper->NDCCContamination());
00204     prediction.Subtract(wsBackground);
00205 
00206     prediction.RecoToTrue(fHelper->NDRecoVsTrue());
00207     prediction.Divide(fHelper->NDEfficiency());
00208     prediction.Divide(fNDCCData->GetPOT());
00209     prediction.Divide(fNDFidMass);
00210     prediction.ExtrapolateNDToFD(fHelper->BeamMatrixNuMuCCXSec());
00211     prediction.Multiply(fFDFidMass);
00212     prediction.Multiply(fFDCCData->GetPOT());
00213 
00214     NuMatrixSpectrum unoscWsBackground(prediction);
00215     unoscWsBackground.Multiply(fHelper->FDCCContamination());
00216     unoscWsBackground.TrueToReco(fHelper->FDCCContaminationRecoVsTrue());
00217 
00218     prediction.Multiply(fHelper->FDEfficiency());
00219   
00220     NuMatrixSpectrum unoscTrueSpectrum(prediction);
00221     unoscTrueSpectrum.TrueToReco(fHelper->FDRecoVsTrue());
00222     unoscTrueSpectrum.Add(unoscWsBackground);
00223 
00224     NuMatrixSpectrum ncBackground(unoscTrueSpectrum);
00225     ncBackground.Divide(fHelper->FDPurity());
00226     ncBackground.Subtract(unoscTrueSpectrum);
00227     
00228     vector<NuMatrixSpectrum> predictions;
00229     predictions.push_back(ncBackground);
00230     return predictions;
00231 }

vector< NuMatrixSpectrum > NuMMRunNSINubar::CalculateFDTauFlux ( const Double_t  ncScale = 1.0  )  const [private, virtual]

Definition at line 159 of file NuMMRunNSINubar.cxx.

References NuMMHelperPRL::BeamMatrixTauCCXSec(), NuMatrixSpectrum::Divide(), NuMatrixSpectrum::ExtrapolateNDToFD(), fFDCCData, NuMMRun::fFDFidMass, fHelper, fNDCCData, NuMMRun::fNDFidMass, NuMatrix::GetPOT(), NuMatrixSpectrum::Multiply(), NuMMHelperPRL::NDCCContamination(), NuMMHelperPRL::NDEfficiency(), NuMMHelperPRL::NDPurity(), NuMMHelperPRL::NDRecoVsTrue(), NuMatrixSpectrum::RecoToTrue(), and NuMatrix1D::Subtract().

Referenced by MakeFDPred().

00160 {
00161     NuMatrixSpectrum prediction(*fNDCCData);
00162     NuMatrixSpectrum wsBackground(prediction);
00163 
00164     NuMatrixSpectrum signal(prediction);
00165     signal.Multiply(fHelper->NDPurity());
00166     NuMatrixSpectrum ncBackground(prediction);
00167     ncBackground.Subtract(signal);
00168     ncBackground.Multiply(ncScale);
00169     prediction.Subtract(ncBackground);
00170     //    prediction.Multiply(fHelper->NDPurity());
00171 
00172     wsBackground.Multiply(fHelper->NDCCContamination());
00173     prediction.Subtract(wsBackground);
00174 
00175     prediction.RecoToTrue(fHelper->NDRecoVsTrue());
00176     prediction.Divide(fHelper->NDEfficiency());
00177     prediction.Divide(fNDCCData->GetPOT());
00178     prediction.Divide(fNDFidMass);
00179     prediction.ExtrapolateNDToFD(fHelper->BeamMatrixTauCCXSec());
00180     prediction.Multiply(fFDFidMass);
00181     prediction.Multiply(fFDCCData->GetPOT());
00182     
00183     vector<NuMatrixSpectrum> predictions;
00184     predictions.push_back(prediction);
00185     return predictions;
00186 }

Double_t NuMMRunNSINubar::ComparePredWithData ( const NuMMParameters pars  )  [virtual]

Implements NuMMRun.

Definition at line 572 of file NuMMRunNSINubar.cxx.

00573 {
00574   const vector<NuMatrixSpectrum> predictions =
00575     this->MakeFDPred(pars);
00576   Double_t like = 0.0;
00577   
00578   like += this->StatsLikelihood(predictions[0].Spectrum(),
00579                                 fFDCCData->Spectrum());
00580 
00581   return like;
00582 }

virtual const NuMatrixSpectrum* NuMMRunNSINubar::GetFDDataNSI (  )  const [inline, virtual]

Get a const pointer to the FD data spectrum.

Definition at line 34 of file NuMMRunNSINubar.h.

References fFDCCData.

00034 {return fFDCCData;};

virtual const NuMatrixSpectrum* NuMMRunNSINubar::GetNDDataNSI (  )  const [inline, virtual]

Get a const pointer to the ND data spectrum.

Definition at line 32 of file NuMMRunNSINubar.h.

References fNDCCData.

Referenced by NuFCExperimentFactoryNSI::GenerateND().

00032 {return fNDCCData;};

void NuMMRunNSINubar::InverseOscillateNuTau ( NuMatrixSpectrum nutau,
const NuMMParameters pars 
) const [private]

Helper. Inverse oscillates a true energy nutau spectrum.

Definition at line 634 of file NuMMRunNSINubar.cxx.

References NuMMParameters::Alpha(), NuMatrix1D::DecayMuToTau(), NuMMParameters::Dm2(), NuMMParameters::Epsilon(), NuMMRun::fDisappearanceModel, NuMatrix1D::InverseDecohere(), NuMatrixSpectrum::InverseOscillate(), NuMatrixSpectrum::InverseOscillateNSI(), NuMMParameters::Mu2(), and NuMMParameters::Sn2().

00636 {
00637   switch(fDisappearanceModel){
00638   case 0:
00639     nutau.InverseOscillate(pars.Dm2(), pars.Sn2());
00640     return;
00641   case 1:
00642     nutau.DecayMuToTau(pars.Dm2(), pars.Sn2(), pars.Alpha());
00643     return;
00644   case 2:
00645     nutau.InverseDecohere(pars.Dm2(), pars.Sn2(), pars.Mu2());
00646     return; 
00647   case 3:
00648     nutau.InverseOscillateNSI(pars.Dm2(), pars.Sn2(), pars.Epsilon(), 1.0);
00649     return;
00650   default:
00651     assert(0 && "Badly configured disappearance model");
00652   }
00653 }

void NuMMRunNSINubar::InverseOscillateTauBar ( NuMatrixSpectrum nutau,
const NuMMParameters pars 
) const [private]

Definition at line 655 of file NuMMRunNSINubar.cxx.

References NuMMParameters::Alpha(), NuMatrix1D::DecayMuToTau(), NuMMParameters::Dm2(), NuMMParameters::Dm2Bar(), NuMMParameters::Epsilon(), NuMMRun::fDisappearanceModel, NuMatrix1D::InverseDecohere(), NuMatrixSpectrum::InverseOscillate(), NuMatrixSpectrum::InverseOscillateNSI(), NuMMParameters::Mu2(), NuMMParameters::Sn2(), and NuMMParameters::Sn2Bar().

Referenced by MakeFDPred(), and TrueComponents().

00657 {
00658   switch(fDisappearanceModel){
00659   case 0:
00660     nutau.InverseOscillate(pars.Dm2Bar(), pars.Sn2Bar());
00661     return;
00662   case 1:
00663     nutau.DecayMuToTau(pars.Dm2Bar(), pars.Sn2Bar(), pars.Alpha());
00664     return;
00665   case 2:
00666     nutau.InverseDecohere(pars.Dm2Bar(), pars.Sn2Bar(), pars.Mu2());
00667     return; 
00668   case 3:
00669     // Oscillate nubar with dm2 and sn2 too. The only difference is the 
00670     // sign of epsilon
00671     nutau.InverseOscillateNSI(pars.Dm2(), pars.Sn2(), pars.Epsilon(), -1.0);
00672     return;
00673   default:
00674     assert(0 && "Badly configured disappearance model");
00675   }
00676 }

vector< NuMatrixSpectrum > NuMMRunNSINubar::MakeFDPred ( const NuMMParameters pars  )  [virtual]

Definition at line 235 of file NuMMRunNSINubar.cxx.

References CalculateFDFlux(), CalculateFDNCBackground(), CalculateFDTauFlux(), NuMMParameters::Dm2(), NuMMParameters::Dm2Bar(), NuMMParameters::Epsilon(), NuMMHelperPRL::FDCCContamination(), NuMMHelperPRL::FDCCContaminationRecoVsTrue(), NuMMHelperPRL::FDEfficiency(), NuMMHelperPRL::FDRecoVsTrue(), NuMMHelperPRL::FDTauEfficiency(), NuMMHelperPRL::FDTauRecoVsTrue(), fFDCCData, fFDFlux, fFDNCBackground, fFDTauFlux, fHelper, NuMMRun::fQuietMode, fSpecialWSBackgroundFlux, fSpecialWSMode, InverseOscillateTauBar(), NuMatrixSpectrum::Multiply(), NuMMParameters::NCBackgroundScale(), NuMMParameters::Normalisation(), OscillateNuBar(), OscillateNuMu(), NuMatrixSpectrum::RemoveErrors(), NuMatrixSpectrum::SetName(), NuMatrixSpectrum::SetTitle(), NuMMParameters::ShwEnScale(), NuMMParameters::Sn2(), NuMMParameters::Sn2Bar(), NuMMParameters::TrkEnScale(), NuMatrixSpectrum::TrueToReco(), and WriteToJess().

00236 {
00237   if (!fQuietMode) {
00238     cout << "sn2: " << pars.Sn2() << "; dm2: " << pars.Dm2() 
00239          << "; sn2bar: " << pars.Sn2Bar() << "; dm2bar: " << pars.Dm2Bar()
00240          << "; epsilon: "<< pars.Epsilon()
00241          << endl
00242          << "; norm: " << pars.Normalisation() 
00243          << "; NCBack: " << pars.NCBackgroundScale()
00244          << "; TrkEn: " << pars.TrkEnScale()
00245          << "; ShwEn: " << pars.ShwEnScale() << endl;
00246   }
00247 
00248   fFDFlux = this->CalculateFDFlux(pars.NCBackgroundScale());
00249   fFDTauFlux = this->CalculateFDTauFlux(pars.NCBackgroundScale());
00250   fFDNCBackground = this->CalculateFDNCBackground(pars.NCBackgroundScale());
00251   
00252   //Pick up the pre-calculated stuff
00253   // TODO CJB - the destruction of these histograms takes ages
00254   NuMatrixSpectrum nuPrediction = fFDFlux[0];  
00255   NuMatrixSpectrum potentialTaus = fFDTauFlux[0];
00256   NuMatrixSpectrum wsBackground = fFDFlux[0];
00257   NuMatrixSpectrum ncBackground = fFDNCBackground[0];
00258 
00259   //Do extrapolation
00260   potentialTaus.Multiply(fHelper->FDTauEfficiency());
00261   
00262   wsBackground.Multiply(fHelper->FDCCContamination());
00263   if (fSpecialWSMode){
00264     wsBackground = fSpecialWSBackgroundFlux[0];
00265   }
00266 
00267   WriteToJess(wsBackground,"wsBackground", false);
00268   OscillateNuMu(wsBackground, pars);
00269   WriteToJess(wsBackground,"wsBackground", true);
00270   wsBackground.TrueToReco(fHelper->FDCCContaminationRecoVsTrue());
00271 
00272   nuPrediction.Multiply(fHelper->FDEfficiency());
00273   
00274   WriteToJess(nuPrediction,"nuPrediction", false);
00275   //  cout << "nuPrediction, before: " <<nuPrediction.Spectrum()->Integral() << endl;
00276   OscillateNuBar(nuPrediction, pars);
00277   //  cout << "nuPrediction, after: " <<nuPrediction.Spectrum()->Integral() << endl;
00278   WriteToJess(nuPrediction,"nuPrediction", true);
00279 
00280   WriteToJess(potentialTaus,"potentialTaus", false);
00281   InverseOscillateTauBar(potentialTaus, pars);
00282   WriteToJess(potentialTaus,"potentialTaus", true);
00283   
00284   potentialTaus.TrueToReco(fHelper->FDTauRecoVsTrue());
00285   nuPrediction.TrueToReco(fHelper->FDRecoVsTrue());
00286 
00287   ncBackground.Multiply(pars.NCBackgroundScale());
00288 
00289   WriteToJess(ncBackground,"ncBackground", false);
00290   // We don't oscillate the NC background. Which means it doesn't get
00291   // decayed or decohered either. Probably OK since it's a tiny component,
00292   // but not exactly ideal.
00293 
00294   // Get systematic shifts
00295 
00296 
00297   //  TFile *fSystPQ = new TFile("/minos/app/zisvan/NSI_kNN/Systematics/rhc_syst_shifts_py.root");
00298   TFile *fSystPQ = new TFile("$SRT_PRIVATE_CONTEXT/NuMuBar/macros/zeynep_nsi/Systematics/rhc_syst_shifts_py.root");
00299 
00300   TH1D *trackBandPQ = (TH1D*)fSystPQ->Get("fdPredTrackEnergyOverall");
00301   trackBandPQ->Scale(pars.TrkEnScale());
00302   for(Int_t i=0; i<trackBandPQ->GetNbinsX()+1; ++i){
00303     trackBandPQ->SetBinContent(i, trackBandPQ->GetBinContent(i)+1);
00304   }
00305   nuPrediction.Multiply(trackBandPQ);
00306 
00307   TH1D *showerBandPQ = (TH1D*)fSystPQ->Get("fdPredShowerEnergyScaleFunctionBoth");
00308   showerBandPQ->Scale(pars.ShwEnScale());
00309   for(Int_t i=0; i<showerBandPQ->GetNbinsX()+1; ++i){
00310     showerBandPQ->SetBinContent(i, showerBandPQ->GetBinContent(i)+1);
00311   }
00312   nuPrediction.Multiply(showerBandPQ);
00313 
00314   TH1D *ncBandPQ = (TH1D*)fSystPQ->Get("fdPredNCBackground");
00315   ncBandPQ->Scale(pars.NCBackgroundScale());
00316   for(Int_t i=0; i<ncBandPQ->GetNbinsX()+1; ++i){
00317     ncBandPQ->SetBinContent(i, ncBandPQ->GetBinContent(i)+1);
00318   }
00319   nuPrediction.Multiply(ncBandPQ);
00320 
00321   TH1D *trackBandWSPQ = (TH1D*)fSystPQ->Get("wsBackgroundTrackEnergyOverall");
00322   trackBandWSPQ->Scale(pars.TrkEnScale());
00323   for(Int_t i=0; i<trackBandWSPQ->GetNbinsX()+1; ++i){
00324     trackBandWSPQ->SetBinContent(i, trackBandWSPQ->GetBinContent(i)+1);
00325   }
00326   wsBackground.Multiply(trackBandWSPQ);
00327 
00328   TH1D *showerBandWSPQ = (TH1D*)fSystPQ->Get("wsBackgroundShowerEnergyScaleFunctionBoth");
00329   showerBandWSPQ->Scale(pars.ShwEnScale());
00330   for(Int_t i=0; i<showerBandWSPQ->GetNbinsX()+1; ++i){
00331     showerBandWSPQ->SetBinContent(i, showerBandWSPQ->GetBinContent(i)+1);
00332   }
00333   wsBackground.Multiply(showerBandWSPQ);
00334 
00335   TH1D *ncBandWSPQ = (TH1D*)fSystPQ->Get("wsBackgroundNCBackground");
00336   ncBandWSPQ->Scale(pars.NCBackgroundScale());
00337   for(Int_t i=0; i<ncBandWSPQ->GetNbinsX()+1; ++i){
00338     ncBandWSPQ->SetBinContent(i, ncBandWSPQ->GetBinContent(i)+1);
00339   }
00340   wsBackground.Multiply(ncBandWSPQ);
00341 
00342   fSystPQ->Close();
00343 
00344 
00345 //   // Shifting signal
00346 //   TFile *fSyst_PQ = new TFile("/minos/app/zisvan/NSI_kNN/Systematics/rhc_syst_shifts.root");
00347 
00348 //   TH1D *trackBand_PQ = (TH1D*)fSyst_PQ->Get("hUpTrk");
00349 //   trackBand_PQ->Scale(pars.TrkEnScale());
00350 //   for(Int_t i=0; i<trackBand_PQ->GetNbinsX()+1; ++i){
00351 //     trackBand_PQ->SetBinContent(i, trackBand_PQ->GetBinContent(i)+1);
00352 //   }
00353 //   nuPrediction.Multiply(trackBand_PQ);
00354 
00355 //   TH1D *showerBand_PQ = (TH1D*)fSyst_PQ->Get("hUpShw");
00356 //   showerBand_PQ->Scale(pars.ShwEnScale());
00357 //   for(Int_t i=0; i<showerBand_PQ->GetNbinsX()+1; ++i){
00358 //     showerBand_PQ->SetBinContent(i, showerBand_PQ->GetBinContent(i)+1);
00359 //   }
00360 //   nuPrediction.Multiply(showerBand_PQ);
00361   
00362 //   TH1D *ncBand_PQ = (TH1D*)fSyst_PQ->Get("hUpNC");
00363 //   ncBand_PQ->Scale(pars.NCBackgroundScale());
00364 //   for(Int_t i=0; i<ncBand_PQ->GetNbinsX()+1; ++i){
00365 //     ncBand_PQ->SetBinContent(i, ncBand_PQ->GetBinContent(i)+1);
00366 //   }
00367 //   nuPrediction.Multiply(ncBand_PQ);
00368 
00369 //   fSyst_PQ->Close();
00370 
00371 //   // Shifting WS background
00372 //   TFile *fSystWS_PQ = new TFile("/minos/app/zisvan/NSI_kNN/Systematics/rhc_syst_shifts_ws.root");
00373 
00374 //   TH1D *trackBandWS_PQ = (TH1D*)fSystWS_PQ->Get("hUpTrk");
00375 //   trackBandWS_PQ->Scale(pars.TrkEnScale());
00376 //   for(Int_t i=0; i<trackBandWS_PQ->GetNbinsX()+1; ++i){
00377 //     trackBandWS_PQ->SetBinContent(i, trackBandWS_PQ->GetBinContent(i)+1);
00378 //   }
00379 //   wsBackground.Multiply(trackBandWS_PQ);
00380 
00381 //   TH1D *showerBandWS_PQ = (TH1D*)fSystWS_PQ->Get("hUpShw");
00382 //   showerBandWS_PQ->Scale(pars.ShwEnScale());
00383 //   for(Int_t i=0; i<showerBandWS_PQ->GetNbinsX()+1; ++i){
00384 //     showerBandWS_PQ->SetBinContent(i, showerBandWS_PQ->GetBinContent(i)+1);
00385 //   }
00386 //   wsBackground.Multiply(showerBandWS_PQ);
00387 
00388 //   TH1D *ncBandWS_PQ = (TH1D*)fSystWS_PQ->Get("hUpNC");
00389 //   ncBandWS_PQ->Scale(pars.NCBackgroundScale());
00390 //   for(Int_t i=0; i<ncBandWS_PQ->GetNbinsX()+1; ++i){
00391 //     ncBandWS_PQ->SetBinContent(i, ncBandWS_PQ->GetBinContent(i)+1);
00392 //   }
00393 //   wsBackground.Multiply(ncBandWS_PQ);
00394 
00395 
00396 //   fSystWS_PQ->Close();
00397 
00398   //Done shifting//
00399 
00400   nuPrediction.Add(ncBackground);
00401   nuPrediction.Add(potentialTaus);
00402   nuPrediction.Add(wsBackground);
00403 
00404   nuPrediction.Multiply(pars.Normalisation());
00405 
00406 
00407   WriteToJess(*fFDCCData, "data", false);
00408 
00409   //Prediction is done. Now fix the stupid error bars and give it a
00410   //better name
00411   nuPrediction.RemoveErrors();
00412   nuPrediction.SetName("fdPred");  
00413   nuPrediction.SetTitle("fdPred");  
00414   vector<NuMatrixSpectrum> ccPredictions;
00415   ccPredictions.push_back(nuPrediction);
00416 
00417   //Return these as well to be used with Feldman-Cousins sampling for NSI
00418   wsBackground.RemoveErrors();
00419   wsBackground.SetName("wsBackground");  
00420   wsBackground.SetTitle("wsBackground");  
00421 
00422   ncBackground.RemoveErrors();
00423   ncBackground.SetName("ncBackground");  
00424   ncBackground.SetTitle("ncBackground");  
00425 
00426   potentialTaus.RemoveErrors();
00427   potentialTaus.SetName("potentialTaus");  
00428   potentialTaus.SetTitle("potentialTaus");  
00429 
00430   ccPredictions.push_back(wsBackground);
00431   ccPredictions.push_back(ncBackground);
00432   ccPredictions.push_back(potentialTaus);
00433 
00434   return ccPredictions;
00435 }

void NuMMRunNSINubar::OscillateNuBar ( NuMatrixSpectrum numu,
const NuMMParameters pars 
) const [private]

Definition at line 609 of file NuMMRunNSINubar.cxx.

References NuMMParameters::Alpha(), NuMatrix1D::DecayCC(), NuMatrix1D::Decohere(), NuMMParameters::Dm2(), NuMMParameters::Dm2Bar(), NuMMParameters::Epsilon(), NuMMRun::fDisappearanceModel, NuMMParameters::Mu2(), NuMatrixSpectrum::Oscillate(), NuMatrixSpectrum::OscillateNSI(), NuMMParameters::Sn2(), and NuMMParameters::Sn2Bar().

Referenced by MakeFDPred(), and TrueComponents().

00611 {
00612   switch(fDisappearanceModel){
00613   case 0:
00614     numu.Oscillate(pars.Dm2Bar(), pars.Sn2Bar());
00615     return;
00616   case 1:
00617     numu.DecayCC(pars.Dm2Bar(), pars.Sn2Bar(), pars.Alpha());
00618     return;
00619   case 2:
00620     numu.Decohere(pars.Dm2Bar(), pars.Sn2Bar(), pars.Mu2());
00621     return;
00622   case 3: 
00623     // Oscillate nubar with dm2 and sn2 too. The only difference is the 
00624     // sign of epsilon
00625     numu.OscillateNSI(pars.Dm2(), pars.Sn2(), pars.Epsilon(), -1.0);
00626     return;
00627   default:
00628     assert(0 && "Badly configured disappearance model");
00629   }
00630 }

void NuMMRunNSINubar::OscillateNuMu ( NuMatrixSpectrum numu,
const NuMMParameters pars 
) const [private]

Helper. Oscillates, decays or decoheres a true energy numu spectrum.

Definition at line 586 of file NuMMRunNSINubar.cxx.

References NuMMParameters::Alpha(), NuMatrix1D::DecayCC(), NuMatrix1D::Decohere(), NuMMParameters::Dm2(), NuMMParameters::Epsilon(), NuMMRun::fDisappearanceModel, NuMMParameters::Mu2(), NuMatrixSpectrum::Oscillate(), NuMatrixSpectrum::OscillateNSI(), and NuMMParameters::Sn2().

Referenced by MakeFDPred(), and TrueComponents().

00589 {
00590   switch(fDisappearanceModel){
00591   case 0:
00592     numu.Oscillate(pars.Dm2(), pars.Sn2());
00593     return;
00594   case 1:
00595     numu.DecayCC(pars.Dm2(), pars.Sn2(), pars.Alpha());
00596     return;
00597   case 2:
00598     numu.Decohere(pars.Dm2(), pars.Sn2(), pars.Mu2());
00599     return;
00600   case 3: 
00601     numu.OscillateNSI(pars.Dm2(), pars.Sn2(), pars.Epsilon(), 1.0);
00602     return;
00603   default:
00604     assert(0 && "Badly configured disappearance model");
00605   }
00606 }

void NuMMRunNSINubar::PrecalculateWSFlux ( NuMMHelperPRL helper,
const NuMatrixSpectrum ndOtherData 
) [virtual]

Definition at line 544 of file NuMMRunNSINubar.cxx.

References NuMMHelperPRL::BeamMatrixNuMuCCXSec(), NuMatrixSpectrum::Divide(), NuMatrixSpectrum::ExtrapolateNDToFD(), NuMMHelperPRL::FDEfficiencyOtherChargeWS(), fFDCCData, NuMMRun::fFDFidMass, NuMMRun::fNDFidMass, fSpecialWSBackgroundFlux, fSpecialWSMode, NuMatrix::GetPOT(), NuMatrixSpectrum::Multiply(), NuMMHelperPRL::NDCCContamination(), NuMMHelperPRL::NDEfficiency(), NuMMHelperPRL::NDPurity(), NuMMHelperPRL::NDRecoVsTrue(), NuMatrixSpectrum::RecoToTrue(), SanityCheckSpecialWSFiles(), and NuMatrix1D::Subtract().

00546 {
00547   cout << "Running PrecalculateWSFlux" << endl;
00548   this->SanityCheckSpecialWSFiles(helper,ndOtherData);
00549   fSpecialWSMode = true;
00550   fSpecialWSBackgroundFlux.clear();
00551   NuMatrixSpectrum prediction(*ndOtherData);
00552   NuMatrixSpectrum wsBackground(prediction);
00553   prediction.Multiply(helper->NDPurity());
00554   
00555   wsBackground.Multiply(helper->NDCCContamination());
00556   prediction.Subtract(wsBackground);
00557   
00558   prediction.RecoToTrue(helper->NDRecoVsTrue());
00559   prediction.Divide(helper->NDEfficiency());
00560   prediction.Divide(ndOtherData->GetPOT());
00561   prediction.Divide(fNDFidMass);
00562   prediction.ExtrapolateNDToFD(helper->BeamMatrixNuMuCCXSec());
00563   prediction.Multiply(fFDFidMass);
00564   prediction.Multiply(fFDCCData->GetPOT());
00565   prediction.Multiply(helper->FDEfficiencyOtherChargeWS());
00566   
00567   fSpecialWSBackgroundFlux.push_back(prediction);
00568 }

void NuMMRunNSINubar::SanityCheckSpecialWSFiles ( NuMMHelperPRL helper,
const NuMatrixSpectrum ndOtherData 
) const [private, virtual]

Definition at line 489 of file NuMMRunNSINubar.cxx.

References NuMMHelperPRL::NDEfficiency(), and NuMatrixSpectrum::Spectrum().

Referenced by PrecalculateWSFlux().

00491 {
00492 
00493   string dataName = fNDCCData->Spectrum()->GetName();
00494   string otherDataName = ndOtherData->Spectrum()->GetName();
00495   string helperEffName = helper->NDEfficiency()->GetName();
00496 
00497   if ("RecoEnergy_ND" == dataName){
00498     if ("RecoEnergyPQ_ND" == otherDataName){
00499       cout << "You are extrapolating NuMu data. "
00500            << "WS histograms sanity checked as OK."
00501            << endl;
00502     }
00503     else{
00504       cout << "You are extrapolating NuMu data. "
00505            << "WS histograms failing sanity check."
00506            << endl;
00507       assert(false);
00508     }
00509     if ("EfficiencyPQ_ND" == helperEffName){
00510       cout << "WS helper sanity checked as OK."
00511            << endl;
00512     }
00513     else{
00514       cout << "WS helper failing sanity check."
00515            << endl;
00516       assert(false);
00517     }
00518   }
00519   else if ("RecoEnergyPQ_ND" == dataName){
00520     if ("RecoEnergy_ND" == otherDataName){
00521       cout << "You are extrapolating NuMu data. "
00522            << "WS histograms sanity checked as OK."
00523            << endl;
00524     }
00525     else{
00526       cout << "You are extrapolating NuMu data. "
00527            << "WS histograms failing sanity check."
00528            << endl;
00529       assert(false);
00530     }
00531     if ("Efficiency_ND" == helperEffName){
00532       cout << "WS helper sanity checked as OK."
00533            << endl;
00534     }
00535     else{
00536       cout << "WS helper failing sanity check."
00537            << endl;
00538       assert(false);
00539     }
00540   }
00541 }

virtual void NuMMRunNSINubar::SetFDData ( NuMatrixSpectrum fdData  )  [inline, virtual]

Definition at line 40 of file NuMMRunNSINubar.h.

References fFDCCData.

00040 {fFDCCData = fdData;}

NuMatrixSpectrum NuMMRunNSINubar::TrueComponents ( const NuMMParameters pars,
Sample_t  s 
) const [virtual]

Return the individual true energy prediction of the far detector sub sample s with oscillation parameters described in pars. Default implementation just drops an error.

Reimplemented from NuMMRun.

Definition at line 437 of file NuMMRunNSINubar.cxx.

References NuMMParameters::Dm2(), NuMMParameters::Dm2Bar(), NuMMParameters::Epsilon(), NuMMHelperPRL::FDCCContamination(), NuMMHelperPRL::FDEfficiency(), fFDFlux, fFDNCBackground, fFDTauFlux, fHelper, NuMMRun::fQuietMode, InverseOscillateTauBar(), Sample::kNCBackNSI, Sample::kSignalNSI, Sample::kTauNSI, Msg::kWarning, Sample::kWSBackNSI, MSG, NuMatrixSpectrum::Multiply(), OscillateNuBar(), OscillateNuMu(), NuMatrixSpectrum::SetName(), NuMMParameters::Sn2(), NuMMParameters::Sn2Bar(), and NuMatrixSpectrum::Spectrum().

Referenced by NuFCExperimentFactoryNSI::GenerateNewExperiment().

00438 {
00439   // Output the oscillation settings!
00440   if (!fQuietMode) {
00441     cout << "sn2: " << pars.Sn2() << "; dm2: " << pars.Dm2() 
00442          << "; sn2bar: " << pars.Sn2Bar() << "; dm2bar: " << pars.Dm2Bar()
00443          << "; epsilon: " << pars.Epsilon() << endl;
00444   }
00445   
00446   if (s == kSignalNSI) {
00447     NuMatrixSpectrum prediction = fFDFlux[0];
00448     prediction.Multiply(fHelper->FDEfficiency());
00449     //    cout << s << ", before osc. " << prediction.Spectrum()->Integral() << endl;
00450     OscillateNuBar(prediction,pars);
00451     //    cout << s << ", after osc. " << prediction.Spectrum()->Integral() << endl;
00452     return prediction;
00453   }
00454 
00455   else if (s == kWSBackNSI) {
00456     NuMatrixSpectrum wrongSign = fFDFlux[0];
00457     wrongSign.Multiply(fHelper->FDCCContamination());
00458     //    cout << s << ", before osc. " << wrongSign.Spectrum()->Integral() << endl;
00459     OscillateNuMu(wrongSign,pars);
00460     //    cout << s << ", after osc. " << wrongSign.Spectrum()->Integral() << endl;
00461     return wrongSign;
00462   }
00463   else if (s == kNCBackNSI) {
00464     NuMatrixSpectrum ncBackground = fFDNCBackground[0];
00465     //    cout << s << ", not oscillating " << ncBackground.Spectrum()->Integral() << endl;
00466     return ncBackground;
00467   }
00468 
00469   else if (s == kTauNSI) {
00470     NuMatrixSpectrum potentialTaus = fFDTauFlux[0];
00471     //    cout << s << ", before osc. " << potentialTaus.Spectrum()->Integral() << endl;
00472     InverseOscillateTauBar(potentialTaus,pars);
00473     //    cout << s << ", after osc. " << potentialTaus.Spectrum()->Integral() << endl;
00474     return potentialTaus;
00475   }
00476 
00477   else {
00478     MSG("NuMMRunNSINubar",Msg::kWarning) << "Requested unknown prediction #" << s << ", returning blank." << endl;
00479     NuMatrixSpectrum blank = fFDFlux[0];
00480     blank.SetName("Blank");
00481     blank.Spectrum()->Scale(0);
00482     return blank;
00483   }
00484 }

std::vector< TH1D > NuMMRunNSINubar::WriteFDPredHistos ( const NuMMParameters pars  )  const [virtual]

Implements NuMMRun.

Definition at line 42 of file NuMMRunNSINubar.cxx.

References NuMatrix1D::Add(), NuMatrixSpectrum::Multiply(), NuMatrixSpectrum::Spectrum(), and NuMatrixSpectrum::TrueToReco().

00043 {
00044   vector<TH1D> vHistos;
00045 
00046   NuMatrixSpectrum nuPrediction = fFDFlux[0];
00047   
00048   TH1D hNDData(*(fNDCCData->Spectrum()));
00049   hNDData.SetName("ndData");
00050   hNDData.SetTitle("ndData");
00051   vHistos.push_back(*(new TH1D(hNDData)));
00052   
00053   NuMatrixSpectrum potentialTaus(fFDTauFlux[0]);
00054   potentialTaus.Multiply(fHelper->FDTauEfficiency());
00055 
00056   nuPrediction.Multiply(fHelper->FDEfficiency());
00057 
00058   NuMatrixSpectrum ncBackground = fFDNCBackground[0];
00059   
00060   //oscillate right signs as nubars
00061   OscillateNuBar(nuPrediction, pars);
00062   InverseOscillateTauBar(potentialTaus, pars);
00063   
00064   //Output the prediction in true energy
00065   TH1D hTrueFDPrediction(*(nuPrediction.Spectrum()));
00066   hTrueFDPrediction.SetName("fdTruePrediction");
00067   vHistos.push_back(hTrueFDPrediction);
00068   
00069   potentialTaus.TrueToReco(fHelper->FDTauRecoVsTrue());  
00070   nuPrediction.TrueToReco(fHelper->FDRecoVsTrue());
00071   
00072   //Get the prediction in reco energy
00073   TH1D hBaseFDPrediction(*(nuPrediction.Spectrum()));
00074   hBaseFDPrediction.SetName("fdBasePrediction");
00075   vHistos.push_back(hBaseFDPrediction);
00076   
00077   // Add in the backgrounds: NC
00078   nuPrediction.Add(ncBackground);
00079   // tau
00080   if (0==fDisappearanceModel || 3==fDisappearanceModel){
00081     nuPrediction.Add(potentialTaus);
00082   }
00083   // WS
00084   //oscillate ws as nus
00085   NuMatrixSpectrum wsBackground = fFDFlux[0];
00086   wsBackground.Multiply(fHelper->FDCCContamination());
00087   if(fSpecialWSMode) wsBackground = fSpecialWSBackgroundFlux[0];
00088   OscillateNuMu(wsBackground, pars);
00089   wsBackground.TrueToReco(fHelper->FDCCContaminationRecoVsTrue());
00090   nuPrediction.Add(wsBackground);
00091   
00092   //Get the prediction with backgrounds
00093   TH1D hFDPrediction(*(nuPrediction.Spectrum()));  
00094   hFDPrediction.SetName("fdPrediction");
00095   vHistos.push_back(hFDPrediction);
00096   
00097   TH1D hFDTaus(*(potentialTaus.Spectrum()));
00098   hFDTaus.SetName("fdTaus");
00099   vHistos.push_back(hFDTaus);
00100   
00101   TH1D hFDNCBackground(*(ncBackground.Spectrum()));
00102   hFDNCBackground.SetName("fdNCBackground");
00103   vHistos.push_back(hFDNCBackground);
00104 
00105   TH1D hFDWSBackground(*(wsBackground.Spectrum()));
00106   hFDWSBackground.SetName("fdWSBackground");
00107   vHistos.push_back(hFDWSBackground);
00108   
00109   TH1D hfdData(*(fFDCCData->Spectrum()));
00110   hfdData.SetName("fdData");
00111   vHistos.push_back(hfdData);
00112 
00113   return vHistos;
00114 }

void NuMMRunNSINubar::WriteToJess ( NuMatrixSpectrum  spectrum,
const std::string  name,
bool  osc 
) [private, virtual]

Definition at line 679 of file NuMMRunNSINubar.cxx.

References NuMMHelperPRL::FDCCContaminationRecoVsTrue(), NuMMHelperPRL::FDRecoVsTrue(), NuMMHelperPRL::FDTauRecoVsTrue(), fHelper, NuMMRun::fJessFile, Msg::kError, NuMatrixSpectrum::MakeJessTemplate(), MSG, NuMatrixSpectrum::RemoveErrors(), and NuMatrixSpectrum::Spectrum().

Referenced by MakeFDPred().

00682 {
00683   // If they don't want the plots don't try to give them
00684   if (!fJessFile) return;
00685 
00686   const string opName = osc ? (name+"_osc") : name;
00687 
00688   fJessFile->cd();
00689   if ("wsBackground" == name){
00690     TH2D jessHist =
00691       spectrum.MakeJessTemplate(fHelper->FDCCContaminationRecoVsTrue());
00692     jessHist.Write(opName.c_str());
00693   }
00694   else if ("nuPrediction" == name){
00695     TH2D jessHist =
00696       spectrum.MakeJessTemplate(fHelper->FDRecoVsTrue());
00697     jessHist.Write(opName.c_str());
00698   }
00699   else if ("potentialTaus" == name){
00700     TH2D jessHist =
00701       spectrum.MakeJessTemplate(fHelper->FDTauRecoVsTrue());
00702     jessHist.Write(opName.c_str());
00703   }
00704   else if ("ncBackground" == name){
00705     spectrum.RemoveErrors();
00706     spectrum.Spectrum()->Write(opName.c_str());
00707   }
00708   else if ("data" == name){
00709     spectrum.Spectrum()->Write(opName.c_str());
00710   }
00711   else{
00712     MSG("NuMatrixSpectrum", Msg::kError)
00713       << "You're trying to write a Jess template which has an "
00714       << "unrecognized name"
00715       << endl;
00716   }
00717 }


Member Data Documentation

Definition at line 70 of file NuMMRunNSINubar.h.

Referenced by MakeFDPred(), and TrueComponents().

Definition at line 72 of file NuMMRunNSINubar.h.

Referenced by MakeFDPred(), and TrueComponents().

Definition at line 71 of file NuMMRunNSINubar.h.

Referenced by MakeFDPred(), and TrueComponents().

Definition at line 73 of file NuMMRunNSINubar.h.

Referenced by MakeFDPred(), and PrecalculateWSFlux().

Definition at line 66 of file NuMMRunNSINubar.h.

Referenced by MakeFDPred(), and PrecalculateWSFlux().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1