64 return first.
t < second.
t;
103 return( abs(A.first - A.second) > abs(B.first - B.second) ) ;
124 double Timewindow_ns;
128 unsigned int multiplicity;
135 JParser<> zap(
"Program to create L1 hit time difference histograms from raw data.");
137 zap[
'f'] =
make_field(inputFile,
"input file");
139 zap[
'a'] =
make_field(detectorFile,
"detector file");
140 zap[
't'] =
make_field(TmaxL1_ns,
"max time between L1 hits [ns]") = 1000.0;
141 zap[
'T'] =
make_field(Timewindow_ns,
"time window around t=0 [ns]") = 2400.0;
142 zap[
'w'] =
make_field(binwidth,
"binwidth [ns]") = 1;
144 zap[
'm'] =
make_field(multiplicity,
"minimal multiplicity of the L1 hits") = 2;
145 zap[
'c'] =
make_field(correct_time,
"subtract expected arrival time from delta-t");
146 zap[
'L'] =
make_field(livetime_s,
"livetime of the data, set to positive value") = -1.0;
149 if (zap.
read(argc, argv) != 0)
152 catch(
const exception &error) {
153 FATAL(error.what() << endl);
167 FATAL(
"Empty detector." << endl);
174 const double ctMin = -1;
181 const double xmin = -0.5;
182 const double xmax = nx - 0.5;
184 const double ymin = -floor(Timewindow_ns) + 0.5;
185 const double ymax = +floor(Timewindow_ns) + 0.5;
186 const int ny = (int) ((ymax - ymin) / binwidth);
195 manager =
new JManager <int, TH2D>(
new TH2D(
"h%",
"", npairs, 0.5, npairs+0.5, ny, ymin, ymax));
197 NOTICE(
"Running JMonitorL1dt: Monitoring L1 time differences and creating histograms." << endl);
198 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
202 STATUS(
"Booking histograms for module " << module->getID() << endl);
204 const JString title(module->getID());
207 titleString1D = title +
".1L";
208 titleString2D = title +
".2S";
210 zmap[address.
first] = JHistogram(
new TH2D((titleString2D).c_str(), NULL, nx, xmin, xmax, ny, ymin, ymax),
211 new TH1D((titleString1D).c_str(), NULL, nx, xmin, xmax));
213 for (JDetector::iterator mod =
detector.begin(); mod !=
detector.end(); ++mod) {
214 zmap[address.
first].h2s->GetXaxis()->SetBinLabel(
distance(
detector.begin(), mod)+1, Form(
"%i", mod->getID()));
215 zmap[address.
first].h1l->GetXaxis()->SetBinLabel(
distance(
detector.begin(), mod)+1, Form(
"%i", mod->getID()));
226 for ( ; in.
hasNext() && counter != inputFile.getLimit(); ++counter) {
228 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
236 for (JDAQTimeslice::const_iterator super_frame = timeslice->begin(); super_frame != timeslice->end(); ++super_frame) {
237 if (router.
hasModule(super_frame->getModuleID()) && !super_frame->empty()) {
244 buildL2(*super_frame, module, back_inserter(frameL1));
246 for (JFrameL1_t::iterator L1hit = frameL1.begin(); L1hit != frameL1.end(); ++L1hit) {
247 buffer.push_back(
JElement(address.
first, L1hit->begin()->getT()));
253 if (!DOM_OK[
distance(zmap.begin(), h1)]) {
256 for (
unsigned int i = 0; i <
detector.size(); ++i) {
257 if (DOM_OK[i]) { h1->h1l->Fill(i,
getFrameTime() * 1e-9); }
262 sort(buffer.begin(), buffer.end());
264 for (vector<JElement>::const_iterator p = buffer.begin(); p != buffer.end(); ) {
265 vector<JElement>::const_iterator q = p;
269 while (++q != buffer.end() && q->t - p->t <= Timewindow_ns ) {
275 double time_correction = (correct_time ? (dom_distance /
getSpeedOfLight()) : 0);
277 zmap[p->id].h2s->Fill(q->id, q->t - p->t - time_correction);
278 zmap[q->id].h2s->Fill(p->id, p->t - q->t + time_correction);
283 (*manager)[module_p.
getString()]->Fill(xbin, q->t - p->t - time_correction);
293 if (livetime_s > 0.0) {
296 for (
int ibin = 1; ibin <= hl->GetNbinsX(); ++ibin) {
297 hl->SetBinContent(ibin, livetime_s);
298 hl->SetBinError(ibin, 0.0000001);
KM3NeT DAQ constants, bit handling, etc.
Data structure for detector geometry and calibration.
Basic data structure for L1 hit.
Dynamic ROOT object management.
#define DEBUG(A)
Message macros.
Direct access to module in detector data structure.
int main(int argc, char **argv)
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
ROOT TTree parameter settings of various packages.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
int getFloor() const
Get floor number.
int getString() const
Get string number.
Address of module in detector data structure.
int first
index of module in detector data structure
Router for direct addressing of module data in detector data structure.
bool hasModule(const JObjectID &id) const
Has module.
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
Data structure for a composite optical module.
const JPosition3D & getPosition() const
Get position.
Auxiliary class for multiplexing object iterators.
virtual bool hasNext() override
Check availability of next element.
virtual const pointer_type & next() override
Get next element.
Wrapper class around STL string class.
Utility class to parse command line options.
int read(const int argc, const char *const argv[])
Parse the program's 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.
Template definition for direct access of elements in ROOT TChain.
Data structure for hit time and DOM identifier.
JElement(const int __id, const double __t)
JCombinatorics::pair_type pair_type
int getNumberOfFloors(const JDetector &detector)
Get number of floors.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
const double getSpeedOfLight()
Get speed of light.
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.
double getFrameTime()
Get frame time duration.
bool operator<(const JElement &first, const JElement &second)
Sort JElement in time.
bool comparepair(const pair_type &A, const pair_type &B)
Auxiliary class to select ROOT class based on class name.
Data structure for L2 parameters.
Auxiliary data structure for histogram management.
JHistogram(TH2D *__h2s, TH1D *__h1l)
Constructor.
JHistogram()
Default constructor.