63 zap[
'F'] =
make_field(formula,
"Reweighting formula, e.g.: \"[0] + [1]*x[0]\"") =
"";
69 catch(
const exception& error) {
70 FATAL(error.what() << endl);
81 FATAL(
"MC-header is incompatible with MUPAGE.");
89 if (reweighter.GetNdim() > JEvtWeightFactorMupage::NUMBER_OF_VARIABLES) {
91 FATAL(
"Invalid formula " << formula <<
" (number of dimensions must be < " <<
92 JEvtWeightFactorMupage::NUMBER_OF_VARIABLES <<
"; see `JAANET::JEvtWeightFactorMupage`).");
95 if (
size_t(reweighter.GetNpar()) !=
parameters.size()) {
97 FATAL(
"Not all parameters have been specified.");
109 reweighter.SetParameter(index,
getValue(*i, 0));
113 FATAL(error << endl);
120 FATAL(
"Setting of reweighting factor was unsuccessful.");
134 out.put(
JMeta(argc, argv));
142 while (scanner.hasNext()) {
144 Evt*
event = scanner.next();
148 double weight = scanner.getWeight(*event);
153 if (!isfinite(weight)) {
155 WARNING(
"Non-finite reweighting factor " << weight <<
156 " for event " << scanner.getCounter() <<
"!");
169 WARNING(
"Event " << scanner.getCounter() <<
" is empty; skip.");
bool is_mupage(const JHead &header)
Check for generator.
static const int RESCALED_WEIGHT_INDEX
Index of rescaled weight.
Utility class to parse command line options.
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
int getParameter(const std::string &text)
Get parameter number from text string.
const JHead & getHeader() const
Get header.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
JEvtWeightFactorFunction< JFunction_t, JEvtWeightFactor_t > make_weightFactor(const JFunction_t &function)
Auxiliary method for creating an interface to an event-weight factor.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Implementation of reweighting factor for mupage events according to a specifiable ROOT TFormula...
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
General purpose class for object reading from a list of file names.
Wrapper class around string.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
void copy(const Head &from, JHead &to)
Copy header from from to to.
Exception for parsing value.
virtual void open(const char *file_name) override
Open file.
Template event-weighter-associated file scanner.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Auxiliary data structure for floating point format specification.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
std::vector< double > weight