95{
98
100 Long64_t numberOfEvents;
102 JK40DefaultSimulator_t k40Simulator;
103 ULong_t seed;
104 double Tmax_ns;
106
107 try {
108
109 JParser<> zap(
"Example program to test hit coincidence building with random data.");
110
118
119 zap(argc, argv);
120 }
121 catch(const exception &error) {
122 FATAL(error.what() << endl);
123 }
124
125 gRandom->SetSeed(seed);
126
128
129
131
132 detector.push_back(getModule<JKM3NeT_t>(1001));
133
135
138 simbad.reset(k40Simulator.clone());
139
140
142
143 TProfile hn("hn", NULL, 31, 0.5, +31.5);
144 TProfile hc("hc", NULL, 21, -1.05, +1.05);
145 TProfile ht("ht", NULL, 20, 0.5, +20.5);
146
147
149
151 typedef vector <hit_type> JFrameL1_t;
153 typedef JBuildL1 <hit_type> JBuildL1_t;
154
155
157 JSuperFrame2D_t buffer;
158
159
160 for (int event_count = 0; event_count < numberOfEvents; ++event_count) {
161
162 STATUS(
"event: " << setw(10) << event_count <<
'\r');
DEBUG(endl);
163
164 const int frame_index = 1;
165
167
169
170 for (JDAQTimeslice::const_iterator super_frame = timeslice.begin(); super_frame != timeslice.end(); ++super_frame) {
171
172 if (moduleRouter.hasModule(super_frame->getModuleID())) {
173
174
175
176 const JModule& module =
detector.getModule(moduleRouter.getAddress(super_frame->getModuleID()));
177
178 buffer(*super_frame, module);
179
180 JFrameL1_t dataL1;
181
182 buildL1(buffer, back_inserter(dataL1));
183
184
185 if (!dataL1.empty()) {
186
188
189 JFrameL1_t d1(dataL1);
190 JFrameL1_t d2;
191
192 for (int i = 1; i <= hn.GetNbinsX(); ++i) {
193
194 buildL2.numberOfHits = (int) hn.GetBinCenter(i);
195
196 d2.clear();
197
198 buildL2(buffer, d1, back_inserter(d2));
199
200 hn.Fill((double) buildL2.numberOfHits, (double) d2.size() / (double) dataL1.size());
201
202 d1.swap(d2);
203 }
204 }
205
206
207 if (!dataL1.empty()) {
208
210
211 JFrameL1_t d1(dataL1);
212 JFrameL1_t d2;
213
214 for (int i = 1; i <= hc.GetNbinsX(); ++i) {
215
216 buildL2.ctMin = hc.GetBinCenter(i);
217
218 d2.clear();
219
220 buildL2(buffer, d1, back_inserter(d2));
221
222 hc.Fill(buildL2.ctMin, (double) d2.size() / (double) dataL1.size());
223
224 d1.swap(d2);
225 }
226 }
227
228
229 if (!dataL1.empty()) {
230
232
233 JFrameL1_t d1(dataL1);
234 JFrameL1_t d2;
235
236 for (int i = ht.GetNbinsX(); i != 0; --i) {
237
238 buildL2.TMaxLocal_ns = ht.GetBinCenter(i);
239
240 d2.clear();
241
242 buildL2(buffer, d1, back_inserter(d2));
243
244 ht.Fill(buildL2.TMaxLocal_ns, (double) d2.size() / (double) dataL1.size());
245
246 d1.swap(d2);
247 }
248 }
249 }
250 }
251 }
253
254 out.Write();
255 out.Close();
256
257}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Router for direct addressing of module data in detector data structure.
Data structure for a composite optical module.
Auxiliary class for map of PMT parameters.
Utility class to parse command line options.
2-dimensional frame with time calibrated data from one optical module.
Data structure for UTC time.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
double getTimeOfFrame(const int frame_index)
Get start time of frame in ns since start of run for a given frame index.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for L1 build parameters.
Data structure for L2 parameters.
Timeslice with random data.