1 #ifndef __JSUPPORT__JEVTWEIGHTFILESCANNER__
2 #define __JSUPPORT__JEVTWEIGHTFILESCANNER__
61 template<
class JFileScanner_t = JMultipleFileScanner<Evt> >
120 static const char SEPARATOR =
'.';
124 if (header.
simul.size() > 0) {
126 string name = header.
simul.cbegin()->program;
136 THROW(
JNoValue,
"JEvtWeightFileScanner::getProgramName(): Missing simul header-field!");
149 JFileScanner_t ::clear();
163 for (
typename input_type::const_iterator i = input.begin(); i != input.end(); ++i) {
164 n += size_t(this->
put(*i));
177 bool put(
const std::string& input)
183 if (this->
check(head)) {
186 JFileScanner_t ::push_back(input);
206 template<
class JEvtWeightFactorHelper_t>
209 JEvtWeightFactorHelper_t* helper =
dynamic_cast<JEvtWeightFactorHelper_t*
>(this->get());
211 if (helper != NULL) {
213 helper->configure(factor);
256 bool matching = (!categories.empty());
262 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend() && matching; ++i) {
264 JEvtCategorySet::const_iterator
j = std::find(cats.cbegin(), cats.cend(), *i);
266 matching = (
j != cats.cend());
284 template<
class JEvtWeightFactorHelper_t>
293 bool matching = (!
object.empty());
299 for (
typename JEvtCategoryMap_t::const_iterator i =
object.cbegin(); i !=
object.cend() && matching; ++i) {
301 JEvtCategorySet::const_iterator
j = std::find(cats.cbegin(), cats.cend(), i->first);
303 matching = (
j != cats.cend());
364 return setEvtWeightFactor<JFluxHelper>(
object);
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
#define MAKE_STRING(A)
Make string.
ROOT TTree parameter settings of various packages.
Template specialisation for a map between event categories and flux factors.
Auxiliary class for reading a map of event categories.
std::vector< JAANET::simul > simul
const JHead & getHeader() const
Get header.
Exception for missing value.
virtual const pointer_type & next() override
Get next element.
JEvtCategorySet getCategories(const JHead &header)
Auxiliary method to retrieve the unique event categories corresponding to a MC header.
JEvtWeighter getEventWeighter
Function object for mapping header to event weighter.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JLANG::JSTDObjectReader< const event_type > input_type
Support classes and methods for experiment specific I/O.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Helper class for event categories.
bool match(const JHead &header) const
Check whether given MC header matches with this event category.
Container for a set of event categories.
Helper class for event-weight factor.
Helper class for event weighing.
void configure(const JEvtWeight &weighter)
Configuration.
void add(const JHead &header)
Add header.
bool check(const JHead &header) const
Check if a given header is consistent with this event weighter.
Abstract base class for event weighing.
Helper class for flux function.
Template event-weighter-associated file scanner.
bool setFlux(const JEvtCategoryHelper &category, const JFluxHelper &flux)
Set flux function corresponding to a given event category.
bool setEvtWeightFactor(const JEvtCategoryHelper &category, const JEvtWeightFactorHelper &factor)
Set event-weight factor corresponding to a given event category.
JEvtWeightFileScanner()
Default constructor.
bool put(const std::string &input)
Put file.
size_t put(const input_type &input)
Put files.
JFileScanner_t::input_type input_type
bool setFlux(const JFluxHelper &factor)
Set flux function for the event-weighter associated with this file scanner.
bool setEvtWeightFactor(const JEvtWeightFactorHelper_t &factor)
Set event-weight factor for the event-weighter associated with this file scanner.
JEvtWeightFileScanner(const JEvtWeight &weighter)
Constructor.
bool setEvtWeightFactor(const JEvtCategorySet &categories, const JEvtWeightFactorHelper &factor)
Set event-weight factor corresponding to a given set of event categories.
bool setEvtWeightFactor(const JEvtCategoryMap< JEvtWeightFactorHelper_t > &object)
Set event-weight factor according to a given map between event categories and event-weight factors.
void reset(const JEvtWeight &weighter)
Reset file scanner and event weighter.
bool setFlux(const JEvtCategoryMap< JFluxHelper > &object)
Set flux function according to a given map between event categories and flux functions.
bool setFlux(const JEvtCategorySet &categories, const JFluxHelper &flux)
Set flux function corresponding to a given set of event categories.
std::string getProgramName() const
Get name of simulation program.
JEvtWeightFileScanner(const input_type &input)
Constructor.