LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
HeaderDrawer.cxx
Go to the documentation of this file.
9 
10 #include "TText.h"
11 #include "TTimeStamp.h"
12 
16 
17 namespace evd {
18 
19  //......................................................................
20 
22  {
24 
25  TText& titlet = view->AddText(0.03, 0.80, layoutopt->fDisplayName.c_str());
26  titlet.SetTextSize(0.13);
27  titlet.SetTextFont(72);
28 
29  // get the event
31  if (!evt) return;
32 
33  int run = evt->run();
34  int srun = evt->subRun();
35  int event = evt->id().event();
36 
37  unsigned int year, month, day, dayofweek;
38  unsigned int hour, minute, second;
39  int nano;
40 
41  // get the time stamp. art::Timestamp::value() returns a TimeValue_t which is a typedef to unsigned long long.
42  // The conventional use is for the upper 32 bits to have the seconds since 1970 epoch and the lower 32 bits to be
43  // the number of microseconds with the current second.
44  unsigned long long int tsval = evt->time().value();
45 
46  // taking it apart
47  // the masking isn't strictly necessary *if* "long" is truly 32bits
48  // but this can vary w/ compiler/platform
49  const unsigned long int mask32 = 0xFFFFFFFFUL;
50  unsigned long int lup = (tsval >> 32) & mask32;
51  unsigned long int llo = tsval & mask32;
52  TTimeStamp ts(lup, (int)llo);
53 
54  ts.GetDate(kTRUE, 0, &year, &month, &day);
55  ts.GetTime(kTRUE, 0, &hour, &minute, &second);
56  nano = ts.GetNanoSec();
57  dayofweek = ts.GetDayOfWeek();
58  char eventbuff[256];
59  char runbuff[256];
60  char datebuff[256];
61  char timebuff[256];
62 
63  // Skip first one since ROOT returns these numbers starting from 1 not 0
64  static const char* days[] = {"", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
65  static const char* months[] = {
66  "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
67 
68  sprintf(runbuff, "Run: %d/%d", run, srun);
69  sprintf(eventbuff, "Event: %d", event);
70  sprintf(datebuff, "UTC %s %s %d, %d", days[dayofweek], months[month], day, year);
71  sprintf(timebuff, "%.2d:%.2d:%2.9f", hour, minute, (float)second + (float)nano / 1.0E9);
72 
73  TText& runt = view->AddText(0.04, 0.60, runbuff);
74  TText& eventt = view->AddText(0.04, 0.45, eventbuff);
75  TText& datet = view->AddText(0.04, 0.25, datebuff);
76  TText& timet = view->AddText(0.04, 0.10, timebuff);
77 
78  runt.SetTextSize(0.13);
79  runt.SetTextFont(42);
80 
81  eventt.SetTextSize(0.13);
82  eventt.SetTextFont(42);
83 
84  datet.SetTextSize(0.12);
85  datet.SetTextFont(42);
86 
87  timet.SetTextSize(0.12);
88  timet.SetTextFont(42);
89  }
90 
91 } // namespace
void Header(evdb::View2D *view)
SubRunNumber_t subRun() const
Definition: Event.cc:35
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
Render the objects from the Simulation package.
A collection of drawable 2-D objects.
Singleton to hold the current art::Event for the event display.
constexpr TimeValue_t value() const
Definition: Timestamp.h:23
LArSoft includes.
static EventHolder * Instance()
Definition: EventHolder.cxx:15
TText & AddText(double x, double y, const char *text)
Definition: View2D.cxx:286
std::string fDisplayName
Name to apply to 2D display.
Timestamp time() const
Definition: Event.cc:47
EventNumber_t event() const
Definition: EventID.h:116
TCEvent evt
Definition: DataStructs.cxx:8
RunNumber_t run() const
Definition: Event.cc:29
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
EventID id() const
Definition: Event.cc:23
Event finding and building.