CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::service::InitRootHandlers Class Reference

#include <InitRootHandlers.h>

Inheritance diagram for edm::service::InitRootHandlers:
edm::RootHandlers

Public Member Functions

 InitRootHandlers (ParameterSet const &pset)
 
virtual ~InitRootHandlers ()
 
- Public Member Functions inherited from edm::RootHandlers
void disableErrorHandler ()
 
void enableErrorHandler ()
 
 RootHandlers ()
 
virtual ~RootHandlers ()
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void disableErrorHandler_ ()
 
virtual void enableErrorHandler_ ()
 

Private Attributes

bool autoLibraryLoader_
 
bool resetErrHandler_
 
bool unloadSigHandler_
 

Detailed Description

Definition at line 11 of file InitRootHandlers.h.

Constructor & Destructor Documentation

edm::service::InitRootHandlers::InitRootHandlers ( ParameterSet const &  pset)
explicit

Definition at line 146 of file InitRootHandlers.cc.

References autoLibraryLoader_, edm::RootAutoLibraryLoader::enable(), edmplugin::PluginCapabilities::get(), edmplugin::PluginCapabilities::load(), resetErrHandler_, edm::setCacheStreamers(), edm::setRefCoreStreamer(), edm::setTransientStreamers(), and unloadSigHandler_.

147  : RootHandlers(),
148  unloadSigHandler_(pset.getUntrackedParameter<bool> ("UnloadRootSigHandler")),
149  resetErrHandler_(pset.getUntrackedParameter<bool> ("ResetRootErrHandler")),
150  autoLibraryLoader_(pset.getUntrackedParameter<bool> ("AutoLibraryLoader")) {
151 
152  if(unloadSigHandler_) {
153  // Deactivate all the Root signal handlers and restore the system defaults
154  gSystem->ResetSignal(kSigChild);
155  gSystem->ResetSignal(kSigBus);
156  gSystem->ResetSignal(kSigSegmentationViolation);
157  gSystem->ResetSignal(kSigIllegalInstruction);
158  gSystem->ResetSignal(kSigSystem);
159  gSystem->ResetSignal(kSigPipe);
160  gSystem->ResetSignal(kSigAlarm);
161  gSystem->ResetSignal(kSigUrgent);
162  gSystem->ResetSignal(kSigFloatingException);
163  gSystem->ResetSignal(kSigWindowChanged);
164  }
165 
166  if(resetErrHandler_) {
167 
168  // Replace the Root error handler with one that uses the MessageLogger
169  SetErrorHandler(RootErrorHandler);
170  }
171 
172  // Enable automatic Root library loading.
173  if(autoLibraryLoader_) {
175  }
176 
177  // Enable Cintex.
178  ROOT::Cintex::Cintex::Enable();
179 
180  // Set ROOT parameters.
181  TTree::SetMaxTreeSize(kMaxLong64);
182  TH1::AddDirectory(kFALSE);
183  G__SetCatchException(0);
184 
185  // Set custom streamers
189 
190  // Load the library containing dictionaries for std:: classes (e.g. std::vector<int>)
191  if (ROOT::Reflex::Type()== Reflex::Type::ByName("std::vector<std::vector<unsigned int> >")) {
192  edmplugin::PluginCapabilities::get()->load("LCGReflex/std::vector<std::vector<unsigned int> >");
193  }
194  }
void setRefCoreStreamer(bool resetAll=false)
static PluginCapabilities * get()
tuple pset
Definition: CrabTask.py:85
void setTransientStreamers()
void setCacheStreamers()
void load(const std::string &iName)
static void enable()
interface for TClass generators
edm::service::InitRootHandlers::~InitRootHandlers ( )
virtual

Definition at line 196 of file InitRootHandlers.cc.

References f.

196  {
197  // close all open ROOT files
198  // We get a new iterator each time,
199  // because closing a file can invalidate the iterator
200  while(gROOT->GetListOfFiles()->GetSize()) {
201  TIter iter(gROOT->GetListOfFiles());
202  TFile* f = dynamic_cast<TFile*>(iter.Next());
203  if(f) f->Close();
204  }
205  }
double f[11][100]

Member Function Documentation

void edm::service::InitRootHandlers::disableErrorHandler_ ( )
privatevirtual

Implements edm::RootHandlers.

Definition at line 220 of file InitRootHandlers.cc.

220  {
221  SetErrorHandler(DefaultErrorHandler);
222  }
void edm::service::InitRootHandlers::enableErrorHandler_ ( )
privatevirtual

Implements edm::RootHandlers.

Definition at line 225 of file InitRootHandlers.cc.

225  {
226  SetErrorHandler(RootErrorHandler);
227  }
void edm::service::InitRootHandlers::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 207 of file InitRootHandlers.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and edm::ParameterSetDescription::setComment().

207  {
209  desc.setComment("Centralized interface to ROOT.");
210  desc.addUntracked<bool>("UnloadRootSigHandler", false)
211  ->setComment("If True, signals are handled by this service, rather than by ROOT.");
212  desc.addUntracked<bool>("ResetRootErrHandler", true)
213  ->setComment("If True, ROOT messages (e.g. errors, warnings) are handled by this service, rather than by ROOT.");
214  desc.addUntracked<bool>("AutoLibraryLoader", true)
215  ->setComment("If True, enables automatic loading of data dictionaries.");
216  descriptions.add("InitRootHandlers", desc);
217  }

Member Data Documentation

bool edm::service::InitRootHandlers::autoLibraryLoader_
private

Definition at line 24 of file InitRootHandlers.h.

Referenced by InitRootHandlers().

bool edm::service::InitRootHandlers::resetErrHandler_
private

Definition at line 23 of file InitRootHandlers.h.

Referenced by InitRootHandlers().

bool edm::service::InitRootHandlers::unloadSigHandler_
private

Definition at line 22 of file InitRootHandlers.h.

Referenced by InitRootHandlers().