58int main(
int argc,
char **argv)
64 JLimit_t& numberOfEvents = inputFile.getLimit();
79 JParser<> zap(
"Program to display strings.");
81 zap[
'w'] =
make_field(canvas,
"size of canvas <nx>x<ny> [pixels]") =
JCanvas(1200, 600);
82 zap[
'f'] =
make_field(inputFile,
"input file (output of JKatoomba[.sh])");
88 zap[
'P'] =
make_field(prescale,
"prescale") = 1;
89 zap[
'R'] =
make_field(ratio,
"aspect ratio") = 0.1;
90 zap[
'B'] =
make_field(batch,
"batch processing");
91 zap[
'N'] =
make_field(Nmin,
"minimum number of transmissions") = 0;
96 catch(
const exception& error) {
97 FATAL(error.what() << endl);
101 FATAL(
"Missing output file name " <<
outputFile <<
" in batch mode." << endl);
128 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
129 status[module->getID()] =
module->getStatus();
134 gROOT->SetBatch(batch);
136 TApplication* tp =
new TApplication(
"user", NULL, NULL);
137 TCanvas* cv =
new TCanvas(
"display",
"", canvas.
x, canvas.
y);
139 unique_ptr<TStyle> gStyle(
new JStyle(
"gplot", cv->GetWw(), cv->GetWh()));
141 gROOT->SetStyle(
"gplot");
144 const size_t NY = (size_t) (sqrt(geometry.size()) * 0.75 + 0.25);
145 const size_t NX = (size_t) (geometry.size() + NY - 1) / NY;
147 const size_t NUMBER_OF_PADS = NX * NY;
149 cv->SetFillStyle(4000);
150 cv->SetFillColor(kWhite);
152 TPad*
p1 =
new TPad(
"p1", NULL, 0.0, 0.00, 1.0, 0.95);
153 TPad* p2 =
new TPad(
"p2", NULL, 0.0, 0.95, 1.0, 1.00);
155 p1->Divide(NX, NY, 0.01, 0.001);
165 if (i->second.getZ() < zmin) {
166 zmin = i->second.getZ();
169 if (i->second.rbegin()->getHeight() > zmax) {
170 zmax = i->second.rbegin()->getHeight();
177 double xmin = -ratio * (zmax - zmin);
178 double xmax = +ratio * (zmax - zmin);
180 TH2D H2[NUMBER_OF_PADS];
181 TText T2[NUMBER_OF_PADS];
183 for (
size_t i = 0; i != geometry.size(); ++i) {
185 H2[i] = TH2D(
MAKE_CSTRING(
FILL(4,
'0') << geometry.at(i).first <<
FILL()), NULL, 100, xmin, xmax, 100, zmin, zmax);
187 DEBUG(
"Pad " << setw(3) << i + 1 <<
' ' << H2[i].GetName() << endl);
189 H2[i].GetXaxis()->SetTitle(
"x/y [m]");
190 H2[i].GetYaxis()->SetTitle(
"z [m]");
192 H2[i].GetXaxis()->CenterTitle(
true);
193 H2[i].GetYaxis()->CenterTitle(
true);
195 H2[i].SetStats(kFALSE);
197 T2[i] = TText(0.0, zmax + 0.05 * (zmax - zmin),
MAKE_CSTRING(
FILL(4,
'0') << geometry.at(i).first <<
FILL()));
199 T2[i].SetTextAlign(21);
200 T2[i].SetTextFont(42);
201 T2[i].SetTextSize(0.05);
213 JTreeScanner_t::iterator p = in.begin();
217 cout <<
"\revent: " << setw(8) << inputFile.
getCounter() << flush;
222 if (batch && inputFile.
getCounter()%prescale != 0) {
228 for ( ; p != in.end() && p-> begin()->getToA() < evt->
UNIXTimeStart - 0.5; ++p) {}
230 JTreeScanner_t::iterator q = p;
232 for ( ; q != in.end() && q->rbegin()->getToA() <= evt->
UNIXTimeStop + 0.5; ++q) {}
238 for (JTreeScanner_t::iterator evt = p; evt != q; ++evt) {
239 for (JEvent::const_iterator i = evt->begin(); i != evt->end(); ++i) {
240 buffer[i->getID()] += 1;
244 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
246 module->setStatus(status[module->getID()]);
248 if (buffer[module->getID()] < Nmin) {
249 module->set(module->getFloor() == 0 ? HYDROPHONE_DISABLE : PIEZO_DISABLE);
259 TText title(0.5, 0.5, utc.c_str());
261 title.SetTextAlign(22);
262 title.SetTextFont(42);
263 title.SetTextSize(0.3);
272 for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
274 if (geometry.
has(i->id)) {
276 const int index = geometry.
getIndex(i->id);
279 const JMODEL ::JString& parameters =
model.string[i->id];
281 X[index].push_back(TMarker(0.0,
string.getZ(), kFullCircle));
282 Y[index].push_back(TMarker(0.0,
string.getZ(), kFullCircle));
284 for (
size_t floor = 1; floor <
string.size(); ++floor) {
290 X[index].push_back(TMarker(position.
getX() -
string.getX(), position.
getZ(), kFullCircle));
291 Y[index].push_back(TMarker(position.
getY() -
string.getY(), position.
getZ(), kFullCircle));
299 for (
size_t i = 0; i != NUMBER_OF_PADS; ++i) {
303 for (
auto& m1 : X[i]) {
static_cast<TAttMarker&
>(m1) = TAttMarker(kBlack, kFullCircle, 0.7/sqrt(NY)); m1.Draw(); }
304 for (
auto& m1 : Y[i]) {
static_cast<TAttMarker&
>(m1) = TAttMarker(kRed, kFullCircle, 0.7/sqrt(NY)); m1.Draw(); }
317 static int count = 0;
320 cout << endl <<
"Type '?' for possible options." << endl;
323 for (
bool user =
true; user; ) {
325 cout <<
"\n> " << flush;
331 cout <<
"possible options: " << endl;
332 cout <<
'q' <<
" -> " <<
"exit application" << endl;
333 cout <<
'u' <<
" -> " <<
"update canvas" << endl;
334 cout <<
's' <<
" -> " <<
"save graphics to file" << endl;
335 cout <<
'r' <<
" -> " <<
"rewind input file" << endl;
336 cout <<
'R' <<
" -> " <<
"switch to ROOT mode (quit ROOT to continue)" << endl;
337 cout <<
'p' <<
" -> " <<
"print event information" << endl;
338 cout <<
' ' <<
" -> " <<
"next event (as well as any other key)" << endl;
358 cout << endl << *evt << endl;