GhostMerge Class Reference

#include <GhostMerge.h>

List of all members.

Public Member Functions

 GhostMerge (GhostInputs *)
 ~GhostMerge ()
void AddFile (Char_t *filename)
void SetNumberInputFile (Int_t num)
void Pause ()
void AddSample (GhostSample *sample)
void RunMerge ()

Private Attributes

GhostInputsgInputs
Int_t fNumInputFiles
vector< TFile * > vFile
vector< GhostSample * > vSamples
TFile * fOutputRootFile
Double_t fSin2MinOverall
Double_t fSin2MaxOverall
Double_t fDm2MinOverall
Double_t fDm2MaxOverall
Double_t fDm2BinWidth
Double_t fSin2BinWidth
Int_t fNumSin2BinsOverall
Int_t fNumDm2BinsOverall
Int_t fNumSin2Bins
Int_t fNumDm2Bins
Double_t fMinLik
Int_t fMinIndexDm2
Int_t fMinIndexSin2
Double_t fMinLikSin2
Double_t fMinLikSin2Error
Double_t fMinLikDm2
Double_t fMinLikDm2Error
TGraph * gBestFit
TH2D * hOverallSurface
TH2D * hDeltaOverallSurface
TH2D * hCCDetNormalisation
TH2D * hCCDetNormalisationError
TH2D * hCCRockNormalisation
TH2D * hCCRockNormalisationError
TH2D * hNuMuBarNormalisation
TH2D * hNuMuBarNormalisationError
TH2D * hNCNormalisation
TH2D * hNCNormalisationError
vector< TH2D * > v2DSystematicSurfaces
vector< TH2D * > v2DSystematicErrorSurfaces
vector< TH2D * > v1DSystematicSurfaces
vector< TH2D * > v1DSystematicErrorSurfaces
TH2D * hDecoherenceSurface
TH2D * hDecoherenceSurfaceError

Friends

class GhostInputs
class GhostFakeData
class GhostFramework
class GhostSample

Detailed Description

Definition at line 34 of file GhostMerge.h.


Constructor & Destructor Documentation

GhostMerge::GhostMerge ( GhostInputs inputs  ) 

Definition at line 40 of file GhostMerge.cxx.

00040                                           :
00041     fNumInputFiles(-999),
00042     fMinLik(-999.9),
00043     fMinIndexDm2(-999),
00044     fMinIndexSin2(-999),
00045     fMinLikSin2(-999.9),
00046     fMinLikSin2Error(-999.9),
00047     fMinLikDm2(-999.9),
00048     fMinLikDm2Error(-999.9)
00049 {
00050   
00051   gInputs = inputs;
00052   fSin2MinOverall = gInputs->fSin2MinOverall;
00053   fSin2MaxOverall = gInputs->fSin2MaxOverall;
00054   fDm2MinOverall = gInputs->fDm2MinOverall;
00055   fDm2MaxOverall = gInputs->fDm2MaxOverall;
00056   fNumDm2BinsOverall = gInputs->fNumDm2BinsOverall;
00057   fNumSin2BinsOverall = gInputs->fNumSin2BinsOverall;
00058   vSamples.clear();
00059 }

GhostMerge::~GhostMerge (  ) 

Definition at line 61 of file GhostMerge.cxx.

References vFile.

00062 {
00063   for(UInt_t i=0;i<vFile.size();i++) delete vFile.at(i);
00064 }


Member Function Documentation

void GhostMerge::AddFile ( Char_t *  filename  )  [inline]

Definition at line 47 of file GhostMerge.h.

References vFile.

00047                                 {
00048     vFile.push_back(new TFile(filename,"read"));
00049   }

void GhostMerge::AddSample ( GhostSample sample  )  [inline]

Definition at line 52 of file GhostMerge.h.

References vSamples.

00052 { vSamples.push_back(sample); }

void GhostMerge::Pause (  ) 

Definition at line 409 of file GhostMerge.cxx.

References gSystem().

00410 {
00411   cout << "Press return to continue" << endl;
00412   
00413   int key = 0;
00414   while(1){
00415     gSystem->ProcessEvents();
00416     fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK);
00417     key = getchar();
00418     if(key=='\n') break;
00419     usleep(1000);
00420   }
00421 }

void GhostMerge::RunMerge (  ) 

Definition at line 66 of file GhostMerge.cxx.

References GhostInputs::f1DSystematicName, GhostInputs::f2DSystematicName, GhostInputs::fBestFitRootFilename, GhostInputs::fBestFitTextFilename, GhostInputs::fCCDetSigma, GhostInputs::fCCRockSigma, fDm2BinWidth, fDm2MaxOverall, fDm2MinOverall, GhostInputs::fFitCCDet, GhostInputs::fFitCCRock, GhostInputs::fFitDecoherence, GhostInputs::fFitNC, GhostInputs::fFitNuMuBar, fMinIndexDm2, fMinIndexSin2, fMinLik, fMinLikDm2, fMinLikDm2Error, fMinLikSin2, fMinLikSin2Error, GhostInputs::fNCSigma, GhostInputs::fNum1DSysts, GhostInputs::fNum2DSysts, fNumDm2BinsOverall, GhostInputs::fNumMockDataExpts, GhostInputs::fNumSamples, fNumSin2BinsOverall, GhostInputs::fNuMuBarSigma, fOutputRootFile, GhostInputs::fRealData, fSin2BinWidth, fSin2MaxOverall, fSin2MinOverall, gBestFit, gInputs, hCCDetNormalisation, hCCDetNormalisationError, hCCRockNormalisation, hCCRockNormalisationError, hDecoherenceSurface, hDecoherenceSurfaceError, hDeltaOverallSurface, hNCNormalisation, hNCNormalisationError, hNuMuBarNormalisation, hNuMuBarNormalisationError, hOverallSurface, Msg::kDebug, Msg::kInfo, MSG, v1DSystematicErrorSurfaces, v1DSystematicSurfaces, v2DSystematicErrorSurfaces, v2DSystematicSurfaces, vFile, and vSamples.

00067 {
00068   TString name;
00069 
00070   gInputs->fNumMockDataExpts = 1;
00071 
00072   for(Int_t nexp=0;nexp<gInputs->fNumMockDataExpts;nexp++){
00073     
00074     //Setup overall likelihood surfaces
00075     fDm2BinWidth = (fDm2MaxOverall - fDm2MinOverall)/fNumDm2BinsOverall;
00076     fSin2BinWidth = (fSin2MaxOverall - fSin2MinOverall)/fNumSin2BinsOverall;
00077     
00078     name.Resize(0); name.Append("hOverallLogLikelihoodSurface_Exp_"); name += nexp;
00079     hOverallSurface = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00080     
00081     name.Resize(0); name.Append("hOverallDeltaLogLikelihoodSurface_Exp_"); name += nexp;
00082     hDeltaOverallSurface = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00083     
00084     
00085     //NOTE: ALL SYST SURFACES FILLED IN UNITS OF SIGMA
00086     //Scaling Surfaces
00087     if(gInputs->fFitCCDet){
00088       name.Resize(0); name.Append("hOverallCCDetScalingSurface_Exp_"); name += nexp;
00089       hCCDetNormalisation = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00090       name.Resize(0); name.Append("hOverallCCDetScalingErrorSurface__Exp_"); name += nexp;
00091       hCCDetNormalisationError = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00092     }
00093     if(gInputs->fFitCCRock){
00094       name.Resize(0); name.Append("hOverallCCRockScalingSurface_Exp_"); name += nexp;
00095       hCCRockNormalisation = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00096       name.Resize(0); name.Append("hOverallCCRockScalingErrorSurface__Exp_"); name += nexp;
00097       hCCRockNormalisationError = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00098     }
00099     if(gInputs->fFitNC){
00100       name.Resize(0); name.Append("hOverallNCScalingSurface_Exp_"); name += nexp;
00101       hNCNormalisation = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00102       name.Resize(0); name.Append("hOverallNCScalingErrorSurface__Exp_"); name += nexp;
00103       hNCNormalisationError = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00104     }
00105     if(gInputs->fFitNuMuBar){
00106       name.Resize(0); name.Append("hOverallNuMuBarScalingSurface_Exp_"); name += nexp;
00107       hNuMuBarNormalisation = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00108       name.Resize(0); name.Append("hOverallNuMuBarScalingErrorSurface__Exp_"); name += nexp;
00109       hNuMuBarNormalisationError = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00110     }
00111     
00112     //2D Systematics Surfaces
00113     for(Int_t i=0;i<gInputs->fNum2DSysts;i++){
00114       name.Resize(0); name.Append(gInputs->f2DSystematicName.at(i)); name.Append("OverallSurface_Exp_"); name += nexp;
00115       v2DSystematicSurfaces.push_back(new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall));
00116       name.Resize(0); name.Append(gInputs->f2DSystematicName.at(i)); name.Append("OverallErrorSurface_Exp_"); name += nexp;
00117       v2DSystematicErrorSurfaces.push_back(new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall));
00118     }
00119     //1D Systematics Surfaces
00120     for(Int_t i=0;i<gInputs->fNum1DSysts;i++){
00121       name.Resize(0); name.Append(gInputs->f1DSystematicName.at(i)); name.Append("OverallSurface_Exp_"); name += nexp;
00122       v1DSystematicSurfaces.push_back(new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall));
00123       name.Resize(0); name.Append(gInputs->f1DSystematicName.at(i)); name.Append("OverallErrorSurface_Exp_"); name += nexp;
00124       v1DSystematicErrorSurfaces.push_back(new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall));
00125     }
00126     
00127     if(gInputs->fFitDecoherence){
00128       name.Resize(0); name.Append("hOverallDecoherenceSurface_Exp_"); name += nexp;
00129       hDecoherenceSurface = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00130       name.Resize(0); name.Append("hOverallDecoherenceErrorSurface__Exp_"); name += nexp;
00131       hDecoherenceSurfaceError = new TH2D(name.Data(),name.Data(),fNumSin2BinsOverall,fSin2MinOverall,fSin2MaxOverall,fNumDm2BinsOverall,fDm2MinOverall,fDm2MaxOverall);
00132     }
00133     
00134 MSG("GhostMerge",Msg::kDebug) << " *-* GhostMerge::RunMerge() Prepared Likelihood Surfaces Completed *-*" << endl;
00135     
00136     
00137     //Sum surfaces from input files
00138     for(UInt_t i=0;i<vFile.size();i++){
00139       
00140       name.Resize(0); name.Append("hLogLikelihoodSurface_Exp_"); name += nexp;
00141       
00142       //Add surfaces
00143       hOverallSurface->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00144 
00145 
00146       if(gInputs->fFitCCDet){
00147         name.Resize(0); name.Append("hCCDetScalingSurface_Exp_"); name += nexp;
00148         cout << name.Data() << endl;
00149         hCCDetNormalisation->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00150         name.Resize(0); name.Append("hCCDetScalingErrorSurface__Exp_"); name += nexp;
00151         cout << name.Data() << endl;
00152         hCCDetNormalisationError->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00153       }
00154       if(gInputs->fFitNC){
00155         name.Resize(0); name.Append("hNCScalingSurface_Exp_"); name += nexp;
00156         cout << name.Data() << endl;
00157         hNCNormalisation->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00158         name.Resize(0); name.Append("hNCScalingErrorSurface__Exp_"); name += nexp;
00159         cout << name.Data() << endl;
00160         hNCNormalisationError->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00161       }
00162       for(Int_t j=0;j<gInputs->fNum2DSysts;j++){
00163         name.Resize(0); name.Append(gInputs->f2DSystematicName.at(j)); name.Append("Surface_Exp_"); name += nexp;
00164         v2DSystematicSurfaces.at(j)->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00165         name.Resize(0); name.Append(gInputs->f2DSystematicName.at(j)); name.Append("ErrorSurface_Exp_"); name += nexp;
00166         v2DSystematicErrorSurfaces.at(j)->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00167       }
00168       for(Int_t j=0;j<gInputs->fNum1DSysts;j++){
00169         name.Resize(0); name.Append(gInputs->f1DSystematicName.at(j)); name.Append("Surface_Exp_"); name += nexp;
00170         v1DSystematicSurfaces.at(j)->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00171         name.Resize(0); name.Append(gInputs->f1DSystematicName.at(j)); name.Append("ErrorSurface_Exp_"); name += nexp;
00172         v1DSystematicErrorSurfaces.at(j)->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00173       }
00174       if(gInputs->fFitDecoherence){
00175         name.Resize(0); name.Append("hDecoherenceSurface_Exp_"); name += nexp;
00176         cout << name.Data() << endl;
00177         hDecoherenceSurface->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00178         name.Resize(0); name.Append("hDecoherenceErrorSurface__Exp_"); name += nexp;
00179         cout << name.Data() << endl;
00180         hDecoherenceSurfaceError->Add((TH2D*)vFile.at(i)->Get(name.Data()));
00181       }
00182     }
00183 
00184 
00185     
00186     //Calculate best fit point and delta loglikelihood surface
00187     for(Int_t i=0;i<fNumSin2BinsOverall;i++){
00188       for(Int_t j=0;j<fNumDm2BinsOverall;j++){
00189         
00190         Double_t tmp_lik = hOverallSurface->GetBinContent(i+1,j+1);
00191         if((i==0 && j==0) || fMinLik > tmp_lik){
00192           fMinLik = tmp_lik; fMinIndexSin2 = i; fMinIndexDm2 = j;
00193         }
00194       }
00195     }
00196     MSG("GhostMerge",Msg::kInfo) << " *-* GhostMerge::RunFit() Found Best Fit Point *-*" << endl;
00197     
00198 
00199     //Fill delta loglikelihood surface and get best fit values
00200     for(Int_t i=0;i<fNumSin2BinsOverall;i++){
00201       for(Int_t j=0;j<fNumDm2BinsOverall;j++){
00202         Double_t temp_delta = 0.0;
00203         temp_delta = (hOverallSurface->GetBinContent(i+1,j+1) - fMinLik);
00204         hDeltaOverallSurface->SetBinContent(i+1,j+1,temp_delta);
00205       }
00206     }
00207   
00208     MSG("GhostMerge",Msg::kInfo) << " *-* GhostMerge::RunFit() Made DeltaLogLikelihood Surface *-*" << endl;
00209     
00210 
00211     //Get Variables for text file
00212     fMinLikSin2 = hOverallSurface->GetXaxis()->GetBinCenter(fMinIndexSin2+1); fMinLikSin2Error = fSin2BinWidth/2.;
00213     fMinLikDm2 = hOverallSurface->GetYaxis()->GetBinCenter(fMinIndexDm2+1); fMinLikDm2Error = fDm2BinWidth/2.;
00214     
00215     if(nexp==0){
00216       ofstream ofile(gInputs->fBestFitTextFilename);
00217       if(!ofile.fail()){
00218         ofile << "Number of Experiments = " << gInputs->fNumMockDataExpts << endl;
00219         ofile << endl;
00220       }
00221       ofile.close();
00222     }
00223     
00224     ofstream ofile(gInputs->fBestFitTextFilename,ios::app);
00225     MSG("GhostMerge",Msg::kDebug) << " *-* GhostMerge::RunFit() Opened text file *-* " << endl;
00226     
00227     if(!ofile.fail()){
00228       ofile << "EXPERIMENT = " << nexp << endl;
00229       ofile << "Best Fit Point (sin2,dm2) = (" << fMinLikSin2 << "," << fMinLikDm2 << ")" << endl;
00230       ofile << "Error on sin2 best fit point: " << fMinLikSin2Error << endl;
00231       ofile << "Error on dm2 best fit point: " << fMinLikDm2Error << endl;
00232       ofile << "Likelihood value at the best fit point = " << fMinLik << endl;
00233       ofile << endl;
00234       
00235       if(gInputs->fFitCCDet){ofile << "Best Fit CC Detector Scale (/sigma) = " << hCCDetNormalisation->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;
00236       ofile << "Error on Best Fit CC Detector Scale (/sigma) = " << hCCDetNormalisationError->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;}
00237       if(gInputs->fFitCCRock){ofile << "Best Fit CC Rock Scale (/sigma) = " << hCCRockNormalisation->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;
00238       ofile << "Error on Best Fit CC Rock Scale (/sigma) = " << hCCRockNormalisationError->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;}
00239       if(gInputs->fFitNC){ofile << "Best Fit NC Scale (/sigma) = " << hNCNormalisation->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;
00240       ofile << "Error on Best Fit NC Scale (/sigma) = " << hNCNormalisationError->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;}
00241       if(gInputs->fFitNuMuBar){ofile << "Best Fit NuMuBar Scale (/sigma) = " << hNuMuBarNormalisation->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;
00242       ofile << "Error on Best Fit NuMuBar Scale (/sigma) = " << hNuMuBarNormalisationError->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;}
00243       
00244       for(Int_t i=0;i<gInputs->fNum2DSysts;i++){
00245         ofile << "Best Fit " << (gInputs->f2DSystematicName).at(i) <<  " (/sigma)  = " << v2DSystematicSurfaces.at(i)->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;
00246         ofile << "Error on " << (gInputs->f2DSystematicName).at(i) <<  " (/sigma)  = " << v2DSystematicErrorSurfaces.at(i)->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;
00247       }
00248       for(Int_t i=0;i<gInputs->fNum1DSysts;i++){
00249         ofile << "Best Fit " << (gInputs->f1DSystematicName).at(i) <<  " (/sigma)  = " << v1DSystematicSurfaces.at(i)->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;
00250         ofile << "Error on " << (gInputs->f1DSystematicName).at(i) <<  " (/sigma)  = " << v1DSystematicErrorSurfaces.at(i)->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;
00251       }
00252       if(gInputs->fFitDecoherence){ofile << "Best Fit mu2 = " << hDecoherenceSurface->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;
00253       ofile << "Error on Best Fit mu2 = " << hDecoherenceSurfaceError->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1) << endl;}
00254     }
00255     ofile.close();
00256     
00257     MSG("GhostMerge",Msg::kInfo) << " *-* GhostMerge::RunFit() Written Text File *-* " << endl; 
00258     
00259     //Make best fit graph
00260     Double_t sin2_bestfit_array[1] = {fMinLikSin2};
00261     Double_t dm2_bestfit_array[1] = {fMinLikDm2};
00262       
00263     gBestFit = new TGraph(1,sin2_bestfit_array,dm2_bestfit_array);
00264     gBestFit->SetMarkerColor(2);
00265     gBestFit->SetMarkerStyle(5);
00266     gBestFit->SetMarkerSize(5);
00267     TString tempstring("gBestFit_Exp");
00268     tempstring += nexp;                         
00269     gBestFit->SetName(tempstring.Data());
00270     
00271 
00272     //WRITE OUT ROOT FILE-----------------------------------------------------------------------------------------------------------
00273     if(nexp==0 && gInputs->fRealData) fOutputRootFile = new TFile(gInputs->fBestFitRootFilename,"recreate");
00274     else fOutputRootFile = new TFile(gInputs->fBestFitRootFilename,"update");
00275     fOutputRootFile->cd();
00276     hOverallSurface->Write();
00277     if(gInputs->fFitCCDet){hCCDetNormalisation->Write();
00278                   hCCDetNormalisationError->Write();}
00279     if(gInputs->fFitCCRock){hCCRockNormalisation->Write();
00280                   hCCRockNormalisationError->Write();}
00281     if(gInputs->fFitNC){hNCNormalisation->Write();
00282                hNCNormalisationError->Write();}
00283     if(gInputs->fFitNuMuBar){hNuMuBarNormalisation->Write();
00284                hNuMuBarNormalisationError->Write();}
00285 
00286     for(Int_t i=0;i<gInputs->fNum2DSysts;i++){
00287       v2DSystematicSurfaces.at(i)->Write();
00288       v2DSystematicErrorSurfaces.at(i)->Write();
00289     }
00290     for(Int_t i=0;i<gInputs->fNum1DSysts;i++){
00291       v1DSystematicSurfaces.at(i)->Write();
00292       v1DSystematicErrorSurfaces.at(i)->Write();
00293     }
00294     if(gInputs->fFitDecoherence){hDecoherenceSurface->Write();
00295                hDecoherenceSurfaceError->Write();}
00296     gBestFit->Write();
00297     hDeltaOverallSurface->Write();
00298     
00299     //Here will write out all spectra when above is correct
00300 
00301     //Write out spectrum at best fit point for each sample
00302     for(Int_t i=0;i<gInputs->fNumSamples;i++){
00303 
00304       TString label("BESTFIT");
00305       TString label_unosc("UNOSCILLATED");
00306 
00307       //Dummy 2D vector container
00308       vector<vector<ArrayTH1D*> > vDummy2D;
00309       vector<ArrayTH1D*> vDummy1D;
00310       for(Int_t j=0;j<vSamples.at(i)->fNDis;j++) vDummy2D.push_back(vDummy1D);
00311 
00312       //Get scales
00313       Double_t cc_detbestfitscale = 0.0;
00314       Double_t cc_rockbestfitscale = 0.0;
00315       Double_t nc_bestfitscale = 0.0;
00316       Double_t ws_bestfitscale = 0.0;
00317 
00318       if(gInputs->fFitCCDet) cc_detbestfitscale = hCCDetNormalisation->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1)*(gInputs->fCCDetSigma);
00319       if(gInputs->fFitCCRock) cc_rockbestfitscale = hCCRockNormalisation->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1)*(gInputs->fCCRockSigma);
00320       if(gInputs->fFitNC) nc_bestfitscale = hNCNormalisation->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1)*(gInputs->fNCSigma);
00321       if(gInputs->fFitNuMuBar) ws_bestfitscale = hNuMuBarNormalisation->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1)*(gInputs->fNuMuBarSigma);
00322       
00323       //Get energy systs
00324       Double_t* EnergySysts2D = new Double_t[gInputs->fNum2DSysts];
00325       Double_t* EnergySysts1D = new Double_t[gInputs->fNum1DSysts];
00326       for(Int_t j=0;j<gInputs->fNum2DSysts;j++) EnergySysts2D[j] = v2DSystematicSurfaces.at(j)->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1);
00327       for(Int_t j=0;j<gInputs->fNum1DSysts;j++) EnergySysts1D[j] = v2DSystematicSurfaces.at(j)->GetBinContent(fMinIndexSin2+1,fMinIndexDm2+1);
00328 
00329       MSG("GhostMerge",Msg::kInfo) << " *-* GhostMerge::RunFit() Writing out best fit spectra *-*" << endl;
00330       
00331       vSamples.at(i)->GetSpectrum(fMinLikSin2,fMinLikDm2,cc_detbestfitscale,cc_rockbestfitscale,nc_bestfitscale,ws_bestfitscale,EnergySysts2D,EnergySysts1D,vDummy2D,fOutputRootFile,label);
00332 
00333       //Write out overall best fit spectrum for sample,dis,res bin
00334       for(Int_t j=0;j<vSamples.at(i)->fNDis;j++){
00335         for(Int_t k=0;k<vSamples.at(i)->fNResBins;k++){
00336           
00337           TString name; name.Append("hBestFitSpectrum_"); name += i; name.Append("_"); name += j; name.Append("_"); name += k;
00338           TH1D* hBestFit = (TH1D*)(vDummy2D.at(j)).at(k)->ConvertTH1D(name.Data());
00339           hBestFit->Write();
00340           delete hBestFit;
00341         }
00342       }
00343 
00344       //Get Unoscillated prediction for all contributions
00345       vector<vector<ArrayTH1D*> > vDummyUnosc2D;
00346       vector<ArrayTH1D*> vDummyUnosc1D;
00347       for(Int_t j=0;j<vSamples.at(i)->fNDis;j++) vDummyUnosc2D.push_back(vDummyUnosc1D);
00348 
00349       for(Int_t j=0;j<gInputs->fNum2DSysts;j++) EnergySysts2D[j] = 0.;
00350       for(Int_t j=0;j<gInputs->fNum1DSysts;j++) EnergySysts1D[j] = 0.;
00351       vSamples.at(i)->GetSpectrum(0.0,0.0,0.0,0.0,0.0,0.0,EnergySysts2D,EnergySysts1D,vDummyUnosc2D,fOutputRootFile,label_unosc);
00352     
00353       //Write out unoscillated spectrum for sample,dis,res bin
00354       for(Int_t j=0;j<vSamples.at(i)->fNDis;j++){
00355         for(Int_t k=0;k<vSamples.at(i)->fNResBins;k++){
00356           
00357           TString name; name.Append("hUnoscillatedSpectrum_"); name += i; name.Append("_"); name += j; name.Append("_"); name += k;
00358           TH1D* hUnoscillated = (TH1D*)(vDummyUnosc2D.at(j)).at(k)->ConvertTH1D(name.Data());
00359           hUnoscillated->Write();
00360           delete hUnoscillated;
00361         }
00362       }
00363       delete[] EnergySysts2D ;
00364       delete[] EnergySysts1D;
00365     }
00366     
00367     fOutputRootFile->Close();
00368     
00369     MSG("GhostMerge",Msg::kInfo) << " *-* GhostMerge::RunFit() Written Root File *-* " << endl; 
00370 
00371     
00372     //Remade for each experiment
00373     delete gBestFit;
00374     delete hOverallSurface;
00375     delete hDeltaOverallSurface;
00376     if(gInputs->fFitCCDet){
00377       delete hCCDetNormalisation;
00378       delete hCCDetNormalisationError;
00379     }
00380     if(gInputs->fFitCCRock){
00381       delete hCCRockNormalisation;
00382       delete hCCRockNormalisationError;
00383     }
00384     if(gInputs->fFitNC){
00385       delete hNCNormalisation;
00386       delete hNCNormalisationError;
00387     }
00388     if(gInputs->fFitNuMuBar){
00389       delete hNuMuBarNormalisation;
00390       delete hNuMuBarNormalisationError;
00391     }
00392     for(Int_t i=0;i<gInputs->fNum2DSysts;i++){
00393       delete v2DSystematicSurfaces.at(i);
00394       delete v2DSystematicErrorSurfaces.at(i);
00395     }
00396     for(Int_t i=0;i<gInputs->fNum1DSysts;i++){
00397       delete v1DSystematicSurfaces.at(i);
00398       delete v1DSystematicErrorSurfaces.at(i);
00399     }
00400     if(gInputs->fFitDecoherence){
00401       delete hDecoherenceSurface;
00402       delete hDecoherenceSurfaceError;
00403     }
00404     delete fOutputRootFile;
00405 
00406   }//EO loop over experiments
00407 }

void GhostMerge::SetNumberInputFile ( Int_t  num  )  [inline]

Definition at line 50 of file GhostMerge.h.

References fNumInputFiles.

00050 { fNumInputFiles = num; }


Friends And Related Function Documentation

friend class GhostFakeData [friend]

Definition at line 37 of file GhostMerge.h.

friend class GhostFramework [friend]

Definition at line 38 of file GhostMerge.h.

friend class GhostInputs [friend]

Definition at line 36 of file GhostMerge.h.

friend class GhostSample [friend]

Definition at line 39 of file GhostMerge.h.


Member Data Documentation

Double_t GhostMerge::fDm2BinWidth [private]

Definition at line 73 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fDm2MaxOverall [private]

Definition at line 71 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fDm2MinOverall [private]

Definition at line 70 of file GhostMerge.h.

Referenced by RunMerge().

Int_t GhostMerge::fMinIndexDm2 [private]

Definition at line 84 of file GhostMerge.h.

Referenced by RunMerge().

Int_t GhostMerge::fMinIndexSin2 [private]

Definition at line 85 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fMinLik [private]

Definition at line 83 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fMinLikDm2 [private]

Definition at line 88 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fMinLikDm2Error [private]

Definition at line 89 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fMinLikSin2 [private]

Definition at line 86 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fMinLikSin2Error [private]

Definition at line 87 of file GhostMerge.h.

Referenced by RunMerge().

Int_t GhostMerge::fNumDm2Bins [private]

Definition at line 79 of file GhostMerge.h.

Definition at line 77 of file GhostMerge.h.

Referenced by RunMerge().

Int_t GhostMerge::fNumInputFiles [private]

Definition at line 61 of file GhostMerge.h.

Referenced by SetNumberInputFile().

Int_t GhostMerge::fNumSin2Bins [private]

Definition at line 78 of file GhostMerge.h.

Definition at line 76 of file GhostMerge.h.

Referenced by RunMerge().

TFile* GhostMerge::fOutputRootFile [private]

Definition at line 64 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fSin2BinWidth [private]

Definition at line 74 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fSin2MaxOverall [private]

Definition at line 69 of file GhostMerge.h.

Referenced by RunMerge().

Double_t GhostMerge::fSin2MinOverall [private]

Definition at line 68 of file GhostMerge.h.

Referenced by RunMerge().

TGraph* GhostMerge::gBestFit [private]

Definition at line 90 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 58 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 96 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 97 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 98 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 99 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 110 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 111 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 94 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 102 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 103 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 100 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 101 of file GhostMerge.h.

Referenced by RunMerge().

TH2D* GhostMerge::hOverallSurface [private]

Definition at line 93 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 108 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 107 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 106 of file GhostMerge.h.

Referenced by RunMerge().

Definition at line 105 of file GhostMerge.h.

Referenced by RunMerge().

vector<TFile*> GhostMerge::vFile [private]

Definition at line 62 of file GhostMerge.h.

Referenced by AddFile(), RunMerge(), and ~GhostMerge().

Definition at line 63 of file GhostMerge.h.

Referenced by AddSample(), and RunMerge().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1