CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ClassFiller.cc
Go to the documentation of this file.
6 #include "Cintex/Cintex.h"
8 
9 
10 #include "TClass.h"
11 #include "G__ci.h"
12 
13 #include <string>
14 #include <set>
15 #include <algorithm>
16 
17 namespace edm {
18  std::string getName(Reflex::Type& cc) {
19  return cc.Name(Reflex::SCOPED);
20  }
21 
22  void loadCap(std::string const& name) {
23  static std::string const fname("LCGReflex/");
24  FDEBUG(1) << "Loading dictionary for " << name << "\n";
26  checkDictionaries(name);
27  if (!missingTypes().empty()) {
29  missingTypes().clear();
30  for_all(missing, loadCap);
31  }
32  }
33 
34  void doBuildRealData(std::string const& name) {
35  FDEBUG(3) << "doing BuildRealData for " << name << "\n";
36  Reflex::Type cc = Reflex::Type::ByName(name);
37  TClass* ttest = TClass::GetClass(getName(cc).c_str());
38  if (ttest != 0) {
39  ttest->BuildRealData();
40  } else {
42  << "Could not find TClass for " << name << "\n";
43  }
44  }
45  // ---------------------
46 
48  static bool done = false;
49  if (done == false) {
50  loadCap(std::string("edm::StreamedProduct"));
51  loadCap(std::string("std::vector<edm::StreamedProduct>"));
52  loadCap(std::string("edm::SendEvent"));
53  loadCap(std::string("std::vector<edm::BranchDescription>"));
54  loadCap(std::string("edm::SendJobHeader"));
55  }
56  G__SetCatchException(0);
57  ROOT::Cintex::Cintex::Enable();
58  done=true;
59  }
60 
61  namespace {
62  Reflex::Type const getReflectClass(std::type_info const& ti) {
63  Reflex::Type const typ = Reflex::Type::ByTypeInfo(ti);
64  return typ;
65  }
66 
67  TClass* getRootClass(std::string const& name) {
68  TClass* tc = TClass::GetClass(name.c_str());
69 
70  // get ROOT TClass for this product
71  // CINT::Type* cint_type = CINT::Type::get(typ_ref);
72  // tc_ = cint_type->rootClass();
73  // TClass* tc = TClass::GetClass(typeid(se));
74  // tc_ = TClass::GetClass("edm::SendEvent");
75 
76  if(tc == 0) {
77  throw edm::Exception(errors::Configuration,"getRootClass")
78  << "could not find TClass for " << name
79  << "\n";
80  }
81 
82  return tc;
83  }
84  }
85 
86  // ---------------------
87  TClass* getTClass(std::type_info const& ti) {
88  Reflex::Type const typ = getReflectClass(ti);
89  return getRootClass(typ.Name(Reflex::SCOPED));
90  }
91 }
dictionary missing
Definition: combine.py:4
void doBuildRealData(const std::string &name)
Definition: ClassFiller.cc:34
#define FDEBUG(lev)
Definition: DebugMacros.h:18
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:87
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
StringSet & missingTypes()
Definition: ReflexTools.cc:189
std::set< std::string > StringSet
Definition: ReflexTools.h:22
void checkDictionaries(std::string const &name, bool noComponents=false)
Definition: ReflexTools.cc:199
static PluginCapabilities * get()
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
string fname
main script
void load(const std::string &iName)
void loadExtraClasses()
Definition: ClassFiller.cc:47
void loadCap(const std::string &name)
Definition: ClassFiller.cc:22