43 int number_of_hits = 0;
47 while (p != data1.end() && q != data2.end() && *p < *q - Tmax_ns) { ++p; }
48 while (p != data1.end() && q != data2.end() && *q < *p - Tmax_ns) { ++q; }
50 if (p == data1.end() || q == data2.end()) {
54 if (fabs(*p - *q) <= Tmax_ns) {
59 return number_of_hits;
70 int main(
int argc,
char **argv)
74 using namespace KM3NETDAQ;
76 JTriggeredFileScanner<> inputFile;
84 JParser<> zap(
"Example program to test conversion between Monte Carlo and DAQ times.");
88 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
94 catch(
const exception &error) {
95 FATAL(error.what() << endl);
99 using namespace KM3NETDAQ;
107 load(detectorFile, detector);
109 catch(
const JException& error) {
113 const JModuleRouter router(detector);
119 while (inputFile.hasNext()) {
121 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
123 JTriggeredFileScanner<>::multi_pointer_type ps = inputFile.next();
126 const Evt*
event = ps;
130 const JTimeConverter converter(*
event, *tev);
141 DEBUG(
"Hit (MC): " << setw(5) << i->pmt_id <<
' ' <<
FIXED(6,1) <<
getTime(*i) << endl);
143 mc[i->pmt_id].insert(
getTime(*i));
149 const JModule& module = router.getModule(i->getModuleID());
150 const JPMT& pmt = module.getPMT(i->getPMT());
152 DEBUG(
"Hit (DAQ): " << setw(5) << pmt.getID() <<
' ' <<
FIXED(6,1) << converter.getTime(*i, pmt) << endl);
154 data[pmt.getID()].insert(converter.getTime(*i, pmt));
157 int number_of_hits = 0;
159 for (map_type::const_iterator p = mc.begin(), q = data.begin(); ; ++p, ++q) {
161 while (p != mc.end() && q != data.end() && p->first < q->first) { ++p; }
162 while (p != mc.end() && q != data.end() && q->first < p->first) { ++q; }
164 if (p == mc.end() || q == data.end()) {
168 if (p->first == q->first) {
169 number_of_hits += get_count(p->second, q->second, Tmax_ns);
173 NOTICE(
"Number of hits " << setw(5) << number_of_hits <<
'/' << setw(5) << tev->
size<JHit_t>() << endl);
175 ASSERT(number_of_hits != 0);
178 ASSERT(inputFile.getCounter() != 0);
Utility class to parse command line options.
bool empty() const
Check emptyness of hit container.
Synchronously read DAQ events and Monte Carlo events (and optionally other events).
Structure to store the ToT mean and standard deviation of the hits produced by a nanobeacon in a sour...
Auxiliary data structure for floating point format specification.
double getTime(const Hit &hit)
Get true time of hit.
Data structure for detector geometry and calibration.
unsigned int size() const
Get number of hits.
bool is_noise(const Hit &hit)
Verify hit origin.
JLimit JLimit_t
Type definition of limit.
const_iterator< T > end() const
Get end of data.
I/O formatting auxiliaries.
#define ASSERT(A)
Assert macro.
const_iterator< T > begin() const
Get begin of data.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
General purpose messaging.
Direct access to module in detector data structure.
Utility class to parse command line options.
ROOT TTree parameter settings.
const JLimit & getLimit() const
Get limit.
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])