45{
49
51 JLimit_t& numberOfEvents = inputFile.getLimit();
53 string detectorFile;
54 double TMax_ns;
55 int numberOfTimeslices;
56 double binWidth_ns;
57 double binWidth_min_timeEvolution;
60
61 try {
62
63 JParser<> zap(
"Example program to search for out of sync shifts around integral timeslices evolving over time.");
64
70 zap[
'N'] =
make_field(numberOfTimeslices) = 40;
72 zap[
'M'] =
make_field(binWidth_min_timeEvolution) = 2;
75
76 zap(argc, argv);
77 }
78 catch(const exception& error) {
79 FATAL(error.what() << endl);
80 }
81
82
83
85
86 const int WR = 0x80000000;
87
88 MASK[808969848] = 0x00000020;
89 MASK[809544061] = 0x00000080;
90 MASK[808432835] = 0x00004000;
91
92
94
95 try {
97 }
100 }
101
103
104
106
109 vector <hit_type>
data;
110
112
114
116
117 if (selector == "") {
118
124 } else {
125 FATAL(
"No timeslice data." << endl);
126 }
127
128 NOTICE(
"Selected class " << ps->getClassName() << endl);
129
130 } else {
131
132 ps = zmap[selector];
133
134 ps->configure(inputFile);
135 }
136
138
139
140 const Double_t ymin = -(numberOfTimeslices + 0.5);
141 const Double_t ymax = +(numberOfTimeslices + 0.5);
142 const Int_t ny = (Int_t) (ymax - ymin);
143
145 const Double_t
xmax = min(inputFile.getLimit().max(), ps->getEntries())*
getFrameTime()*1e-9;
146 const Int_t nx = (Int_t) ((xmax - xmin) / (60*binWidth_min_timeEvolution)) + 1;
147
148 JManager_t manager(new TH2D("M2D_%", ";time [s];shift [timeslices]", nx, xmin, xmax, ny, ymin, ymax));
149
151
152 map_type buffer;
153
155
156 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
157
159
160
161
162 double t0 = 0.0;
163
165 t0 +=
getTime(*hit, router.getPMT(*hit));
166 }
167
170
171 buffer[event->getFrameIndex()].push_back(t0);
172 }
174
175
176 while (ps->hasNext()) {
177
178 STATUS(
"event: " << setw(10) << ps->getCounter() <<
'\r');
DEBUG(endl);
179
181
182 map_type::const_iterator p = buffer.lower_bound(timeslice->
getFrameIndex() - numberOfTimeslices);
183 map_type::const_iterator q = buffer.upper_bound(timeslice->
getFrameIndex() + numberOfTimeslices);
184
185 int number_of_events = 0;
186
187 for (map_type::const_iterator i = p; i != q; ++i) {
188 number_of_events += i->second.size();
189 }
190
191 if (number_of_events == 0) {
192 continue;
193 }
194
195 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
196
197
198
199 if ((frame->getStatus() & ~MASK[frame->getModuleID()] & ~WR) == 0) {
200
202
203 buildL1(*frame, router.getModule(frame->getModuleID()), back_inserter(data));
204
205 TH2D* h2 = manager[frame->getModuleID()];
206
207 for (vector<hit_type>::const_iterator hit =
data.begin(); hit !=
data.end(); ++hit) {
208
209 const double t1 = *hit + frame->getFrameIndex() *
getFrameTime();
210
211 for (map_type::const_iterator i = p; i != q; ++i) {
212 for (map_type::mapped_type::const_iterator
j = i->second.begin();
j != i->second.end(); ++
j) {
213
214 const double t0 = *
j;
215
216
218 if ( abs(timeFromInt)*
getFrameTime() < binWidth_ns/2. ){
220 }
221 }
222 }
223 }
224 }
225 }
226 }
228
231 }
232}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structur...
Auxialiary class to assert type conversion.
The template JSinglePointer class can be used to hold a pointer to an object.
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
Template definition for direct access of elements in ROOT TChain.
int getFrameIndex() const
Get frame index.
JTriggerCounter_t next()
Increment trigger counter.
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).
std::set< JROOTClassSelector > getROOTClassSelection(const bool option=false)
Get ROOT class selection.
const char * getTime()
Get current local time conform ISO-8601 standard.
KM3NeT DAQ data structures and auxiliaries.
double getFrameTime()
Get frame time duration.
std::map< int, range_type > map_type
Auxiliary class for a type holder.
Auxiliary class to select ROOT class based on class name.
Auxiliary class to select JTreeScanner based on ROOT class name.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Auxiliary data structure for L1 build parameters.