NuHistos Class Reference

#include <NuHistos.h>

List of all members.

Public Member Functions

 NuHistos ()
 ~NuHistos ()
void FillMatrixMethodHistos (const NuEvent &nu, const NuBinningScheme::NuBinningScheme_t binningScheme=NuBinningScheme::kUnknown) const
void FillMatrixMethodNCHistos (const NuEvent &nu, const NuBinningScheme::NuBinningScheme_t binningScheme=NuBinningScheme::kUnknown) const
Float_t CalcPOTsFromHistos (std::string sNamePostfix="") const

Detailed Description

Definition at line 25 of file NuHistos.h.


Constructor & Destructor Documentation

NuHistos::NuHistos (  ) 

Definition at line 34 of file NuHistos.cxx.

References Msg::kDebug, and MSG.

00035 {
00036   MSG("NuHistos",Msg::kDebug)
00037     <<"Running NuHistos Constructor..."<<endl;
00038 
00039 
00040   MSG("NuHistos",Msg::kDebug)
00041     <<"Finished NuHistos Constructor"<<endl;
00042 }

NuHistos::~NuHistos (  ) 

Definition at line 46 of file NuHistos.cxx.

References Msg::kDebug, and MSG.

00047 {
00048   MSG("NuHistos",Msg::kDebug)
00049     <<"Running NuHistos Destructor..."<<endl;
00050 
00051 
00052   MSG("NuHistos",Msg::kDebug)
00053     <<"Finished NuHistos Destructor"<<endl;
00054 }


Member Function Documentation

Float_t NuHistos::CalcPOTsFromHistos ( std::string  sNamePostfix = ""  )  const

Definition at line 1256 of file NuHistos.cxx.

References det, SimFlag::kData, Detector::kFar, SimFlag::kMC, and Detector::kNear.

Referenced by NuDSTAna::DoIO(), and NuAnalysis::StoreOrFinishTree().

01257 {
01258   //Method to Calc POTs from histograms
01259 
01260   //string to use for histo names
01261   string s="";
01262 
01263 
01264   //get the detector
01265   s="hDetector";
01266   s+=sNamePostfix;
01267   TH1F* hDetector=(TH1F*)gROOT->FindObjectAny(s.c_str());
01268   Int_t det=-1;
01269   if (hDetector) det=static_cast<Int_t>(hDetector->GetMean());
01270   else cout<<"Ahhh, no hDetector"<<endl;
01271 
01272   //get the simflag
01273   s="hSimFlag";
01274   s+=sNamePostfix;
01275   TH1F* hSimFlag=(TH1F*)gROOT->FindObjectAny(s.c_str());
01276   Int_t simFlag=-1;
01277   if (hSimFlag) simFlag=static_cast<Int_t>(hSimFlag->GetMean());
01278   else cout<<"Ahhh, no hSimFlag"<<endl;
01279 
01280   cout<<"POT Counting: found Detector="<<det
01281       <<", SimFlag="<<simFlag<<endl;
01282 
01283   //get the pots
01284   s="hPottrtgtd";
01285   s+=sNamePostfix;
01286   TH1F* hPot=(TH1F*)gROOT->FindObjectAny(s.c_str());
01287   Float_t avPot=-1;
01288   if (hPot) avPot=hPot->GetMean();
01289   else cout<<"Ahhh, no hPottrtgtd histogram"<<endl;
01290 
01291   //get the pots that failed the cuts
01292   s="hPotBadtrtgtd";
01293   s+=sNamePostfix;
01294   TH1F* hPotBad=(TH1F*)gROOT->FindObjectAny(s.c_str());
01295   Float_t avPotBad=-1;
01296   if (hPotBad) avPotBad=hPotBad->GetMean();
01297   else cout<<"Ahhh, no hPotBadtrtgtd histogram"<<endl;
01298     
01299   //get the number of runs/subruns
01300   s="hRun";
01301   s+=sNamePostfix;
01302   TH1F* hRun=(TH1F*)gROOT->FindObjectAny(s.c_str());
01303   Float_t runs=-1;
01304   if (hRun) runs=hRun->GetEntries();
01305   else cout<<"Ahhh, no hRun histo"<<endl;
01306 
01307   //get the spills per file
01308   Float_t spillsPerFile=-1;
01309   s="hSpillsPerFile";
01310   s+=sNamePostfix;
01311   TH1F* hSpillsPerFile=(TH1F*)gROOT->FindObjectAny(s.c_str());
01312   if (hSpillsPerFile){
01313     spillsPerFile=hSpillsPerFile->GetMean();
01314   }
01315   else {
01316     spillsPerFile=400;
01317     cout<<"Can't find hSpillsPerFile, so using spillsPerFile="
01318         <<spillsPerFile<<endl;
01319 
01320     //deal with a bug
01321     if (spillsPerFile==0 && det==Detector::kFar) {
01322       spillsPerFile=1;
01323       cout<<endl<<"*** WARNING spillsPerFile=0 so setting to "
01324           <<spillsPerFile<<" ***"<<endl;
01325     }
01326   }
01327 
01328   //apply the necessary 1e12 factor
01329   avPot*=1e12;
01330 
01331   //for the FD there is an additional factor of 1e8
01332   if (det==Detector::kFar) avPot*=1e8;
01333 
01334   Float_t totalPotFiles=0;//calc from number of files
01335   if (simFlag==SimFlag::kMC) {
01336     cout<<"For spills per files method: using avPot="<<avPot
01337         <<", avPotBad="<<avPotBad
01338         <<", runs="<<runs<<", spillsPerFile="<<spillsPerFile<<endl;
01339 
01340     //calc the totalPotFiles
01341     totalPotFiles=avPot*spillsPerFile*runs;
01342     cout<<"Total POT calc from spills per file="
01343         <<totalPotFiles<<endl;
01344   }
01345 
01346   //now calc the pots using the information from individual spills
01347   //this is for data
01348   Float_t totalPotHist=0;
01349   Float_t totalPotBadHist=0;
01350   if (det==Detector::kNear && simFlag==SimFlag::kData) {
01351     if (hPot) totalPotHist=
01352                 hPot->GetMean()*hPot->GetEntries();
01353     else cout<<"Ahhh, no hPottortgt histogram"<<endl;
01354 
01355     if (hPotBad) totalPotBadHist=
01356                    hPotBad->GetMean()*hPotBad->GetEntries();
01357     else cout<<"Ahhh, no hPotBadtortgt histogram"<<endl;
01358 
01359     //multiply by the necessary 1e12 factor
01360     totalPotHist*=1e12;
01361     totalPotBadHist*=1e12;
01362 
01363     cout<<"Total POT calc from spill beam data="<<totalPotHist
01364         <<" (potsRejected="<<totalPotBadHist<<")"<<endl;
01365   }
01366 
01367   //decide which version to use
01368   Float_t totalPot=1;
01369   if (simFlag==SimFlag::kData) {
01370     totalPot=totalPotHist;
01371   }
01372   else if (simFlag==SimFlag::kMC) {
01373     totalPot=totalPotFiles;
01374   }
01375   else cout<<"ahhh, pot error"<<endl;
01376 
01378   //section to create the hTotalPot histo (or not)
01380   if (simFlag==-1) {
01381     //do nothing
01382     cout<<"Not creating hTotalPot histo"<<endl;
01383   }
01384   else if (det==Detector::kFar && simFlag==SimFlag::kData) {
01385     //don't create the histogram here
01386     //FD data pot counting has to be done by hand
01387     cout<<"Not creating hTotalPot histo for det="<<det
01388         <<", simFlag="<<simFlag<<endl;
01389   }
01390   else {
01391     //make a histogram to store the result
01392     TH1F* hTotalPot=new TH1F("hTotalPot","hTotalPot",2,-0.5,1.5);
01393     hTotalPot->Fill(1,totalPot);
01394     cout<<"hTotalPot->GetMax()="<<hTotalPot->GetMaximum()
01395         <<", hTotalPot->Integral()="<<hTotalPot->Integral()<<endl;
01396   }
01397 
01398   return totalPot;
01399 }

void NuHistos::FillMatrixMethodHistos ( const NuEvent nu,
const NuBinningScheme::NuBinningScheme_t  binningScheme = NuBinningScheme::kUnknown 
) const

Definition at line 59 of file NuHistos.cxx.

References NuEvent::charge, NuEvent::detector, NuEvent::dpID, NuEvent::energy, NuEvent::energyMC, NuEvent::iaction, NuEvent::inu, NuEvent::inunoosc, Detector::kFar, Msg::kInfo, SimFlag::kMC, Detector::kNear, MAXMSG, MSG, NuOscProbCalc::OscillationWeight(), NuEvent::poIDKin, NuEvent::prob, NuUtilities::RecoBins(), NuEvent::relativeAngle, NuEvent::roID, NuEvent::rw, NuEvent::sigqp_qp, NuEvent::simFlag, NuEvent::smoothMajC, NuEvent::trkLength, NuUtilities::TrueBins(), NuEvent::xTrkEnd, NuEvent::yTrkEnd, and NuEvent::zTrkEnd.

Referenced by NuAnalysis::ChargeSeparationOneSnarl(), NuDSTAna::JeffsTestAna(), NuDSTAna::MMRereco(), NuDSTAna::MMTransition(), NuDSTAna::MMTransSME(), NuDSTAna::NewFieldAna(), NuDSTAna::StdCCAna(), and NuDSTAna::StdNMBAna().

00061 {
00062   //TH1D *fFracErrOnPred;//JE does this one
00063   //TH1D *fTrueEnergyTrueCCFidEvents_ND;//this is in NuPlots
00064   //TH1D *fTrueEnergyTrueCCFidEvents_FD;//this is in NuPlots
00065 
00066   MAXMSG("NuHistos",Msg::kInfo,1)
00067     <<"Running FillMatrixMethodHistos..."<<endl;
00068 
00069   //MC Helper histos (CC numus):
00070   static TH2D* fRecoVsTrueEnergy_ND=0;
00071   static TH1D* fEfficiency_ND=0;
00072   static TH1D* fPurity_ND=0;
00073   static TH2D* fRecoVsTrueEnergy_FD=0;
00074   static TH1D* fEfficiency_FD=0;
00075   static TH1D* fPurity_FD=0;
00076   static TH1D* fCCContamination_ND = 0;
00077   static TH1D* fCCContamination_FD = 0;
00078   static TH2D* fCCContaminationRecoVsTrue_FD = 0;
00079   static TH1D* fNCContamination_ND = 0;
00080   static TH1D* fNCContamination_FD = 0;
00081   //MC Helper histos (CC numubars):
00082   static TH2D* fRecoVsTrueEnergyPQ_ND=0;
00083   static TH1D* fEfficiencyPQ_ND=0;
00084   static TH1D* fPurityPQ_ND=0;
00085   static TH2D* fRecoVsTrueEnergyPQ_FD=0;
00086   static TH1D* fEfficiencyPQ_FD=0;
00087   static TH1D* fPurityPQ_FD=0;
00088   static TH1D* fCCContaminationPQ_ND = 0;
00089   static TH1D* fCCContaminationPQ_FD = 0;
00090   static TH2D* fCCContaminationRecoVsTruePQ_FD = 0;
00091   static TH1D* fNCContaminationPQ_ND = 0;
00092   static TH1D* fNCContaminationPQ_FD = 0;
00093   //MC Helper histos (CC numus + CC numubars):
00094   static TH2D* fRecoVsTrueEnergyAll_ND=0;
00095   static TH1D* fEfficiencyAll_ND=0;
00096   static TH1D* fPurityAll_ND=0;
00097   static TH2D* fRecoVsTrueEnergyAll_FD=0;
00098   static TH1D* fEfficiencyAll_FD=0;
00099   static TH1D* fPurityAll_FD=0;
00100   //MC Helper histos (CC nutaus):
00101   static TH2D* fRecoVsTrueEnergyTau_FD=0;
00102   static TH1D* fEfficiencyTau_FD=0;
00103   //MC Helper histos (CC nutaus):
00104   static TH2D* fRecoVsTrueEnergyTauPQ_FD=0;
00105   static TH1D* fEfficiencyTauPQ_FD=0;
00106   //MC Helper histos (CC nutaus):
00107   static TH2D* fRecoVsTrueEnergyTauAll_FD=0;
00108   static TH1D* fEfficiencyTauAll_FD=0;
00109 
00110   //MC Check list histos (CC numus):
00111   static TH1D* fTrueEnergyCCOnlyEvents_ND=0;
00112   static TH1D* fRecoEnergyCCOnlyEvents_ND=0;
00113   static TH1D* fRecoEnergyAllEvents_ND=0;
00114   static TH1D* fTrueEnergyCCOnlyEvents_FD=0;
00115   static TH1D* fRecoEnergyCCOnlyEvents_FD=0;
00116   static TH1D* fRecoEnergyAllEvents_FD=0;
00117   //MC Check list histos (CC numubars):
00118   static TH1D* fTrueEnergyCCOnlyEventsPQ_ND=0;
00119   static TH1D* fRecoEnergyCCOnlyEventsPQ_ND=0;
00120   static TH1D* fRecoEnergyAllEventsPQ_ND=0;
00121   static TH1D* fTrueEnergyCCOnlyEventsPQ_FD=0;
00122   static TH1D* fRecoEnergyCCOnlyEventsPQ_FD=0;
00123   static TH1D* fRecoEnergyAllEventsPQ_FD=0;
00124   //MC Check list histos (CC numus + CC numubars):
00125   static TH1D* fTrueEnergyCCOnlyEventsAll_ND=0;
00126   static TH1D* fRecoEnergyCCOnlyEventsAll_ND=0;
00127   static TH1D* fRecoEnergyAllEventsAll_ND=0;
00128   static TH1D* fTrueEnergyCCOnlyEventsAll_FD=0;
00129   static TH1D* fRecoEnergyCCOnlyEventsAll_FD=0;
00130   static TH1D* fRecoEnergyAllEventsAll_FD=0;
00131   //MC checklist histos (CC nutaus):
00132   static TH1D* fTrueEnergyCCOnlyEventsTau_FD=0;
00133   //MC checklist histos (CC nutaubars):
00134   static TH1D* fTrueEnergyCCOnlyEventsTauPQ_FD=0;
00135   //MC checklist histos (CC nutaus + nutaubars):
00136   static TH1D* fTrueEnergyCCOnlyEventsTauAll_FD=0;
00137 
00138   //DATA histos (CC numus)
00139   static TH1D* RecoEnergy_ND=0;
00140   static TH1D* RecoEnergy_FD=0;
00141   //DATA histos (CC numubars)
00142   static TH1D* RecoEnergyPQ_ND=0;
00143   static TH1D* RecoEnergyPQ_FD=0;
00144 
00145   //DATA histos (Pure Reco Energys)
00146   static TH1D* RecoEnergyTrueTauPQ_FD=0;
00147   static TH1D* RecoEnergyTrueMuonPQ_FD=0;
00148   static TH1D* RecoEnergyTrueTauNQ_FD=0;
00149   static TH1D* RecoEnergyTrueMuonNQ_FD=0;
00150 
00151   static TH1D* RecoEnergyTrueTauPQ_ND=0;
00152   static TH1D* RecoEnergyTrueMuonPQ_ND=0;
00153   static TH1D* RecoEnergyTrueTauNQ_ND=0;
00154   static TH1D* RecoEnergyTrueMuonNQ_ND=0;
00155 
00156   static TH1D* RecoEnergyWSTauPQ_FD=0;
00157   static TH1D* RecoEnergyWSMuonPQ_FD=0;
00158   static TH1D* RecoEnergyWSTauNQ_FD=0;
00159   static TH1D* RecoEnergyWSMuonNQ_FD=0;
00160 
00161   static TH1D* RecoEnergyWSTauPQ_ND=0;
00162   static TH1D* RecoEnergyWSMuonPQ_ND=0;
00163   static TH1D* RecoEnergyWSTauNQ_ND=0;
00164   static TH1D* RecoEnergyWSMuonNQ_ND=0;
00165 
00166 
00167   //DATA histos (CC numus + CC numubars)
00168   static TH1D* RecoEnergyAll_ND=0;
00169   static TH1D* RecoEnergyAll_FD=0;
00170 
00171   static TH1F*  poKinPQ = 0;
00172   static TH1F*  roIdPQ = 0;
00173   static TH1F*  dpIdPQ = 0;
00174   static TH1F*  trkLPQ = 0;
00175   static TH1F*  relAPQ = 0;
00176   static TH1F*  relANQ = 0;
00177   static TH1F*  relAPQ1 = 0;
00178   static TH1F*  qp_sigmaqpPQ = 0;
00179   static TH1F*  majCPQ = 0;
00180   static TH1F*  probPQ = 0;
00181   static TH2F*  relAngVsTrkEndX = 0;
00182   static TH2F*  relAngVsTrkEndY = 0;
00183   static TH2F*  relAngVsTrkEndZ = 0;
00184 
00185   if(!fRecoVsTrueEnergy_ND){
00186     MSG("NuHistos",Msg::kInfo)
00187       <<"Creating histograms on first run of FillMatrixMethodHistos..."
00188       <<" gDirectory gives:"<<endl;
00189           gDirectory->Print();
00190 
00191     const NuUtilities cuts;
00192     const vector<Double_t> recoBins = cuts.RecoBins(binningScheme);
00193     const Int_t numRecoBins = recoBins.size()-1;
00194     Float_t *recoBinsArray;
00195     recoBinsArray=new Float_t[numRecoBins+1];
00196     {
00197       Int_t i=0;
00198       for (vector<Double_t>::const_iterator itBin = recoBins.begin();
00199            itBin != recoBins.end();
00200            ++itBin, ++i){
00201         recoBinsArray[i] = *itBin;
00202       }
00203     }
00204 
00205     const vector<Double_t> trueBins = cuts.TrueBins(binningScheme);
00206     const Int_t numTrueBins = trueBins.size()-1;
00207     Float_t *trueBinsArray;
00208     trueBinsArray=new Float_t[numTrueBins+1];
00209     {
00210       Int_t i=0;
00211       for (vector<Double_t>::const_iterator itBin = trueBins.begin();
00212            itBin != trueBins.end();
00213            ++itBin, ++i){
00214         trueBinsArray[i] = *itBin;
00215       }
00216     }
00217 
00218     //helper histos (CC numus):
00219     fRecoVsTrueEnergy_ND=new TH2D
00220                 ("RecoVsTrueEnergy_ND",
00221                  "Reco Vs True Energy (NearDet)",
00222                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00223     fRecoVsTrueEnergy_ND->Sumw2();
00224 
00225     fEfficiency_ND=new TH1D
00226                 ("Efficiency_ND",
00227                  "NuMu CC Selection Efficiency with True Energy (NearDet)",
00228                  numTrueBins,trueBinsArray);
00229     fEfficiency_ND->Sumw2();
00230 
00231     fPurity_ND=new TH1D
00232                 ("Purity_ND",
00233                  "NuMu CC Selection Purity with Reco Energy (NearDet)",
00234                  numRecoBins,recoBinsArray);
00235     fPurity_ND->Sumw2();
00236 
00237     fRecoVsTrueEnergy_FD=new TH2D
00238                 ("RecoVsTrueEnergy_FD",
00239                  "Reco Vs True Energy (FarDet)",
00240                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00241     fRecoVsTrueEnergy_FD->Sumw2();
00242 
00243     fEfficiency_FD=new TH1D
00244                 ("Efficiency_FD",
00245                  "NuMu CC Selection Efficiency with True Energy (FarDet)",
00246                  numTrueBins,trueBinsArray);
00247     fEfficiency_FD->Sumw2();
00248 
00249     fPurity_FD=new TH1D
00250                 ("Purity_FD",
00251                  "NuMu CC Selection Purity with Reco Energy (FarDet)",
00252                  numRecoBins,recoBinsArray);
00253     fPurity_FD->Sumw2();
00254 
00255     fCCContamination_FD = new TH1D
00256                 ("CCContamination_FD",
00257                  "CC antineutrino contamination in a -ve curving CC selection (FarDet)",
00258                  numTrueBins,trueBinsArray);
00259     fCCContamination_FD->Sumw2();
00260 
00261     fCCContamination_ND = new TH1D
00262                 ("CCContamination_ND",
00263                  "CC antineutrino contamination in a -ve curving CC selection (NearDet)",
00264                  numRecoBins,recoBinsArray);
00265     fCCContamination_ND->Sumw2();
00266 
00267     fCCContaminationRecoVsTrue_FD = new TH2D
00268                 ("CCContaminationRecoVsTrue_FD",
00269                  "Reco vs true energy of CC antineutrino contamination in a -ve curving CC selection (FarDet)",
00270                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00271     fCCContaminationRecoVsTrue_FD->Sumw2();
00272 
00273     fNCContamination_ND = new TH1D
00274                 ("NCContamination_ND",
00275                  "NC contamination in a -ve curving CC selection (NearDet)",
00276                  numRecoBins,recoBinsArray);
00277     fNCContamination_ND->Sumw2();
00278 
00279     fNCContamination_FD = new TH1D
00280                 ("NCContamination_FD",
00281                  "NC contamination in a -ve curving CC selection (FarDet)",
00282                  numRecoBins,recoBinsArray);
00283     fNCContamination_FD->Sumw2();
00284 
00285     //helper histos (CC numubars):
00286     fRecoVsTrueEnergyPQ_ND=new TH2D
00287                 ("RecoVsTrueEnergyPQ_ND",
00288                  "Reco Vs True Energy (NearDet)",
00289                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00290     fRecoVsTrueEnergyPQ_ND->Sumw2();
00291 
00292     fEfficiencyPQ_ND=new TH1D
00293                 ("EfficiencyPQ_ND",
00294                  "NuMuBar CC Selection Efficiency with True Energy (NearDet)",
00295                  numTrueBins,trueBinsArray);
00296     fEfficiencyPQ_ND->Sumw2();
00297 
00298     fPurityPQ_ND=new TH1D
00299                 ("PurityPQ_ND",
00300                  "NuMuBar CC Selection Purity with Reco Energy (NearDet)",
00301                  numRecoBins,recoBinsArray);
00302     fPurityPQ_ND->Sumw2();
00303 
00304     fRecoVsTrueEnergyPQ_FD=new TH2D
00305                 ("RecoVsTrueEnergyPQ_FD",
00306                  "Reco Vs True Energy (FarDet)",
00307                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00308     fRecoVsTrueEnergyPQ_FD->Sumw2();
00309 
00310     fEfficiencyPQ_FD=new TH1D
00311                 ("EfficiencyPQ_FD",
00312                  "NuMuBar CC Selection Efficiency with True Energy (FarDet)",
00313                  numTrueBins,trueBinsArray);
00314     fEfficiencyPQ_FD->Sumw2();
00315 
00316     fPurityPQ_FD=new TH1D
00317                 ("PurityPQ_FD",
00318                  "NuMuBar CC Selection Purity with Reco Energy (FarDet)",
00319                  numRecoBins,recoBinsArray);
00320     fPurityPQ_FD->Sumw2();
00321 
00322     fCCContaminationPQ_ND = new TH1D
00323                 ("CCContaminationPQ_ND",
00324                  "CC neutrino contamination in a +ve curving CC selection (NearDet)",
00325                  numRecoBins,recoBinsArray);
00326     fCCContaminationPQ_ND->Sumw2();
00327 
00328     fCCContaminationPQ_FD = new TH1D
00329                 ("CCContaminationPQ_FD",
00330                  "CC neutrino contamination in a +ve curving CC selection (FarDet)",
00331                  numTrueBins,trueBinsArray);
00332     fCCContaminationPQ_FD->Sumw2();
00333 
00334     fCCContaminationRecoVsTruePQ_FD = new TH2D
00335                 ("CCContaminationRecoVsTruePQ_FD",
00336                  "RecoVsTrue Energy of CC neutrino contamination in a +ve curving CC selection (FarDet)",
00337                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00338     fCCContaminationRecoVsTruePQ_FD->Sumw2();
00339 
00340     fNCContaminationPQ_ND = new TH1D
00341                 ("NCContaminationPQ_ND",
00342                  "NC contamination in a +ve curving CC selection (NearDet)",
00343                  numRecoBins,recoBinsArray);
00344     fNCContaminationPQ_ND->Sumw2();
00345 
00346     fNCContaminationPQ_FD = new TH1D
00347                 ("NCContaminationPQ_FD",
00348                  "NC contamination in a +ve curving CC selection (FarDet)",
00349                  numRecoBins,recoBinsArray);
00350     fNCContaminationPQ_FD->Sumw2();
00351 
00352     //helper histos (CC numus + CC numubars):
00353     fRecoVsTrueEnergyAll_ND=new TH2D
00354                 ("RecoVsTrueEnergyAll_ND",
00355                  "Reco Vs True Energy (NearDet)",
00356                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00357     fRecoVsTrueEnergyAll_ND->Sumw2();
00358 
00359     fEfficiencyAll_ND=new TH1D
00360                 ("EfficiencyAll_ND",
00361                  "All CC Selection Efficiency with True Energy (NearDet)",
00362                  numTrueBins,trueBinsArray);
00363     fEfficiencyAll_ND->Sumw2();
00364 
00365     fPurityAll_ND=new TH1D
00366                 ("PurityAll_ND",
00367                  "All CC Selection Purity with Reco Energy (NearDet)",
00368                  numRecoBins,recoBinsArray);
00369     fPurityAll_ND->Sumw2();
00370 
00371     fRecoVsTrueEnergyAll_FD=new TH2D
00372                 ("RecoVsTrueEnergyAll_FD",
00373                  "Reco Vs True Energy (FarDet)",
00374                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00375     fRecoVsTrueEnergyAll_FD->Sumw2();
00376 
00377     fEfficiencyAll_FD=new TH1D
00378                 ("EfficiencyAll_FD",
00379                  "All CC Selection Efficiency with True Energy (FarDet)",
00380                  numTrueBins,trueBinsArray);
00381     fEfficiencyAll_FD->Sumw2();
00382 
00383     fPurityAll_FD=new TH1D
00384                 ("PurityAll_FD",
00385                  "All CC Selection Purity with Reco Energy (FarDet)",
00386                  numRecoBins,recoBinsArray);
00387     fPurityAll_FD->Sumw2();
00388 
00389     //Helper histos (CC nutau):
00390     fRecoVsTrueEnergyTau_FD=new TH2D
00391                 ("RecoVsTrueEnergyTau_FD",
00392                  "Tau Reco Vs True Energy (FarDet)",
00393                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00394     fRecoVsTrueEnergyTau_FD->Sumw2();
00395 
00396     fEfficiencyTau_FD=new TH1D
00397                 ("EfficiencyTau_FD",
00398                  "NuTau CC Selection Efficiency with True Energy (FarDet)",
00399                  numTrueBins,trueBinsArray);
00400     fEfficiencyTau_FD->Sumw2();
00401 
00402     //Helper histos (CC nutaubar):
00403     fRecoVsTrueEnergyTauPQ_FD=new TH2D
00404                 ("RecoVsTrueEnergyTauPQ_FD",
00405                  "TauBar Reco Vs True Energy (FarDet)",
00406                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00407     fRecoVsTrueEnergyTauPQ_FD->Sumw2();
00408 
00409     fEfficiencyTauPQ_FD=new TH1D
00410                 ("EfficiencyTauPQ_FD",
00411                  "NuTauBar CC Selection Efficiency with True Energy (FarDet)",
00412                  numTrueBins,trueBinsArray);
00413     fEfficiencyTauPQ_FD->Sumw2();
00414 
00415     //Helper histos (CC nutau + nutaubar):
00416     fRecoVsTrueEnergyTauAll_FD=new TH2D
00417                 ("RecoVsTrueEnergyTauAll_FD",
00418                  "Tau Reco Vs True Energy (FarDet)",
00419                  numTrueBins,trueBinsArray,numRecoBins,recoBinsArray);
00420     fRecoVsTrueEnergyTauAll_FD->Sumw2();
00421 
00422     fEfficiencyTauAll_FD=new TH1D
00423                 ("EfficiencyTauAll_FD",
00424                  "NuTau CC Selection Efficiency with True Energy (FarDet)",
00425                  numTrueBins,trueBinsArray);
00426     fEfficiencyTauAll_FD->Sumw2();
00427 
00428     //Checklist histos (CC numus):
00429     fTrueEnergyCCOnlyEvents_ND=new TH1D
00430                 ("TrueEnergyCCOnlyEvents_ND",
00431                  "NuMu CC Selected Events with True Energy (NearDet)",
00432                  numTrueBins,trueBinsArray);
00433     fTrueEnergyCCOnlyEvents_ND->Sumw2();
00434 
00435     fRecoEnergyCCOnlyEvents_ND=new TH1D
00436                 ("RecoEnergyCCOnlyEvents_ND",
00437                  "NuMu CC Selected Events with Reco Energy (NearDet)",
00438                  numRecoBins,recoBinsArray);
00439     fRecoEnergyCCOnlyEvents_ND->Sumw2();
00440 
00441     fRecoEnergyAllEvents_ND=new TH1D
00442                 ("RecoEnergyAllEvents_ND",
00443                  "Selected Events with Reco Energy (NearDet)",
00444                  numRecoBins,recoBinsArray);
00445     fRecoEnergyAllEvents_ND->Sumw2();
00446 
00447     fTrueEnergyCCOnlyEvents_FD=new TH1D
00448                 ("TrueEnergyCCOnlyEvents_FD",
00449                  "NuMu CC Selected Events with True Energy (FarDet)",
00450                  numTrueBins,trueBinsArray);
00451     fTrueEnergyCCOnlyEvents_FD->Sumw2();
00452 
00453     fRecoEnergyCCOnlyEvents_FD=new TH1D
00454                 ("RecoEnergyCCOnlyEvents_FD",
00455                  "NuMu CC Selected Events with Reco Energy (FarDet)",
00456                  numRecoBins,recoBinsArray);
00457     fRecoEnergyCCOnlyEvents_FD->Sumw2();
00458 
00459     fRecoEnergyAllEvents_FD=new TH1D
00460                 ("RecoEnergyAllEvents_FD",
00461                  "Selected Events with Reco Energy (FarDet)",
00462                  numRecoBins,recoBinsArray);
00463     fRecoEnergyAllEvents_FD->Sumw2();
00464 
00465     //Checklist histos (CC numubars):
00466     fTrueEnergyCCOnlyEventsPQ_ND=new TH1D
00467                 ("TrueEnergyCCOnlyEventsPQ_ND",
00468                  "NuMuBar CC Selected Events with True Energy (NearDet)",
00469                  numTrueBins,trueBinsArray);
00470     fTrueEnergyCCOnlyEventsPQ_ND->Sumw2();
00471 
00472     fRecoEnergyCCOnlyEventsPQ_ND=new TH1D
00473                 ("RecoEnergyCCOnlyEventsPQ_ND",
00474                  "NuMuBar CC Selected Events with Reco Energy (NearDet)",
00475                  numRecoBins,recoBinsArray);
00476     fRecoEnergyCCOnlyEventsPQ_ND->Sumw2();
00477 
00478     fRecoEnergyAllEventsPQ_ND=new TH1D
00479                 ("RecoEnergyAllEventsPQ_ND",
00480                  "Selected Events with Reco Energy (NearDet)",
00481                  numRecoBins,recoBinsArray);
00482     fRecoEnergyAllEventsPQ_ND->Sumw2();
00483 
00484     fTrueEnergyCCOnlyEventsPQ_FD=new TH1D
00485                 ("TrueEnergyCCOnlyEventsPQ_FD",
00486                  "NuMuBar CC Selected Events with True Energy (FarDet)",
00487                  numTrueBins,trueBinsArray);
00488     fTrueEnergyCCOnlyEventsPQ_FD->Sumw2();
00489 
00490     fRecoEnergyCCOnlyEventsPQ_FD=new TH1D
00491                 ("RecoEnergyCCOnlyEventsPQ_FD",
00492                  "NuMuBar CC Selected Events with Reco Energy (FarDet)",
00493                  numRecoBins,recoBinsArray);
00494     fRecoEnergyCCOnlyEventsPQ_FD->Sumw2();
00495 
00496     fRecoEnergyAllEventsPQ_FD=new TH1D
00497                 ("RecoEnergyAllEventsPQ_FD",
00498                  "Selected Events with Reco Energy (FarDet)",
00499                  numRecoBins,recoBinsArray);
00500     fRecoEnergyAllEventsPQ_FD->Sumw2();
00501 
00502     //Checklist histos (CC numus + CC numubars):
00503     fTrueEnergyCCOnlyEventsAll_ND=new TH1D
00504                 ("TrueEnergyCCOnlyEventsAll_ND",
00505                  "All CC Selected Events with True Energy (NearDet)",
00506                  numTrueBins,trueBinsArray);
00507     fTrueEnergyCCOnlyEventsAll_ND->Sumw2();
00508 
00509     fRecoEnergyCCOnlyEventsAll_ND=new TH1D
00510                 ("RecoEnergyCCOnlyEventsAll_ND",
00511                  "All CC Selected Events with Reco Energy (NearDet)",
00512                  numRecoBins,recoBinsArray);
00513     fRecoEnergyCCOnlyEventsAll_ND->Sumw2();
00514 
00515     fRecoEnergyAllEventsAll_ND=new TH1D
00516                 ("RecoEnergyAllEventsAll_ND",
00517                  "Selected Events with Reco Energy (NearDet)",
00518                  numRecoBins,recoBinsArray);
00519     fRecoEnergyAllEventsAll_ND->Sumw2();
00520 
00521     fTrueEnergyCCOnlyEventsAll_FD=new TH1D
00522                 ("TrueEnergyCCOnlyEventsAll_FD",
00523                  "All CC Selected Events with True Energy (FarDet)",
00524                  numTrueBins,trueBinsArray);
00525     fTrueEnergyCCOnlyEventsAll_FD->Sumw2();
00526 
00527     fRecoEnergyCCOnlyEventsAll_FD=new TH1D
00528                 ("RecoEnergyCCOnlyEventsAll_FD",
00529                  "All CC Selected Events with Reco Energy (FarDet)",
00530                  numRecoBins,recoBinsArray);
00531     fRecoEnergyCCOnlyEventsAll_FD->Sumw2();
00532 
00533     fRecoEnergyAllEventsAll_FD=new TH1D
00534                 ("RecoEnergyAllEventsAll_FD",
00535                  "Selected Events with Reco Energy (FarDet)",
00536                  numRecoBins,recoBinsArray);
00537     fRecoEnergyAllEventsAll_FD->Sumw2();
00538 
00539     //Checklist histos (CC nutaus)
00540     fTrueEnergyCCOnlyEventsTau_FD=new TH1D
00541                 ("TrueEnergyCCOnlyEventsTau_FD",
00542                  "NuTau CC Selected Events with True Energy (FarDet)",
00543                  numTrueBins,trueBinsArray);
00544     fTrueEnergyCCOnlyEventsTau_FD->Sumw2();
00545 
00546     //Checklist histos (CC nutaubars)
00547     fTrueEnergyCCOnlyEventsTauPQ_FD=new TH1D
00548                 ("TrueEnergyCCOnlyEventsTauPQ_FD",
00549                  "NuTauBar CC Selected Events with True Energy (FarDet)",
00550                  numTrueBins,trueBinsArray);
00551     fTrueEnergyCCOnlyEventsTauPQ_FD->Sumw2();
00552 
00553     //Checklist histos (CC nutaus + nutaubars)
00554     fTrueEnergyCCOnlyEventsTauAll_FD=new TH1D
00555                 ("TrueEnergyCCOnlyEventsTauAll_FD",
00556                  "NuTau CC Selected Events with True Energy (FarDet)",
00557                  numTrueBins,trueBinsArray);
00558     fTrueEnergyCCOnlyEventsTauAll_FD->Sumw2();
00559 
00560     //DATA histos (CC numus):
00561     RecoEnergy_ND=new TH1D
00562                 ("RecoEnergy_ND","Reconstructed Energy - Data (NearDet)",
00563                  numRecoBins,recoBinsArray);
00564     RecoEnergy_FD=new TH1D
00565                 ("RecoEnergy_FD","Reconstructed Energy - Data (FarDet)",
00566                  numRecoBins,recoBinsArray);
00567 
00568     //DATA histos (CC numubars):
00569     RecoEnergyPQ_ND=new TH1D
00570                 ("RecoEnergyPQ_ND","Reconstructed Energy - Data (NearDet)",
00571                  numRecoBins,recoBinsArray);
00572     RecoEnergyPQ_FD=new TH1D
00573       ("RecoEnergyPQ_FD","Reconstructed Energy - Data (FarDet)",
00574        numRecoBins,recoBinsArray);
00575 
00576     //DATA histos (Pure Reco Energys)
00577     RecoEnergyTrueTauPQ_FD=new TH1D
00578       ("RecoEnergyTrueTauPQ_FD","Reconstructed Energy - Data (True anti tau FarDet)",
00579        numRecoBins,recoBinsArray);
00580     RecoEnergyTrueMuonPQ_FD=new TH1D
00581       ("RecoEnergyTrueMuonPQ_FD","Reconstructed Energy - Data (True anti muon FarDet)",
00582        numRecoBins,recoBinsArray);
00583     RecoEnergyTrueTauNQ_FD=new TH1D
00584   ("RecoEnergyTrueTauNQ_FD","Reconstructed Energy - Data (True tau FarDet)",
00585    numRecoBins,recoBinsArray);
00586     RecoEnergyTrueMuonNQ_FD=new TH1D
00587       ("RecoEnergyTrueMuonNQ_FD","Reconstructed Energy - Data (True muon FarDet)",
00588        numRecoBins,recoBinsArray);
00589 
00590     RecoEnergyTrueTauPQ_ND=new TH1D
00591   ("RecoEnergyTrueTauPQ_ND","Reconstructed Energy - Data (True anti tau NearDet)",
00592    numRecoBins,recoBinsArray);
00593     RecoEnergyTrueMuonPQ_ND=new TH1D
00594       ("RecoEnergyTrueMuonPQ_ND","Reconstructed Energy - Data (True anti muon NearDet)",
00595        numRecoBins,recoBinsArray);
00596     RecoEnergyTrueTauNQ_ND=new TH1D
00597       ("RecoEnergyTrueTauNQ_ND","Reconstructed Energy - Data (True tau NearDet)",
00598        numRecoBins,recoBinsArray);
00599     RecoEnergyTrueMuonNQ_ND=new TH1D
00600       ("RecoEnergyTrueMuonNQ_ND","Reconstructed Energy - Data (True muon NearDet)",
00601        numRecoBins,recoBinsArray);
00602 
00603     RecoEnergyWSTauPQ_FD=new TH1D
00604       ("RecoEnergyWSTauPQ_FD","Reconstructed Energy - Data (WS tau FarDet)",
00605        numRecoBins,recoBinsArray);
00606     RecoEnergyWSMuonPQ_FD=new TH1D
00607       ("RecoEnergyWSMuonPQ_FD","Reconstructed Energy - Data (WS muon FarDet)",
00608        numRecoBins,recoBinsArray);
00609     RecoEnergyWSTauNQ_FD=new TH1D
00610       ("RecoEnergyWSTauNQ_FD","Reconstructed Energy - Data (WS anti tau FarDet)",
00611        numRecoBins,recoBinsArray);
00612     RecoEnergyWSMuonNQ_FD=new TH1D
00613       ("RecoEnergyWSMuonNQ_FD","Reconstructed Energy - Data (WS anti muon FarDet)",
00614        numRecoBins,recoBinsArray);
00615 
00616     RecoEnergyWSTauPQ_ND=new TH1D
00617       ("RecoEnergyWSTauPQ_ND","Reconstructed Energy - Data (WS tau NearDet)",
00618        numRecoBins,recoBinsArray);
00619     RecoEnergyWSMuonPQ_ND=new TH1D
00620       ("RecoEnergyWSMuonPQ_ND","Reconstructed Energy - Data (WS muon NearDet)",
00621        numRecoBins,recoBinsArray);
00622     RecoEnergyWSTauNQ_FD=new TH1D
00623       ("RecoEnergyWSTauNQ_ND","Reconstructed Energy - Data (WS anti tau NearDet)",
00624        numRecoBins,recoBinsArray);
00625     RecoEnergyWSMuonNQ_ND=new TH1D
00626       ("RecoEnergyWSMuonNQ_ND","Reconstructed Energy - Data (WS anti muon NearDet)",
00627        numRecoBins,recoBinsArray);
00628 
00629 
00630     //DATA histos (CC numus + CC numubars):
00631     RecoEnergyAll_ND=new TH1D
00632                 ("RecoEnergyAll_ND","Reconstructed Energy - Data (NearDet)",
00633                  numRecoBins,recoBinsArray);
00634     RecoEnergyAll_FD=new TH1D
00635                 ("RecoEnergyAll_FD","Reconstructed Energy - Data (FarDet)",
00636                  numRecoBins,recoBinsArray);
00637 
00638         poKinPQ = new TH1F("poKinPQ", "poKin Value for PQ Events;poKIN", 100, -1., 1.);
00639         roIdPQ = new TH1F("roIdPQ", "roID Value for PQ Events;roID", 100, 0., 1.);
00640         dpIdPQ = new TH1F("dpIdPQ", "dpID Value for PQ Events;dpID", 100, -1., 1.);
00641         trkLPQ = new TH1F("trkLPQ", "trkLength for PQ Events;Track Length", 500, -10., 490.);
00642         relAPQ = new TH1F("relAPQ", "|Relative Angle - #pi| for PQ Events", 100, 0., 3.14159);
00643         relAPQ1 = new TH1F("relAPQ1","Relative Angle for PQ Events", 60, 0, 6.28);
00644         relAngVsTrkEndX = new TH2F("relAngVsTrkEndX", "Rel. Angle vs xTrkEnd for PQ", 100, -5., 5., 100, 2.0, 3.14159);
00645         relAngVsTrkEndY = new TH2F("relAngVsTrkEndY", "Rel. Angle vs yTrkEnd for PQ", 100, -3.5, 3.5, 100, 2.0, 3.14159);
00646         relAngVsTrkEndZ = new TH2F("relAngVsTrkEndZ", "Rel. Angle vs zTrkEnd for PQ", 100, 0., 18., 100, 2.0, 3.14159);
00647         relANQ = new TH1F("relANQ", "|Relative Angle - #pi| for NQ Events", 100, 0., 3.14159);
00648         qp_sigmaqpPQ = new TH1F("qp_sigmaqpPQ", "qp/#sigma qp for PQ Events", 320, -16, 16.);
00649         majCPQ = new TH1F("majCPQ", "Majority Curvature for PQ Events;Majority Curvature", 100, -1., 1.);
00650         probPQ = new TH1F("probPQ", "prob for PQ Events;Prob", 100, 0., 1.);
00651   }
00652 
00653   Float_t weight=nu.rw;
00654 
00655   if (nu.simFlag==SimFlag::kMC) {
00656     if (nu.charge==-1) {
00657       //fill histos
00658       if (nu.detector==Detector::kNear) {
00659         fRecoEnergyAllEvents_ND->Fill(nu.energy,weight);
00660         if(nu.iaction==1 && nu.inu==14) {
00661           fRecoEnergyCCOnlyEvents_ND->Fill(nu.energy,weight);
00662           fTrueEnergyCCOnlyEvents_ND->Fill(fabs(nu.energyMC),weight);
00663           fPurity_ND->Fill(nu.energy,weight);
00664           fEfficiency_ND->Fill(fabs(nu.energyMC),weight);
00665           fRecoVsTrueEnergy_ND->Fill(fabs(nu.energyMC),
00666                                      nu.energy,weight);
00667         }
00668         else if (nu.iaction==1 && nu.inu==-14){
00669           fCCContamination_ND->Fill(nu.energy,weight);
00670         }
00671         else {
00672           fNCContamination_ND->Fill(nu.energy,weight);
00673         }
00674       }
00675       else if (nu.detector==Detector::kFar) {
00676         fRecoEnergyAllEvents_FD->Fill(nu.energy,weight);
00677         if(nu.iaction==1 && nu.inu==14) {
00678           fRecoEnergyCCOnlyEvents_FD->Fill(nu.energy,weight);
00679           fTrueEnergyCCOnlyEvents_FD->Fill(fabs(nu.energyMC),weight);
00680           fPurity_FD->Fill(nu.energy,weight);
00681           fEfficiency_FD->Fill(fabs(nu.energyMC),weight);
00682           fRecoVsTrueEnergy_FD->Fill(fabs(nu.energyMC),
00683                                      nu.energy,weight);
00684         }
00685         else if (nu.iaction==1 && nu.inu==-14){
00686           fCCContamination_FD->Fill(fabs(nu.energyMC),weight);
00687           fCCContaminationRecoVsTrue_FD->Fill(fabs(nu.energyMC),
00688                                               nu.energy,
00689                                               weight);
00690         }
00691         else if (nu.iaction==1 && nu.inu==16 && nu.inunoosc==14){
00692           fEfficiencyTau_FD->Fill(fabs(nu.energyMC),weight);
00693           fTrueEnergyCCOnlyEventsTau_FD->Fill(fabs(nu.energyMC),weight);
00694           fRecoVsTrueEnergyTau_FD->Fill(fabs(nu.energyMC),
00695                                         nu.energy,weight);
00696         }
00697         else {
00698           fNCContamination_FD->Fill(nu.energy,weight);
00699         }
00700       }
00701       else cout<<"ahhhh, det="<<nu.detector<<endl;
00702     }
00703     if (nu.charge==1) {
00704       //fill histos
00705       if (nu.detector==Detector::kNear) {
00706         fRecoEnergyAllEventsPQ_ND->Fill(nu.energy,weight);
00707         if(nu.iaction==1 && nu.inu==-14) {
00708           fRecoEnergyCCOnlyEventsPQ_ND->Fill(nu.energy,weight);
00709           fTrueEnergyCCOnlyEventsPQ_ND->Fill(fabs(nu.energyMC),weight);
00710           fPurityPQ_ND->Fill(nu.energy,weight);
00711           fEfficiencyPQ_ND->Fill(fabs(nu.energyMC),weight);
00712           fRecoVsTrueEnergyPQ_ND->Fill(fabs(nu.energyMC),
00713                                        nu.energy,weight);
00714         }
00715         else if (nu.iaction==1 && nu.inu==14){
00716           fCCContaminationPQ_ND->Fill(nu.energy,weight);
00717         }
00718         else {
00719           fNCContaminationPQ_ND->Fill(nu.energy,weight);
00720         }
00721       }
00722       else if (nu.detector==Detector::kFar) {
00723         fRecoEnergyAllEventsPQ_FD->Fill(nu.energy,weight);
00724         if(nu.iaction==1 && nu.inu==-14) {
00725           fRecoEnergyCCOnlyEventsPQ_FD->Fill(nu.energy,weight);
00726           fTrueEnergyCCOnlyEventsPQ_FD->Fill(fabs(nu.energyMC),weight);
00727           fPurityPQ_FD->Fill(nu.energy,weight);
00728           fEfficiencyPQ_FD->Fill(fabs(nu.energyMC),weight);
00729           fRecoVsTrueEnergyPQ_FD->Fill(fabs(nu.energyMC),
00730                                        nu.energy,weight);
00731         }
00732         else if (nu.iaction==1 && nu.inu==14){
00733           fCCContaminationPQ_FD->Fill(fabs(nu.energyMC),weight);
00734           fCCContaminationRecoVsTruePQ_FD->Fill(fabs(nu.energyMC),
00735                                                 nu.energy,
00736                                                 weight);
00737         }
00738         else if (nu.iaction==1 && nu.inu==-16 && nu.inunoosc==-14){
00739           fEfficiencyTauPQ_FD->Fill(fabs(nu.energyMC),weight);
00740           fTrueEnergyCCOnlyEventsTauPQ_FD->Fill(fabs(nu.energyMC),weight);
00741           fRecoVsTrueEnergyTauPQ_FD->Fill(fabs(nu.energyMC),
00742                                           nu.energy,weight);
00743         }
00744         else {
00745           fNCContaminationPQ_FD->Fill(nu.energy,weight);
00746         }
00747       }
00748       else cout<<"ahhhh, det="<<nu.detector<<endl;
00749     }
00750     if ((nu.charge==1) || (-1==nu.charge)) {
00751       //fill histos
00752       if (nu.detector==Detector::kNear) {
00753         fRecoEnergyAllEventsAll_ND->Fill(nu.energy,weight);
00754         if(nu.iaction==1 && (nu.inu==-14 || nu.inu == 14)) {
00755           fRecoEnergyCCOnlyEventsAll_ND->Fill(nu.energy,weight);
00756           fTrueEnergyCCOnlyEventsAll_ND->Fill(fabs(nu.energyMC),weight);
00757           fPurityAll_ND->Fill(nu.energy,weight);
00758           fEfficiencyAll_ND->Fill(fabs(nu.energyMC),weight);
00759           fRecoVsTrueEnergyAll_ND->Fill(fabs(nu.energyMC),
00760                                         nu.energy,weight);
00761         }
00762       }
00763       else if (nu.detector==Detector::kFar) {
00764         fRecoEnergyAllEventsAll_FD->Fill(nu.energy,weight);
00765         if(nu.iaction==1 && (nu.inu==-14 || nu.inu == 14)) {
00766           fRecoEnergyCCOnlyEventsAll_FD->Fill(nu.energy,weight);
00767           fTrueEnergyCCOnlyEventsAll_FD->Fill(fabs(nu.energyMC),weight);
00768           fPurityAll_FD->Fill(nu.energy,weight);
00769           fEfficiencyAll_FD->Fill(fabs(nu.energyMC),weight);
00770           fRecoVsTrueEnergyAll_FD->Fill(fabs(nu.energyMC),
00771                                         nu.energy,weight);
00772         }
00773         else if (nu.iaction==1 && (nu.inu==-16 || nu.inu == 16)
00774                  && (nu.inunoosc == -14 || nu.inunoosc == 14)){
00775           fEfficiencyTauAll_FD->Fill(fabs(nu.energyMC),weight);
00776           fTrueEnergyCCOnlyEventsTauAll_FD->Fill(fabs(nu.energyMC),weight);
00777           fRecoVsTrueEnergyTauAll_FD->Fill(fabs(nu.energyMC),
00778                                           nu.energy,weight);
00779         }
00780       }
00781       else cout<<"ahhhh, det="<<nu.detector<<endl;
00782     }
00783   }
00784 
00785   Bool_t oscillateData = false;
00786   Double_t oscWeight = 1.0;
00787   Double_t s2t = 1.0;
00788   Double_t dm2 = 2.3e-3;
00789   if (oscillateData && nu.energyMC && nu.iaction==1 && abs(nu.inu)==14){
00790     oscWeight = NuOscProbCalc::OscillationWeight(nu.energyMC, dm2, s2t);
00791   }
00792 
00793   if (nu.charge==-1) {
00794     if (nu.detector==Detector::kNear) {
00795       RecoEnergy_ND->Fill(nu.energy,weight);
00796     }
00797     else if (nu.detector==Detector::kFar) {
00798       RecoEnergy_FD->Fill(nu.energy,weight*oscWeight);
00799     }
00800     else cout<<"ahhhh, det="<<nu.detector<<endl;
00801   }
00802   if (nu.charge==1) {
00803     if (nu.detector==Detector::kNear) {
00804       RecoEnergyPQ_ND->Fill(nu.energy,weight);
00805     }
00806     else if (nu.detector==Detector::kFar) {
00807       RecoEnergyPQ_FD->Fill(nu.energy,weight*oscWeight);
00808     }
00809     else cout<<"ahhhh, det="<<nu.detector<<endl;
00810   }
00811   if(nu.detector==Detector::kFar&&nu.iaction==1){
00812     if(nu.inu==-16&&nu.charge==1&& nu.inunoosc==-14){
00813       RecoEnergyTrueTauPQ_FD->Fill(nu.energy,weight*oscWeight);
00814     }
00815     if(nu.inu==16&&nu.charge==1&& nu.inunoosc==14){
00816       RecoEnergyWSTauPQ_FD->Fill(nu.energy,weight*oscWeight);
00817     }
00818     if(nu.inu==-14&&nu.charge==1){
00819       RecoEnergyTrueMuonPQ_FD->Fill(nu.energy,weight*oscWeight);
00820     }
00821     if(nu.inu==14&&nu.charge==1){
00822       RecoEnergyWSMuonPQ_FD->Fill(nu.energy,weight*oscWeight);
00823     }
00824     if(nu.inu==16&&nu.charge==-1&& nu.inunoosc==14){
00825       RecoEnergyTrueTauNQ_FD->Fill(nu.energy,weight*oscWeight);
00826     }
00827     if(nu.inu==-16&&nu.charge==-1&& nu.inunoosc==-14){
00828       RecoEnergyWSTauNQ_FD->Fill(nu.energy,weight*oscWeight);
00829     }
00830     if(nu.inu==14&&nu.charge==-1){
00831       RecoEnergyTrueMuonNQ_FD->Fill(nu.energy,weight*oscWeight);
00832     }
00833     if(nu.inu==-14&&nu.charge==-1){
00834       RecoEnergyWSMuonNQ_FD->Fill(nu.energy,weight*oscWeight);
00835     }
00836   }
00837   else if(nu.detector==Detector::kNear&&nu.iaction==1){
00838     if(nu.inu==-16&&nu.charge==1&& nu.inunoosc==-14){
00839       RecoEnergyTrueTauPQ_ND->Fill(nu.energy,weight*oscWeight);
00840     }
00841     if(nu.inu==16&&nu.charge==1&& nu.inunoosc==14){
00842       RecoEnergyWSTauPQ_ND->Fill(nu.energy,weight*oscWeight);
00843     }
00844     if(nu.inu==-14&&nu.charge==1){
00845       RecoEnergyTrueMuonPQ_ND->Fill(nu.energy,weight*oscWeight);
00846     }
00847     if(nu.inu==14&&nu.charge==1){
00848       RecoEnergyWSMuonPQ_ND->Fill(nu.energy,weight*oscWeight);
00849     }
00850     if(nu.inu==16&&nu.charge==-1&& nu.inunoosc==14){
00851       RecoEnergyTrueTauNQ_ND->Fill(nu.energy,weight*oscWeight);
00852     }
00853     if(nu.inu==-16&&nu.charge==-1&& nu.inunoosc==-14){
00854       RecoEnergyWSTauNQ_ND->Fill(nu.energy,weight*oscWeight);
00855     }
00856     if(nu.inu==14&&nu.charge==-1){
00857       RecoEnergyTrueMuonNQ_ND->Fill(nu.energy,weight*oscWeight);
00858     }
00859     if(nu.inu==-14&&nu.charge==-1){
00860       RecoEnergyWSMuonNQ_ND->Fill(nu.energy,weight*oscWeight);
00861     }
00862   }
00863 
00864   if (nu.charge==1 || -1==nu.charge) {
00865     if (nu.detector==Detector::kNear) {
00866       RecoEnergyAll_ND->Fill(nu.energy,weight);
00867     }
00868     else if (nu.detector==Detector::kFar) {
00869       RecoEnergyAll_FD->Fill(nu.energy,weight*oscWeight);
00870     }
00871     else cout<<"ahhhh, det="<<nu.detector<<endl;
00872   }
00873 
00874 
00875     // Do the cut variables...
00876     if (nu.charge == 1) {
00877       if (weight != 0.)
00878         {
00879           //      cout<<"check if weights are correct = "<<weight<<endl;
00880         }
00881     poKinPQ->Fill(nu.poIDKin,weight);
00882     roIdPQ->Fill(nu.roID,weight);
00883     dpIdPQ->Fill(nu.dpID,weight);
00884     trkLPQ->Fill(nu.trkLength,weight);
00885     relAPQ->Fill(abs(nu.relativeAngle-TMath::Pi()),weight);
00886     relAPQ1->Fill(nu.relativeAngle,weight);
00887     relAngVsTrkEndX->Fill(nu.xTrkEnd,abs(nu.relativeAngle-TMath::Pi()),weight);
00888     relAngVsTrkEndY->Fill(nu.yTrkEnd,abs(nu.relativeAngle-TMath::Pi()),weight);
00889     relAngVsTrkEndZ->Fill(nu.zTrkEnd,abs(nu.relativeAngle-TMath::Pi()),weight);
00890     qp_sigmaqpPQ->Fill(1./nu.sigqp_qp,weight);
00891     majCPQ->Fill(nu.smoothMajC,weight);
00892     probPQ->Fill(nu.prob,weight);
00893   }
00894 }

void NuHistos::FillMatrixMethodNCHistos ( const NuEvent nu,
const NuBinningScheme::NuBinningScheme_t  binningScheme = NuBinningScheme::kUnknown 
) const

Definition at line 899 of file NuHistos.cxx.

References det, NuEvent::detector, NuEvent::energyNC, NuEvent::iaction, NuEvent::inu, ENCTruth::kCCe, ENCTruth::kCCmu, ENCTruth::kCCmubar, ENCTruth::kCCtau, ENCTruth::kCCtaubar, Detector::kFar, Msg::kInfo, SimFlag::kMC, OscFit::kNC, ENCTruth::kNCbar, Detector::kNear, ENCTruth::kNumTruths, MAXMSG, MSG, NuEvent::neuEnMC, NuUtilities::RecoBins(), NuEvent::rw, NuEvent::simFlag, NuUtilities::TrueBins(), and ENCTruth::truthNames.

Referenced by NuDSTAna::MMRereco(), and NuDSTAna::MMTransSME().

00902 {
00903   MAXMSG("NuHistos",Msg::kInfo,1)
00904     <<"Running FillMatrixMethodNCHistos..."<<endl;
00905 
00906   //DATA histos (NCs)
00907   static TH1D* recoEnergy_ND_NC = 0;
00908   static TH1D* recoEnergy_FD_NC = 0;
00909   static TH2D* recoVsTrueEnergy_ND_NC = 0;
00910   static TH2D* recoVsTrueEnergy_FD_NC = 0;
00911 
00912   static TH2D* recoVsTrueEnergy_truly[kNumTruths][2] = {{0,},}; // ND, FD
00913 
00914   if(!recoEnergy_ND_NC){ // If not initialized
00915     MSG("NuHistos",Msg::kInfo)
00916       <<"Creating histograms on first run of FillMatrixMethodNCHistos..."
00917       <<" gDirectory gives:"<<endl;
00918           gDirectory->Print();
00919 
00920     const NuUtilities cuts;
00921     const vector<Double_t> recoBins = cuts.RecoBins(binningScheme);
00922     const Int_t numRecoBins = recoBins.size()-1;
00923     const Double_t* recoBinsArray = &recoBins[0];
00924 
00925     const vector<Double_t> trueBins = cuts.TrueBins(binningScheme);
00926     const Int_t numTrueBins = trueBins.size()-1;
00927     const Double_t* trueBinsArray = &trueBins[0];
00928 
00929     recoEnergy_ND_NC=new TH1D
00930       ("RecoEnergy_ND_NC","Reconstructed NC Energy - Data (NearDet)",
00931        numRecoBins, recoBinsArray);
00932     recoEnergy_FD_NC=new TH1D
00933       ("RecoEnergy_FD_NC","Reconstructed NC Energy - Data (FarDet)",
00934        numRecoBins, recoBinsArray);
00935 
00936     recoVsTrueEnergy_ND_NC=new TH2D
00937       ("RecoVsTrueEnergy_ND_NC",
00938        "Reco Vs True Energy (NearDet);True neutrino energy;Reconstructed energy",
00939        numTrueBins, trueBinsArray,
00940        numRecoBins, recoBinsArray);
00941     recoVsTrueEnergy_ND_NC->Sumw2();
00942 
00943     recoVsTrueEnergy_FD_NC=new TH2D
00944       ("RecoVsTrueEnergy_FD_NC",
00945        "Reco Vs True Energy (FarDet);True neutrino energy;Reconstructed energy",
00946        numTrueBins, trueBinsArray,
00947        numRecoBins, recoBinsArray);
00948     recoVsTrueEnergy_FD_NC->Sumw2();
00949 
00950     for(int truth = 0; truth < kNumTruths; ++truth){
00951       recoVsTrueEnergy_truly[truth][0] =
00952         new TH2D("RecoVsTrueEnergy_truly"+truthNames[truth]+"_ND_NC",
00953                  "Reco Vs True Energy (NearDet);"
00954                  "True neutrino energy;Reconstructed energy",
00955                  numTrueBins, trueBinsArray, numRecoBins, recoBinsArray);
00956 
00957       recoVsTrueEnergy_truly[truth][1] =
00958         new TH2D("RecoVsTrueEnergy_truly"+truthNames[truth]+"_FD_NC",
00959                  "Reco Vs True Energy (FarDet);"
00960                  "True neutrino energy; Reconstructed energy",
00961                  numTrueBins, trueBinsArray, numRecoBins, recoBinsArray);
00962     } // end for truth
00963   } // end if not initialized
00964 
00965   assert(nu.detector == Detector::kNear || nu.detector == Detector::kFar);
00966   const int det = int(nu.detector == Detector::kFar);
00967 
00968   if(nu.simFlag == SimFlag::kMC){
00969     ENCTruth_t truth = kNumTruths;
00970     if(abs(nu.inu) == 12 && nu.iaction == 1) truth = kCCe;
00971     if(nu.inu == +14 && nu.iaction == 1) truth = kCCmu;
00972     if(nu.inu == -14 && nu.iaction == 1) truth = kCCmubar;
00973     if(nu.inu == +16 && nu.iaction == 1) truth = kCCtau;
00974     if(nu.inu == -16 && nu.iaction == 1) truth = kCCtaubar;
00975     if(nu.inu > 0    && nu.iaction == 0) truth = kNC;
00976     if(nu.inu < 0    && nu.iaction == 0) truth = kNCbar;
00977     assert(truth != kNumTruths);
00978 
00979     recoVsTrueEnergy_truly[truth][det]->Fill(fabs(nu.neuEnMC), nu.energyNC, nu.rw);
00980   } // end if MC
00981 
00982   switch(nu.detector){
00983   case Detector::kNear:
00984     recoEnergy_ND_NC->Fill(nu.energyNC, nu.rw);
00985     recoVsTrueEnergy_ND_NC->Fill(fabs(nu.neuEnMC), nu.energyNC, nu.rw);
00986     break;
00987   case Detector::kFar:
00988     recoEnergy_FD_NC->Fill(nu.energyNC, nu.rw);
00989     recoVsTrueEnergy_FD_NC->Fill(fabs(nu.neuEnMC), nu.energyNC, nu.rw);
00990     break;
00991   default:
00992     cout<<"ahhhh, det="<<nu.detector<<endl;
00993     assert(0 && "bad detector");
00994   }
00995 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1