61 zap[
'F'] =
make_field(formula,
"Reweighting formula, e.g.: \"[0] + [1]*x[0]\"") =
"";
67 catch(
const exception& error) {
68 FATAL(error.what() << endl);
79 FATAL(
"MC-header is incompatible with MUPAGE.");
85 JEvtWeightFactorMupage reweighter(
"reweighter", formula.c_str());
87 if (reweighter.GetNdim() > JEvtWeightFactorMupage::NUMBER_OF_VARIABLES) {
89 FATAL(
"Invalid formula " << formula <<
" (number of dimensions must be < " <<
90 JEvtWeightFactorMupage::NUMBER_OF_VARIABLES <<
"; see `JAANET::JEvtWeightFactorMupage`).");
93 if (
size_t(reweighter.GetNpar()) !=
parameters.size()) {
95 FATAL(
"Not all parameters have been specified.");
107 reweighter.SetParameter(index,
getValue(*i, 0));
111 FATAL(error << endl);
118 FATAL(
"Setting of reweighting factor was unsuccessful.");
132 out.put(
JMeta(argc, argv));
140 while (scanner.hasNext()) {
142 Evt*
event = scanner.next();
146 double weight = scanner.getWeight(*event);
151 if (!isfinite(weight)) {
153 WARNING(
"Non-finite reweighting factor " << weight <<
154 " for event " << scanner.getCounter() <<
"!");
167 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)...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
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.
JEvtWeightFactorFunction< JFunction_t > make_weightFactor(const JFunction_t &function)
Auxiliary method for creating an interface to an event-weight factor.
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