8 #include "TApplication.h" 
   67   const char WILDCARD = 
'%';
 
   81   struct JEventSelector :
 
  136     friend std::istream& 
operator>>(std::istream& 
in, JEventSelector& 
object)
 
  142       if (in >> 
object.libso) {
 
  144         if (
object.libso.find(function_adaptor_type::SEPARATOR) == string::npos) {
 
  145           object.libso += 
MAKE_CSTRING(function_adaptor_type::SEPARATOR << 
"accept");
 
  148         object.load(
object.libso);
 
  164   inline void execute(
const std::string& command, 
int debug)
 
  171     istream 
in(
process.getInputStreamBuffer());
 
  173     for (
string buffer; 
getline(in, buffer); ) {
 
  174       DEBUG(buffer << endl);
 
  187 int main(
int argc, 
char **argv)
 
  191   using namespace KM3NETDAQ;
 
  194   typedef JParallelFileScanner_t::multi_pointer_type               multi_pointer_type;
 
  196   JParallelFileScanner_t   inputFile;
 
  203   JEventSelector           event_selector;
 
  216     JParser<> zap(
"Program to display hit probabilities.");
 
  218     zap[
'w'] = 
make_field(canvas,       
"size of canvas <nx>x<ny> [pixels]")  = 
JCanvas(1200, 600);
 
  219     zap[
'f'] = 
make_field(inputFile,    
"input file (output of JXXXMuonReconstruction.sh)");
 
  221     zap[
'n'] = 
make_field(numberOfEvents)      = JLimit::max();
 
  230     zap[
'B'] = 
make_field(batch,        
"batch processing");
 
  235   catch(
const exception& error) {
 
  236     FATAL(error.what() << endl);
 
  240     FATAL(
"Missing output file name " << 
outputFile << 
" in batch mode." << endl);
 
  247   if (
outputFile.find(WILDCARD) == string::npos) {
 
  248     FATAL(
"Output file name " << 
outputFile << 
" has no wild card '" << WILDCARD << 
"'" << endl);
 
  280     center = get<JPosition3D>(
getHeader(inputFile));
 
  281   } 
catch(
const exception& error) {}
 
  286   gROOT->SetBatch(batch);
 
  288   TApplication* tp = 
new TApplication(
"user", NULL, NULL);
 
  289   TCanvas*      cv = 
new TCanvas(
"display", 
"", canvas.x, canvas.y);
 
  293   gROOT->SetStyle(
"gplot");
 
  296   const size_t NUMBER_OF_PADS = 3;
 
  298   cv->SetFillStyle(4000);
 
  299   cv->SetFillColor(kWhite);
 
  300   cv->Divide(NUMBER_OF_PADS, 1);
 
  303   const double Rmin = 0.0;
 
  304   const double Rmax = min(
parameters.roadWidth_m, 0.4 * Dmax);
 
  305   const double Tmin = min(
parameters.TMin_ns,  -10.0);
 
  306   const double Tmax = max(
parameters.TMax_ns, +100.0);
 
  307   const double Amin = 0.002 * (Tmax - Tmin);                               
 
  308   const double Amax = 0.8   * (Tmax - Tmin);                               
 
  309   const double ymin = min(-Amax, Tmin - 0.3 * Amax);
 
  310   const double ymax = max(+Amax, Tmax + 0.5 * Amax);
 
  312   const string Xlabel[NUMBER_OF_PADS] = { 
"R [m]", 
"#phi [rad]",   
"z [m]"  };
 
  313   const double Xmin  [NUMBER_OF_PADS] = {  Rmin,      -
PI,      -0.5 * Dmax };
 
  314   const double Xmax  [NUMBER_OF_PADS] = {  Rmax,      +
PI,      +0.5 * Dmax };
 
  316   double Xs[NUMBER_OF_PADS];
 
  318   for (
size_t i = 0; i != NUMBER_OF_PADS; ++i) {
 
  322   TH2D   H2[NUMBER_OF_PADS];
 
  323   TGraph G2[NUMBER_OF_PADS];
 
  325   for (
size_t i = 0; i != NUMBER_OF_PADS; ++i) {
 
  327     H2[i] = TH2D(
MAKE_CSTRING(
"h" << i), NULL, 100, Xmin[i] - Xs[i], Xmax[i] + Xs[i], 100, ymin, ymax);
 
  329     H2[i].GetXaxis()->SetTitle(Xlabel[i].c_str());
 
  330     H2[i].GetYaxis()->SetTitle(
"#Deltat [ns]");
 
  332     H2[i].GetXaxis()->CenterTitle(
true);
 
  333     H2[i].GetYaxis()->CenterTitle(
true);
 
  335     H2[i].SetStats(kFALSE);
 
  339     G2[i].SetPoint(0, H2[i].GetXaxis()->GetXmin(), 0.0);
 
  340     G2[i].SetPoint(1, H2[i].GetXaxis()->GetXmax(), 0.0);
 
  351     cout << 
"\revent: " << setw(8) << inputFile.getCounter() << flush;
 
  353     multi_pointer_type ps = inputFile.next();
 
  359     if (mc.getEntries() != 0) {
 
  370       if (!event_selector(*in, event)) {
 
  377       buildL0(*tev, router, 
true, back_inserter(dataL0));
 
  388         for (
const auto& t1 : event->mc_trks) {
 
  390             if (t1.E > muon.getE()) {
 
  397               muon = 
getFit(0, ta, 0.0, 0, t1.E, 1);
 
  404       bool   next_event  = 
false;                                          
 
  405       bool   monte_carlo = 
false;                                          
 
  408       while (!next_event) {
 
  432         for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
 
  445         sort(data.begin(), data.end(), JHitW0::compare);
 
  447         JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());      
 
  465         TLatex         latex[NUMBER_OF_PADS];
 
  468         for (
int i = 0; i != NUMBER_OF_PADS; ++i) {
 
  470           latex[i].SetTextAlign(12);
 
  471           latex[i].SetTextFont(42);
 
  472           latex[i].SetTextSize(0.06);
 
  474           latex[i].SetX(H2[i].GetXaxis()->GetXmin()  +  0.05 * (H2[i].GetXaxis()->GetXmax() - H2[i].GetXaxis()->GetXmin()));
 
  475           latex[i].SetY(H2[i].GetYaxis()->GetXmax()  -  0.05 * (H2[i].GetYaxis()->GetXmax() - H2[i].GetYaxis()->GetXmin()));
 
  480         for (JDataW0_t::const_iterator hit = data.begin(); hit != __end; ++hit) {
 
  482           const double x  = hit->getX() - tz.getX();
 
  483           const double y  = hit->getY() - tz.getY();
 
  484           const double z  = hit->getZ() - tz.getZ();
 
  485           const double R  = sqrt(x*x + y*y);
 
  489           JDirection3D dir(hit->getDX(), hit->getDY(), hit->getDZ()); 
 
  493           const double theta = dir.
getTheta();
 
  494           const double phi   = fabs(dir.getPhi());                    
 
  497           const double E  = E_GeV;
 
  498           const double dt = T_ns.
constrain(hit->getT()  -  t1);
 
  509           chi2 += H1.getChi2() - H0.getChi2();
 
  511           const double derivative = H1.getDerivativeOfChi2() - H0.getDerivativeOfChi2();
 
  513           double size = derivative * arrowScale;                      
 
  515           if        (fabs(size) < Amin) { 
 
  516             size = (size > 0.0 ? +Amin : -Amin);
 
  517           } 
else if (fabs(size) > Amax) { 
 
  518             size = (size > 0.0 ? +Amax : -Amax);
 
  521           const double X[NUMBER_OF_PADS] = { 
R, atan2(y,x), z };
 
  525           for (
size_t i = 0; i != NUMBER_OF_PADS; ++i) {
 
  526             arrow[i].push_back(TArrow(X[i] + xs*Xs[i], dt, X[i] + xs*Xs[i], dt + size, arrowSize, arrowType.c_str()));
 
  535           latex[1].SetTitle(
MAKE_CSTRING(
"[" << index << 
"]"                            << 
" "  
  541         if (muon.getStatus() >= 0) {
 
  546             latex[2].SetTitle(
"Monte Carlo");
 
  552         for (
int i = 0; i != NUMBER_OF_PADS; ++i) {
 
  558           for (
auto& a1 : arrow[i]) {
 
  576           for (
int c = 0; c == 0; ) {
 
  580               static bool first = 
true;
 
  583                 cout << endl << 
"Type '?' for possible options." << endl;
 
  589             cout << 
"\n> " << flush;
 
  595                    << 
"possible options: " << endl
 
  596                    << 
'q' << 
" -> " << 
"exit application"                            << endl
 
  597                    << 
'u' << 
" -> " << 
"update canvas"                               << endl
 
  598                    << 
's' << 
" -> " << 
"save graphics to file"                       << endl
 
  599                    << 
'+' << 
" -> " << 
"next fit"                                    << endl
 
  600                    << 
'-' << 
" -> " << 
"previous fit"                                << endl
 
  601                    << 
'M' << 
" -> " << 
"Monte Carlo true muon information"           << endl
 
  602                    << 
'F' << 
" -> " << 
"fit information"                             << endl
 
  603                    << 
'x' << 
" -> " << 
"remake standard event selector"              << endl
 
  604                    << 
'L' << 
" -> " << 
"reload event selector"                       << endl
 
  605                    << 
'r' << 
" -> " << 
"rewind input file"                           << endl
 
  606                    << 
'R' << 
" -> " << 
"switch to ROOT mode (quit ROOT to continue)" << endl
 
  607                    << 
' ' << 
" -> " << 
"next event (and any other key)"              << endl;
 
  627               index = (index != in->size() - 1 ? index + 1 : 0);
 
  632               index = (index != 0 ? index - 1 : in->size() - 1);
 
  636               if (muon.getStatus() >= 0)
 
  639                 ERROR(endl << 
"No Monte Carlo muon available." << endl);
 
  657               if (event_selector.is_valid())
 
  658                 event_selector.reload();
 
  660                 ERROR(endl << 
"No event selector (use command line option -L)." << endl);
 
Utility class to parse command line options. 
 
double getAngle(const JQuaternion3D &first, const JQuaternion3D &second)
Get space angle between quanternions. 
 
int main(int argc, char *argv[])
 
ROOT TTree parameter settings of various packages. 
 
bool accept(const JEvt &in, const Evt *event)
Event selection. 
 
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. 
 
void update(const JDAQHeader &header)
Update router. 
 
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. 
 
double getRate() const 
Get default rate. 
 
*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. 
 
Data structure for detector geometry and calibration. 
 
void load(const std::string &file_name, const std::string &symbol)
Load function from shared library. 
 
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. 
 
Basic data structure for L0 hit. 
 
result_type calculate(const double E, const double R, const double theta, const double phi, const double t1) const 
Get PDF. 
 
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. 
 
I/O formatting auxiliaries. 
 
JAxis3D & rotate(const JRotation3D &R)
Rotate axis. 
 
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. 
 
Keyboard settings for unbuffered input. 
 
#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. 
 
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
 
bool is_valid(const json &js)
Check validity of JSon data. 
 
JPosition3D getPosition(const Vec &pos)
Get position. 
 
then break fi done getCenter read X Y Z let X
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line. 
 
static const int JGANDALF_BETA0_RAD
KM3NeT Data Definitions v2.1.0-7-g97845ea https://git.km3net.de/common/km3net-dataformat. 
 
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. 
 
Auxiliary data structure for muon PDF. 
 
Data structure for fit parameters. 
 
then usage $script[distance] fi case set_variable R
 
General purpose messaging. 
 
Auxiliary data structure for sequence of same character. 
 
Auxiliary include file for time conversion between DAQ/trigger hit and Monte Carlo hit...
 
Auxiliary data structure for muon PDF. 
 
Direct access to module in detector data structure. 
 
Streaming of input and output from Linux command. 
 
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=0)
Get fit. 
 
Auxiliary class for a hit with background rate value. 
 
const double getSpeedOfLight()
Get speed of light. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
Utility class to parse command line options. 
 
const double getInverseSpeedOfLight()
Get inverse speed of light. 
 
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
 
Data structure for fit of straight line paralel to z-axis. 
 
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity. 
 
const JLimit & getLimit() const 
Get limit. 
 
void reset()
Reset function adaptor helper. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
KM3NeT DAQ constants, bit handling, etc. 
 
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
 
JTriggerCounter_t getCounter() const 
Get trigger counter. 
 
Wrapper class around ROOT TStyle. 
 
static const int JMUONENERGY
 
bool is_valid() const
Check validity of function. 
 
The Evt class respresent a Monte Carlo (MC) event as well as an offline event. 
 
Data structure for size of TCanvas. 
 
friend std::istream & operator>>(std::istream &in, JFunctionAdaptorHelper &object)
Read function adaptor helper from input stream.