Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
larsim
larsim
EventWeight
Base
WeightManager.cxx
Go to the documentation of this file.
1
#include "
WeightManager.h
"
2
3
4
namespace
evwgh
{
5
6
WeightManager::WeightManager
(
const
std::string
name
)
7
: _name(name)
8
{
9
_configured
=
false
;
10
}
11
12
const
std::string
&
WeightManager::Name
()
const
13
{
return
_name
; }
14
15
16
//
17
// CORE FUNCTION
18
//
19
MCEventWeight
WeightManager::Run
(
art::Event
&
e
,
const
int
inu
)
20
{
21
22
if
(!
_configured
)
23
throw
cet::exception
(__PRETTY_FUNCTION__) <<
"Have not configured yet!"
<<
std::endl
;
24
25
//
26
// Loop over all functions ang calculate weights
27
//
28
MCEventWeight
mcwgh;
29
for
(
auto
it =
fWeightCalcMap
.begin() ;it !=
fWeightCalcMap
.end(); it++) {
30
31
auto
const
& weights = it->second->GetWeight(e);
32
33
if
(weights.size() == 0){
34
std::vector<double>
empty
;
35
std::pair<std::string, std::vector <double> >
p
(
"empty"
,empty);
36
mcwgh.
fWeight
.insert(p);
37
}
38
else
{
39
std::pair<std::string, std::vector<double> >
40
p
(it->first+
"_"
+it->second->fWeightCalcType,
41
weights[inu]);
42
mcwgh.
fWeight
.insert(p);
43
}
44
}
45
46
return
mcwgh;
47
}
48
49
50
51
void
WeightManager::PrintConfig
() {
52
53
return
;
54
}
55
56
}
name
static QCString name
Definition:
declinfo.cpp:673
evwgh::WeightManager::_name
std::string _name
Name.
Definition:
WeightManager.h:81
string
std::string string
Definition:
nybbler.cc:12
truth_ana.inu
int inu
Definition:
truth_ana.py:132
WeightManager.h
Allows to interface to EventWeight calculators.
e
const double e
Definition:
gUpMuFluxGen.cxx:165
evwgh
Definition:
EventWeight_module.cc:31
test.p
p
Definition:
test.py:223
evwgh::MCEventWeight::fWeight
std::map< std::string, std::vector< double > > fWeight
Definition:
MCEventWeight.h:10
evwgh::WeightManager::_configured
bool _configured
Readiness flag.
Definition:
WeightManager.h:80
evwgh::WeightManager::WeightManager
WeightManager(const std::string name="WeightManager")
Default constructor.
Definition:
WeightManager.cxx:6
evwgh::MCEventWeight
Definition:
MCEventWeight.h:8
art::Event
Definition:
Event.h:22
evwgh::WeightManager::fWeightCalcMap
std::map< std::string, Weight_t * > fWeightCalcMap
A set of custom weight calculators.
Definition:
WeightManager.h:79
evwgh::WeightManager::PrintConfig
void PrintConfig()
Definition:
WeightManager.cxx:51
evwgh::WeightManager::Run
MCEventWeight Run(art::Event &e, const int inu)
Core function (previous call to Configure is needed)
Definition:
WeightManager.cxx:19
evwgh::WeightManager::Name
const std::string & Name() const
Name getter.
Definition:
WeightManager.cxx:12
fhicl::exception
cet::coded_exception< error, detail::translate > exception
Definition:
exception.h:33
util::empty
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition:
StdUtils.h:97
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11