Public Member Functions | Private Attributes | List of all members
VLN::VLNEnergyAnalyzer Class Reference
Inheritance diagram for VLN::VLNEnergyAnalyzer:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 VLNEnergyAnalyzer (const fhicl::ParameterSet &pset)
 
void analyze (const art::Event &evt) override
 
void respondToOpenInputFile (const art::FileBlock &fb) override
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

Format format
 
int precision
 
DefaultInputVarExtractor inputVarExtractor
 
VLNEnergyModel model
 
VarDict vars
 
std::unique_ptr< CSVExporterexporter
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 12 of file VLNEnergyAnalyzer_module.cc.

Constructor & Destructor Documentation

VLN::VLNEnergyAnalyzer::VLNEnergyAnalyzer ( const fhicl::ParameterSet pset)
explicit

Definition at line 31 of file VLNEnergyAnalyzer_module.cc.

32  : EDAnalyzer(pset),
33  precision(pset.get<int>("OutputPrecision")),
34  inputVarExtractor("", pset.get<fhicl::ParameterSet>("ConfigInputVars")),
35  model(pset.get<std::string>("ModelPath"))
36 {
37  format = parseFormat(pset.get<std::string>("OutputFormat"));
38 }
Format parseFormat(const std::string &formatStr)
Definition: utils.cxx:24
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
DefaultInputVarExtractor inputVarExtractor
T get(std::string const &key) const
Definition: ParameterSet.h:271

Member Function Documentation

void VLN::VLNEnergyAnalyzer::analyze ( const art::Event evt)
override

Definition at line 52 of file VLNEnergyAnalyzer_module.cc.

53 {
55 
56  const VLNEnergy energy = model.predict(vars);
57 
58  vars.scalar["vln.energy.totalE"] = energy.totalE;
59  vars.scalar["vln.energy.primaryE"] = energy.primaryE;
60  vars.scalar["vln.energy.secondaryE"] = energy.totalE - energy.primaryE;
61 
62  exporter->exportVars(vars);
63 }
Definition: model.py:1
virtual void extract(const art::Event &evt, VarDict &vars)
DefaultInputVarExtractor inputVarExtractor
std::unique_ptr< CSVExporter > exporter
std::unordered_map< std::string, double > scalar
Definition: VarDict.h:10
void VLN::VLNEnergyAnalyzer::respondToOpenInputFile ( const art::FileBlock fb)
override

Definition at line 40 of file VLNEnergyAnalyzer_module.cc.

41 {
42  const std::string filename = convertFilename(fb.fileName(), "./", format);
43 
44  switch (format) {
45  case Format::CSV:
46  exporter = std::make_unique<CSVExporter>(filename);
47  exporter->setPrecision(precision);
48  break;
49  }
50 }
std::string string
Definition: nybbler.cc:12
string filename
Definition: train.py:213
std::string convertFilename(const std::string &path, const std::string &root, Format format)
Definition: utils.cxx:35
std::unique_ptr< CSVExporter > exporter
std::string const & fileName() const
Definition: FileBlock.cc:29

Member Data Documentation

std::unique_ptr<CSVExporter> VLN::VLNEnergyAnalyzer::exporter
private

Definition at line 28 of file VLNEnergyAnalyzer_module.cc.

Format VLN::VLNEnergyAnalyzer::format
private

Definition at line 21 of file VLNEnergyAnalyzer_module.cc.

DefaultInputVarExtractor VLN::VLNEnergyAnalyzer::inputVarExtractor
private

Definition at line 24 of file VLNEnergyAnalyzer_module.cc.

VLNEnergyModel VLN::VLNEnergyAnalyzer::model
private

Definition at line 25 of file VLNEnergyAnalyzer_module.cc.

int VLN::VLNEnergyAnalyzer::precision
private

Definition at line 22 of file VLNEnergyAnalyzer_module.cc.

VarDict VLN::VLNEnergyAnalyzer::vars
private

Definition at line 27 of file VLNEnergyAnalyzer_module.cc.


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