Weight_t.h
Go to the documentation of this file.
1 #ifndef _WEIGHT_T_H_
2 #define _WEIGHT_T_H_
3 
4 #include "WeightCalc.h"
5 
6 #include <numeric> // std::accumulate()
7 
8 namespace evwgh {
9  struct Weight_t {
10 
12  fMinWeight(std::numeric_limits<double>::max()),
13  fMaxWeight(std::numeric_limits<double>::min()),
14  fAvgWeight(0),
15  fNcalls(0)
16  {}
17 
18  std::vector<std::vector<double> > GetWeight(art::Event& e) {
19  std::vector<std::vector<double> >wgh=fWeightCalc->GetWeight(e);
20  for (unsigned int inu=0;inu<wgh.size();inu++) {
21  double avgwgh=std::accumulate(wgh[inu].begin(),wgh[inu].end(),0.0)/wgh[inu].size();
22  fAvgWeight=(fAvgWeight*fNcalls+avgwgh)/float(fNcalls+1);
24  *std::min_element(wgh[inu].begin(),wgh[inu].end()));
26  *std::max_element(wgh[inu].begin(),wgh[inu].end()));
27  fNcalls++;
28  }
29 
30  return wgh;
31  }
35  double fMinWeight;
36  double fMaxWeight;
37  double fAvgWeight;
38  long fNcalls;
40  };
41 
42 }
43 
44 #endif // _WEIGHT_T_H_
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::string string
Definition: nybbler.cc:12
STL namespace.
WeightCalc * fWeightCalc
Definition: Weight_t.h:33
std::string fName
Definition: Weight_t.h:32
std::vector< std::vector< double > > GetWeight(art::Event &e)
Definition: Weight_t.h:18
const double e
std::string fWeightCalcType
Definition: Weight_t.h:34
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
double fMaxWeight
Definition: Weight_t.h:36
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
virtual std::vector< std::vector< double > > GetWeight(art::Event &e)=0
double fMinWeight
Definition: Weight_t.h:35
double fAvgWeight
Definition: Weight_t.h:37