48 using namespace KM3NETDAQ;
55 int numberOfTimeslices;
57 double binWidth_min_timeEvolution;
63 JParser<> zap(
"Example program to search for out of sync shifts around integral timeslices evolving over time.");
68 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
70 zap[
'N'] =
make_field(numberOfTimeslices) = 40;
72 zap[
'M'] =
make_field(binWidth_min_timeEvolution) = 2;
73 zap[
'C'] =
make_field(selector) =
"", getROOTClassSelection<JDAQTimesliceTypes_t>();
78 catch(
const exception& error) {
79 FATAL(error.what() << endl);
86 const int WR = 0x80000000;
88 MASK[808969848] = 0x00000020;
89 MASK[809544061] = 0x00000080;
90 MASK[808432835] = 0x00004000;
117 if (selector ==
"") {
125 FATAL(
"No timeslice data." << endl);
128 NOTICE(
"Selected class " << ps->getClassName() << endl);
134 ps->configure(inputFile);
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);
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;
148 JManager_t manager(
new TH2D(
"M2D_%",
";time [s];shift [timeslices]", nx,
xmin,
xmax, ny, ymin, ymax));
156 STATUS(
"event: " << setw(10) <<
in.getCounter() <<
'\r');
DEBUG(endl);
165 t0 +=
getTime(*hit, router.getPMT(*hit));
171 buffer[
event->getFrameIndex()].push_back(t0);
176 while (ps->hasNext()) {
178 STATUS(
"event: " << setw(10) << ps->getCounter() <<
'\r');
DEBUG(endl);
182 map_type::const_iterator p = buffer.lower_bound(timeslice->
getFrameIndex() - numberOfTimeslices);
183 map_type::const_iterator q = buffer.upper_bound(timeslice->
getFrameIndex() + numberOfTimeslices);
185 int number_of_events = 0;
187 for (map_type::const_iterator
i = p;
i != q; ++
i) {
188 number_of_events +=
i->second.size();
191 if (number_of_events == 0) {
195 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
199 if ((frame->getStatus() & ~MASK[frame->getModuleID()] & ~
WR) == 0) {
203 buildL1(*frame, router.getModule(frame->getModuleID()), back_inserter(
data));
205 TH2D* h2 = manager[frame->getModuleID()];
209 const double t1 = *hit + frame->getFrameIndex() *
getFrameTime();
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) {
214 const double t0 = *
j;
218 if ( abs(timeFromInt)*
getFrameTime() < binWidth_ns/2. ){
Utility class to parse command line options.
std::map< int, buffer_type > map_type
string -> hits
Auxiliary class to select ROOT class based on class name.
Auxialiary class to assert type conversion.
Auxiliary class for a type holder.
double getTime(const Hit &hit)
Get true time of hit.
Template definition for direct access of elements in ROOT TChain.
Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structur...
int getFrameIndex() const
Get frame index.
The template JSinglePointer class can be used to hold a pointer to an object.
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...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double getFrameTime()
Get frame time duration.
Auxiliary class to select JTreeScanner based on ROOT class name.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary data structure for L1 build parameters.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
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 JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
#define DEBUG(A)
Message macros.