48{
52
54 JLimit_t& numberOfEvents = inputFile.getLimit();
56 string detectorFile;
58 double ctMax;
60 double deadTime_us;
64
65 try {
66
67 JParser<> zap(
"Monitoring of PMT time-over-threshold distributions.");
68
69 zap[
'f'] =
make_field(inputFile,
"input file.");
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;
80
81 zap(argc, argv);
82 }
83 catch(const exception &error) {
84 FATAL(error.what() << endl);
85 }
86
87
88
89
90
91
93 FATAL(
"Invalid time window [ns] " << T_ns << endl);
94 }
95
96 if (selector == JDAQTimeslice ::Class_Name() ||
97 selector == JDAQTimesliceL1::Class_Name()) {
98
100
101 try {
103 }
105 FATAL(
"No trigger parameters from input." << endl);
106 }
107
108 if ((selector == JDAQTimeslice ::Class_Name() && parameters.writeL1.prescale > 0) ||
109 (selector == JDAQTimesliceL1::Class_Name())) {
110
112 FATAL(
"Option -T <T_ns> = " << T_ns.
getUpperLimit() <<
" is larger than in the trigger " << parameters.TMaxLocal_ns << endl);
113 }
114 }
115 }
116
117 if (!multiplicity.
is_valid()) {
FATAL(
"Invalid multiplicity " << multiplicity << endl); }
118 if ( multiplicity.
getLowerLimit() < 1) {
FATAL(
"Invalid multiplicity " << multiplicity << endl); }
119
120
121
122
123
125
126 try {
128 }
131 }
132
134 FATAL(
"Empty detector." << endl);
135 }
136
138
139
140
141
142
143 const double zmin = -0.5;
144 const double zmax = 256.5;
145 const int nz = (int) ((zmax-zmin) / 1.0);
146
148
152
154
155 const double deadTime_ns = deadTime_us * 1e3;
156
158
159
161
163
165
166 for (
counter_type counter = 0; in.hasNext() && counter != inputFile.getLimit(); ++counter) {
167
168 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
169
171
174
176
178 }
179
180 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
181
182 if (router.hasModule(frame->getModuleID())) {
183
184 TH2D* h2 = manager[frame->getModuleID()];
185 const JModule& module = router.getModule(frame->getModuleID());
186
187 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, module);
188
189 buffer.preprocess(option, match);
190
191 JSuperFrame1D_t&
data = JSuperFrame1D_t::multiplex(buffer);
192
193 vector<double> t0(NUMBER_OF_PMTS, numeric_limits<double>::lowest());
194
195 for (JSuperFrame1D_t::const_iterator p =
data.begin(); p !=
data.end(); ) {
196
197 JSuperFrame1D_t::const_iterator q = p;
198
199
200
201 double ct_max = -1.0;
202 double dt_min = numeric_limits<double>::max();
203
205
207 const double dt = q->getT() - p->getT();
208
209 if (ct > ct_max) {
210 ct_max = ct;
211 }
212
213 if (dt < dt_min) {
214 dt_min = dt;
215 }
216 }
217
219
220 for (JSuperFrame1D_t::const_iterator i = p; i != q; ++i) {
221
222 if (i->getT() > t0[i->getPMT()] + deadTime_ns) {
223 h2->Fill(i->getPMT(), i->getToT());
224 }
225
226 t0[i->getPMT()] = i->getT();
227 }
228 }
229
230 p = q;
231 }
232 }
233 }
234 }
235
237
238 out << manager;
239
240 out.Close();
241 out.Write();
242}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Router for direct addressing of module data in detector data structure.
Data structure for a composite optical module.
const JPMT & getPMT(const int index) const
Get PMT.
Auxiliary class for multiplexing object iterators.
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
General purpose class for object reading from a list of file names.
Reduced data structure for L0 hit.
1-dimensional frame with time calibrated data from one optical module.
2-dimensional frame with time calibrated data from one optical module.
int getDetectorID() const
Get detector identifier.
int getRunNumber() const
Get run number.
double getDot(const JNeutrinoDirection &first, const JNeutrinoDirection &second)
Dot product.
static const char *const _2SToT
Histogram naming.
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).
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
std::set< JROOTClassSelector > getROOTClassSelection(const bool option=false)
Get ROOT class selection.
Long64_t counter_type
Type definition for counter.
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.
KM3NeT DAQ data structures and auxiliaries.
Auxiliary class to select ROOT class based on class name.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Auxiliary class for specifying the way of pre-processing of hits.
static std::vector< JPreprocessor > getOptions()
Get options.