Jpp
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"
9 #include "JDetector/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  /**
22  * Default implementation of the simulation of K40 background.
23  * This class implements the JK40Simulator interface.
24  */
27  public JK40Rates
28  {
29  public:
30  /**
31  * Default constructor.
32  */
34  JK40Rates()
35  {}
36 
37 
38  /**
39  * Constructor.
40  *
41  * \param rates K40 rates [Hz]
42  */
44  JK40Rates(rates)
45  {}
46 
47 
48  /**
49  * Get reference to unique instance of this class object.
50  *
51  * This method returns an object with default values.
52  * The singles and multiples rates are taken from KM3NeT
53  * internal note "Detector simulations for KM3NeT".
54  *
55  * \return reference to this class object
56  */
58  {
59  static JK40DefaultSimulator k40Simulator(JK40Rates::getInstance());
60 
61  return k40Simulator;
62  }
63 
64 
65  /**
66  * Get singles rate as a function of PMT.
67  *
68  * \param pmt PMT identifier
69  * \return rate [Hz]
70  */
71  virtual double getSinglesRate(const JPMTIdentifier& pmt) const
72  {
74  }
75 
76 
77  /**
78  * Get multiples rate as a function of optical module.
79  *
80  * \param module optical module identifier
81  * \param M multiplicity (M >= 2)
82  * \return rate [Hz]
83  */
84  virtual double getMultiplesRate(const JModuleIdentifier& module, const int M) const
85  {
87  }
88 
89 
90  /**
91  * Get probability of coincidence.
92  *
93  * \param ct cosine space angle between PMT axes
94  * \return probability
95  */
96  virtual double getProbability(const double ct) const
97  {
98  return exp(ct * (p1() + ct * (p2() + ct * (p3() + ct*p4()))));
99  }
100 
101 
102  /**
103  * Read K40 simulator from input.
104  *
105  * \param in input stream
106  * \param object K40 simulator
107  * \return input stream
108  */
109  friend inline std::istream& operator>>(std::istream& in, JK40DefaultSimulator& object)
110  {
111  const double rateL0 = object.rateL0;
112 
113  if (in >> object.rateL0) {
114 
115  object.rateL1.clear();
116 
117  for (double x; in >> x; ) {
118  object.rateL1.push_back(x);
119  }
120 
121  } else {
122 
123  object.rateL0 = rateL0;
124  }
125 
126  return in;
127  }
128 
129 
130  /**
131  * Write K40 simulator to output.
132  *
133  * \param out output stream
134  * \param object K40 simulator
135  * \return output stream
136  */
137  friend inline std::ostream& operator<<(std::ostream& out, const JK40DefaultSimulator& object)
138  {
139  out << object.rateL0;
140 
141  for (JRateL1_t::const_iterator i = object.rateL1.begin(); i != object.rateL1.end(); ++i) {
142  out << ' ' << *i;
143  }
144 
145  return out;
146  }
147 
148 
149  protected:
150  /**
151  * Parameters for probability of coincidence as a function of
152  * the cosine of space angle between PMT axes.
153  * Values are provided by V.Kulikovski.
154  */
155  static double p1() { return 2.85261; }
156  static double p2() { return -0.949097; }
157  static double p3() { return 0.182419; }
158  static double p4() { return 1.23075; }
159  };
160 }
161 
162 #endif
JDETECTOR::JK40DefaultSimulator::p2
static double p2()
Definition: JK40DefaultSimulator.hh:156
JDETECTOR::JK40DefaultSimulator
Default implementation of the simulation of K40 background.
Definition: JK40DefaultSimulator.hh:25
JDETECTOR::JK40Rates::rateL1
JRateL1_t rateL1
multiples rates [Hz]
Definition: JK40Rates.hh:237
JK40Rates.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JDETECTOR::JK40Rates
Auxiliary class for K40 rates.
Definition: JK40Rates.hh:41
JDETECTOR::JK40DefaultSimulator::JK40DefaultSimulator
JK40DefaultSimulator(const JK40Rates &rates)
Constructor.
Definition: JK40DefaultSimulator.hh:43
JDETECTOR::JK40Rates::getSinglesRate
double getSinglesRate() const
Get singles rate.
Definition: JK40Rates.hh:97
JDETECTOR::JK40DefaultSimulator::JK40DefaultSimulator
JK40DefaultSimulator()
Default constructor.
Definition: JK40DefaultSimulator.hh:33
JDETECTOR::JK40DefaultSimulator::getProbability
virtual double getProbability(const double ct) const
Get probability of coincidence.
Definition: JK40DefaultSimulator.hh:96
JDETECTOR::JK40DefaultSimulator::operator<<
friend std::ostream & operator<<(std::ostream &out, const JK40DefaultSimulator &object)
Write K40 simulator to output.
Definition: JK40DefaultSimulator.hh:137
JDETECTOR::JK40DefaultSimulator::p1
static double p1()
Parameters for probability of coincidence as a function of the cosine of space angle between PMT axes...
Definition: JK40DefaultSimulator.hh:155
JDETECTOR::JK40DefaultSimulator::getInstance
static JK40DefaultSimulator & getInstance()
Get reference to unique instance of this class object.
Definition: JK40DefaultSimulator.hh:57
JDETECTOR::JK40Rates::getInstance
static JK40Rates & getInstance()
Get reference to unique instance of this class object.
Definition: JK40Rates.hh:75
JLANG::JObjectID
Auxiliary class for object identification.
Definition: JObjectID.hh:27
JDETECTOR::JK40Rates::rateL0
JRateL0_t rateL0
singles rate [Hz]
Definition: JK40Rates.hh:236
JDETECTOR::JK40DefaultSimulator::getSinglesRate
virtual double getSinglesRate(const JPMTIdentifier &pmt) const
Get singles rate as a function of PMT.
Definition: JK40DefaultSimulator.hh:71
JDETECTOR::JK40DefaultSimulator::getMultiplesRate
virtual double getMultiplesRate(const JModuleIdentifier &module, const int M) const
Get multiples rate as a function of optical module.
Definition: JK40DefaultSimulator.hh:84
JDETECTOR::JK40DefaultSimulator::operator>>
friend std::istream & operator>>(std::istream &in, JK40DefaultSimulator &object)
Read K40 simulator from input.
Definition: JK40DefaultSimulator.hh:109
JDETECTOR::JK40DefaultSimulator::p4
static double p4()
Definition: JK40DefaultSimulator.hh:158
JDETECTOR::JPMTIdentifier
PMT identifier.
Definition: JPMTIdentifier.hh:30
JK40DefaultSimulatorInterface.hh
JDETECTOR::JK40Rates::getMultiplesRate
double getMultiplesRate(const multiplicity_type M) const
Get multiples rate.
Definition: JK40Rates.hh:109
JDETECTOR::JK40DefaultSimulator::p3
static double p3()
Definition: JK40DefaultSimulator.hh:157
JDETECTOR::JK40DefaultSimulatorInterface
Default K40 simulator interface.
Definition: JK40DefaultSimulatorInterface.hh:35
JDETECTOR
Auxiliary classes and methods for detector calibration.
Definition: JAnchor.hh:12
JCC.hh