71{
75
77 JLimit_t& numberOfEvents = inputFile.getLimit();
78 string detectorFile;
79 double Tmax_ns;
81
82 try {
83
84 JParser<> zap(
"Example program to test conversion between Monte Carlo and DAQ times.");
85
91
92 zap(argc, argv);
93 }
94 catch(const exception &error) {
95 FATAL(error.what() << endl);
96 }
97
98
100
101
103
104 try {
106 }
109 }
110
112
113
114
116
118
120
122
124 const Evt*
event = ps;
125
127
129
130 map_type mc;
132
133 for (vector<Hit>::const_iterator i = event->mc_hits.begin(); i != event->mc_hits.end(); ++i) {
134
136
137 DEBUG(
"Hit (MC): " << setw(5) << i->pmt_id <<
' ' <<
FIXED(6,1) <<
getTime(*i) << endl);
138
139 mc[i->pmt_id].insert(
getTime(*i));
140 }
141 }
142
143 for (int test : {1, 2} ) {
144
145 DEBUG(
"Test "<< test << endl);
146
148
150
151 if (test == 1) {
152
154
156
157 const JModule& module = router.getModule(i->getModuleID());
158 const JPMT& pmt =
module.getPMT(i->getPMT());
159
161 }
162
163 } else if (test == 2) {
164
166
168
170
171 for (vector<Hit>::const_iterator i = evt.
hits.begin(); i != evt.
hits.end(); ++i) {
172
173 if (i->trig != 0) {
174
175 const JModule& module = router.getModule(i->dom_id);
176 const JPMT& pmt =
module.getPMT(i->channel_id);
177
179 }
180 }
181 }
182
183 for (map_type::const_iterator i =
data.begin(); i !=
data.end(); ++i) {
185 DEBUG(
"Hit (DAQ): " << setw(5) << i->first <<
' ' <<
FIXED(6,1) << *hit << endl);
186 }
187 }
188
189 int number_of_hits = 0;
190
191 for (map_type::const_iterator p = mc.begin(), q =
data.begin(); ; ++p, ++q) {
192
193 while (p != mc.end() && q !=
data.end() && p->first < q->first) { ++p; }
194 while (p != mc.end() && q !=
data.end() && q->first < p->first) { ++q; }
195
196 if (p == mc.end() || q ==
data.end()) {
197 break;
198 }
199
200 if (p->first == q->first) {
201 number_of_hits += get_count(p->second, q->second, Tmax_ns);
202 }
203 }
204
205 NOTICE(
"Number of hits " << setw(5) << number_of_hits <<
'/' << setw(5) << tev->
size<
JHit_t>() << endl);
206
207 ASSERT(number_of_hits != 0);
208 }
209 }
210
212
213 return 0;
214}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#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.
Data structure for PMT geometry, calibration and status.
int getID() const
Get identifier.
Utility class to parse command line options.
counter_type getCounter() const
Get counter.
const_iterator< T > end() const
Get end of data.
unsigned int size() const
Get number of hits.
const_iterator< T > begin() const
Get begin of data.
bool empty() const
Check emptyness of hit container.
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
double getTime() const
Get DAQ/trigger time minus Monte Carlo time.
bool is_noise(const Hit &hit)
Verify hit origin.
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter=' ')
Read test summary.
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).
const char * getTime()
Get current local time conform ISO-8601 standard.
KM3NeT DAQ data structures and auxiliaries.
std::map< int, range_type > map_type
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
std::vector< Hit > hits
list of hits
Auxiliary data structure for floating point format specification.
General purpose class for multiple pointers.
Auxiliary class to set-up Hit.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
virtual bool hasNext() override
Check availability of next element.
virtual const multi_pointer_type & next() override
Get next element.