コード例 #1
0
def compileAClick(dictionary, g4=True):
  from ROOT import gInterpreter, gSystem
  import os.path
  dd4hep = os.environ['DD4hepINSTALL']
  inc = ' -I' + os.environ['ROOTSYS'] + '/include -I' + dd4hep + '/include '
  lib = ' -L' + dd4hep + '/lib -lDDCore -lDDG4 -lDDSegmentation '
  if g4:
    geant4 = os.environ['G4INSTALL']
    inc = inc + ' -I' + geant4 + '/include/Geant4 -Wno-shadow -g -O0 '
    lib = lib + ' -L' + geant4 + '/lib  -L' + geant4 + '/lib64 -lG4event -lG4tracking -lG4particles '

  gSystem.AddIncludePath(inc)
  gSystem.AddLinkedLibs(lib)
  logger.info('Loading AClick %s', dictionary)
  package = imp.find_module('DDG4')
  dic = os.path.dirname(package[1]) + os.sep + dictionary
  gInterpreter.ProcessLine('.L ' + dic + '+')
  from ROOT import dd4hep as module
  return module
コード例 #2
0
ファイル: DD4hep.py プロジェクト: shaojunlu/DD4hep_fork
def compileAClick(dictionary,g4=True):
  from ROOT import gInterpreter, gSystem
  import sys, imp, exceptions
  import os.path
  dd4hep = os.environ['DD4hepINSTALL']
  inc    = ' -I'+os.environ['ROOTSYS']+'/include -I'+dd4hep+'/include '
  lib    = ' -L'+dd4hep+'/lib -lDDCore -lDDG4 -lDDSegmentation '
  if g4:
    geant4 = os.environ['G4INSTALL']
    inc    = inc + ' -I'+geant4+'/include/Geant4 -Wno-shadow -g -O0 '
    lib    = lib + ' -L'+geant4+'/lib  -L'+geant4+'/lib64 -lG4event -lG4tracking -lG4particles '

  gSystem.AddIncludePath(inc)
  gSystem.AddLinkedLibs(lib)
  #####print "Includes:   ",gSystem.GetIncludePath(),"\n","Linked libs:",gSystem.GetLinkedLibs()
  print 'Loading AClick ',dictionary
  package = imp.find_module('DDG4')
  dic = os.path.dirname(package[1])+os.sep+dictionary
  ###print dic
  gInterpreter.ProcessLine('.L '+dic+'+')
  #####gInterpreter.Load('DDG4Dict_C.so')
  from ROOT import DD4hep as module
  return module
コード例 #3
0
ファイル: extract.py プロジェクト: ruphy/crystal
# Aggiungi qui, separandole da virgole, le classi di ROOT
# che usi:
from os import popen
from ROOT import TCanvas, TH1F, TChain
from ROOT import gInterpreter, gSystem, gROOT
import numpy as np

gSystem.AddLinkedLibs(popen('root-config --libs').read())
gInterpreter.GenerateDictionary("vector<ROOT::Math::Cartesian3D<double> >",
                                "Math/Cartesian3D.h")

# ---------------------- #
# Inizio codice serio    #
# ---------------------- #

c1 = TChain('tree')
c1.Add('out.root')

a = [x.MomentumOut for x in c1]
print a[1].size()
a = filter(lambda x: x.size() > 0, a)

print len(a)
for item in a:
    print item.z()

for event in c1:
    if (event.MomentumOut.size()):
        print acos(event.MomentumOut[0].z())