LCG Project | LCG Applications Area | |
$Date: 2005/06/30 13:31:19 $ |
Cintex is a library that converts Reflex dictionary information to CINT data structures used by ROOT. This package allows to interact with CINT with any class for which the Reflex dictionary is provided (using the lcgdict command).
Assuming that the environment is setup correctly (LD_LIBRARY_PATH) the user can start interacting with C++ classes directly from the ROOT/CINT prompt. In this example the CLHEP dictionary is used (SealCLHEPDict).
******************************************* * * * W E L C O M E to R O O T * * * * Version 4.03/02 11 February 2005 * * * * You are welcome to visit our Web site * * http://root.cern.ch * * * ******************************************* gSystem->Load("lcg_Cintex"); // Load Cintex gSystem->Load("SealCLHEPDict"); // Load any Reflex dictionary Cintex::setDebug(0) // Optional the debug level can be changed Cintex::enable() // Enable Cintex using namespace CLHEP; Hep3Vector v1(10.,20.,30.); Hep3Vector v2(v1); cout << v2.r() << endl; RanluxEngine r; RandFlat f(r); RandGauss g(r,0,1); TH1F hf("hf","flat distribution",100,0,1); TH1F hg("hg","gauss distribution",100,-5,5); for (int i = 0; i < 10000; i ++) { hf.Fill(f.fire()); hg.Fill(g.fire()); }
This an example to illustrate how to write and read back objects of any class loaded by Cintex. In this example the CLHEP dictionary is used (SealCLHEPDict).
******************************************* * * * W E L C O M E to R O O T * * * * Version 4.03/02 11 February 2005 * * * * You are welcome to visit our Web site * * http://root.cern.ch * * * ******************************************* gSystem->Load("lcg_Cintex"); // Load Cintex Cintex::enable(); // Enable Cintex gSystem->Load("SealCLHEPDict"); // Load any Reflex dictionary CLHEP::Hep3Vector v0; CLHEP::Hep3Vector v1(22,1,1); TFile fo("data.root","RECREATE"); fo.WriteObject(&v0, "my_v0"); fo.WriteObject(&v1, "my_v1"); fo.Close(); TFile fi("data.root"); CLHEP::Hep3Vector* vp; fi.GetObject("my_v1", vp); cout << " x = " << vp->x() << " y = " << vp->y() << " z = " << vp->z() << endl; fi.Close();