#include <InitRootHandlers.h>
Public Member Functions | |
InitRootHandlers (ParameterSet const &pset) | |
virtual | ~InitRootHandlers () |
Static Public Member Functions | |
static void | fillDescriptions (ConfigurationDescriptions &descriptions) |
Private Member Functions | |
virtual void | disableErrorHandler_ () |
virtual void | enableErrorHandler_ () |
virtual void | enableErrorHandlerWithoutWarnings_ () |
Private Attributes | |
bool | autoLibraryLoader_ |
bool | resetErrHandler_ |
bool | unloadSigHandler_ |
Definition at line 11 of file InitRootHandlers.h.
edm::service::InitRootHandlers::InitRootHandlers | ( | ParameterSet const & | pset | ) | [explicit] |
Definition at line 187 of file InitRootHandlers.cc.
References autoLibraryLoader_, edm::RootAutoLibraryLoader::enable(), reco::get(), edm::ParameterSet::getUntrackedParameter(), edm::installCustomHandler(), resetErrHandler_, edm::setRefCoreStreamer(), edm::setStreamedProductStreamer(), and unloadSigHandler_.
: RootHandlers(), unloadSigHandler_(pset.getUntrackedParameter<bool> ("UnloadRootSigHandler")), resetErrHandler_(pset.getUntrackedParameter<bool> ("ResetRootErrHandler")), autoLibraryLoader_(pset.getUntrackedParameter<bool> ("AutoLibraryLoader")) { if(unloadSigHandler_) { // Deactivate all the Root signal handlers and restore the system defaults gSystem->ResetSignal(kSigChild); gSystem->ResetSignal(kSigBus); gSystem->ResetSignal(kSigSegmentationViolation); gSystem->ResetSignal(kSigIllegalInstruction); gSystem->ResetSignal(kSigSystem); gSystem->ResetSignal(kSigPipe); gSystem->ResetSignal(kSigAlarm); gSystem->ResetSignal(kSigUrgent); gSystem->ResetSignal(kSigFloatingException); gSystem->ResetSignal(kSigWindowChanged); } else if(pset.getUntrackedParameter<bool>("AbortOnSignal")){ //NOTE: ROOT can also be told to abort on these kinds of problems BUT // it requires an TApplication to be instantiated which causes problems gSystem->ResetSignal(kSigBus); gSystem->ResetSignal(kSigSegmentationViolation); gSystem->ResetSignal(kSigIllegalInstruction); installCustomHandler(SIGBUS,sig_dostack_then_abort); installCustomHandler(SIGSEGV,sig_dostack_then_abort); installCustomHandler(SIGILL,sig_dostack_then_abort); } if(resetErrHandler_) { // Replace the Root error handler with one that uses the MessageLogger SetErrorHandler(RootErrorHandler); } // Enable automatic Root library loading. if(autoLibraryLoader_) { RootAutoLibraryLoader::enable(); } // Enable Cintex. ROOT::Cintex::Cintex::Enable(); // Set ROOT parameters. TTree::SetMaxTreeSize(kMaxLong64); TH1::AddDirectory(kFALSE); G__SetCatchException(0); // Set custom streamers setRefCoreStreamer(); setStreamedProductStreamer(); // Load the library containing dictionaries for std:: classes (e.g. std::vector<int>) if (ROOT::Reflex::Type()== Reflex::Type::ByName("std::vector<std::vector<unsigned int> >")) { edmplugin::PluginCapabilities::get()->load("LCGReflex/std::vector<std::vector<unsigned int> >"); } }
edm::service::InitRootHandlers::~InitRootHandlers | ( | ) | [virtual] |
Definition at line 245 of file InitRootHandlers.cc.
References f.
{ // close all open ROOT files // We get a new iterator each time, // because closing a file can invalidate the iterator while(gROOT->GetListOfFiles()->GetSize()) { TIter iter(gROOT->GetListOfFiles()); TFile* f = dynamic_cast<TFile*>(iter.Next()); if(f) f->Close(); } }
void edm::service::InitRootHandlers::disableErrorHandler_ | ( | ) | [private, virtual] |
Implements edm::RootHandlers.
Definition at line 271 of file InitRootHandlers.cc.
{ SetErrorHandler(DefaultErrorHandler); }
void edm::service::InitRootHandlers::enableErrorHandler_ | ( | ) | [private, virtual] |
Implements edm::RootHandlers.
Definition at line 276 of file InitRootHandlers.cc.
{ SetErrorHandler(RootErrorHandler); }
void edm::service::InitRootHandlers::enableErrorHandlerWithoutWarnings_ | ( | ) | [private, virtual] |
Implements edm::RootHandlers.
Definition at line 281 of file InitRootHandlers.cc.
{ SetErrorHandler(RootErrorHandlerWithoutWarnings); }
void edm::service::InitRootHandlers::fillDescriptions | ( | ConfigurationDescriptions & | descriptions | ) | [static] |
Definition at line 256 of file InitRootHandlers.cc.
References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and edm::ParameterSetDescription::setComment().
{ ParameterSetDescription desc; desc.setComment("Centralized interface to ROOT."); desc.addUntracked<bool>("UnloadRootSigHandler", false) ->setComment("If True, signals are handled by this service, rather than by ROOT."); desc.addUntracked<bool>("ResetRootErrHandler", true) ->setComment("If True, ROOT messages (e.g. errors, warnings) are handled by this service, rather than by ROOT."); desc.addUntracked<bool>("AutoLibraryLoader", true) ->setComment("If True, enables automatic loading of data dictionaries."); desc.addUntracked<bool>("AbortOnSignal",true) ->setComment("If True, do an abort when a signal occurs that causes a crash. If False, ROOT will do an exit which attempts to do a clean shutdown."); descriptions.add("InitRootHandlers", desc); }
bool edm::service::InitRootHandlers::autoLibraryLoader_ [private] |
Definition at line 25 of file InitRootHandlers.h.
Referenced by InitRootHandlers().
bool edm::service::InitRootHandlers::resetErrHandler_ [private] |
Definition at line 24 of file InitRootHandlers.h.
Referenced by InitRootHandlers().
bool edm::service::InitRootHandlers::unloadSigHandler_ [private] |
Definition at line 23 of file InitRootHandlers.h.
Referenced by InitRootHandlers().