#include <NueFNHelper.h>
Inheritance diagram for NueFNHelper:
Public Member Functions | |
NueFNHelper (Int_t nx, Double_t lx, Double_t ux, Int_t ny=0, Double_t ly=0, Double_t uy=0) | |
NueFNHelper (Int_t nx, Double_t *xbins, Int_t ny=0, Double_t *ybins=0) | |
virtual | ~NueFNHelper () |
void | MakeHelpers (Selection::Selection_t) |
void | WriteFile (std::string tag) |
void | AddNueSystematic (NueSystematic *nueSys) |
Private Attributes | |
std::map< NueSystematic *, std::map< Background::Background_t, FNHists * > > | fFarNearEnergyHists |
|
Definition at line 9 of file NueFNHelper.cxx.
00010 : 00011 NueExtrapHelper(nx,lx,ux,ny,ly,uy) 00012 { 00013 } |
|
Definition at line 15 of file NueFNHelper.cxx.
00016 : 00017 NueExtrapHelper(nx,x,ny,y) 00018 { 00019 } |
|
Definition at line 21 of file NueFNHelper.cxx.
00022 { 00023 } |
|
Reimplemented from NueExtrapHelper. Definition at line 25 of file NueFNHelper.cxx. References AsString(), Background::EBackground, FNHists::fDirectory, fFarNearEnergyHists, FNHists::fFD_RecoEnergy, FNHists::fFD_TrueEnergy, FNHists::fND_RecoEnergy, FNHists::fND_TrueEnergy, and NueSystematic::GetName().
00026 { 00027 fFarNearEnergyHists[nueSys]; 00028 Int_t max_bg_index = 0; 00029 while(strcmp(Background:: 00030 AsString(Background::EBackground(max_bg_index)), 00031 "?Unknown?")!=0) { 00032 gDirectory->cd("/"); 00033 string fnh_name = string(Background:: 00034 AsString(Background::EBackground(max_bg_index))); 00035 fnh_name += "_" + string(nueSys->GetName()); 00036 FNHists *fnh = new FNHists(fnh_name.c_str()); 00037 fnh->fDirectory->cd(); 00038 fnh->fND_RecoEnergy = new TH1D("ND_RecoEnergy","ND Reco Energy",fNXBins,fXBins); 00039 fnh->fND_RecoEnergy->Sumw2(); 00040 fnh->fFD_RecoEnergy = new TH1D("FD_RecoEnergy","FD Reco Energy",fNXBins,fXBins); 00041 fnh->fFD_RecoEnergy->Sumw2(); 00042 fnh->fND_TrueEnergy = new TH1D("ND_TrueEnergy","ND True Energy",fNXBins,fXBins); 00043 fnh->fND_TrueEnergy->Sumw2(); 00044 fnh->fFD_TrueEnergy = new TH1D("FD_TrueEnergy","FD True Energy",fNXBins,fXBins); 00045 fnh->fFD_TrueEnergy->Sumw2(); 00046 (fFarNearEnergyHists[nueSys])[Background::EBackground(max_bg_index)] = fnh; 00047 max_bg_index++; 00048 } 00049 gDirectory->cd("/"); 00050 } |
|
Reimplemented from NueExtrapHelper. Definition at line 52 of file NueFNHelper.cxx. References Background::Background_t, fFarNearEnergyHists, NueRecord::fluxinfo, NueExtrapHelper::GetNueEnergy(), ANtpTruthInfo::interactionType, NueRecord::mctrue, ANtpTruthInfoBeam::nonOscNuFlavor, ANtpTruthInfo::nuEnergy, ANtpTruthInfo::nuFlavor, NueExtrapHelper::PassCuts(), NtpMCFluxInfo::ptype, Selection::Selection_t, NtpMCFluxInfo::tptype, and Background::TranslateFromMC().
00053 { 00054 if(!fFarChain && !fNearChain) return; 00055 fCurSel = sel; 00056 std::map<NueSystematic*, 00057 std::map<Background::Background_t,FNHists*> >::iterator mapBeg = 00058 fFarNearEnergyHists.begin(); 00059 std::map<NueSystematic*, 00060 std::map<Background::Background_t,FNHists*> >::iterator mapEnd = 00061 fFarNearEnergyHists.end(); 00062 //near: 00063 Int_t nEntries = fNearChain->GetEntries(); 00064 for(int i=0;i<nEntries;i++){ 00065 if(i%10000==0) std::cout << "Processed " 00066 << 100*Float_t(i)/Float_t(nEntries) 00067 << "% of Near" << std::endl; 00068 mapBeg = fFarNearEnergyHists.begin(); 00069 while(mapBeg!=mapEnd) { 00070 fNearChain->GetEntry(i); 00071 Double_t totWeight = 1; 00072 if((mapBeg->first)) totWeight = (mapBeg->first)->UpdateRecord(fRecord,sel); 00073 if(this->PassCuts(sel)) { 00074 Double_t recoEnergy = this->GetNueEnergy(sel); 00075 Background::Background_t bg = 00076 Background::TranslateFromMC(fRecord->mctrue.interactionType, 00077 fRecord->mctrue.nuFlavor, 00078 fRecord->mctrue.nonOscNuFlavor, 00079 fRecord->fluxinfo.tptype); 00080 (mapBeg->second)[bg]->fND_RecoEnergy->Fill(recoEnergy,totWeight); 00081 (mapBeg->second)[bg]->fND_TrueEnergy->Fill(fRecord->mctrue.nuEnergy,totWeight); 00082 Background::Background_t bg2 = 00083 Background::TranslateFromMC(fRecord->mctrue.interactionType, 00084 fRecord->mctrue.nuFlavor, 00085 fRecord->mctrue.nonOscNuFlavor); 00086 if(bg2!=bg) { 00087 (mapBeg->second)[bg2]->fND_RecoEnergy->Fill(recoEnergy,totWeight); 00088 (mapBeg->second)[bg2]->fND_TrueEnergy->Fill(fRecord->mctrue.nuEnergy,totWeight); 00089 } 00090 } 00091 mapBeg++; 00092 } 00093 } 00094 00095 // far: 00096 nEntries = fFarChain->GetEntries(); 00097 for(int i=0;i<nEntries;i++){ 00098 if(i%10000==0) std::cout << "Processed " 00099 << 100*Float_t(i)/Float_t(nEntries) 00100 << "% of Far" << std::endl; 00101 mapBeg = fFarNearEnergyHists.begin(); 00102 while(mapBeg!=mapEnd) { 00103 fFarChain->GetEntry(i); 00104 Double_t totWeight = 1; 00105 if((mapBeg->first)) totWeight = (mapBeg->first)->UpdateRecord(fRecord,sel); 00106 if(this->PassCuts(sel)) { 00107 Double_t recoEnergy = this->GetNueEnergy(sel); 00108 if(TMath::Abs(fRecord->fluxinfo.ptype)==13 && 00109 fRecord->fluxinfo.tptype==0) fRecord->fluxinfo.tptype = 211; 00110 Background::Background_t bg = 00111 Background::TranslateFromMC(fRecord->mctrue.interactionType, 00112 fRecord->mctrue.nuFlavor, 00113 fRecord->mctrue.nonOscNuFlavor, 00114 fRecord->fluxinfo.tptype); 00115 (mapBeg->second)[bg]->fFD_RecoEnergy->Fill(recoEnergy,totWeight); 00116 (mapBeg->second)[bg]->fFD_TrueEnergy->Fill(fRecord->mctrue.nuEnergy,totWeight); 00117 Background::Background_t bg2 = 00118 Background::TranslateFromMC(fRecord->mctrue.interactionType, 00119 fRecord->mctrue.nuFlavor, 00120 fRecord->mctrue.nonOscNuFlavor); 00121 if(bg2!=bg) { 00122 (mapBeg->second)[bg2]->fFD_RecoEnergy->Fill(recoEnergy,totWeight); 00123 (mapBeg->second)[bg2]->fFD_TrueEnergy->Fill(fRecord->mctrue.nuEnergy,totWeight); 00124 } 00125 } 00126 mapBeg++; 00127 } 00128 } 00129 } |
|
Reimplemented from NueExtrapHelper. Definition at line 131 of file NueFNHelper.cxx. References fFarNearEnergyHists.
00132 { 00133 std::map<NueSystematic*, 00134 std::map<Background::Background_t,FNHists*> >::iterator mapBeg = 00135 fFarNearEnergyHists.begin(); 00136 std::map<NueSystematic*, 00137 std::map<Background::Background_t,FNHists*> >::iterator mapEnd = 00138 fFarNearEnergyHists.end(); 00139 if(mapBeg==mapEnd) return; 00140 00141 std::string filename = "EnergySpectraHelper_" + tag + ".root"; 00142 TFile *file = new TFile(filename.c_str(),"RECREATE"); 00143 file->cd(); 00144 00145 char selection[256]; 00146 sprintf(selection,"%s",Selection::AsString(fCurSel)); 00147 TTree *tree = new TTree("energytree","energytree"); 00148 tree->Branch("Selection",selection,"Selection/C"); 00149 tree->Branch("nearPOT",&fNearPOT,"nearPOT/D"); 00150 tree->Branch("farPOT",&fFarPOT,"farPOT/D"); 00151 00152 while(mapBeg!=mapEnd){ 00153 std::map<Background::Background_t,FNHists*>::iterator FNbeg = (mapBeg->second).begin(); 00154 std::map<Background::Background_t,FNHists*>::iterator FNend = (mapBeg->second).end(); 00155 while(FNbeg!=FNend) { 00156 TDirectory *filedir = file->mkdir(FNbeg->second->fDirectory->GetName()); 00157 filedir->cd(); 00158 TList *list = FNbeg->second->fDirectory->GetList(); 00159 TIter iter(list->MakeIterator()); 00160 TObject *ob = 0; 00161 while((ob = iter())) ob->Write(); 00162 file->cd(); 00163 FNbeg++; 00164 } 00165 if((mapBeg->first)) (mapBeg->first)->MakeBranches(tree); 00166 tree->Fill(); 00167 mapBeg++; 00168 } 00169 00170 tree->Write(); 00171 delete file; 00172 } |
|
Definition at line 33 of file NueFNHelper.h. Referenced by AddNueSystematic(), MakeHelpers(), and WriteFile(). |