1 #ifndef __JSUPPORT_JEVTWEIGHTFILESCANNERSET__
2 #define __JSUPPORT_JEVTWEIGHTFILESCANNERSET__
31 namespace JPP {
using namespace JSUPPORT; }
46 template<
class JFileScanner_t = JMultipleFileScanner<Evt>,
47 class JComparator_t = std::less<JHead> >
49 public std::vector< JEvtWeightFileScanner<JFileScanner_t> >
95 for (
typename input_type::const_iterator
i = input.begin();
i != input.end(); ++
i) {
96 n += size_t(this->
put(*
i));
109 bool put(
const std::string& input)
116 iterator i = lower_bound(this->begin(), this->end(), head,
119 if (
i == this->end() || !
i->getHeader().match(head)) {
123 return i->put(input);
138 static const char SEPARATOR =
'.';
140 string name = p->getProgramName();
144 if (
i->getProgramName() ==
name) {
164 if (
i->match(head)) {
169 THROW(
JValueOutOfRange,
"JEvtWeightFileScannerSet::get(): No corresponding scanner found for given header.");
186 template<
class JEvtWeightFactor_t = JEvtWeightFactor>
188 const JEvtWeightFactor_t& factor)
195 for (
iterator i = this->begin();
i != this->end(); ++
i) {
196 n += (size_t)
i->template setEvtWeightFactor<JEvtWeightFactor_t>(type, factor);
218 template<
class JEvtWeightFactor_t = JEvtWeightFactor>
220 const JEvtWeightFactor_t& factor,
221 const bool requireAll =
false)
230 for (
iterator i = this->begin();
i != this->end(); ++
i) {
231 n += (size_t)
i->template setEvtWeightFactor<JEvtWeightFactor_t>(types, factor);
236 for (
iterator i = this->begin();
i != this->end(); ++
i) {
241 isSet =
i->template setEvtWeightFactor<JEvtWeightFactor_t>(*
j, factor);
266 template<
class JEvtWeightFactor_t = JEvtWeightFactor>
268 const bool requireAll =
false)
277 for (
iterator i = this->begin();
i != this->end(); ++
i) {
278 n += (size_t)
i->template setEvtWeightFactor<JEvtWeightFactor_t>(multiParticleFactor);
283 for (
iterator i = this->begin();
i != this->end(); ++
i) {
288 isSet =
i->template setEvtWeightFactor<JEvtWeightFactor_t>(
j->first, *(
j->second));
312 return setEvtWeightFactor<JFlux>(
type, flux);
330 const bool requireAll =
false)
332 return setEvtWeightFactor<JFlux>(types, flux, requireAll);
348 const bool requireAll =
false)
350 return setEvtWeightFactor<JFlux>(multiParticleFlux, requireAll);
JEvtWeighter getEventWeighter
Function object for mapping header to event weighter.
bool put(const std::string &input)
Put file.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
std::string getUniqueIdentifier(const_iterator p) const
Get unique identifier for a file-scanner contained within this set of event-weighter-associated file-...
std::vector< filescanner_type >::reverse_iterator reverse_iterator
size_t setEvtWeightFactor(const std::set< int > &types, const JEvtWeightFactor_t &factor, const bool requireAll=false)
Set event-weight factor of all MC-files corresponding to a given set of PDG codes.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
size_t setEvtWeightFactor(const JEvtWeightFactorMultiParticle< JEvtWeightFactor_t > &multiParticleFactor, const bool requireAll=false)
Set event-weight factor of all MC-files corresponding to a given multi-particle flux.
size_t setEvtWeightFactor(const int type, const JEvtWeightFactor_t &factor)
Set event-weighting factor for all MC-files corresponding to a given PDG code.
size_t put(const input_type &input)
Put files.
std::vector< filescanner_type >::const_reverse_iterator const_reverse_iterator
#define MAKE_STRING(A)
Make string.
JEvtWeightFileScannerSet(const input_type &input)
Constructor.
JEvtWeightFileScannerSet()
Default constructor.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Implementation of event-weight factor for multiple particle types.
JEvtWeightFileScannerSet< JFileScanner_t, JComparator_t > filescannerset_type
size_t setFlux(const std::set< int > &types, const JFlux &flux, const bool requireAll=false)
Set flux function of all MC-files corresponding to a given set of PDG codes.
std::vector< filescanner_type >::reference reference
JEvtWeightFileScanner< JFileScanner_t > filescanner_type
Low-level interface for retrieving the flux corresponding to a given event.
then fatal The output file must have the wildcard in the name
Scanning of objects from multiple files according a format that follows from the extension of each fi...
size_t setFlux(const JEvtWeightFactorMultiParticle< JFlux > &multiParticleFlux, const bool requireAll=false)
Set flux function of all MC-files corresponding to a given multi-particle flux interface.
std::vector< filescanner_type >::const_reference const_reference
JFileScanner_t::input_type input_type
std::vector< filescanner_type >::iterator iterator
filescanner_type::input_type input_type
std::vector< filescanner_type >::value_type value_type
size_t setFlux(const int type, const JFlux &flux)
Set flux function for all MC-files corresponding to a given PDG code.
then set_variable DETECTOR set_variable OUTPUT_FILE set_variable DAQ_FILE set_variable PMT_FILE else fatal Wrong number of arguments fi JPrintTree f $DAQ_FILE type
const JHead & getHeader() const
Get header.
Auxiliary class for organising Monte Carlo file scanners associated with event weighters.
Exception for accessing a value in a collection that is outside of its range.
Template event-weighter-associated file scanner.
Low-level interface for retrieving a specifiable multiplication factor corresponding to a given event...
const_reference find(const JHead &head) const
Find file scanner compatible with a given header.
std::vector< filescanner_type >::const_iterator const_iterator
JComparator_t compare
Function object for comparison of headers.