00001 #include <cmath>
00002 #include <cassert>
00003
00004
00005 #include "Rtypes.h"
00006 #include "TH1D.h"
00007
00008 #include "Conventions/Detector.h"
00009 #include "Conventions/SimFlag.h"
00010 #include "MessageService/MsgService.h"
00011 #include "NtupleUtils/NuCuts.h"
00012 #include "NtupleUtils/NuHistInterpolator.h"
00013 #include "NtupleUtils/NuMMHelperPRL.h"
00014 #include "NtupleUtils/NuMMRunNuBar.h"
00015 #include "NtupleUtils/NuMatrixSpectrum.h"
00016
00017 ClassImp(NuMMRunNuBar)
00018
00019 CVSID("$Id: NuMMRunNuBar.cxx,v 1.5 2008/10/28 22:59:29 ahimmel Exp $");
00020
00021 int NuMMRunNuBar::counter = 0;
00022
00023
00024 NuMMRunNuBar::NuMMRunNuBar()
00025 : NuMMRun()
00026 {
00027 fCached = false;
00028
00029 fndNuData_orig = 0;
00030 fndBarData_orig = 0;
00031 }
00032
00033
00034 NuMMRunNuBar::NuMMRunNuBar(NuMMHelperPRL* helper,
00035 NuHistInterpolator* ndData,
00036 NuHistInterpolator* fdData)
00037 : NuMMRun(helper, ndData, fdData)
00038 {
00039 fCached = false;
00040
00041 fndNuData_orig = 0;
00042 fndBarData_orig = 0;
00043 }
00044
00045
00053 void NuMMRunNuBar::MakeFDPredNoPair(const NuMMParameters& pars, NuMatrixSpectrum **nu, NuMatrixSpectrum **nubar)
00054 {
00055 pair<NuMatrixSpectrum, NuMatrixSpectrum> fits = MakeFDPred(pars);
00056 if (nu) *nu = new NuMatrixSpectrum(fits.first);
00057 if (nubar) *nubar = new NuMatrixSpectrum(fits.second);
00058 }
00059
00060
00064 NuMatrixSpectrum* NuMMRunNuBar::MakeFDPredNuMu(const NuMMParameters& pars)
00065 {
00066 pair<NuMatrixSpectrum, NuMatrixSpectrum> fits = MakeFDPred(pars);
00067 return new NuMatrixSpectrum(fits.first);
00068 }
00069
00073 NuMatrixSpectrum* NuMMRunNuBar::MakeFDPredNuBar(const NuMMParameters& pars)
00074 {
00075 pair<NuMatrixSpectrum, NuMatrixSpectrum> fits = MakeFDPred(pars);
00076 return new NuMatrixSpectrum(fits.second);
00077 }
00078
00079
00094 NuMatrixSpectrum* NuMMRunNuBar::ModifyNDNuData()
00095 {
00096 if (fndNuData_orig) {
00097 MAXMSG("NuMMRunNuBar",Msg::kWarning, 5) << "You did not reset the Nu data after modifying it. Data should always be reset. Doing so now." << endl;
00098 ResetNDNuData();
00099 }
00100
00101 if (!fQuietMode) {MAXMSG("NuMMRunNuBar",Msg::kInfo, 5) << "Making a Nu backup copy." << endl;}
00102
00103
00104 fndNuData_orig = fndNuData;
00105 fndNuData = new NuMatrixSpectrum(*fndNuData);
00106
00107
00108 fCached = false;
00109
00110 return fndNuData;
00111 }
00112
00113
00128 NuMatrixSpectrum* NuMMRunNuBar::ModifyNDBarData()
00129 {
00130 if (fndBarData_orig) {
00131 MAXMSG("NuMMRunNuBar",Msg::kWarning, 5) << "You did not reset the Bar data after modifying it. Data should always be reset. Doing so now." << endl;
00132 ResetNDBarData();
00133 }
00134
00135 if (!fQuietMode) {MAXMSG("NuMMRunNuBar",Msg::kInfo, 5) << "Making a Bar backup copy." << endl;}
00136
00137
00138 fndBarData_orig = fndBarData;
00139 fndBarData = new NuMatrixSpectrum(*fndBarData);
00140
00141
00142 fCached = false;
00143 return fndBarData;
00144 }
00145
00146
00152 void NuMMRunNuBar::ResetNDNuData()
00153 {
00154 if (fndNuData_orig) {
00155 if (!fQuietMode) {MAXMSG("NuMMRunNuBar",Msg::kInfo, 5) << "Reverting Nu to backup copy." << endl;}
00156
00157 delete fndNuData;
00158 fndNuData = fndNuData_orig;
00159 fndNuData_orig = 0;
00160
00161
00162 fCached = false;
00163 }
00164 else {
00165 MAXMSG("NuMMRunNuBar",Msg::kWarning, 5) << "Resetting unmodified Nu data. Not harmful, just superfluous." << endl;
00166 }
00167 }
00168
00174 void NuMMRunNuBar::ResetNDBarData()
00175 {
00176 if (fndBarData_orig) {
00177 if (!fQuietMode) {MAXMSG("NuMMRunNuBar",Msg::kInfo, 5) << "Reverting Bar to backup copy." << endl;}
00178
00179 delete fndBarData;
00180 fndBarData = fndBarData_orig;
00181 fndBarData_orig = 0;
00182
00183
00184 fCached = false;
00185 }
00186 else {
00187 MAXMSG("NuMMRunNuBar",Msg::kWarning, 5) << "Resetting unmodified Bars data. Not harmful, just superfluous." << endl;
00188 }
00189 }
00190
00197 NuMMHelperCPT* NuMMRunNuBar::GetHelper()
00198 {
00199 fCached = false;
00200 return fHelper;
00201 }
00202
00203