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