29 namespace MONITORL1DT {
61 return first.
t < second.
t;
105 int main(
int argc,
char **argv)
108 using namespace MONITORL1DT;
114 Double_t Timewindow_ns;
117 unsigned int multiplicity;
123 JParser<> zap(
"Program to create L1 hit time difference histograms from raw data.");
125 zap[
'f'] =
make_field(inputFile,
"input file");
127 zap[
'a'] =
make_field(detectorFile,
"detector file");
128 zap[
't'] =
make_field(TmaxL1_ns,
"max time between L1 hits [ns]") = 1000.0;
129 zap[
'T'] =
make_field(Timewindow_ns,
"time window around t=0 [ns]") = 2400.0;
130 zap[
'C'] =
make_field(selector,
"datastream selector") = getROOTClassSelection<JDAQTimesliceTypes_t>();
131 zap[
'm'] =
make_field(multiplicity,
"minimal multiplicity of the L1 hits") = 2;
132 zap[
'L'] =
make_field(livetime_s,
"livetime of the data, set to positive value") = -1.0;
135 if (zap.read(argc, argv) != 0)
138 catch(
const exception &error) {
139 FATAL(error.what() << endl);
154 FATAL(
"Empty detector." << endl);
161 const double ctMin = -1;
167 const double xmin = -0.5;
168 const double xmax = nx - 0.5;
170 const double ymin = -floor(Timewindow_ns) + 0.5;
171 const double ymax = +floor(Timewindow_ns) + 0.5;
172 const int ny = (int) ((ymax - ymin) / 1.0);
174 NOTICE(
"Running JMonitorL1dt: Monitoring L1 time differences MonitorL1dt creating histograms.");
175 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
179 STATUS(
"Booking histograms for module " << module->getID() << endl);
181 const JString title(module->getID());
184 titleString1D = title +
".1L";
185 titleString2D = title +
".2S";
187 zmap[address.
first] =
JHistogram(
new TH2D((titleString2D).c_str(), NULL, nx, xmin, xmax, ny, ymin, ymax),
188 new TH1D((titleString1D).c_str(), NULL, nx, xmin, xmax));
190 for (JDetector::iterator mod =
detector.begin(); mod !=
detector.end(); ++mod) {
191 zmap[address.
first].h2s->GetXaxis()->SetBinLabel(
distance(
detector.begin(), mod)+1, Form(
"%i", mod->getID()));
192 zmap[address.
first].h1l->GetXaxis()->SetBinLabel(
distance(
detector.begin(), mod)+1, Form(
"%i", mod->getID()));
203 for ( ; in.
hasNext() && counter != inputFile.getLimit(); ++counter) {
205 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
213 for (JDAQTimeslice::const_iterator super_frame = timeslice->begin(); super_frame != timeslice->end(); ++super_frame) {
214 if (router.
hasModule(super_frame->getModuleID()) && !super_frame->empty()) {
221 buildL2(*super_frame, module, back_inserter(frameL1));
223 for (JFrameL1_t::iterator L1hit = frameL1.begin(); L1hit != frameL1.end(); ++L1hit) {
224 buffer.push_back(
JElement(address.
first, L1hit->begin()->getT()));
233 for (
unsigned int i = 0; i <
detector.size(); ++i) {
239 sort(buffer.begin(), buffer.end());
244 while (++q != buffer.end() && q->t - p->t <= Timewindow_ns ) {
247 zmap[p->id].h2s->Fill(q->id, q->t - p->t);
248 zmap[q->id].h2s->Fill(p->id, p->t - q->t);
257 if (livetime_s > 0.0) {
260 for (
int ibin = 1; ibin <= hl->GetNbinsX(); ++ibin) {
261 hl->SetBinContent(ibin, livetime_s);
262 hl->SetBinError(ibin, 0.0000001);
Utility class to parse command line options.
ROOT TTree parameter settings.
Wrapper class around STL string class.
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.
bool operator<(const JElement &first, const JElement &second)
Sort JElement in time.
Auxiliary class to select ROOT class based on class name.
Router for direct addressing of module data in detector data structure.
JHistogram(TH2D *__h2s, TH1D *__h1l)
Constructor.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
then for HISTOGRAM in h0 h1
Auxiliary class for multiplexing object iterators.
Data structure for detector geometry and calibration.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
int first
index of module in detector data structure
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Data structure for hit time and DOM identifier.
double getFrameTime()
Get frame time duration.
virtual const pointer_type & next()
Get next element.
JHistogram()
Default constructor.
Address of module in detector data structure.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
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.
Data structure for L2 parameters.
JElement(const int __id, const double __t)
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
bool hasModule(const JObjectID &id) const
Has module.
virtual bool hasNext()
Check availability of next element.
KM3NeT DAQ constants, bit handling, etc.
Auxiliary data structure for histogram management.
Basic data structure for L1 hit.
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])