CorrSpec_SimpleNuMuExtrap.cxx
Go to the documentation of this file.
1 #include <bitset>
2 
4 
6 #include "FNEX/core/VarBinning.h"
8 
9 namespace fnex{
10 
11  //----------------------------------------------------------------------------
13  : CorrectedSpectrum(pset)
14  {
15  this->Reconfigure(pset);
16  }
17 
18  //----------------------------------------------------------------------------
20  fVarName = pset.get< std::string >("VarName");
21  fIsConfigured = true;
22  fFarNormalizationType = pset.get< std::string >("FarNormalizationType");
23  fNearNormalizationType = pset.get< std::string >("NearNormalizationType");
24  fDoOscillate[novadaq::cnv::kNEARDET] = pset.get< bool >("OscillateND", false);
25  fDoOscillate[novadaq::cnv::kFARDET] = pset.get< bool >("OscillateFD", true );
26 
27  return;
28  }
29 
30  //----------------------------------------------------------------------------
32  std::string r = "CorrSpec_SimpleNuMuExtrap_";
33  r += fVarName;
34  return r;
35  }
36 
37  //----------------------------------------------------------------------------
40  }
41 
42  //----------------------------------------------------------------------------
45  }
46 
47  //----------------------------------------------------------------------------
48  const std::vector<double> & CorrSpec_SimpleNuMuExtrap::DataPointsForFit() const{
49  return fDataPointsForFit;
50  }
51 
52  //----------------------------------------------------------------------------
53  const std::vector<double> & CorrSpec_SimpleNuMuExtrap::WeightsForFit() const{
54  return fWeightsForFit;
55  }
56 
57  //----------------------------------------------------------------------------
59 
61  throw cet::exception("CorrSpec_SimpleNuMuExtrap")
62  << "SpectrumList not generated! Cannot SetPlotStyles.";
63 
64  // Both the Corrected and UnCorrected maps are expected to have
65  // the same MetaData keys present
66  int color = 0;
68  auto uncorritr = fUncorrectedHistMap.begin();
69  for(auto corritr : fCorrectedHistMap){
70  md = corritr.first;
71  uncorritr = fUncorrectedHistMap.find(md);
72 
73  if(uncorritr == fUncorrectedHistMap.end())
74  throw cet::exception("CorrSpec_SimpleNuMuExtrap")
75  << "Unable to find metadata "
76  << md.ToString()
77  << " in the uncorrected histogram map";
78 
79  if(md.isMC){
80  if (md.fileType == fnex::kBeam ) color = 9;
81  else if(md.fileType == fnex::kTauSwap) color = 8;
82  else if(md.fileType == fnex::kSwap ) color = 7;
83 
84  corritr.second.SetFillColor(color);
85  corritr.second.SetFillStyle(1001);
86  corritr.second.SetOption("HIST");
87 
88  uncorritr->second.SetFillColor(color);
89  uncorritr->second.SetFillStyle(1001);
90  uncorritr->second.SetOption("HIST");
91  } // end if MC
92  else{
93  corritr.second.SetFillStyle(0);
94  corritr.second.SetMarkerColor(1);
95  corritr.second.SetMarkerStyle(2);
96  corritr.second.SetLineWidth(1);
97  corritr.second.SetOption("E1");
98 
99  uncorritr->second.SetFillStyle(0);
100  uncorritr->second.SetMarkerColor(1);
101  uncorritr->second.SetMarkerStyle(2);
102  uncorritr->second.SetLineWidth(1);
103  uncorritr->second.SetOption("E1");
104  } // end if data
105  } // end loop over spectrum metadata
106 
107 
108  // DetHistMap
109  std::set<novadaq::cnv::DetId> dets({novadaq::cnv::kNEARDET, novadaq::cnv::kFARDET});
110 
111  for(auto const& det : dets){
112 
113  // Corrected
114  fCorrectedHist_All_Data.at(det).SetMarkerColor(1);
115  fCorrectedHist_All_Data.at(det).SetMarkerStyle(2);
116  fCorrectedHist_All_Data.at(det).SetLineWidth(1);
117  fCorrectedHist_All_Data.at(det).SetOption("E1");
118 
119  fCorrectedHist_All_MC.at(det).SetFillStyle(0);
120  fCorrectedHist_All_MC.at(det).SetLineColor(2);
121  fCorrectedHist_All_MC.at(det).SetLineWidth(1);
122  fCorrectedHist_All_MC.at(det).SetOption("HIST");
123 
124  fCorrectedHist_All_Data_Over_MC.at(det).SetMarkerColor(1);
125  fCorrectedHist_All_Data_Over_MC.at(det).SetMarkerStyle(2);
126  fCorrectedHist_All_Data_Over_MC.at(det).SetLineWidth(1);
127  fCorrectedHist_All_Data_Over_MC.at(det).SetOption("E1");
128 
129  // Uncorrected
130  fUncorrectedHist_All_Data.at(det).SetMarkerColor(1);
131  fUncorrectedHist_All_Data.at(det).SetMarkerStyle(2);
132  fUncorrectedHist_All_Data.at(det).SetLineWidth(1);
133  fUncorrectedHist_All_Data.at(det).SetOption("E1");
134 
135  fUncorrectedHist_All_MC.at(det).SetFillStyle(0);
136  fUncorrectedHist_All_MC.at(det).SetLineColor(2);
137  fUncorrectedHist_All_MC.at(det).SetLineWidth(1);
138  fUncorrectedHist_All_MC.at(det).SetOption("HIST");
139 
140  fUncorrectedHist_All_Data_Over_MC.at(det).SetMarkerColor(1);
141  fUncorrectedHist_All_Data_Over_MC.at(det).SetMarkerStyle(2);
142  fUncorrectedHist_All_Data_Over_MC.at(det).SetLineWidth(1);
143  fUncorrectedHist_All_Data_Over_MC.at(det).SetOption("E1");
144 
145  }
146 
147  return;
148  }
149 
150  //----------------------------------------------------------------------------
152 
153  // Clear out existing SpectrumList if it's filled
154  fSpectrumListGenerated = false;
155  fSpectrumList.clear();
156 
157  // Keep a constant reference to the EventListMap
158  fEventListMap = &pEventListMap;
159 
160  fnex::Binning const* binning;
161 
162  if(fFitEvalType == "UBL" && (fVarName == "Nu_RecoE" ||
163  fVarName == "Lep_RecoE" ||
164  fVarName == "Had_RecoE" ))
165  binning = fnex::VarBinning::Instance()->BinInfo(fVarName + "_UBL");
166  else if(fEventListMap->begin()->first.IsNuMuQuantiles())
167  binning = fnex::VarBinning::Instance()->BinInfo(fVarName + "_2017_NuMu");
168  else
170 
171 
172  // keep track of the types of MetaData which are present, at a minimum
173  // require ND data, ND beam MC, FD data, FD beam MC, FD flux swap MC,
174  // FD tau swap MC, set the bits in that order
175  // the bitset has all locations initialized to 0 by default.
176  std::bitset<6> requiredMD;
177 
178  // Look through pEventListMap, check for basic types required;
179  // if found, assign to class-wide MetaData definition for use as keys
181  size_t bit;
182  for(auto const& eventList : pEventListMap){
183  md = eventList.first;
184  binning = this->SpectrumBinning(md);
185 
186  // only use the numu selected events for this extrapolation
187  if(!md.IsNuMuSelected()) continue;
188 
189  fSpectrumList.emplace(md, Spectrum(eventList.second, binning, md.ToString()));
190 
191  // reset the bit
192  bit = 0;
193 
194  if(md.detector == novadaq::cnv::kFARDET) bit = 2;
195 
196  switch(md.fileType){
197  case fnex::kDataFile:
198  bit += 0;
199  break;
200  case fnex::kBeam:
201  bit += 1;
202  break;
203  case fnex::kSwap:
204  bit += 2;
205  break;
206  case fnex::kTauSwap:
207  bit += 3;
208  break;
210  break;
211  default:
212  throw cet::exception("CorrSpec_SimpleNuMuExtrap")
213  << "Unknown FileType: " << md.ToString();
214  }
215 
216  LOG_DEBUG("CorrSpec_SimpleNuMuExtrap")
217  << md.ToString()
218  << " " << requiredMD.to_string()
219  << " " << bit
220  << " " << md.fileType;
221 
222  requiredMD.set(bit);
223  }
224 
225  // check that the expected metadata are present.
226  if( !requiredMD.all() )
227  throw cet::exception("CorrSpec_SimpleNuMuExtrap")
228  << "Some expected metadata are missing: "
229  << requiredMD.to_string() << std::endl;
230 
231  // we got here, so all the spectra are accounted for
232  fSpectrumListGenerated = true;
233 
234  // Now make the corrected histograms
235  LOG_DEBUG("CorrSpec_SimpleNuMuExtrap")
236  << "MakingCorrectedHistograms";
237 
239  this->MakeCorrectedHistograms();
240 
241  // We're done here
242  return fSpectrumListGenerated;
243  }
244 
245 
246  //----------------------------------------------------------------------------
248 
249  // Check that spectrum list is generated
251  throw cet::exception("CorrSpec_SimpleNuMuExtrap")
252  << "Spectrum list not generated!";
253 
254  // Make histograms, appropriately scaled to data those factors
255  std::string histname;
256  std::string histtitle;
258  std::string yaxisname = "Events";
259 
260  // make the HistMaps (uncombined hists)
261  // use the same binning as in the histograms for each metadata type
262  fnex::Binning const* binning = nullptr;
263 
264  //auto hist = fSpectrumList.begin()->second.Histogram(fVarName);
265 
267  for(auto & spectrum : fSpectrumList){
268  md = spectrum.first;
269  binning = this->SpectrumBinning(md);
270 
271  histname = md.ToString() + "_Uncorr_SimpleNuMuExtrap_" + fVarName;
272  histtitle = md.ToStringLatex() + " (Uncorr::SimpleNuMuExtrap) (" + fVarName + ")";
273  histtitle += ";" + xaxisname + ";" + yaxisname;
274  fUncorrectedHistMap.emplace(md, TH1D(histname.c_str(),
275  histtitle.c_str(),
276  binning->nBins(),
277  &(binning->BinLowEdges()[0])) );
278  this->AddSpectrumHistogram(spectrum.second, fUncorrectedHistMap.at(md), fVarName);
279  }
280 
281  return true;
282  }
283 
284  //----------------------------------------------------------------------------
286 
287  // Check that spectrum list is generated
289  throw cet::exception("CorrSpec_SimpleNuMuExtrap")
290  << "Spectrum list not generated!";
291 
292  // Make histograms, appropriately scaled to data those factors
293  std::string histname;
294  std::string histtitle;
296  std::string yaxisname = "Events";
297 
298  // make the HistMaps (uncombined hists)
299  // use the same binning as in the histograms for each metadata type
300  //auto hist = fSpectrumList.begin()->second.Histogram(fVarName);
301  fnex::Binning const* binning = nullptr;
302 
303  // First the uncorrected HistMap (uncombined hists)
305  for(auto & spectrum : fSpectrumList){
306  md = spectrum.first;
307  binning = this->SpectrumBinning(md);
308  histname = md.ToString() + "_Corr_SimpleNuMuExtrap_" + fVarName;
309  histtitle = md.ToStringLatex() + " (Corr::SimpleNuMuExtrap) (" + fVarName + ")";
310  histtitle += ";" + xaxisname + ";" + yaxisname;
311  fCorrectedHistMap.emplace(md, TH1D(histname.c_str(),
312  histtitle.c_str(),
313  binning->nBins(),
314  &(binning->BinLowEdges()[0])) );
315  this->AddSpectrumHistogram(spectrum.second, fCorrectedHistMap.at(md), fVarName);
316  }
317 
318  // Now name and title all of the histograms
319  // (ROOT's the worst; you'll get segfaults and other unpleasantries
320  // without unique names and titles for all TH1D instances)
321  std::set<std::pair<novadaq::cnv::DetId, std::string> > detectors({std::make_pair(novadaq::cnv::kNEARDET, "ND"),
323 
324  for(auto const& det : detectors){
325 
326  histname = det.second + "_Uncorr_SimpleNuMuExtrap_Data_" + fVarName;
327  histtitle = det.second + "::Uncorr::SimpleNuMuExtrap::Data::" + fVarName;
328  histtitle += ";" + xaxisname + ";" + yaxisname;
329  fUncorrectedHist_All_Data.emplace(det.first, TH1D(histname.c_str(), histtitle.c_str(), binning->nBins(), &(binning->BinLowEdges()[0])));
330 
331  fUncorrectedHist_All_Data.at(det.first).Sumw2();
332 
333  histname = det.second + "_Uncorr_SimpleNuMuExtrap_MC_" + fVarName;
334  histtitle = det.second + "::Uncorr::SimpleNuMuExtrap::MC::" + fVarName;
335  histtitle += ";" + xaxisname + ";" + yaxisname;
336  fUncorrectedHist_All_MC.emplace(det.first, TH1D(histname.c_str(), histtitle.c_str(), binning->nBins(), &(binning->BinLowEdges()[0])));
337  fUncorrectedHist_All_MC.at(det.first).Sumw2();
338 
339  histname = det.second + "_Uncorr_SimpleNuMuExtrap_Data_Over_MC_" + fVarName;
340  histtitle = det.second + "::Uncorr::SimpleNuMuExtrap::Data_Over_MC::" + fVarName;
341  histtitle += ";" + xaxisname + ";" + yaxisname;
342  fUncorrectedHist_All_Data_Over_MC.emplace(det.first, TH1D(histname.c_str(), histtitle.c_str(), binning->nBins(), &(binning->BinLowEdges()[0])));
343  fUncorrectedHist_All_Data_Over_MC.at(det.first).Sumw2();
344 
345  histname = det.second + "_Uncorr_SimpleNuMuExtrap_Data_" + fVarName;
346  histtitle = det.second + "::Uncorr::SimpleNuMuExtrap::Data::" + fVarName;
347  histtitle += ";" + xaxisname + ";" + yaxisname;
348  fCorrectedHist_All_Data.emplace(det.first, TH1D(histname.c_str(), histtitle.c_str(), binning->nBins(), &(binning->BinLowEdges()[0])));
349  fCorrectedHist_All_Data.at(det.first).Sumw2();
350 
351  histname = det.second + "_Uncorr_SimpleNuMuExtrap_MC_" + fVarName;
352  histtitle = det.second + "::Uncorr::SimpleNuMuExtrap::MC::" + fVarName;
353  histtitle += ";" + xaxisname + ";" + yaxisname;
354  fCorrectedHist_All_MC.emplace(det.first, TH1D(histname.c_str(), histtitle.c_str(), binning->nBins(), &(binning->BinLowEdges()[0])));
355  fCorrectedHist_All_MC.at(det.first).Sumw2();
356 
357  histname = det.second + "_Uncorr_SimpleNuMuExtrap_Data_Over_MC_" + fVarName;
358  histtitle = det.second + "::Uncorr::SimpleNuMuExtrap::Data_Over_MC::" + fVarName;
359  histtitle += ";" + xaxisname + ";" + yaxisname;
360  fCorrectedHist_All_Data_Over_MC.emplace(det.first, TH1D(histname.c_str(), histtitle.c_str(), binning->nBins(), &(binning->BinLowEdges()[0])));
361 
362  fCorrectedHist_All_Data_Over_MC.at(det.first).Sumw2();
363 
364  }
365 
366  LOG_VERBATIM("CorrSpec_SimpleNuMuExtrap")
367  << "Finished making histograms. There are "
368  << "\nUncorrectedHistMap: " << fUncorrectedHistMap.size()
369  << "\nCorrectedHistMap: " << fCorrectedHistMap.size()
370  << "\nUncorrectedAllData: " << fUncorrectedHist_All_Data.size()
371  << "\nUncorrectedAllMC: " << fUncorrectedHist_All_MC.size()
372  << "\nUncorrectedAllData/MC: " << fUncorrectedHist_All_Data_Over_MC.size()
373  << "\nCorrectedAllData: " << fCorrectedHist_All_Data.size()
374  << "\nCorrectedAllMC: " << fCorrectedHist_All_MC.size()
375  << "\nCorrectedAllData/MC: " << fCorrectedHist_All_Data_Over_MC.size();
376 
377  //std::cout << " about to set plot styles" << histname << std::endl;
378  this->SetPlotStyles();
379 
380  // We're done here
381  return true;
382  }
383 
384 
385  //----------------------------------------------------------------------------
387 
388 
389  // KM June 6 2016
390  // Reset fDataPointsForFit/fWeightsForFit. These are used for UBL fits.
391  fDataPointsForFit.resize(0);
392  fWeightsForFit.resize(0);
393 
394  // Check that spectrum list is generated
396  throw cet::exception("CorrSpec_SimpleNuMuExtrap")
397  << "Spectrum list not generated!";
398 
399  std::unordered_map<fnex::MetaData,
400  std::pair<double, double>,
401  fnex::MetaDataHasher> mdToEventsPOT;
402 
403  // store the number of events and POT for each detector's data
404  // the key is det * 1e4 + epoch
405  std::map<int, std::pair<double, double> > dataEventsPOT;
406 
407  // The key to fEventListMap and fSpectrumList is a fnex::MetaData,
408  // and both maps should have the same metadata present
409  fnex::MetaData md;
411  auto specItr = fSpectrumList.begin();
412  double events = 0.;
413  double pot = 0.;
414  int epochDetKey = 0;
415 
416  LOG_DEBUG("CorrSpec_SimpleNuMuExtrapEventsPerPOT")
417  << "EVENTS/POT:";
418 
419  // loop over the event lists to ensure that we have
420  // a spectrum for each list
421  for(auto evitr : *fEventListMap){
422  md = evitr.first;
423 
424  // we only want numu spectra here
425  if(!md.IsNuMuSelected()) continue;
426 
427  det = md.detector;
428  pot = evitr.second.ListSpillSummary().goodPOT;
429  events = 1. * fUncorrectedHistMap.at(md).GetEntries();
430 
431  mdToEventsPOT[md] = std::make_pair(events, pot);
432 
433  LOG_DEBUG("CorrSpec_SimpleNuMuExtrapEventsPerPOT")
434  << std::setw(35) << md.ToString()
435  << " " << std::setw(15) << events
436  << " / " << std::setw(15) << pot
437  << " = " << std::setw(15) << events / pot;
438 
439  if(!md.isMC){
440  epochDetKey = 1e4 * det + md.epoch;
441  dataEventsPOT[epochDetKey] = std::make_pair(events, pot);
442  }
443 
444  specItr = fSpectrumList.find(md);
445  if(specItr == fSpectrumList.end() )
446  throw cet::exception("CorrSpec_SimpleNuMuExtrap")
447  << "EventListMap and SpectrumList have different metadata keys: "
448  << md.ToString();
449 
450  // reset the uncorrected and corrected histograms, fill the uncorrected
451  // histograms now
452  fUncorrectedHistMap.at(md).Reset();
453  fCorrectedHistMap .at(md).Reset();
454  // std::cout << "CHECKING " << md.ToString() << std::endl;
455  if(md.isMC){
456  this->AddSpectrumHistogram(specItr->second,
457  fUncorrectedHistMap.at(md),
458  fVarName);
459  }else{
460  //std::cout << " IS DATA \n";
461  if(det == novadaq::cnv::kFARDET){
462  //std::cout << " IS FARDET \n";
463  // KM June 6 2016
464  // Grab FD data points as well as making histogram,
465  // and add to fDataPointsForFit. There will never be
466  // very many FD data events, this should not have
467  // an appreciable effect on speed.
468  this->AddSpectrumHistogram(specItr->second, fUncorrectedHistMap.at(md), fVarName);
469  std::vector<double> thisFDData = specItr->second.BaseVals(fVarName);
470  //std::cout << " CALLING FOR DATAPOINTSFORFIT with "
471  //<< thisFDData.size() << " POINTS\n";
473  thisFDData.begin(),
474  thisFDData.end());
475 
476  // SJB Aug 3 2016 - also grab data weights in order to pass
477  // these to the UBL fit object so that UBL fit value
478  // contributions can be weighted correctly.
479  std::vector<double> thisFDWeights = specItr->second.BaseVals(fnex::KeyToVarName(fnex::kFake_Weight));
480  fWeightsForFit.insert(fWeightsForFit.end(),
481  thisFDWeights.begin(),
482  thisFDWeights.end());
483  }else{
484  this->AddSpectrumHistogram(specItr->second, fUncorrectedHistMap.at(md), fVarName);
485  }
486  }
487  } // end loop over metadata to fill maps
488 
489  // reset the (un)corrected histograms for data and MC in each detector
490  std::set<novadaq::cnv::DetId> detectors({novadaq::cnv::kNEARDET, novadaq::cnv::kFARDET});
491  for(auto const& det : detectors){
492  fUncorrectedHist_All_Data .at(det).Reset();
493  fUncorrectedHist_All_MC .at(det).Reset();
494  fUncorrectedHist_All_Data_Over_MC.at(det).Reset();
495  fCorrectedHist_All_Data .at(det).Reset();
496  fCorrectedHist_All_MC .at(det).Reset();
497  fCorrectedHist_All_Data_Over_MC .at(det).Reset();
498  }
499 
500  // Make scale factors
501  // loop over the event and pot maps to determine the scale factors, we
502  // couldn't do this above because we did not know where the data were
503  std::pair<double, double> eventsPOT;
505  double scale = 0.;
506 
507  for(auto itr : *fEventListMap){
508  md = itr.first;
509 
510  // we only want numu spectra here
511  if(!md.IsNuMuSelected()) continue;
512 
513  det = md.detector;
514  scale = 1.;
515  eventsPOT = mdToEventsPOT.find(md)->second;
516  epochDetKey = 1e4 * det + md.epoch;
517 
518  // no need to normalize data
519  if(md.isMC){
520 
521  // figure out how we are normalizing for each detector
523  else if(det == novadaq::cnv::kFARDET ) norm = fFarNormalizationType;
524 
525  if(norm.compare("POT") == 0){
526  scale = dataEventsPOT.find(epochDetKey)->second.second/eventsPOT.second;
527  LOG_DEBUG("CorrSpec_SimpleNuMuExtrapScale")
528  << "POT AND SCALES:"
529  << std::setw(50)
530  << md.ToString()
531  << " "
532  << std::setw(15)
533  << eventsPOT.second
534  << " / "
535  << scale;
536  }
537  else if(norm.compare("AREA") == 0){
538  scale = dataEventsPOT.find(epochDetKey)->second.first/eventsPOT.first;
539  LOG_DEBUG("CorrSpec_SimpleNuMuExtrapScale")
540  << "AREA AND SCALES:\n"
541  << std::setw(50)
542  << md.ToString()
543  << " "
544  << std::setw(15)
545  << eventsPOT.first
546  << " / "
547  << scale;
548  }
549  else
550  LOG_VERBATIM("CorrSpec_SimpleNuMuExtrap")
551  << std::setw(40) << md.ToString() << " NO KNOWN NEAR NORM TYPE REGISTERED, ALL SCALES SET = 1.0";
552  } // end if MC
553 
554  // scale the histograms for each type of metadata accordingly
555  fUncorrectedHistMap.at(md).Scale(scale);
556 
557  if( md.isMC ){
558  // combine the results for all the metadata for each detector
559  //std::cout << "Adding in PLACE 6 " << md.ToString()<< std::endl;
560  fUncorrectedHist_All_MC.at(det).Add( &(fUncorrectedHistMap.at(md)) );
561  }
562  else{
563  // there is only 1 metadata type for each detector for data, so if we
564  // are not looking at MC events, then md is the only option for this det
565  fUncorrectedHist_All_Data.at(det).Add( &(fUncorrectedHistMap.at(md) ) );
566  }
567  } // end loop over the event lists (ie MetaData) for uncorrected histograms
568 
569  // take the ratio of the data to MC for the uncorrected histograms
572 
575 
576  // Now make the corrected HistMap (uncombined hists)
577  for(auto & itr : *fEventListMap){
578  md = itr.first;
579 
580  // only want to use numu selected events here
581  if(!md.IsNuMuSelected()) continue;
582 
583  det = md.detector;
584 
585  // start off with the corrected histogram being the same as the
586  // uncorrected one
587  fCorrectedHistMap.at(md).Add( &(fUncorrectedHistMap.at(md)) );
588 
589  if(md.isMC){
590 
591  // combine the results for all the metadata for each detector
592  fCorrectedHist_All_MC.at(det).Add( &(fCorrectedHistMap.at(md)) );
593 
594  } // end if MC
595  else{
596  // there is only 1 metadata type for each detector for data, so if we
597  // are not looking at MC events, then md is the only option for this det
598  fCorrectedHist_All_Data.at(det).Add( &(fCorrectedHistMap.at(md )) );
599  } // end if data
600 
601  } // end loop over metadata for corrected histograms
602 
603  // make the ratios of data to MC
606 
609 
610  // We're done here
611  return true;
612  }
613 
614  //----------------------------------------------------------------------------
616  TH1D & hist,
617  std::string const& varName)
618  {
619  TH1D* specHist = (TH1D*)spectrum.Histogram(varName);
620 
621  if( specHist ) hist.Add(specHist);
622 
623  return;
624  }
625 
626 
627  //----------------------------------------------------------------------------
629  {
630 
631  // Assign reference input point
632  fRefInputPoint = pInputPoint;
633 
634  //calculate the weights for the numu to numu signal in the Shifters and Weighters
635  //Use the same function NueSignalExtrapWeight for the nue signal.
637 
638  // Currently just updates the histograms; no way to pass the
639  // information into the spectrum right now
640  LOG_DEBUG("CorrSpec_SimpleNuMuExtrap")
641  << " \n\n\nCORRSPEC_SIMPLEEXTRAP: Calling UpdateCorrectedHistograms : \n\n\n";
643 
644  // Find shift description from the input point; apply shift description
645  // to the linked spectrum objects
646 
647  return;
648  }
649 
650 
651 
652 }
unsigned char VarNameToKey(std::string const &name)
Definition: VarVals.h:279
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
const EventListMap * fEventListMap
DetHistMap fUncorrectedHist_All_Data_Over_MC
bool IsNuMuSelected() const
Definition: Structs.cxx:256
const TH1 * Histogram(std::string const &varName)
Prepare a histogram using the fnex::Event objects in the fnex::EventList this Spectrum is using...
Definition: Spectrum.cxx:53
bool GenerateSpectrumList(EventListMap const &pEventListMap)
const std::vector< double > & WeightsForFit() const
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::map< fnex::MetaData, fnex::EventList > EventListMap
Definition: Event.h:186
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
static const unsigned char kFake_Weight
Definition: VarVals.h:39
Create a list of fnex::Events to be used in fits.
static ShifterAndWeighter * Instance()
CorrSpec_SimpleNuMuExtrap(fhicl::ParameterSet const &pset)
SpectrumList fSpectrumList
Internal-use function that updates the weight collections for a new set of oscillation parameters...
Double_t scale
Definition: plot.C:25
std::string const ToString() const
Definition: Structs.cxx:114
Far Detector at Ash River, MN.
virtual std::size_t nBins() const =0
Number of bins always means something, but data is stored differently in derived classes.
void Reconfigure(fhicl::ParameterSet const &pset)
void AddSpectrumHistogram(fnex::Spectrum &spectrum, TH1D &hist, std::string const &varName)
The Spectrum is the means for interaction with Event collections.
Definition: Spectrum.h:29
std::string KeyToLatex(unsigned char const &varkey)
Definition: VarVals.h:593
T get(std::string const &key) const
Definition: ParameterSet.h:231
DetHistMap fCorrectedHist_All_Data_Over_MC
#define pot
void ApplyPoint(InputPoint const &pInputPoint)
Near Detector in the NuMI cavern.
novadaq::cnv::DetId detector
Definition: Structs.h:50
static VarBinning * Instance()
Definition: VarBinning.cxx:15
fnex::FileType_t fileType
Definition: Structs.h:51
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Float_t norm
void CalcNearTrueEnergyRatioWeights(const fnex::EventListMap *pEventListMap)
fnex::Binning const * SpectrumBinning(fnex::MetaData const &md)
TRandom3 r(0)
std::string KeyToVarName(unsigned char const &key)
Definition: VarVals.h:445
const std::vector< double > & DataPointsForFit() const
#define LOG_VERBATIM(category)
Base class for &#39;binning&#39; objects. Pure virtual – you want either a FixedBinning or a VariableBinning...
Definition: Binning.h:20
std::string const ToStringLatex() const
Definition: Structs.cxx:144
virtual std::vector< double > const & BinLowEdges() const =0
fnex::Binning const * BinInfo(std::string const &varName)
Definition: VarBinning.cxx:65
void events(int which)
Definition: Cana.C:52