Skip to content

Commit

Permalink
Merge pull request #5630 from wmtan/UseTClassGetClass
Browse files Browse the repository at this point in the history
Use TClass::GetClass(), not gROOT->GetClass()
  • Loading branch information
nclopezo committed Oct 1, 2014
2 parents c311abc + c57b59b commit 4b47c79
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 23 deletions.
10 changes: 5 additions & 5 deletions DataFormats/Common/src/RefCoreStreamer.cc
Expand Up @@ -2,7 +2,7 @@
#include "DataFormats/Common/interface/RefCore.h"
#include "DataFormats/Common/interface/RefCoreWithIndex.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "TROOT.h"
#include "TClass.h"
#include <ostream>
#include <cassert>
#include <iostream>
Expand Down Expand Up @@ -76,13 +76,13 @@ namespace edm {

void setRefCoreStreamer(bool resetAll) {
{
TClass *cl = gROOT->GetClass("edm::RefCore");
TClass *cl = TClass::GetClass("edm::RefCore");
TClassStreamer *st = cl->GetStreamer();
if (st == 0) {
cl->AdoptStreamer(new RefCoreStreamer());
}
{
TClass *cl = gROOT->GetClass("edm::RefCoreWithIndex");
TClass *cl = TClass::GetClass("edm::RefCoreWithIndex");
TClassStreamer *st = cl->GetStreamer();
if (st == 0) {
cl->AdoptStreamer(new RefCoreWithIndexStreamer());
Expand All @@ -96,14 +96,14 @@ namespace edm {
EDProductGetter const* returnValue=0;
if (ep != 0) {
{
TClass *cl = gROOT->GetClass("edm::RefCore");
TClass *cl = TClass::GetClass("edm::RefCore");
TClassStreamer *st = cl->GetStreamer();
if (st == 0) {
cl->AdoptStreamer(new RefCoreStreamer());
}
}
{
TClass *cl = gROOT->GetClass("edm::RefCoreWithIndex");
TClass *cl = TClass::GetClass("edm::RefCoreWithIndex");
TClassStreamer *st = cl->GetStreamer();
if (st == 0) {
cl->AdoptStreamer(new RefCoreWithIndexStreamer());
Expand Down
6 changes: 3 additions & 3 deletions FWCore/FWLite/src/RefStreamer.cc
@@ -1,6 +1,6 @@
#include "DataFormats/Common/interface/RefCore.h"
#include "DataFormats/Common/interface/RefCoreStreamer.h"
#include "TROOT.h"
#include "TClass.h"
#include <cassert>
#include <ostream>

Expand All @@ -9,14 +9,14 @@ class TBuffer;
namespace fwlite {
edm::EDProductGetter const* setRefStreamer(edm::EDProductGetter const* ep) {
{
TClass* cl = gROOT->GetClass("edm::RefCore");
TClass* cl = TClass::GetClass("edm::RefCore");
TClassStreamer* st = cl->GetStreamer();
if (st == 0) {
cl->AdoptStreamer(new edm::RefCoreStreamer());
}
}
{
TClass* cl = gROOT->GetClass("edm::RefCoreWithIndex");
TClass* cl = TClass::GetClass("edm::RefCoreWithIndex");
TClassStreamer* st = cl->GetStreamer();
if (st == 0) {
cl->AdoptStreamer(new edm::RefCoreWithIndexStreamer());
Expand Down
4 changes: 2 additions & 2 deletions FWCore/RootAutoLibraryLoader/src/RootAutoLibraryLoader.cc
Expand Up @@ -357,7 +357,7 @@ namespace edm {
className.replace(idx + 6, 1, "");
}
classNameAttemptingToLoad_ = className.c_str();
returnValue = gROOT->GetClass(className.c_str(), kTRUE);
returnValue = TClass::GetClass(className.c_str(), kTRUE);
classNameAttemptingToLoad_ = classname;
return returnValue;
}
Expand All @@ -383,7 +383,7 @@ namespace edm {
// It will also attempt to load the dictionary for the class
// if the second argument is kTRUE. This is the default, so it
// need not be explicitly specified.
returnValue = gROOT->GetClass(classname, kTRUE);
returnValue = TClass::GetClass(classname, kTRUE);
classNameAttemptingToLoad_ = nullptr;
}
}
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Utilities/src/DictionaryTools.cc
Expand Up @@ -226,7 +226,7 @@ namespace edm {
for (StringSet::const_iterator it = missing.begin(), itEnd = missing.end();
it != itEnd; ++it) {
try {
gROOT->GetClass(it->c_str(), kTRUE);
TClass::GetClass(it->c_str(), kTRUE);
}
// We don't want to fail if we can't load a plug-in.
catch(...) {}
Expand Down
6 changes: 3 additions & 3 deletions IOPool/Common/interface/CustomStreamer.h
Expand Up @@ -2,7 +2,7 @@
#define IOPool_Common_CustomStreamer_h

#include <string>
#include "TROOT.h"
#include "TClass.h"
#include "TClassStreamer.h"
#include "TClassRef.h"
#include "FWCore/Utilities/interface/TypeID.h"
Expand Down Expand Up @@ -39,7 +39,7 @@ namespace edm {
template <typename T>
void
SetCustomStreamer() {
TClass *cl = gROOT->GetClass(TypeID(typeid(T)).className().c_str());
TClass *cl = TClass::GetClass(TypeID(typeid(T)).className().c_str());
if (cl->GetStreamer() == 0) {
cl->AdoptStreamer(new CustomStreamer<T>());
}
Expand All @@ -48,7 +48,7 @@ namespace edm {
template <typename T>
void
SetCustomStreamer(T const&) {
TClass *cl = gROOT->GetClass(TypeID(typeid(T)).className().c_str());
TClass *cl = TClass::GetClass(TypeID(typeid(T)).className().c_str());
if (cl->GetStreamer() == 0) {
cl->AdoptStreamer(new CustomStreamer<T>());
}
Expand Down
5 changes: 2 additions & 3 deletions IOPool/Input/src/RootDelayedReader.cc
Expand Up @@ -11,7 +11,6 @@

#include "IOPool/Common/interface/getWrapperBasePtr.h"

#include "TROOT.h"
#include "TBranch.h"
#include "TClass.h"

Expand All @@ -28,7 +27,7 @@ namespace edm {
nextReader_(),
resourceAcquirer_(inputType == InputType::Primary ? new SharedResourcesAcquirer(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader()) : static_cast<SharedResourcesAcquirer*>(nullptr)),
inputType_(inputType),
wrapperBaseTClass_(gROOT->GetClass("edm::WrapperBase")) {
wrapperBaseTClass_(TClass::GetClass("edm::WrapperBase")) {
}

RootDelayedReader::~RootDelayedReader() {
Expand Down Expand Up @@ -62,7 +61,7 @@ namespace edm {
setRefCoreStreamer(ep);
TClass* cp = branchInfo.classCache_;
if(nullptr == cp) {
branchInfo.classCache_ = gROOT->GetClass(branchInfo.branchDescription_.wrappedName().c_str());
branchInfo.classCache_ = TClass::GetClass(branchInfo.branchDescription_.wrappedName().c_str());
cp = branchInfo.classCache_;
branchInfo.offsetToWrapperBase_ = cp->GetBaseClassOffset(wrapperBaseTClass_);
}
Expand Down
5 changes: 2 additions & 3 deletions IOPool/Input/src/RootFile.cc
Expand Up @@ -47,7 +47,6 @@
#include "DataFormats/Provenance/interface/RunAux.h"
#include "FWCore/ParameterSet/interface/ParameterSetConverter.h"

#include "TROOT.h"
#include "Rtypes.h"
#include "TClass.h"
#include "TString.h"
Expand Down Expand Up @@ -213,7 +212,7 @@ namespace edm {
eventProductProvenanceRetrievers_(),
parentageIDLookup_(),
daqProvenanceHelper_(),
edProductClass_(gROOT->GetClass("edm::WrapperBase")) {
edProductClass_(TClass::GetClass("edm::WrapperBase")) {

hasNewlyDroppedBranch_.fill(false);

Expand Down Expand Up @@ -1800,7 +1799,7 @@ namespace edm {
for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
BranchDescription const& prod = it->second;
if(prod.branchType() != InEvent) {
TClass* cp = gROOT->GetClass(prod.wrappedName().c_str());
TClass* cp = TClass::GetClass(prod.wrappedName().c_str());
void* p = cp->New();
int offset = cp->GetBaseClassOffset(edProductClass_);
std::unique_ptr<WrapperBase> edp = getWrapperBasePtr(p, offset);
Expand Down
5 changes: 2 additions & 3 deletions IOPool/Output/src/RootOutputFile.cc
Expand Up @@ -33,7 +33,6 @@
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "IOPool/Common/interface/getWrapperBasePtr.h"

#include "TROOT.h"
#include "TTree.h"
#include "TFile.h"
#include "TClass.h"
Expand Down Expand Up @@ -98,7 +97,7 @@ namespace edm {
processHistoryRegistry_(),
parentageIDs_(),
branchesWithStoredHistory_(),
wrapperBaseTClass_(gROOT->GetClass("edm::WrapperBase")) {
wrapperBaseTClass_(TClass::GetClass("edm::WrapperBase")) {
#if ROOT_VERSION_CODE >= ROOT_VERSION(5,30,0)
if (om_->compressionAlgorithm() == std::string("ZLIB")) {
filePtr_->SetCompressionAlgorithm(ROOT::kZLIB);
Expand Down Expand Up @@ -717,7 +716,7 @@ namespace edm {
if(product == nullptr) {
// No product with this ID is in the event.
// Add a null product.
TClass* cp = gROOT->GetClass(item.branchDescription_->wrappedName().c_str());
TClass* cp = TClass::GetClass(item.branchDescription_->wrappedName().c_str());
int offset = cp->GetBaseClassOffset(wrapperBaseTClass_);
void* p = cp->New();
std::unique_ptr<WrapperBase> dummy = getWrapperBasePtr(p, offset);
Expand Down

0 comments on commit 4b47c79

Please sign in to comment.