53 using namespace KM3NETDAQ;
55 JMultipleFileScanner<JDAQTimesliceTypes_t> inputFile;
61 JRange<int> multiplicity;
63 JROOTClassSelector selector;
69 JParser<> zap(
"Monitoring of PMT time-over-threshold distributions.");
71 zap[
'f'] =
make_field(inputFile,
"input file.");
73 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
74 zap[
'a'] =
make_field(detectorFile,
"detector file.");
75 zap[
'T'] =
make_field(T_ns,
"time window [ns].") = JRange<double>(10.0, 25.0);
76 zap[
'c'] =
make_field(ctMax,
"maximal cosine space angle between PMT axes.") = 0.0;
77 zap[
'M'] =
make_field(multiplicity,
"multiplicity range of hits on DOM.") = JRange<int>(1, 2);
78 zap[
'D'] =
make_field(deadTime_us,
"L0 dead time (us)") = 10;
79 zap[
'C'] =
make_field(selector,
"timeslice selector, e.g. JDAQTimesliceL1.") = getROOTClassSelection<JDAQTimesliceTypes_t>();
80 zap[
'O'] =
make_field(option,
"hit processing option.") = none_t, join_t, filter_t;
85 catch(
const exception &error) {
86 FATAL(error.what() << endl);
100 catch(
const JException& error) {
101 FATAL(
"No trigger parameters from input." << endl);
104 if (!T_ns.is_valid()) {
105 FATAL(
"Invalid time window [ns] " << T_ns << endl);
108 if ((selector == JDAQTimeslice ::Class_Name() && parameters.writeL1.prescale > 0) ||
109 (selector == JDAQTimesliceL1::Class_Name())) {
111 if (parameters.TMaxLocal_ns < T_ns.getUpperLimit()) {
112 FATAL(
"Option -T <T_ns> = " << T_ns.getUpperLimit() <<
" is larger than in the trigger " << parameters.TMaxLocal_ns << endl);
116 if (!multiplicity.is_valid()) {
FATAL(
"Invalid multiplicity " << multiplicity << endl); }
117 if ( multiplicity.getLowerLimit() < 1) {
FATAL(
"Invalid multiplicity " << multiplicity << endl); }
126 load(detectorFile, detector);
128 catch(
const JException& error) {
132 if (detector.empty()) {
133 FATAL(
"Empty detector." << endl);
136 const JModuleRouter router(detector);
142 const double zmin = -0.5;
143 const double zmax = 256.5;
144 const int nz = (int) ((zmax-zmin) / 1.0);
152 const JMatch_t match(T_ns.getUpperLimit());
154 const double deadTime_ns = deadTime_us * 1e3;
156 JObjectMultiplexer<JDAQTimesliceTypes_t, JDAQTimeslice> in(inputFile, selector);
160 for ( ; in.hasNext() && counter != inputFile.getLimit(); ++counter) {
162 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
166 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
168 if (router.hasModule(frame->getModuleID())) {
170 TH2D* h2 = manager[frame->getModuleID()];
171 const JModule& module = router.getModule(frame->getModuleID());
173 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, module);
175 if (option != none_t) {
176 for (JSuperFrame2D_t::iterator i = buffer.begin(); i != buffer.end(); ++i) {
177 if (option == join_t)
179 else if (option == filter_t)
188 for (JSuperFrame1D_t::const_iterator p = data.begin(), __end = data.end() - 1; p != __end; ) {
190 JSuperFrame1D_t::const_iterator q = p;
192 double ct_max = -1.0;
193 double dt_min = numeric_limits<double>::max();
195 while (++q != __end && q->getT() - p->getT() < T_ns.getUpperLimit()) {
197 const double ct =
getDot(module.getPMT(p->getPMT()), module.getPMT(q->getPMT()));
198 const double dt = q->getT() - p->getT();
209 if (multiplicity(distance(p,q)) && ct_max < ctMax && dt_min > T_ns.getLowerLimit()) {
211 for (JSuperFrame1D_t::const_iterator __p = p; __p != q; ++__p) {
213 if (__p->getT() > t0[__p->getPMT()] + deadTime_ns) {
214 h2->Fill(__p->getPMT(), __p->getToT());
217 t0[__p->getPMT()] = __p->getT();
Utility class to parse command line options.
Data structure for all trigger parameters.
double getDot(const JNeutrinoDirection &first, const JNeutrinoDirection &second)
Dot product.
Auxiliary class to manage set of histograms.
#define MAKE_CSTRING(A)
Make C-string.
Long64_t counter_type
Type definition for counter.
JSuperFrame2D< hit_type > JSuperFrame2D_t
JLimit JLimit_t
Type definition of limit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
static const char *const _2SToT
Histogram naming.
const JLimit & getLimit() const
Get limit.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.
#define DEBUG(A)
Message macros.
JSuperFrame1D< hit_type > JSuperFrame1D_t
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.