LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evwgh::Weight_t Struct Reference

#include "Weight_t.h"

Public Member Functions

 Weight_t ()
 
std::vector< std::vector< double > > GetWeight (art::Event &e)
 

Public Attributes

std::string fName
 
WeightCalcfWeightCalc
 
std::string fWeightCalcType
 
double fMinWeight
 
double fMaxWeight
 
double fAvgWeight
 
long fNcalls
 
int fNmultisims
 

Detailed Description

Definition at line 9 of file Weight_t.h.

Constructor & Destructor Documentation

evwgh::Weight_t::Weight_t ( )
inline

Definition at line 11 of file Weight_t.h.

12  : fMinWeight(std::numeric_limits<double>::max())
13  , fMaxWeight(std::numeric_limits<double>::min())
14  , fAvgWeight(0)
15  , fNcalls(0)
16  {}
double fMaxWeight
Definition: Weight_t.h:35
double fMinWeight
Definition: Weight_t.h:34
double fAvgWeight
Definition: Weight_t.h:36

Member Function Documentation

std::vector<std::vector<double> > evwgh::Weight_t::GetWeight ( art::Event e)
inline

Definition at line 18 of file Weight_t.h.

References util::begin(), util::end(), fAvgWeight, fMaxWeight, fMinWeight, fNcalls, fWeightCalc, and evwgh::WeightCalc::GetWeight().

19  {
20  std::vector<std::vector<double>> wgh = fWeightCalc->GetWeight(e);
21  for (unsigned int inu = 0; inu < wgh.size(); inu++) {
22  double avgwgh = std::accumulate(wgh[inu].begin(), wgh[inu].end(), 0.0) / wgh[inu].size();
23  fAvgWeight = (fAvgWeight * fNcalls + avgwgh) / float(fNcalls + 1);
24  fMinWeight = std::min(fMinWeight, *std::min_element(wgh[inu].begin(), wgh[inu].end()));
25  fMaxWeight = std::max(fMaxWeight, *std::max_element(wgh[inu].begin(), wgh[inu].end()));
26  fNcalls++;
27  }
28 
29  return wgh;
30  }
WeightCalc * fWeightCalc
Definition: Weight_t.h:32
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
double fMaxWeight
Definition: Weight_t.h:35
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
virtual std::vector< std::vector< double > > GetWeight(art::Event &e)=0
double fMinWeight
Definition: Weight_t.h:34
double fAvgWeight
Definition: Weight_t.h:36

Member Data Documentation

double evwgh::Weight_t::fAvgWeight

Definition at line 36 of file Weight_t.h.

Referenced by GetWeight().

double evwgh::Weight_t::fMaxWeight

Definition at line 35 of file Weight_t.h.

Referenced by GetWeight().

double evwgh::Weight_t::fMinWeight

Definition at line 34 of file Weight_t.h.

Referenced by GetWeight().

std::string evwgh::Weight_t::fName

Definition at line 31 of file Weight_t.h.

long evwgh::Weight_t::fNcalls

Definition at line 37 of file Weight_t.h.

Referenced by GetWeight().

int evwgh::Weight_t::fNmultisims

Definition at line 38 of file Weight_t.h.

Referenced by evwgh::WeightManager::Configure().

WeightCalc* evwgh::Weight_t::fWeightCalc

Definition at line 32 of file Weight_t.h.

Referenced by evwgh::WeightManager::Configure(), and GetWeight().

std::string evwgh::Weight_t::fWeightCalcType

Definition at line 33 of file Weight_t.h.

Referenced by evwgh::WeightManager::Configure().


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