Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JFlatFlux.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JFLATFLUX__
2 #define __JAANET__JFLATFLUX__
3 
4 #include "JLang/JComparable.hh"
5 
7 
8 
9 /**
10  * \author bjung
11  */
12 
13 namespace JAANET {}
14 namespace JPP { using namespace JAANET; }
15 
16 namespace JAANET {
17 
18 
19  /**
20  * Function object for constant fluxes.
21  */
22  struct JFlatFlux :
23  public JLANG::JComparable<JFlatFlux>
24  {
25  /**
26  * Default constructor.
27  */
29  flux(0.0)
30  {}
31 
32 
33  /**
34  * Constructor.
35  *
36  * \param flux [GeV * m^-2 * sr^-1 * s^-1]
37  */
38  JFlatFlux(const double flux) :
39  flux(flux)
40  {}
41 
42 
43  /**
44  * Get flux of given event.
45  *
46  * \param evt event
47  * \return flux [GeV * m^-2 * sr^-1 * s^-1]
48  */
49  double operator()(const Evt& evt) const
50  {
51  return flux;
52  }
53 
54 
55  /**
56  * Check if this flux is less than given flux.
57  *
58  * \param object flat flux object
59  * \return true if this flux less than given flux; else false
60  */
61  bool less(const JFlatFlux& object) const
62  {
63  return this->flux < object.flux;
64  }
65 
66 
67  /**
68  * Stream input.
69  *
70  * \param in input stream
71  * \param object uniform flux
72  * \return input stream
73  */
74  friend inline std::istream& operator>>(std::istream& in, JFlatFlux& object)
75  {
76  in >> object.flux;
77 
78  return in;
79  }
80 
81 
82  /**
83  * Write flux to output stream.
84  *
85  * \param out output stream
86  * \param object uniform
87  * \return output stream
88  */
89  friend inline std::ostream& operator<<(std::ostream& out, const JFlatFlux& object)
90  {
91  const JFormat format(out);
92 
93  out << FIXED(5,3) << object.flux;
94 
95  return out;
96  }
97 
98  double flux; //!< flux [GeV * m^-2 * sr^-1 * s^-1]
99  };
100 
101 
102  /**
103  * Auxiliary method for creating an interface to a flat flux function.
104  *
105  * \param flux flux [GeV * m^-2 * sr^-1 * s^-1]
106  */
108 
109  const JFlatFlux flatFlux(flux);
110 
111  return make_fluxFunction(flatFlux);
112  }
113 }
114 
115 #endif
Implementation of event-weight factor interface.
JFlatFlux(const double flux)
Constructor.
Definition: JFlatFlux.hh:38
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
JEvtWeightFactorFunction< JFunction_t, JFlux > make_fluxFunction(const JFunction_t &flux)
Auxiliary method for creating an interface to a flux function.
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:634
bool less(const JFlatFlux &object) const
Check if this flux is less than given flux.
Definition: JFlatFlux.hh:61
flux()
Default constructor.
Definition: JHead.hh:911
Neutrino flux.
Definition: JHead.hh:906
friend std::istream & operator>>(std::istream &in, JFlatFlux &object)
Stream input.
Definition: JFlatFlux.hh:74
friend std::ostream & operator<<(std::ostream &out, const JFlatFlux &object)
Write flux to output stream.
Definition: JFlatFlux.hh:89
double operator()(const Evt &evt) const
Get flux of given event.
Definition: JFlatFlux.hh:49
Template definition of auxiliary base class for comparison of data structures.
Definition: JComparable.hh:24
Function object for constant fluxes.
Definition: JFlatFlux.hh:22
double flux
flux [GeV * m^-2 * sr^-1 * s^-1]
Definition: JFlatFlux.hh:98
JFlatFlux()
Default constructor.
Definition: JFlatFlux.hh:28
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
JEvtWeightFactorFunction< JFlatFlux, JFlux > make_flatFluxFunction(const double flux)
Auxiliary method for creating an interface to a flat flux function.
Definition: JFlatFlux.hh:107
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20