11 #include "TApplication.h"
58 int main(
int argc,
char **argv)
78 JParser<> zap(
"Program to display strings.");
80 zap[
'w'] =
make_field(canvas,
"size of canvas <nx>x<ny> [pixels]") =
JCanvas(1200, 600);
81 zap[
'f'] =
make_field(inputFile,
"input file (output of JKatoomba[.sh])");
82 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
87 zap[
'P'] =
make_field(prescale,
"prescale") = 1;
88 zap[
'R'] =
make_field(ratio,
"aspect ratio") = 0.1;
89 zap[
'B'] =
make_field(batch,
"batch processing");
90 zap[
'N'] =
make_field(Nmin,
"minimum number of transmissions") = 0;
95 catch(
const exception& error) {
96 FATAL(error.what() << endl);
100 FATAL(
"Missing output file name " <<
outputFile <<
" in batch mode." << endl);
127 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
128 status[module->getID()] = module->getStatus();
133 gROOT->SetBatch(batch);
135 TApplication* tp =
new TApplication(
"user", NULL, NULL);
136 TCanvas* cv =
new TCanvas(
"display",
"", canvas.x, canvas.y);
138 unique_ptr<TStyle> gStyle(
new JStyle(
"gplot", cv->GetWw(), cv->GetWh()));
140 gROOT->SetStyle(
"gplot");
143 const size_t NY = (size_t) (sqrt(geometry.size()) * 0.75 + 0.25);
144 const size_t NX = (size_t) (geometry.size() + NY - 1) / NY;
146 const size_t NUMBER_OF_PADS = NX * NY;
148 cv->SetFillStyle(4000);
149 cv->SetFillColor(kWhite);
151 TPad*
p1 =
new TPad(
"p1", NULL, 0.0, 0.00, 1.0, 0.95);
152 TPad*
p2 =
new TPad(
"p2", NULL, 0.0, 0.95, 1.0, 1.00);
154 p1->Divide(NX, NY, 0.01, 0.001);
164 if (
i->second.getZ() < zmin) {
165 zmin =
i->second.getZ();
168 if (
i->second.rbegin()->getHeight() > zmax) {
169 zmax =
i->second.rbegin()->getHeight();
176 double xmin = -ratio * (zmax - zmin);
177 double xmax = +ratio * (zmax - zmin);
179 TH2D H2[NUMBER_OF_PADS];
180 TText T2[NUMBER_OF_PADS];
182 for (
size_t i = 0;
i != geometry.size(); ++
i) {
186 DEBUG(
"Pad " << setw(3) <<
i + 1 <<
' ' << H2[
i].GetName() << endl);
188 H2[
i].GetXaxis()->SetTitle(
"x/y [m]");
189 H2[
i].GetYaxis()->SetTitle(
"z [m]");
191 H2[
i].GetXaxis()->CenterTitle(
true);
192 H2[
i].GetYaxis()->CenterTitle(
true);
194 H2[
i].SetStats(kFALSE);
196 T2[
i] = TText(0.0, zmax + 0.05 * (zmax - zmin),
MAKE_CSTRING(
FILL(4,
'0') << geometry.at(
i).first <<
FILL()));
198 T2[
i].SetTextAlign(21);
199 T2[
i].SetTextFont(42);
200 T2[
i].SetTextSize(0.05);
212 JTreeScanner_t::iterator p = in.begin();
214 while (inputFile.hasNext()) {
216 cout <<
"\revent: " << setw(8) << inputFile.getCounter() << flush;
218 const JEvt* evt = inputFile.next();
221 if (batch && inputFile.getCounter()%prescale != 0) {
227 for ( ; p != in.end() && p-> begin()->getToA() < evt->
UNIXTimeStart - 0.5; ++p) {}
229 JTreeScanner_t::iterator q = p;
231 for ( ; q != in.end() && q->rbegin()->getToA() <= evt->
UNIXTimeStop + 0.5; ++q) {}
237 for (JTreeScanner_t::iterator evt = p; evt != q; ++evt) {
238 for (JEvent::const_iterator
i = evt->begin();
i != evt->end(); ++
i) {
239 buffer[
i->getID()] += 1;
243 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
245 module->setStatus(status[module->getID()]);
247 if (buffer[module->getID()] < Nmin) {
258 TText title(0.5, 0.5, utc.c_str());
260 title.SetTextAlign(22);
261 title.SetTextFont(42);
262 title.SetTextSize(0.3);
271 for (JEvt::const_iterator
i = evt->begin();
i != evt->end(); ++
i) {
273 if (geometry.
has(
i->id)) {
275 const int index = geometry.
getIndex(
i->id);
280 X[index].push_back(TMarker(0.0,
string.getZ(), kFullCircle));
281 Y[index].push_back(TMarker(0.0,
string.getZ(), kFullCircle));
283 for (
size_t floor = 1; floor <
string.size(); ++floor) {
289 X[index].push_back(TMarker(position.
getX() -
string.getX(), position.
getZ(), kFullCircle));
290 Y[index].push_back(TMarker(position.
getY() -
string.getY(), position.
getZ(), kFullCircle));
298 for (
size_t i = 0;
i != NUMBER_OF_PADS; ++
i) {
302 for (
auto& m1 : X[
i]) {
static_cast<TAttMarker&
>(m1) = TAttMarker(kBlack, kFullCircle, 0.7/sqrt(NY)); m1.Draw(); }
303 for (
auto& m1 : Y[i]) {
static_cast<TAttMarker&
>(m1) = TAttMarker(kRed, kFullCircle, 0.7/sqrt(NY)); m1.Draw(); }
316 static int count = 0;
319 cout << endl <<
"Type '?' for possible options." << endl;
324 cout <<
"\n> " << flush;
330 cout <<
"possible options: " << endl;
331 cout <<
'q' <<
" -> " <<
"exit application" << endl;
332 cout <<
'u' <<
" -> " <<
"update canvas" << endl;
333 cout <<
's' <<
" -> " <<
"save graphics to file" << endl;
334 cout <<
'r' <<
" -> " <<
"rewind input file" << endl;
335 cout <<
'R' <<
" -> " <<
"switch to ROOT mode (quit ROOT to continue)" << endl;
336 cout <<
'p' <<
" -> " <<
"print event information" << endl;
337 cout <<
' ' <<
" -> " <<
"next event (as well as any other key)" << endl;
357 cout << endl << *evt << endl;
JModel getModel(const JEvt &evt)
Get model.
Utility class to parse command line options.
int main(int argc, char *argv[])
TString replace(const TString &target, const TRegexp ®exp, const T &replacement)
Replace regular expression in input by given replacement.
static JDetectorMechanics getMechanics
Function object to get string mechanics.
then wget no check certificate user
ROOT TTree parameter settings.
bool hasLocation(const JLocation &location) const
Has module.
const JModule & getModule(const JLocation &location) const
Get module parameters.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
#define MAKE_CSTRING(A)
Make C-string.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
Auxiliary data structure for floating point format specification.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
Template definition for direct access of elements in ROOT TChain.
Data structure for detector geometry and calibration.
#define MAKE_STRING(A)
Make string.
Direct access to location in detector data structure.
static const char WILDCARD
Model for fit to acoustics data.
double UNIXTimeStop
stop time
Auxiliary class for defining the range of iterations of objects.
static const JSoundVelocity getSoundVelocity(1541.0,-17.0e-3,-2000.0)
Function object for velocity of sound.
I/O formatting auxiliaries.
Router for direct addressing of location data in detector data structure.
Keyboard settings for unbuffered input.
Logical location of module.
bool has(const int bit) const
Test PMT status.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Enable unbuffered terminal input.
double getY() const
Get y position.
const JPosition3D & getPosition() const
Get position.
General purpose messaging.
Auxiliary data structure for sequence of same character.
Implementation for depth dependend velocity of sound.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Base class for JTreeScanner.
JACOUSTICS::JModel::string_type string
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double UNIXTimeStart
start time
General purpose class for object reading from a list of file names.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Auxiliary class for date and time.
Utility class to parse command line options.
static const int PIEZO_DISABLE
Enable (disable) use of piezo if this status bit is 0 (1);.
double getX() const
Get x position.
no fit printf nominal n $STRING awk v X
static const int HYDROPHONE_DISABLE
Enable (disable) use of hydrophone if this status bit is 0 (1);.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
double getZ() const
Get z position.
Wrapper class around ROOT TStyle.
Data structure for size of TCanvas.
#define DEBUG(A)
Message macros.