CMFPredictionLibraryMaker_plugin.cc
Go to the documentation of this file.
1 // Plugin to create a set of predicted spectra for all points in an
2 // oscillation space and a small collection of hidden parameter points
3 // for each point in the oscillation space.
4 //
5 // Created by Brian Rebel on 8/8/20.
6 //
7 
8 #include <memory>
9 #include <string>
10 #include <vector>
11 #include <map>
12 #include <set>
13 
14 #include "TRandom3.h"
15 #include "TFile.h"
16 #include "TH1.h"
17 #include "TH2.h"
18 
19 // Framework includes
23 #include "art_root_io/TFileService.h"
24 #include "art_root_io/TFileDirectory.h"
26 #include "fhiclcpp/ParameterSet.h"
28 
29 // NOvA includes
37 
38 namespace cmf {
39 
41  public:
42  explicit PredictionLibraryMaker(fhicl::ParameterSet const& pset);
43  ~PredictionLibraryMaker() override;
44 
45  // Plugins should not be copied or assigned.
50 
51  void readResults (art::Results const& r) override;
52  void writeResults(art::Results & r) override;
53  void clear() override;
54  void beginJob() override;
55  void reconfigure(fhicl::ParameterSet const& p);
56 
57  private:
58 
59  bool fUseTrig; ///< do we want to use a sin function for the values of one parameter?
60  cmf::OscParm_t fParamX; ///< oscillation parameter for the x axis
61  cmf::OscParm_t fParamY; ///< oscillation parameter for the y axis
62  std::vector<cmf::GridPoint> fGridPoints;
63  };
64 
65  //......................................................................
67  {
70  cmf::ParameterUtility::Instance() ->Initialize(pset.get< fhicl::ParameterSet >("ParametersToUse" ));
72 
73  // produce a vector of OscParamPoints
74  produces< std::vector<cmf::OscParamPoint> >();
75  }
76 
77  //......................................................................
79  = default;
80 
81  //......................................................................
82  // Method to clear out the collections of data products after the
83  // writeResults method is called.
85  {
86  }
87 
88  //......................................................................
90  {
91  }
92 
93  //......................................................................
95  {}
96 
97  //......................................................................
99  {
100  }
101 
102  //......................................................................
104  {
105  // the idea is to loop over the grid in the x and y parameters and
106  // create a cmf::OscParamPoint at each of the points in space
107 
108  // create a vector of OscParamPoints
109  std::unique_ptr<std::vector<cmf::OscParamPoint>> ppVec = std::make_unique<std::vector<cmf::OscParamPoint>>();
110 
112 
113  r.put(std::move(ppVec));
114 
115  } // end writeResults
116 
118 
119 } // end cmf namespace
void MakePredictions(std::vector< cmf::OscParamPoint > &predVec)
enum cmf::osc_params OscParm_t
std::vector< cmf::GridPoint > fGridPoints
PredictionLibraryMaker(fhicl::ParameterSet const &pset)
void Initialize(fhicl::ParameterSet const &pset)
const char * p
Definition: xmltok.h:285
static SelectionUtility * Instance()
static ParameterUtility * Instance()
void Initialize(fhicl::ParameterSet const &pset)
#define DEFINE_ART_RESULTS_PLUGIN(klass)
T get(std::string const &key) const
Definition: ParameterSet.h:231
void Initialize(fhicl::ParameterSet const &pset)
static SpectrumPredictionMaker * Instance()
Module to combine a set of results into a single file currently only does one data product type at a ...
Definition: Event.cxx:24
void writeResults(art::Results &r) override
void reconfigure(fhicl::ParameterSet const &p)
PredictionLibraryMaker & operator=(PredictionLibraryMaker const &)=delete
void readResults(art::Results const &r) override
cmf::OscParm_t fParamY
oscillation parameter for the y axis
TRandom3 r(0)
void Initialize(fhicl::ParameterSet const &pset)
bool fUseTrig
do we want to use a sin function for the values of one parameter?
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
cmf::OscParm_t fParamX
oscillation parameter for the x axis
static CovarianceBinUtility * Instance()