#include <NuTreeWrapper.h>
Public Member Functions | |
| NuTreeWrapper () | |
| NuTreeWrapper (std::string filelist) | |
| virtual | ~NuTreeWrapper () |
| virtual const Int_t | Detector () const |
| virtual void | FillTree () |
| virtual const Int_t | GetEntries () const |
| virtual const Int_t | GetEntriesFast () const |
| virtual const NuEvent | GetInfoObject (const Int_t event) const |
| virtual NuEvent & | GetObjectToFill () |
| virtual const Double_t | GetPoT () const |
| virtual void | Write (const std::string filename) |
Private Member Functions | |
| virtual void | CalculatePoTs () |
| virtual void | LoadEvent (const Int_t event) const |
Private Attributes | |
| Bool_t | IAmReadable |
| Int_t | fcurrEntry |
| Double_t | fTotPoT |
| TFile * | fDummyFile |
| TTree * | fNuTreeWrapper |
| TChain | fInputChain |
| NuEvent * | fNuEvent |
| NuEvent * | fInputInfo |
|
|
Definition at line 35 of file NuTreeWrapper.cxx. 00036 : IAmReadable(false), 00037 fcurrEntry(-1) 00038 { 00039 //Constructor to create a writable tree 00040 fNuTreeWrapper = new TTree("s","s"); 00041 cout<<"NuTreeWrapper::Creating new NuEvent for output to tree"<<endl; 00042 fNuEvent = new NuEvent(); 00043 fNuTreeWrapper->Branch("s","NuEvent",&fNuEvent,32000,2); 00044 fInputInfo = 0; 00045 }
|
|
|
Definition at line 49 of file NuTreeWrapper.cxx. References CalculatePoTs(), fInputChain, fInputInfo, and fTotPoT. 00051 : IAmReadable(true), 00052 fcurrEntry(-1), 00053 fInputChain("s") 00054 { 00055 //Constructor to read a tree(s) from file 00056 cout << "Running constructor." << endl; 00057 fInputInfo = 0; 00058 fInputChain.Add(filelist.c_str()); 00059 fInputChain.SetBranchAddress("s",&fInputInfo); 00060 fTotPoT = 0.0; 00061 00062 this->CalculatePoTs(); 00063 }
|
|
|
Definition at line 66 of file NuTreeWrapper.cxx. 00067 {
00068 }
|
|
|
Definition at line 71 of file NuTreeWrapper.cxx. References Detector(), fInputChain, fTotPoT, and MSG. Referenced by NuTreeWrapper(). 00072 {
00073 cout << "Running PoT function" << endl;
00074 TObjArray* fileList = fInputChain.GetListOfFiles();
00075 fTotPoT = 0.0;
00076 cout << "Starting fileLoop" << endl;
00077 Int_t detector = this->Detector();
00078 cout << "Got detector: " << detector << endl;
00079 for (Int_t counter=0; counter<fileList->GetEntries(); ++counter){
00080 TChainElement* chainElement =
00081 dynamic_cast<TChainElement*> (fileList->At(counter));
00082 if (chainElement){
00083 string fileName = chainElement->GetTitle();
00084 TFile f(fileName.c_str(),"READ");
00085 TH1F* hPottortgt = (TH1F*) f.Get("hPottortgt");
00086 TH1F* hRun = (TH1F*) f.Get("hRun");
00087 if (1==detector){
00088 fTotPoT += hPottortgt->GetMean()*hPottortgt->GetEntries()*1e12;
00089 }
00090 if (2==detector){
00091 fTotPoT += hPottortgt->GetMean()*hRun->GetEntries()*1e8*1e12;
00092 }
00093 fTotPoT += hPottortgt->Integral();
00094 f.Close();
00095 }
00096 }
00097 MSG("NuTreeWrapper.cxx",Msg::kInfo)
00098 << "PoT: " << fTotPoT << endl;
00099 return;
00100 }
|
|
|
Definition at line 103 of file NuTreeWrapper.cxx. References NuEvent::detector, GetEntriesFast(), GetInfoObject(), and MSG. Referenced by CalculatePoTs(). 00104 {
00105 if (this->GetEntriesFast()){
00106 return this->GetInfoObject(0).detector;
00107 }
00108 else{
00109 MSG("NuTreeWrapper.cxx",Msg::kError)
00110 << "Trying to get PoT for empty NuTreeWrapper" << endl;
00111 return 0;
00112 }
00113 }
|
|
|
Definition at line 116 of file NuTreeWrapper.cxx. References fNuTreeWrapper. 00117 {
00118 //fill the tree
00119 fNuTreeWrapper->Fill();
00120 }
|
|
|
Definition at line 123 of file NuTreeWrapper.cxx. References fInputChain, and MSG. Referenced by NuXFitAnalysis::CacheFDMCEvents(), NuCrossSectionFitter::CacheNDMCEvents(), NuXFitAnalysis::FillFDDataHistograms(), NuCrossSectionFitter::FillNDDataHistograms(), NuFluctuator::MakeCPTPDFs(), NuFluctuator::MakeShiftedCPTPDFs(), NuFluctuator::MakeShiftedTransitionPDFs(), and NuFluctuator::MakeTransitionPDFs(). 00124 {
00125 if (!IAmReadable){
00126 MSG("NuTreeWrapper", Msg::kFatal)
00127 << "Trying to read from write-only NuTreeWrapper." << endl;
00128 return -1;
00129 }
00130 return fInputChain.GetEntries();
00131 }
|
|
|
Definition at line 134 of file NuTreeWrapper.cxx. References fInputChain, and MSG. Referenced by Detector(). 00135 {
00136 if (!IAmReadable){
00137 MSG("NuTreeWrapper", Msg::kFatal)
00138 << "Trying to read from write-only NuTreeWrapper." << endl;
00139 return -1;
00140 }
00141 return fInputChain.GetEntriesFast();
00142 }
|
|
|
Definition at line 145 of file NuTreeWrapper.cxx. References LoadEvent(), and MSG. Referenced by NuXFitAnalysis::CacheFDMCEvents(), NuCrossSectionFitter::CacheNDMCEvents(), Detector(), NuXFitAnalysis::FillFDDataHistograms(), NuCrossSectionFitter::FillNDDataHistograms(), NuFluctuator::MakeCPTPDFs(), NuFluctuator::MakeShiftedCPTPDFs(), NuFluctuator::MakeShiftedTransitionPDFs(), and NuFluctuator::MakeTransitionPDFs(). 00146 {
00147 if (!IAmReadable){
00148 MSG("NuTreeWrapper", Msg::kFatal)
00149 << "Trying to read from write-only NuTreeWrapper." << endl;
00150 NuEvent dummy;
00151 return dummy;
00152 }
00153 this->LoadEvent(event);
00154 return *fInputInfo;
00155 }
|
|
|
Definition at line 158 of file NuTreeWrapper.cxx. References fNuEvent, and NuEvent::Reset().
|
|
|
Definition at line 25 of file NuTreeWrapper.h. Referenced by NuXFitAnalysis::FDData(), NuXFitAnalysis::FDMC(), NuFluctuator::MonteCarlo(), NuCrossSectionFitter::NDData(), and NuCrossSectionFitter::NDMC(). 00025 {return fTotPoT;}
|
|
|
Definition at line 165 of file NuTreeWrapper.cxx. References fcurrEntry, and fInputChain. Referenced by GetInfoObject(). 00166 {
00167 if (event == fcurrEntry){return;}
00168 else{
00169 fInputChain.GetEvent(event);
00170 fcurrEntry = event;
00171 }
00172 }
|
|
|
Definition at line 175 of file NuTreeWrapper.cxx. References fNuTreeWrapper. Referenced by NuXFitAnalysis::CPTAnalysis(), NuXFitAnalysis::FillFDDataHistograms(), and NuXFitAnalysis::TransitionAnalysis(). 00176 {
00177 TFile f(filename.c_str(),"RECREATE");
00178 fNuTreeWrapper->Write();
00179 f.Close();
00180 }
|
|
|
Definition at line 34 of file NuTreeWrapper.h. Referenced by LoadEvent(). |
|
|
Definition at line 36 of file NuTreeWrapper.h. |
|
|
Definition at line 38 of file NuTreeWrapper.h. Referenced by CalculatePoTs(), GetEntries(), GetEntriesFast(), LoadEvent(), and NuTreeWrapper(). |
|
|
Definition at line 40 of file NuTreeWrapper.h. Referenced by NuTreeWrapper(). |
|
|
Definition at line 39 of file NuTreeWrapper.h. Referenced by GetObjectToFill(). |
|
|
Definition at line 37 of file NuTreeWrapper.h. Referenced by FillTree(), and Write(). |
|
|
Definition at line 35 of file NuTreeWrapper.h. Referenced by CalculatePoTs(), and NuTreeWrapper(). |
|
|
Definition at line 33 of file NuTreeWrapper.h. |
1.3.9.1