56 const double factor = 1.0e-3;
58 for (JDAQSummaryslice::const_iterator frame = summary.begin(); frame != summary.end(); ++frame) {
60 if (router.
hasModule(frame->getModuleID())) {
62 const int index = router.
getIndex(frame->getModuleID());
65 (*this)[index].put(frame->getRate(pmt, factor));
85 for (ExtendedSummary_TimeSlice::const_iterator frame = summary.begin(); frame != summary.end(); ++frame) {
89 const int index = router.
getIndex(frame->lcm_id());
91 const int count = frame->numberOfItemsOrg() << 4;
93 (*this)[index].put(count * factor);
108 bool do_main(
int argc,
char **argv)
112 using namespace KM3NETDAQ;
119 double gridAngle_deg;
125 JParser<> zap(
"Example program to analyse summary data.");
130 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
138 catch(
const exception& error) {
139 FATAL(error.what() << endl);
145 if (roadWidth_m <= 0.0) {
FATAL(
"Invalid road width [m] " << roadWidth_m << endl); }
146 if (gridAngle_deg <= 0.0) {
FATAL(
"Invalid grid angle [deg] " << gridAngle_deg << endl); }
147 if (gridAngle_deg >= 90.0) {
FATAL(
"Invalid grid angle [deg] " << gridAngle_deg << endl); }
159 DEBUG(
"Number of modules in detector " <<
detector.size() << endl);
162 const JOmega3D omega(gridAngle_deg *
PI/180.0);
167 buffer2D M2(omega.size(), buffer1D(
detector.size()));
169 for (
size_t i = 0; i != omega.size(); ++i) {
173 for (
size_t m1 = 0; m1 !=
detector.size(); ++m1) {
174 for (
size_t m2 = 0; m2 != m1; ++m2) {
182 const double x = p2.
getX() - p1.
getX();
183 const double y = p2.
getY() - p1.
getY();
185 if (sqrt(x*x + y*y) <= roadWidth_m) {
186 M2[i][m1].insert(m2);
195 TH1D
h1(
"h1", NULL, 1000, 0.0, 1.0e3);
198 while (inputFile.hasNext()) {
200 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
202 const T* summary = inputFile.next();
204 const JRates buffer(router, *summary);
206 for (
size_t i = 0; i != omega.size(); ++i) {
210 for (
size_t m1 = 0; m1 != buffer.size(); ++m1) {
231 return (inputFile.getCounter() != 0 ?
true :
false);
242 int main(
int argc,
char **argv)
244 if (do_main<KM3NETDAQ::JDAQSummaryslice>(argc, argv)) {
return 0; }
245 if (do_main<ExtendedSummary_TimeSlice> (argc, argv)) {
return 0; }
void setClock()
Set clock.
Utility class to parse command line options.
ROOT TTree parameter settings of various packages.
const int getIndex(const JObjectID &id) const
Get index of module.
Router for direct addressing of module data in detector data structure.
then for HISTOGRAM in h0 h1
Direction set covering (part of) solid angle.
Data structure for detector geometry and calibration.
ExtendedSummary time slices.
Auxiliary class for defining the range of iterations of objects.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double getFrameTime()
Get frame time duration.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
static const double PI
Mathematical constants.
double getY() const
Get y position.
then usage $script[distance] fi case set_variable R
General purpose messaging.
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.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
bool hasModule(const JObjectID &id) const
Has module.
double getX() const
Get x position.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])