55{
59
61
63 JLimit_t& numberOfEvents = inputFile.getLimit();
66 double TMax_ns;
70 string option;
72
73 try {
74
75 JParser<> zap(
"Example program to determine N-fold coincidence rates.");
76
87
89 }
90 catch(const exception &error) {
92 }
93
94
96
97 try {
99 }
102 }
103
105
107
108 TMax_s[2] = 5.0e-2;
109 TMax_s[3] = 0.2e+0;
110 TMax_s[4] = 1.0e+0;
111 TMax_s[5] = 1.0e+1;
112 TMax_s[6] = 1.0e+2;
113
116
118
120
123
126
128
130
132
134
135
136
138
140
141 ps->configure(*i);
142
144
145 for ( ; ps->hasNext() && counter != inputFile.getLimit(); ++counter) {
146
148
150
151 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
152
153 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, router.getModule(frame->getModuleID()));
154
155 for (JSuperFrame2D_t::iterator i = buffer.begin(); i != buffer.end(); ++i) {
156 i->join(match);
157 }
158
159 JSuperFrame1D_t&
data = JSuperFrame1D_t::multiplex(buffer);
160
161 if (
data.size() > 1) {
162
163 TH1D* h1 =
H1[frame->getModuleID()];
164 TH1D* t1 =
T1[frame->getModuleID()];
165
167
169
170 while (++q !=
data.end() && q->getT() - p->getT() <= TMax_ns ) {}
171
173
175
176 const int i = router.getIndex(frame->getModuleID());
177 const double ts =
getTimeOfRTS(frame->getFrameIndex()) + p->getT();
178
179 t1->Fill((ts - t0[i]) * 1.0e-9);
180
181 t0[i] = ts;
182
184
188 }
189 }
190 }
191
192 p = q;
193 }
194 }
195 }
196 }
198 }
199
200 if (counter != 0) {
201
202 const double V = (
H1->GetXaxis()->GetXmax() -
H1->GetXaxis()->GetXmin()) / (
double)
H1->GetXaxis()->GetNbins();
204
205 for (JManager_t::iterator i =
H1.begin(); i !=
H1.end(); ++i) {
206 i->second->Scale(1.0/(V*W));
207 }
208
209 for (JManager_t::iterator i =
T1.begin(); i !=
T1.end(); ++i) {
210 i->second->Scale(1.0/i->second->GetMaximum());
211 }
212 }
213
215
216 const double V = (
H1->GetXaxis()->GetXmax() -
H1->GetXaxis()->GetXmin()) / (
double)
H1->GetXaxis()->GetNbins();
217
220 const int PRECISION = (
M.getLowerLimit() > 2 ? 4 : 3);
221
223
224 out <<
"Multiplicity " <<
M <<
endl;
225 out <<
"-------------------------------------------------------" <<
endl;
226 out <<
" location | Gauss | S - B | Total | slope " <<
endl;
227 out <<
" | [Hz] | [Hz] | [Hz] | [Hz] " <<
endl;
228 out <<
"-------------------------------------------------------" <<
endl;
229
231
234
236
237 out <<
" " <<
setw(3) <<
string <<
' ' <<
setw(2) << floor <<
" ";
238
241
243
244 TF1 f1("f1", "[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))/(TMath::Sqrt(2*TMath::Pi())*[2]) + [3]");
245
246 f1.SetParameter(0, h1->GetMaximum());
247 f1.SetParameter(1, 0.0);
248 f1.SetParameter(2, h1->GetRMS() * 0.25);
249 f1.SetParameter(3, h1->GetMinimum());
250
251 h1->Fit(&f1, option.c_str(), "same");
252
254 out <<
" | " <<
FIXED(8,
PRECISION) << (h1->GetSumOfWeights() - f1.GetParameter(3) * h1->GetNbinsX()) * V;
256
257 Q[0].
put( f1.GetParameter(0));
258 Q[1].
put((h1->GetSumOfWeights() - f1.GetParameter(3) * h1->GetNbinsX()) * V);
259 Q[2].
put( h1->GetSumOfWeights() * V);
260 }
261
263
264 TF1 f1("f1", "[0]*exp(-[1]*x)");
265
266 f1.SetParameter(0, t1->GetMaximum());
267 f1.SetParameter(1, 1.0 / t1->GetRMS());
268
269 t1->Fit(&f1, option.c_str(), "same");
270
272
273 Q[3].
put(f1.GetParameter(1));
274 }
275
277 }
278
280 }
281
283
284 out <<
"-------------------------------------------------------" <<
endl;
285 out <<
setw(10) << left <<
" average";
286
287 for (int i = 0; i != sizeof(Q)/sizeof(Q[0]); ++i) {
289 }
290
292 }
293
294 out.close();
295 }
296
298
300
303
304 out.Close();
305 }
306}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Logical location of module.
Router for direct addressing of module data in detector data structure.
Template definition of a multi-dimensional oscillation probability interpolation table.
int getNumberOfFloors(const JDetector &detector)
Get number of floors.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
size_t getCount(const array_type< T > &buffer, const JCompare_t &compare)
Count number of unique values.
long long int factorial(const long long int n)
Determine factorial.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
double getFrameTime()
Get frame time duration.
double getTimeOfRTS(const JDAQChronometer &chronometer)
Get time of last RTS in ns since start of run for a given chronometer.
Auxiliary data structure for floating point format specification.
Type definition of range.
Auxiliary class to select ROOT class based on class name.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.