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 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:218
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:310
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:41
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 277 of file EveService.cc.

References m_EveManager.

Referenced by DummyEvelyser::analyze().

278 {
279  m_EveManager->AddElement(el);
280 }
TEveManager * m_EveManager
Definition: EveService.h:88
void EveService::AddGlobalElement ( TEveElement *  el)

Definition at line 282 of file EveService.cc.

References m_EveManager.

Referenced by DummyEvelyser::beginRun().

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

Definition at line 310 of file EveService.cc.

References f, m_ContinueButton, m_StepButton, and m_StepLabel.

Referenced by EveService().

311 {
312  const TString cls("EveService");
313 
314  TEveBrowser *browser = gEve->GetBrowser();
315  browser->StartEmbedding(TRootBrowser::kBottom);
316 
317  TGMainFrame *mf = new TGMainFrame(gClient->GetRoot(), 400, 100, kVerticalFrame);
318 
319  TGHorizontalFrame* f = new TGHorizontalFrame(mf);
320  mf->AddFrame(f, new TGLayoutHints(kLHintsExpandX, 0,0,2,2));
321 
322  MkTxtButton(f, "Exit", 100, 2, 2)->
323  Connect("Clicked()", cls, this, "slotExit()");
324 
325  MkTxtButton(f, "Next Event", 100, 2, 2)->
326  Connect("Clicked()", cls, this, "slotNextEvent()");
327 
328  m_ContinueButton = MkTxtButton(f, "Continue", 100, 2, 2);
329  m_ContinueButton->Connect("Clicked()", cls, this, "slotContinue()");
330 
331  m_StepButton = MkTxtButton(f, "Step", 100, 2, 2);
332  m_StepButton->Connect("Clicked()", cls, this, "slotStep()");
333 
334  m_StepLabel = new TGLabel(mf, "");
335  m_StepLabel->SetTextJustify(kTextTop | kTextLeft);
336  mf->AddFrame(m_StepLabel, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
337 
338  mf->SetCleanup(kDeepCleanup);
339  mf->Layout();
340  mf->MapSubwindows();
341  mf->MapWindow();
342 
343  browser->StopEmbedding("EventCtrl");
344 }
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 239 of file EveService.cc.

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

Referenced by DummyEvelyser::analyze().

240 {
241  // Display whatever was registered so far, wait until user presses
242  // the "Step" button.
243 
244  if (m_AllowStep)
245  {
246  m_ContinueButton->SetEnabled(kTRUE);
247  m_StepButton->SetEnabled(kTRUE);
248  m_StepLabel->SetText(info.c_str());
249  gEve->Redraw3D();
250  m_Rint->Run(kTRUE);
251  }
252 }
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 264 of file EveService.cc.

References m_MagField.

265 {
266  return m_MagField;
267 }
TEveMagField * m_MagField
Definition: EveService.h:91
TEveManager * EveService::getManager ( )

Definition at line 258 of file EveService.cc.

References m_EveManager.

Referenced by DummyEvelyser::beginRun().

259 {
260  gEve = m_EveManager;
261  return m_EveManager;
262 }
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::getByType(), edm::HandleBase::isValid(), and m_MagField.

Referenced by EveService().

191 {
192  float current = 18160.0f;
193 
195  bool res = iRun.getByType(runCond);
196  //bool res = run.getByLabel("conditionsInEdm", runCond, "", "");
197  if (res && runCond.isValid())
198  {
199  printf("Got current from conds in edm %f\n", runCond->BAvgCurrent);
200  current = runCond->BAvgCurrent;
201  }
202  else
203  {
204  printf("Could not extract run-conditions get-result=%d, is-valid=%d\n", res, runCond.isValid());
205 
207  iSetup.get<RunInfoRcd>().get(sum);
208 
209  current = sum->m_avg_current;
210  printf("Got current from RunInfoRcd %f\n", sum->m_avg_current);
211  }
212 
213  static_cast<CmsEveMagField*>(m_MagField)->SetFieldByCurrent(current);
214 }
bool isValid() const
Definition: HandleBase.h:76
bool getByType(Handle< PROD > &result) const
Definition: Run.h:202
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 218 of file EveService.cc.

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

Referenced by EveService().

219 {
220  printf("EveService::postProcessEvent: Starting GUI loop.\n");
221 
222  m_StepButton->SetEnabled(kFALSE);
223  m_ContinueButton->SetEnabled(kFALSE);
224  m_StepLabel->SetText("");
225 
226  if (m_ShowEvent)
227  {
228  gEve->Redraw3D();
229  m_Rint->Run(kTRUE);
230  }
231  m_ShowEvent = true;
232  m_AllowStep = true;
233 
234  gEve->GetCurrentEvent()->DestroyElements();
235 }
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 268 of file EveService.cc.

References m_MagField.

Referenced by DummyEvelyser::beginJob().

269 {
270  prop->SetMagFieldObj(m_MagField, kFALSE);
271 }
TEveMagField * m_MagField
Definition: EveService.h:91
void EveService::slotContinue ( )

Definition at line 367 of file EveService.cc.

References m_AllowStep.

368 {
369  gSystem->ExitLoop();
370  m_AllowStep = false;
371 }
bool m_AllowStep
Definition: EveService.h:93
void EveService::slotExit ( )

Definition at line 346 of file EveService.cc.

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

Definition at line 360 of file EveService.cc.

References m_AllowStep, and m_ShowEvent.

361 {
362  gSystem->ExitLoop();
363  m_ShowEvent = false;
364  m_AllowStep = false;
365 }
bool m_ShowEvent
Definition: EveService.h:94
bool m_AllowStep
Definition: EveService.h:93
void EveService::slotStep ( )

Definition at line 373 of file EveService.cc.

374 {
375  gSystem->ExitLoop();
376 }

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