Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VLN::VarExtractorBase Class Referenceabstract

#include <VarExtractorBase.h>

Inheritance diagram for VLN::VarExtractorBase:
VLN::DefaultInputVarExtractor VLN::EventAddrVarExtractor VLN::EventMCVarExtractor VLN::EventRecoEVarExtractor VLN::EventRecoVarExtractor VLN::FiducialCutVarExtractor VLN::PFParticleVarExtractor VLN::VLNEnergyVarExtractor

Public Member Functions

 VarExtractorBase (const std::string &prefix, const std::vector< std::string > &scalarVars, const std::vector< std::string > &vectorVars)
 
virtual ~VarExtractorBase ()=default
 
virtual void extract (const art::Event &evt, VarDict &vars)
 

Protected Member Functions

virtual void extractVars (const art::Event &evt, VarDict &vars)=0
 
void setScalarVar (VarDict &vars, const std::string &name, double value) const
 
void appendToVectorVar (VarDict &vars, const std::string &name, double value) const
 
void initScalarVars (VarDict &vars, const std::vector< std::string > &names) const
 
void initVectorVars (VarDict &vars, const std::vector< std::string > &names) const
 

Protected Attributes

std::string prefix
 
std::vector< std::stringscalarVars
 
std::vector< std::stringvectorVars
 

Detailed Description

Definition at line 11 of file VarExtractorBase.h.

Constructor & Destructor Documentation

VLN::VarExtractorBase::VarExtractorBase ( const std::string prefix,
const std::vector< std::string > &  scalarVars,
const std::vector< std::string > &  vectorVars 
)

Definition at line 6 of file VarExtractorBase.cxx.

10  : prefix(prefix), scalarVars(scalarVars), vectorVars(vectorVars)
11 { }
std::vector< std::string > vectorVars
std::vector< std::string > scalarVars
virtual VLN::VarExtractorBase::~VarExtractorBase ( )
virtualdefault

Member Function Documentation

void VLN::VarExtractorBase::appendToVectorVar ( VarDict vars,
const std::string name,
double  value 
) const
protected

Definition at line 20 of file VarExtractorBase.cxx.

23 {
24  vars.vector[prefix + name].push_back(value);
25 }
static QCString name
Definition: declinfo.cpp:673
std::unordered_map< std::string, std::vector< double > > vector
Definition: VarDict.h:11
void VLN::VarExtractorBase::extract ( const art::Event evt,
VarDict vars 
)
virtual

Definition at line 54 of file VarExtractorBase.cxx.

55 {
58 
59  extractVars(evt, vars);
60 }
virtual void extractVars(const art::Event &evt, VarDict &vars)=0
std::vector< std::string > vectorVars
std::vector< std::string > scalarVars
void initScalarVars(VarDict &vars, const std::vector< std::string > &names) const
void initVectorVars(VarDict &vars, const std::vector< std::string > &names) const
virtual void VLN::VarExtractorBase::extractVars ( const art::Event evt,
VarDict vars 
)
protectedpure virtual
void VLN::VarExtractorBase::initScalarVars ( VarDict vars,
const std::vector< std::string > &  names 
) const
protected

Definition at line 27 of file VarExtractorBase.cxx.

30 {
31  for (auto &name : names) {
32  vars.scalar[prefix + name] = -1;
33  }
34 }
static QCString name
Definition: declinfo.cpp:673
std::unordered_map< std::string, double > scalar
Definition: VarDict.h:10
void VLN::VarExtractorBase::initVectorVars ( VarDict vars,
const std::vector< std::string > &  names 
) const
protected

Definition at line 36 of file VarExtractorBase.cxx.

39 {
40  for (auto &name : names) {
41  const std::string fullname = prefix + name;
42 
43  auto it = vars.vector.find(fullname);
44 
45  if (it != vars.vector.end()) {
46  it->second.clear();
47  }
48  else {
49  vars.vector[fullname] = {};
50  }
51  }
52 }
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
std::unordered_map< std::string, std::vector< double > > vector
Definition: VarDict.h:11
void VLN::VarExtractorBase::setScalarVar ( VarDict vars,
const std::string name,
double  value 
) const
protected

Definition at line 13 of file VarExtractorBase.cxx.

16 {
17  vars.scalar[prefix + name] = value;
18 }
static QCString name
Definition: declinfo.cpp:673
std::unordered_map< std::string, double > scalar
Definition: VarDict.h:10

Member Data Documentation

std::string VLN::VarExtractorBase::prefix
protected

Definition at line 42 of file VarExtractorBase.h.

std::vector<std::string> VLN::VarExtractorBase::scalarVars
protected

Definition at line 44 of file VarExtractorBase.h.

std::vector<std::string> VLN::VarExtractorBase::vectorVars
protected

Definition at line 45 of file VarExtractorBase.h.


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