38 inline double zeroFlux(
const Evt& evt)
62 JFlatFlux(
const double flux) :
73 double operator()(
const Evt& evt)
const
86 friend inline std::istream&
operator>>(std::istream&
in, JFlatFlux&
object)
101 friend inline std::ostream&
operator<<(std::ostream& out,
const JFlatFlux&
object)
105 out <<
FIXED(5,3) <<
object.flux;
134 JPowerLawFlux(
const double normalisation,
135 const double spectralIndex) :
136 normalisation(normalisation),
137 spectralIndex(spectralIndex)
147 double operator()(
const Evt& evt)
const
156 return normalisation *
pow(neutrino.
E, -spectralIndex);
172 inline friend std::istream&
operator>>(std::istream&
in,
173 JPowerLawFlux&
object)
175 return in >>
object.normalisation
176 >>
object.spectralIndex;
187 inline friend std::ostream&
operator<<(std::ostream& out,
188 const JPowerLawFlux&
object)
192 out <<
FIXED(5,3) <<
object.normalisation <<
' '
193 <<
FIXED(5,3) <<
object.spectralIndex;
199 double normalisation;
200 double spectralIndex;
219 int main(
int argc,
char **argv)
236 fluxMaps[
"zero"] = zeroFluxes;
237 fluxMaps[
"flat"] = flatFluxes;
238 fluxMaps[
"powerlaw"] = powerlawFluxes;
248 catch(
const exception& error) {
249 FATAL(error.what() << endl);
258 FATAL(
"Particle type " << i->first <<
" does not correspond to a neutrino." << endl);
283 const size_t n = scanners.
setFlux(multiFlux);
286 WARNING(
"No file found containing all given primaries; Flux function not set." << endl);
294 if (scanner->simul.size() > 0) {
295 STATUS(
"Scanning " << scanner->simul[0].program <<
" files..." << endl);
300 while (scanner->hasNext()) {
302 const Evt*
event = scanner->next();
303 const double weight = scanner->getWeight(*event);
Utility class to parse command line options.
void insert(const int type, const JEvtWeightFactor_t &factor)
Insert pair of particle code and event-weight factor.
int main(int argc, char *argv[])
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Utility class to parse parameter values.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
JEvtWeightFactorFunction< JFunction_t, JFlux > make_fluxFunction(const JFunction_t &flux)
Auxiliary method for creating an interface to a flux function.
double E
Energy [GeV] (either MC truth or reconstructed)
std::vector< value_type >::iterator iterator
Utility class to parse parameter values.
I/O formatting auxiliaries.
Exception for null pointer operation.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Implementation of event-weight factor for multiple particle types.
T pow(const T &x, const double y)
Power .
General purpose messaging.
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.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
Utility class to parse command line options.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
size_t setFlux(const int type, const JFlux &flux)
Set flux function for all MC-files corresponding to a given PDG code.
int id
offline event identifier
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.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
Auxiliaries for defining the range of iterations of objects.
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
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
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