59int main(
int argc,
char **argv)
65 JLimit_t& numberOfEvents = inputFile.getLimit();
80 JParser<> zap(
"Program to display strings.");
82 zap[
'w'] =
make_field(canvas,
"size of canvas <nx>x<ny> [pixels]") =
JCanvas(1200, 600);
83 zap[
'f'] =
make_field(inputFile,
"input file (output of JKatoomba[.sh])");
89 zap[
'P'] =
make_field(prescale,
"prescale") = 1;
90 zap[
'R'] =
make_field(ratio,
"aspect ratio") = 0.1;
91 zap[
'B'] =
make_field(batch,
"batch processing");
92 zap[
'N'] =
make_field(Nmin,
"minimum number of transmissions") = 0;
97 catch(
const exception& error) {
98 FATAL(error.what() << endl);
102 FATAL(
"Missing output file name " <<
outputFile <<
" in batch mode." << endl);
129 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
130 status[module->getID()] =
module->getStatus();
135 gROOT->SetBatch(batch);
137 TApplication* tp =
new TApplication(
"user", NULL, NULL);
138 TCanvas* cv =
new TCanvas(
"display",
"", canvas.
x, canvas.
y);
140 unique_ptr<TStyle> gStyle(
new JStyle(
"gplot", cv->GetWw(), cv->GetWh()));
142 gROOT->SetStyle(
"gplot");
145 const size_t NY = (size_t) (sqrt(geometry.size()) * 0.75 + 0.25);
146 const size_t NX = (size_t) (geometry.size() + NY - 1) / NY;
148 const size_t NUMBER_OF_PADS = NX * NY;
150 cv->SetFillStyle(4000);
151 cv->SetFillColor(kWhite);
153 TPad*
p1 =
new TPad(
"p1", NULL, 0.0, 0.00, 1.0, 0.95);
154 TPad* p2 =
new TPad(
"p2", NULL, 0.0, 0.95, 1.0, 1.00);
156 p1->Divide(NX, NY, 0.01, 0.001);
166 if (i->second.getZ() < zmin) {
167 zmin = i->second.getZ();
170 if (i->second.rbegin()->getHeight() > zmax) {
171 zmax = i->second.rbegin()->getHeight();
178 double xmin = -ratio * (zmax - zmin);
179 double xmax = +ratio * (zmax - zmin);
181 TH2D H2[NUMBER_OF_PADS];
182 TText T2[NUMBER_OF_PADS];
184 for (
size_t i = 0; i != geometry.size(); ++i) {
186 H2[i] = TH2D(
MAKE_CSTRING(
FILL(4,
'0') << geometry.at(i).first <<
FILL()), NULL, 100, xmin, xmax, 100, zmin, zmax);
188 DEBUG(
"Pad " << setw(3) << i + 1 <<
' ' << H2[i].GetName() << endl);
190 H2[i].GetXaxis()->SetTitle(
"x/y [m]");
191 H2[i].GetYaxis()->SetTitle(
"z [m]");
193 H2[i].GetXaxis()->CenterTitle(
true);
194 H2[i].GetYaxis()->CenterTitle(
true);
196 H2[i].SetStats(kFALSE);
198 T2[i] = TText(0.0, zmax + 0.05 * (zmax - zmin),
MAKE_CSTRING(
FILL(4,
'0') << geometry.at(i).first <<
FILL()));
200 T2[i].SetTextAlign(21);
201 T2[i].SetTextFont(42);
202 T2[i].SetTextSize(0.05);
214 JTreeScanner_t::iterator p = in.begin();
218 cout <<
"\revent: " << setw(8) << inputFile.
getCounter() << flush;
223 if (batch && inputFile.
getCounter()%prescale != 0) {
229 for ( ; p != in.end() && p-> begin()->getToA() < evt->
UNIXTimeStart - 0.5; ++p) {}
231 JTreeScanner_t::iterator q = p;
233 for ( ; q != in.end() && q->rbegin()->getToA() <= evt->
UNIXTimeStop + 0.5; ++q) {}
239 for (JTreeScanner_t::iterator evt = p; evt != q; ++evt) {
240 for (JEvent::const_iterator i = evt->begin(); i != evt->end(); ++i) {
241 buffer[i->getID()] += 1;
245 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
247 module->setStatus(status[module->getID()]);
249 if (buffer[module->getID()] < Nmin) {
250 module->set(module->getFloor() == 0 ? HYDROPHONE_DISABLE : PIEZO_DISABLE);
260 TText title(0.5, 0.5, utc.c_str());
262 title.SetTextAlign(22);
263 title.SetTextFont(42);
264 title.SetTextSize(0.3);
273 for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
275 if (geometry.
has(i->id)) {
277 const int index = geometry.
getIndex(i->id);
280 const JMODEL ::JString& parameters =
model.string[i->id];
282 X[index].push_back(TMarker(0.0,
string.getZ(), kFullCircle));
283 Y[index].push_back(TMarker(0.0,
string.getZ(), kFullCircle));
285 for (
size_t floor = 1; floor <
string.size(); ++floor) {
291 X[index].push_back(TMarker(position.
getX() -
string.getX(), position.
getZ(), kFullCircle));
292 Y[index].push_back(TMarker(position.
getY() -
string.getY(), position.
getZ(), kFullCircle));
300 for (
size_t i = 0; i != NUMBER_OF_PADS; ++i) {
304 for (
auto& m1 :
X[i]) {
static_cast<TAttMarker&
>(m1) = TAttMarker(kBlack, kFullCircle, 0.7/sqrt(NY)); m1.Draw(); }
305 for (
auto& m1 : Y[i]) {
static_cast<TAttMarker&
>(m1) = TAttMarker(kRed, kFullCircle, 0.7/sqrt(NY)); m1.Draw(); }
318 static int count = 0;
321 cout << endl <<
"Type '?' for possible options." << endl;
324 for (
bool user =
true; user; ) {
326 cout <<
"\n> " << flush;
332 cout <<
"possible options: " << endl;
333 cout <<
'q' <<
" -> " <<
"exit application" << endl;
334 cout <<
'u' <<
" -> " <<
"update canvas" << endl;
335 cout <<
's' <<
" -> " <<
"save graphics to file" << endl;
336 cout <<
'r' <<
" -> " <<
"rewind input file" << endl;
337 cout <<
'R' <<
" -> " <<
"switch to ROOT mode (quit ROOT to continue)" << endl;
338 cout <<
'p' <<
" -> " <<
"print event information" << endl;
339 cout <<
' ' <<
" -> " <<
"next event (as well as any other key)" << endl;
359 cout << endl << *evt << endl;