1 #ifndef __JSUPPORT__JEVTWEIGHTFILESCANNER__
2 #define __JSUPPORT__JEVTWEIGHTFILESCANNER__
52 template<
class JFileScanner_t = JMultipleFileScanner<Evt> >
102 static const char SEPARATOR =
'.';
106 if (header.simul.size() > 0) {
108 string name = header.simul.cbegin()->program;
118 THROW(
JNoValue,
"JEvtWeightFileScanner::getProgramName(): Missing simul header-field!");
131 JFileScanner_t ::clear();
145 for (
typename JMultipleFileScanner_t::const_iterator i = input.begin(); i != input.end(); ++i) {
146 n += size_t(this->
put(*i));
159 bool put(
const std::string& input)
165 if (this->
check(head)) {
168 JFileScanner_t ::push_back(input);
191 template<
class JEvtWeightFactor_t = JEvtWeightFactor>
193 const JEvtWeightFactor_t& factor)
206 if ((header.primary.type == type) ||
208 (header.flux.size() == 1 && i != header.flux.end())) {
210 JEvtWeightFactorHelper_t* helper =
dynamic_cast<JEvtWeightFactorHelper_t*
>(this->
get());
212 if (helper != NULL) {
214 helper->configure(factor);
237 template<
class JEvtWeightFactor_t = JEvtWeightFactor>
239 const JEvtWeightFactor_t& factor)
246 bool matching = (!types.empty());
256 matching = (flux != header.flux.cend());
261 JEvtWeightFactorHelper_t* helper =
dynamic_cast<JEvtWeightFactorHelper_t*
>(this->
get());
263 if (helper != NULL) {
265 helper->configure(factor);
286 template<
class JEvtWeightFactor_t = JEvtWeightFactor>
294 typedef typename JEvtWeightFactorMultiParticle_t::const_iterator const_iterator;
296 bool matching = (!multiParticleFactor.empty());
300 for (const_iterator i = multiParticleFactor.cbegin(); i != multiParticleFactor.cend() && matching; ++i) {
306 matching = (flux != header.flux.cend());
311 JEvtWeightFactorHelper_t* helper =
dynamic_cast<JEvtWeightFactorHelper_t*
>(this->
get());
313 if (helper != NULL) {
315 helper->configure(multiParticleFactor);
335 const JFlux&
function)
337 return setEvtWeightFactor<JFlux>(type,
function);
352 const JFlux&
function)
354 return setEvtWeightFactor<JFlux>(types,
function);
369 return setEvtWeightFactor<JFlux>(multiParticleFlux);
bool is_mupage(const JHead &header)
Check for generator.
JEvtWeighter getEventWeighter
Function object for mapping header to event weighter.
void configure(const JEvtWeight &weighter)
Configuration.
void reset(const JEvtWeight &weighter)
Reset file scanner and event weighter.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
bool setFlux(const std::set< int > &types, const JFlux &function)
Set flux function corresponding to a given set of PDG codes.
JEvtWeightFileScanner(const JMultipleFileScanner_t &input)
Constructor.
bool setEvtWeightFactor(const int type, const JEvtWeightFactor_t &factor)
Set event-weight factor corresponding to a given PDG code.
const JHead & getHeader() const
Get header.
Recording of objects on file according a format that follows from the file name extension.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
bool check(const JHead &header) const
Check if a given header is consistent with this event weighter.
then echo Enter input within $TIMEOUT_S seconds echo n User name
#define MAKE_STRING(A)
Make string.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Exception for missing value.
Low-level interface for event weighing.
bool setEvtWeightFactor(const JEvtWeightFactorMultiParticle< JEvtWeightFactor_t > &multiParticleFactor)
Set event-weight factor corresponding to a given multi-particle weighting factor interface.
Implementation of event-weight factor for multiple particle types.
Helper class for event-weight factor.
bool setFlux(const int type, const JFlux &function)
Set flux function corresponding to a given PDG code.
Low-level interface for retrieving the flux corresponding to a given event.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Auxiliary base class for list of file names.
JEvtWeightFileScanner()
Default constructor.
bool put(const std::string &input)
Put file.
size_t put(const JMultipleFileScanner_t &input)
Put list of files.
Template event-weighter-associated file scanner.
virtual void reset() override
Reset pointer.
Low-level interface for retrieving a specifiable multiplication factor corresponding to a given event...
bool setFlux(const JEvtWeightFactorMultiParticle< JFlux > &multiParticleFlux)
Set flux function corresponding to a given multi-particle flux interface.
bool setEvtWeightFactor(const std::set< int > &types, const JEvtWeightFactor_t &factor)
Set event-weight factor corresponding to a given set of PDG codes.
Helper class for event weighing.
void add(const JHead &header)
Add header.
JEvtWeightFileScanner(const JEvtWeight &weighter)
Constructor.
std::string getProgramName() const
Get name of simulation program.