Skip to content

Commit

Permalink
Merge pull request #4458 from alja/newServiceRegistry71
Browse files Browse the repository at this point in the history
fix cmsShowFF crash -- root 5.34.18 & new ServiRegistry interface
  • Loading branch information
davidlange6 committed Jul 3, 2014
2 parents 5fbb28c + 7532dc7 commit 71ff1a5
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 25 deletions.
8 changes: 5 additions & 3 deletions Fireworks/Eve/interface/EveService.h
Expand Up @@ -27,7 +27,9 @@ namespace edm
class ActivityRegistry;
class Run;
class Event;
class EventSetup;
class EventSetup;
class StreamContext;
class GlobalContext;
}

class TEveManager;
Expand All @@ -54,9 +56,9 @@ class EveService
void postBeginJob();
void postEndJob();

void postBeginRun(const edm::Run&, const edm::EventSetup&);
void postGlobalBeginRun(edm::GlobalContext const&);

void postProcessEvent(const edm::Event&, const edm::EventSetup&);
void postEvent(edm::StreamContext const&);

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

Expand Down
30 changes: 24 additions & 6 deletions Fireworks/Eve/src/EveService.cc
Expand Up @@ -19,6 +19,13 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"

#define private public
#include "TROOT.h"
#include "TSystem.h"
#include "TColor.h"
#include "TStyle.h"
#include "TEnv.h"

// To extract coil current from ConditionsDB
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
Expand Down Expand Up @@ -139,6 +146,16 @@ EveService::EveService(const edm::ParameterSet&, edm::ActivityRegistry& ar) :
std::cout<<"calling NeedGraphicsLibs()"<<std::endl;
TApplication::NeedGraphicsLibs();

#if ROOT_VERSION_CODE >= ROOT_VERSION(5,34,18)
// AMT workaround for an agressive clenup in 5.43.18
if (!gStyle) {
TColor::fgInitDone=false;
TColor::InitializeColors();
TStyle::BuildStyles();
gROOT->SetStyle(gEnv->GetValue("Canvas.Style", "Modern"));
gStyle = gROOT->GetStyle("Classic");
}
#endif
m_EveManager = TEveManager::Create();

m_EveManager->AddEvent(new TEveEventManager("Event", "Event Data"));
Expand All @@ -152,9 +169,9 @@ EveService::EveService(const edm::ParameterSet&, edm::ActivityRegistry& ar) :
ar.watchPostBeginJob(this, &EveService::postBeginJob);
ar.watchPostEndJob (this, &EveService::postEndJob);

ar.watchPostBeginRun(this, &EveService::postBeginRun);
ar.watchPostGlobalBeginRun(this, &EveService::postGlobalBeginRun);

ar.watchPostProcessEvent(this, &EveService::postProcessEvent);
ar.watchPostEvent(this, &EveService::postEvent);
}

EveService::~EveService()
Expand Down Expand Up @@ -186,10 +203,10 @@ void EveService::postEndJob()

//------------------------------------------------------------------------------

void EveService::postBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
void EveService::postGlobalBeginRun(edm::GlobalContext const&)
{
float current = 18160.0f;

/*
try
{
edm::Handle<edm::ConditionsInRunBlock> runCond;
Expand All @@ -212,14 +229,15 @@ void EveService::postBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetu
}
catch (...)
{
printf("RunInfo not available \n");
}
*/
printf("RunInfo not available \n");
static_cast<CmsEveMagField*>(m_MagField)->SetFieldByCurrent(current);
}

//------------------------------------------------------------------------------

void EveService::postProcessEvent(const edm::Event&, const edm::EventSetup&)
void EveService::postEvent(edm::StreamContext const&)
{
printf("EveService::postProcessEvent: Starting GUI loop.\n");

Expand Down
19 changes: 16 additions & 3 deletions Fireworks/FWInterface/src/FWFFHelper.cc
Expand Up @@ -2,9 +2,12 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"

#define private public
#include "TROOT.h"
#include "TSystem.h"
#define private public
#include "TColor.h"
#include "TStyle.h"
#include "TEnv.h"
#include "TRint.h"
#include "TEveManager.h"
#include "TEveEventManager.h"
Expand Down Expand Up @@ -61,7 +64,17 @@ FWFFHelper::FWFFHelper(const edm::ParameterSet &ps, const edm::ActivityRegistry
std::cerr <<"Insufficient GL support. " << iException.what() << std::endl;
throw;
}


TEveManager::Create(kFALSE, "FIV");
// AMT workaround for an agressive clenup in 5.43.18
#if ROOT_VERSION_CODE >= ROOT_VERSION(5,34,18)
if (!gStyle) {
TColor::fgInitDone=false;
TColor::InitializeColors();
TStyle::BuildStyles();
gROOT->SetStyle(gEnv->GetValue("Canvas.Style", "Modern"));
gStyle = gROOT->GetStyle("Classic");
}
#endif

TEveManager::Create(kFALSE, "FIV");
}
17 changes: 12 additions & 5 deletions Fireworks/FWInterface/src/FWFFLooper.cc
Expand Up @@ -47,6 +47,12 @@
#include "TGeoManager.h"


namespace edm
{
class StreamContext;
class ModuleCallingContext;
}

namespace
{
class CmsEveMagField : public TEveMagField
Expand Down Expand Up @@ -189,9 +195,8 @@ FWFFLooper::attachTo(edm::ActivityRegistry &ar)
{
m_pathsGUI = new FWPathsPopup(this, guiManager());

ar.watchPostProcessEvent(m_pathsGUI, &FWPathsPopup::postProcessEvent);
ar.watchPostModule(m_pathsGUI, &FWPathsPopup::postModule);
ar.watchPreModule(m_pathsGUI, &FWPathsPopup::preModule);
ar.watchPostModuleEvent(m_pathsGUI, &FWPathsPopup::postModuleEvent);
ar.watchPreModuleEvent(m_pathsGUI, &FWPathsPopup::preModuleEvent);
ar.watchPostEndJob(this, &FWFFLooper::postEndJob);
}

Expand Down Expand Up @@ -232,8 +237,8 @@ FWFFLooper::startingNewLoop(unsigned int count)
void
FWFFLooper::postEndJob()
{
// printf("FWFFLooper::postEndJob\n");
// TEveManager::Terminate();
printf("FWFFLooper::postEndJob\n");
TEveManager::Terminate();
}

void
Expand Down Expand Up @@ -387,6 +392,8 @@ FWFFLooper::duringLoop(const edm::Event &event,
} catch (...) {}


m_pathsGUI->postEvent(event);

m_isLastEvent = controller.forwardState() == edm::ProcessingController::kAtLastEvent;
m_isFirstEvent = controller.reverseState() == edm::ProcessingController::kAtFirstEvent;
// If the next event id is valid, set the transition so
Expand Down
13 changes: 8 additions & 5 deletions Fireworks/FWInterface/src/FWPathsPopup.cc
Expand Up @@ -22,6 +22,8 @@
#include "DataFormats/Provenance/interface/ProcessHistory.h"
#include "DataFormats/Common/interface/TriggerResults.h"

#include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h"
#include "FWCore/ServiceRegistry/interface/StreamContext.h"


#include "TGLabel.h"
Expand Down Expand Up @@ -85,6 +87,7 @@ FWPathsPopup::FWPathsPopup(FWFFLooper *looper, FWGUIManager *guiManager)
Layout();
}


/** Handle pressing of esc.
*/
Bool_t
Expand Down Expand Up @@ -162,23 +165,23 @@ FWPathsPopup::setup(const edm::ScheduleInfo *info)

/** Gets called by CMSSW as modules are about to be processed. **/
void
FWPathsPopup::postModule(edm::ModuleDescription const& description)
FWPathsPopup::postModuleEvent(edm::StreamContext const &s, edm::ModuleCallingContext const &mcc)
{
m_guiManager->updateStatus((description.moduleName() + " processed.").c_str());
m_guiManager->updateStatus((mcc.moduleDescription()->moduleName() + " processed.").c_str());
gSystem->ProcessEvents();
}

/** Gets called by CMSSW as we process modules. **/
void
FWPathsPopup::preModule(edm::ModuleDescription const& description)
FWPathsPopup::preModuleEvent(edm::StreamContext const &s, edm::ModuleCallingContext const &mcc)
{
m_guiManager->updateStatus(("Processing " + description.moduleName() + "...").c_str());
m_guiManager->updateStatus(("Processing " + mcc.moduleDescription()->moduleName() + "...").c_str());
gSystem->ProcessEvents();
}


void
FWPathsPopup::postProcessEvent(edm::Event const& event, edm::EventSetup const& eventSetup)
FWPathsPopup::postEvent(edm::Event const &event)
{
m_guiManager->updateStatus("Done processing.");
gSystem->ProcessEvents();
Expand Down
9 changes: 6 additions & 3 deletions Fireworks/FWInterface/src/FWPathsPopup.h
Expand Up @@ -10,6 +10,8 @@ namespace edm
class ModuleDescription;
class Event;
class EventSetup;
class StreamContext;
class ModuleCallingContext;
}

class FWFFLooper;
Expand All @@ -28,9 +30,9 @@ class FWPathsPopup : public TGMainFrame
public:
FWPathsPopup(FWFFLooper *, FWGUIManager *);

void postProcessEvent(edm::Event const&, edm::EventSetup const&);
void postModule(edm::ModuleDescription const&);
void preModule(edm::ModuleDescription const &);
void postEvent(edm::Event const &event);
void postModuleEvent(edm::StreamContext const&, edm::ModuleCallingContext const&);
void preModuleEvent(edm::StreamContext const&, edm::ModuleCallingContext const&);
void scheduleReloadEvent();
bool &hasChanges() { return m_hasChanges; }
void setup(const edm::ScheduleInfo *info);
Expand All @@ -57,6 +59,7 @@ class FWPathsPopup : public TGMainFrame
FWTableWidget *m_tableWidget;
TGTextEntry *m_search;
FWGUIManager *m_guiManager;


ClassDef(FWPathsPopup, 0);
};
Expand Down
18 changes: 18 additions & 0 deletions Fireworks/Geometry/plugins/EveDisplayPlugin.cc
Expand Up @@ -15,6 +15,12 @@
// Created: Wed Sep 26 08:27:23 EDT 2007
//
//
#define private public // workaround for bug in 5.34.18
#include "TROOT.h"
#include "TSystem.h"
#include "TColor.h"
#include "TStyle.h"
#include "TEnv.h"

// system include files
#include <memory>
Expand Down Expand Up @@ -92,6 +98,18 @@ EveDisplayPlugin::run(const edm::EventSetup& iSetup)
iSetup.get<DisplayGeomRecord>().get(geom);



// AMT workaround for an agressive clenup in 5.43.18
#if ROOT_VERSION_CODE >= ROOT_VERSION(5,34,18)
if (!gStyle) {
TColor::fgInitDone=false;
TColor::InitializeColors();
TStyle::BuildStyles();
gROOT->SetStyle(gEnv->GetValue("Canvas.Style", "Modern"));
gStyle = gROOT->GetStyle("Classic");
}
#endif

TEveManager::Create();

TEveGeoTopNode* trk = new TEveGeoTopNode(const_cast<TGeoManager*>(geom.product()),
Expand Down

0 comments on commit 71ff1a5

Please sign in to comment.