NuFluctuator Class Reference

#include <NuFluctuator.h>

List of all members.

Public Types

enum  NuSelectionResult_t { kCCNuMuBar = 1, kCCNuMu = 2, kUnknown = 0 }

Public Member Functions

 NuFluctuator ()
virtual ~NuFluctuator ()
virtual TH1D Fluctuate (TH1D *hin) const
virtual TH1D FluctuateSampling (TH1D *hin) const
virtual const TH1D NuMuCCFakeData () const
virtual const TH1D NuBarCCFakeData () const
virtual const TH1D NuMuCCScaledData () const
virtual const TH1D NuBarCCScaledData () const
virtual void MakeCPTPDFs () const
virtual void MakeShiftedCPTPDFs (const TString &xmlConfigFile) const
virtual Double_t Oscillate (NuEvent &event) const
virtual void MakeTransitionPDFs ()
virtual void MakeShiftedTransitionPDFs (const TString &xmlConfigFile)
virtual void NuBarCCRecoEBinning (const std::vector< Double_t > &nubarBins)
virtual void NuMuCCRecoEBinning (const std::vector< Double_t > &numuBins)
virtual void MonteCarlo (const std::string &mcFileName)
virtual void FakeDataPoT (const Double_t fakeDataPoT)
virtual void NuMuDm2 (const Double_t numuDm2)
virtual void NuMuSn2 (const Double_t numuSn2)
virtual void NuBarDm2 (const Double_t nubarDm2)
virtual void NuBarSn2 (const Double_t nubarSn2)
virtual void Selection (const NuCuts::NuAnaVersion_t selection)
virtual NuSelectionResult_t SelectedAs (NuEvent &nuEvent) const
virtual void SelectionEfficiencyFileName (const std::string &selEffFileName)
virtual void TransitionProb (const Double_t transitionProb)

Private Member Functions

virtual Double_t Baseline () const
virtual Bool_t CheckConfigForPDFMaking () const
virtual void ConfigHistosForTransitionAnalysis ()
virtual Double_t NuBarCCCrossSection (const Double_t trueNuE) const
virtual Double_t NuMuCCCrossSection (const Double_t trueNuE) const
virtual Double_t NuBarCCSelectionEfficiency (const Double_t trueNuE) const
virtual Double_t NuMuCCSelectionEfficiency (const Double_t trueNuE) const
virtual void PDFsFilled (const Bool_t pdfsFilled)
virtual NuCuts::NuAnaVersion_t SelectionScheme () const

Private Attributes

Bool_t fPDFsFilled
Double_t fFakeDataPoT
Double_t fMCPoT
Double_t fNuMuDm2
Double_t fNuMuSn2
Double_t fNuBarDm2
Double_t fNuBarSn2
Double_t fTransitionProb
NuCuts::NuAnaVersion_t fSelection
TH1D * fhNuBarCCRecoE
TH1D * fhNuMuCCRecoE
TRandom3 * fRandom
NuTreeWrapperfMonteCarlo
std::string fxsecfilename
std::string fSelEffFileName
TGraph * fNuBarCCCrossSectionGraph
TGraph * fNuMuCCCrossSectionGraph
TH1D * fhNuBarCCSelectionEfficiency
TH1D * fhNuMuCCSelectionEfficiency
TH1F * fhNuBarCCCrossSections
TH1F * fhNuMuCCCrossSections

Detailed Description

Definition at line 29 of file NuFluctuator.h.


Member Enumeration Documentation

Enumerator:
kCCNuMuBar 
kCCNuMu 
kUnknown 

Definition at line 33 of file NuFluctuator.h.

00033                {
00034     kCCNuMuBar = 1,
00035     kCCNuMu = 2,
00036     kUnknown = 0
00037   } NuSelectionResult_t;


Constructor & Destructor Documentation

NuFluctuator::NuFluctuator (  )  [explicit]

Definition at line 107 of file NuFluctuator.cxx.

00108   : fPDFsFilled(false),
00109     fFakeDataPoT(0.0),
00110     fMCPoT(0.0),
00111     fNuMuDm2(0.0),
00112     fNuMuSn2(0.0),
00113     fNuBarDm2(0.0),
00114     fNuBarSn2(0.0),
00115     fTransitionProb(0.0),
00116     fSelection(NuCuts::kUnknown)
00117 {
00118   fhNuMuCCRecoE = 0;
00119   fhNuBarCCRecoE = 0;
00120   fMonteCarlo = 0;
00121   fRandom = new TRandom3(0);
00122   fxsecfilename = "$SRT_PRIVATE_CONTEXT/NtupleUtils/data/xsec_minos_modbyrs4_v3_5_0_mk.root";
00123   fSelEffFileName = "/minos/scratch/ahimmel/SystematicsStudies/Transitions/CombinedHelpers.root";
00124   fNuBarCCCrossSectionGraph = 0;
00125   fNuMuCCCrossSectionGraph = 0;
00126   fhNuBarCCSelectionEfficiency = 0;
00127   fhNuMuCCSelectionEfficiency = 0;
00128   fhNuBarCCCrossSections = 0;
00129   fhNuMuCCCrossSections = 0;
00130 }

NuFluctuator::~NuFluctuator (  )  [virtual]

Definition at line 133 of file NuFluctuator.cxx.

References fhNuBarCCRecoE, fhNuMuCCRecoE, and fMonteCarlo.

00134 {
00135   if (fhNuMuCCRecoE) {
00136     delete fhNuMuCCRecoE; fhNuMuCCRecoE = 0;
00137   }
00138   if (fhNuBarCCRecoE) {
00139     delete fhNuBarCCRecoE; fhNuBarCCRecoE = 0;
00140   }
00141   if (fMonteCarlo) {
00142     delete fMonteCarlo; fMonteCarlo = 0;
00143   }
00144 }


Member Function Documentation

virtual Double_t NuFluctuator::Baseline (  )  const [inline, private, virtual]

Definition at line 104 of file NuFluctuator.h.

00104 {return 735.0;}

Bool_t NuFluctuator::CheckConfigForPDFMaking (  )  const [private, virtual]

Definition at line 176 of file NuFluctuator.cxx.

References fFakeDataPoT, fhNuBarCCRecoE, fhNuMuCCRecoE, fMCPoT, fMonteCarlo, Msg::kError, Msg::kWarning, and MSG.

Referenced by MakeCPTPDFs(), MakeShiftedCPTPDFs(), MakeShiftedTransitionPDFs(), and MakeTransitionPDFs().

00177 {
00178   if (!fhNuMuCCRecoE){
00179     MSG("NuFluctuator",Msg::kError)
00180       << "NuMuCC binning not supplied"
00181       << endl;
00182     return false;
00183   }
00184   if (!fhNuBarCCRecoE){
00185     MSG("NuFluctuator",Msg::kError)
00186       << "NuBarCC binning not supplied"
00187       << endl;
00188     return false;
00189   }
00190   if (!fMonteCarlo){
00191     MSG("NuFluctuator",Msg::kError)
00192       << "MC not supplied"
00193       << endl;
00194     return false;
00195   }
00196   if (fMCPoT<0.001){
00197     MSG("NuFluctuator",Msg::kError)
00198       << "MC PoT are worryingly small"
00199       << endl;
00200     return false;
00201   }
00202   if (fFakeDataPoT<0.001){
00203     MSG("NuFluctuator",Msg::kWarning)
00204       << "Your requested fake data PoT are worryingly small"
00205       << endl;
00206     return true;
00207   }
00208 
00209   return true;
00210 }

void NuFluctuator::ConfigHistosForTransitionAnalysis (  )  [private, virtual]

Definition at line 213 of file NuFluctuator.cxx.

References fhNuBarCCCrossSections, fhNuBarCCSelectionEfficiency, fhNuMuCCCrossSections, fhNuMuCCSelectionEfficiency, fNuBarCCCrossSectionGraph, fNuMuCCCrossSectionGraph, fSelEffFileName, and fxsecfilename.

Referenced by MakeShiftedTransitionPDFs(), and MakeTransitionPDFs().

00214 {
00215   //Get cross-sections
00216   TFile *xsecfile = new TFile(fxsecfilename.c_str(),"READ");
00217 
00218   if (fNuMuCCCrossSectionGraph){
00219     delete fNuMuCCCrossSectionGraph;
00220     fNuMuCCCrossSectionGraph = 0;
00221   }
00222   if (fhNuMuCCCrossSections){
00223     delete fhNuMuCCCrossSections;
00224     fhNuMuCCCrossSections = 0;
00225   }
00226   TH1F* XSec_CC = (TH1F*) xsecfile->Get("h_numu_cc_tot");
00227   fhNuMuCCCrossSections = new TH1F(*XSec_CC);
00228   fhNuMuCCCrossSections->SetDirectory(0);
00229   Float_t *x = new Float_t[XSec_CC->GetNbinsX()];
00230   Float_t *y = new Float_t[XSec_CC->GetNbinsX()];
00231   for(int i=0;i<XSec_CC->GetNbinsX();i++) {
00232     x[i] = XSec_CC->GetBinCenter(i+1);
00233     y[i] = XSec_CC->GetBinContent(i+1);
00234   }
00235   fNuMuCCCrossSectionGraph = new TGraph(XSec_CC->GetNbinsX(),x,y);
00236   if (x) {delete[] x; x = 0;}
00237   if (y) {delete[] y; y = 0;}
00238 
00239   if (fNuBarCCCrossSectionGraph){
00240     delete fNuBarCCCrossSectionGraph;
00241     fNuBarCCCrossSectionGraph = 0;
00242   }
00243   if (fhNuBarCCCrossSections){
00244     delete fhNuBarCCCrossSections;
00245     fhNuBarCCCrossSections = 0;
00246   }
00247   XSec_CC = (TH1F*) xsecfile->Get("h_numubar_cc_tot");
00248   fhNuBarCCCrossSections = new TH1F(*XSec_CC);
00249   fhNuBarCCCrossSections->SetDirectory(0);
00250   x = new Float_t[XSec_CC->GetNbinsX()];
00251   y = new Float_t[XSec_CC->GetNbinsX()];
00252   for(int i=0;i<XSec_CC->GetNbinsX();i++) {
00253     x[i] = XSec_CC->GetBinCenter(i+1);
00254     y[i] = XSec_CC->GetBinContent(i+1);
00255   }
00256   fNuBarCCCrossSectionGraph = new TGraph(XSec_CC->GetNbinsX(),x,y);
00257   if (x) {delete[] x; x = 0;}
00258   if (y) {delete[] y; y = 0;}
00259 
00260   xsecfile->Close();
00261   if (xsecfile){delete xsecfile; xsecfile = 0;}
00262 
00263   //Get selection efficiencies
00264   TFile* selEffFile = new TFile(fSelEffFileName.c_str(),"READ");
00265 
00266   if (fhNuBarCCSelectionEfficiency){
00267     delete fhNuBarCCSelectionEfficiency;
00268     fhNuBarCCSelectionEfficiency = 0;
00269   }
00270   fhNuBarCCSelectionEfficiency = (TH1D*) selEffFile->Get("EfficiencyPQ_FD");
00271   fhNuBarCCSelectionEfficiency->SetDirectory(0);
00272 
00273   if (fhNuMuCCSelectionEfficiency){
00274     delete fhNuMuCCSelectionEfficiency;
00275     fhNuMuCCSelectionEfficiency = 0;
00276   }
00277   fhNuMuCCSelectionEfficiency = (TH1D*) selEffFile->Get("Efficiency_FD");
00278   fhNuMuCCSelectionEfficiency->SetDirectory(0);
00279 
00280   selEffFile->Close();
00281   if (selEffFile){delete selEffFile; selEffFile = 0;}
00282 }

virtual void NuFluctuator::FakeDataPoT ( const Double_t  fakeDataPoT  )  [inline, virtual]

Definition at line 61 of file NuFluctuator.h.

References fFakeDataPoT.

00062     {fFakeDataPoT = fakeDataPoT;}

TH1D NuFluctuator::Fluctuate ( TH1D *  hin  )  const [virtual]

Definition at line 147 of file NuFluctuator.cxx.

References fRandom.

Referenced by NuMatrixSpectrum::FluctuateMe(), NuBarCCFakeData(), and NuMuCCFakeData().

00148 {
00149         TH1D hData(*hin);
00150   hData.Reset();
00151   //Set all bins, including overflow (not underflow)
00152   for (Int_t binCounter = 1;
00153        binCounter < hin->GetNbinsX() + 2;
00154        ++binCounter){
00155     hData.SetBinContent
00156                  (binCounter,
00157                  fRandom->Poisson(hin->GetBinContent(binCounter)));
00158   }
00159   return hData;
00160 }

TH1D NuFluctuator::FluctuateSampling ( TH1D *  hin  )  const [virtual]

Definition at line 163 of file NuFluctuator.cxx.

References fRandom.

00164 {
00165     TH1D hData(*hin);
00166     hData.Reset();
00167     int entries = fRandom->Poisson(hin->Integral());
00168     //Set all bins, including overflow (not underflow)
00169     for (int i = 0; i < entries; i++) {
00170         hData.Fill(hin->GetRandom());
00171     }
00172     return hData;
00173 }

void NuFluctuator::MakeCPTPDFs (  )  const [virtual]

Definition at line 285 of file NuFluctuator.cxx.

References CheckConfigForPDFMaking(), fFakeDataPoT, fhNuBarCCRecoE, fhNuMuCCRecoE, fMCPoT, fMonteCarlo, NuTreeWrapper::GetEntries(), NuTreeWrapper::GetInfoObject(), kCCNuMu, kCCNuMuBar, Msg::kInfo, MSG, Oscillate(), and SelectedAs().

00286 {
00287   if (!this->CheckConfigForPDFMaking()){return;}
00288 
00289   fhNuMuCCRecoE->Reset();
00290   fhNuBarCCRecoE->Reset();
00291 
00292   Int_t numMCEntries = fMonteCarlo->GetEntries();
00293   for (Int_t eventCounter = 0;
00294        eventCounter < numMCEntries;
00295        ++eventCounter){
00296     if (!(eventCounter%10000)){
00297       MSG("NuFluctuator",Msg::kInfo)
00298                         << eventCounter << " of " << numMCEntries
00299                         << endl
00300                         << "NuMu PDF has " << fhNuMuCCRecoE->GetEntries()
00301                         << " entries; NuBar PDF has "
00302                         << fhNuBarCCRecoE->GetEntries() << " entries."
00303                         << endl;
00304     }
00305     NuEvent event = fMonteCarlo->GetInfoObject(eventCounter);
00306     NuFluctuator::NuSelectionResult_t recoType = this->SelectedAs(event);
00307 
00308 //     Double_t eventWeight = event.rw;
00309     Double_t eventWeight = event.beamWeight;
00310 
00311     //Oscillate
00312                 eventWeight *= Oscillate(event);
00313 
00314     if (recoType==NuFluctuator::kCCNuMu){
00315       fhNuMuCCRecoE->Fill(event.energy,eventWeight);
00316     }
00317     if (recoType==NuFluctuator::kCCNuMuBar){
00318       fhNuBarCCRecoE->Fill(event.energy,eventWeight);
00319     }
00320   }
00321   fhNuMuCCRecoE->Scale(fFakeDataPoT/fMCPoT);
00322   fhNuBarCCRecoE->Scale(fFakeDataPoT/fMCPoT);
00323 }

void NuFluctuator::MakeShiftedCPTPDFs ( const TString &  xmlConfigFile  )  const [virtual]

Definition at line 326 of file NuFluctuator.cxx.

References CheckConfigForPDFMaking(), fFakeDataPoT, fhNuBarCCRecoE, fhNuMuCCRecoE, fMCPoT, fMonteCarlo, NuTreeWrapper::GetEntries(), NuTreeWrapper::GetInfoObject(), kCCNuMu, kCCNuMuBar, Msg::kInfo, MSG, Oscillate(), SelectedAs(), and NuSystematic::Shift().

00327 {
00328   NuXMLConfig xmlConfig(xmlConfigFile);
00329 
00330   if (!this->CheckConfigForPDFMaking()){return;}
00331 
00332   fhNuMuCCRecoE->Reset();
00333   fhNuBarCCRecoE->Reset();
00334 
00335   NuSystematic nuSyst(xmlConfig);
00336 
00337   Int_t numMCEntries = fMonteCarlo->GetEntries();
00338   for (Int_t eventCounter = 0;
00339        eventCounter < numMCEntries;
00340        ++eventCounter){
00341     if (!(eventCounter%10000)){
00342       MSG("NuFluctuator",Msg::kInfo)
00343                         << eventCounter << " of " << numMCEntries
00344                         << endl
00345                         << "NuMu PDF has " << fhNuMuCCRecoE->GetEntries()
00346                         << " entries; NuBar PDF has "
00347                         << fhNuBarCCRecoE->GetEntries() << " entries."
00348                         << endl;
00349     }
00350     NuEvent event = fMonteCarlo->GetInfoObject(eventCounter);
00351     nuSyst.Shift(event);
00352     NuFluctuator::NuSelectionResult_t recoType = this->SelectedAs(event);
00353 
00354     Double_t eventWeight = event.rw;
00355 
00356     //Oscillate
00357                 eventWeight *= Oscillate(event);
00358 
00359     if (recoType==NuFluctuator::kCCNuMu){
00360       fhNuMuCCRecoE->Fill(event.energy,eventWeight);
00361     }
00362     if (recoType==NuFluctuator::kCCNuMuBar){
00363       fhNuBarCCRecoE->Fill(event.energy,eventWeight);
00364     }
00365   }
00366   fhNuMuCCRecoE->Scale(fFakeDataPoT/fMCPoT);
00367   fhNuBarCCRecoE->Scale(fFakeDataPoT/fMCPoT);
00368 }

void NuFluctuator::MakeShiftedTransitionPDFs ( const TString &  xmlConfigFile  )  [virtual]

Definition at line 462 of file NuFluctuator.cxx.

References CheckConfigForPDFMaking(), ConfigHistosForTransitionAnalysis(), fFakeDataPoT, fhNuBarCCRecoE, fhNuMuCCRecoE, fMCPoT, fMonteCarlo, fNuMuDm2, fNuMuSn2, fTransitionProb, NuTreeWrapper::GetEntries(), NuTreeWrapper::GetInfoObject(), kCCNuMu, kCCNuMuBar, Msg::kInfo, Msg::kWarning, MSG, NuBarCCCrossSection(), NuBarCCSelectionEfficiency(), NuMuCCCrossSection(), NuMuCCSelectionEfficiency(), Oscillate(), NuOscProbCalc::OscillationWeight(), SelectedAs(), and NuSystematic::Shift().

00463 {
00464   NuXMLConfig xmlConfig(xmlConfigFile);
00465 
00466   if (!this->CheckConfigForPDFMaking()){return;}
00467   this->ConfigHistosForTransitionAnalysis();
00468 
00469   fhNuMuCCRecoE->Reset();
00470   fhNuBarCCRecoE->Reset();
00471 
00472   NuSystematic nuSyst(xmlConfig);
00473 
00474   Int_t numMCEntries = fMonteCarlo->GetEntries();
00475   for (Int_t eventCounter = 0;
00476        eventCounter < numMCEntries;
00477        ++eventCounter){
00478     if (!(eventCounter%10000)){
00479       MSG("NuFluctuator",Msg::kInfo)
00480         << eventCounter << " of " << numMCEntries
00481         << endl;
00482     }
00483     NuEvent event = fMonteCarlo->GetInfoObject(eventCounter);
00484     nuSyst.Shift(event);
00485     NuFluctuator::NuSelectionResult_t recoType = this->SelectedAs(event);
00486 
00487     Double_t eventWeight = event.rw;
00488     Double_t transitionWeight = event.rw;
00489 
00490     //Oscillate
00491                 eventWeight *= Oscillate(event);
00492 
00493     Double_t nuBarSelEff = this->NuBarCCSelectionEfficiency(event.neuEnMC);
00494     Double_t nuBarXSec = this->NuBarCCCrossSection(event.neuEnMC);
00495     Double_t nuMuSelEff = this->NuMuCCSelectionEfficiency(event.neuEnMC);
00496     Double_t nuMuXSec = this->NuMuCCCrossSection(event.neuEnMC);
00497 
00498     if (recoType==NuFluctuator::kCCNuMu){
00499       fhNuMuCCRecoE->Fill(event.energy,eventWeight);
00500       if (1==event.iaction && 14==event.inu){
00501         transitionWeight *= fTransitionProb*(1-NuOscProbCalc::OscillationWeight(event.neuEnMC, fNuMuDm2, fNuMuSn2));
00502         if (!nuMuXSec || !nuMuSelEff){
00503           MSG("NuFluctuator.cxx",Msg::kWarning)
00504             << "Trying to apply transitions to a NuMu event "
00505             << "that shouldn't exist."
00506             << endl;
00507         }
00508         else{
00509           transitionWeight /= nuMuXSec;
00510           transitionWeight /= nuMuSelEff;
00511           transitionWeight *= nuBarSelEff;
00512           transitionWeight *= nuBarXSec;
00513           fhNuBarCCRecoE->Fill(event.energy,transitionWeight);
00514         }
00515       }
00516     }
00517     if (recoType==NuFluctuator::kCCNuMuBar){
00518       fhNuBarCCRecoE->Fill(event.energy,eventWeight);
00519       if (1==event.iaction && -14==event.inu){
00520         transitionWeight *= fTransitionProb*(1-NuOscProbCalc::OscillationWeight(event.neuEnMC, fNuMuDm2, fNuMuSn2));
00521         if (!nuMuXSec || !nuMuSelEff){
00522           MSG("NuFluctuator.cxx",Msg::kWarning)
00523             << "Trying to apply transitions to a NuMu event "
00524             << "that shouldn't exist."
00525             << endl;
00526         }
00527         else{
00528           transitionWeight *= nuMuXSec;
00529           transitionWeight *= nuMuSelEff;
00530           transitionWeight /= nuBarSelEff;
00531           transitionWeight /= nuBarXSec;
00532           fhNuMuCCRecoE->Fill(event.energy,transitionWeight);
00533         }
00534       }
00535     }
00536   }
00537   fhNuMuCCRecoE->Scale(fFakeDataPoT/fMCPoT);
00538   fhNuBarCCRecoE->Scale(fFakeDataPoT/fMCPoT);
00539 }

void NuFluctuator::MakeTransitionPDFs (  )  [virtual]

Definition at line 387 of file NuFluctuator.cxx.

References CheckConfigForPDFMaking(), ConfigHistosForTransitionAnalysis(), fFakeDataPoT, fhNuBarCCRecoE, fhNuMuCCRecoE, fMCPoT, fMonteCarlo, fNuMuDm2, fNuMuSn2, fTransitionProb, NuTreeWrapper::GetEntries(), NuTreeWrapper::GetInfoObject(), kCCNuMu, kCCNuMuBar, Msg::kInfo, Msg::kWarning, MSG, NuBarCCCrossSection(), NuBarCCSelectionEfficiency(), NuMuCCCrossSection(), NuMuCCSelectionEfficiency(), Oscillate(), NuOscProbCalc::OscillationWeight(), and SelectedAs().

00388 {
00389   if (!this->CheckConfigForPDFMaking()){return;}
00390   this->ConfigHistosForTransitionAnalysis();
00391 
00392   fhNuMuCCRecoE->Reset();
00393   fhNuBarCCRecoE->Reset();
00394 
00395   Int_t numMCEntries = fMonteCarlo->GetEntries();
00396   for (Int_t eventCounter = 0;
00397        eventCounter < numMCEntries;
00398        ++eventCounter){
00399     if (!(eventCounter%10000)){
00400       MSG("NuFluctuator",Msg::kInfo)
00401         << eventCounter << " of " << numMCEntries
00402         << endl;
00403     }
00404     NuEvent event = fMonteCarlo->GetInfoObject(eventCounter);
00405     NuFluctuator::NuSelectionResult_t recoType = this->SelectedAs(event);
00406 
00407     Double_t eventWeight = event.rw;
00408     Double_t transitionWeight = event.rw;
00409 
00410     //Oscillate
00411                 eventWeight *= Oscillate(event);
00412 
00413     Double_t nuBarSelEff = this->NuBarCCSelectionEfficiency(event.neuEnMC);
00414     Double_t nuBarXSec = this->NuBarCCCrossSection(event.neuEnMC);
00415     Double_t nuMuSelEff = this->NuMuCCSelectionEfficiency(event.neuEnMC);
00416     Double_t nuMuXSec = this->NuMuCCCrossSection(event.neuEnMC);
00417 
00418     if (recoType==NuFluctuator::kCCNuMu){
00419       fhNuMuCCRecoE->Fill(event.energy,eventWeight);
00420       if (1==event.iaction && 14==event.inu){
00421         transitionWeight *= fTransitionProb*(1-NuOscProbCalc::OscillationWeight(event.neuEnMC, fNuMuDm2, fNuMuSn2));
00422         if (!nuMuXSec || !nuMuSelEff){
00423           MSG("NuFluctuator.cxx",Msg::kWarning)
00424             << "Trying to apply transitions to a NuMu event "
00425             << "that shouldn't exist."
00426             << endl;
00427         }
00428         else{
00429           transitionWeight /= nuMuXSec;
00430           transitionWeight /= nuMuSelEff;
00431           transitionWeight *= nuBarSelEff;
00432           transitionWeight *= nuBarXSec;
00433           fhNuBarCCRecoE->Fill(event.energy,transitionWeight);
00434         }
00435       }
00436     }
00437     if (recoType==NuFluctuator::kCCNuMuBar){
00438       fhNuBarCCRecoE->Fill(event.energy,eventWeight);
00439       if (1==event.iaction && -14==event.inu){
00440         transitionWeight *= fTransitionProb*(1-NuOscProbCalc::OscillationWeight(event.neuEnMC, fNuMuDm2, fNuMuSn2));
00441         if (!nuMuXSec || !nuMuSelEff){
00442           MSG("NuFluctuator.cxx",Msg::kWarning)
00443             << "Trying to apply transitions to a NuMu event "
00444             << "that shouldn't exist."
00445             << endl;
00446         }
00447         else{
00448           transitionWeight *= nuMuXSec;
00449           transitionWeight *= nuMuSelEff;
00450           transitionWeight /= nuBarSelEff;
00451           transitionWeight /= nuBarXSec;
00452           fhNuMuCCRecoE->Fill(event.energy,transitionWeight);
00453         }
00454       }
00455     }
00456   }
00457   fhNuMuCCRecoE->Scale(fFakeDataPoT/fMCPoT);
00458   fhNuBarCCRecoE->Scale(fFakeDataPoT/fMCPoT);
00459 }

virtual void NuFluctuator::MonteCarlo ( const std::string &  mcFileName  )  [virtual]
Double_t NuFluctuator::NuBarCCCrossSection ( const Double_t  trueNuE  )  const [private, virtual]

Definition at line 543 of file NuFluctuator.cxx.

Referenced by MakeShiftedTransitionPDFs(), and MakeTransitionPDFs().

00544 {
00545   //  return fNuBarCCCrossSectionGraph->Eval(trueNuE,0,"");
00546   return fhNuBarCCCrossSections->
00547     GetBinContent(fhNuBarCCCrossSections->FindBin(trueNuE));
00548 }

virtual const TH1D NuFluctuator::NuBarCCFakeData (  )  const [inline, virtual]

Definition at line 46 of file NuFluctuator.h.

References fhNuBarCCRecoE, and Fluctuate().

00047     {return Fluctuate(fhNuBarCCRecoE);};

virtual void NuFluctuator::NuBarCCRecoEBinning ( const std::vector< Double_t > &  nubarBins  )  [virtual]
virtual const TH1D NuFluctuator::NuBarCCScaledData (  )  const [inline, virtual]

Definition at line 50 of file NuFluctuator.h.

References fhNuBarCCRecoE.

00051     {return *fhNuBarCCRecoE;}

Double_t NuFluctuator::NuBarCCSelectionEfficiency ( const Double_t  trueNuE  )  const [private, virtual]

Definition at line 552 of file NuFluctuator.cxx.

Referenced by MakeShiftedTransitionPDFs(), and MakeTransitionPDFs().

00553 {
00554   return fhNuBarCCSelectionEfficiency->
00555     GetBinContent(fhNuBarCCSelectionEfficiency->FindBin(trueNuE));
00556 }

virtual void NuFluctuator::NuBarDm2 ( const Double_t  nubarDm2  )  [inline, virtual]

Definition at line 67 of file NuFluctuator.h.

References fNuBarDm2.

00068     {fNuBarDm2 = nubarDm2;}

virtual void NuFluctuator::NuBarSn2 ( const Double_t  nubarSn2  )  [inline, virtual]

Definition at line 69 of file NuFluctuator.h.

References fNuBarSn2.

00070     {fNuBarSn2 = nubarSn2;}

Double_t NuFluctuator::NuMuCCCrossSection ( const Double_t  trueNuE  )  const [private, virtual]

Definition at line 560 of file NuFluctuator.cxx.

Referenced by MakeShiftedTransitionPDFs(), and MakeTransitionPDFs().

00561 {
00562   //  return fNuMuCCCrossSectionGraph->Eval(trueNuE,0,"");
00563   return fhNuMuCCCrossSections->
00564     GetBinContent(fhNuMuCCCrossSections->FindBin(trueNuE));
00565 }

virtual const TH1D NuFluctuator::NuMuCCFakeData (  )  const [inline, virtual]

Definition at line 44 of file NuFluctuator.h.

References fhNuMuCCRecoE, and Fluctuate().

00045     {return Fluctuate(fhNuMuCCRecoE);};

virtual void NuFluctuator::NuMuCCRecoEBinning ( const std::vector< Double_t > &  numuBins  )  [virtual]
virtual const TH1D NuFluctuator::NuMuCCScaledData (  )  const [inline, virtual]

Definition at line 48 of file NuFluctuator.h.

References fhNuMuCCRecoE.

00049     {return *fhNuMuCCRecoE;}

Double_t NuFluctuator::NuMuCCSelectionEfficiency ( const Double_t  trueNuE  )  const [private, virtual]

Definition at line 569 of file NuFluctuator.cxx.

Referenced by MakeShiftedTransitionPDFs(), and MakeTransitionPDFs().

00570 {
00571   return fhNuMuCCSelectionEfficiency->
00572     GetBinContent(fhNuMuCCSelectionEfficiency->FindBin(trueNuE));
00573 }

virtual void NuFluctuator::NuMuDm2 ( const Double_t  numuDm2  )  [inline, virtual]

Definition at line 63 of file NuFluctuator.h.

References fNuMuDm2.

00064     {fNuMuDm2 = numuDm2;}

virtual void NuFluctuator::NuMuSn2 ( const Double_t  numuSn2  )  [inline, virtual]

Definition at line 65 of file NuFluctuator.h.

References fNuMuSn2.

00066     {fNuMuSn2 = numuSn2;}

Double_t NuFluctuator::Oscillate ( NuEvent event  )  const [virtual]

Definition at line 371 of file NuFluctuator.cxx.

References fNuBarDm2, fNuBarSn2, fNuMuDm2, fNuMuSn2, NuEvent::iaction, NuEvent::inu, NuEvent::neuEnMC, and NuOscProbCalc::OscillationWeight().

Referenced by MakeCPTPDFs(), MakeShiftedCPTPDFs(), MakeShiftedTransitionPDFs(), and MakeTransitionPDFs().

00372 {
00373   if (1==event.iaction){
00374     if (14==event.inu){
00375       return NuOscProbCalc::OscillationWeight(event.neuEnMC,
00376                                             fNuMuDm2, fNuMuSn2);
00377     }
00378     if (-14==event.inu){
00379       return NuOscProbCalc::OscillationWeight(event.neuEnMC,
00380                                             fNuBarDm2, fNuBarSn2);
00381     }
00382   }
00383   return 1; // Doesn't oscillate
00384 }

virtual void NuFluctuator::PDFsFilled ( const Bool_t  pdfsFilled  )  [inline, private, virtual]

Definition at line 113 of file NuFluctuator.h.

References fPDFsFilled.

00114     {fPDFsFilled = pdfsFilled;}

NuFluctuator::NuSelectionResult_t NuFluctuator::SelectedAs ( NuEvent nuEvent  )  const [virtual]

Definition at line 577 of file NuFluctuator.cxx.

References NuEvent::anaVersion, NuEvent::charge, NuCuts::IsGoodBeam(), NuCuts::IsGoodDataQuality(), NuCuts::IsGoodDirCos(), NuCuts::IsGoodFitProb(), NuCuts::IsGoodMajorityCurvature(), NuCuts::IsGoodNumberOfTracks(), NuCuts::IsGoodPID(), NuCuts::IsGoodSigmaQP_QP(), NuCuts::IsGoodTimeToNearestSpill(), NuCuts::IsGoodTrackFitPass(), NuCuts::IsInFidVolTrk(), NuCuts::IsLI(), kCCNuMu, kCCNuMuBar, kUnknown, NuCuts::kUnknown, and SelectionScheme().

Referenced by MakeCPTPDFs(), MakeShiftedCPTPDFs(), MakeShiftedTransitionPDFs(), and MakeTransitionPDFs().

00578 {
00579   NuCuts nuCuts;
00580   if (NuCuts::kUnknown != this->SelectionScheme()){
00581     nuEvent.anaVersion = this->SelectionScheme();
00582   }
00583 
00584   //cut on LI
00585   if (nuCuts.IsLI(nuEvent)) return NuFluctuator::kUnknown;
00586   //cut on the data quality
00587   if (!nuCuts.IsGoodDataQuality(nuEvent)) return NuFluctuator::kUnknown;
00588   //cut on the spill time
00589   if (!nuCuts.IsGoodTimeToNearestSpill(nuEvent)) return NuFluctuator::kUnknown;
00590   //cut on the beam
00591   if (!nuCuts.IsGoodBeam(nuEvent)) return NuFluctuator::kUnknown;
00592 
00593   //cut on whether event vtx is in fid vol (does nothing for CC ana)
00594   //    if (!nuCuts.IsInFidVol(evt,nu)) continue;
00595   //ensure good number of tracks in event (note preselection above)
00596   if (!nuCuts.IsGoodNumberOfTracks(nuEvent)) return NuFluctuator::kUnknown;
00597   //check trk is in fiducial volume (note preselection above)
00598   if (!nuCuts.IsInFidVolTrk(nuEvent)) return NuFluctuator::kUnknown;
00599 
00600   //require a good trk fit
00601   if (!nuCuts.IsGoodTrackFitPass(nuEvent)) return NuFluctuator::kUnknown;
00602   //require a forward going neutrino about beam direction
00603   if (!nuCuts.IsGoodDirCos(nuEvent)) return NuFluctuator::kUnknown;
00604 
00605   //cut on the PID
00606   if (!nuCuts.IsGoodPID(nuEvent)) {
00607     return NuFluctuator::kUnknown;
00608   }
00609   //cut on the fractional track momentum and sign error
00610   if (!nuCuts.IsGoodSigmaQP_QP(nuEvent)) {
00611     return NuFluctuator::kUnknown;
00612   }
00613   //cut on the track fit probability
00614   if (!nuCuts.IsGoodFitProb(nuEvent)) {
00615     return NuFluctuator::kUnknown;
00616   }
00617   if (!nuCuts.IsGoodMajorityCurvature(nuEvent)){
00618     return NuFluctuator::kUnknown;
00619   }
00620 
00621   if (-1==nuEvent.charge){return NuFluctuator::kCCNuMu;}
00622   if (1==nuEvent.charge){return NuFluctuator::kCCNuMuBar;}
00623   return NuFluctuator::kUnknown;
00624 }

virtual void NuFluctuator::Selection ( const NuCuts::NuAnaVersion_t  selection  )  [inline, virtual]

Definition at line 71 of file NuFluctuator.h.

References fSelection.

00072     {fSelection = selection;}

virtual void NuFluctuator::SelectionEfficiencyFileName ( const std::string &  selEffFileName  )  [inline, virtual]

Definition at line 74 of file NuFluctuator.h.

References fSelEffFileName.

00075     {fSelEffFileName = selEffFileName;}

virtual NuCuts::NuAnaVersion_t NuFluctuator::SelectionScheme (  )  const [inline, private, virtual]

Definition at line 115 of file NuFluctuator.h.

References fSelection.

Referenced by SelectedAs().

00116     {return fSelection;}

virtual void NuFluctuator::TransitionProb ( const Double_t  transitionProb  )  [inline, virtual]

Definition at line 76 of file NuFluctuator.h.

References fTransitionProb.

00077     {fTransitionProb = transitionProb;}


Member Data Documentation

Double_t NuFluctuator::fFakeDataPoT [private]

Definition at line 101 of file NuFluctuator.h.

Referenced by ConfigHistosForTransitionAnalysis().

Definition at line 99 of file NuFluctuator.h.

Referenced by ConfigHistosForTransitionAnalysis().

Definition at line 102 of file NuFluctuator.h.

Referenced by ConfigHistosForTransitionAnalysis().

TH1D* NuFluctuator::fhNuMuCCRecoE [private]

Definition at line 100 of file NuFluctuator.h.

Referenced by ConfigHistosForTransitionAnalysis().

Double_t NuFluctuator::fMCPoT [private]

Definition at line 97 of file NuFluctuator.h.

Referenced by ConfigHistosForTransitionAnalysis().

Double_t NuFluctuator::fNuBarDm2 [private]

Definition at line 85 of file NuFluctuator.h.

Referenced by NuBarDm2(), and Oscillate().

Double_t NuFluctuator::fNuBarSn2 [private]

Definition at line 86 of file NuFluctuator.h.

Referenced by NuBarSn2(), and Oscillate().

Definition at line 98 of file NuFluctuator.h.

Referenced by ConfigHistosForTransitionAnalysis().

Double_t NuFluctuator::fNuMuDm2 [private]

Definition at line 83 of file NuFluctuator.h.

Referenced by MakeShiftedTransitionPDFs(), MakeTransitionPDFs(), NuMuDm2(), and Oscillate().

Double_t NuFluctuator::fNuMuSn2 [private]

Definition at line 84 of file NuFluctuator.h.

Referenced by MakeShiftedTransitionPDFs(), MakeTransitionPDFs(), NuMuSn2(), and Oscillate().

Bool_t NuFluctuator::fPDFsFilled [private]

Definition at line 80 of file NuFluctuator.h.

Referenced by PDFsFilled().

TRandom3* NuFluctuator::fRandom [private]

Definition at line 91 of file NuFluctuator.h.

Referenced by Fluctuate(), and FluctuateSampling().

Definition at line 88 of file NuFluctuator.h.

Referenced by Selection(), and SelectionScheme().

std::string NuFluctuator::fSelEffFileName [private]
Double_t NuFluctuator::fTransitionProb [private]

Definition at line 87 of file NuFluctuator.h.

Referenced by MakeShiftedTransitionPDFs(), MakeTransitionPDFs(), and TransitionProb().

std::string NuFluctuator::fxsecfilename [private]

Definition at line 95 of file NuFluctuator.h.

Referenced by ConfigHistosForTransitionAnalysis().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1