51{
54
56 JLimit_t& numberOfEvents = inputFile.getLimit();
58 string detectorFile;
60 double Tmax_ns;
62
63 try {
64
65 JParser<> zap(
"Example program to test hit coincidence building with Monte Carlo events.");
66
74
75 zap(argc, argv);
76 }
77 catch(const exception &error) {
78 FATAL(error.what() << endl);
79 }
80
81
83
84
86
87 try {
89 }
92 }
93
95
98
99
101
102 TProfile hn("hn", NULL, 31, 0.5, +31.5);
103 TProfile hc("hc", NULL, 21, -1.05, +1.05);
104 TProfile ht("ht", NULL, 20, 0.5, +20.5);
105
106
108
110 typedef vector <hit_type> JFrameL1_t;
112 typedef JBuildL1 <hit_type> JBuildL1_t;
113
114
116 JSuperFrame2D_t buffer;
117
118
120
121 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
122
123 Evt*
event = in.next();
124
125 const int frame_index = 1;
126
128
130
132
133 for (JDAQTimeslice::const_iterator super_frame = timeslice.begin(); super_frame != timeslice.end(); ++super_frame) {
134
135 if (moduleRouter.hasModule(super_frame->getModuleID())) {
136
137
138
139 const JModule& module =
detector.getModule(moduleRouter.getAddress(super_frame->getModuleID()));
140
141 buffer(*super_frame, module);
142
143 JFrameL1_t dataL1;
144
145 buildL1(buffer, back_inserter(dataL1));
146
147 if (!dataL1.empty()) {
148
150
151 JFrameL1_t d1(dataL1);
152 JFrameL1_t d2;
153
154 for (int i = 1; i <= hn.GetNbinsX(); ++i) {
155
156 buildL2.numberOfHits = (int) hn.GetBinCenter(i);
157
158 d2.clear();
159
160 buildL2(buffer, d1, back_inserter(d2));
161
162 hn.Fill((double) buildL2.numberOfHits, (double) d2.size() / (double) dataL1.size());
163
164 d1.swap(d2);
165 }
166 }
167
168
169 if (!dataL1.empty()) {
170
172
173 JFrameL1_t d1(dataL1);
174 JFrameL1_t d2;
175
176 for (int i = 1; i <= hc.GetNbinsX(); ++i) {
177
178 buildL2.ctMin = hc.GetBinCenter(i);
179
180 d2.clear();
181
182 buildL2(buffer, d1, back_inserter(d2));
183
184 hc.Fill(buildL2.ctMin, (double) d2.size() / (double) dataL1.size());
185
186 d1.swap(d2);
187 }
188 }
189
190
191 if (!dataL1.empty()) {
192
194
195 JFrameL1_t d1(dataL1);
196 JFrameL1_t d2;
197
198 for (int i = ht.GetNbinsX(); i != 0; --i) {
199
200 buildL2.TMaxLocal_ns = ht.GetBinCenter(i);
201
202 d2.clear();
203
204 buildL2(buffer, d1, back_inserter(d2));
205
206 ht.Fill(buildL2.TMaxLocal_ns, (double) d2.size() / (double) dataL1.size());
207
208 d1.swap(d2);
209 }
210 }
211 }
212 }
213 }
215
216 out.Write();
217 out.Close();
218}
#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.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
2-dimensional frame with time calibrated data from one optical module.
Data structure for UTC time.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
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 getTimeOfFrame(const int frame_index)
Get start time of frame in ns since start of run for a given frame index.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
double mc_t
MC: time where the mc-event was put in the timeslice, since start of run (offset+frameidx*timeslice_d...
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Auxiliary data structure for L1 build parameters.
Data structure for L2 parameters.
Timeslice with Monte Carlo event.