NueFNExtrapolation Class Reference

#include <NueFNExtrapolation.h>

Inheritance diagram for NueFNExtrapolation:
NueExtrapolation

List of all members.

Public Member Functions

 NueFNExtrapolation ()
 NueFNExtrapolation (std::string)
virtual ~NueFNExtrapolation ()
void UseTreeEntry (Int_t treeEntry=0)
Int_t GetMaxTreeEntry ()
TH1 * GetRatio (string)
NueSystematicGetCurrentSystematic ()

Protected Member Functions

TH1 * Extrapolate (const char *, Bool_t)

Private Attributes

TH1D * fHelperRatio
TTree * fHelperTree
Int_t fTreeEntry

Detailed Description

Definition at line 13 of file NueFNExtrapolation.h.


Constructor & Destructor Documentation

NueFNExtrapolation::NueFNExtrapolation (  ) 

Definition at line 9 of file NueFNExtrapolation.cxx.

References NueExtrapolation::fExtrapMethod, and Extrapolation::kFN.

00009                                        :
00010   NueExtrapolation(),
00011   fHelperRatio(0),fTreeEntry(-1)
00012 {
00013   fExtrapMethod = Extrapolation::kFN;
00014 }

NueFNExtrapolation::NueFNExtrapolation ( std::string  name  ) 

Definition at line 16 of file NueFNExtrapolation.cxx.

References NueExtrapolation::fExtrapMethod, NueExtrapolation::fHelperFile, fHelperTree, Extrapolation::kFN, and NueExtrapolation::SetHelperFile().

00016                                                      :
00017   NueExtrapolation(),
00018   fHelperRatio(0),fTreeEntry(-1)
00019 {
00020   fExtrapMethod = Extrapolation::kFN;
00021   this->SetHelperFile(name);
00022   fHelperTree = (TTree*) fHelperFile->Get("energytree");  
00023 }

NueFNExtrapolation::~NueFNExtrapolation (  )  [virtual]

Definition at line 25 of file NueFNExtrapolation.cxx.

References NueExtrapolation::fHelperFile, and fHelperRatio.

00026 {
00027   if(fHelperRatio) delete fHelperRatio;
00028   if(fHelperFile) fHelperFile->Close();
00029 }


Member Function Documentation

TH1 * NueFNExtrapolation::Extrapolate ( const char *  histName,
Bool_t  extrapNtoF 
) [protected, virtual]

Reimplemented from NueExtrapolation.

Definition at line 31 of file NueFNExtrapolation.cxx.

References NueExtrapolation::fBg, NueExtrapolation::fHelperFile, fHelperRatio, NueBackground::GetHist(), and GetRatio().

00032 {
00033   if(!fHelperFile) return NULL;
00034   //get appropriate F/N ratio histogram:
00035   this->GetRatio("RecoEnergy");
00036 
00037   //get background histogram
00038   TH1D* extrapHist = NULL;
00039   if(fBg->GetHist()->InheritsFrom("TH2")){
00040     TH2* hist = (TH2*) fBg->GetHist();
00041     extrapHist = (TH1D*) hist->ProjectionX(histName);
00042   }
00043   else extrapHist = (TH1D*) fBg->GetHist()->Clone(histName);  
00044 
00045   //apply ratio:
00046   for(int i=0;i<extrapHist->GetNbinsX()+1;i++){
00047     Double_t ratio = fHelperRatio->GetBinContent(i);
00048     if(!extrapNtoF && ratio!=0) ratio = 1/ratio;
00049     extrapHist->SetBinContent(i,extrapHist->GetBinContent(i)*ratio);
00050     extrapHist->SetBinError(i,extrapHist->GetBinError(i)*ratio);
00051   }
00052   return extrapHist;
00053 }

NueSystematic * NueFNExtrapolation::GetCurrentSystematic (  ) 

Definition at line 55 of file NueFNExtrapolation.cxx.

References NueSystematic::AddSystematic(), Systematic::AsString(), NueExtrapolation::fHelperFile, fHelperTree, fTreeEntry, and NueSystematic::SetOscParams().

Referenced by Comparator::GetPredictions().

00056 {
00057   if(!fHelperFile || !fHelperTree) return NULL;
00058   if(fTreeEntry==-1) return NULL;
00059   fHelperTree->ResetBranchAddresses();
00060 
00061   char sysname[256] = "";
00062   //Double_t beamWeightPars[6] = {};
00063 //  Double_t hadProdPars[7] = {};
00064   Double_t theta12=0,theta23=0,theta13=0;
00065   Double_t deltaMSq23=0,deltaMSq12=0;
00066   Double_t deltaCP=0;Int_t massHierarchy=0;
00067   fHelperTree->SetBranchAddress("SysName",sysname);
00068   fHelperTree->SetBranchAddress("Theta12",&theta12);
00069   fHelperTree->SetBranchAddress("Theta23",&theta23);
00070   fHelperTree->SetBranchAddress("Theta13",&theta13);
00071   fHelperTree->SetBranchAddress("DeltaMSq23",&deltaMSq23);
00072   fHelperTree->SetBranchAddress("DeltaMSq12",&deltaMSq12);
00073   fHelperTree->SetBranchAddress("DeltaCP",&deltaCP);
00074   fHelperTree->SetBranchAddress("MassHierarchy",&massHierarchy);
00075   fHelperTree->GetEntry(fTreeEntry);
00076 
00077   NueSystematic *nueSys = new NueSystematic(string(sysname));
00078 //  nueSys->SetSKZPParams(beamWeightPars,hadProdPars);
00079   nueSys->SetOscParams(theta12,theta23,theta13,deltaMSq12,
00080                        deltaMSq23,deltaCP,massHierarchy);
00081   
00082   Int_t max_sys_index = 0;
00083   while(strcmp(Systematic::AsString(Systematic::ESystematic(max_sys_index)),
00084                "?Unknown?")!=0) {
00085     fHelperTree->ResetBranchAddresses();
00086     Double_t tempDouble = 0;
00087     fHelperTree->SetBranchAddress(Systematic::AsString(Systematic::ESystematic(max_sys_index)),
00088                                   &tempDouble);
00089     fHelperTree->GetEntry(fTreeEntry);
00090     if(tempDouble>-9998) {
00091       nueSys->AddSystematic(Systematic::ESystematic(max_sys_index),tempDouble);
00092     }
00093     max_sys_index++;
00094   }
00095   return nueSys;
00096 }

Int_t NueFNExtrapolation::GetMaxTreeEntry (  )  [inline]

Definition at line 22 of file NueFNExtrapolation.h.

References fHelperTree.

Referenced by Comparator::GetPredictions().

00022 {if(fHelperTree) return fHelperTree->GetEntries(); return 0;}

TH1 * NueFNExtrapolation::GetRatio ( string  distname  ) 

Definition at line 98 of file NueFNExtrapolation.cxx.

References Background::AsString(), NueExtrapolation::fBg, NueExtrapolation::fHelperFile, fHelperRatio, fHelperTree, fTreeEntry, NueBackground::GetBackground(), Background::kNueCC, Background::kNuMuCC, and Background::kNuTauCC.

Referenced by Extrapolate().

00099 {
00100   if(!fBg) return NULL;
00101   if(!fHelperFile) return NULL;
00102   if(fHelperRatio) {delete fHelperRatio; fHelperRatio = NULL;}
00103 
00104   fHelperTree->ResetBranchAddresses();
00105   Double_t nearPOT  = 0;  fHelperTree->SetBranchAddress("nearPOT",&nearPOT);
00106   Double_t farPOT   = 0;  fHelperTree->SetBranchAddress("farPOT",&farPOT);
00107   char sysname[256] = ""; fHelperTree->SetBranchAddress("SysName",sysname);
00108   fHelperTree->GetEntry(fTreeEntry);
00109   //nearPOT = 2982*400*2.568e13;  
00110   //farPOT  = 990.*1.02716e20/3.;
00111 
00112   char fddir[256] = "";
00113   sprintf(fddir,"%s_%s/FD_%s",Background::AsString(fBg->GetBackground()),
00114           sysname,distname.c_str());
00115   char nddir[256] = "";
00116   if(fBg->GetBackground()==Background::kNuTauCC || 
00117      fBg->GetBackground()==Background::kNueCC) {
00118     //these are appearances in FD, so cannot construct F/N ratio directly
00119     //instead assume that ND numuCC spectrum must have been passed if this
00120     //extrapolation method was chosen and so construct ratio using ND numuCC
00121     //as denominator
00122     sprintf(nddir,"%s_%s/ND_%s",Background::AsString(Background::kNuMuCC),
00123             sysname,distname.c_str());
00124   }
00125   else sprintf(nddir,"%s_%s/ND_%s",Background::AsString(fBg->GetBackground()),
00126                sysname,distname.c_str());
00127 
00128   TH1 *helperHistFD = (TH1*) fHelperFile->Get(fddir);    
00129   TH1 *helperHistND = (TH1*) fHelperFile->Get(nddir);    
00130   fHelperRatio = (TH1D*) helperHistFD->Clone("helperRatio");
00131   fHelperRatio->SetDirectory(0);
00132   fHelperRatio->Divide(helperHistND);
00133   if(nearPOT!=0) fHelperRatio->Scale(nearPOT/farPOT);
00134   return (TH1*) fHelperRatio;
00135 }

void NueFNExtrapolation::UseTreeEntry ( Int_t  treeEntry = 0  )  [inline]

Definition at line 21 of file NueFNExtrapolation.h.

References fTreeEntry.

Referenced by Comparator::GetPredictions().

00021 {fTreeEntry = treeEntry;}


Member Data Documentation

Definition at line 32 of file NueFNExtrapolation.h.

Referenced by Extrapolate(), GetRatio(), and ~NueFNExtrapolation().

Definition at line 34 of file NueFNExtrapolation.h.

Referenced by GetCurrentSystematic(), GetRatio(), and UseTreeEntry().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1