Jpp  15.0.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JK40DefaultSimulator.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JK40DEFAULTSIMULATOR__
2 #define __JDETECTOR__JK40DEFAULTSIMULATOR__
3 
4 #include <vector>
5 #include <cmath>
6 
7 #include "JLang/JCC.hh"
8 #include "JPhysics/JK40Rates.hh"
9 #include "JPhysics/KM3NeT.hh"
11 
12 
13 /**
14  * \author mdejong
15  */
16 
17 namespace JDETECTOR {}
18 namespace JPP { using namespace JDETECTOR; }
19 
20 namespace JDETECTOR {
21 
22  using JPHYSICS::JK40Rates;
23  using JPHYSICS::JRateL0_t;
24  using JPHYSICS::JRateL1_t;
25 
26  /**
27  * Default implementation of the simulation of K40 background.
28  * This class implements the JK40Simulator interface.
29  */
32  public JK40Rates
33  {
34  public:
35  /**
36  * Default constructor.
37  */
39  JK40Rates()
40  {}
41 
42 
43  /**
44  * Constructor.
45  *
46  * \param rates K40 rates [Hz]
47  */
49  JK40Rates(rates)
50  {}
51 
52 
53  /**
54  * Get reference to unique instance of this class object.
55  *
56  * This method returns an object with default values.
57  * The singles and multiples rates are taken from %KM3NeT
58  * internal note "Detector simulations for KM3NeT".
59  *
60  * \return reference to this class object
61  */
63  {
64  static JK40DefaultSimulator k40Simulator(KM3NET::getK40Rates());
65 
66  return k40Simulator;
67  }
68 
69 
70  /**
71  * Get singles rate as a function of PMT.
72  *
73  * \param pmt PMT identifier
74  * \return rate [Hz]
75  */
76  virtual double getSinglesRate(const JPMTIdentifier& pmt) const override
77  {
79  }
80 
81 
82  /**
83  * Get multiples rate as a function of optical module.
84  *
85  * \param module optical module identifier
86  * \param M multiplicity (M >= 2)
87  * \return rate [Hz]
88  */
89  virtual double getMultiplesRate(const JModuleIdentifier& module, const int M) const override
90  {
92  }
93 
94 
95  /**
96  * Get probability of coincidence.
97  *
98  * \param ct cosine space angle between PMT axes
99  * \return probability
100  */
101  virtual double getProbability(const double ct) const override
102  {
103  return exp(ct * (p1() + ct * (p2() + ct * (p3() + ct*p4()))));
104  }
105 
106 
107  /**
108  * Read K40 simulator from input.
109  *
110  * \param in input stream
111  * \param object K40 simulator
112  * \return input stream
113  */
114  friend inline std::istream& operator>>(std::istream& in, JK40DefaultSimulator& object)
115  {
116  const double rateL0 = object.rateL0;
117 
118  if (in >> object.rateL0) {
119 
120  object.rateL1.clear();
121 
122  for (double x; in >> x; ) {
123  object.rateL1.push_back(x);
124  }
125 
126  } else {
127 
128  object.rateL0 = rateL0;
129  }
130 
131  return in;
132  }
133 
134 
135  /**
136  * Write K40 simulator to output.
137  *
138  * \param out output stream
139  * \param object K40 simulator
140  * \return output stream
141  */
142  friend inline std::ostream& operator<<(std::ostream& out, const JK40DefaultSimulator& object)
143  {
144  out << object.rateL0;
145 
146  for (JRateL1_t::const_iterator i = object.rateL1.begin(); i != object.rateL1.end(); ++i) {
147  out << ' ' << *i;
148  }
149 
150  return out;
151  }
152 
153 
154  protected:
155  /**
156  * Parameters for probability of coincidence as a function of
157  * the cosine of space angle between PMT axes.
158  * Values are provided by V.Kulikovski.
159  */
160  static double p1() { return 3.0767; }
161  static double p2() { return -1.2078; }
162  static double p3() { return 0.9905; }
163  static double p4() { return 0.9379; }
164  };
165 }
166 
167 #endif
static JK40DefaultSimulator & getInstance()
Get reference to unique instance of this class object.
do $JPP JMEstimator M
Definition: JMEstimator.sh:37
Default implementation of the simulation of K40 background.
static double p1()
Parameters for probability of coincidence as a function of the cosine of space angle between PMT axes...
virtual double getProbability(const double ct) const override
Get probability of coincidence.
const JK40Rates & getK40Rates()
Get K40 rates.
Definition: KM3NeT.hh:36
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable STRING $argv[2] set_array QUANTILES set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"` typeset -Z 4 STRING JOpera1D -f hydrophone.root
JK40DefaultSimulator()
Default constructor.
virtual double getSinglesRate(const JPMTIdentifier &pmt) const override
Get singles rate as a function of PMT.
Compiler version dependent expressions, macros, etc.
Properties of KM3NeT PMT and deep-sea water.
JK40DefaultSimulator(const JK40Rates &rates)
Constructor.
JRateL1_t rateL1
multiples rates [Hz]
Definition: JK40Rates.hh:211
double getMultiplesRate(const multiplicity_type M) const
Get multiples rate.
Definition: JK40Rates.hh:83
friend std::ostream & operator<<(std::ostream &out, const JK40DefaultSimulator &object)
Write K40 simulator to output.
friend std::istream & operator>>(std::istream &in, JK40DefaultSimulator &object)
Read K40 simulator from input.
double getSinglesRate() const
Get singles rate.
Definition: JK40Rates.hh:71
Auxiliary class for object identification.
Definition: JObjectID.hh:22
std::vector< double > JRateL1_t
Type definition of count rate as a function of multiplicty [Hz] The multiples rate start counting at ...
Definition: JK40Rates.hh:27
double JRateL0_t
Type definition of singles rate [Hz].
Definition: JK40Rates.hh:21
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
Definition: JCanberra.sh:41
virtual double getMultiplesRate(const JModuleIdentifier &module, const int M) const override
Get multiples rate as a function of optical module.
JRateL0_t rateL0
singles rate [Hz]
Definition: JK40Rates.hh:210
Auxiliary class for K40 rates.
Definition: JK40Rates.hh:41