CMS 3D CMS Logo

FWEventAnnotation.cc
Go to the documentation of this file.
1 #include "TGLViewer.h"
2 #include "TEveManager.h"
3 
8 
10 
11 FWEventAnnotation::FWEventAnnotation(TGLViewerBase* view) : TGLAnnotation(view, "Event Info", 0.05, 0.95), m_level(1) {
12  SetRole(TGLOverlayElement::kViewer);
13  SetUseColorSet(true);
14  fAllowClose = false;
15 }
16 
18 
19 //______________________________________________________________________________
20 
22  if (x != m_level) {
23  m_level = x;
24  fParent->Changed();
25  gEve->Redraw3D();
26  }
28 }
29 
31 
33  fText = "CMS Experiment at LHC, CERN";
34 
36 
37  if (event && m_level) {
38  fText += "\nData recorded: ";
39  fText += fireworks::getLocalTime(*event);
40  fText += "\nRun/Event: ";
41  fText += event->id().run();
42  fText += " / ";
43  fText += event->id().event();
44  if (m_level > 1) {
45  fText += "\nLumi section: ";
46  fText += event->luminosityBlock();
47  }
48  if (m_level > 2) {
49  fText += "\nOrbit/Crossing: ";
50  fText += event->orbitNumber();
51  fText += " / ";
52  fText += event->bunchCrossing();
53  }
54  }
55 
56  if (m_level) {
57  fParent->Changed();
58  gEve->Redraw3D();
59  }
60 }
61 
62 void FWEventAnnotation::Render(TGLRnrCtx& rnrCtx) {
63  if (m_level)
64  TGLAnnotation::Render(rnrCtx);
65 }
66 
67 //______________________________________________________________________________
68 
70  std::stringstream s;
71  s << fTextSize;
72  iTo.addKeyValue("EventInfoTextSize", FWConfiguration(s.str()));
73 
74  std::stringstream x;
75  x << fPosX;
76  iTo.addKeyValue("EventInfoPosX", FWConfiguration(x.str()));
77 
78  std::stringstream y;
79  y << fPosY;
80  iTo.addKeyValue("EventInfoPosY", FWConfiguration(y.str()));
81 }
82 
84  const FWConfiguration* value;
85 
86  value = iFrom.valueForKey("EventInfoTextSize");
87  if (value)
88  fTextSize = atof(value->value().c_str());
89 
90  value = iFrom.valueForKey("EventInfoPosX");
91  if (value)
92  fPosX = atof(value->value().c_str());
93 
94  value = iFrom.valueForKey("EventInfoPosY");
95  if (value)
96  fPosY = atof(value->value().c_str());
97 }
void Render(TGLRnrCtx &rnrCtx) override
virtual void addTo(FWConfiguration &) const
const edm::EventBase * getCurrentEvent() const
virtual void setFrom(const FWConfiguration &)
FWEventAnnotation(TGLViewerBase *view)
Definition: value.py:1
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
static FWGUIManager * getGUIManager()
const FWConfiguration * valueForKey(const std::string &iKey) const
std::string getLocalTime(const edm::EventBase &event)
float x
~FWEventAnnotation() override
Definition: event.py:1