Jpp - 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"
10 
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace JDETECTOR {}
17 namespace JPP { using namespace JDETECTOR; }
18 
19 namespace JDETECTOR {
20 
21  using JPHYSICS::JK40Rates;
22  using JPHYSICS::JRateL0_t;
23  using JPHYSICS::JRateL1_t;
24 
25  /**
26  * Default implementation of the simulation of K40 background.
27  * This class implements the JK40Simulator interface.
28  */
31  public JK40Rates
32  {
33  public:
34  /**
35  * Default constructor.
36  */
38  JK40Rates()
39  {}
40 
41 
42  /**
43  * Constructor.
44  *
45  * \param rates K40 rates [Hz]
46  */
48  JK40Rates(rates)
49  {}
50 
51 
52  /**
53  * Get reference to unique instance of this class object.
54  *
55  * This method returns an object with default values.
56  * The singles and multiples rates are taken from %KM3NeT
57  * internal note "Detector simulations for KM3NeT".
58  *
59  * \return reference to this class object
60  */
62  {
63  static JK40DefaultSimulator k40Simulator(JK40Rates::getInstance());
64 
65  return k40Simulator;
66  }
67 
68 
69  /**
70  * Get singles rate as a function of PMT.
71  *
72  * \param pmt PMT identifier
73  * \return rate [Hz]
74  */
75  virtual double getSinglesRate(const JPMTIdentifier& pmt) const override
76  {
78  }
79 
80 
81  /**
82  * Get multiples rate as a function of optical module.
83  *
84  * \param module optical module identifier
85  * \param M multiplicity (M >= 2)
86  * \return rate [Hz]
87  */
88  virtual double getMultiplesRate(const JModuleIdentifier& module, const int M) const override
89  {
91  }
92 
93 
94  /**
95  * Get probability of coincidence.
96  *
97  * \param ct cosine space angle between PMT axes
98  * \return probability
99  */
100  virtual double getProbability(const double ct) const override
101  {
102  return exp(ct * (p1() + ct * (p2() + ct * (p3() + ct*p4()))));
103  }
104 
105 
106  /**
107  * Read K40 simulator from input.
108  *
109  * \param in input stream
110  * \param object K40 simulator
111  * \return input stream
112  */
113  friend inline std::istream& operator>>(std::istream& in, JK40DefaultSimulator& object)
114  {
115  const double rateL0 = object.rateL0;
116 
117  if (in >> object.rateL0) {
118 
119  object.rateL1.clear();
120 
121  for (double x; in >> x; ) {
122  object.rateL1.push_back(x);
123  }
124 
125  } else {
126 
127  object.rateL0 = rateL0;
128  }
129 
130  return in;
131  }
132 
133 
134  /**
135  * Write K40 simulator to output.
136  *
137  * \param out output stream
138  * \param object K40 simulator
139  * \return output stream
140  */
141  friend inline std::ostream& operator<<(std::ostream& out, const JK40DefaultSimulator& object)
142  {
143  out << object.rateL0;
144 
145  for (JRateL1_t::const_iterator i = object.rateL1.begin(); i != object.rateL1.end(); ++i) {
146  out << ' ' << *i;
147  }
148 
149  return out;
150  }
151 
152 
153  protected:
154  /**
155  * Parameters for probability of coincidence as a function of
156  * the cosine of space angle between PMT axes.
157  * Values are provided by V.Kulikovski.
158  */
159  static double p1() { return 3.0767; }
160  static double p2() { return -1.2078; }
161  static double p3() { return 0.9905; }
162  static double p4() { return 0.9379; }
163  };
164 }
165 
166 #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.
then set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))*exp(-0.5 *(y-[1])*(y-[1])/([2]*[2]))" JF2 -o $WORKDIR/f2.root -F "$FORMULA" -@ "p0
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.
JK40DefaultSimulator(const JK40Rates &rates)
Constructor.
JRateL1_t rateL1
multiples rates [Hz]
Definition: JK40Rates.hh:237
double getMultiplesRate(const multiplicity_type M) const
Get multiples rate.
Definition: JK40Rates.hh:109
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:97
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:38
static JK40Rates & getInstance()
Get reference to unique instance of this class object.
Definition: JK40Rates.hh:75
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:236
Auxiliary class for K40 rates.
Definition: JK40Rates.hh:41