#include <NuHistInterpolator.h>
Public Member Functions | |
| NuHistInterpolator () | |
| NuHistInterpolator (Double_t pot) | |
| virtual | ~NuHistInterpolator () |
| virtual void | push_back (const Double_t shift, const TH1D &spectrum, const Double_t pot) |
| virtual void | push_back (const Double_t shift, const TH1D &spectrum) |
| virtual const TH1D | ProvideSpectrum (const Double_t shift) const |
| virtual const TH1D | ApplyShiftTo (const TH1D &spectrumToShift, const Double_t shift) const |
| virtual const Double_t | PoT () const |
Private Attributes | |
| Double_t | fPoT |
| std::map< Double_t, TH1D > | fSpectra |
|
|
Definition at line 11 of file NuHistInterpolator.h. 00011 {};
|
|
|
Definition at line 12 of file NuHistInterpolator.h. 00012 {fPoT = pot;};
|
|
|
Definition at line 13 of file NuHistInterpolator.h. 00013 {};
|
|
||||||||||||
|
Definition at line 256 of file NuHistInterpolator.cxx. References count, and fSpectra. 00258 {
00259 TH1D outSpectrum(spectrumToShift);
00260 string name = spectrumToShift.GetName();
00261 string title = spectrumToShift.GetTitle();
00262 // outSpectrum.Reset();
00263 // outSpectrum.Clear();
00264
00265 std::map<Double_t,TH1D>::const_iterator spectraIt = fSpectra.begin();
00266 for (Int_t bin = 1; bin<=outSpectrum.GetNbinsX(); ++bin){
00267 TGraph gInterpolate(fSpectra.size());
00268 Int_t count=0;
00269 for (spectraIt = fSpectra.begin();
00270 spectraIt != fSpectra.end();
00271 ++spectraIt){
00272 gInterpolate.SetPoint(count,
00273 spectraIt->first,
00274 spectraIt->second.GetBinContent(bin));
00275 ++count;
00276 // cout << "Limit: " << outSpectrum.GetNbinsX() << endl;
00277 // cout << "Bin: " << bin << "Count: " << count << endl;
00278 }
00279 gInterpolate.Fit("pol2","Q");
00280 Double_t par0 = gInterpolate.GetFunction("pol2")->GetParameter(0);
00281 Double_t par1 = gInterpolate.GetFunction("pol2")->GetParameter(1);
00282 Double_t par2 = gInterpolate.GetFunction("pol2")->GetParameter(2);
00283
00284 Double_t scaleFactor = par0 + shift*par1 + shift*shift*par2;
00285 scaleFactor /= par0;
00286 Double_t binContent = spectrumToShift.GetBinContent(bin);
00287 // if (10==bin){cout << "Scale factor: " << scaleFactor << endl;}
00288 binContent *= scaleFactor;
00289 if (binContent<0.0){binContent=0.0;}
00290 outSpectrum.SetBinContent(bin,binContent);
00291 }
00292 // outSpectrum.SetName(name.c_str());
00293 // outSpectrum.SetTitle(title.c_str());
00294 return outSpectrum;
00295 }
|
|
|
Definition at line 24 of file NuHistInterpolator.h. Referenced by NuMMRunPRL::MakeFDPred(), and NuMMRunNoChargeCut::MakeFDPred(). 00024 {return fPoT;}
|
|
|
Definition at line 117 of file NuHistInterpolator.cxx. Referenced by NuMMRunPRL::MakeFDPred(), and NuMMRunNoChargeCut::MakeFDPred(). 00118 {
00119 //This is the simple interpolator
00120 std::map<Double_t,TH1D>::const_iterator spectraIt = fSpectra.begin();
00121 while (spectraIt->first < shift && spectraIt != fSpectra.end()){
00122 ++spectraIt;
00123 }
00124 if (fSpectra.begin() == spectraIt){
00125 MSG("NuHistInterpolator",Msg::kWarning)
00126 << "Systematic shift " << shift << " below provided range" << endl;
00127 assert(false);
00128 }
00129 if (fSpectra.end() == spectraIt){
00130 MSG("NuHistInterpolator",Msg::kWarning)
00131 << "Systematic shift " << shift << " above provided range" << endl;
00132 assert(false);
00133 }
00134
00135 TH1D spectrumAbove(spectraIt->second);
00136 const Double_t shiftAbove = spectraIt->first;
00137 --spectraIt;
00138 TH1D spectrumBelow(spectraIt->second);
00139 const Double_t shiftBelow = spectraIt->first;
00140 // cout << "Shift above = " << shiftAbove
00141 // << "; shift below = " << shiftBelow << endl;
00142
00143 if (shiftAbove == shiftBelow){
00144 MSG("NuHistInterpolator",Msg::kWarning)
00145 << "Two shifted spectra have the identical systematic shifts" << endl;
00146 return spectrumAbove;
00147 }
00148
00149 spectrumAbove.Scale(shift-shiftBelow);
00150 spectrumAbove.Add(&spectrumBelow,shiftAbove-shift);
00151 spectrumAbove.Scale(1.0/(shiftAbove-shiftBelow));
00152 // static Int_t count=0;
00153 // if (!(count%6)){
00154 // cout << "Being asked for spectrum with shift " << shift << endl;
00155 // cout << "Bin 10 " << spectrumAbove.GetBinContent(10) << endl;
00156 // }
00157 // ++count;
00158 return spectrumAbove;
00159 }
|
|
||||||||||||
|
Definition at line 23 of file NuHistInterpolator.cxx. References fSpectra. 00025 {
00026 fSpectra[shift] = spectrum;
00027 }
|
|
||||||||||||||||
|
Definition at line 14 of file NuHistInterpolator.cxx.
|
|
|
Definition at line 27 of file NuHistInterpolator.h. |
|
|
Definition at line 28 of file NuHistInterpolator.h. Referenced by ApplyShiftTo(), ProvideSpectrum(), and push_back(). |
1.3.9.1