192 using namespace KM3NETDAQ;
195 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
197 JParallelFileScanner_t inputFile;
204 JEventSelector event_selector;
217 JParser<> zap(
"Program to display hit probabilities.");
219 zap[
'w'] =
make_field(canvas,
"size of canvas <nx>x<ny> [pixels]") =
JCanvas(1200, 600);
220 zap[
'f'] =
make_field(inputFile,
"input file (output of JXXXMuonReconstruction.sh)");
222 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
231 zap[
'B'] =
make_field(batch,
"batch processing");
236 catch(
const exception& error) {
237 FATAL(error.what() << endl);
241 FATAL(
"Missing output file name " <<
outputFile <<
" in batch mode." << endl);
248 if (
outputFile.find(WILDCARD) == string::npos) {
249 FATAL(
"Output file name " <<
outputFile <<
" has no wild card '" << WILDCARD <<
"'" << endl);
281 center = get<JPosition3D>(
getHeader(inputFile));
282 }
catch(
const exception& error) {}
287 gROOT->SetBatch(batch);
289 TApplication* tp =
new TApplication(
"user", NULL, NULL);
290 TCanvas* cv =
new TCanvas(
"display",
"", canvas.x, canvas.y);
294 gROOT->SetStyle(
"gplot");
297 const size_t NUMBER_OF_PADS = 3;
299 cv->SetFillStyle(4000);
300 cv->SetFillColor(kWhite);
301 cv->Divide(NUMBER_OF_PADS, 1);
304 const double Rmin = 0.0;
305 const double Rmax = min(
parameters.roadWidth_m, 0.4 * Dmax);
306 const double Tmin = min(
parameters.TMin_ns, -10.0);
307 const double Tmax = max(
parameters.TMax_ns, +100.0);
308 const double Amin = 0.002 * (Tmax - Tmin);
309 const double Amax = 0.8 * (Tmax - Tmin);
310 const double ymin = min(-Amax, Tmin - 0.3 * Amax);
311 const double ymax = max(+Amax, Tmax + 0.5 * Amax);
313 const string Xlabel[NUMBER_OF_PADS] = {
"R [m]",
"#phi [rad]",
"z [m]" };
314 const double Xmin [NUMBER_OF_PADS] = { Rmin, -
PI, -0.5 * Dmax };
315 const double Xmax [NUMBER_OF_PADS] = { Rmax, +
PI, +0.5 * Dmax };
317 double Xs[NUMBER_OF_PADS];
319 for (
size_t i = 0; i != NUMBER_OF_PADS; ++i) {
323 TH2D H2[NUMBER_OF_PADS];
324 TGraph G2[NUMBER_OF_PADS];
326 for (
size_t i = 0; i != NUMBER_OF_PADS; ++i) {
328 H2[i] = TH2D(
MAKE_CSTRING(
"h" << i), NULL, 100, Xmin[i] - Xs[i], Xmax[i] + Xs[i], 100, ymin, ymax);
330 H2[i].GetXaxis()->SetTitle(Xlabel[i].c_str());
331 H2[i].GetYaxis()->SetTitle(
"#Deltat [ns]");
333 H2[i].GetXaxis()->CenterTitle(
true);
334 H2[i].GetYaxis()->CenterTitle(
true);
336 H2[i].SetStats(kFALSE);
340 G2[i].SetPoint(0, H2[i].GetXaxis()->GetXmin(), 0.0);
341 G2[i].SetPoint(1, H2[i].GetXaxis()->GetXmax(), 0.0);
352 cout <<
"\revent: " << setw(8) << inputFile.getCounter() << flush;
354 multi_pointer_type ps = inputFile.next();
360 if (mc.getEntries() != 0) {
371 if (!event_selector(*in, event)) {
378 buildL0(*tev, router,
true, back_inserter(dataL0));
380 summary.update(*tev);
389 for (
const auto& t1 : event->mc_trks) {
391 if (t1.E > muon.getE()) {
398 muon =
getFit(0, ta, 0.0, 0, t1.E, 1);
407 bool next_event =
false;
408 bool monte_carlo =
false;
411 while (!next_event) {
435 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
437 JHitW0 hit(*i, summary.getRate(i->getPMTIdentifier()));
448 sort(data.begin(), data.end(), JHitW0::compare);
450 JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
463 const double z0 = tz.getZ();
464 const double z1 = 0.5 * (zs.getLowerLimit() + zs.getUpperLimit());
471 TLatex latex [NUMBER_OF_PADS];
475 for (
int i = 0; i != NUMBER_OF_PADS; ++i) {
477 latex[i].SetTextAlign(12);
478 latex[i].SetTextFont(42);
479 latex[i].SetTextSize(0.06);
481 latex[i].SetX(H2[i].GetXaxis()->GetXmin() + 0.05 * (H2[i].GetXaxis()->GetXmax() - H2[i].GetXaxis()->GetXmin()));
482 latex[i].SetY(H2[i].GetYaxis()->GetXmax() - 0.05 * (H2[i].GetYaxis()->GetXmax() - H2[i].GetYaxis()->GetXmin()));
487 marker[2].push_back(TMarker(z0 - tz.getZ(), 0.0, kFullCircle));
488 marker[2].push_back(TMarker(z0 - tz.getZ() + fit.getW(
JSTART_LENGTH_METRES), 0.0, kFullCircle));
490 static_cast<TAttMarker&
>(marker[2][0]) = TAttMarker(kRed, kFullCircle, 0.7);
491 static_cast<TAttMarker&
>(marker[2][1]) = TAttMarker(kRed, kFullCircle, 0.7);
496 for (JDataW0_t::const_iterator hit = data.begin(); hit != __end; ++hit) {
498 const double x = hit->getX() - tz.getX();
499 const double y = hit->getY() - tz.getY();
500 const double z = hit->getZ() - tz.getZ();
501 const double R = sqrt(x*x + y*y);
505 JDirection3D dir(hit->getDX(), hit->getDY(), hit->getDZ());
509 const double theta = dir.
getTheta();
510 const double phi = fabs(dir.getPhi());
513 const double E = E_GeV;
514 const double dt = T_ns.constrain(hit->getT() - t1);
525 chi2 += H1.getChi2() - H0.getChi2();
527 const double derivative = H1.getDerivativeOfChi2() - H0.getDerivativeOfChi2();
529 double size = derivative * arrowScale;
531 if (fabs(size) < Amin) {
532 size = (size > 0.0 ? +Amin : -Amin);
533 }
else if (fabs(size) > Amax) {
534 size = (size > 0.0 ? +Amax : -Amax);
537 const double X[NUMBER_OF_PADS] = {
R, atan2(y,x), z - R/
getTanThetaC() };
541 for (
size_t i = 0; i != NUMBER_OF_PADS; ++i) {
542 arrow[i].push_back(TArrow(X[i] + xs*Xs[i], dt, X[i] + xs*Xs[i], dt + size, arrowSize, arrowType.c_str()));
551 latex[1].SetTitle(
MAKE_CSTRING(
"[" << index <<
"]" <<
" " <<
553 "E = " <<
SCIENTIFIC(7,1) << fit.getE() <<
" [GeV]"));
557 if (muon.getStatus() >= 0) {
562 latex[2].SetTitle(
"Monte Carlo");
568 for (
int i = 0; i != NUMBER_OF_PADS; ++i) {
574 for (
auto& a1 : arrow[i]) {
578 for (
auto& m1 : marker[i]) {
596 for (
int c = 0;
c == 0; ) {
600 static bool first =
true;
603 cout << endl <<
"Type '?' for possible options." << endl;
609 cout <<
"\n> " << flush;
615 cout <<
"possible options: " << endl;
616 cout <<
'q' <<
" -> " <<
"exit application" << endl;
617 cout <<
'u' <<
" -> " <<
"update canvas" << endl;
618 cout <<
's' <<
" -> " <<
"save graphics to file" << endl;
619 cout <<
'+' <<
" -> " <<
"next fit" << endl;
620 cout <<
'-' <<
" -> " <<
"previous fit" << endl;
621 cout <<
'M' <<
" -> " <<
"Monte Carlo true muon information" << endl;
622 cout <<
'F' <<
" -> " <<
"fit information" << endl;
623 if (event_selector.is_valid()) {
624 cout <<
'L' <<
" -> " <<
"reload event selector" << endl;
626 cout <<
'r' <<
" -> " <<
"rewind input file" << endl;
627 cout <<
'R' <<
" -> " <<
"switch to ROOT mode (quit ROOT to continue)" << endl;
628 cout <<
' ' <<
" -> " <<
"next event (as well as any other key)" << endl;
648 index = (index != in->size() - 1 ? index + 1 : 0);
653 index = (index != 0 ? index - 1 : in->size() - 1);
657 if (muon.getStatus() >= 0)
660 ERROR(endl <<
"No Monte Carlo muon available." << endl);
673 if (event_selector.is_valid()) {
674 execute(
MAKE_STRING(
"make -f " <<
getPath(argv[0]) <<
"/JMakeEventSelector libs"), 3);
675 event_selector.reload();
static const int JMUONSTART
Utility class to parse command line options.
double getAngle(const JQuaternion3D &first, const JQuaternion3D &second)
Get space angle between quanternions.
TString replace(const TString &target, const TRegexp ®exp, const T &replacement)
Replace regular expression in input by given replacement.
Data structure for direction in three dimensions.
double getQuality(const double chi2, const int NDF)
Get quality of fit.
JTrack3E getTrack(const Trk &track)
Get track.
Template specialisation of L0 builder for JHitL0 data type.
std::string getPath(const std::string &file_name)
Get path, i.e. part before last JEEP::PATHNAME_SEPARATOR if any.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
Router for direct addressing of module data in detector data structure.
*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
General purpose class for parallel reading of objects from a single file or multiple files...
#define MAKE_CSTRING(A)
Make C-string.
Template specialisation of class JModel to match hit with muon trajectory along z-axis.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
Auxiliary data structure for floating point format specification.
int getRunNumber() const
Get run number.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
#define MAKE_STRING(A)
Make string.
int getFrameIndex() const
Get frame index.
JTime & add(const JTime &value)
Addition operator.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
The template JSinglePointer class can be used to hold a pointer to an object.
Auxiliary class for defining the range of iterations of objects.
double getMaximalDistance(const JDetector &detector)
Get maximal distance between modules in detector.
JDirection3D getDirection(const Vec &dir)
Get direction.
JFunction1D_t::result_type result_type
Data structure for vector in three dimensions.
JDirection3D & rotate(const JRotation3D &R)
Rotate.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Enable unbuffered terminal input.
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
Auxiliary class to test history.
static const int JMUONGANDALF
double getTheta() const
Get theta angle.
JPosition3D getPosition(const Vec &pos)
Get position.
double putTime() const
Get Monte Carlo time minus DAQ/trigger time.
static const double PI
Mathematical constants.
File router for fast addressing of summary data.
Data structure for fit parameters.
then usage $script[distance] fi case set_variable R
Auxiliary data structure for sequence of same character.
Auxiliary data structure for muon PDF.
Auxiliary class for a hit with background rate value.
const double getSpeedOfLight()
Get speed of light.
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
JFit getFit(const int id, const JMODEL::JString &string)
Get fit parameters of string.
const double getInverseSpeedOfLight()
Get inverse speed of light.
Data structure for fit of straight line paralel to z-axis.
no fit printf nominal n $STRING awk v X
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
const JLimit & getLimit() const
Get limit.
$WORKDIR ev_configure_domsimulator txt echo process $DOM_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DOM_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
do set_variable DETECTOR_TXT $WORKDIR detector
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
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 data structure for floating point format specification.
JTriggerCounter_t getCounter() const
Get trigger counter.
Wrapper class around ROOT TStyle.
static const int JMUONENERGY
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Data structure for size of TCanvas.