HeaderDrawer.cxx
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////////////
2 /// \file HeaderDrawer.cxx
3 /// \brief Render the objects from the Simulation package
4 /// \version $Id: HeaderDrawer.cxx,v 1.11 2012-08-28 22:00:57 denis Exp $
5 /// \author messier@indiana.edu
6 /////////////////////////////////////////////////////////////////////////
8 #include "TText.h"
9 #include "TTimeStamp.h"
12 #include "RawData/RawTrigger.h"
16 #include "DAQDataFormats/TriggerDefines.h" // needed to print trigger ID
17 
18 namespace evd
19 {
20  //....................................................................
21 
23 
24  //......................................................................
25 
27 
28  //......................................................................
29 
33  std::string& dates,
35  {
36  titles = "NOvA - FNAL E929";
37 
38  //
39  // get the event
40  //
42  if (!evt) return;
43  if (getenv("BLIND_NOVA_EVD")!=NULL) return;
44 
45  int run = evt->run();
46  int srun = evt->subRun();
47 
48  //
49  // Line of text for run and event number
50  //
51  char runbuff[256];
52  sprintf(runbuff, "Run: %d / %d",run,srun);
53  runs = runbuff;
54 
55  //
56  // Unpack trigger information and make line for event number
57  //
58  char eventbuff[256];
59  int event = evt->id().event();
60  std::vector<art::Handle<std::vector<rawdata::RawTrigger> > > trigv;
61  evt->getManyByType(trigv);
62  const char* trgname="--";
63  if (!trigv.empty()) {
64  const rawdata::RawTrigger& trig = (*trigv[0])[0];
65  const int trgsrc = trig.fTriggerMask_TriggerType;
66  if (trgsrc>0 && trgsrc<MAX_TRIGGER_BITS) {
67  trgname = daqdataformats::trigIDShortStrings[trgsrc];
68  }
69  }
70  sprintf(eventbuff,"Event: %d / %s",event,trgname);
71  events = eventbuff;
72 
73  //
74  // Unpack time and date information
75  //
76  unsigned int year, month, day, dayofweek;
77  unsigned int hour, minute, second;
78  int nano;
79  //
80  // get the time stamp. art::Timestamp::value() returns a
81  // TimeValue_t which is a typedef to unsigned long long. The
82  // upper 32 bits is the seconds since 1970 epoch and the lower
83  // 32 bits is the number of nanoseconds with the current second.
84  // (This comment previously said *microseconds*, but as you can
85  // see below, it's clearly nano.)
86  //
87  unsigned long long int tsval = evt->time().value();
88  //
89  // taking it apart the masking isn't strictly necessary *if*
90  // "long" is truly 32bits but this can vary w/ compiler/platform
91  //
92  const unsigned long int mask32 = 0xFFFFFFFFUL;
93  unsigned long int lup = ( tsval >> 32 ) & mask32;
94  unsigned long int llo = tsval & mask32;
95  TTimeStamp ts(lup, (int)llo);
96 
97  ts.GetDate(kTRUE,0,&year,&month,&day);
98  ts.GetTime(kTRUE,0,&hour,&minute,&second);
99  nano = ts.GetNanoSec();
100  dayofweek = ts.GetDayOfWeek();
101 
102  // Skip first one since ROOT returns these numbers starting from 1 not 0
103  static const char* days[] = {"",
104  "Mon","Tue","Wed","Thu","Fri","Sat","Sun"
105  };
106  static const char* months[] = {"",
107  "Jan","Feb","Mar","Apr","May","Jun",
108  "Jul","Aug","Sep","Oct","Nov","Dec"
109  };
110  char datebuff[256];
111  char timebuff[256];
112  sprintf(datebuff, "UTC %s %s %u, %u",
113  days[dayofweek],
114  months[month],
115  day,
116  year);
117  sprintf(timebuff, "%.2u:%.2u:%2.9f",
118  hour,
119  minute,
120  (float)second+(float)nano/1.0E9);
121  dates = datebuff;
122  times = timebuff;
123  }
124 
125  //......................................................................
126 
128  {
131  std::string event;
134 
135  this->Text(title,run,event,date,time);
136 
138  int c = colors->Foreground(0);
139 
140  TText& titlet = view->AddText(0.03,0.80, title.c_str());
141  TText& runt = view->AddText(0.04,0.60, run.c_str());
142  TText& eventt = view->AddText(0.04,0.45, event.c_str());
143  TText& datet = view->AddText(0.04,0.25, date.c_str());
144  TText& timet = view->AddText(0.04,0.10, time.c_str());
145 
146  titlet.SetTextSize(0.13);
147  titlet.SetTextFont(62);
148  titlet.SetTextColor(c);
149 
150  runt.SetTextSize(0.12);
151  runt.SetTextFont(42);
152  runt.SetTextColor(c);
153 
154  eventt.SetTextSize(0.12);
155  eventt.SetTextFont(42);
156  eventt.SetTextColor(c);
157 
158  datet.SetTextSize(0.12);
159  datet.SetTextFont(42);
160  datet.SetTextColor(c);
161 
162  timet.SetTextSize(0.12);
163  timet.SetTextFont(42);
164  timet.SetTextColor(c);
165  }
166 
167  //......................................................................
168 
170  {
173  std::string event;
176 
177  this->Text(title,run,event,date,time);
178 
180  int c = colors->Foreground(0);
181 
182  TText& titlet = view->AddText(-0.98,-0.75, title.c_str());
183  TText& runt = view->AddText(-0.98,-0.80, run.c_str());
184  TText& eventt = view->AddText(-0.98,-0.85, event.c_str());
185  TText& datet = view->AddText(-0.98,-0.90, date.c_str());
186  TText& timet = view->AddText(-0.98,-0.95, time.c_str());
187 
188  titlet.SetTextSize(0.030);
189  titlet.SetTextFont(62);
190  titlet.SetTextColor(c);
191 
192  runt.SetTextSize(0.024);
193  runt.SetTextFont(42);
194  runt.SetTextColor(c);
195 
196  eventt.SetTextSize(0.024);
197  eventt.SetTextFont(42);
198  eventt.SetTextColor(c);
199 
200  datet.SetTextSize(0.024);
201  datet.SetTextFont(42);
202  datet.SetTextColor(c);
203 
204  timet.SetTextSize(0.024);
205  timet.SetTextFont(42);
206  timet.SetTextColor(c);
207  }
208 
209 } // end namespace evd
210 ////////////////////////////////////////////////////////////////////////
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.
::xsd::cxx::tree::date< char, simple_type > date
Definition: Database.h:186
#define MAX_TRIGGER_BITS
A collection of drawable 2-D objects.
::xsd::cxx::tree::time< char, simple_type > time
Definition: Database.h:194
Singleton to hold the current art::Event for the event display.
TText & AddText(double x, double y, const char *text)
Definition: View3D.cxx:135
constexpr TimeValue_t value() const
Definition: Timestamp.h:24
uint8_t fTriggerMask_TriggerType
Definition: RawTrigger.h:43
int colors[6]
Definition: tools.h:1
nova event display
static EventHolder * Instance()
Definition: EventHolder.cxx:15
std::string getenv(std::string const &name)
const char * trigIDShortStrings[]
TText & AddText(double x, double y, const char *text)
Definition: View2D.cxx:286
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: DataViewImpl.h:446
Definition: run.py:1
EventNumber_t event() const
Definition: EventID.h:116
int Foreground(int i=0)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Timestamp time() const
Definition: Event.h:61
void Text(std::string &title, std::string &run, std::string &event, std::string &date, std::string &time)
A collection of 3D drawable objects.
RunNumber_t run() const
Definition: Event.h:77
void events(int which)
Definition: Cana.C:52
EventID id() const
Definition: Event.h:56
list runs
Definition: shutoffs.py:47
static constexpr Double_t year
Definition: Munits.h:185