How to add your own class to a plain Root Tree - (no EDM) - in CMSSW




cvs co -d JetEventDataformat UserCode/aosorio/UCT2015/JetEventDataformat
cvs co -d UCT15Additions UserCode/aosorio/UCT2015/UCT15Additions


  • First you need to define your class in a new package (I used the mkedanlzr to give it the usual structure).
  • Write your class (put in the src directory if you want). For this example, my classes are Region and SimpleJet
  • At the end of my class declaration file, we need to add a type definition:

typedef std::vector< Region > RegionCollection;
typedef std::vector< SimpleJet > JetEventCollection;
  • When you are done with your class declaration and definition, you need to create a xml file classes_def.xml inside the src/ directory. This file tells what classes are you adding to the dictionary:

< lcgdict>
 < class name="Region"/ >
 < class name="std::vector< Region >"/ >
 < class name="edm::Wrapper< std::vector< Region > >"/ >
 < class name="SimpleJet"/ >
 < class name="std::vector< SimpleJet >"/ >
 < class name="edm::Wrapper< std::vector >"/ >
< /lcgdict >

  • Check the buildfile. This is how mine looks like currently:

< use name="FWCore/Framework"/ >
< use name="FWCore/ParameterSet"/ >
< use name="PhysicsTools/UtilAlgos"/ >
< use name="FWCore/ServiceRegistry"/ >
< use name="DataFormats/Candidate"/ >
< use name="root"/ >
< use name="rootrflx"/ >
< use name="FWCore/Utilities"/ >
< export >
< /export >

  • Build your classes. If everything goes well, then you are ready to add this class to a plain Root tree in CMSSW.

This topic: Main > TWikiUsers > AndresOsorio > MyClassInRootTree
Topic revision: r3 - 2013-01-30 - AndresOsorio
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback