Public Member Functions | Protected Member Functions | Private Attributes | List of all members
VLN::FiducialCutVarExtractor Class Reference

#include <FiducialCutVarExtractor.h>

Inheritance diagram for VLN::FiducialCutVarExtractor:
VLN::VarExtractorBase

Public Member Functions

 FiducialCutVarExtractor (const std::string &prefix, const fhicl::ParameterSet &pset, const std::string &labelGenerator="generator")
 
 ~FiducialCutVarExtractor ()=default
 
- Public Member Functions inherited from VLN::VarExtractorBase
 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

void extractVars (const art::Event &evt, VarDict &vars) override
 
- Protected Member Functions inherited from VLN::VarExtractorBase
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
 

Private Attributes

std::string labelGenerator
 
double containVolMaxX
 
double containVolMaxY
 
double containVolMinZ
 
double containVolMaxZ
 

Additional Inherited Members

- Protected Attributes inherited from VLN::VarExtractorBase
std::string prefix
 
std::vector< std::stringscalarVars
 
std::vector< std::stringvectorVars
 

Detailed Description

Definition at line 8 of file FiducialCutVarExtractor.h.

Constructor & Destructor Documentation

VLN::FiducialCutVarExtractor::FiducialCutVarExtractor ( const std::string prefix,
const fhicl::ParameterSet pset,
const std::string labelGenerator = "generator" 
)

Definition at line 9 of file FiducialCutVarExtractor.cxx.

16  containVolMaxX(pset.get<double>("ContainVolMaxX")),
17  containVolMaxY(pset.get<double>("ContainVolMaxY")),
18  containVolMinZ(pset.get<double>("ContainVolMinZ")),
19  containVolMaxZ(pset.get<double>("ContainVolMaxZ"))
20 { }
static const std::vector< std::string > VECTOR_VARS({})
static const std::vector< std::string > SCALAR_VARS({"run","subRun","event"})
T get(std::string const &key) const
Definition: ParameterSet.h:271
VarExtractorBase(const std::string &prefix, const std::vector< std::string > &scalarVars, const std::vector< std::string > &vectorVars)
VLN::FiducialCutVarExtractor::~FiducialCutVarExtractor ( )
default

Member Function Documentation

void VLN::FiducialCutVarExtractor::extractVars ( const art::Event evt,
VarDict vars 
)
overrideprotectedvirtual

Implements VLN::VarExtractorBase.

Definition at line 22 of file FiducialCutVarExtractor.cxx.

23 {
24  std::vector<art::Ptr<simb::MCTruth>> mcTruth;
25 
26  auto mcTruth_h = evt.getHandle<std::vector<simb::MCTruth>>(labelGenerator);
27  if (!mcTruth_h) {
28  return;
29  }
30 
31  art::fill_ptr_vector(mcTruth, mcTruth_h);
32  if (mcTruth.empty()) {
33  return;
34  }
35 
36  const auto &nu = mcTruth[0]->GetNeutrino();
37 
38  auto vtxX = nu.Nu().Vx();
39  auto vtxY = nu.Nu().Vy();
40  auto vtxZ = nu.Nu().Vz();
41 
42  setScalarVar(vars, "vtxContain",
43  (
44  (std::abs(vtxX) < containVolMaxX)
45  && (std::abs(vtxY) < containVolMaxY)
46  && (vtxZ > containVolMinZ) && (vtxZ < containVolMaxZ)
47  )
48  );
49 }
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
T abs(T value)
void setScalarVar(VarDict &vars, const std::string &name, double value) const
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297

Member Data Documentation

double VLN::FiducialCutVarExtractor::containVolMaxX
private

Definition at line 24 of file FiducialCutVarExtractor.h.

double VLN::FiducialCutVarExtractor::containVolMaxY
private

Definition at line 25 of file FiducialCutVarExtractor.h.

double VLN::FiducialCutVarExtractor::containVolMaxZ
private

Definition at line 28 of file FiducialCutVarExtractor.h.

double VLN::FiducialCutVarExtractor::containVolMinZ
private

Definition at line 27 of file FiducialCutVarExtractor.h.

std::string VLN::FiducialCutVarExtractor::labelGenerator
private

Definition at line 22 of file FiducialCutVarExtractor.h.


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