74 using namespace KM3NETDAQ;
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;
119 while (inputFile.hasNext()) {
121 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
126 const Evt*
event = ps;
139 DEBUG(
"Hit (MC): " << setw(5) << i->pmt_id <<
' ' <<
FIXED(6,1) <<
getTime(*i) << endl);
141 mc[i->pmt_id].insert(
getTime(*i));
145 for (
int test : {1, 2} ) {
147 DEBUG(
"Test "<< test << endl);
159 const JModule& module = router.getModule(i->getModuleID());
165 }
else if (test == 2) {
177 const JModule& module = router.getModule(i->dom_id);
178 const JPMT& pmt = module.
getPMT(i->channel_id);
186 for (map_type::const_iterator i = data.begin(); i != data.end(); ++i) {
188 DEBUG(
"Hit (DAQ): " << setw(5) << i->first <<
' ' <<
FIXED(6,1) << *hit << endl);
192 int number_of_hits = 0;
194 for (map_type::const_iterator p = mc.begin(), q = data.begin(); ; ++p, ++q) {
196 while (p != mc.end() && q != data.end() && p->first < q->first) { ++p; }
197 while (p != mc.end() && q != data.end() && q->first < p->first) { ++q; }
199 if (p == mc.end() || q == data.end()) {
203 if (p->first == q->first) {
204 number_of_hits += get_count(p->second, q->second, Tmax_ns);
208 NOTICE(
"Number of hits " << setw(5) << number_of_hits <<
'/' << setw(5) << tev->
size<
JHit_t>() << endl);
210 ASSERT(number_of_hits != 0);
214 ASSERT(inputFile.getCounter() != 0);
Auxiliary class to set-up Hit.
Utility class to parse command line options.
Data structure for a composite optical module.
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
bool empty() const
Check emptyness of hit container.
Router for direct addressing of module data in detector data structure.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
Auxiliary data structure for floating point format specification.
double getTime(const Hit &hit)
Get true time of hit.
unsigned int size() const
Get number of hits.
bool is_noise(const Hit &hit)
Verify hit origin.
Auxiliary class for defining the range of iterations of objects.
const_iterator< T > end() const
Get end of data.
#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
int getID() const
Get identifier.
Data structure for PMT geometry, calibration and status.
const JPMT & getPMT(const int index) const
Get PMT.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
const JLimit & getLimit() const
Get limit.
std::vector< Hit > hits
list of hits
do set_variable DETECTOR_TXT $WORKDIR detector
General purpose class for multiple pointers.
double getTime() const
Get DAQ/trigger time minus Monte Carlo time.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.