37 inline double zeroFlux(
const Evt& evt)
61 JFlatFlux(
const double flux) :
72 double operator()(
const Evt& evt)
const
85 friend inline std::istream&
operator>>(std::istream&
in, JFlatFlux&
object)
100 friend inline std::ostream&
operator<<(std::ostream& out,
const JFlatFlux&
object)
104 out <<
FIXED(5,3) <<
object.flux;
133 JPowerLawFlux(
const double normalisation,
134 const double spectralIndex) :
135 normalisation(normalisation),
136 spectralIndex(spectralIndex)
146 double operator()(
const Evt& evt)
const
155 return normalisation *
pow(neutrino.
E, -spectralIndex);
171 inline friend std::istream&
operator>>(std::istream&
in,
172 JPowerLawFlux&
object)
174 return in >>
object.normalisation
175 >>
object.spectralIndex;
186 inline friend std::ostream&
operator<<(std::ostream& out,
187 const JPowerLawFlux&
object)
191 out <<
FIXED(5,3) <<
object.normalisation <<
' '
192 <<
FIXED(5,3) <<
object.spectralIndex;
198 double normalisation;
199 double spectralIndex;
218 int main(
int argc,
char **argv)
236 fluxMaps[
"zero"] = zeroFluxes;
237 fluxMaps[
"flat"] = flatFluxes;
238 fluxMaps[
"powerlaw"] = powerlawFluxes;
244 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
249 catch(
const exception& error) {
250 FATAL(error.what() << endl);
259 FATAL(
"Particle type " << i->first <<
" does not correspond to a neutrino." << endl);
284 size_t n = scanners.
setFlux(multiFlux);
287 WARNING(
"No file found containing all given primaries; Flux function not set." << endl);
295 if (scanner->simul.size() > 0) {
296 STATUS(
"Scanning " << scanner->simul[0].program <<
" files..." << endl);
301 while (scanner->hasNext()) {
303 const Evt*
event = scanner->next();
304 const double weight = scanner->getWeight(*event);
Utility class to parse command line options.
Implementation of flux function for multiple particle types.
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.
void insert(const int type, const JFlux &flux)
Insert pair of particle code and flux function.
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)
Auxiliary class for organising Monte Carlo file scanners.
Utility class to parse parameter values.
std::vector< value_type >::iterator iterator
Auxiliary class for defining the range of iterations of objects.
I/O formatting auxiliaries.
Exception for null pointer operation.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
size_t setFlux(const int type, const JFlux &function)
Set flux function for all MC-files corresponding to a given PDG code.
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 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.
alias put_queue eval echo n
int id
offline event identifier
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
#define DEBUG(A)
Message macros.