Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
fnex::ReadFitResults Class Reference
Inheritance diagram for fnex::ReadFitResults:
art::ResultsProducer art::ProductRegistryHelper art::Consumer

Public Types

template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::PluginConfig, KeysToIgnore >
 

Public Member Functions

 ReadFitResults (fhicl::ParameterSet const &pset)
 
virtual ~ReadFitResults ()
 
void readResults (art::Results const &r)
 
void writeResults (art::Results &r)
 
void reconfigure (fhicl::ParameterSet const &p)
 
void clear ()
 
void endJob ()
 
void doBeginJob ()
 
void doEndJob ()
 
void doBeginSubRun (SubRunPrincipal const &)
 
void doEndSubRun (SubRunPrincipal const &)
 
void doBeginRun (RunPrincipal const &)
 
void doEndRun (RunPrincipal const &)
 
void doEvent (EventPrincipal const &)
 
void doReadResults (ResultsPrincipal const &)
 
void doWriteResults (ResultsPrincipal &)
 
void doClear ()
 
void registerProducts (MasterProductRegistry &mpr, ProductDescriptions &producedProducts, ModuleDescription const &md)
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

template<class P >
void produces (std::string const &instanceName={})
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void setModuleDescription (ModuleDescription const &md)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

bool readSingleResults (art::Results const &r, std::vector< fnex::PointResult > &prvec, std::vector< fnex::InputPoint > &ipvec)
 
bool readVectorResults (art::Results const &r, std::vector< fnex::PointResult > &prvec, std::vector< fnex::InputPoint > &ipvec)
 
void plotResults ()
 

Private Attributes

art::ServiceHandle< art::TFileServicefTFS
 TFileService. More...
 
std::unique_ptr< art::TFileDirectoryfTFD_Working
 Split saved items into Working. More...
 
std::unique_ptr< art::TFileDirectoryfTFD_Showcase
 And 'showcase' folders (for final results) More...
 
PointResMap fPointResMap
 Initial point passed to fitter, typedef above. More...
 
std::string fPointLabel
 label of plugin storing the points More...
 
std::string fAltPointLabel
 reverse the order of the parameters in the label More...
 
fnex::OscParm_t fParam1Enum
 enumerated value of the parameter from FNEX/dataProducts/Constants.h More...
 
fnex::OscParm_t fParam2Enum
 enumerated value of the parameter from FNEX/dataProducts/Constants.h More...
 
std::pair< double, std::stringfParam1Scale
 scale the parameter if necessary ie is x10^{-3}, string is latex friendly More...
 
std::pair< double, std::stringfParam2Scale
 scale the parameter if necessary ie is x10^{-3}, string is latex friendly More...
 
std::vector< shiftconvfshiftconvs
 Systematic pulls for point results. More...
 

Detailed Description

Definition at line 53 of file ReadFitResults_plugin.cc.

Member Typedef Documentation

template<typename UserConfig , typename KeysToIgnore = void>
using art::ResultsProducer::Table = ProducerTable<UserConfig, detail::PluginConfig, KeysToIgnore>
inherited

Definition at line 114 of file ResultsProducer.h.

Constructor & Destructor Documentation

fnex::ReadFitResults::ReadFitResults ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 93 of file ReadFitResults_plugin.cc.

96  , fParam1Scale(std::make_pair(1., ""))
97  , fParam2Scale(std::make_pair(1., ""))
98  {
99  //this->reconfigure(pset);
100 
101  return;
102  }
fnex::OscParm_t fParam1Enum
enumerated value of the parameter from FNEX/dataProducts/Constants.h
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
std::pair< double, std::string > fParam2Scale
scale the parameter if necessary ie is x10^{-3}, string is latex friendly
std::pair< double, std::string > fParam1Scale
scale the parameter if necessary ie is x10^{-3}, string is latex friendly
fnex::OscParm_t fParam2Enum
enumerated value of the parameter from FNEX/dataProducts/Constants.h
fnex::ReadFitResults::~ReadFitResults ( )
virtual

Definition at line 105 of file ReadFitResults_plugin.cc.

106  {
107 
108  }

Member Function Documentation

void fnex::ReadFitResults::clear ( )
virtual

Implements art::ResultsProducer.

Definition at line 193 of file ReadFitResults_plugin.cc.

194  {
195  return;
196  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
void art::ResultsProducer::doBeginJob ( )
inlineinherited

Definition at line 165 of file ResultsProducer.h.

References ana::assert(), breakpoints::beginJob(), fhicl::ParameterSetRegistry::get(), and art::Consumer::setModuleDescription().

Referenced by art::RootOutput::beginJob().

166 {
168  // Preparing the consumer for the job must be done after the
169  // constructer has been called.
170  auto const& mainID = moduleDescription_->mainParameterSetID();
171  auto const& scheduler_pset =
173  "services.scheduler");
175  prepareForJob(scheduler_pset);
176  beginJob();
177 }
static collection_type const & get() noexcept
void setModuleDescription(ModuleDescription const &md)
void prepareForJob(fhicl::ParameterSet const &pset)
assert(nhit_max >=nhit_nbins)
virtual void beginJob()
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doBeginRun ( RunPrincipal const &  rp)
inlineinherited

Definition at line 201 of file ResultsProducer.h.

References r().

Referenced by art::RootOutput::beginRun().

202 {
203  Run const r{rp, *moduleDescription_, this};
204  beginRun(r);
205 }
virtual void beginRun(Run const &)
TRandom3 r(0)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doBeginSubRun ( SubRunPrincipal const &  srp)
inlineinherited

Definition at line 187 of file ResultsProducer.h.

References sr.

Referenced by art::RootOutput::beginSubRun().

188 {
189  SubRun const sr{srp, *moduleDescription_, this};
190  beginSubRun(sr);
191 }
virtual void beginSubRun(SubRun const &)
caf::StandardRecord * sr
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doClear ( )
inlineinherited

Definition at line 229 of file ResultsProducer.h.

References clear.

Referenced by art::RootOutput::finishEndFile().

230 {
231  clear();
232 }
virtual void clear()=0
void art::ResultsProducer::doEndJob ( )
inlineinherited

Definition at line 180 of file ResultsProducer.h.

Referenced by art::RootOutput::endJob().

181 {
182  endJob();
184 }
virtual void endJob()
void showMissingConsumes() const
void art::ResultsProducer::doEndRun ( RunPrincipal const &  rp)
inlineinherited

Definition at line 208 of file ResultsProducer.h.

References r().

Referenced by art::RootOutput::endRun().

209 {
210  Run const r{rp, *moduleDescription_, this};
211  endRun(r);
212 }
virtual void endRun(Run const &)
TRandom3 r(0)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doEndSubRun ( SubRunPrincipal const &  srp)
inlineinherited

Definition at line 194 of file ResultsProducer.h.

References sr.

Referenced by art::RootOutput::endSubRun().

195 {
196  SubRun const sr{srp, *moduleDescription_, this};
197  endSubRun(sr);
198 }
caf::StandardRecord * sr
virtual void endSubRun(SubRun const &)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doEvent ( EventPrincipal const &  ep)
inlineinherited

Definition at line 215 of file ResultsProducer.h.

References e, and lem_server::ep.

Referenced by art::RootOutput::event().

216 {
217  Event const e{ep, *moduleDescription_, this};
218  event(e);
219 }
Float_t e
Definition: plot.C:35
virtual void event(Event const &)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doReadResults ( ResultsPrincipal const &  resp)
inlineinherited

Definition at line 222 of file ResultsProducer.h.

Referenced by art::RootOutput::readResults().

223 {
224  Results const res{resp, *moduleDescription_, this};
225  readResults(res);
226 }
virtual void readResults(Results const &)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::ResultsProducer::doWriteResults ( ResultsPrincipal )
inherited
void fnex::ReadFitResults::endJob ( )
virtual

Reimplemented from art::ResultsProducer.

Definition at line 883 of file ReadFitResults_plugin.cc.

References DEFINE_ART_RESULTS_PLUGIN, and plotResults().

884  {
885  // get the maps for the 1 and 2D delta ChiSqr values
886 
887  plotResults();
888  //fTFD_Working = sfTFS->mkdir("Working")>;
889  //fTFD_Showcase = std::make_unique<fTFS->mkdir("Showcase")>;
890 
891  return;
892  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void fnex::ReadFitResults::plotResults ( )
private

Definition at line 476 of file ReadFitResults_plugin.cc.

References demo5::c1, demo5::c2, chisquared::c3, chisquared::c4, APDHVSetting::dummy, E, allTimeWatchdog::endl, fshiftconvs, fTFS, MECModelEnuComparisons::i, kBlue, kRed, LOG_VERBATIM, art::TFileDirectory::make(), std::max(), make_syst_table_plots::nsysts, std::sin(), and string.

Referenced by endJob().

477  {
478 
479  LOG_VERBATIM("ReadFitResults") << "Run with " << fshiftconvs.size() << " shifts (should be 1 per ART file)" << std::endl << std::endl;
480 
481  double input_Dmsq32 = 2.44e-03;
482  double input_Th23 = 0.843529;
483  double input_ssTh23 = 0.558;
484 
485  //from https://arxiv.org/pdf/1701.05891.pdf
486  double err_input_Dmsq32 = 0.11e-03;
487  double pos_err_input_ssTh23 = 0.03;
488  double neg_err_input_ssTh23 = 0.022;
489 
490  //Fill arrays for graph
491  int nsysts = fshiftconvs.size(); //number of systematic shifts that have non-zero initial guess value (usually ±1e-3)
492  double dummy[nsysts/2];
493  double resultsHigh[nsysts/2];//for Value: 1
494  double resultsLow[nsysts/2]; //for Value: -1
495  double Dmsq32High[nsysts/2]; //for Value: 1
496  double Dmsq32Low[nsysts/2]; //for Value: -1
497  double Th23High[nsysts/2]; //for Value: 1
498  double Th23Low[nsysts/2]; //for Value: -1
499  double ssTh23High[nsysts/2]; //for Value: 1
500  double ssTh23Low[nsysts/2]; //for Value: -1
501  double chisqHigh[nsysts/2];
502  LOG_VERBATIM("ReadFitResults")
503  << "Initialised int and arrays "
504  << nsysts/2
505  << " systematics";
506 
507  //If namestyle=0, the bin titles are the shift name. If namestyle=1,
508  //bin titles are the number of sigma by which data is shifted
509  int namestyle=0;
510 
511  for (int i=0;i<nsysts;i++)
512  {
513 
514  //At least the first two use the same shifter, so name bins by initial shift
515  if(i==0 && fshiftconvs[0].shiftName == fshiftconvs[1].shiftName) namestyle=1;
516 
517  if(i < nsysts/2){
518  dummy[i] = i+1;
519  //if(namestyle==0) dummy[i] = i + 1;
520  //else dummy[i] = 5. - i*0.2;//fshiftconvs[i].initialShift;
521  //else dummy[i] = -2. + i*0.2;
522  resultsHigh[i] = fshiftconvs[i].convergedShift;
523  Th23High[i] = fshiftconvs[i].convergedTh23;
524  ssTh23High[i] = sin(fshiftconvs[i].convergedTh23) * sin(fshiftconvs[i].convergedTh23);
525  Dmsq32High[i] = fshiftconvs[i].convergedDmsq32;
526  if(fshiftconvs[i].chiSq > 0 && fshiftconvs[i].chiSq < 1e10) chisqHigh[i] = fshiftconvs[i].chiSq;
527  LOG_VERBATIM("ReadFitResults") << i << ": dummy " << dummy[i] << " shift " << fshiftconvs[i].shiftName << " fit " << resultsHigh[i] << std::endl;
528  } else {
529  resultsLow[i - nsysts/2] = fshiftconvs[i].convergedShift;
530  Th23Low[i - nsysts/2] = fshiftconvs[i].convergedTh23;
531  ssTh23Low[i - nsysts/2] = sin(fshiftconvs[i].convergedTh23) * sin(fshiftconvs[i].convergedTh23);
532  Dmsq32Low[i - nsysts/2] = fshiftconvs[i].convergedDmsq32;
533  LOG_VERBATIM("ReadFitResults") << i << " : dummy " << i - nsysts/2 << " shift " << fshiftconvs[i].shiftName << " fit " << resultsLow[i - nsysts/2] << std::endl;
534  }
535 
536 
537  //LOG_VERBATIM("ReadFitResults") << "namestyle = " << namestyle <<std::endl;
538 
539  // LOG_VERBATIM("ReadFitResults") << dummy[i] << "\t Shifter: " << fshiftconvs[i].shiftName
540  // << " Initial val: " << fshiftconvs[i].initialShift
541  // << " Converged val: " << resultsHigh[i]//fshiftconvs[i].convergedShift
542  // << " ChiSqr: " << chisq[i] << std::endl;//fshiftconvs[i].chiSq << std::endl;
543 
544  }
545  LOG_VERBATIM("ReadFitResults")
546  << "Filled arrays";
547 
548  TCanvas *c1 = fTFS->make<TCanvas>("Results_of_fit_shift", "Converged shift", 1200, 800);
549  TCanvas *c3 = fTFS->make<TCanvas>("Results_of_fit_Dmsq32", "Converged #Delta m_{32}^{2}", 1200, 800);
550  TCanvas *c4 = fTFS->make<TCanvas>("Results_of_fit_Th23", "Converged #theta_{23}", 1200, 800);
551  TCanvas *c5 = fTFS->make<TCanvas>("Results_of_fit_ssTh23", "Converged sin^{2} #theta_{23}", 1200, 800);
552 
553  c1->cd();
554  //c1->SetLogy();
555  c1->SetBottomMargin(0.3);
556  c3->SetBottomMargin(0.3);
557  c4->SetBottomMargin(0.3);
558  c5->SetBottomMargin(0.3);
559  //TCanvas * c1 = new TCanvas("c1");
560  LOG_VERBATIM("ReadFitResults") << "Made canvases" << std::endl;
561 
562  //Make a graph of converged fit: high for positive shifts, low for negative
563  TGraph *gGuessHigh = new TGraph(nsysts/2,dummy,resultsHigh);
564  TGraph *gGuessLow = new TGraph(nsysts/2,dummy,resultsLow);
565  TGraph *gDmsq32High = new TGraph(nsysts/2,dummy,Dmsq32High);
566  TGraph *gDmsq32Low = new TGraph(nsysts/2,dummy,Dmsq32Low);
567  TGraph *gTh23High = new TGraph(nsysts/2,dummy,Th23High);
568  TGraph *gTh23Low = new TGraph(nsysts/2,dummy,Th23Low);
569  TGraph *gssTh23High = new TGraph(nsysts/2,dummy,ssTh23High);
570  TGraph *gssTh23Low = new TGraph(nsysts/2,dummy,ssTh23Low);
571  LOG_VERBATIM("ReadFitResults") << "Made graphs" << std::endl;
572 
573  //Make a graph of chi sq of fits
574  TCanvas *c2 = fTFS->make<TCanvas>("Chi_Sqr", "Chi Sqr'", 1200, 800);
575  c2->cd();
576  // if(namestyle==0) c2->SetBottomMargin(0.3);
577  c2->SetBottomMargin(0.3);
578  TGraph *gChiSqHigh = new TGraph(nsysts/2,dummy,chisqHigh);
579 
580  //Make graphs of osc pars as a fraction of error
581  TGraph *gDmsq32ErrFracHigh = new TGraph(nsysts/2,dummy,Dmsq32High);
582  TGraph *gDmsq32ErrFracLow = new TGraph(nsysts/2,dummy,Dmsq32Low);
583  TGraph *gssTh23ErrFracHigh = new TGraph(nsysts/2,dummy,ssTh23High);
584  TGraph *gssTh23ErrFracLow = new TGraph(nsysts/2,dummy,ssTh23Low);
585 
586  TF2 * fErrFrac = new TF2("fDmsq32ErrFrac", "(y-[0]) / [1]");
587  fErrFrac->SetParameter(0, input_Dmsq32);
588  fErrFrac->SetParameter(1, err_input_Dmsq32);
589  gDmsq32ErrFracHigh->Apply(fErrFrac);
590  gDmsq32ErrFracLow->Apply(fErrFrac);
591 
592  for(int i = 0; i < nsysts/2; ++i)
593  {
594  double x_temp = 0., y_temp = 0.;
595  gssTh23ErrFracHigh->GetPoint(i, x_temp, y_temp);
596  if(y_temp >= input_ssTh23) gssTh23ErrFracHigh->SetPoint(i, x_temp, (y_temp - input_ssTh23) / pos_err_input_ssTh23);
597  if(y_temp < input_ssTh23) gssTh23ErrFracHigh->SetPoint(i, x_temp, (y_temp - input_ssTh23) / neg_err_input_ssTh23);
598 
599  gssTh23ErrFracLow->GetPoint(i, x_temp, y_temp);
600  if(y_temp >= input_ssTh23) gssTh23ErrFracLow->SetPoint(i, x_temp, (y_temp - input_ssTh23) / pos_err_input_ssTh23);
601  if(y_temp < input_ssTh23) gssTh23ErrFracLow->SetPoint(i, x_temp, (y_temp - input_ssTh23) / neg_err_input_ssTh23);
602  }
603  LOG_VERBATIM("ReadFitResults")
604  << "Made err frac graphs";
605 
606  TCanvas *cDmsq32ErrFrac = fTFS->make<TCanvas>("Dmsq32_ErrFrac", "Dmsq32_ErrFrac", 1200, 800);
607  cDmsq32ErrFrac->cd();
608  //if(namestyle==0) cDmsq32ErrFrac->SetBottomMargin(0.3);
609  cDmsq32ErrFrac->SetBottomMargin(0.3);
610  TCanvas *cssTh23ErrFrac = fTFS->make<TCanvas>("ssTh23_ErrFrac", "ssTh23_ErrFrac", 1200, 800);
611  cssTh23ErrFrac->cd();
612  //if(namestyle==0) cssTh23ErrFrac->SetBottomMargin(0.3);
613  cssTh23ErrFrac->SetBottomMargin(0.3);
614 
615  for (int i=0;i<nsysts/2;++i)
616  {
617  int bin_index = gGuessHigh->GetXaxis()->FindBin(i+1);
618  LOG_VERBATIM("ReadFitResults")
619  << "Looking for bin index for "
620  << i
621  << ": <<"
622  << fshiftconvs[i].shiftName
623  << "... Find "
624  << bin_index;
625  //std::string bin_title = fshiftconvs[i].shiftName;
626 
627  std::string bin_title;
628  if (fshiftconvs[i].shiftName.compare("RelNormWgt") == 0) bin_title = "Rel. Norm.";
629  else if(fshiftconvs[i].shiftName.compare("RPACCQEWgt") == 0) bin_title = "RPA CC QE Wgt";
630  else if(fshiftconvs[i].shiftName.compare("RecoHadEShifter") == 0) bin_title = "Reco. E_{Had} Shift";
631  else if(fshiftconvs[i].shiftName.compare("RecoLepEShifter") == 0) bin_title = "Reco. E_{#mu} Shift";
632  else if(fshiftconvs[i].shiftName.compare("RelRecoHadEShifter") == 0) bin_title = "Rel. Reco. E_{Had} Shift";
633  else if(fshiftconvs[i].shiftName.compare("RelRecoLepEShifter") == 0) bin_title = "Rel. Reco. E_{#mu} Shift";
634  else if(fshiftconvs[i].shiftName.compare("RecoNuEShifter") == 0) bin_title = "Reco. E_{#nu} Shift";
635  else if(fshiftconvs[i].shiftName.compare("TauNormWgt") == 0) bin_title = "Tau Norm.";
636  else if(fshiftconvs[i].shiftName.compare("NCNormWgt") == 0) bin_title = "NC Norm.";
637  else if(fshiftconvs[i].shiftName.compare("MECNormWgt") == 0) bin_title = "MEC Norm.";
638  else if(fshiftconvs[i].shiftName.compare("CosmicMuNormWgt") == 0) bin_title = "Cosmic #mu Norm.";
639  else if(fshiftconvs[i].shiftName.compare("AbsNormWgt") == 0) bin_title = "Abs. Norm";
640  else if(fshiftconvs[i].shiftName.compare("FarBeamSystWgt") == 0) bin_title = "Beam Syst.";
641  else if(fshiftconvs[i].shiftName.compare("RecoNuENoiseFarShifter") == 0) bin_title = "Noise Syst.";
642  else if(fshiftconvs[i].shiftName.compare("RecoNuECalibFarShifter") == 0) bin_title = "Calib. Syst.";
643  else if(fshiftconvs[i].shiftName.compare("RecoNuEBirksFarShifter") == 0) bin_title = "Birks Syst.";
644  else if(fshiftconvs[i].shiftName.compare("MaCCQE_shapeWgt") == 0) bin_title = "MaCCQE Shape";
645  else if(fshiftconvs[i].shiftName.compare("NormCCQEWgt") == 0) bin_title = "Norm. CC QE";
646  else if(fshiftconvs[i].shiftName.compare("MaCCRESWgt") == 0) bin_title = "MaCCRES";
647  else if(fshiftconvs[i].shiftName.compare("MvCCRESWgt") == 0) bin_title = "MvCCRES";
648  else if(fshiftconvs[i].shiftName.compare("MaNCRESWgt") == 0) bin_title = "MaNCRES";
649  else if(fshiftconvs[i].shiftName.compare("MvNCRESWgt") == 0) bin_title = "MvNCRES";
650  else if(fshiftconvs[i].shiftName.compare("MaNCELWgt") == 0) bin_title = "MaNCEL";
651  else if(fshiftconvs[i].shiftName.compare("RockNormOnFidWgt") == 0) bin_title = "Rock norm.";
652  else if(fshiftconvs[i].shiftName.compare("ReweightCCQEPauliSupViaKFWgt") == 0) bin_title = "Reweight CCQE Pauli Sup. via KF";
653 
654  //update for A2017
655  else if(fshiftconvs[i].shiftName.compare("RecoHadEShifter2017") == 0) bin_title = "Abs. E_{Had} shift";
656  else if(fshiftconvs[i].shiftName.compare("RecoLepEShifter2017") == 0) bin_title = "Abs. E_{#mu} shift";
657  else if(fshiftconvs[i].shiftName.compare("RelRecoHadEShifter2017") == 0) bin_title = "Rel. E_{Had} shift";
658  else if(fshiftconvs[i].shiftName.compare("RelRecoLepEShifter2017") == 0) bin_title = "Rel. E_{#mu} shift";
659  else if(fshiftconvs[i].shiftName.compare("MECq0ShapeWgt") == 0) bin_title = "MEC q_{0} Shape";
660  else if(fshiftconvs[i].shiftName.compare("MaCCQEReducedWgt") == 0) bin_title = "Reduced MaCCQE";
661  else if(fshiftconvs[i].shiftName.compare("RPARESWgt") == 0) bin_title = "RPA RES";
662  else if(fshiftconvs[i].shiftName.compare("RPACCQEshapeEnhWgt") == 0) bin_title = "RPA CCQE Shape Enh.";
663  else if(fshiftconvs[i].shiftName.compare("DISvnCC1piWgt") == 0) bin_title = "DIS #nu n CC 1#pi";
664  else if(fshiftconvs[i].shiftName.compare("PPFXPCA0Wgt") == 0) bin_title = "PPFX PCA 0";
665  else if(fshiftconvs[i].shiftName.compare("PPFXPCA1Wgt") == 0) bin_title = "PPFX PCA 1";
666  else if(fshiftconvs[i].shiftName.compare("PPFXPCA2Wgt") == 0) bin_title = "PPFX PCA 2";
667  else if(fshiftconvs[i].shiftName.compare("PPFXPCA3Wgt") == 0) bin_title = "PPFX PCA 3";
668  else if(fshiftconvs[i].shiftName.compare("PPFXPCA4Wgt") == 0) bin_title = "PPFX PCA 4";
669  else if(fshiftconvs[i].shiftName.compare("FarCalibShapeWgt") == 0) bin_title = "Calib. Shape";
670  else if(fshiftconvs[i].shiftName.compare("FarLightLevelWgt") == 0) bin_title = "Light Level";
671  else if(fshiftconvs[i].shiftName.compare("FarCherenkovWgt") == 0) bin_title = "Cherenkov";
672  else if(fshiftconvs[i].shiftName.compare("SumSmallXSecNumu2017Weight") == 0) bin_title = "Sum Small XSec 2017";//aka MEGAGLOM
673 
674  //update for A2018
675  else if(fshiftconvs[i].shiftName.compare("MECShapeNuWgt") == 0) bin_title = "MEC Shape: #nu";
676  else if(fshiftconvs[i].shiftName.compare("MECShapeAntiNuWgt") == 0) bin_title = "MEC Shape: anti #nu";
677  else if(fshiftconvs[i].shiftName.compare("MECInitNPFracNuWgt") == 0) bin_title = "MEC Init. NP Frac.: #nu";
678  else if(fshiftconvs[i].shiftName.compare("MECInitNPFracAntiNuWgt") == 0) bin_title = "MEC Init. NP Frac.: anti #nu";
679  else if(fshiftconvs[i].shiftName.compare("MECEnuShapeNuWgt") == 0) bin_title = "MEC E_{#nu} Shape: #nu";
680  else if(fshiftconvs[i].shiftName.compare("MECEnuShapeAntiNuWgt") == 0) bin_title = "MEC E_{#nu} Shape: anti #nu";
681 
682  else bin_title = fshiftconvs[i].shiftName;
683 
684  gGuessHigh ->GetXaxis()->SetBinLabel(bin_index, bin_title.c_str());
685  LOG_VERBATIM("ReadFitResults") << "Setting label for gDmsq32High, bin " << gDmsq32High->GetXaxis()->FindBin(i+1) << std::endl;
686  gDmsq32High->GetXaxis()->SetBinLabel(gDmsq32High->GetXaxis()->FindBin(i+1), bin_title.c_str());
687  LOG_VERBATIM("ReadFitResults") << "Setting label for gTh23High, bin " << gTh23High->GetXaxis()->FindBin(i+1) << std::endl;
688  gTh23High ->GetXaxis()->SetBinLabel(gTh23High->GetXaxis()->FindBin(i+1), bin_title.c_str());
689  LOG_VERBATIM("ReadFitResults") << "Setting label for gssTh23High, bin " << gssTh23High->GetXaxis()->FindBin(i+1) << std::endl;
690  gssTh23High->GetXaxis()->SetBinLabel(gssTh23High->GetXaxis()->FindBin(i+1), bin_title.c_str());
691 
692  LOG_VERBATIM("ReadFitResults") << "Setting label for gChiSqHigh, bin " << gChiSqHigh->GetXaxis()->FindBin(i+1) << std::endl;
693  bin_index = gChiSqHigh->GetXaxis()->FindBin(i+1);
694  gChiSqHigh->GetXaxis()->SetBinLabel(bin_index, bin_title.c_str());
695 
696  bin_index = gDmsq32ErrFracHigh->GetXaxis()->FindBin(i+1);
697  gDmsq32ErrFracHigh->GetXaxis()->SetBinLabel(bin_index, bin_title.c_str());
698 
699  bin_index = gssTh23ErrFracHigh->GetXaxis()->FindBin(i+1);
700  gssTh23ErrFracHigh->GetXaxis()->SetBinLabel(bin_index, bin_title.c_str());
701  }
702  LOG_VERBATIM("ReadFitResults")
703  << "changed bin labels";
704 
705  gGuessHigh->SetMarkerStyle(22);
706  gGuessHigh->SetMarkerSize(2);
707  gGuessHigh->SetMarkerColor(kRed);
708  gGuessHigh->SetMaximum(1.5);
709  gGuessHigh->SetMinimum(-1.5);
710  if(namestyle==0) gGuessHigh->SetTitle("Converged value of shift;Shift;Converged value");
711  else gGuessHigh->SetTitle("Converged value of shift;Initial shift value;Converged value");
712  // gGuessHigh->GetYaxis()->SetTitleOffset(1.5);
713 
714  gGuessLow->SetMarkerStyle(23);
715  gGuessLow->SetMarkerSize(2);
716  gGuessLow->SetMarkerColor(kBlue);
717 
718  gDmsq32High->SetTitle("Converged value of #Delta m_{32}^{2};Shift;#Delta m_{32}^{2}");
719  gDmsq32High->SetMarkerStyle(22);
720  gDmsq32High->SetMarkerSize(2);
721  gDmsq32High->SetMarkerColor(kRed);
722 
723  gTh23High->SetTitle("Converged value of #theta_{23};Shift;#theta_{23}");
724  gTh23High->SetMarkerStyle(22);
725  gTh23High->SetMarkerSize(2);
726  gTh23High->SetMarkerColor(kRed);
727 
728  gssTh23High->SetTitle("Converged value of sin^{2} #theta_{23};Shift;sin^{2} #theta_{23}");
729  gssTh23High->SetMarkerStyle(22);
730  gssTh23High->SetMarkerSize(2);
731  gssTh23High->SetMarkerColor(kRed);
732 
733  gDmsq32Low->SetMarkerStyle(23);
734  gDmsq32Low->SetMarkerSize(2);
735  gDmsq32Low->SetMarkerColor(kBlue);
736 
737  gTh23Low->SetMarkerStyle(23);
738  gTh23Low->SetMarkerSize(2);
739  gTh23Low->SetMarkerColor(kBlue);
740 
741  gssTh23Low->SetMarkerStyle(23);
742  gssTh23Low->SetMarkerSize(2);
743  gssTh23Low->SetMarkerColor(kBlue);
744 
745  gChiSqHigh->SetTitle("Chi square of fit;Shift;Chi sqr");
746  if(namestyle==1)
747  {
748  gChiSqHigh->SetTitle(fshiftconvs[0].shiftName.c_str());
749  gChiSqHigh->GetXaxis()->SetTitle("Initial value of shift");
750  gChiSqHigh->GetYaxis()->SetTitle("Chi Sq");
751  }
752  gChiSqHigh->GetYaxis()->SetTitleOffset(1.5);
753  gChiSqHigh->SetMarkerStyle(7);
754 
755  gDmsq32ErrFracHigh->SetTitle("Change in #Delta m_{32}^{2} as a fraction of #sigma_{#Delta m_{32}^{2}};Shift;(converged #Delta m_{32}^{2} - input #Delta m_{32}^{2}) / #sigma_{#Delta m_{32}^{2}}");
756  gDmsq32ErrFracHigh->SetMarkerStyle(22);
757  gDmsq32ErrFracHigh->SetMarkerColor(kRed);
758  gDmsq32ErrFracHigh->SetMarkerSize(2);
759 
760  gssTh23ErrFracHigh->SetTitle("Change in sin^{2} #theta_{23} as a fraction of #sigma_{sin^{2} #theta_{23}};Shift;(converged sin^{2} #theta_{23} - input sin^{2} #theta_{23}) / #sigma_{sin^{2} #theta_{23}}");
761  gssTh23ErrFracHigh->SetMarkerStyle(22);
762  gssTh23ErrFracHigh->SetMarkerColor(kRed);
763  gssTh23ErrFracHigh->SetMarkerSize(2);
764 
765  gDmsq32ErrFracLow->SetMarkerStyle(23);
766  gDmsq32ErrFracLow->SetMarkerColor(kBlue);
767  gDmsq32ErrFracLow->SetMarkerSize(2);
768 
769  gssTh23ErrFracLow->SetMarkerStyle(23);
770  gssTh23ErrFracLow->SetMarkerColor(kBlue);
771  gssTh23ErrFracLow->SetMarkerSize(2);
772 
773  // //Make lines
774  TLine *lHigh = new TLine(0.,1.,gGuessHigh->GetXaxis()->GetXmax(),1.);
775  lHigh->SetLineColor(kRed);
776  lHigh->SetLineStyle(kDashed);
777  TLine *lLow = new TLine(0.,-1.,gGuessHigh->GetXaxis()->GetXmax(),-1.);
778  lLow->SetLineColor(kBlue);
779  lLow->SetLineStyle(kDashed);
780  TLine *lZero = new TLine(0.,0.,gGuessHigh->GetXaxis()->GetXmax(),0.);
781  lZero->SetLineColor(kBlack);
782  lZero->SetLineStyle(kDashed);
783  TLine *lDmsq32 = new TLine(0., input_Dmsq32, gDmsq32High->GetXaxis()->GetXmax(), input_Dmsq32);
784  lDmsq32->SetLineColor(kBlack);
785  lDmsq32->SetLineStyle(kDashed);
786  TLine *lTh23 = new TLine(0., input_Th23, gTh23High->GetXaxis()->GetXmax(), input_Th23);
787  lTh23->SetLineColor(kBlack);
788  lTh23->SetLineStyle(kDashed);
789  TLine *lssTh23 = new TLine(0., input_ssTh23, gssTh23High->GetXaxis()->GetXmax(), input_ssTh23);
790  lssTh23->SetLineColor(kBlack);
791  lssTh23->SetLineStyle(kDashed);
792 
793  TLegend * leg_High = new TLegend(0.11, 0.8, 0.5, 0.89);
794  leg_High->SetBorderSize(0);
795  leg_High->SetFillStyle(0);
796  leg_High->AddEntry(gGuessHigh, "Converged value for +#sigma shift", "p");
797  leg_High->AddEntry(gGuessLow, "Converged value for -#sigma shift", "p");
798  // TLegend * leg_Low = new TLegend(0.11, 0.31, 0.5, 0.4);
799  // leg_Low->SetBorderSize(0);
800  // leg_Low->SetFillStyle(0);
801  // leg_Low->AddEntry(gGuessLow, "Converged value for -#sigma shift", "p");
802  TLegend * leg_dmsq32 = new TLegend(0.5, 0.7, 0.89, 0.89);
803  leg_dmsq32->SetBorderSize(0);
804  leg_dmsq32->SetFillStyle(0);
805  leg_dmsq32->AddEntry(lDmsq32, "#Delta m_{32}^{2} = 2.44 x 10^{-3}: Input Value", "l");
806  leg_dmsq32->AddEntry(gDmsq32High, "Converged value for +#sigma shift", "p");
807  leg_dmsq32->AddEntry(gDmsq32Low, "Converged value for -#sigma shift", "p");
808  TLegend * leg_th23 = new TLegend(0.5, 0.7, 0.89, 0.89);
809  leg_th23->SetBorderSize(0);
810  leg_th23->SetFillStyle(0);
811  leg_th23->AddEntry(lTh23, "#theta_{23} = 0.843529: Input Value", "l");
812  leg_th23->AddEntry(gTh23High, "Converged value for +#sigma shift", "p");
813  leg_th23->AddEntry(gTh23Low, "Converged value for -#sigma shift", "p");
814  TLegend * leg_ssTh23 = new TLegend(0.5, 0.7, 0.89, 0.89);
815  leg_ssTh23->SetBorderSize(0);
816  leg_ssTh23->SetFillStyle(0);
817  leg_ssTh23->AddEntry(lssTh23, "sin^{2} #theta_{23} = 0.558: Input Value", "l");
818  leg_ssTh23->AddEntry(gssTh23High, "Converged value for +#sigma shift", "p");
819  leg_ssTh23->AddEntry(gssTh23Low, "Converged value for -#sigma shift", "p");
820 
821  c1->cd();
822  gGuessHigh->SetMaximum(1.1 * std::max(gGuessHigh->GetMaximum(), gGuessLow->GetMaximum()));
823  gGuessHigh->SetMinimum(0.9 * std::max(gGuessHigh->GetMinimum(), gGuessLow->GetMinimum()));
824  gGuessHigh->Draw("AP");
825  gGuessLow->Draw("same p");
826  lHigh->Draw();
827  lLow->Draw();
828  lZero->Draw();
829  leg_High->Draw();
830  // leg_Low->Draw();
831  c1->Write();
832 
833  c2->cd();
834  gChiSqHigh->Draw("APL");
835  c2->Write();
836 
837  c3->cd();
838  gDmsq32High->SetMaximum(2.44E-03 + 0.1E-03);
839  gDmsq32High->SetMinimum(2.44E-03 - 0.1E-03);
840  gDmsq32High->GetYaxis()->SetTitleOffset(1.5);
841  gDmsq32High->Draw("AP");
842  gDmsq32Low->Draw("SAME P");
843  lDmsq32->Draw();
844  leg_dmsq32->Draw();
845  c3->Write();
846 
847  c4->cd();
848  gTh23High->SetMaximum(0.843529 + 0.01);
849  gTh23High->SetMinimum(0.843529 - 0.01);
850  gTh23High->GetYaxis()->SetTitleOffset(1.5);
851  gTh23High->Draw("AP");
852  gTh23Low->Draw("SAME P");
853  lTh23->Draw();
854  leg_th23->Draw();
855  c4->Write();
856 
857  c5->cd();
858  gssTh23High->SetMaximum(0.558 + 0.2);
859  gssTh23High->SetMinimum(0.558 - 0.2);
860  gssTh23High->GetYaxis()->SetTitleOffset(1.5);
861  gssTh23High->Draw("AP");
862  gssTh23Low->Draw("SAME P");
863  lssTh23->Draw();
864  leg_ssTh23->Draw();
865  c5->Write();
866 
867  cDmsq32ErrFrac->cd();
868  gDmsq32ErrFracHigh->GetYaxis()->SetTitleOffset(1.5);
869  gDmsq32ErrFracHigh->Draw("AP");
870  gDmsq32ErrFracLow->Draw("SAME P");
871  cDmsq32ErrFrac->Write();
872 
873  cssTh23ErrFrac->cd();
874  gssTh23ErrFracHigh->GetYaxis()->SetTitleOffset(1.5);
875  gssTh23ErrFracHigh->Draw("AP");
876  gssTh23ErrFracLow->Draw("SAME P");
877  cssTh23ErrFrac->Write();
878 
879  return;
880  }
T max(const caf::Proxy< T > &a, T b)
art::ServiceHandle< art::TFileService > fTFS
TFileService.
enum BeamMode kRed
c2
Definition: demo5.py:33
std::vector< shiftconv > fshiftconvs
Systematic pulls for point results.
Float_t E
Definition: plot.C:20
T * make(ARGS...args) const
T sin(T number)
Definition: d0nt_math.hpp:132
c1
Definition: demo5.py:24
#define LOG_VERBATIM(category)
enum BeamMode kBlue
enum BeamMode string
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
template<class P >
void art::ResultsProducer::produces ( std::string const &  instanceName = {})
inlineprotectedinherited

Definition at line 159 of file ResultsProducer.h.

160 {
161  ProductRegistryHelper::produces<P, InResults>(instanceName);
162 }
void fnex::ReadFitResults::readResults ( art::Results const &  r)
virtual

Reimplemented from art::ResultsProducer.

Definition at line 312 of file ReadFitResults_plugin.cc.

References fnex::shiftconv::chiSq, fnex::PointResult::ChiSqr(), fnex::shiftconv::convergedDmsq32, fnex::shiftconv::convergedShift, fnex::shiftconv::convergedTh23, hadd_many_files::counter, allTimeWatchdog::endl, fnex::InputPoint::FixedSystematics(), fshiftconvs, fnex::shiftconv::initialShift, ip, novadaq::cnv::kFARDET, novadaq::cnv::kNEARDET, LOG_VERBATIM, LOG_WARNING, fnex::PointResult::ParameterSpaceLocation(), gammaraytel::pr, readSingleResults(), readVectorResults(), fnex::shiftconv::shiftName, fnex::PointResult::SystematicPulls(), fnex::InputPoint::SystematicPulls(), and APDHVSetting::temp.

313  {
314 
315  std::vector<fnex::PointResult> prvec;
316  std::vector<fnex::InputPoint> ipvec;
317  shiftconv temp;
318 
319  // check to see if we have single points stored in the
320  // results, and if not look for vectors of points.
321  // if none of those either, give up
322  if( !this->readSingleResults(r, prvec, ipvec) ){
323 
324  if( !this->readVectorResults(r, prvec, ipvec) ){
325  LOG_WARNING("ReadFitResults")
326  << "No valid handles to either single fnex::PointResult, fnex::InputPoint "
327  << "objects or vectors of them, skip this file";
328 
329  return;
330 
331  } // end if no vector point results
332 
333  } // end if no single point results
334 
335  // we found the results, so loop over the vectors and add them to the
336  // map
339  int counter = 0;
340  for(size_t p = 0; p < prvec.size(); ++p){
341 
342  LOG_VERBATIM("ReadFitResults") << "counter is " << counter << std::endl;
343  ++counter;
344 
345  pr = prvec[p];
346  ip = ipvec[p];
347 
348  bool infardet = false; //If we read in the results in the fardet results, we don't want to double up by reading the same thing in the neardet results
349  bool inneardet = false; //If there were no systematics floating, we probably still want Dmsq32 and Th23
350 
351  //fSysts.push_back(pr.SystematicPulls());
352  temp.convergedDmsq32 = pr.ParameterSpaceLocation(novadaq::cnv::kFARDET).at("Dmsq32");
353  temp.convergedTh23 = pr.ParameterSpaceLocation(novadaq::cnv::kFARDET).at("Th23");
354  for (const auto & systPull : ip.SystematicPulls(novadaq::cnv::kFARDET)){
355  LOG_VERBATIM("ReadFitResults")
356  << "NAME: "
357  << systPull.first
358  << " INITIAL GUESS: "
359  << systPull.second;
360 
361  //check if it's fixed: run through list of fixed systematics. if there's a match, it's fixed
362  bool isFixed = false;
363  for(auto fixedSystName : ip.FixedSystematics(novadaq::cnv::kFARDET))
364  if(!systPull.first.compare(fixedSystName)) isFixed = true;
365 
366  // if(systPull.first != "XsecCVWgt")// && systPull.second != 0)
367  if(!isFixed)
368  {
369  //const double& convpull = pr.SystematicPulls(novadaq::cnv::kFARDET).at(systPull.first);
370  //shiftconv temp = {systPull.first, systPull.second, pr.SystematicPulls(novadaq::cnv::kFARDET).at(systPull.first)};
371  temp.shiftName = systPull.first;
372  temp.initialShift = systPull.second;
373  temp.convergedShift = pr.SystematicPulls(novadaq::cnv::kFARDET).at(systPull.first);
374  temp.chiSq = pr.ChiSqr();
375  fshiftconvs.push_back(temp);
376  LOG_VERBATIM("ReadFitResults")
377  << "Shifter: "
378  << temp.shiftName
379  << " Initial val: "
380  << temp.initialShift
381  << " Converged val: "
382  << temp.convergedShift
383  << " ChiSq: "
384  << temp.chiSq;
385  //LOG_VERBATIM("ReadFitResults") << "Shifter: " << fshiftconvs[0].shiftName << " Initial val: " << fshiftconvs[0].initialShift << " Converged val: " << fshiftconvs[0].convergedShift << std::endl;
386 
387  infardet = true;
388  }
389  }
390 
391  // LOG_VERBATIM("ReadFitResults") << "any fardets? " << infardet << std::endl;
392  for (const auto & systPull : ip.SystematicPulls(novadaq::cnv::kNEARDET)){
393  LOG_VERBATIM("ReadFitResults")
394  << "NAME: "
395  << systPull.first
396  << " INITIAL GUESS: "
397  << systPull.second
398  << " CONVERGED: "
399  << pr.SystematicPulls(novadaq::cnv::kNEARDET).at(systPull.first);
400  if(!infardet && systPull.first != "XsecCVWgt")// && systPull.second != 0)
401  {
402  LOG_VERBATIM("ReadFitResults")
403  << "Found nothing in fardet, try neardet...";
404  //shiftconv temp = {systPull.first, systPull.second, pr.SystematicPulls(novadaq::cnv::kNEARDET).at(systPull.first)};
405  temp.shiftName = systPull.first;
406  temp.initialShift = systPull.second;
407  temp.convergedShift = pr.SystematicPulls(novadaq::cnv::kNEARDET).at(systPull.first);
408  temp.chiSq = pr.ChiSqr();
409  fshiftconvs.push_back(temp);
410  LOG_VERBATIM("ReadFitResults")
411  << "Shifter: "
412  << temp.shiftName
413  << " Initial val: "
414  << temp.initialShift
415  << " Converged val: "
416  << temp.convergedShift
417  << " ChiSq: "
418  << temp.chiSq
419  << std::endl
420  << "Shifter: "
421  << fshiftconvs[0].shiftName
422  << " Initial val: "
423  << fshiftconvs[0].initialShift
424  << " Converged val: "
425  << fshiftconvs[0].convergedShift;
426  inneardet = true;
427  }
428  }
429 
430  if (!infardet && !inneardet)
431  {
432  LOG_VERBATIM("ReadFitResults") << "Found nothing in fardet OR neardet: assume no systs floated, but we still want osc. pars\n";
433  temp.shiftName = Form("None%i", counter);
434  temp.initialShift = 0;
435  temp.convergedShift = 0;
436  temp.chiSq = pr.ChiSqr();
437  fshiftconvs.push_back(temp);
438  }
439 
440  //LOG_VERBATIM("ReadFitResults") << "Run with " << fshiftconvs.size() << " non-zero shift" << std::endl << std::endl;
441  /*if(pr.ChiSqr() >= 0){
442  this->AddPointToMap(ip, pr);
443  }
444  else{
445  // if the chi^2 = -1, that is a stupid number, so
446  // create a new PointResult with a very large chiSqr
447  // I am assuming that a value of -1 means the fit did not
448  // converge, so substitute it for a stupidly large chi^2
449  LOG_VERBATIM("ReadFitResults")
450  << "switching chi^2 for "
451  << ip
452  << " "
453  << pr.ChiSqr();
454 
455  pr = fnex::PointResult(std::numeric_limits<double>::max(),
456  -1,
457  pr.ParameterSpaceLocation(),
458  pr.SystematicPulls());
459  this->AddPointToMap(ip, pr);
460  }*/
461 
462  } // end loop over points found in file
463 
464  return;
465  }
const char * p
Definition: xmltok.h:285
TString ip
Definition: loadincs.C:5
ParameterDetMap const SystematicPulls() const
bool readVectorResults(art::Results const &r, std::vector< fnex::PointResult > &prvec, std::vector< fnex::InputPoint > &ipvec)
std::vector< std::string > const & FixedSystematics(novadaq::cnv::DetId const &det) const
Definition: InputPoint.cxx:404
Far Detector at Ash River, MN.
std::vector< shiftconv > fshiftconvs
Systematic pulls for point results.
Near Detector in the NuMI cavern.
double const & ChiSqr() const
Definition: PointResult.h:70
ParameterDetMap const ParameterSpaceLocation() const
Definition: PointResult.cxx:82
#define LOG_WARNING(category)
TRandom3 r(0)
#define LOG_VERBATIM(category)
bool readSingleResults(art::Results const &r, std::vector< fnex::PointResult > &prvec, std::vector< fnex::InputPoint > &ipvec)
ParameterMap const SystematicPulls(novadaq::cnv::DetId const &det) const
Definition: InputPoint.cxx:364
bool fnex::ReadFitResults::readSingleResults ( art::Results const &  r,
std::vector< fnex::PointResult > &  prvec,
std::vector< fnex::InputPoint > &  ipvec 
)
private

Definition at line 199 of file ReadFitResults_plugin.cc.

References art::DataViewImpl::getByLabel(), ip, art::Handle< T >::isValid(), LOG_WARNING, and gammaraytel::pr.

Referenced by readResults().

202  {
203  prvec.resize(1);
204  ipvec.resize(1);
205 
206  // get the FitPoints from the output files
208  //r.getByLabel(fPointLabel, pr);
209  //r.getByLabel("fit", pr);
210 
211  // get the InputPoints from the output files - need these when
212  // attempting to make FC contours when there are many results for each
213  // InputPoint
215  //r.getByLabel("fit", ip);
216  //r.getByLabel(fPointLabel, ip);
217 
218 
219  r.getByLabel("fit#Dmsq32Th23", pr);
220  r.getByLabel("fit#Dmsq32Th23", ip);
221 
222  // check that the handles are valid, add the points to the map
223  // and move along
224  if( !ip.isValid() || !pr.isValid() ){
225 
226  // see if the alternative label works
227  r.getByLabel("plot#plotPoint", pr);
228  r.getByLabel("plot#plotPoint", ip);//fAltPointLabel, ip);
229 
230  //r.getByLabel("plot",pr);
231  //r.getByLabel("plot",ip);
232 
233  if( !ip.isValid() || !pr.isValid() ){
234  LOG_WARNING("ReadFitResults")
235  << "unable to find any results in either\n"
236  << "fit#Dmsq32Th23"//fPointLabel
237  //<< "fit#Dmsq32Th23 << ""
238  << "\n or "
239  << "plot#plotPoint";
240 
241  // no valid handles, clear the vectors.
242  prvec.clear();
243  ipvec.clear();
244 
245  return false;
246  }
247 
248  }
249 
250  // got here, so we have valid handles
251  prvec[0] = *pr;
252  ipvec[0] = *ip;
253 
254  return true;
255  }
TString ip
Definition: loadincs.C:5
bool isValid() const
Definition: Handle.h:189
#define LOG_WARNING(category)
TRandom3 r(0)
bool fnex::ReadFitResults::readVectorResults ( art::Results const &  r,
std::vector< fnex::PointResult > &  prvec,
std::vector< fnex::InputPoint > &  ipvec 
)
private

Definition at line 258 of file ReadFitResults_plugin.cc.

References fPointLabel, art::DataViewImpl::getByLabel(), art::Handle< T >::isValid(), and LOG_WARNING.

Referenced by readResults().

260  {
261  prvec.clear();
262  ipvec.clear();
263 
264  // individual point handles are not valid, what about vectors of them?
266  r.getByLabel(fPointLabel, prhand);
267 
269  r.getByLabel(fPointLabel, iphand);
270 
271  if( !prhand.isValid() || !iphand.isValid() ){
272 
273  // see if the alternative label works
274  //r.getByLabel(fAltPointLabel, prhand);
275  //r.getByLabel(fAltPointLabel, iphand);
276 
277  r.getByLabel("plot", prhand);
278  r.getByLabel("plot", iphand);
279 
280  if( !prhand.isValid() || !iphand.isValid() ){
281 
282  LOG_WARNING("ReadFitResults")
283  << "PointResult handle isValid: "
284  << prhand.isValid()
285  << " InputPoint handle isValid: "
286  << iphand.isValid();
287 
288  return false;
289  } // end if the alternate label still does not make valid handles.
290  } // end if the handles are not valid
291 
292  // check that the vectors are the same size, we assume that the entries
293  // in each spot of the vectors go together
294  if( prhand->size() != iphand->size() )
295  throw cet::exception("ReadFitResults")
296  << "PointResult and InputPoint vectors have different sizes, "
297  << "not sure we can do anything with these data so bail";
298 
299  // fill the vectors
300  prvec.resize(prhand->size());
301  ipvec.resize(iphand->size());
302 
303  for(size_t p = 0; p < prhand->size(); ++p){
304  prvec[p] = (*prhand)[p];
305  ipvec[p] = (*iphand)[p];
306  }
307 
308  return true;
309  }
const char * p
Definition: xmltok.h:285
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
bool isValid() const
Definition: Handle.h:189
#define LOG_WARNING(category)
std::string fPointLabel
label of plugin storing the points
TRandom3 r(0)
void fnex::ReadFitResults::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 111 of file ReadFitResults_plugin.cc.

References fAltPointLabel, fParam1Enum, fParam1Scale, fParam2Enum, fParam2Scale, fPointLabel, fhicl::ParameterSet::get(), fnex::kDmsq32, fnex::kTh13, fnex::kTh23, LOG_DEBUG, LOG_VERBATIM, make_pair(), string, and std::swap().

112  {
113 
114  fPointLabel = pset.get<std::string>("PointLabel");
115 
116  auto hashPos = fPointLabel.find("#" );
117  auto Dmsq32Pos = fPointLabel.find("Dmsq32");
118  auto Th13Pos = fPointLabel.find("Th13" );
119  auto Th23Pos = fPointLabel.find("Th23" );
120 
121  LOG_DEBUG("ReadFitResults")
122  << "\nLabel: " << fPointLabel
123  << "\n\tDmsq32Pos: " << Dmsq32Pos
124  << "\n\tTh13Pos: " << Th13Pos
125  << "\n\tTh23Pos: " << Th23Pos;
126 
127  std::string subPar1;
128  std::string subPar2;
129 
130  if(hashPos == std::string::npos)
131  throw cet::exception("ReadFitResults")
132  << "cannot find the # in the input label, something is wrong";
133 
134  if(Dmsq32Pos != std::string::npos){
135  if(Dmsq32Pos > hashPos+2){
137  fParam2Scale = std::make_pair(1.e3, " (#times10^{-3} GeV^{2})");
138  subPar2 = fPointLabel.substr(Dmsq32Pos, 6);
139  }
140  else{
142  fParam1Scale = std::make_pair(1.e3, " (#times10^{-3} GeV^{2})");
143  subPar1 = fPointLabel.substr(Dmsq32Pos, 6);
144  }
145  }
146 
147  if(Th13Pos != std::string::npos){
148  if(Th13Pos > hashPos+2){
150  fParam2Scale = std::make_pair(1./3.14159, " (#pi rad)");
151  subPar2 = fPointLabel.substr(Th13Pos, 4);
152  }
153  else{
155  fParam1Scale = std::make_pair(1./3.14159, " (#pi rad)");
156  subPar1 = fPointLabel.substr(Th13Pos, 4);
157  }
158  }
159 
160  if(Th23Pos != std::string::npos){
161  if(Th23Pos > hashPos+2){
162  subPar2 = fPointLabel.substr(Th23Pos, 4);
164  //if(!fUseTrig) fParam2Scale = std::make_pair(1./3.14159, " (#pi rad)");
165  }
166  else{
167  subPar1 = fPointLabel.substr(Th23Pos, 4);
169  //if(!fUseTrig) fParam1Scale = std::make_pair(1./3.14159, " (#pi rad)");
170  }
171  }
172 
173  fAltPointLabel = fPointLabel.substr(0, hashPos+1) + subPar2 + subPar1;
174 
175  // we always want Delta m^2 to be on the y axis, and the 2D drawing
176  // method always puts parameter 1 on the x axis...so make sure
177  // Delta m^2 is in the parameter 2 spot
178  if(fParam1Enum == fnex::kDmsq32){
181  }
182 
183  LOG_VERBATIM("ReadFitResults")
184  << "Alternate label is "
185  << fAltPointLabel;
186 
187  return;
188  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
fnex::OscParm_t fParam1Enum
enumerated value of the parameter from FNEX/dataProducts/Constants.h
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
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
std::string fAltPointLabel
reverse the order of the parameters in the label
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
std::pair< double, std::string > fParam2Scale
scale the parameter if necessary ie is x10^{-3}, string is latex friendly
std::pair< double, std::string > fParam1Scale
scale the parameter if necessary ie is x10^{-3}, string is latex friendly
std::string fPointLabel
label of plugin storing the points
#define LOG_VERBATIM(category)
fnex::OscParm_t fParam2Enum
enumerated value of the parameter from FNEX/dataProducts/Constants.h
enum BeamMode string
void art::ResultsProducer::registerProducts ( MasterProductRegistry mpr,
ProductDescriptions producedProducts,
ModuleDescription const &  md 
)
inlineinherited

Definition at line 128 of file ResultsProducer.h.

References fetch_tb_beamline_files::md, and art::ProductRegistryHelper::registerProducts().

Referenced by art::RootOutput::doRegisterProducts().

131  {
132  ProductRegistryHelper::registerProducts(mpr, producedProducts, md);
134  }
void registerProducts(MasterProductRegistry &mpr, ProductDescriptions &productsToRegister, ModuleDescription const &md)
cet::exempt_ptr< ModuleDescription const > moduleDescription_
void art::Consumer::setModuleDescription ( ModuleDescription const &  md)
protectedinherited
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
void fnex::ReadFitResults::writeResults ( art::Results r)
virtual

Implements art::ResultsProducer.

Definition at line 468 of file ReadFitResults_plugin.cc.

469  {
470  // not writing anything to the file for this plugin at this time
471 
472  return;
473  } // end writeResults

Member Data Documentation

std::string fnex::ReadFitResults::fAltPointLabel
private

reverse the order of the parameters in the label

Definition at line 81 of file ReadFitResults_plugin.cc.

Referenced by reconfigure().

fnex::OscParm_t fnex::ReadFitResults::fParam1Enum
private

enumerated value of the parameter from FNEX/dataProducts/Constants.h

Definition at line 82 of file ReadFitResults_plugin.cc.

Referenced by reconfigure().

std::pair<double, std::string> fnex::ReadFitResults::fParam1Scale
private

scale the parameter if necessary ie is x10^{-3}, string is latex friendly

Definition at line 84 of file ReadFitResults_plugin.cc.

Referenced by reconfigure().

fnex::OscParm_t fnex::ReadFitResults::fParam2Enum
private

enumerated value of the parameter from FNEX/dataProducts/Constants.h

Definition at line 83 of file ReadFitResults_plugin.cc.

Referenced by reconfigure().

std::pair<double, std::string> fnex::ReadFitResults::fParam2Scale
private

scale the parameter if necessary ie is x10^{-3}, string is latex friendly

Definition at line 85 of file ReadFitResults_plugin.cc.

Referenced by reconfigure().

std::string fnex::ReadFitResults::fPointLabel
private

label of plugin storing the points

Definition at line 80 of file ReadFitResults_plugin.cc.

Referenced by readVectorResults(), and reconfigure().

PointResMap fnex::ReadFitResults::fPointResMap
private

Initial point passed to fitter, typedef above.

Definition at line 79 of file ReadFitResults_plugin.cc.

std::vector<shiftconv> fnex::ReadFitResults::fshiftconvs
private

Systematic pulls for point results.

Definition at line 88 of file ReadFitResults_plugin.cc.

Referenced by plotResults(), and readResults().

std::unique_ptr<art::TFileDirectory> fnex::ReadFitResults::fTFD_Showcase
private

And 'showcase' folders (for final results)

Definition at line 78 of file ReadFitResults_plugin.cc.

std::unique_ptr<art::TFileDirectory> fnex::ReadFitResults::fTFD_Working
private

Split saved items into Working.

Definition at line 77 of file ReadFitResults_plugin.cc.

art::ServiceHandle<art::TFileService> fnex::ReadFitResults::fTFS
private

TFileService.

Definition at line 76 of file ReadFitResults_plugin.cc.

Referenced by plotResults().


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