All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
HeaderDrawer.cxx
Go to the documentation of this file.
1 ///
2 /// \file HeaderDrawer.cxx
3 /// \brief Render the objects from the Simulation package
4 /// \author messier@indiana.edu
5 ///
7 #include "nuevdb/EventDisplayBase/View2D.h"
8 #include "nuevdb/EventDisplayBase/EventHolder.h"
9 
10 #include "TText.h"
11 #include "TTimeStamp.h"
12 
16 
17 namespace evd{
18 
19 //......................................................................
20 
21 void HeaderDrawer::Header(evdb::View2D* view)
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
30  const art::Event* evt = evdb::EventHolder::Instance()->GetEvent();
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[] = {"","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
66 
67  sprintf(runbuff, "Run: %d/%d",run,srun);
68  sprintf(eventbuff,"Event: %d",event);
69  sprintf(datebuff, "UTC %s %s %d, %d",
70  days[dayofweek],
71  months[month],
72  day,
73  year);
74  sprintf(timebuff, "%.2d:%.2d:%2.9f",
75  hour,
76  minute,
77  (float)second+(float)nano/1.0E9);
78 
79  TText& runt = view->AddText(0.04,0.60, runbuff);
80  TText& eventt = view->AddText(0.04,0.45, eventbuff);
81  TText& datet = view->AddText(0.04,0.25, datebuff);
82  TText& timet = view->AddText(0.04,0.10, timebuff);
83 
84  runt.SetTextSize(0.13);
85  runt.SetTextFont(42);
86 
87  eventt.SetTextSize(0.13);
88  eventt.SetTextFont(42);
89 
90  datet.SetTextSize(0.12);
91  datet.SetTextFont(42);
92 
93  timet.SetTextSize(0.12);
94  timet.SetTextFont(42);
95 }
96 
97 }// namespace
98 ////////////////////////////////////////////////////////////////////////
void Header(evdb::View2D *view)
constexpr TimeValue_t value() const
Definition: Timestamp.h:23
Timestamp time() const
LArSoft includes.
Definition: InfoTransfer.h:33
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:78
RunNumber_t run() const
Definition: DataViewImpl.cc:71
std::string fDisplayName
Name to apply to 2D display.
EventNumber_t event() const
Definition: EventID.h:116
TCEvent evt
Definition: DataStructs.cxx:7
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
EventID id() const
Definition: Event.cc:34
Event finding and building.