Jpp
 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"
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
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...
double getSinglesRate() const
Get singles rate.
Definition: JK40Rates.hh:97
JRateL1_t rateL1
multiples rates [Hz]
Definition: JK40Rates.hh:237
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
Definition: JTransitTime.sh:36
JK40DefaultSimulator()
Default constructor.
Compiler version dependent expressions, macros, etc.
JK40DefaultSimulator(const JK40Rates &rates)
Constructor.
virtual double getMultiplesRate(const JModuleIdentifier &module, const int M) const
Get multiples rate as a function of optical module.
static JK40Rates & getInstance()
Get reference to unique instance of this class object.
Definition: JK40Rates.hh:75
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 getMultiplesRate(const multiplicity_type M) const
Get multiples rate.
Definition: JK40Rates.hh:109
virtual double getProbability(const double ct) const
Get probability of coincidence.
JRateL0_t rateL0
singles rate [Hz]
Definition: JK40Rates.hh:236
Auxiliary class for object identification.
Definition: JObjectID.hh:27
virtual double getSinglesRate(const JPMTIdentifier &pmt) const
Get singles rate as a function of PMT.
then set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable OUTPUT_FILE histogram.root JHistogram1D -o $WORKDIR/$OUTPUT_FILE -F "$FORMULA" -
Auxiliary class for K40 rates.
Definition: JK40Rates.hh:41