NuePrediction Class Reference

#include <NuePrediction.h>

List of all members.

Public Member Functions

 NuePrediction ()
 ~NuePrediction ()
Bool_t AddExtrapolation (NueExtrapolation *, Extrapolation::Extrapolation_t)
Bool_t AddBackground (NueBackground *, Extrapolation::Extrapolation_t)
TH1D * GetPrediction (Detector::Detector_t, Double_t)
void Clear ()
void ClearPred ()
void ClearExtrap ()
void Draw ()

Private Attributes

TH1D * fFinalPred
std::vector< TH1 * > fCurrentPred
std::vector< NueBackground * > fBgVec
std::vector
< Extrapolation::Extrapolation_t
fExtrapVec
std::map
< Extrapolation::Extrapolation_t,
NueExtrapolation * > 
fExtrapMap

Detailed Description

Definition at line 9 of file NuePrediction.h.


Constructor & Destructor Documentation

NuePrediction::NuePrediction (  ) 

Definition at line 6 of file NuePrediction.cxx.

References fFinalPred.

00007 {
00008   fFinalPred = NULL;
00009 }

NuePrediction::~NuePrediction (  ) 

Definition at line 11 of file NuePrediction.cxx.

References Clear(), and fExtrapMap.

00012 {
00013   this->Clear();
00014   fExtrapMap.clear();
00015 }


Member Function Documentation

Bool_t NuePrediction::AddBackground ( NueBackground bg,
Extrapolation::Extrapolation_t  extrap 
)

Definition at line 49 of file NuePrediction.cxx.

References fBgVec, and fExtrapVec.

00051 {
00052   fBgVec.push_back(bg);
00053   fExtrapVec.push_back(extrap);
00054   return true;
00055 }

Bool_t NuePrediction::AddExtrapolation ( NueExtrapolation ex,
Extrapolation::Extrapolation_t  extrap 
)

Definition at line 42 of file NuePrediction.cxx.

References fExtrapMap.

00044 {
00045   fExtrapMap[extrap] = ex;
00046   return true;
00047 }

void NuePrediction::Clear ( void   ) 

Definition at line 22 of file NuePrediction.cxx.

References ClearPred(), fBgVec, and fExtrapVec.

Referenced by ~NuePrediction().

00023 {
00024   fBgVec.clear();
00025   fExtrapVec.clear();
00026   this->ClearPred();
00027 }

void NuePrediction::ClearExtrap (  ) 

Definition at line 17 of file NuePrediction.cxx.

References fExtrapMap.

00018 {
00019   fExtrapMap.clear();
00020 }

void NuePrediction::ClearPred (  ) 

Definition at line 29 of file NuePrediction.cxx.

References fCurrentPred, and fFinalPred.

Referenced by Clear(), and GetPrediction().

00030 {
00031   delete fFinalPred;
00032   fFinalPred = NULL;
00033   std::vector<TH1*>::iterator beg = fCurrentPred.begin();
00034   std::vector<TH1*>::iterator end = fCurrentPred.end();
00035   while(beg!=end) {
00036     delete (*beg);
00037     beg++;
00038   }
00039   fCurrentPred.clear();
00040 }

void NuePrediction::Draw (  ) 

Definition at line 104 of file NuePrediction.cxx.

References bfld::AsString(), Background::AsString(), fBgVec, fCurrentPred, fExtrapVec, and fFinalPred.

00105 {
00106   if(!fFinalPred) return;
00107 
00108   fFinalPred->Draw("e");
00109   Int_t col = 2;
00110 
00111   TLegend *leg = new TLegend(0.2,0.2,0.4,0.4);
00112   leg->AddEntry(fFinalPred,"Total Prediction","lp");
00113   char legname[256];
00114 
00115   std::vector<TH1*>::iterator beg = fCurrentPred.begin();
00116   std::vector<TH1*>::iterator end = fCurrentPred.end();
00117   std::vector<NueBackground*>::iterator bgBeg = fBgVec.begin();
00118   std::vector<NueBackground*>::iterator bgEnd = fBgVec.end();
00119   std::vector<Extrapolation::Extrapolation_t>::iterator extrapBeg = fExtrapVec.begin();
00120   std::vector<Extrapolation::Extrapolation_t>::iterator extrapEnd = fExtrapVec.end();
00121 
00122   while(beg!=end && bgBeg!=bgEnd && extrapBeg!=extrapEnd) {
00123     if(col==5) col+=1;
00124     sprintf(legname,"%s_%s",
00125             Background::AsString(Background::
00126                                  EBackground((*bgBeg)->GetBackground())),
00127             Extrapolation::AsString(Extrapolation::
00128                                     EExtrapolation((*extrapBeg))));
00129     if((*beg)->InheritsFrom("TH2")) {
00130       TH2* hist = (TH2*) (*beg);
00131       TH1D *proj = hist->ProjectionX();
00132       proj->SetLineColor(col);
00133       proj->Draw("histsames");
00134       leg->AddEntry(proj,legname,"l");
00135     }
00136     else {
00137       (*beg)->SetLineColor(col);
00138       (*beg)->Draw("histsames");
00139       leg->AddEntry((*beg),legname,"l");
00140     }
00141 
00142     beg++;
00143     bgBeg++;
00144     extrapBeg++;
00145     col++;
00146   }
00147   leg->SetBorderSize(1);
00148   leg->Draw();
00149 }

TH1D * NuePrediction::GetPrediction ( Detector::Detector_t  det,
Double_t  pot 
)

Definition at line 57 of file NuePrediction.cxx.

References Selection::AsString(), Detector::AsString(), ClearPred(), MuELoss::e, fBgVec, fCurrentPred, fExtrapMap, fExtrapVec, and fFinalPred.

00058 {
00059   if(fBgVec.begin()==fBgVec.end()) {
00060     return NULL;
00061     std::cerr << "No NueBackground objects added!" << std::endl;
00062   }
00063   std::vector<NueBackground*>::iterator bgBeg = fBgVec.begin();
00064   std::vector<NueBackground*>::iterator bgEnd = fBgVec.end();
00065   std::vector<Extrapolation::Extrapolation_t>::iterator extrapBeg = fExtrapVec.begin();
00066   std::vector<Extrapolation::Extrapolation_t>::iterator extrapEnd = fExtrapVec.end();
00067   
00068   this->ClearPred();
00069   while(bgBeg!=bgEnd && extrapBeg!=extrapEnd){
00070     fCurrentPred.push_back(fExtrapMap[(*extrapBeg)]->GetSpectrum(det,pot,(*bgBeg)) );
00071     bgBeg++;
00072     extrapBeg++;
00073   }
00074   char name[256];
00075   sprintf(name,"%s_Prediction_%s_%.2f#times10^{20}POT",
00076           Detector::AsString(Detector::EDetector(det)),
00077           Selection::AsString(Selection::ESelection(fBgVec[0]->GetSelection())),
00078           pot*1e-20);
00079   fFinalPred = new TH1D(name,name,
00080                         fCurrentPred[0]->GetNbinsX(),
00081                         fCurrentPred[0]->GetBinLowEdge(1),
00082                         fCurrentPred[0]->GetBinLowEdge(fCurrentPred[0]->
00083                                                        GetNbinsX()+1));
00084   fFinalPred->Sumw2();
00085 
00086   std::vector<TH1*>::iterator beg = fCurrentPred.begin();
00087   std::vector<TH1*>::iterator end = fCurrentPred.end();
00088   while(beg!=end) {
00089     //determine what type of histogram this is:
00090     if((*beg)->InheritsFrom("TH2")) {
00091       TH2 *hist = (TH2*) (*beg);
00092       TH1D *proj = hist->ProjectionX();
00093       fFinalPred->Add(proj);
00094     }
00095     else {
00096       TH1D *spec = (TH1D*) (*beg);
00097       fFinalPred->Add(spec);
00098     }
00099     beg++;
00100   }
00101   return fFinalPred;
00102 }


Member Data Documentation

std::vector<NueBackground*> NuePrediction::fBgVec [private]

Definition at line 28 of file NuePrediction.h.

Referenced by AddBackground(), Clear(), Draw(), and GetPrediction().

std::vector<TH1*> NuePrediction::fCurrentPred [private]

Definition at line 27 of file NuePrediction.h.

Referenced by ClearPred(), Draw(), and GetPrediction().

Definition at line 30 of file NuePrediction.h.

Referenced by AddExtrapolation(), ClearExtrap(), GetPrediction(), and ~NuePrediction().

Definition at line 29 of file NuePrediction.h.

Referenced by AddBackground(), Clear(), Draw(), and GetPrediction().

TH1D* NuePrediction::fFinalPred [private]

Definition at line 26 of file NuePrediction.h.

Referenced by ClearPred(), Draw(), GetPrediction(), and NuePrediction().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1