47 int main(
int argc,
char **argv)
51 using namespace KM3NETDAQ;
67 JParser<> zap(
"Monitoring of PMT time-over-threshold distributions.");
69 zap[
'f'] =
make_field(inputFile,
"input file.");
71 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
72 zap[
'a'] =
make_field(detectorFile,
"detector file.");
74 zap[
'c'] =
make_field(ctMax,
"maximal cosine space angle between PMT axes.") = 0.0;
76 zap[
'D'] =
make_field(deadTime_us,
"L0 dead time (us)") = 10;
77 zap[
'C'] =
make_field(selector,
"timeslice selector, e.g. JDAQTimesliceL1.") = getROOTClassSelection<JDAQTimesliceTypes_t>();
78 zap[
'O'] =
make_field(option,
"hit pre-processing option.") = JPreprocessor::getOptions();
83 catch(
const exception &error) {
84 FATAL(error.what() << endl);
93 if (!T_ns.is_valid()) {
94 FATAL(
"Invalid time window [ns] " << T_ns << endl);
97 if (selector == JDAQTimeslice ::Class_Name() ||
98 selector == JDAQTimesliceL1::Class_Name()) {
106 FATAL(
"No trigger parameters from input." << endl);
109 if ((selector == JDAQTimeslice ::Class_Name() && parameters.writeL1.prescale > 0) ||
110 (selector == JDAQTimesliceL1::Class_Name())) {
112 if (parameters.TMaxLocal_ns < T_ns.getUpperLimit()) {
113 FATAL(
"Option -T <T_ns> = " << T_ns.getUpperLimit() <<
" is larger than in the trigger " << parameters.TMaxLocal_ns << endl);
118 if (!multiplicity.is_valid()) {
FATAL(
"Invalid multiplicity " << multiplicity << endl); }
119 if ( multiplicity.getLowerLimit() < 1) {
FATAL(
"Invalid multiplicity " << multiplicity << endl); }
135 FATAL(
"Empty detector." << endl);
144 const double zmin = -0.5;
145 const double zmax = 256.5;
146 const int nz = (int) ((zmax-zmin) / 1.0);
156 const double deadTime_ns = deadTime_us * 1e3;
167 for (
counter_type counter = 0; in.
hasNext() && counter != inputFile.getLimit(); ++counter) {
169 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
181 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
183 if (router.
hasModule(frame->getModuleID())) {
185 TH2D* h2 = manager[frame->getModuleID()];
188 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, module);
190 buffer.preprocess(option, match);
192 JSuperFrame1D_t& data = JSuperFrame1D_t::multiplex(buffer);
196 for (JSuperFrame1D_t::const_iterator p = data.begin(); p != data.end(); ) {
198 JSuperFrame1D_t::const_iterator q = p;
202 double ct_max = -1.0;
203 double dt_min = numeric_limits<double>::max();
205 while (++q != data.end() && q->getT() - p->getT() < T_ns.getUpperLimit()) {
208 const double dt = q->getT() - p->getT();
219 if (multiplicity(
distance(p,q)) && ct_max < ctMax && dt_min > T_ns.getLowerLimit()) {
221 for (JSuperFrame1D_t::const_iterator i = p; i != q; ++i) {
223 if (i->getT() > t0[i->getPMT()] + deadTime_ns) {
224 h2->Fill(i->getPMT(), i->getToT());
227 t0[i->getPMT()] = i->getT();
Utility class to parse command line options.
Auxiliaries for pre-processing of hits.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
Basic data structure for L0 hit.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Data structure for a composite optical module.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
int getDetectorID() const
Get detector identifier.
double getDot(const JNeutrinoDirection &first, const JNeutrinoDirection &second)
Dot product.
Auxiliary class to select ROOT class based on class name.
Router for direct addressing of module data in detector data structure.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
#define MAKE_CSTRING(A)
Make C-string.
Long64_t counter_type
Type definition for counter.
Dynamic ROOT object management.
Auxiliary class for multiplexing object iterators.
int getRunNumber() const
Get run number.
Data structure for detector geometry and calibration.
1-dimensional frame with time calibrated data from one optical module.
Auxiliary class for defining the range of iterations of objects.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
I/O formatting auxiliaries.
Reduced data structure for L0 hit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
virtual const pointer_type & next() override
Get next element.
Match operator for consecutive hits.
virtual bool hasNext() override
Check availability of next element.
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
const JPMT & getPMT(const int index) const
Get PMT.
General purpose messaging.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Direct access to module in detector data structure.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
bool hasModule(const JObjectID &id) const
Has module.
static const char *const _2SToT
Histogram naming.
2-dimensional frame with time calibrated data from one optical module.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Auxiliary class for specifying the way of pre-processing of hits.
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.