Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SysFileGen Class Reference

#include <SysFileGen.h>

Inheritance diagram for SysFileGen:

NueExtrapHelper List of all members.

Public Member Functions

 SysFileGen ()
virtual ~SysFileGen ()
void Reset ()
void Initialize ()
void AddSystematic (string sys)
void PrepareExtrapHistograms (Selection::Selection_t)
TH1 * GetPrediction (Background::Background_t bg)
void RunSystematicStudy (Selection::Selection_t sel)
void SetOutputFile (string name)
void WriteToFile (Selection::Selection_t sel)
void SetNearPOT (double pot)
void SetFarPOT (double pot)
void SetNueRecoBins (int, double, double)
void SetNueRecoBins (int, double *)
void SetTrueBins (int, double, double)
void SetTrueBins (int, double *)
void InitializeSysHists (SysHists *one)
void SetDataFileName (string name)
void SetOscParams (Double_t theta12, Double_t theta23, Double_t theta13, Double_t deltam12, Double_t deltam23, Double_t deltaCP, Int_t massH)

Private Member Functions

void ResetHistograms ()
void InitializeHistograms ()
void PrepareHistograms (Selection::Selection_t sel)
void FillSysHistograms ()

Private Attributes

vector< string > fSystematics
string fCurrentSys
std::map< Background::Background_t,
SysHists * > 
fHistMap
std::string outFileName
double fTargetPOT
Double_t fTheta12
Double_t fTheta23
Double_t fTheta13
Double_t fDeltaMSq23
Double_t fDeltaMSq12
Double_t fDeltaCP
Double_t fMassHierarchy

Constructor & Destructor Documentation

SysFileGen::SysFileGen  ) 
 

Definition at line 13 of file SysFileGen.cxx.

References fTargetPOT, and outFileName.

00014 {
00015    outFileName = "DefaultOut.root";
00016    fTargetPOT = 3.25e20;
00017    fNearPOT = 0.0;
00018    fFarPOT = 0.0;
00019 }

virtual SysFileGen::~SysFileGen  )  [inline, virtual]
 

Definition at line 15 of file SysFileGen.h.

00015 {};


Member Function Documentation

void SysFileGen::AddSystematic string  sys  )  [inline]
 

Definition at line 20 of file SysFileGen.h.

References fSystematics.

00020 { fSystematics.push_back(sys);};

void SysFileGen::FillSysHistograms  )  [private]
 

Definition at line 82 of file SysFileGen.cxx.

References fHistMap.

Referenced by RunSystematicStudy().

00083 {
00084   std::map<Background::Background_t,SysHists*>::iterator mapBeg = fHistMap.begin();
00085   std::map<Background::Background_t,SysHists*>::iterator mapEnd = fHistMap.end();
00086 
00087   //Now looping over each background assign in the appropriate histograms
00088 
00089   while(mapBeg != mapEnd){
00090     //     SysHists* local = mapBeg->second;
00091 
00092      // Now here is one of the tricky parts
00093      // If you are going to overwrite local make sure you are using the same bins
00094      //*************************************************
00095 
00096 
00097      // Do whatever you have to do
00098  
00099 
00100      //***************************************************
00101 
00102 
00103      mapBeg++;
00104   }    
00105 }

TH1* SysFileGen::GetPrediction Background::Background_t  bg  ) 
 

void SysFileGen::Initialize  ) 
 

Definition at line 37 of file SysFileGen.cxx.

References NueExtrapHelper::Init().

00038 {
00039    this->Init();
00040 }

void SysFileGen::InitializeHistograms  )  [private]
 

Definition at line 165 of file SysFileGen.cxx.

References fHistMap, and InitializeSysHists().

Referenced by ResetHistograms().

00166 {
00167 
00168   vector<Background::Background_t> bgs;
00169   bgs.push_back(Background::kNC);
00170   bgs.push_back(Background::kNuMuCC);
00171   bgs.push_back(Background::kNuTauCC);
00172   bgs.push_back(Background::kNueCC);
00173   bgs.push_back(Background::kBNueCC);
00174   bgs.push_back(Background::kSelCC);
00175 
00176   for(unsigned int i = 0; i < bgs.size(); i++){
00177     gDirectory->cd("/");
00178     string fnh_name = string(Background::AsString(bgs[i]));
00179     SysHists *fnh = new SysHists(fnh_name.c_str());
00180 
00181     InitializeSysHists(fnh);
00182  
00183     (fHistMap)[bgs[i]] = fnh;
00184   }
00185 }

void SysFileGen::InitializeSysHists SysHists one  ) 
 

Definition at line 188 of file SysFileGen.cxx.

References SysHists::fDirectory, SysHists::fFD_RecoEnergy, SysHists::fFD_RecoVsTrue, SysHists::fND_RecoEnergy, and SysHists::fND_RecoVsTrue.

Referenced by InitializeHistograms().

00189 {
00190    gDirectory->cd("/"); 
00191   
00192    int nRecoBins = fNXBins; 
00193    Double_t* RecoBins = fXBins; 
00194  
00195    one->fDirectory->cd(); 
00196    one->fND_RecoEnergy = new TH1D("ND_RecoEnergy","ND Reco Energy",nRecoBins, RecoBins);
00197    one->fND_RecoEnergy->Sumw2(); 
00198    one->fFD_RecoEnergy = new TH1D("FD_RecoEnergy","FD Reco Energy",nRecoBins, RecoBins);
00199    one->fFD_RecoEnergy->Sumw2(); 
00200 
00201    one->fND_RecoVsTrue = new TH2D("ND_RecoVsTrue", "ND Reco v True E", nRecoBins, RecoBins,
00202                                        fNYBins, fYBins); 
00203    one->fND_RecoVsTrue->Sumw2();  
00204  
00205    one->fFD_RecoVsTrue = new TH2D("FD_RecoVsTrue", "FD Reco v True E", nRecoBins, RecoBins,
00206                                        fNYBins, fYBins); 
00207    one->fFD_RecoVsTrue->Sumw2(); 
00208 } 

void SysFileGen::PrepareExtrapHistograms Selection::Selection_t   ) 
 

void SysFileGen::PrepareHistograms Selection::Selection_t  sel  )  [private]
 

Definition at line 72 of file SysFileGen.cxx.

References Selection::Selection_t.

Referenced by RunSystematicStudy().

00073 {
00074    //This is a function entirely up the the systematic so you need to fill this yourself 
00075    // build whatever histograms you're heart desires - 
00076    //   should not impact any of the default data structures
00077  
00078  
00079    return;
00080 }

void SysFileGen::Reset  )  [inline]
 

Definition at line 17 of file SysFileGen.h.

00017 {};

void SysFileGen::ResetHistograms  )  [private]
 

Definition at line 211 of file SysFileGen.cxx.

References SysHists::fDirectory, SysHists::fFD_RecoEnergy, SysHists::fFD_RecoVsTrue, fHistMap, SysHists::fND_RecoEnergy, SysHists::fND_RecoVsTrue, and InitializeHistograms().

Referenced by RunSystematicStudy().

00212 {
00213 
00214   if(fHistMap.size() == 0) InitializeHistograms();
00215 
00216    //Really I should change this to iterate over the fHistMap
00217 
00218   std::map<Background::Background_t, SysHists*>::iterator first = fHistMap.begin();
00219   std::map<Background::Background_t, SysHists*>::iterator last  = fHistMap.end();
00220 
00221   while(first != last)
00222   {
00223     //Background::Background_t bg = first->first;
00224     SysHists* fnh = first->second;
00225 
00226     fnh->fDirectory->cd();
00227     fnh->fND_RecoEnergy->Reset("ICE");
00228     fnh->fFD_RecoEnergy->Reset("ICE");
00229     fnh->fND_RecoVsTrue->Reset("ICE");
00230     fnh->fFD_RecoVsTrue->Reset("ICE");
00231 
00232     first++;
00233   }
00234 }

void SysFileGen::RunSystematicStudy Selection::Selection_t  sel  ) 
 

Definition at line 51 of file SysFileGen.cxx.

References fCurrentSys, FillSysHistograms(), fSystematics, PrepareHistograms(), ResetHistograms(), Selection::Selection_t, and WriteToFile().

00052 {
00053    //For a given selection (Presel, ANN, MCNN)
00054    // there will be a set of "systematics"
00055    // normal, parameter + 1 sigma, par - 1 sigma
00056    // For each of these build the necessary histograms then write
00057    // them to file
00058 
00059    //Because this is much more arbitrary fSystematics is a vector of strings
00060    // These strings should describe the systematic under consideration
00061 
00062    for(unsigned int j = 0; j < fSystematics.size(); j++){
00063         std::cout<<"systematic "<<j<<endl;
00064         fCurrentSys = fSystematics[j];
00065         PrepareHistograms(sel);
00066         ResetHistograms();  //Clear out whatever happened last time
00067         FillSysHistograms();
00068         WriteToFile(sel);
00069    }
00070 }

void SysFileGen::SetDataFileName string  name  ) 
 

void SysFileGen::SetFarPOT double  pot  )  [inline]
 

Definition at line 30 of file SysFileGen.h.

00030 { fFarPOT = pot;};

void SysFileGen::SetNearPOT double  pot  )  [inline]
 

Definition at line 29 of file SysFileGen.h.

00029 { fNearPOT = pot;};

void SysFileGen::SetNueRecoBins int  ,
double * 
 

void SysFileGen::SetNueRecoBins int  ,
double  ,
double 
 

void SysFileGen::SetOscParams Double_t  theta12,
Double_t  theta23,
Double_t  theta13,
Double_t  deltam12,
Double_t  deltam23,
Double_t  deltaCP,
Int_t  massH
 

Definition at line 42 of file SysFileGen.cxx.

References fDeltaCP, fDeltaMSq12, fDeltaMSq23, fMassHierarchy, fTheta12, fTheta13, and fTheta23.

00045 {   
00046   fTheta12 = theta12; fTheta23 = theta23; fTheta13 = theta13;
00047   fDeltaMSq12 = deltam12; fDeltaMSq23 = deltam23;
00048   fDeltaCP = deltaCP; fMassHierarchy = massH; 
00049 }

void SysFileGen::SetOutputFile string  name  ) 
 

Definition at line 107 of file SysFileGen.cxx.

References outFileName.

00108 {
00109    outFileName = name;
00110 }

void SysFileGen::SetTrueBins int  ,
double * 
 

void SysFileGen::SetTrueBins int  ,
double  ,
double 
 

void SysFileGen::WriteToFile Selection::Selection_t  sel  ) 
 

Definition at line 113 of file SysFileGen.cxx.

References fCurrentSys, fDeltaCP, fDeltaMSq12, fDeltaMSq23, fHistMap, fMassHierarchy, fSystematics, fTheta12, outFileName, and Selection::Selection_t.

Referenced by RunSystematicStudy().

00114 {
00115   static TFile* file = 0;  
00116   static TTree* tree = 0;
00117   static char selection[256];
00118   static char sysname[256];
00119 
00120   if(file == 0){
00121      file = new TFile(outFileName.c_str(),"RECREATE");
00122      tree = new TTree("energytree","energytree");
00123      tree->Branch("Selection",selection,"Selection/C");
00124      tree->Branch("nearPOT",&fNearPOT,"nearPOT/D");
00125      tree->Branch("farPOT",&fFarPOT,"farPOT/D");
00126      tree->Branch("SysName", sysname,"SysName/C");
00127      tree->Branch("Theta12",&fTheta12,"Theta12/D");
00128      tree->Branch("Theta13",&fTheta12,"Theta13/D");
00129      tree->Branch("Theta23",&fTheta12,"Theta23/D");
00130      tree->Branch("DeltaMSq23",&fDeltaMSq23,"DeltaMSq23/D");
00131      tree->Branch("DeltaMSq12",&fDeltaMSq12,"DeltaMSq12/D");
00132      tree->Branch("DeltaCP",&fDeltaCP,"DeltaCP/D");
00133      tree->Branch("MassHierarchy",&fMassHierarchy,"MassHierarchy/I");
00134   }
00135   file->cd();
00136                                                                                 
00137   sprintf(selection,"%s",Selection::AsString(sel));
00138   sprintf(sysname, "%s", fCurrentSys.c_str());
00139 
00140   std::map<Background::Background_t,SysHists*>::iterator FNbeg = fHistMap.begin();
00141   std::map<Background::Background_t,SysHists*>::iterator FNend = fHistMap.end();
00142 
00143   while(FNbeg!=FNend) {
00144     string fnh_name = FNbeg->second->fDirectory->GetName();
00145     fnh_name += "_" + fCurrentSys + "_" + string(Selection::AsString(sel));
00146 
00147     TDirectory *filedir = file->mkdir(fnh_name.c_str());
00148     filedir->cd();
00149     TList *list = FNbeg->second->fDirectory->GetList();
00150     TIter iter(list->MakeIterator());
00151     TObject *ob = 0;
00152     while((ob = iter())) ob->Write();
00153     file->cd();
00154     FNbeg++;
00155   }
00156 
00157   file->cd();
00158 
00159   tree->Fill();
00160 
00161   if(fCurrentSys == fSystematics[fSystematics.size()-1])
00162      tree->Write();
00163 }


Member Data Documentation

string SysFileGen::fCurrentSys [private]
 

Definition at line 51 of file SysFileGen.h.

Referenced by RunSystematicStudy(), and WriteToFile().

Double_t SysFileGen::fDeltaCP [private]
 

Definition at line 63 of file SysFileGen.h.

Referenced by SetOscParams(), and WriteToFile().

Double_t SysFileGen::fDeltaMSq12 [private]
 

Definition at line 62 of file SysFileGen.h.

Referenced by SetOscParams(), and WriteToFile().

Double_t SysFileGen::fDeltaMSq23 [private]
 

Definition at line 61 of file SysFileGen.h.

Referenced by SetOscParams(), and WriteToFile().

std::map<Background::Background_t, SysHists*> SysFileGen::fHistMap [private]
 

Definition at line 53 of file SysFileGen.h.

Referenced by FillSysHistograms(), InitializeHistograms(), ResetHistograms(), and WriteToFile().

Double_t SysFileGen::fMassHierarchy [private]
 

Definition at line 64 of file SysFileGen.h.

Referenced by SetOscParams(), and WriteToFile().

vector<string> SysFileGen::fSystematics [private]
 

Definition at line 50 of file SysFileGen.h.

Referenced by AddSystematic(), RunSystematicStudy(), and WriteToFile().

double SysFileGen::fTargetPOT [private]
 

Definition at line 56 of file SysFileGen.h.

Referenced by SysFileGen().

Double_t SysFileGen::fTheta12 [private]
 

Definition at line 58 of file SysFileGen.h.

Referenced by SetOscParams(), and WriteToFile().

Double_t SysFileGen::fTheta13 [private]
 

Definition at line 60 of file SysFileGen.h.

Referenced by SetOscParams().

Double_t SysFileGen::fTheta23 [private]
 

Definition at line 59 of file SysFileGen.h.

Referenced by SetOscParams().

std::string SysFileGen::outFileName [private]
 

Definition at line 55 of file SysFileGen.h.

Referenced by SetOutputFile(), SysFileGen(), and WriteToFile().


The documentation for this class was generated from the following files:
Generated on Sat Mar 14 22:46:57 2009 for loon by doxygen 1.3.5