CMS 3D CMS Logo

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.

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 }

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().

◆ ~EveService()

EveService::~EveService ( )
virtual

Definition at line 155 of file EveService.cc.

155  {
156  printf("EveService::~EveService DTOR\n");
157 
158  delete m_MagField;
159 }

References m_MagField.

◆ 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.

261 { m_EveManager->AddElement(el); }

References m_EveManager.

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

◆ AddGlobalElement()

void EveService::AddGlobalElement ( TEveElement *  el)

Definition at line 263 of file EveService.cc.

263 { m_EveManager->AddGlobalElement(el); }

References m_EveManager.

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

◆ ClassDef()

EveService::ClassDef ( EveService  ,
 
)
private

◆ createEventNavigationGUI()

void EveService::createEventNavigationGUI ( )
protected

Definition at line 285 of file EveService.cc.

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 }

References f, m_ContinueButton, m_StepButton, and m_StepLabel.

Referenced by EveService().

◆ display()

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

Definition at line 232 of file EveService.cc.

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 }

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

Referenced by DummyEvelyser::analyze().

◆ getMagField()

TEveMagField * EveService::getMagField ( )

Definition at line 254 of file EveService.cc.

254 { return m_MagField; }

References m_MagField.

◆ getManager()

TEveManager * EveService::getManager ( )

Definition at line 249 of file EveService.cc.

249  {
250  gEve = m_EveManager;
251  return m_EveManager;
252 }

References m_EveManager.

Referenced by DummyEvelyser::beginRun().

◆ operator=()

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

◆ postBeginJob()

void EveService::postBeginJob ( )

Definition at line 165 of file EveService.cc.

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

Referenced by EveService().

◆ postEndJob()

void EveService::postEndJob ( )

Definition at line 172 of file EveService.cc.

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

Referenced by EveService().

◆ postEvent()

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

Definition at line 213 of file EveService.cc.

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 }

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

Referenced by EveService().

◆ postGlobalBeginRun()

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

Definition at line 180 of file EveService.cc.

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 }

References m_MagField.

Referenced by EveService().

◆ setupFieldForPropagator()

void EveService::setupFieldForPropagator ( TEveTrackPropagator *  prop)

Definition at line 255 of file EveService.cc.

255 { prop->SetMagFieldObj(m_MagField, kFALSE); }

References m_MagField.

Referenced by DummyEvelyser::beginJob().

◆ slotContinue()

void EveService::slotContinue ( )

Definition at line 337 of file EveService.cc.

337  {
338  gSystem->ExitLoop();
339  m_AllowStep = false;
340 }

References m_AllowStep.

◆ 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.

331  {
332  gSystem->ExitLoop();
333  m_ShowEvent = false;
334  m_AllowStep = false;
335 }

References m_AllowStep, and m_ShowEvent.

◆ 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().

EveService::m_ShowEvent
bool m_ShowEvent
Definition: EveService.h:93
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
EveService::m_AllowStep
bool m_AllowStep
Definition: EveService.h:92
EveService::m_StepButton
TGTextButton * m_StepButton
Definition: EveService.h:96
EveService::postGlobalBeginRun
void postGlobalBeginRun(edm::GlobalContext const &)
Definition: EveService.cc:180
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
EveService::m_EveManager
TEveManager * m_EveManager
Definition: EveService.h:87
EveService::createEventNavigationGUI
void createEventNavigationGUI()
Definition: EveService.cc:285
edm::ActivityRegistry::watchPostEndJob
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
Definition: ActivityRegistry.h:170
edm::ActivityRegistry::watchPostBeginJob
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
Definition: ActivityRegistry.h:158
EveService::postBeginJob
void postBeginJob()
Definition: EveService.cc:165
EveService::m_Rint
TRint * m_Rint
Definition: EveService.h:88
edm::ActivityRegistry::watchPostEvent
void watchPostEvent(PostEvent::slot_type const &iSlot)
Definition: ActivityRegistry.h:464
EveService::m_MagField
TEveMagField * m_MagField
Definition: EveService.h:90
EveService::postEvent
void postEvent(edm::StreamContext const &)
Definition: EveService.cc:213
EveService::postEndJob
void postEndJob()
Definition: EveService.cc:172
EveService::m_StepLabel
TGLabel * m_StepLabel
Definition: EveService.h:97
edm::ActivityRegistry::watchPostGlobalBeginRun
void watchPostGlobalBeginRun(PostGlobalBeginRun::slot_type const &iSlot)
Definition: ActivityRegistry.h:322
EveService::m_ContinueButton
TGTextButton * m_ContinueButton
Definition: EveService.h:95