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/Eve/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 postBeginRun (const edm::Run &, const edm::EventSetup &)
 
void postEndJob ()
 
void postProcessEvent (const edm::Event &, const edm::EventSetup &)
 
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::EveService ( const edm::ParameterSet ,
edm::ActivityRegistry ar 
)

Definition at line 120 of file EveService.cc.

References gather_cfg::cout, createEventNavigationGUI(), m_EveManager, m_MagField, m_Rint, postBeginJob(), postBeginRun(), postEndJob(), postProcessEvent(), edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostBeginRun(), edm::ActivityRegistry::watchPostEndJob(), and edm::ActivityRegistry::watchPostProcessEvent().

120  :
121  m_EveManager(0), m_Rint(0),
122  m_MagField(0),
123  m_AllowStep(true), m_ShowEvent(true),
125 {
126  printf("EveService::EveService CTOR\n");
127 
128  std::cout <<" gApplication "<< gApplication <<std::endl;
129  std::cout <<" is batch " << gROOT->IsBatch() <<std::endl;
130  std::cout <<" display " << gSystem->Getenv("DISPLAY") <<std::endl;
131 
132  const char* dummyArgvArray[] = {"cmsRun"};
133  char** dummyArgv = const_cast<char**>(dummyArgvArray);
134  int dummyArgc = 1;
135 
136  m_Rint = new TRint("App", &dummyArgc, dummyArgv);
137  assert(TApplication::GetApplications()->GetSize());
138 
139  gROOT->SetBatch(kFALSE);
140  std::cout<<"calling NeedGraphicsLibs()"<<std::endl;
141  TApplication::NeedGraphicsLibs();
142 
143  m_EveManager = TEveManager::Create();
144 
145  m_EveManager->AddEvent(new TEveEventManager("Event", "Event Data"));
146 
147  m_MagField = new CmsEveMagField();
148 
150 
151  // ----------------------------------------------------------------
152 
155 
157 
159 }
void watchPostBeginRun(PostBeginRun::slot_type const &iSlot)
void postBeginJob()
Definition: EveService.cc:173
TGLabel * m_StepLabel
Definition: EveService.h:98
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void postProcessEvent(const edm::Event &, const edm::EventSetup &)
Definition: EveService.cc:223
void postEndJob()
Definition: EveService.cc:181
TGTextButton * m_ContinueButton
Definition: EveService.h:96
void watchPostProcessEvent(PostProcessEvent::slot_type const &iSlot)
TGTextButton * m_StepButton
Definition: EveService.h:97
bool m_ShowEvent
Definition: EveService.h:94
TEveManager * m_EveManager
Definition: EveService.h:88
void createEventNavigationGUI()
Definition: EveService.cc:315
bool m_AllowStep
Definition: EveService.h:93
void postBeginRun(const edm::Run &, const edm::EventSetup &)
Definition: EveService.cc:190
tuple cout
Definition: gather_cfg.py:121
TEveMagField * m_MagField
Definition: EveService.h:91
TRint * m_Rint
Definition: EveService.h:89
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
EveService::~EveService ( )
virtual

Definition at line 161 of file EveService.cc.

References m_MagField.

162 {
163  printf("EveService::~EveService DTOR\n");
164 
165  delete m_MagField;
166 }
TEveMagField * m_MagField
Definition: EveService.h:91
EveService::EveService ( const EveService )
private

Member Function Documentation

void EveService::AddElement ( TEveElement *  el)

Definition at line 282 of file EveService.cc.

References m_EveManager.

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

283 {
284  m_EveManager->AddElement(el);
285 }
TEveManager * m_EveManager
Definition: EveService.h:88
void EveService::AddGlobalElement ( TEveElement *  el)

Definition at line 287 of file EveService.cc.

References m_EveManager.

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

288 {
289  m_EveManager->AddGlobalElement(el);
290 }
TEveManager * m_EveManager
Definition: EveService.h:88
EveService::ClassDef ( EveService  ,
 
)
private
void EveService::createEventNavigationGUI ( )
protected

Definition at line 315 of file EveService.cc.

References f, m_ContinueButton, m_StepButton, and m_StepLabel.

Referenced by EveService().

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

Definition at line 244 of file EveService.cc.

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

Referenced by DummyEvelyser::analyze().

245 {
246  // Display whatever was registered so far, wait until user presses
247  // the "Step" button.
248 
249  if (m_AllowStep)
250  {
251  m_ContinueButton->SetEnabled(kTRUE);
252  m_StepButton->SetEnabled(kTRUE);
253  m_StepLabel->SetText(info.c_str());
254  gEve->Redraw3D();
255  m_Rint->Run(kTRUE);
256  }
257 }
TGLabel * m_StepLabel
Definition: EveService.h:98
TGTextButton * m_ContinueButton
Definition: EveService.h:96
TGTextButton * m_StepButton
Definition: EveService.h:97
bool m_AllowStep
Definition: EveService.h:93
TRint * m_Rint
Definition: EveService.h:89
TEveMagField * EveService::getMagField ( )

Definition at line 269 of file EveService.cc.

References m_MagField.

270 {
271  return m_MagField;
272 }
TEveMagField * m_MagField
Definition: EveService.h:91
TEveManager * EveService::getManager ( )

Definition at line 263 of file EveService.cc.

References m_EveManager.

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

264 {
265  gEve = m_EveManager;
266  return m_EveManager;
267 }
TEveManager * m_EveManager
Definition: EveService.h:88
const EveService& EveService::operator= ( const EveService )
private
void EveService::postBeginJob ( )

Definition at line 173 of file EveService.cc.

Referenced by EveService().

174 {
175  printf("EveService::postBeginJob\n");
176 
177  // Show the GUI ...
178  gSystem->ProcessEvents();
179 }
void EveService::postBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 190 of file EveService.cc.

References cond::rpcobimon::current, edm::EventSetup::get(), edm::Run::getByLabel(), edm::HandleBase::isValid(), and m_MagField.

Referenced by EveService().

191 {
192  float current = 18160.0f;
193 
194  try
195  {
197  bool res = iRun.getByLabel("conditionsInEdm", runCond);
198  if (res && runCond.isValid())
199  {
200  printf("Got current from conds in edm %f\n", runCond->BAvgCurrent);
201  current = runCond->BAvgCurrent;
202  }
203  else
204  {
205  printf("Could not extract run-conditions get-result=%d, is-valid=%d\n", res, runCond.isValid());
206 
208  iSetup.get<RunInfoRcd>().get(sum);
209 
210  current = sum->m_avg_current;
211  printf("Got current from RunInfoRcd %f\n", sum->m_avg_current);
212  }
213  }
214  catch (...)
215  {
216  printf("RunInfo not available \n");
217  }
218  static_cast<CmsEveMagField*>(m_MagField)->SetFieldByCurrent(current);
219 }
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:177
bool isValid() const
Definition: HandleBase.h:76
const T & get() const
Definition: EventSetup.h:55
TEveMagField * m_MagField
Definition: EveService.h:91
void EveService::postEndJob ( )

Definition at line 181 of file EveService.cc.

Referenced by EveService().

182 {
183  printf("EveService::postEndJob\n");
184 
185  TEveManager::Terminate();
186 }
void EveService::postProcessEvent ( const edm::Event ,
const edm::EventSetup  
)

Definition at line 223 of file EveService.cc.

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

Referenced by EveService().

224 {
225  printf("EveService::postProcessEvent: Starting GUI loop.\n");
226 
227  m_StepButton->SetEnabled(kFALSE);
228  m_ContinueButton->SetEnabled(kFALSE);
229  m_StepLabel->SetText("");
230 
231  if (m_ShowEvent)
232  {
233  gEve->Redraw3D();
234  m_Rint->Run(kTRUE);
235  }
236  m_ShowEvent = true;
237  m_AllowStep = true;
238 
239  gEve->GetCurrentEvent()->DestroyElements();
240 }
TGLabel * m_StepLabel
Definition: EveService.h:98
TGTextButton * m_ContinueButton
Definition: EveService.h:96
TGTextButton * m_StepButton
Definition: EveService.h:97
bool m_ShowEvent
Definition: EveService.h:94
bool m_AllowStep
Definition: EveService.h:93
TRint * m_Rint
Definition: EveService.h:89
void EveService::setupFieldForPropagator ( TEveTrackPropagator *  prop)

Definition at line 273 of file EveService.cc.

References m_MagField.

Referenced by DummyEvelyser::beginJob().

274 {
275  prop->SetMagFieldObj(m_MagField, kFALSE);
276 }
TEveMagField * m_MagField
Definition: EveService.h:91
void EveService::slotContinue ( )

Definition at line 372 of file EveService.cc.

References m_AllowStep.

373 {
374  gSystem->ExitLoop();
375  m_AllowStep = false;
376 }
bool m_AllowStep
Definition: EveService.h:93
void EveService::slotExit ( )

Definition at line 351 of file EveService.cc.

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

Definition at line 365 of file EveService.cc.

References m_AllowStep, and m_ShowEvent.

366 {
367  gSystem->ExitLoop();
368  m_ShowEvent = false;
369  m_AllowStep = false;
370 }
bool m_ShowEvent
Definition: EveService.h:94
bool m_AllowStep
Definition: EveService.h:93
void EveService::slotStep ( )

Definition at line 378 of file EveService.cc.

379 {
380  gSystem->ExitLoop();
381 }

Member Data Documentation

bool EveService::m_AllowStep
private

Definition at line 93 of file EveService.h.

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

TGTextButton* EveService::m_ContinueButton
private

Definition at line 96 of file EveService.h.

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

TEveManager* EveService::m_EveManager
private

Definition at line 88 of file EveService.h.

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

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

Definition at line 89 of file EveService.h.

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

bool EveService::m_ShowEvent
private

Definition at line 94 of file EveService.h.

Referenced by postProcessEvent(), and slotNextEvent().

TGTextButton* EveService::m_StepButton
private

Definition at line 97 of file EveService.h.

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

TGLabel* EveService::m_StepLabel
private

Definition at line 98 of file EveService.h.

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