LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
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 namespace evwgh {
7  struct Weight_t {
8 
9  Weight_t() :
10  fMinWeight(std::numeric_limits<double>::max()),
11  fMaxWeight(std::numeric_limits<double>::min()),
12  fAvgWeight(0),
13  fNcalls(0)
14  {}
15 
16  std::vector<std::vector<double> > GetWeight(art::Event& e) {
17  std::vector<std::vector<double> >wgh=fWeightCalc->GetWeight(e);
18  for (unsigned int inu=0;inu<wgh.size();inu++) {
19  double avgwgh=std::accumulate(wgh[inu].begin(),wgh[inu].end(),0.0)/wgh[inu].size();
20  fAvgWeight=(fAvgWeight*fNcalls+avgwgh)/float(fNcalls+1);
22  *std::min_element(wgh[inu].begin(),wgh[inu].end()));
24  *std::max_element(wgh[inu].begin(),wgh[inu].end()));
25  fNcalls++;
26  }
27 
28  return wgh;
29  }
30  std::string fName;
32  std::string fWeightCalcType;
33  double fMinWeight;
34  double fMaxWeight;
35  double fAvgWeight;
36  long fNcalls;
38  };
39 
40 }
41 
42 #endif // _WEIGHT_T_H_
STL namespace.
WeightCalc * fWeightCalc
Definition: Weight_t.h:31
std::string fName
Definition: Weight_t.h:30
Int_t max
Definition: plot.C:27
std::vector< std::vector< double > > GetWeight(art::Event &e)
Definition: Weight_t.h:16
std::string fWeightCalcType
Definition: Weight_t.h:32
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
double fMaxWeight
Definition: Weight_t.h:34
Int_t min
Definition: plot.C:26
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
Float_t e
Definition: plot.C:34
virtual std::vector< std::vector< double > > GetWeight(art::Event &e)=0
double fMinWeight
Definition: Weight_t.h:33
double fAvgWeight
Definition: Weight_t.h:35