CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/IOPool/Streamer/src/ClassFiller.cc

Go to the documentation of this file.
00001 #include "FWCore/Utilities/interface/Exception.h"
00002 #include "FWCore/Utilities/interface/EDMException.h"
00003 #include "FWCore/Utilities/interface/Algorithms.h"
00004 #include "FWCore/Utilities/interface/DebugMacros.h"
00005 #include "FWCore/Utilities/interface/DictionaryTools.h"
00006 #include "FWCore/Utilities/interface/TypeID.h"
00007 #include "Cintex/Cintex.h"
00008 #include "FWCore/PluginManager/interface/PluginCapabilities.h"
00009 
00010 
00011 #include "TClass.h"
00012 #include "G__ci.h"
00013 
00014 #include <string>
00015 #include <set>
00016 #include <algorithm>
00017 
00018 namespace edm {
00019   void loadCap(std::string const& name) {
00020     FDEBUG(1) << "Loading dictionary for " << name << "\n";
00021     edmplugin::PluginCapabilities::get()->load(dictionaryPlugInPrefix() + name);
00022     checkDictionaries(name);
00023     if (!missingTypes().empty()) {
00024       StringSet missing = missingTypes();
00025       missingTypes().clear();
00026       for_all(missing, loadCap);
00027     }
00028   }
00029 
00030   void doBuildRealData(std::string const& name) {
00031     FDEBUG(3) << "doing BuildRealData for " << name << "\n";
00032     TClass* ttest = TClass::GetClass(name.c_str());
00033     if (ttest != 0) {
00034       ttest->BuildRealData();
00035     } else {
00036       throw edm::Exception(errors::Configuration)
00037                         << "Could not find TClass for " << name << "\n";
00038     }
00039   }
00040   // ---------------------
00041 
00042   void loadExtraClasses() {
00043     static bool done = false;
00044     if (done == false) {
00045         loadCap(std::string("edm::StreamedProduct"));
00046         loadCap(std::string("std::vector<edm::StreamedProduct>"));
00047         loadCap(std::string("edm::SendEvent"));
00048         loadCap(std::string("std::vector<edm::BranchDescription>"));
00049         loadCap(std::string("edm::SendJobHeader"));
00050     }
00051     G__SetCatchException(0);
00052     ROOT::Cintex::Cintex::Enable();
00053     done=true;
00054   }
00055 
00056   namespace {
00057     TClass* getRootClass(std::string const& name) {
00058       TClass* tc = TClass::GetClass(name.c_str());    
00059       
00060       // get ROOT TClass for this product
00061       // CINT::Type* cint_type = CINT::Type::get(typ_ref);
00062       // tc_ = cint_type->rootClass();
00063       // TClass* tc = TClass::GetClass(typeid(se));
00064       // tc_ = TClass::GetClass("edm::SendEvent");
00065       
00066       if(tc == 0) {
00067         throw edm::Exception(errors::Configuration,"getRootClass")
00068           << "could not find TClass for " << name
00069           << "\n";
00070       }
00071       
00072       return tc;
00073     }
00074   }
00075 
00076   // ---------------------
00077   TClass* getTClass(std::type_info const& ti) {
00078     TypeID const type(ti);
00079     return getRootClass(type.className());
00080   }
00081 }