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

Public Types

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

Public Member Functions

 SensitivityPointsMaker (fhicl::ParameterSet const &pset)
 
virtual ~SensitivityPointsMaker ()
 
void readResults (art::Results const &r)
 
void writeResults (art::Results &r)
 
void reconfigure (const fhicl::ParameterSet &p)
 
void clear ()
 
void beginJob ()
 
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

double ChiSqrForInputPoint (fnex::InputPoint &ip, double const &Par1Val, double const &Par2Val)
 
double MultiExperimentChiSqrForInputPoint (fnex::InputPoint &ip, double const &Par1Val, double const &Par2Val)
 
double CovarianceFitChiSqrForInputPoint (fnex::InputPoint &ip)
 

Private Attributes

double fMinPar1
 minimum value of Parameter 1 More...
 
double fMaxPar1
 maximum value of Parameter 1 More...
 
double fMinPar2
 minimum value of Parameter 2 More...
 
double fMaxPar2
 maximum value of Parameter 2 More...
 
int fNumDivisions
 number of divisions in each direction of space More...
 
bool fSaveAllPlots
 
bool fUseTrig
 turn on testing in trig function space for angles More...
 
bool fUseTrigPar1
 turn on testing in trig function space for Parameter1 More...
 
bool fUseTrigPar2
 turn on testing in trig function space for Parameter2 More...
 
std::string fAxisPar1
 Axis on which you want to plot Parameter1. More...
 
std::string fAxisPar2
 Axis on which you want to plot Parameter2. More...
 
std::string fNamePar1
 Name of the Parameter1. More...
 
std::string fNamePar2
 Name of the Parameter2. More...
 
fnex::FitType_t fFitType
 
fhicl::ParameterSet fMultiExperimentParameters
 parameter set for all experiments to run More...
 
std::unique_ptr< fnex::MultiExperimentfMultiExperiment
 Multiexperiment. More...
 
fnex::EventListMap fEventLists
 the lists of events we are going to use, data and MC More...
 
std::unique_ptr< fnex::EventListManipulatorfManipulator
 helper object to work with event lists from TTree More...
 
std::unique_ptr< fnex::InputPointfInitialGuessInputPoint
 Initial point passed to fitter. More...
 
std::unique_ptr< fnex::CovarianceFitHelperfFitHelper
 covariance fit helper class More...
 

Detailed Description

Definition at line 42 of file SensitivityPointsMaker_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::SensitivityPointsMaker::SensitivityPointsMaker ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 88 of file SensitivityPointsMaker_plugin.cc.

References reconfigure().

89  {
90  this->reconfigure(pset);
91 
92  produces<std::vector<fnex::InputPoint> >();
93  produces<std::vector<fnex::PointResult> >();
94 
95  return;
96  }
void reconfigure(const fhicl::ParameterSet &p)
fnex::SensitivityPointsMaker::~SensitivityPointsMaker ( )
virtual

Definition at line 99 of file SensitivityPointsMaker_plugin.cc.

100  {
101 
102  }

Member Function Documentation

void fnex::SensitivityPointsMaker::beginJob ( )
virtual

Reimplemented from art::ResultsProducer.

Definition at line 152 of file SensitivityPointsMaker_plugin.cc.

References fFitHelper.

153  {
154  if(fFitHelper.get() != nullptr) fFitHelper->Initialize();
155 
156  return;
157  }
std::unique_ptr< fnex::CovarianceFitHelper > fFitHelper
covariance fit helper class
double fnex::SensitivityPointsMaker::ChiSqrForInputPoint ( fnex::InputPoint ip,
double const &  Par1Val,
double const &  Par2Val 
)
private

Definition at line 198 of file SensitivityPointsMaker_plugin.cc.

References CovarianceFitChiSqrForInputPoint(), fFitType, fnex::kCovarianceFit, and MultiExperimentChiSqrForInputPoint().

Referenced by writeResults().

201  {
203 
204  return this->MultiExperimentChiSqrForInputPoint(ip, Par1Val, Par2Val);
205  }
double MultiExperimentChiSqrForInputPoint(fnex::InputPoint &ip, double const &Par1Val, double const &Par2Val)
double CovarianceFitChiSqrForInputPoint(fnex::InputPoint &ip)
void fnex::SensitivityPointsMaker::clear ( )
virtual

Implements art::ResultsProducer.

Definition at line 162 of file SensitivityPointsMaker_plugin.cc.

References fEventLists.

163  {
164  fEventLists.clear();
165  return;
166  }
fnex::EventListMap fEventLists
the lists of events we are going to use, data and MC
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
double fnex::SensitivityPointsMaker::CovarianceFitChiSqrForInputPoint ( fnex::InputPoint ip)
private

Definition at line 270 of file SensitivityPointsMaker_plugin.cc.

References fFitHelper, fnex::ShifterAndWeighter::Instance(), LOG_DEBUG, and fnex::ShifterAndWeighter::SetCurrentVals().

Referenced by ChiSqrForInputPoint().

271  {
272  // Make the new input point and then set the ShifterAndWeighter to use it
273  fFitHelper->UpdateInputPoint(ip);
274 
275  // Now update the ShifterAndWeighter to check the goodness of fit
277 
278  LOG_DEBUG("CovarianceMatrixFitter")
279  << "fill the MC spectrum with the new values";
280 
281  // fill the MC spectrum
282  fFitHelper->FillMCSpectrum();
283 
284  LOG_DEBUG("CovarianceMatrixFitter")
285  << "get the new chi^2";
286 
287  // Get Chisq
288  return fFitHelper->ChiSqr();
289  }
void SetCurrentVals(fnex::InputPoint const &curPoint)
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
std::unique_ptr< fnex::CovarianceFitHelper > fFitHelper
covariance fit helper class
static ShifterAndWeighter * Instance()
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
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
double fnex::SensitivityPointsMaker::MultiExperimentChiSqrForInputPoint ( fnex::InputPoint ip,
double const &  Par1Val,
double const &  Par2Val 
)
private

Definition at line 208 of file SensitivityPointsMaker_plugin.cc.

References fetch_tb_beamline_files::experiment, fMultiExperiment, fNamePar1, fNamePar2, fSaveAllPlots, LOG_VERBATIM, art::TFileDirectory::mkdir(), and string.

Referenced by ChiSqrForInputPoint().

211  {
212 
213  // Apply the event list map and point
214  fMultiExperiment->ApplyPoint(ip);
215 
216  // Get ART file service
217  if(fSaveAllPlots){
218  std::stringstream ss_foldername;
219  ss_foldername.str("");
220  ss_foldername << "fitpoint_hist_"
221  << fNamePar1
222  << "_"
223  << std::setprecision(5)
224  << std::fixed
225  << Par1Val
226  << "_"
227  << fNamePar2
228  << "_"
229  << std::setprecision(5)
230  << std::fixed
231  << Par2Val;
232 
233  LOG_VERBATIM("SensitivityPointsMaker")
234  << "File service";
235 
237 
238  LOG_VERBATIM("SensitivityPointsMaker")
239  << "Makedir";
240 
241  std::string foldername = ss_foldername.str();
242  size_t dotLoc = foldername.find('.');
243  while( dotLoc !=std::string::npos){
244  foldername.replace(dotLoc, 1, "_");
245  dotLoc = foldername.find('.');
246  }
247 
248  LOG_VERBATIM("SensitivityPointsMaker")
249  << " Saving to folder: "
250  << foldername;
251 
252  art::TFileDirectory mexpDir = tfs->mkdir( foldername.data() );
253 
254  LOG_VERBATIM("SensitivityPointsMaker")
255  << "ListExperiments";
256 
257  for(auto & experiment : fMultiExperiment->ListExperiments()){
258  LOG_VERBATIM("SensitivityPointsMaker")
259  << " This Experiment";
260 
261  experiment->DrawPlots(&mexpDir);
262  }
263  }
264 
265  // Grab ChiSq
266  return fMultiExperiment->FitValue();
267  }
std::unique_ptr< fnex::MultiExperiment > fMultiExperiment
Multiexperiment.
TFileDirectory mkdir(std::string const &dir, std::string const &descr="")
std::string fNamePar2
Name of the Parameter2.
std::string fNamePar1
Name of the Parameter1.
#define LOG_VERBATIM(category)
enum BeamMode string
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
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::SensitivityPointsMaker::readResults ( art::Results const &  r)
virtual

Reimplemented from art::ResultsProducer.

Definition at line 169 of file SensitivityPointsMaker_plugin.cc.

References fEventLists, fFitHelper, fFitType, fManipulator, fMultiExperiment, fnex::kCovarianceFit, fnex::kMultiExperiment, and LOG_VERBATIM.

170  {
171 
172  // the following lines are commented out until we can read the
173  // fnex::EventLists from the art file
174  // get the fnex::EventList objects for all the relevant lists
175  //art::Handle<fnex::EventList> lists;
176  //evt.getByLabel(fClusterInput, hSlices);
177 
178  //================================
179  // the code between these lines of ==== is the workaround for not being able
180  // to read in the fnex::EventLists from the art file
182  fEventLists = fManipulator->Deserialize();
183 
184  // Apply the event list map and point
185  LOG_VERBATIM("SensitivityPointsMaker") << "SetEventListMap\n";
186  fMultiExperiment->SetEventListMap(fEventLists);
187  }
188  else if(fFitType == fnex::kCovarianceFit){
189  fFitHelper->FillDataSpectrum();
190  fFitHelper->FillCovarianceMatrix();
191  }
192  //================================
193 
194  return;
195  }
fnex::EventListMap fEventLists
the lists of events we are going to use, data and MC
std::unique_ptr< fnex::MultiExperiment > fMultiExperiment
Multiexperiment.
std::unique_ptr< fnex::CovarianceFitHelper > fFitHelper
covariance fit helper class
std::unique_ptr< fnex::EventListManipulator > fManipulator
helper object to work with event lists from TTree
#define LOG_VERBATIM(category)
void fnex::SensitivityPointsMaker::reconfigure ( const fhicl::ParameterSet p)

Definition at line 105 of file SensitivityPointsMaker_plugin.cc.

References fAxisPar1, fAxisPar2, fFitHelper, fFitType, fInitialGuessInputPoint, fManipulator, fMaxPar1, fMaxPar2, fMinPar1, fMinPar2, fMultiExperiment, fMultiExperimentParameters, fNamePar1, fNamePar2, fNumDivisions, fSaveAllPlots, fUseTrig, fUseTrigPar1, fUseTrigPar2, fhicl::ParameterSet::get(), fnex::kCovarianceFit, fnex::kMultiExperiment, and string.

Referenced by SensitivityPointsMaker().

106  {
107  fMinPar1 = pset.get<double >("MinPar1", 0. );
108  fMaxPar1 = pset.get<double >("MaxPar1", 1. );
109  fMinPar2 = pset.get<double >("MinPar2", 0. );
110  fMaxPar2 = pset.get<double >("MaxPar2", 1. );
111  fNumDivisions = pset.get<int >("NumDivisions", 5 );
112  fSaveAllPlots = pset.get<bool >("SaveAllPlots", false );
113  fUseTrig = pset.get<bool >("UseTrig", false );
114  fUseTrigPar1 = pset.get<bool >("UseTrigPar1", false );
115  fUseTrigPar2 = pset.get<bool >("UseTrigPar2", false );
116  fAxisPar1 = pset.get<std::string >("AxisPar1", "X" );
117  fAxisPar2 = pset.get<std::string >("AxisPar2", "Y" );
118  fNamePar1 = pset.get<std::string >("NamePar1", " " );
119  fNamePar2 = pset.get<std::string >("NamePar2", " " );
120 
121  auto fitTypeStr = pset.get<std::string>("FitType", "MultiExperiment");
122  if(fitTypeStr.find("MultiExperiment") != std::string::npos) fFitType = fnex::kMultiExperiment;
123  else if(fitTypeStr.find("CovarianceFit") != std::string::npos) fFitType = fnex::kCovarianceFit;
124  else{
125  throw cet::exception("SensitivityPointsMaker") << "Unknown fit type requested in configuration";
126  }
127 
128  // grab the initial guess
129  // create the input point and put it into the data member
130  // Make input point
131  fInitialGuessInputPoint = std::make_unique<InputPoint>(pset.get< fhicl::ParameterSet>("InitialGuessInputPoint"));
132 
134  fMultiExperimentParameters = pset.get< fhicl::ParameterSet>("MultiExperimentParameters");
135 
136  // create the unique_ptr to the MultiExperiment
137  fMultiExperiment = std::make_unique<fnex::MultiExperiment>(fMultiExperimentParameters);
138 
139  // create the manipulator
140  fManipulator = std::make_unique<fnex::EventListManipulator>(pset.get<fhicl::ParameterSet>("EventListManipulator"),
142  }
143  else if(fFitType == fnex::kCovarianceFit){
144  fFitHelper = std::make_unique<fnex::CovarianceFitHelper>();
145  fFitHelper->reconfigure(pset.get<fhicl::ParameterSet>("FitHelperParameters"));
146  }
147 
148  return;
149  }
bool fUseTrigPar1
turn on testing in trig function space for Parameter1
std::unique_ptr< fnex::MultiExperiment > fMultiExperiment
Multiexperiment.
std::unique_ptr< fnex::CovarianceFitHelper > fFitHelper
covariance fit helper class
double fMinPar1
minimum value of Parameter 1
std::string fNamePar2
Name of the Parameter2.
fhicl::ParameterSet fMultiExperimentParameters
parameter set for all experiments to run
std::string fAxisPar1
Axis on which you want to plot Parameter1.
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
bool fUseTrigPar2
turn on testing in trig function space for Parameter2
double fMaxPar2
maximum value of Parameter 2
double fMinPar2
minimum value of Parameter 2
int fNumDivisions
number of divisions in each direction of space
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::string fAxisPar2
Axis on which you want to plot Parameter2.
std::string fNamePar1
Name of the Parameter1.
std::unique_ptr< fnex::InputPoint > fInitialGuessInputPoint
Initial point passed to fitter.
std::unique_ptr< fnex::EventListManipulator > fManipulator
helper object to work with event lists from TTree
bool fUseTrig
turn on testing in trig function space for angles
double fMaxPar1
maximum value of Parameter 1
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::SensitivityPointsMaker::writeResults ( art::Results r)
virtual

Implements art::ResultsProducer.

Definition at line 292 of file SensitivityPointsMaker_plugin.cc.

References std::asin(), ChiSqrForInputPoint(), DEFINE_ART_RESULTS_PLUGIN, fInitialGuessInputPoint, fMaxPar1, fMaxPar2, fMinPar1, fMinPar2, fNamePar1, fNamePar2, fNumDivisions, fUseTrigPar1, fUseTrigPar2, novadaq::cnv::kFARDET, novadaq::cnv::kNEARDET, LOG_VERBATIM, art::Results::put(), std::sqrt(), submit_syst::x, and submit_syst::y.

293  {
294  std::unique_ptr<std::vector<fnex::InputPoint > > ipvec(new std::vector<fnex::InputPoint>() );
295  std::unique_ptr<std::vector<fnex::PointResult> > prvec(new std::vector<fnex::PointResult>() );
296 
297  // Get the input point
298 
299  // Add the initial point (should be best fit point for high statistics)
300  //ipvec->emplace_back(fInputPoint.ParameterSpaceLocation());
301  //fMultiExperiment->ApplyPoint(fInputPoint);
302  //double chiSqrInitial = fMultiExperiment->FitValue();
303  //prvec->emplace_back(chiSqrInitial,
304  // fInputPoint.ParameterSpaceLocation(),
305  // fInputPoint.SystematicPulls());
306 
307  // Set up a default ParameterDetMap
308  fnex::ParameterDetMap oscMap = fInitialGuessInputPoint->ParameterSpaceLocation();
309  fnex::ParameterDetMap systMap = fInitialGuessInputPoint->SystematicPulls();
310  std::vector<fnex::ParameterDet> fixedOsc = fInitialGuessInputPoint->FixedParameters();
311  std::vector<fnex::ParameterDet> fixedSyst = fInitialGuessInputPoint->FixedSystematics();
312 
313  // loop over the space and set the oscMap values for Parameter 1
314  // and Parameter 2 appropriately for the input points.
315 
316  // the results will be faked up to have the lowest chi&2 in the middle
317  // of the space with a quadratic in x and y to specify the chi^2 values
318  double Par1Val = 0.;
319  double Par1Div = (fMaxPar1 - fMinPar1) / (1. * fNumDivisions);
320  double Par2Val = 0.;
321  double Par2Div = (fMaxPar2 - fMinPar2) / (1. * fNumDivisions);
322  double chiSqr = 0.;
323 
324  fnex::ParameterDet farPar ("unknown", novadaq::cnv::kFARDET );
325  fnex::ParameterDet nearPar("unknown", novadaq::cnv::kNEARDET);
326 
327  //TODO: Add some logic here so that the fhicl parameters can decide
328  //whether Par1 need to be on the x axis or the y axis and
329  //similarly for the Par2
330  for(int x = 0; x < fNumDivisions + 1; ++x){
331 
332  farPar.first = fNamePar1;
333  nearPar.first = fNamePar1;
334  Par1Val = (x * Par1Div) + fMinPar1;
335  oscMap[farPar] = (fUseTrigPar1) ? std::asin(std::sqrt(Par1Val)) : Par1Val;
336  oscMap[nearPar] = (fUseTrigPar1) ? std::asin(std::sqrt(Par1Val)) : Par1Val;
337 
338  for(int y = 0; y < fNumDivisions + 1; ++y){
339 
340  farPar.first = fNamePar2;
341  nearPar.first = fNamePar2;
342  Par2Val = (y * Par2Div) + fMinPar2;
343  oscMap[farPar] = (fUseTrigPar2) ? std::asin(std::sqrt(Par2Val)) : Par2Val;
344  oscMap[nearPar] = (fUseTrigPar2) ? std::asin(std::sqrt(Par2Val)) : Par2Val;
345 
346  ipvec->emplace_back(oscMap, systMap, fixedOsc, fixedSyst);
347  InputPoint fip(oscMap, systMap, fixedOsc, fixedSyst);
348 
349  chiSqr = this->ChiSqrForInputPoint(fip,
350  Par1Val,
351  Par2Val);
352 
353  // Debug output (if this is official version, should not be present!)
354  LOG_VERBATIM("GeneralizedSensitivityPointsMaker")
355  << " "
356  << fNamePar1
357  << " Par1: "
358  << Par1Val
359  << " "
360  << fNamePar2
361  << " Par2: "
362  << Par2Val
363  << " ChiSq: "
364  << chiSqr;
365 
366  // we did not do a fit, so the status code can be 0
367  prvec->emplace_back(chiSqr, 0, oscMap, systMap);
368  LOG_VERBATIM("SensitivityPointsMaker")
369  << "PointResult Values "
370  << fip;
371 
372  } // end loop over Y (Delta m^{2}_{23}
373  } // end loop over X (theta_23)
374  r.put(std::move(ipvec));
375  r.put(std::move(prvec));
376 
377  return;
378  } // end writeResults
bool fUseTrigPar1
turn on testing in trig function space for Parameter1
double fMinPar1
minimum value of Parameter 1
T sqrt(T number)
Definition: d0nt_math.hpp:156
std::string fNamePar2
Name of the Parameter2.
art::ProductID put(std::unique_ptr< PROD > &&product)
Definition: Results.h:78
bool fUseTrigPar2
turn on testing in trig function space for Parameter2
double fMaxPar2
maximum value of Parameter 2
double fMinPar2
minimum value of Parameter 2
Far Detector at Ash River, MN.
int fNumDivisions
number of divisions in each direction of space
Near Detector in the NuMI cavern.
std::unordered_map< ParameterDet, double, ParameterDetHasher > ParameterDetMap
Definition: Constants.h:63
std::string fNamePar1
Name of the Parameter1.
double ChiSqrForInputPoint(fnex::InputPoint &ip, double const &Par1Val, double const &Par2Val)
std::unique_ptr< fnex::InputPoint > fInitialGuessInputPoint
Initial point passed to fitter.
std::pair< std::string, novadaq::cnv::DetId > ParameterDet
Definition: Constants.h:38
#define LOG_VERBATIM(category)
double fMaxPar1
maximum value of Parameter 1
T asin(T number)
Definition: d0nt_math.hpp:60

Member Data Documentation

std::string fnex::SensitivityPointsMaker::fAxisPar1
private

Axis on which you want to plot Parameter1.

Definition at line 72 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure().

std::string fnex::SensitivityPointsMaker::fAxisPar2
private

Axis on which you want to plot Parameter2.

Definition at line 73 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure().

fnex::EventListMap fnex::SensitivityPointsMaker::fEventLists
private

the lists of events we are going to use, data and MC

Definition at line 80 of file SensitivityPointsMaker_plugin.cc.

Referenced by clear(), and readResults().

std::unique_ptr<fnex::CovarianceFitHelper> fnex::SensitivityPointsMaker::fFitHelper
private

covariance fit helper class

Definition at line 83 of file SensitivityPointsMaker_plugin.cc.

Referenced by beginJob(), CovarianceFitChiSqrForInputPoint(), readResults(), and reconfigure().

fnex::FitType_t fnex::SensitivityPointsMaker::fFitType
private

Definition at line 77 of file SensitivityPointsMaker_plugin.cc.

Referenced by ChiSqrForInputPoint(), readResults(), and reconfigure().

std::unique_ptr<fnex::InputPoint> fnex::SensitivityPointsMaker::fInitialGuessInputPoint
private

Initial point passed to fitter.

Definition at line 82 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure(), and writeResults().

std::unique_ptr<fnex::EventListManipulator> fnex::SensitivityPointsMaker::fManipulator
private

helper object to work with event lists from TTree

Definition at line 81 of file SensitivityPointsMaker_plugin.cc.

Referenced by readResults(), and reconfigure().

double fnex::SensitivityPointsMaker::fMaxPar1
private

maximum value of Parameter 1

Definition at line 64 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure(), and writeResults().

double fnex::SensitivityPointsMaker::fMaxPar2
private

maximum value of Parameter 2

Definition at line 66 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure(), and writeResults().

double fnex::SensitivityPointsMaker::fMinPar1
private

minimum value of Parameter 1

Definition at line 63 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure(), and writeResults().

double fnex::SensitivityPointsMaker::fMinPar2
private

minimum value of Parameter 2

Definition at line 65 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure(), and writeResults().

std::unique_ptr<fnex::MultiExperiment> fnex::SensitivityPointsMaker::fMultiExperiment
private

Multiexperiment.

Definition at line 79 of file SensitivityPointsMaker_plugin.cc.

Referenced by MultiExperimentChiSqrForInputPoint(), readResults(), and reconfigure().

fhicl::ParameterSet fnex::SensitivityPointsMaker::fMultiExperimentParameters
private

parameter set for all experiments to run

Definition at line 78 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure().

std::string fnex::SensitivityPointsMaker::fNamePar1
private

Name of the Parameter1.

Definition at line 74 of file SensitivityPointsMaker_plugin.cc.

Referenced by MultiExperimentChiSqrForInputPoint(), reconfigure(), and writeResults().

std::string fnex::SensitivityPointsMaker::fNamePar2
private

Name of the Parameter2.

Definition at line 75 of file SensitivityPointsMaker_plugin.cc.

Referenced by MultiExperimentChiSqrForInputPoint(), reconfigure(), and writeResults().

int fnex::SensitivityPointsMaker::fNumDivisions
private

number of divisions in each direction of space

Definition at line 67 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure(), and writeResults().

bool fnex::SensitivityPointsMaker::fSaveAllPlots
private
bool fnex::SensitivityPointsMaker::fUseTrig
private

turn on testing in trig function space for angles

Definition at line 69 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure().

bool fnex::SensitivityPointsMaker::fUseTrigPar1
private

turn on testing in trig function space for Parameter1

Definition at line 70 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure(), and writeResults().

bool fnex::SensitivityPointsMaker::fUseTrigPar2
private

turn on testing in trig function space for Parameter2

Definition at line 71 of file SensitivityPointsMaker_plugin.cc.

Referenced by reconfigure(), and writeResults().


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