test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 44 of file EveService.h.

Constructor & Destructor Documentation

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

Definition at line 125 of file EveService.cc.

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

125  :
126  m_EveManager(0), m_Rint(0),
127  m_MagField(0),
128  m_AllowStep(true), m_ShowEvent(true),
130 {
131  printf("EveService::EveService CTOR\n");
132 
133  std::cout <<" gApplication "<< gApplication <<std::endl;
134  std::cout <<" is batch " << gROOT->IsBatch() <<std::endl;
135  std::cout <<" display " << gSystem->Getenv("DISPLAY") <<std::endl;
136 
137  const char* dummyArgvArray[] = {"cmsRun"};
138  char** dummyArgv = const_cast<char**>(dummyArgvArray);
139  int dummyArgc = 1;
140 
141  m_Rint = new TRint("App", &dummyArgc, dummyArgv);
142  assert(TApplication::GetApplications()->GetSize());
143 
144  gROOT->SetBatch(kFALSE);
145  std::cout<<"calling NeedGraphicsLibs()"<<std::endl;
146  TApplication::NeedGraphicsLibs();
147 
148  m_EveManager = TEveManager::Create();
149 
150  m_EveManager->AddEvent(new TEveEventManager("Event", "Event Data"));
151 
152  m_MagField = new CmsEveMagField();
153 
155 
156  // ----------------------------------------------------------------
157 
160 
162 
164 }
void postEvent(edm::StreamContext const &)
Definition: EveService.cc:229
void postBeginJob()
Definition: EveService.cc:178
TGLabel * m_StepLabel
Definition: EveService.h:99
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void watchPostEvent(PostEvent::slot_type const &iSlot)
assert(m_qm.get())
void postEndJob()
Definition: EveService.cc:186
TGTextButton * m_ContinueButton
Definition: EveService.h:97
void watchPostGlobalBeginRun(PostGlobalBeginRun::slot_type const &iSlot)
TGTextButton * m_StepButton
Definition: EveService.h:98
bool m_ShowEvent
Definition: EveService.h:95
void postGlobalBeginRun(edm::GlobalContext const &)
Definition: EveService.cc:195
TEveManager * m_EveManager
Definition: EveService.h:89
void createEventNavigationGUI()
Definition: EveService.cc:321
bool m_AllowStep
Definition: EveService.h:94
tuple cout
Definition: gather_cfg.py:145
TEveMagField * m_MagField
Definition: EveService.h:92
TRint * m_Rint
Definition: EveService.h:90
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
EveService::~EveService ( )
virtual

Definition at line 166 of file EveService.cc.

References m_MagField.

167 {
168  printf("EveService::~EveService DTOR\n");
169 
170  delete m_MagField;
171 }
TEveMagField * m_MagField
Definition: EveService.h:92
EveService::EveService ( const EveService )
private

Member Function Documentation

void EveService::AddElement ( TEveElement *  el)

Definition at line 288 of file EveService.cc.

References m_EveManager.

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

289 {
290  m_EveManager->AddElement(el);
291 }
TEveManager * m_EveManager
Definition: EveService.h:89
void EveService::AddGlobalElement ( TEveElement *  el)

Definition at line 293 of file EveService.cc.

References m_EveManager.

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

294 {
295  m_EveManager->AddGlobalElement(el);
296 }
TEveManager * m_EveManager
Definition: EveService.h:89
EveService::ClassDef ( EveService  ,
 
)
private
void EveService::createEventNavigationGUI ( )
protected

Definition at line 321 of file EveService.cc.

References f, m_ContinueButton, m_StepButton, and m_StepLabel.

Referenced by EveService().

322 {
323  const TString cls("EveService");
324 
325  TEveBrowser *browser = gEve->GetBrowser();
326  browser->StartEmbedding(TRootBrowser::kBottom);
327 
328  TGMainFrame *mf = new TGMainFrame(gClient->GetRoot(), 400, 100, kVerticalFrame);
329 
330  TGHorizontalFrame* f = new TGHorizontalFrame(mf);
331  mf->AddFrame(f, new TGLayoutHints(kLHintsExpandX, 0,0,2,2));
332 
333  MkTxtButton(f, "Exit", 100, 2, 2)->
334  Connect("Clicked()", cls, this, "slotExit()");
335 
336  MkTxtButton(f, "Next Event", 100, 2, 2)->
337  Connect("Clicked()", cls, this, "slotNextEvent()");
338 
339  m_ContinueButton = MkTxtButton(f, "Continue", 100, 2, 2);
340  m_ContinueButton->Connect("Clicked()", cls, this, "slotContinue()");
341 
342  m_StepButton = MkTxtButton(f, "Step", 100, 2, 2);
343  m_StepButton->Connect("Clicked()", cls, this, "slotStep()");
344 
345  m_StepLabel = new TGLabel(mf, "");
346  m_StepLabel->SetTextJustify(kTextTop | kTextLeft);
347  mf->AddFrame(m_StepLabel, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
348 
349  mf->SetCleanup(kDeepCleanup);
350  mf->Layout();
351  mf->MapSubwindows();
352  mf->MapWindow();
353 
354  browser->StopEmbedding("EventCtrl");
355 }
TGLabel * m_StepLabel
Definition: EveService.h:99
TGTextButton * m_ContinueButton
Definition: EveService.h:97
double f[11][100]
TGTextButton * m_StepButton
Definition: EveService.h:98
void EveService::display ( const std::string &  info = "")

Definition at line 250 of file EveService.cc.

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

Referenced by DummyEvelyser::analyze().

251 {
252  // Display whatever was registered so far, wait until user presses
253  // the "Step" button.
254 
255  if (m_AllowStep)
256  {
257  m_ContinueButton->SetEnabled(kTRUE);
258  m_StepButton->SetEnabled(kTRUE);
259  m_StepLabel->SetText(info.c_str());
260  gEve->Redraw3D();
261  m_Rint->Run(kTRUE);
262  }
263 }
static const TGPicture * info(bool iBackgroundIsBlack)
TGLabel * m_StepLabel
Definition: EveService.h:99
TGTextButton * m_ContinueButton
Definition: EveService.h:97
TGTextButton * m_StepButton
Definition: EveService.h:98
bool m_AllowStep
Definition: EveService.h:94
TRint * m_Rint
Definition: EveService.h:90
TEveMagField * EveService::getMagField ( )

Definition at line 275 of file EveService.cc.

References m_MagField.

276 {
277  return m_MagField;
278 }
TEveMagField * m_MagField
Definition: EveService.h:92
TEveManager * EveService::getManager ( )

Definition at line 269 of file EveService.cc.

References m_EveManager.

Referenced by DummyEvelyser::beginRun().

270 {
271  gEve = m_EveManager;
272  return m_EveManager;
273 }
TEveManager * m_EveManager
Definition: EveService.h:89
const EveService& EveService::operator= ( const EveService )
private
void EveService::postBeginJob ( )

Definition at line 178 of file EveService.cc.

Referenced by EveService().

179 {
180  printf("EveService::postBeginJob\n");
181 
182  // Show the GUI ...
183  gSystem->ProcessEvents();
184 }
void EveService::postEndJob ( )

Definition at line 186 of file EveService.cc.

Referenced by EveService().

187 {
188  printf("EveService::postEndJob\n");
189 
190  TEveManager::Terminate();
191 }
void EveService::postEvent ( edm::StreamContext const &  )

Definition at line 229 of file EveService.cc.

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

Referenced by EveService().

230 {
231  printf("EveService::postProcessEvent: Starting GUI loop.\n");
232 
233  m_StepButton->SetEnabled(kFALSE);
234  m_ContinueButton->SetEnabled(kFALSE);
235  m_StepLabel->SetText("");
236 
237  if (m_ShowEvent)
238  {
239  gEve->Redraw3D();
240  m_Rint->Run(kTRUE);
241  }
242  m_ShowEvent = true;
243  m_AllowStep = true;
244 
245  gEve->GetCurrentEvent()->DestroyElements();
246 }
TGLabel * m_StepLabel
Definition: EveService.h:99
TGTextButton * m_ContinueButton
Definition: EveService.h:97
TGTextButton * m_StepButton
Definition: EveService.h:98
bool m_ShowEvent
Definition: EveService.h:95
bool m_AllowStep
Definition: EveService.h:94
TRint * m_Rint
Definition: EveService.h:90
void EveService::postGlobalBeginRun ( edm::GlobalContext const &  )

Definition at line 195 of file EveService.cc.

References m_MagField.

Referenced by EveService().

196 {
197  float current = 18160.0f;
198  /*
199  try
200  {
201  edm::Handle<edm::ConditionsInRunBlock> runCond;
202  bool res = iRun.getByLabel("conditionsInEdm", runCond);
203  if (res && runCond.isValid())
204  {
205  printf("Got current from conds in edm %f\n", runCond->BAvgCurrent);
206  current = runCond->BAvgCurrent;
207  }
208  else
209  {
210  printf("Could not extract run-conditions get-result=%d, is-valid=%d\n", res, runCond.isValid());
211 
212  edm::ESHandle<RunInfo> sum;
213  iSetup.get<RunInfoRcd>().get(sum);
214 
215  current = sum->m_avg_current;
216  printf("Got current from RunInfoRcd %f\n", sum->m_avg_current);
217  }
218  }
219  catch (...)
220  {
221  }
222  */
223  printf("RunInfo not available \n");
224  static_cast<CmsEveMagField*>(m_MagField)->SetFieldByCurrent(current);
225 }
TEveMagField * m_MagField
Definition: EveService.h:92
void EveService::setupFieldForPropagator ( TEveTrackPropagator *  prop)

Definition at line 279 of file EveService.cc.

References m_MagField.

Referenced by DummyEvelyser::beginJob().

280 {
281  prop->SetMagFieldObj(m_MagField, kFALSE);
282 }
TEveMagField * m_MagField
Definition: EveService.h:92
void EveService::slotContinue ( )

Definition at line 378 of file EveService.cc.

References m_AllowStep.

379 {
380  gSystem->ExitLoop();
381  m_AllowStep = false;
382 }
bool m_AllowStep
Definition: EveService.h:94
void EveService::slotExit ( )

Definition at line 357 of file EveService.cc.

358 {
359  gSystem->ExitLoop();
360  printf("EveService exiting on user request.\n");
361 
362  // Throwing exception here is bad because:
363  // a) it does not work when in a "debug step";
364  // b) does not restore terminal state.
365  // So we do exit instead for now.
366  // throw cms::Exception("UserTerminationRequest");
367 
368  gSystem->Exit(0);
369 }
void EveService::slotNextEvent ( )

Definition at line 371 of file EveService.cc.

References m_AllowStep, and m_ShowEvent.

372 {
373  gSystem->ExitLoop();
374  m_ShowEvent = false;
375  m_AllowStep = false;
376 }
bool m_ShowEvent
Definition: EveService.h:95
bool m_AllowStep
Definition: EveService.h:94
void EveService::slotStep ( )

Definition at line 384 of file EveService.cc.

385 {
386  gSystem->ExitLoop();
387 }

Member Data Documentation

bool EveService::m_AllowStep
private

Definition at line 94 of file EveService.h.

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

TGTextButton* EveService::m_ContinueButton
private

Definition at line 97 of file EveService.h.

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

TEveManager* EveService::m_EveManager
private

Definition at line 89 of file EveService.h.

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

TEveMagField* EveService::m_MagField
private
TRint* EveService::m_Rint
private

Definition at line 90 of file EveService.h.

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

bool EveService::m_ShowEvent
private

Definition at line 95 of file EveService.h.

Referenced by postEvent(), and slotNextEvent().

TGTextButton* EveService::m_StepButton
private

Definition at line 98 of file EveService.h.

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

TGLabel* EveService::m_StepLabel
private

Definition at line 99 of file EveService.h.

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