Loading Dictionaries

To be able to use the member functions of a CMSSW data class from within ROOT requires ROOT to have a 'dictionary' for that class. To get that dictionary, you need to load the proper library into ROOT. We have provided a mechanism so that ROOT can automatically load the correct library. To use this mechanism, issue the following commands to ROOT

Unfortunately, this only works when you use a TFile. It will not work with a TChain or a TDSet. The reason is ROOT only 'calls' the auto loader when it can not find a dictionary for a class which is stored in the file used by the TFile.

Once the dictionary has been loaded, the member functions of the class can be used from TBrowser, TTree::Draw, the ROOT command line or from within a Macro.

NEW As of CMSSW_1_0_0_pre2 enabling the AutoLibraryLoader will also allow the Cint interpreter (which runs the ROOT command line and ROOT macros) to automatically load the library the first time you refer to a class that Cint does not know. This same change makes TChains work as well.

Example LinkDef.h

#include "Higgs/HiggsAnalyzer/interface/Lepton.h"
#include "Higgs/HiggsAnalyzer/interface/HiggsEvent.h"
#ifdef __CINT__

// Do not link 
//#pragma link off all globals;
//#pragma link off all classes;
//#pragma link off all functions;

#pragma link C++ class Lepton;
#pragma link C++ class HiggsEvent;
#pragma link C++ enum flag+;
#pragma link C++ class std::vector<Lepton*>+;
#pragma link C++ all_function std::vector<Lepton*>+;


Adding Root Files

To add two or more root files:

hadd [new filename] [filename 1] [filename 2] ... [filename 3]

Opening a sample directly

To open a sample ROOT file

   TFile* f = new TFile("dcache:/pnfs/cms/WAX/11/[filepath from cff file]")

-- RyanKelley - 21 Aug 2007

Topic revision: r4 - 2007/10/11 - 09:59:33 - RyanKelley
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback