FoverNHistos Class Reference

#include <FoverNHistos.h>

Inheritance diagram for FoverNHistos:
NuDSTAna NuBase

List of all members.

Public Types

enum  fileType { nue, nutau, numiflux }
enum  detType { far, near }
enum  ChargeID { Everything, Positives, Negatives }
enum  TrueEventCategory {
  CCNuMu, CCNuMuBar, NC, BeamNuE,
  AppearedTau, AppearedNuE
}

Public Member Functions

 FoverNHistos (NuXMLConfig *xmlConfig, string type_, string det_)
virtual ~FoverNHistos ()
virtual void MakeDataPlots ()
virtual void Oscillate (NuEvent &event, const NuXMLConfig *xmlConfig) const
virtual void Oscillate (NuMCEvent &event, const NuXMLConfig *xmlConfig) const

Static Public Member Functions

static std::string CreateCCSelectedHistoName (const Int_t trueEventCategory, const Int_t chargeID)
static std::string CreateCCSelectedHistoNameLoverE (const Int_t trueEventCategory, const Int_t chargeID)
static std::string CreateNCSelectedHistoNameLoverE (const Int_t trueEventCategory)

Static Public Attributes

static Int_t nChargeIDs
static Int_t nTrueEventCategories

Private Member Functions

virtual NuInputEventsGetEventListForLooping ()
virtual void PrepareNCEventForPlotting (NuEvent &event) const
virtual void PrepareCCEventForPlotting (NuEvent &event) const
virtual void CreateHistograms ()
virtual void FillRecoVTrueHistoTriplet (TH2D *histoTriplet[], const NuEvent &event)
virtual void FillRecoToTrueHistoTriplet (TH2D *histoTriplet[], const NuEvent &event)
virtual void DeleteHistograms ()
virtual void FillCCSelectedPlots (NuEvent &event)
virtual void FillNCSelectedPlots (NuEvent &event)
virtual void WritePlots ()

Private Attributes

NuCuts::NuAnaVersion_t fAnaVersionNC
NuCuts::NuAnaVersion_t fAnaVersionCC
NuCutterfNCCutter
NuCutterfCCCutter
NuLibraryfLib
NuSystematicfSyst
NuXMLConfigfxmlConfig
fileType type
detType det
double baseline
TH1D * hRecoEnergy
TH1D * hRecoEnergyNC
TH1D * hRecoEnergyCCAll
TH1D * hRecoEnergyCCNQ
TH1D * hRecoEnergyCCPQ
TH2D * ccSelectedHistos [6][3]
TH2D * ccSelectedHistosLoverE [6][3]
TH2D * ncSelectedHistosLoverE [6]

Detailed Description

Definition at line 23 of file FoverNHistos.h.


Member Enumeration Documentation

Enumerator:
Everything 
Positives 
Negatives 

Definition at line 42 of file FoverNHistos.h.

00042                 {
00043     Everything,
00044     Positives,
00045     Negatives
00046   };

Enumerator:
far 
near 

Definition at line 30 of file FoverNHistos.h.

00030 {far, near}; 

Enumerator:
nue 
nutau 
numiflux 

Definition at line 26 of file FoverNHistos.h.

00026 {nue, nutau, numiflux}; // A.Devan 8/24/2012: need to specify which type of file 

Enumerator:
CCNuMu 
CCNuMuBar 
NC 
BeamNuE 
AppearedTau 
AppearedNuE 

Definition at line 48 of file FoverNHistos.h.

00048                          {
00049     CCNuMu,
00050     CCNuMuBar,
00051     NC,
00052     BeamNuE,
00053     AppearedTau,
00054     AppearedNuE
00055   };


Constructor & Destructor Documentation

FoverNHistos::FoverNHistos ( NuXMLConfig xmlConfig,
string  type_,
string  det_ 
) [explicit]

Definition at line 36 of file FoverNHistos.cxx.

References NuCutter::AnaVersion(), NuXMLConfig::AnaVersionString(), baseline, CreateHistograms(), det, fAnaVersionCC, fAnaVersionNC, far, fCCCutter, fLib, fNCCutter, fSyst, fxmlConfig, NuCutter::GetCut(), NuXMLConfig::GetUnknownKey(), NuLibrary::Instance(), Msg::kInfo, Msg::kWarning, MSG, near, nue, numiflux, nutau, NuSystematic::PrintState(), NuSystematic::SetCCSelector(), NuSystematic::SetNCSelector(), and type.

00037 {
00038   if (!xmlConfig){
00039     MSG("FoverNHistos",Msg::kWarning)
00040       << "Far over Near analysis object configured with a non-existent xml object."
00041       << endl
00042       << "Asserting now."
00043       << endl;
00044     assert(false);
00045   }
00046 
00047   // A.Devan 8/24/2012
00048   // adding in an enum to know which type of file is being made into a helper
00049   if(     type_ == "nue")      type = nue;
00050   else if(type_ == "nutau")    type = nutau;
00051   else if(type_ == "numiflux") type = numiflux;
00052   else cout << "wrong file type!!" << endl; 
00053 
00054   if(det_ == "far") {det = far; baseline = 735.0;}
00055   else if(det_ == "near") {det = near; baseline = 1.04;}
00056   else cout << "wrong detector type" << endl;
00057 
00058   fxmlConfig = xmlConfig;
00059 
00060   // Get the anaVersion and anaVersionNC from the XML config
00061   TString anaVer = fxmlConfig->AnaVersionString();
00062   TString anaVerNC = "";
00063 
00064   if (xmlConfig->GetUnknownKey("anaVersionNC").IsNull()) {
00065     MSG("NuDSTAna",Msg::kInfo) 
00066       << "Did not find anaVersionNC in configuration...cannot proceed" << endl;
00067     assert(false);
00068   } else {
00069     anaVerNC = xmlConfig->GetUnknownKey("anaVersionNC");
00070   }
00071 
00072   fCCCutter = new NuCutter(anaVer);
00073   fNCCutter = new NuCutter(anaVerNC);
00074 
00075   // Get NuAnaVersion_t from the cutter objects
00076   fAnaVersionNC = static_cast<NuCuts::NuAnaVersion_t>(fNCCutter->AnaVersion());
00077   fAnaVersionCC = static_cast<NuCuts::NuAnaVersion_t>(fCCCutter->AnaVersion());
00078 
00079   fLib = &NuLibrary::Instance();
00080 
00081   fSyst = new NuSystematic(*fxmlConfig);
00082   fSyst->SetNCSelector(fNCCutter->GetCut());
00083   fSyst->SetCCSelector(fCCCutter->GetCut());
00084 
00085   fSyst->PrintState();
00086 
00087   this->CreateHistograms();
00088 }

FoverNHistos::~FoverNHistos (  )  [virtual]

Definition at line 90 of file FoverNHistos.cxx.

References DeleteHistograms(), fCCCutter, fLib, fNCCutter, and fSyst.

00091 {
00092   if (fCCCutter) { delete fCCCutter; fCCCutter = 0; }
00093   if (fNCCutter) { delete fNCCutter; fNCCutter = 0; }
00094   if (fSyst) { delete fSyst; fSyst = 0; }
00095 
00096   fLib = 0; // I didn't create this, so don't have the right to delete it.
00097 
00098   this->DeleteHistograms();
00099 }


Member Function Documentation

string FoverNHistos::CreateCCSelectedHistoName ( const Int_t  trueEventCategory,
const Int_t  chargeID 
) [static]

Definition at line 432 of file FoverNHistos.cxx.

References AppearedNuE, AppearedTau, BeamNuE, CCNuMu, CCNuMuBar, Everything, NC, Negatives, and Positives.

Referenced by CreateHistograms().

00433 {
00434   string categoryPart;
00435   if (CCNuMu == trueEventCategory) { categoryPart = "CCNuMu"; } 
00436   else if (CCNuMuBar == trueEventCategory) { categoryPart = "CCNuMuBar"; } 
00437   else if (NC == trueEventCategory) { categoryPart = "NC"; } 
00438   else if (BeamNuE == trueEventCategory) { categoryPart = "BeamNuE"; } 
00439   else if (AppearedTau == trueEventCategory) { categoryPart = "AppearedTau"; } 
00440   else if (AppearedNuE == trueEventCategory) { categoryPart = "AppearedNuE"; } 
00441   else { cout << "Unrecognized category" << endl; assert(false); }
00442 
00443   string chargePart;
00444   if (Everything == chargeID) { chargePart = "All"; } 
00445   else if (Positives == chargeID) { chargePart = "PQ"; } 
00446   else if (Negatives == chargeID) { chargePart = "NQ"; } 
00447   else { std::cout << "Unrecognized charge" << std::endl; assert(false); }
00448 
00449   string histoName = "hRecoVTrueCCSelectedTrue";
00450   histoName += categoryPart;
00451   histoName += chargePart;
00452 
00453   std::cout << "category: " << trueEventCategory << ", charge: " << chargeID << ", histo name: " << histoName << std::endl;
00454 
00455   return histoName;
00456 }

string FoverNHistos::CreateCCSelectedHistoNameLoverE ( const Int_t  trueEventCategory,
const Int_t  chargeID 
) [static]

Definition at line 458 of file FoverNHistos.cxx.

References AppearedNuE, AppearedTau, BeamNuE, CCNuMu, CCNuMuBar, Everything, NC, Negatives, and Positives.

Referenced by CreateHistograms().

00459 {
00460   string categoryPart;
00461   if (CCNuMu == trueEventCategory) { categoryPart = "CCNuMu"; }
00462   else if (CCNuMuBar == trueEventCategory) { categoryPart = "CCNuMuBar"; }
00463   else if (NC == trueEventCategory) { categoryPart = "NC"; }
00464   else if (BeamNuE == trueEventCategory) { categoryPart = "BeamNuE"; }
00465   else if (AppearedTau == trueEventCategory) { categoryPart = "AppearedTau"; }
00466   else if (AppearedNuE == trueEventCategory) { categoryPart = "AppearedNuE"; }
00467   else { cout << "Unrecognised category... asserting." << endl; assert(false); }
00468 
00469   string chargePart;
00470   if (Everything == chargeID) { chargePart = "All"; }
00471   else if (Positives == chargeID) { chargePart = "PQ"; }
00472   else if (Negatives == chargeID) { chargePart = "NQ"; }
00473   else { std::cout << "Unrecognised charge... asserting." << std::endl; assert(false); }
00474 
00475   string histoName = "hRecoToTrueCCSelectedTrue";
00476   histoName += categoryPart;
00477   histoName += "_";
00478   histoName += chargePart;
00479 
00480   std::cout << "category: " << trueEventCategory << ", charge: " << chargeID << ", histo name: " << histoName << std::endl;
00481 
00482   return histoName;
00483 
00484 }

void FoverNHistos::CreateHistograms (  )  [private, virtual]

Definition at line 348 of file FoverNHistos.cxx.

References addbins(), ccSelectedHistos, ccSelectedHistosLoverE, CreateCCSelectedHistoName(), CreateCCSelectedHistoNameLoverE(), CreateNCSelectedHistoNameLoverE(), det, far, hRecoEnergy, hRecoEnergyCCAll, hRecoEnergyCCNQ, hRecoEnergyCCPQ, hRecoEnergyNC, NuBinningScheme::kSterile, nChargeIDs, ncSelectedHistosLoverE, near, nTrueEventCategories, NuUtilities::RecoBins(), and NuUtilities::TrueBins().

Referenced by FoverNHistos().

00349 {
00350   //  NuBinningScheme::NuBinningScheme_t binningScheme =
00351   //   static_cast<NuBinningScheme::NuBinningScheme_t>(fxmlConfig->BinningScheme());
00352   const vector<Double_t> recoBins =
00353     NuUtilities::RecoBins(NuBinningScheme::kSterile);
00354   //    NuUtilities::RecoBins(binningScheme);
00355   const Int_t numRecoBins = recoBins.size() - 1;
00356   Double_t* recoBinsArray = new Double_t[numRecoBins + 1];
00357   Int_t i = 0;
00358   for (vector<Double_t>::const_iterator itBin = recoBins.begin();
00359        itBin != recoBins.end();
00360        ++itBin, ++i){
00361     recoBinsArray[i] = *itBin;
00362   }
00363   
00364   const vector<Double_t> trueBins = 
00365     NuUtilities::TrueBins(NuBinningScheme::kSterile);
00366   //    NuUtilities::TrueBins(binningScheme);
00367   const Int_t numTrueBins = trueBins.size() - 1;
00368   Double_t* trueBinsArray;
00369   trueBinsArray = new Double_t[numTrueBins + 1];
00370   i = 0;
00371   for (vector<Double_t>::const_iterator itBin = trueBins.begin();
00372        itBin != trueBins.end();
00373        ++itBin, ++i){
00374     trueBinsArray[i] = *itBin;
00375   }
00376   
00377   double bins[4000];
00378   int n_bins = 0;
00379   switch(det)
00380     {
00381     case far:
00382       bins[0] = 0.0;
00383       addbins(bins, n_bins,    0.5, 1000.0); // km/GeV
00384           addbins(bins, n_bins,    1.0, 2000.0); // km/GeV
00385           addbins(bins, n_bins, 3000.0, 5000.0); // km/GeV
00386           break;
00387           
00388     case near:
00389       bins[0] = 0.0;
00390       addbins(bins, n_bins, 0.0025, 5.0); // km/GeV
00391       break;
00392       
00393     default:
00394       cout << "weird detector type" << endl;
00395     }
00396   
00397   hRecoEnergy = new TH1D("hRecoEnergy", "Reco Energy;E_{Reco} (GeV);Events",  numRecoBins, recoBinsArray);
00398   
00399   hRecoEnergyCCAll = new TH1D("hRecoEnergyCCAll", "Reco Energy (CC selected);E_{Reco} (GeV);Events",  numRecoBins, recoBinsArray);
00400   
00401   hRecoEnergyCCNQ = new TH1D("hRecoEnergyCCNQ", "Reco Energy (CC selected);E_{Reco} (GeV);Events",  numRecoBins, recoBinsArray);
00402   
00403   hRecoEnergyCCPQ = new TH1D("hRecoEnergyCCPQ", "Reco Energy (CC selected);E_{Reco} (GeV);Events",  numRecoBins, recoBinsArray);
00404   
00405   hRecoEnergyNC = new TH1D("hRecoEnergyNC", "Reco Energy (NC selected);E_{Reco} (GeV);Events", numRecoBins, recoBinsArray);
00406 
00407  // This is reco energy vs L/E_true CC
00408   for (Int_t chargeID = 0; chargeID < nChargeIDs; ++chargeID) {
00409     for (Int_t trueEventCategory = 0; trueEventCategory < nTrueEventCategories; ++trueEventCategory) {
00410       string histoName = this->CreateCCSelectedHistoNameLoverE(trueEventCategory, chargeID);
00411       ccSelectedHistosLoverE[trueEventCategory][chargeID] = new TH2D(histoName.c_str(), "", n_bins, bins, numRecoBins, recoBinsArray);
00412     }
00413   }
00414 
00415   // This is reco energy vs L/E_true NC
00416   for (Int_t trueEventCategory = 0; trueEventCategory < nTrueEventCategories; ++trueEventCategory) {
00417     string histoName = this->CreateNCSelectedHistoNameLoverE(trueEventCategory); 
00418     ncSelectedHistosLoverE[trueEventCategory] = new TH2D(histoName.c_str(), "", n_bins, bins, numRecoBins, recoBinsArray);  
00419   }
00420 
00421  // This is reco energy vs E_true
00422  for (Int_t chargeID = 0; chargeID < nChargeIDs; ++chargeID) {
00423     for (Int_t trueEventCategory = 0; trueEventCategory < nTrueEventCategories; ++trueEventCategory) {
00424       string histoName = this->CreateCCSelectedHistoName(trueEventCategory, chargeID);
00425       ccSelectedHistos[trueEventCategory][chargeID] = new TH2D(histoName.c_str(), "", numRecoBins, recoBinsArray, numRecoBins, recoBinsArray);
00426     }
00427   }
00428 
00429 } // CreateHistograms()

string FoverNHistos::CreateNCSelectedHistoNameLoverE ( const Int_t  trueEventCategory  )  [static]

Definition at line 486 of file FoverNHistos.cxx.

References AppearedNuE, AppearedTau, BeamNuE, CCNuMu, CCNuMuBar, and NC.

Referenced by CreateHistograms().

00487 {
00488   string categoryPart;
00489   if (CCNuMu == trueEventCategory) { categoryPart = "CCNuMu"; }
00490   else if (CCNuMuBar == trueEventCategory) { categoryPart = "CCNuMuBar"; }
00491   else if (NC == trueEventCategory) { categoryPart = "NC"; }
00492   else if (BeamNuE == trueEventCategory) { categoryPart = "BeamNuE"; }
00493   else if (AppearedTau == trueEventCategory) { categoryPart = "AppearedTau"; }
00494   else if (AppearedNuE == trueEventCategory) { categoryPart = "AppearedNuE"; }
00495   else { cout << "Unrecognised category... asserting." << endl; assert(false); }
00496 
00497   string histoName = "hRecoToTrueNCSelectedTrue";
00498   histoName += categoryPart;
00499 
00500   std::cout << "category: " << trueEventCategory << ", charge: " << ", histo name: " << histoName << std::endl;
00501 
00502   return histoName;
00503 
00504 }

void FoverNHistos::DeleteHistograms (  )  [private, virtual]

Definition at line 506 of file FoverNHistos.cxx.

References ccSelectedHistos, ccSelectedHistosLoverE, hRecoEnergy, hRecoEnergyCCAll, hRecoEnergyCCNQ, hRecoEnergyCCPQ, hRecoEnergyNC, nChargeIDs, ncSelectedHistosLoverE, and nTrueEventCategories.

Referenced by ~FoverNHistos().

00506                                     {
00507   
00508   if (hRecoEnergy) { delete hRecoEnergy; hRecoEnergy = 0; }
00509 
00510   if (hRecoEnergyCCAll) { delete hRecoEnergyCCAll; hRecoEnergyCCAll = 0; }
00511 
00512   if (hRecoEnergyCCNQ) { delete hRecoEnergyCCNQ; hRecoEnergyCCNQ = 0; }
00513 
00514   if (hRecoEnergyCCPQ) { delete hRecoEnergyCCPQ; hRecoEnergyCCPQ = 0; }
00515 
00516   if (hRecoEnergyNC) { delete hRecoEnergyNC; hRecoEnergyNC = 0; }
00517 
00518   // delete CC
00519   for (Int_t chargeID = 0; chargeID < nChargeIDs; ++chargeID) {
00520     for (Int_t trueEventCategory = 0; trueEventCategory < nTrueEventCategories; ++trueEventCategory) {
00521       delete ccSelectedHistos[trueEventCategory][chargeID];
00522       delete ccSelectedHistosLoverE[trueEventCategory][chargeID];
00523       ccSelectedHistos[trueEventCategory][chargeID] = 0;
00524       ccSelectedHistosLoverE[trueEventCategory][chargeID] = 0;
00525     }
00526   }
00527 
00528   // delete NC
00529   for (Int_t trueEventCategory = 0; trueEventCategory < nTrueEventCategories; ++trueEventCategory) {
00530     delete ncSelectedHistosLoverE[trueEventCategory];
00531     ncSelectedHistosLoverE[trueEventCategory] = 0;
00532   }
00533   
00534 
00535 } // DeleteHistograms()

void FoverNHistos::FillCCSelectedPlots ( NuEvent event  )  [private, virtual]

Definition at line 538 of file FoverNHistos.cxx.

References AppearedNuE, AppearedTau, BeamNuE, CCNuMu, CCNuMuBar, ccSelectedHistos, ccSelectedHistosLoverE, NuEvent::charge, NuEvent::energy, FillRecoToTrueHistoTriplet(), FillRecoVTrueHistoTriplet(), hRecoEnergy, hRecoEnergyCCAll, hRecoEnergyCCNQ, hRecoEnergyCCPQ, NuEvent::iaction, NuEvent::inu, NuEvent::inunoosc, SimFlag::kMC, NC, PrepareCCEventForPlotting(), NuEvent::rw, and NuEvent::simFlag.

Referenced by MakeDataPlots().

00538                                                      {
00539 
00540   this->PrepareCCEventForPlotting(event);
00541 
00542   hRecoEnergy->Fill(event.energy, event.rw);
00543   hRecoEnergyCCAll->Fill(event.energy, event.rw);
00544 
00545   if (-1 == event.charge) { hRecoEnergyCCNQ->Fill(event.energy, event.rw); } 
00546   else if (1 == event.charge) { hRecoEnergyCCPQ->Fill(event.energy, event.rw); }
00547 
00548   // Fill Justin's plots for CC extrapolation
00549   if (SimFlag::kMC != event.simFlag) {
00550     return;
00551   }
00552 
00553   // I need to fill plots of beam nues, NCs, CCs, appeared taus and appeared nues
00554   // For now, just reco v true histos will do
00555   if (event.simFlag != SimFlag::kMC) return;
00556 
00557   if (0 == event.iaction) {
00558       this->FillRecoVTrueHistoTriplet(ccSelectedHistos[NC], event);
00559       this->FillRecoToTrueHistoTriplet(ccSelectedHistosLoverE[NC], event);
00560   } 
00561   else if (1 == event.iaction) {
00562     switch(100*event.inunoosc + event.inu){
00563 
00564       // numu CC
00565       case 1414:
00566         this->FillRecoVTrueHistoTriplet(ccSelectedHistos[CCNuMu], event);
00567         this->FillRecoToTrueHistoTriplet(ccSelectedHistosLoverE[CCNuMu], event);
00568         break;        
00569 
00570       // numubar CC
00571       case -1414:
00572         this->FillRecoVTrueHistoTriplet(ccSelectedHistos[CCNuMuBar], event);
00573         this->FillRecoToTrueHistoTriplet(ccSelectedHistosLoverE[CCNuMuBar], event);
00574         break;        
00575 
00576       // beam nue
00577       case 1212:
00578       case -1212:
00579         this->FillRecoVTrueHistoTriplet(ccSelectedHistos[BeamNuE], event);
00580         this->FillRecoToTrueHistoTriplet(ccSelectedHistosLoverE[BeamNuE], event);
00581         break;        
00582 
00583       // oscillated numu to nutau
00584       case 1416:
00585       case -1416:
00586         this->FillRecoVTrueHistoTriplet(ccSelectedHistos[AppearedTau], event);
00587         this->FillRecoToTrueHistoTriplet(ccSelectedHistosLoverE[AppearedTau], event);
00588         break;        
00589 
00590       // oscillated numu to nue
00591       case 1412:
00592       case -1412:
00593         this->FillRecoVTrueHistoTriplet(ccSelectedHistos[AppearedNuE], event);
00594         this->FillRecoToTrueHistoTriplet(ccSelectedHistosLoverE[AppearedNuE], event);
00595         break; 
00596 
00597       // Do nothing with beam nues that oscillate for now. Nowhere to store them.
00598       case 1214:
00599       case -1214:
00600       case 1216:
00601       case -1216:
00602         break;
00603 
00604       default:
00605         cout << "CC event not recognized: event.inu = " << event.inu << ", event.inunoosc = " 
00606              << event.inunoosc << endl;
00607     }
00608   } 
00609   else {
00610     cout << "iaction not recognized" << endl;
00611   }
00612 
00613 }

void FoverNHistos::FillNCSelectedPlots ( NuEvent event  )  [private, virtual]

Definition at line 647 of file FoverNHistos.cxx.

References AppearedNuE, AppearedTau, baseline, BeamNuE, CCNuMu, Munits::cm, hRecoEnergy, hRecoEnergyNC, NuEvent::iaction, NuEvent::inu, NuEvent::inunoosc, Munits::km, SimFlag::kMC, NC, ncSelectedHistosLoverE, NuEvent::neuEnMC, PrepareNCEventForPlotting(), NuEvent::rw, NuEvent::shwEnLinNCCor, NuEvent::simFlag, and NuEvent::Vz.

Referenced by MakeDataPlots().

00648 {
00649   this->PrepareNCEventForPlotting(event);
00650 
00651   hRecoEnergy->Fill(event.shwEnLinNCCor, event.rw);
00652   hRecoEnergyNC->Fill(event.shwEnLinNCCor, event.rw);
00653 
00654   if (event.simFlag != SimFlag::kMC) return;
00655 
00656   if (0 == event.iaction) {
00657     ncSelectedHistosLoverE[NC]->Fill((baseline - event.Vz*Munits::cm/Munits::km)/event.neuEnMC, event.shwEnLinNCCor, event.rw);
00658   } 
00659   else if (1 == event.iaction) {
00660     switch(100*event.inunoosc + event.inu){
00661 
00662       // numu CC
00663       case 1414:
00664       case -1414:
00665         ncSelectedHistosLoverE[CCNuMu]->Fill((baseline - event.Vz*Munits::cm/Munits::km)/event.neuEnMC, event.shwEnLinNCCor, event.rw);
00666         break;        
00667 
00668       // beam nue
00669       case 1212:
00670       case -1212:
00671         ncSelectedHistosLoverE[BeamNuE]->Fill((baseline - event.Vz*Munits::cm/Munits::km)/event.neuEnMC, event.shwEnLinNCCor, event.rw);
00672         break;        
00673 
00674       // oscillated numu to nutau
00675       case 1416:
00676       case -1416:
00677         ncSelectedHistosLoverE[AppearedTau]->Fill((baseline - event.Vz*Munits::cm/Munits::km)/event.neuEnMC, event.shwEnLinNCCor, event.rw);
00678         break;        
00679 
00680       // oscillated numu to nue
00681       case 1412:
00682       case -1412:
00683         ncSelectedHistosLoverE[AppearedNuE]->Fill((baseline - event.Vz*Munits::cm/Munits::km)/event.neuEnMC, event.shwEnLinNCCor, event.rw);
00684         break; 
00685 
00686       // Do nothing with beam nues that oscillate for now. Nowhere to store them.
00687       case 1214:
00688       case -1214:
00689       case 1216:
00690       case -1216:
00691         break;
00692 
00693       default:
00694         cout << "NC event not recognized: event.inu = " << event.inu << ", event.inunoosc = " 
00695              << event.inunoosc << endl;
00696     }
00697   } 
00698   else {
00699     cout << "iaction not recognized" << endl;
00700   }
00701 
00702 } // FillNCSelectedPlots

void FoverNHistos::FillRecoToTrueHistoTriplet ( TH2D *  histoTriplet[],
const NuEvent event 
) [private, virtual]

Definition at line 627 of file FoverNHistos.cxx.

References baseline, NuEvent::charge, Munits::cm, Everything, Munits::km, Negatives, NuEvent::neuEnMC, Positives, and NuEvent::rw.

Referenced by FillCCSelectedPlots().

00628 {
00629   Double_t energy = -999.0;
00630   Double_t LoverE = -999.0;
00631 
00632   energy = event.energy;
00633 
00634   // This is true distance neutrino has travelled since decay from hadron parent to int in detector / E_true
00635   LoverE = (baseline - event.Vz*Munits::cm/Munits::km)/event.neuEnMC;
00636 
00637   // This fills PQ and NQ
00638   histoTriplet[Everything]->Fill(LoverE, energy, event.rw);
00639 
00640   // Fill PQ
00641   if (1 == event.charge ){ histoTriplet[Positives]->Fill(LoverE, energy, event.rw); } 
00642   // Fill NQ
00643   else if (-1 == event.charge){ histoTriplet[Negatives]->Fill(LoverE, energy, event.rw); }
00644 
00645 }

void FoverNHistos::FillRecoVTrueHistoTriplet ( TH2D *  histoTriplet[],
const NuEvent event 
) [private, virtual]

Definition at line 615 of file FoverNHistos.cxx.

References NuEvent::charge, NuEvent::energy, Everything, Negatives, NuEvent::neuEnMC, Positives, and NuEvent::rw.

Referenced by FillCCSelectedPlots().

00616 {
00617   // This fills PQ and NQ 
00618   histoTriplet[Everything]->Fill(event.neuEnMC, event.energy, event.rw);
00619 
00620   // Fill PQ
00621   if (1 == event.charge) { histoTriplet[Positives]->Fill(event.neuEnMC, event.energy, event.rw); } 
00622   // Fill NQ
00623   else if (-1 == event.charge) { histoTriplet[Negatives]->Fill(event.neuEnMC, event.energy, event.rw); }
00624 
00625 }

NuInputEvents & FoverNHistos::GetEventListForLooping (  )  [private, virtual]

Definition at line 101 of file FoverNHistos.cxx.

References NuDSTAna::DoIO(), fxmlConfig, and NuInputEvents::ResetNuEventLoopPositionToStart().

Referenced by MakeDataPlots().

00102 {
00103   NuInputEvents& input = this->DoIO(0, "", "null");
00104   fxmlConfig->Write();
00105   input.ResetNuEventLoopPositionToStart();
00106   return input;
00107 }

void FoverNHistos::MakeDataPlots (  )  [virtual]

Definition at line 109 of file FoverNHistos.cxx.

References NuReco::ApplyReweights(), NuReco::CalcResolution(), NuXMLConfig::ConfigureWeights(), NuCutter::Failed(), fAnaVersionCC, fAnaVersionNC, fCCCutter, FillCCSelectedPlots(), FillNCSelectedPlots(), fLib, fNCCutter, fxmlConfig, NuInputEvents::GetEntriesNuEvent(), GetEventListForLooping(), NuReco::GetEvtEnergy(), NuInputEvents::GetNextNuEvent(), Msg::kDebug, NuCutter::MakeCuts(), MSG, NuCutter::Passed(), NuXMLConfig::PrintAll(), NuCutter::PrintNMinusOneSummary(), NuCutter::PrintSummary(), NuUtilities::ProgressBar(), NuLibrary::reco, and WritePlots().

00110 {
00111   fxmlConfig->PrintAll(cout);
00112 
00113   NuInputEvents& input = this->GetEventListForLooping();
00114 
00115   for (Int_t i = 0; i < input.GetEntriesNuEvent(); ++i){
00116     NuUtilities::ProgressBar(i, input.GetEntriesNuEvent(), 5);
00117     NuEvent& nu = const_cast<NuEvent&>(input.GetNextNuEvent(Msg::kDebug));
00118 
00119     // Configuring weights, etc is a hack until DSTs are fixed
00120     nu.anaVersion = fAnaVersionCC;
00121     fxmlConfig->ConfigureWeights(nu);
00122 
00123     // RE-RECONSTRUCT the neutrino energy
00124     fLib->reco.GetEvtEnergy(nu, false);
00125     fLib->reco.ApplyReweights(nu);
00126     fLib->reco.CalcResolution(nu);
00127 
00128     fCCCutter->MakeCuts(nu);
00129 
00130     // Configuring weights, etc is a hack until DSTs are fixed
00131     nu.anaVersion = fAnaVersionNC;
00132     fxmlConfig->ConfigureWeights(nu);
00133 
00134     // RE-RECONSTRUCT the neutrino energy
00135     fLib->reco.GetEvtEnergy(nu, false);
00136     fLib->reco.ApplyReweights(nu);
00137     fLib->reco.CalcResolution(nu);
00138 
00139     fNCCutter->MakeCuts(nu);
00140 
00141     // If both cuts failed, continue
00142     if (fCCCutter->Failed() && fNCCutter->Failed()) {
00143       continue;
00144     }
00145 
00146     // Explicitly not allow events to be filled twice
00147     if (fNCCutter->Passed()) {
00148       this->FillNCSelectedPlots(nu);
00149     }
00150     if (fCCCutter->Passed() && fNCCutter->Failed()) {
00151       this->FillCCSelectedPlots(nu);
00152     } else {
00153       MSG("FoverNHistos", Msg::kDebug)
00154         << "The event didn't pass either selection. Run " << nu.run << "/" << nu.subRun 
00155         << " snarl " << nu.snarl << endl;
00156     }
00157   } // for
00158   this->WritePlots();
00159 
00160   fNCCutter->PrintSummary();
00161   fNCCutter->PrintNMinusOneSummary();
00162 
00163   fCCCutter->PrintSummary();
00164   fCCCutter->PrintNMinusOneSummary();
00165 }

void FoverNHistos::Oscillate ( NuMCEvent event,
const NuXMLConfig xmlConfig 
) const [virtual]

Reimplemented from NuDSTAna.

Definition at line 301 of file FoverNHistos.cxx.

00302 {
00303 } // Oscillate MC event

void FoverNHistos::Oscillate ( NuEvent event,
const NuXMLConfig xmlConfig 
) const [virtual]

Reimplemented from NuDSTAna.

Definition at line 167 of file FoverNHistos.cxx.

References NuXMLConfig::Delta1(), NuXMLConfig::Delta2(), NuXMLConfig::Delta3(), NuXMLConfig::DM221(), NuXMLConfig::DM232(), NuXMLConfig::DM243(), NuOscProb::FourFlavourDisappearanceWeight(), NuOscProb::FourFlavourNuESurvivalProbability(), NuOscProb::FourFlavourNuMuToNuEProbability(), NuOscProb::FourFlavourNuMuToNuSProbability(), NuOscProb::FourFlavourNuMuToNuTauProbability(), NuEvent::iaction, NuEvent::inu, NuEvent::inunoosc, SimFlag::kData, Msg::kInfo, MAXMSG, nue, numiflux, nutau, NuEvent::run, NuEvent::simFlag, NuXMLConfig::Theta12(), NuXMLConfig::Theta13(), NuXMLConfig::Theta14(), NuXMLConfig::Theta23(), NuXMLConfig::Theta24(), NuXMLConfig::Theta34(), and type.

Referenced by PrepareCCEventForPlotting(), and PrepareNCEventForPlotting().

00168 {
00169   // Check that the xmlConfig object exists
00170   if (!xmlConfig) return;
00171 
00172   // Don't oscillate real data
00173   if (SimFlag::kData == event.simFlag){
00174     MAXMSG("FoverNHistos", Msg::kInfo, 1)
00175       << "Not applying fake oscillations to data" << endl;
00176     return;
00177   }
00178 
00179   // MDC files have 9 as the third digit in their run number
00180   if((event.run / 100000) % 10 == 9){
00181     MAXMSG("FoverNHistos", Msg::kInfo, 1)
00182       << "Not applying fake oscillations to MDC" << endl;
00183     return;
00184   }
00185 
00186   // Start the weight at one - i.e., don't change anything
00187   double oscWeight = 1.0;
00188 
00189   if (0 == event.iaction) {
00190     // NC events
00191     oscWeight = 1 - NuOscProb::FourFlavourNuMuToNuSProbability(event,  xmlConfig);
00192   } 
00193   else if (1 == event.iaction) {
00194     switch(100*event.inunoosc + event.inu){
00195 
00196       // numu CC
00197       case 1414:
00198       case -1414:
00199         oscWeight = NuOscProb::FourFlavourDisappearanceWeight(event, xmlConfig);
00200         break;        
00201 
00202       // beam nue
00203       case 1212:
00204       case -1212:
00205         oscWeight = NuOscProb::FourFlavourNuESurvivalProbability(event, xmlConfig);
00206         break;        
00207 
00208       // oscillated numu to nutau
00209       case 1416:
00210       case -1416:
00211         oscWeight = NuOscProb::FourFlavourNuMuToNuTauProbability(event, xmlConfig);
00212         break;        
00213 
00214       // oscillated numu to nue
00215       case 1412:
00216       case -1412:
00217         oscWeight = NuOscProb::FourFlavourNuMuToNuEProbability(event, xmlConfig);
00218         break; 
00219 
00220       // Set beam nue oscillations to zero. These are not used yet.
00221       case 1214:
00222       case -1214:
00223       case 1216:
00224       case -1216:
00225         oscWeight = 0;
00226         break;
00227 
00228       default:
00229         cout << "CC event not recognized: event.inu = " << event.inu << ", event.inunoosc = " 
00230              << event.inunoosc << endl;
00231     }
00232   } 
00233   else {
00234     oscWeight = 0;
00235     MAXMSG("FoverNHistos", Msg::kInfo, 1)
00236       << "Unrecognized iaction = " << event.iaction << endl;
00237   }
00238 
00239   // A.Devan 8/24/2012
00240   // If oscillated event from nue or nutau file, remove NC and originally nue events
00241   switch(type)
00242   {
00243     case nue:
00244       if(!(12 == TMath::Abs(event.inu) && 14 == TMath::Abs(event.inunoosc) && 1 == event.iaction)) 
00245       event.rw = 0;
00246       break;
00247     case nutau:
00248       if(!(16 == TMath::Abs(event.inu) && 14 == TMath::Abs(event.inunoosc) && 1 == event.iaction))
00249       event.rw = 0;
00250       break;
00251     case numiflux:
00252       break;
00253     default:
00254       cout << "DONT KNOW THIS TYPE OF FILE" << endl;
00255   }
00256 
00257   // Do this last, so that taus and nue's are still properly
00258   // reweighted, even in the no-oscillation case
00259   // For example, in the no-osc case the nutaus are given a weight of 0
00260   // so have to explictly just not touch them
00261   if (xmlConfig->DM232() < 0.0 ||
00262       xmlConfig->DM221() < 0.0 ||
00263       xmlConfig->DM243() < 0.0 ||
00264       xmlConfig->Theta23() < 0.0 ||
00265       xmlConfig->Theta12() < 0.0 ||
00266       xmlConfig->Theta13() < 0.0 ||
00267       xmlConfig->Theta14() < 0.0 ||
00268       xmlConfig->Theta24() < 0.0 ||
00269       xmlConfig->Theta34() < 0.0 ||
00270       xmlConfig->Delta1() < 0.0 ||
00271       xmlConfig->Delta2() < 0.0 ||
00272       xmlConfig->Delta3() < 0.0) {
00273     MAXMSG("FoverNHistos", Msg::kInfo, 1)
00274       << "Not applying fake oscillations due to xml configuration." 
00275       << endl;
00276   } else {
00277     // Apply the oscillation weight
00278     event.rw *= oscWeight;
00279     
00280     // Print message
00281     MAXMSG("FoverNHistos", Msg::kInfo, 1)
00282       << "Four-flavour oscillations with the following parameters: " << endl
00283       << "dm232: "   << xmlConfig->DM232()   << " eV^2"    << endl
00284       << "dm243: "   << xmlConfig->DM243()   << " eV^2"    << endl
00285       << "dm221: "   << xmlConfig->DM221()   << " eV^2"    << endl
00286       << "theta23: " << xmlConfig->Theta23() << " radians" << endl
00287       << "theta12: " << xmlConfig->Theta12() << " radians" << endl
00288       << "theta13: " << xmlConfig->Theta13() << " radians" << endl
00289       << "theta14: " << xmlConfig->Theta14() << " radians" << endl
00290       << "theta24: " << xmlConfig->Theta24() << " radians" << endl
00291       << "theta34: " << xmlConfig->Theta34() << " radians" << endl
00292       << "delta1: "  << xmlConfig->Delta1()  << " radians" << endl
00293       << "delta2: "  << xmlConfig->Delta2()  << " radians" << endl
00294       << "delta3: "  << xmlConfig->Delta3()  << " radians" << endl;
00295   } // if oscillations
00296    
00297 // event.rw = 1.0;
00298 } // Oscillate

void FoverNHistos::PrepareCCEventForPlotting ( NuEvent event  )  const [private, virtual]

Definition at line 323 of file FoverNHistos.cxx.

References NuReco::ApplyReweights(), NuReco::CalcResolution(), NuXMLConfig::ConfigureWeights(), fAnaVersionCC, fLib, fSyst, fxmlConfig, NuReco::GetEvtEnergy(), Oscillate(), NuLibrary::reco, and NuSystematic::Shift().

Referenced by FillCCSelectedPlots().

00324 {
00325     event.anaVersion = fAnaVersionCC;
00326     fxmlConfig->ConfigureWeights(event);
00327 
00328     // RE-RECONSTRUCT the neutrino energy
00329     fLib->reco.GetEvtEnergy(event, false);
00330     fLib->reco.ApplyReweights(event);
00331     fLib->reco.CalcResolution(event);
00332 
00333     // Apply the systematic shift if required according to xmlConfig
00334     //this->DoSystematicShifts(nu,xmlConfig);
00335     fSyst->Shift(event);
00336     this->Oscillate(event, fxmlConfig);
00337 }

void FoverNHistos::PrepareNCEventForPlotting ( NuEvent event  )  const [private, virtual]

Definition at line 306 of file FoverNHistos.cxx.

References NuReco::ApplyReweights(), NuReco::CalcResolution(), NuXMLConfig::ConfigureWeights(), fAnaVersionNC, fLib, fSyst, fxmlConfig, NuReco::GetEvtEnergy(), Oscillate(), NuLibrary::reco, and NuSystematic::Shift().

Referenced by FillNCSelectedPlots().

00307 {
00308     event.anaVersion = fAnaVersionNC;
00309     fxmlConfig->ConfigureWeights(event);
00310 
00311     // RE-RECONSTRUCT the neutrino energy
00312     fLib->reco.GetEvtEnergy(event, false);
00313     fLib->reco.ApplyReweights(event);
00314     fLib->reco.CalcResolution(event);
00315 
00316     // Apply the systematic shift if required according to xmlConfig
00317     //this->DoSystematicShifts(nu,xmlConfig);
00318     fSyst->Shift(event);
00319     this->Oscillate(event, fxmlConfig);
00320 }

void FoverNHistos::WritePlots (  )  [private, virtual]

Definition at line 706 of file FoverNHistos.cxx.

References ccSelectedHistos, ccSelectedHistosLoverE, hRecoEnergy, hRecoEnergyCCAll, hRecoEnergyCCNQ, hRecoEnergyCCPQ, hRecoEnergyNC, nChargeIDs, ncSelectedHistosLoverE, and nTrueEventCategories.

Referenced by MakeDataPlots().

00707 {
00708   hRecoEnergy->Write();
00709   hRecoEnergyNC->Write();
00710   hRecoEnergyCCAll->Write();
00711   hRecoEnergyCCNQ->Write();
00712   hRecoEnergyCCPQ->Write();
00713 
00714   for (Int_t chargeID = 0; chargeID < nChargeIDs; ++chargeID) {
00715     for (Int_t trueEventCategory = 0; trueEventCategory < nTrueEventCategories; ++trueEventCategory) {
00716       ccSelectedHistos[trueEventCategory][chargeID]->Write();
00717     }
00718   }
00719 
00720   for (Int_t chargeID = 0; chargeID < nChargeIDs; ++chargeID) {
00721     for (Int_t trueEventCategory = 0; trueEventCategory < nTrueEventCategories; ++trueEventCategory) {
00722       ccSelectedHistosLoverE[trueEventCategory][chargeID]->Write();
00723     }
00724   }
00725 
00726   for (Int_t trueEventCategory = 0; trueEventCategory < nTrueEventCategories; ++trueEventCategory) {
00727     ncSelectedHistosLoverE[trueEventCategory]->Write();
00728   }
00729 
00730 }


Member Data Documentation

double FoverNHistos::baseline [private]

Definition at line 70 of file FoverNHistos.h.

Referenced by FillNCSelectedPlots(), FillRecoToTrueHistoTriplet(), and FoverNHistos().

TH2D* FoverNHistos::ccSelectedHistos[6][3] [private]

Definition at line 78 of file FoverNHistos.h.

Referenced by CreateHistograms(), DeleteHistograms(), FillCCSelectedPlots(), and WritePlots().

TH2D* FoverNHistos::ccSelectedHistosLoverE[6][3] [private]

Definition at line 79 of file FoverNHistos.h.

Referenced by CreateHistograms(), DeleteHistograms(), FillCCSelectedPlots(), and WritePlots().

Definition at line 69 of file FoverNHistos.h.

Referenced by CreateHistograms(), and FoverNHistos().

Definition at line 62 of file FoverNHistos.h.

Referenced by FoverNHistos(), MakeDataPlots(), and PrepareCCEventForPlotting().

Definition at line 61 of file FoverNHistos.h.

Referenced by FoverNHistos(), MakeDataPlots(), and PrepareNCEventForPlotting().

Definition at line 64 of file FoverNHistos.h.

Referenced by FoverNHistos(), MakeDataPlots(), and ~FoverNHistos().

Definition at line 63 of file FoverNHistos.h.

Referenced by FoverNHistos(), MakeDataPlots(), and ~FoverNHistos().

TH1D* FoverNHistos::hRecoEnergy [private]

Definition at line 74 of file FoverNHistos.h.

Referenced by CreateHistograms(), DeleteHistograms(), FillCCSelectedPlots(), and WritePlots().

Definition at line 75 of file FoverNHistos.h.

Referenced by CreateHistograms(), DeleteHistograms(), FillCCSelectedPlots(), and WritePlots().

Definition at line 76 of file FoverNHistos.h.

Referenced by CreateHistograms(), DeleteHistograms(), FillCCSelectedPlots(), and WritePlots().

TH1D* FoverNHistos::hRecoEnergyNC [private]

Definition at line 73 of file FoverNHistos.h.

Referenced by CreateHistograms(), DeleteHistograms(), FillNCSelectedPlots(), and WritePlots().

Int_t FoverNHistos::nChargeIDs [static]

Definition at line 47 of file FoverNHistos.h.

Referenced by CreateHistograms(), DeleteHistograms(), and WritePlots().

Definition at line 80 of file FoverNHistos.h.

Referenced by CreateHistograms(), DeleteHistograms(), FillNCSelectedPlots(), and WritePlots().

Definition at line 57 of file FoverNHistos.h.

Referenced by CreateHistograms(), DeleteHistograms(), and WritePlots().

Definition at line 68 of file FoverNHistos.h.

Referenced by FoverNHistos(), and Oscillate().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1