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

Public Member Functions

 VLNEnergyDataGen (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)
 

Protected Member Functions

bool passesCut (const art::Event &evt, const VarDict &vars)
 
- 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 ()
 

Private Attributes

Flavor flavor
 
Format format
 
bool applyFiducialCut
 
int isCC
 
double maxEnergy
 
int precision
 
DefaultInputVarExtractor inputVarExtractor
 
EventRecoEVarExtractor recoEVarExtractor
 
EventMCVarExtractor truthVarExtractor
 
FiducialCutVarExtractor fiducialCutVarExtractor
 
VarDict vars
 
std::unique_ptr< CSVExporterexporter
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Detailed Description

Definition at line 17 of file VLNEnergyDataGen_module.cc.

Constructor & Destructor Documentation

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

Definition at line 46 of file VLNEnergyDataGen_module.cc.

47  : EDAnalyzer(pset),
48  applyFiducialCut(pset.get<bool>("ApplyFiducialCut")),
49  isCC(pset.get<int>("IsCC")),
50  maxEnergy(pset.get<double>("MaxEnergy")),
51  precision(pset.get<int>("OutputPrecision")),
52  inputVarExtractor("", pset.get<fhicl::ParameterSet>("ConfigInputVars")),
54  pset.get<std::string>("Flavor") + "e.",
55  pset.get<std::string>("LabelRecoE")
56  ),
57  truthVarExtractor("mc.", pset.get<std::string>("LabelGenerator")),
59  "mc.",
60  pset.get<fhicl::ParameterSet>("ConfigFiducialCut"),
61  pset.get<std::string>("LabelGenerator")
62  )
63 {
64  flavor = parseFlavor(pset.get<std::string>("Flavor"));
65  format = parseFormat(pset.get<std::string>("OutputFormat"));
66 }
Format parseFormat(const std::string &formatStr)
Definition: utils.cxx:24
std::string string
Definition: nybbler.cc:12
EventRecoEVarExtractor recoEVarExtractor
DefaultInputVarExtractor inputVarExtractor
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
T get(std::string const &key) const
Definition: ParameterSet.h:271
FiducialCutVarExtractor fiducialCutVarExtractor
Flavor parseFlavor(const std::string &flavStr)
Definition: utils.cxx:8
EventMCVarExtractor truthVarExtractor

Member Function Documentation

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

Definition at line 112 of file VLNEnergyDataGen_module.cc.

113 {
117 
118  if (! passesCut(evt, vars)) {
119  return;
120  }
121 
123 
124  exporter->exportVars(vars);
125 }
EventRecoEVarExtractor recoEVarExtractor
DefaultInputVarExtractor inputVarExtractor
virtual void extract(const art::Event &evt, VarDict &vars)
FiducialCutVarExtractor fiducialCutVarExtractor
bool passesCut(const art::Event &evt, const VarDict &vars)
std::unique_ptr< CSVExporter > exporter
EventMCVarExtractor truthVarExtractor
bool VLN::VLNEnergyDataGen::passesCut ( const art::Event evt,
const VarDict vars 
)
protected

Definition at line 80 of file VLNEnergyDataGen_module.cc.

81 {
82  if (
83  (flavor != Flavor::Any)
84  && (std::abs(vars.scalar.at("mc.pdg")) != static_cast<int>(flavor))
85  ) {
86  return false;
87  }
88 
89  if ((isCC >= 0) && (vars.scalar.at("mc.isCC") != isCC)) {
90  return false;
91  }
92 
93  if (applyFiducialCut && (vars.scalar.at("mc.vtxContain") != 1)) {
94  return false;
95  }
96 
97  if ((maxEnergy > 0) && (vars.scalar.at("mc.nuE") > maxEnergy)) {
98  return false;
99  }
100 
101  /* TODO: find proper way to check containment for non numu events */
102  if (
103  (flavor == Flavor::NuMu)
104  && (vars.scalar.at("numue.longestTrackContained") != 1)
105  ) {
106  return false;
107  }
108 
109  return true;
110 }
T abs(T value)
std::unordered_map< std::string, double > scalar
Definition: VarDict.h:10
void VLN::VLNEnergyDataGen::respondToOpenInputFile ( const art::FileBlock fb)
override

Definition at line 68 of file VLNEnergyDataGen_module.cc.

69 {
70  const std::string filename = convertFilename(fb.fileName(), "./", format);
71 
72  switch (format) {
73  case Format::CSV:
74  exporter = std::make_unique<CSVExporter>(filename);
75  exporter->setPrecision(precision);
76  break;
77  }
78 }
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::string const & fileName() const
Definition: FileBlock.cc:29
std::unique_ptr< CSVExporter > exporter

Member Data Documentation

bool VLN::VLNEnergyDataGen::applyFiducialCut
private

Definition at line 32 of file VLNEnergyDataGen_module.cc.

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

Definition at line 43 of file VLNEnergyDataGen_module.cc.

FiducialCutVarExtractor VLN::VLNEnergyDataGen::fiducialCutVarExtractor
private

Definition at line 40 of file VLNEnergyDataGen_module.cc.

Flavor VLN::VLNEnergyDataGen::flavor
private

Definition at line 29 of file VLNEnergyDataGen_module.cc.

Format VLN::VLNEnergyDataGen::format
private

Definition at line 30 of file VLNEnergyDataGen_module.cc.

DefaultInputVarExtractor VLN::VLNEnergyDataGen::inputVarExtractor
private

Definition at line 37 of file VLNEnergyDataGen_module.cc.

int VLN::VLNEnergyDataGen::isCC
private

Definition at line 33 of file VLNEnergyDataGen_module.cc.

double VLN::VLNEnergyDataGen::maxEnergy
private

Definition at line 34 of file VLNEnergyDataGen_module.cc.

int VLN::VLNEnergyDataGen::precision
private

Definition at line 35 of file VLNEnergyDataGen_module.cc.

EventRecoEVarExtractor VLN::VLNEnergyDataGen::recoEVarExtractor
private

Definition at line 38 of file VLNEnergyDataGen_module.cc.

EventMCVarExtractor VLN::VLNEnergyDataGen::truthVarExtractor
private

Definition at line 39 of file VLNEnergyDataGen_module.cc.

VarDict VLN::VLNEnergyDataGen::vars
private

Definition at line 42 of file VLNEnergyDataGen_module.cc.


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