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 126 of file EveService.cc.

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

126  :
127  m_EveManager(0), m_Rint(0),
128  m_MagField(0),
129  m_AllowStep(true), m_ShowEvent(true),
131 {
132  printf("EveService::EveService CTOR\n");
133 
134  std::cout <<" gApplication "<< gApplication <<std::endl;
135  std::cout <<" is batch " << gROOT->IsBatch() <<std::endl;
136  std::cout <<" display " << gSystem->Getenv("DISPLAY") <<std::endl;
137 
138  const char* dummyArgvArray[] = {"cmsRun"};
139  char** dummyArgv = const_cast<char**>(dummyArgvArray);
140  int dummyArgc = 1;
141 
142  m_Rint = new TRint("App", &dummyArgc, dummyArgv);
143  assert(TApplication::GetApplications()->GetSize());
144 
145  gROOT->SetBatch(kFALSE);
146  std::cout<<"calling NeedGraphicsLibs()"<<std::endl;
147  TApplication::NeedGraphicsLibs();
148 
149 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,34,18)
150  // AMT workaround for an agressive clenup in 5.43.18
151  if (!gStyle) {
152  TColor::fgInitDone=false;
153  TColor::InitializeColors();
154  TStyle::BuildStyles();
155  gROOT->SetStyle(gEnv->GetValue("Canvas.Style", "Modern"));
156  gStyle = gROOT->GetStyle("Classic");
157  }
158 #endif
159  m_EveManager = TEveManager::Create();
160 
161  m_EveManager->AddEvent(new TEveEventManager("Event", "Event Data"));
162 
163  m_MagField = new CmsEveMagField();
164 
166 
167  // ----------------------------------------------------------------
168 
171 
173 
175 }
void postEvent(edm::StreamContext const &)
Definition: EveService.cc:240
void postBeginJob()
Definition: EveService.cc:189
TGLabel * m_StepLabel
Definition: EveService.h:99
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void watchPostEvent(PostEvent::slot_type const &iSlot)
void postEndJob()
Definition: EveService.cc:197
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:206
TEveManager * m_EveManager
Definition: EveService.h:89
void createEventNavigationGUI()
Definition: EveService.cc:332
bool m_AllowStep
Definition: EveService.h:94
tuple cout
Definition: gather_cfg.py:121
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 177 of file EveService.cc.

References m_MagField.

178 {
179  printf("EveService::~EveService DTOR\n");
180 
181  delete m_MagField;
182 }
TEveMagField * m_MagField
Definition: EveService.h:92
EveService::EveService ( const EveService )
private

Member Function Documentation

void EveService::AddElement ( TEveElement *  el)

Definition at line 299 of file EveService.cc.

References m_EveManager.

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

300 {
301  m_EveManager->AddElement(el);
302 }
TEveManager * m_EveManager
Definition: EveService.h:89
void EveService::AddGlobalElement ( TEveElement *  el)

Definition at line 304 of file EveService.cc.

References m_EveManager.

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

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

Definition at line 332 of file EveService.cc.

References f, m_ContinueButton, m_StepButton, and m_StepLabel.

Referenced by EveService().

333 {
334  const TString cls("EveService");
335 
336  TEveBrowser *browser = gEve->GetBrowser();
337  browser->StartEmbedding(TRootBrowser::kBottom);
338 
339  TGMainFrame *mf = new TGMainFrame(gClient->GetRoot(), 400, 100, kVerticalFrame);
340 
341  TGHorizontalFrame* f = new TGHorizontalFrame(mf);
342  mf->AddFrame(f, new TGLayoutHints(kLHintsExpandX, 0,0,2,2));
343 
344  MkTxtButton(f, "Exit", 100, 2, 2)->
345  Connect("Clicked()", cls, this, "slotExit()");
346 
347  MkTxtButton(f, "Next Event", 100, 2, 2)->
348  Connect("Clicked()", cls, this, "slotNextEvent()");
349 
350  m_ContinueButton = MkTxtButton(f, "Continue", 100, 2, 2);
351  m_ContinueButton->Connect("Clicked()", cls, this, "slotContinue()");
352 
353  m_StepButton = MkTxtButton(f, "Step", 100, 2, 2);
354  m_StepButton->Connect("Clicked()", cls, this, "slotStep()");
355 
356  m_StepLabel = new TGLabel(mf, "");
357  m_StepLabel->SetTextJustify(kTextTop | kTextLeft);
358  mf->AddFrame(m_StepLabel, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
359 
360  mf->SetCleanup(kDeepCleanup);
361  mf->Layout();
362  mf->MapSubwindows();
363  mf->MapWindow();
364 
365  browser->StopEmbedding("EventCtrl");
366 }
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 261 of file EveService.cc.

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

Referenced by DummyEvelyser::analyze().

262 {
263  // Display whatever was registered so far, wait until user presses
264  // the "Step" button.
265 
266  if (m_AllowStep)
267  {
268  m_ContinueButton->SetEnabled(kTRUE);
269  m_StepButton->SetEnabled(kTRUE);
270  m_StepLabel->SetText(info.c_str());
271  gEve->Redraw3D();
272  m_Rint->Run(kTRUE);
273  }
274 }
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 286 of file EveService.cc.

References m_MagField.

287 {
288  return m_MagField;
289 }
TEveMagField * m_MagField
Definition: EveService.h:92
TEveManager * EveService::getManager ( )

Definition at line 280 of file EveService.cc.

References m_EveManager.

Referenced by DummyEvelyser::beginRun().

281 {
282  gEve = m_EveManager;
283  return m_EveManager;
284 }
TEveManager * m_EveManager
Definition: EveService.h:89
const EveService& EveService::operator= ( const EveService )
private
void EveService::postBeginJob ( )

Definition at line 189 of file EveService.cc.

Referenced by EveService().

190 {
191  printf("EveService::postBeginJob\n");
192 
193  // Show the GUI ...
194  gSystem->ProcessEvents();
195 }
void EveService::postEndJob ( )

Definition at line 197 of file EveService.cc.

Referenced by EveService().

198 {
199  printf("EveService::postEndJob\n");
200 
201  TEveManager::Terminate();
202 }
void EveService::postEvent ( edm::StreamContext const &  )

Definition at line 240 of file EveService.cc.

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

Referenced by EveService().

241 {
242  printf("EveService::postProcessEvent: Starting GUI loop.\n");
243 
244  m_StepButton->SetEnabled(kFALSE);
245  m_ContinueButton->SetEnabled(kFALSE);
246  m_StepLabel->SetText("");
247 
248  if (m_ShowEvent)
249  {
250  gEve->Redraw3D();
251  m_Rint->Run(kTRUE);
252  }
253  m_ShowEvent = true;
254  m_AllowStep = true;
255 
256  gEve->GetCurrentEvent()->DestroyElements();
257 }
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 206 of file EveService.cc.

References cond::rpcobimon::current, and m_MagField.

Referenced by EveService().

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

Definition at line 290 of file EveService.cc.

References m_MagField.

Referenced by DummyEvelyser::beginJob().

291 {
292  prop->SetMagFieldObj(m_MagField, kFALSE);
293 }
TEveMagField * m_MagField
Definition: EveService.h:92
void EveService::slotContinue ( )

Definition at line 389 of file EveService.cc.

References m_AllowStep.

390 {
391  gSystem->ExitLoop();
392  m_AllowStep = false;
393 }
bool m_AllowStep
Definition: EveService.h:94
void EveService::slotExit ( )

Definition at line 368 of file EveService.cc.

369 {
370  gSystem->ExitLoop();
371  printf("EveService exiting on user request.\n");
372 
373  // Throwing exception here is bad because:
374  // a) it does not work when in a "debug step";
375  // b) does not restore terminal state.
376  // So we do exit instead for now.
377  // throw cms::Exception("UserTerminationRequest");
378 
379  gSystem->Exit(0);
380 }
void EveService::slotNextEvent ( )

Definition at line 382 of file EveService.cc.

References m_AllowStep, and m_ShowEvent.

383 {
384  gSystem->ExitLoop();
385  m_ShowEvent = false;
386  m_AllowStep = false;
387 }
bool m_ShowEvent
Definition: EveService.h:95
bool m_AllowStep
Definition: EveService.h:94
void EveService::slotStep ( )

Definition at line 395 of file EveService.cc.

396 {
397  gSystem->ExitLoop();
398 }

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