CMS 3D CMS Logo

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