InSANE  1.6
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
Using Python and PyROOT with InSANE

Linking InSANE Libraries with pyROOTlink

First you need python and PyROOT. Also recommended is the python module rootplot .

The following example shows one way to use ROOT in python:

    from ROOT import gROOT,TCanvas
    c=TCanvas() 

See PyROOT Manual for other ways and more details on using PyROOT.

Using InSANE in python

To use InSANE in python you import classes from the module ROOT (like the example above) but first you need to load the InSANE libraries and their dependencies into ROOT. This similarly done in your rootlogonC .

Create the file .rootlogon.py which is executed when you import ROOT. The following example shows how to load and use InSANE from your .rootlogon.py script.

Example .rootlogon.py loading InSANE:

from ROOT import gROOT,gSystem
gSystem.Load( 'libFoam' )
gSystem.Load( 'libTreeViewer' )
gSystem.Load( 'libInSANE' )

Example python script using InSANE:

import os
from ROOT import TCanvas,BigcalDetector

c = TCanvas()
bc = BigcalDetector()
h = bc.GetCalibrationCoefficientHist(1)
c.SaveAs('bigcal_calibration.png')
bigcal_calibration.png
Plot of bigcal calibration coefficients produced by example2.py