36 inline double zeroFlux(
const Evt& evt)
60 JFlatFlux(
const double flux) :
71 double operator()(
const Evt& evt)
const
84 friend inline std::istream&
operator>>(std::istream&
in, JFlatFlux&
object)
99 friend inline std::ostream&
operator<<(std::ostream& out,
const JFlatFlux&
object)
103 out <<
FIXED(5,3) <<
object.flux;
132 JPowerLawFlux(
const double normalisation,
133 const double spectralIndex) :
134 normalisation(normalisation),
135 spectralIndex(spectralIndex)
145 double operator()(
const Evt& evt)
const
154 return normalisation *
pow(neutrino.
E, -spectralIndex);
170 inline friend std::istream&
operator>>(std::istream&
in,
171 JPowerLawFlux&
object)
173 return in >>
object.normalisation
174 >>
object.spectralIndex;
185 inline friend std::ostream&
operator<<(std::ostream& out,
186 const JPowerLawFlux&
object)
190 out <<
FIXED(5,3) <<
object.normalisation <<
' '
191 <<
FIXED(5,3) <<
object.spectralIndex;
197 double normalisation;
198 double spectralIndex;
217 int main(
int argc,
char **argv)
234 fluxMaps[
"zero"] = zeroFluxes;
235 fluxMaps[
"flat"] = flatFluxes;
236 fluxMaps[
"powerlaw"] = powerlawFluxes;
246 catch(
const exception& error) {
247 FATAL(error.what() << endl);
256 FATAL(
"Particle type " << i->first <<
" does not correspond to a neutrino." << endl);
281 const size_t n = scanners.
setFlux(multiFlux);
284 WARNING(
"No file found containing all given primaries; Flux function not set." << endl);
292 if (scanner->simul.size() > 0) {
293 STATUS(
"Scanning " << scanner->simul[0].program <<
" files..." << endl);
298 while (scanner->hasNext()) {
300 const Evt*
event = scanner->next();
301 const double weight = scanner->getWeight(*event);
Utility class to parse command line options.
int main(int argc, char *argv[])
void insert(const int type, const JEvtWeightFactor &factor)
Insert pair of particle code and event-weight factor.
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.
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...
JFluxFunction< JFunction_t > make_fluxFunction(const JFunction_t &function)
Auxiliary method for creating an interface to a flux function.
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 &function)
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