CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
EveService Class Reference

#include <Fireworks/Geometry/interface/EveService.h>

Public Member Functions

void AddElement (TEveElement *el)
 
void AddGlobalElement (TEveElement *el)
 
void display (const std::string &info="")
 
 EveService (const edm::ParameterSet &, edm::ActivityRegistry &)
 
TEveMagField * getMagField ()
 
TEveManager * getManager ()
 
void postBeginJob ()
 
void postEndJob ()
 
void postEvent (edm::StreamContext const &)
 
void postGlobalBeginRun (edm::GlobalContext const &)
 
void setupFieldForPropagator (TEveTrackPropagator *prop)
 
void slotContinue ()
 
void slotExit ()
 
void slotNextEvent ()
 
void slotStep ()
 
virtual ~EveService ()
 

Protected Member Functions

void createEventNavigationGUI ()
 

Private Member Functions

 ClassDef (EveService, 0)
 
 EveService (const EveService &)
 
const EveServiceoperator= (const EveService &)
 

Private Attributes

bool m_AllowStep
 
TGTextButton * m_ContinueButton
 
TEveManager * m_EveManager
 
TEveMagField * m_MagField
 
TRint * m_Rint
 
bool m_ShowEvent
 
TGTextButton * m_StepButton
 
TGLabel * m_StepLabel
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 43 of file EveService.h.

Constructor & Destructor Documentation

◆ EveService() [1/2]

EveService::EveService ( const edm::ParameterSet ,
edm::ActivityRegistry ar 
)

Definition at line 111 of file EveService.cc.

References cms::cuda::assert(), gather_cfg::cout, createEventNavigationGUI(), m_EveManager, m_MagField, m_Rint, postBeginJob(), postEndJob(), postEvent(), postGlobalBeginRun(), edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostEvent(), and edm::ActivityRegistry::watchPostGlobalBeginRun().

112  : m_EveManager(nullptr),
113  m_Rint(nullptr),
114  m_MagField(nullptr),
115  m_AllowStep(true),
116  m_ShowEvent(true),
117  m_ContinueButton(nullptr),
118  m_StepButton(nullptr),
119  m_StepLabel(nullptr) {
120  printf("EveService::EveService CTOR\n");
121 
122  std::cout << " gApplication " << gApplication << std::endl;
123  std::cout << " is batch " << gROOT->IsBatch() << std::endl;
124  std::cout << " display " << gSystem->Getenv("DISPLAY") << std::endl;
125 
126  const char* dummyArgvArray[] = {"cmsRun"};
127  char** dummyArgv = const_cast<char**>(dummyArgvArray);
128  int dummyArgc = 1;
129 
130  m_Rint = new TRint("App", &dummyArgc, dummyArgv);
131  assert(TApplication::GetApplications()->GetSize());
132 
133  gROOT->SetBatch(kFALSE);
134  std::cout << "calling NeedGraphicsLibs()" << std::endl;
135  TApplication::NeedGraphicsLibs();
136 
137  m_EveManager = TEveManager::Create();
138 
139  m_EveManager->AddEvent(new TEveEventManager("Event", "Event Data"));
140 
141  m_MagField = new CmsEveMagField();
142 
144 
145  // ----------------------------------------------------------------
146 
149 
151 
153 }
void postEvent(edm::StreamContext const &)
Definition: EveService.cc:213
void postBeginJob()
Definition: EveService.cc:165
TGLabel * m_StepLabel
Definition: EveService.h:97
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void watchPostEvent(PostEvent::slot_type const &iSlot)
void postEndJob()
Definition: EveService.cc:172
assert(be >=bs)
TGTextButton * m_ContinueButton
Definition: EveService.h:95
void watchPostGlobalBeginRun(PostGlobalBeginRun::slot_type const &iSlot)
TGTextButton * m_StepButton
Definition: EveService.h:96
bool m_ShowEvent
Definition: EveService.h:93
void postGlobalBeginRun(edm::GlobalContext const &)
Definition: EveService.cc:180
TEveManager * m_EveManager
Definition: EveService.h:87
void createEventNavigationGUI()
Definition: EveService.cc:285
bool m_AllowStep
Definition: EveService.h:92
TEveMagField * m_MagField
Definition: EveService.h:90
TRint * m_Rint
Definition: EveService.h:88
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal

◆ ~EveService()

EveService::~EveService ( )
virtual

Definition at line 155 of file EveService.cc.

References m_MagField.

155  {
156  printf("EveService::~EveService DTOR\n");
157 
158  delete m_MagField;
159 }
TEveMagField * m_MagField
Definition: EveService.h:90

◆ EveService() [2/2]

EveService::EveService ( const EveService )
private

Member Function Documentation

◆ AddElement()

void EveService::AddElement ( TEveElement *  el)

Definition at line 261 of file EveService.cc.

References m_EveManager.

Referenced by DisplayGeom::analyze(), and DummyEvelyser::analyze().

261 { m_EveManager->AddElement(el); }
TEveManager * m_EveManager
Definition: EveService.h:87

◆ AddGlobalElement()

void EveService::AddGlobalElement ( TEveElement *  el)

Definition at line 263 of file EveService.cc.

References m_EveManager.

Referenced by DisplayGeom::beginJob(), and DummyEvelyser::beginRun().

263 { m_EveManager->AddGlobalElement(el); }
TEveManager * m_EveManager
Definition: EveService.h:87

◆ ClassDef()

EveService::ClassDef ( EveService  ,
 
)
private

◆ createEventNavigationGUI()

void EveService::createEventNavigationGUI ( )
protected

Definition at line 285 of file EveService.cc.

References f, m_ContinueButton, m_StepButton, and m_StepLabel.

Referenced by EveService().

285  {
286  const TString cls("EveService");
287 
288  TEveBrowser* browser = gEve->GetBrowser();
289  browser->StartEmbedding(TRootBrowser::kBottom);
290 
291  TGMainFrame* mf = new TGMainFrame(gClient->GetRoot(), 400, 100, kVerticalFrame);
292 
293  TGHorizontalFrame* f = new TGHorizontalFrame(mf);
294  mf->AddFrame(f, new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 2));
295 
296  MkTxtButton(f, "Exit", 100, 2, 2)->Connect("Clicked()", cls, this, "slotExit()");
297 
298  MkTxtButton(f, "Next Event", 100, 2, 2)->Connect("Clicked()", cls, this, "slotNextEvent()");
299 
300  m_ContinueButton = MkTxtButton(f, "Continue", 100, 2, 2);
301  m_ContinueButton->Connect("Clicked()", cls, this, "slotContinue()");
302 
303  m_StepButton = MkTxtButton(f, "Step", 100, 2, 2);
304  m_StepButton->Connect("Clicked()", cls, this, "slotStep()");
305 
306  m_StepLabel = new TGLabel(mf, "");
307  m_StepLabel->SetTextJustify(kTextTop | kTextLeft);
308  mf->AddFrame(m_StepLabel, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
309 
310  mf->SetCleanup(kDeepCleanup);
311  mf->Layout();
312  mf->MapSubwindows();
313  mf->MapWindow();
314 
315  browser->StopEmbedding("EventCtrl");
316 }
TGLabel * m_StepLabel
Definition: EveService.h:97
TGTextButton * m_ContinueButton
Definition: EveService.h:95
double f[11][100]
TGTextButton * m_StepButton
Definition: EveService.h:96

◆ display()

void EveService::display ( const std::string &  info = "")

Definition at line 232 of file EveService.cc.

References info(), m_AllowStep, m_ContinueButton, m_Rint, m_StepButton, and m_StepLabel.

Referenced by DummyEvelyser::analyze().

232  {
233  // Display whatever was registered so far, wait until user presses
234  // the "Step" button.
235 
236  if (m_AllowStep) {
237  m_ContinueButton->SetEnabled(kTRUE);
238  m_StepButton->SetEnabled(kTRUE);
239  m_StepLabel->SetText(info.c_str());
240  gEve->Redraw3D();
241  m_Rint->Run(kTRUE);
242  }
243 }
static const TGPicture * info(bool iBackgroundIsBlack)
TGLabel * m_StepLabel
Definition: EveService.h:97
TGTextButton * m_ContinueButton
Definition: EveService.h:95
TGTextButton * m_StepButton
Definition: EveService.h:96
bool m_AllowStep
Definition: EveService.h:92
TRint * m_Rint
Definition: EveService.h:88

◆ getMagField()

TEveMagField * EveService::getMagField ( )

Definition at line 254 of file EveService.cc.

References m_MagField.

254 { return m_MagField; }
TEveMagField * m_MagField
Definition: EveService.h:90

◆ getManager()

TEveManager * EveService::getManager ( )

Definition at line 249 of file EveService.cc.

References m_EveManager.

Referenced by DummyEvelyser::beginRun().

249  {
250  gEve = m_EveManager;
251  return m_EveManager;
252 }
TEveManager * m_EveManager
Definition: EveService.h:87

◆ operator=()

const EveService& EveService::operator= ( const EveService )
private

◆ postBeginJob()

void EveService::postBeginJob ( )

Definition at line 165 of file EveService.cc.

Referenced by EveService().

165  {
166  printf("EveService::postBeginJob\n");
167 
168  // Show the GUI ...
169  gSystem->ProcessEvents();
170 }

◆ postEndJob()

void EveService::postEndJob ( )

Definition at line 172 of file EveService.cc.

Referenced by EveService().

172  {
173  printf("EveService::postEndJob\n");
174 
175  TEveManager::Terminate();
176 }

◆ postEvent()

void EveService::postEvent ( edm::StreamContext const &  )

Definition at line 213 of file EveService.cc.

References m_AllowStep, m_ContinueButton, m_Rint, m_ShowEvent, m_StepButton, and m_StepLabel.

Referenced by EveService().

213  {
214  printf("EveService::postProcessEvent: Starting GUI loop.\n");
215 
216  m_StepButton->SetEnabled(kFALSE);
217  m_ContinueButton->SetEnabled(kFALSE);
218  m_StepLabel->SetText("");
219 
220  if (m_ShowEvent) {
221  gEve->Redraw3D();
222  m_Rint->Run(kTRUE);
223  }
224  m_ShowEvent = true;
225  m_AllowStep = true;
226 
227  gEve->GetCurrentEvent()->DestroyElements();
228 }
TGLabel * m_StepLabel
Definition: EveService.h:97
TGTextButton * m_ContinueButton
Definition: EveService.h:95
TGTextButton * m_StepButton
Definition: EveService.h:96
bool m_ShowEvent
Definition: EveService.h:93
bool m_AllowStep
Definition: EveService.h:92
TRint * m_Rint
Definition: EveService.h:88

◆ postGlobalBeginRun()

void EveService::postGlobalBeginRun ( edm::GlobalContext const &  )

Definition at line 180 of file EveService.cc.

References m_MagField.

Referenced by EveService().

180  {
181  float current = 18160.0f;
182  /*
183  try
184  {
185  edm::Handle<edm::ConditionsInRunBlock> runCond;
186  bool res = iRun.getByLabel("conditionsInEdm", runCond);
187  if (res && runCond.isValid())
188  {
189  printf("Got current from conds in edm %f\n", runCond->BAvgCurrent);
190  current = runCond->BAvgCurrent;
191  }
192  else
193  {
194  printf("Could not extract run-conditions get-result=%d, is-valid=%d\n", res, runCond.isValid());
195 
196  edm::ESHandle<RunInfo> sum;
197  iSetup.get<RunInfoRcd>().get(sum);
198 
199  current = sum->m_avg_current;
200  printf("Got current from RunInfoRcd %f\n", sum->m_avg_current);
201  }
202  }
203  catch (...)
204  {
205  }
206  */
207  printf("RunInfo not available \n");
208  static_cast<CmsEveMagField*>(m_MagField)->SetFieldByCurrent(current);
209 }
TEveMagField * m_MagField
Definition: EveService.h:90

◆ setupFieldForPropagator()

void EveService::setupFieldForPropagator ( TEveTrackPropagator *  prop)

Definition at line 255 of file EveService.cc.

References m_MagField.

Referenced by DummyEvelyser::beginJob().

255 { prop->SetMagFieldObj(m_MagField, kFALSE); }
TEveMagField * m_MagField
Definition: EveService.h:90

◆ slotContinue()

void EveService::slotContinue ( )

Definition at line 337 of file EveService.cc.

References m_AllowStep.

337  {
338  gSystem->ExitLoop();
339  m_AllowStep = false;
340 }
bool m_AllowStep
Definition: EveService.h:92

◆ slotExit()

void EveService::slotExit ( )

Definition at line 318 of file EveService.cc.

318  {
319  gSystem->ExitLoop();
320  printf("EveService exiting on user request.\n");
321 
322  // Throwing exception here is bad because:
323  // a) it does not work when in a "debug step";
324  // b) does not restore terminal state.
325  // So we do exit instead for now.
326  // throw cms::Exception("UserTerminationRequest");
327 
328  gSystem->Exit(0);
329 }

◆ slotNextEvent()

void EveService::slotNextEvent ( )

Definition at line 331 of file EveService.cc.

References m_AllowStep, and m_ShowEvent.

331  {
332  gSystem->ExitLoop();
333  m_ShowEvent = false;
334  m_AllowStep = false;
335 }
bool m_ShowEvent
Definition: EveService.h:93
bool m_AllowStep
Definition: EveService.h:92

◆ slotStep()

void EveService::slotStep ( )

Definition at line 342 of file EveService.cc.

342 { gSystem->ExitLoop(); }

Member Data Documentation

◆ m_AllowStep

bool EveService::m_AllowStep
private

Definition at line 92 of file EveService.h.

Referenced by display(), postEvent(), slotContinue(), and slotNextEvent().

◆ m_ContinueButton

TGTextButton* EveService::m_ContinueButton
private

Definition at line 95 of file EveService.h.

Referenced by createEventNavigationGUI(), display(), and postEvent().

◆ m_EveManager

TEveManager* EveService::m_EveManager
private

Definition at line 87 of file EveService.h.

Referenced by AddElement(), AddGlobalElement(), EveService(), and getManager().

◆ m_MagField

TEveMagField* EveService::m_MagField
private

◆ m_Rint

TRint* EveService::m_Rint
private

Definition at line 88 of file EveService.h.

Referenced by display(), EveService(), and postEvent().

◆ m_ShowEvent

bool EveService::m_ShowEvent
private

Definition at line 93 of file EveService.h.

Referenced by postEvent(), and slotNextEvent().

◆ m_StepButton

TGTextButton* EveService::m_StepButton
private

Definition at line 96 of file EveService.h.

Referenced by createEventNavigationGUI(), display(), and postEvent().

◆ m_StepLabel

TGLabel* EveService::m_StepLabel
private

Definition at line 97 of file EveService.h.

Referenced by createEventNavigationGUI(), display(), and postEvent().