Functions | Variables
drawing.cxx File Reference
#include <gtk/gtk.h>
#include <vector>
#include <stdint.h>
#include "event.h"
#include "drawing.h"
#include "status.h"
#include "geo.h"
#include "hits.h"
#include "tracks.h"
#include "vertices.h"

Go to the source code of this file.

Functions

static void draw_background (cairo_t **cr)
 
void request_edarea_size ()
 
void draw_event (const DRAWPARS *const drawpars)
 
gboolean redraw_event (__attribute__((unused)) GtkWidget *widg, __attribute__((unused)) GdkEventExpose *ee, __attribute__((unused)) gpointer data)
 

Variables

std::vector< noeeventtheevents
 
int gevi
 
bool isfd
 
rect screenview [kXorY]
 
rect screenmu
 
int first_mucatcher
 
int nplanes
 
GtkWidget * edarea [kXorY] = { NULL }
 
cairo_pattern_t * eventpattern [kXorY] = { NULL }
 

Function Documentation

static void draw_background ( cairo_t **  cr)
static

Definition at line 24 of file drawing.cxx.

References first_mucatcher, MECModelEnuComparisons::i, kXorY, kY, nplanes, setboxes(), rect::xmin, make_mec_shifts_plots::xmin, rect::xsize, rect::ymin, ymin, and rect::ysize.

Referenced by draw_event().

25 {
26  setboxes();
27  for(int i = 0; i < kXorY; i++){
28  cairo_set_source_rgb(cr[i], 0, 0, 0);
29  cairo_paint(cr[i]);
30 
31  cairo_set_source_rgb(cr[i], 1, 0, 1);
32  cairo_set_line_width(cr[i], 1.0);
33 
34  // detector box
35  cairo_rectangle(cr[i], 0.5+screenview[i].xmin, 0.5+screenview[i].ymin,
36  screenview[i].xsize, screenview[i].ysize);
37  cairo_stroke(cr[i]);
38  }
39 
40  // Y-view muon catcher empty box
42  cairo_rectangle(cr[kY], 0.5+screenmu.xmin, 0.5+screenmu.ymin,
44  cairo_stroke(cr[kY]);
45  }
46 }
void setboxes()
Definition: geo.cxx:149
int first_mucatcher
Definition: geo.cxx:21
Definition: geo.h:1
rect screenmu
Definition: geo.cxx:29
int xmin
Definition: geo.h:4
int nplanes
Definition: geom.C:145
int xsize
Definition: geo.h:5
int ymin
Definition: geo.h:4
const Var kY([](const caf::SRProxy *sr){float tmp=0.f;if(sr->mc.nu.empty()) return tmp;tmp=sr->mc.nu[0].y;return tmp;})
rect screenview[kXorY]
Definition: geo.cxx:29
int ysize
Definition: geo.h:5
Double_t ymin
Definition: plot.C:24
void draw_event ( const DRAWPARS *const  drawpars)

Definition at line 60 of file drawing.cxx.

References DRAWPARS::clear, draw_background(), draw_hits(), draw_tracks(), draw_vertices(), edarea, eventpattern, gevi, MECModelEnuComparisons::i, isfd, kXorY, request_edarea_size(), set_eventn_status(), setfd(), theevents, and allInOneTrainingPlots::window.

Referenced by redraw_event().

61 {
63  if(theevents.empty()) return;
64 
65  if(!isfd && theevents[gevi].fdlike){
66  setfd();
68  }
69 
70  cairo_t * cr[kXorY];
71  for(int i = 0; i < kXorY; i++)
72  cairo_push_group(cr[i] = gdk_cairo_create(edarea[i]->window));
73 
74  // Do not blank the display in the middle of an animation unless necessary
75  if(drawpars->clear) draw_background(cr);
76 
77  draw_hits(cr, drawpars, edarea);
78 
79  set_eventn_status(); // overwrite anything that draw_hits did
80 
81  // Draw and save the state with hits but not reco objects so that we can easily
82  // redraw with differently highlighted things later
83  for(int i = 0; i < kXorY; i++){
84  if(eventpattern[i] != NULL) cairo_pattern_destroy(eventpattern[i]);
85  eventpattern[i] = cairo_pop_group(cr[i]);
86  cairo_push_group(cr[i]);
87  cairo_set_source(cr[i], eventpattern[i]);
88  cairo_paint(cr[i]);
89  }
90 
91  draw_tracks(cr, drawpars);
92  draw_vertices(cr, drawpars);
93 
94  for(int i = 0; i < kXorY; i++){
95  cairo_pop_group_to_source(cr[i]);
96  cairo_paint(cr[i]);
97  cairo_destroy(cr[i]);
98  }
99 }
GtkWidget * edarea[kXorY]
Definition: drawing.cxx:20
Definition: geo.h:1
bool isfd
Definition: geo.cxx:18
void draw_vertices(cairo_t **cr, const DRAWPARS *const drawpars)
Definition: vertices.cxx:49
bool clear
Definition: drawing.h:5
int gevi
Definition: main.cxx:76
std::vector< noeevent > theevents
Definition: noe_module.cc:28
void setfd()
Definition: geo.cxx:80
void draw_tracks(cairo_t **cr, const DRAWPARS *const drawpars)
Definition: tracks.cxx:47
void draw_hits(cairo_t **cr, const DRAWPARS *const drawpars, GtkWidget **edarea)
Definition: hits.cxx:116
void request_edarea_size()
Definition: drawing.cxx:52
void set_eventn_status()
Definition: status.cxx:192
static void draw_background(cairo_t **cr)
Definition: drawing.cxx:24
cairo_pattern_t * eventpattern[kXorY]
Definition: drawing.cxx:21
gboolean redraw_event ( __attribute__((unused)) GtkWidget *  widg,
__attribute__((unused)) GdkEventExpose *  ee,
__attribute__((unused)) gpointer  data 
)

Definition at line 101 of file drawing.cxx.

References DRAWPARS::clear, draw_event(), FALSE, DRAWPARS::firsttick, gevi, DRAWPARS::lasttick, and theevents.

Referenced by dopanning(), dozooming(), and setup().

104 {
105  DRAWPARS drawpars;
106  drawpars.firsttick = theevents[gevi].current_mintick;
107  drawpars.lasttick = theevents[gevi].current_maxtick;
108  drawpars.clear = true;
109  draw_event(&drawpars);
110 
111  return FALSE;
112 }
bool clear
Definition: drawing.h:5
int gevi
Definition: main.cxx:76
std::vector< noeevent > theevents
Definition: noe_module.cc:28
#define FALSE
Definition: crcmodel.h:85
void draw_event(const DRAWPARS *const drawpars)
Definition: drawing.cxx:60
int32_t firsttick
Definition: drawing.h:4
int32_t lasttick
Definition: drawing.h:4
void request_edarea_size ( )

Definition at line 52 of file drawing.cxx.

References edarea, MECModelEnuComparisons::i, kX, kXorY, kY, std::max(), xmax, and ymax.

Referenced by draw_event(), and setup().

53 {
54  for(int i = 0; i < kXorY; i++)
55  gtk_widget_set_size_request(edarea[i],
58 }
GtkWidget * edarea[kXorY]
Definition: drawing.cxx:20
T max(const caf::Proxy< T > &a, T b)
std::map< std::string, double > xmax
Definition: geo.h:1
const Var kY([](const caf::SRProxy *sr){float tmp=0.f;if(sr->mc.nu.empty()) return tmp;tmp=sr->mc.nu[0].y;return tmp;})
Double_t ymax
Definition: plot.C:25
rect screenview[kXorY]
Definition: geo.cxx:29
Definition: geo.h:1

Variable Documentation

GtkWidget* edarea[kXorY] = { NULL }
cairo_pattern_t* eventpattern[kXorY] = { NULL }

Definition at line 21 of file drawing.cxx.

Referenced by change_highlighted_reco(), and draw_event().

int first_mucatcher

Definition at line 21 of file geo.cxx.

Referenced by draw_background().

int gevi

Definition at line 76 of file main.cxx.

Referenced by draw_event(), and redraw_event().

bool isfd

Definition at line 18 of file geo.cxx.

Referenced by draw_event(), main(), and NuMu2020_BasicPIDPlots_Plot().

int nplanes

Definition at line 145 of file geom.C.

Referenced by draw_background().

rect screenmu

Definition at line 29 of file geo.cxx.

rect screenview[kXorY]

Definition at line 29 of file geo.cxx.

std::vector<noeevent> theevents

Definition at line 28 of file noe_module.cc.

Referenced by draw_event(), and redraw_event().