예제 #1
0
def add_path(lmon_top, geant_inst):

    sys.path.append(lmon_top + "/macro")
    sys.path.append(lmon_top + "/macro/Q2rec")

    gSystem.AddIncludePath(" -I" + lmon_top + "/include")
    gSystem.AddIncludePath(" -I" + geant_inst)
    gROOT.ProcessLine(".L " + lmon_top + "/src/GeoParser.cxx+")
예제 #2
0
def compileAll(
        branches            = [],
        treename            = 'tau',
        inputpath           = '',
        outputdump          = False,
        removeunselected    = False,
        cutflows            = [],
        toolset             = 'LepHad2011',
    ):
    global compiledir
    compiledir = 'libs/' + toolset

    from ROOT import gSystem
    gSystem.SetAclicMode(gSystem.kOpt)
    gSystem.AddIncludePath('-I' + filedir + '/../External/TauSpinner/extern/include')
    gSystem.AddIncludePath('-I' + filedir + '/../External/TauSpinner/extern/include/Tauola')
    compileC(filedir+"/Loader.C")
    compileC(filedir+"/CutFlowHist.C")

    print "@@@@@ Setting up the branches, kernel, whiteboard and external tools..."
    if type(branches) is str:
        branches = [branches]
    b = []
    for branch in branches:
        if not hasattr(__import__('Branches.'+branch), branch):
            raise Exception("Can't find Branches: " + branch)
        b.append(getattr(__import__('Branches.'+branch), branch))

    import CodeGenerator, NTupleTools
    if not CodeGenerator.setupBranches(b, treename, inputpath, outputdump):
        raise Exception("Setup branches failed!")

    compileC(filedir+"/WhiteBoard.C")
    compileC(filedir+"/CutFlow_Base.C")
    CodeGenerator.setupForkItem(removeunselected, outputdump)

    import External
    External.initialiseAllTools(toolset)

    import CutFlows
    CutFlows.load(cutflows)
    compileC(filedir+"/PostLoader.C")
예제 #3
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
예제 #4
0
def RooFitInclude():
    print "adding RooFit ...",
    scramCmd = ['scram','tool','info','roofitcore']
    grepCmd = ['grep', 'INCLUDE']
    pscram = subprocess.Popen(scramCmd, stdout = subprocess.PIPE)
    pgrep = subprocess.Popen(grepCmd, stdin=pscram.stdout,
                             stdout=subprocess.PIPE)
    pscram.stdout.close()
    output = pgrep.communicate()[0]
    if (pgrep.returncode == 0):
        print "done"
        roofitinc = output.split("=")[1].rstrip()
        # print roofitinc
        gROOT.GetInterpreter().AddIncludePath(roofitinc)
        roofitinc = '-I"' + roofitinc + '"'
        # print roofitinc
        gSystem.AddIncludePath(roofitinc)
        return True
    else:
        print "failed"
        print 'scram returned:',pscram.returncode,'grep:',pgrep.returncode
        return False
예제 #5
0
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
예제 #6
0
if arguments['--noRoot']:
    print 'Not loading any ROOT modules. usefull for generating files on oslic'

else:
    from ROOT import TRandom3
    from ROOT import TChain, TGraph, TGraphErrors, gSystem, gROOT, TH1D, TH2D, TFile, TCanvas, TF1
    from ROOT import THStack, Double
    from ROOT import kRed, kBlue, kGreen, kCyan, kOrange

    from ROOT import kOrange as kO, kBlue as kB, kGreen as kG
    from ROOT import kMagenta as kM, kAzure as kA, kRed as kR
    from ROOT import TCanvas, TLine, TLatex
    from ROOT import gStyle, gPad, TPaletteAxis

    gSystem.Load("$RATROOT/lib/libRATEvent")
    gSystem.AddIncludePath(" -I$RATROOT/include")

    # gROOT.LoadMacro("$WATCHENV/watchmakers/goldenFileExtractor.C")
    # from ROOT import goldenFileExtractor

    gStyle.SetOptStat(1112211)


def loadSimulationParametersNew():
    #Chain and subsequent isotopes
    d = {}

    d['CHAIN_238U_NA'] = ['234Pa', '214Pb', '214Bi', '210Bi', '210Tl']
    d['CHAIN_232Th_NA'] = ['228Ac', '212Pb', '212Bi', '208Tl']
    d['CHAIN_235U_NA'] = ['231Th', '223Fr', '211Pb', '211Bi', '207Tl']
    d['40K_NA'] = ['40K']
예제 #7
0
    ut.put_yx_tit(hZ, "Counts", "Hit #it{z} (mm)", 1.5, 1.4)

    ut.set_margin_lbtr(gPad, 0.11, 0.11, 0.02, 0.03)

    gPad.SetGrid()

    gPad.SetLogy()

    ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")


#hit_z

#_____________________________________________________________________________
if __name__ == "__main__":

    gROOT.SetBatch()
    gStyle.SetPadTickX(1)
    gStyle.SetFrameLineWidth(2)

    gROOT.ProcessLine(".L ../acc_Q2_kine.h+")

    gSystem.AddIncludePath(" -I/home/jaroslav/sim/lmon/include")
    gSystem.AddIncludePath(
        " -I/home/jaroslav/sim/geant/geant4.10.07.p01/install/include/Geant4")
    gROOT.ProcessLine(".L ../../src/GeoParser.cxx+")

    main()
예제 #8
0
gStyle.SetPadRightMargin(0.06)  ## was 0.02

gStyle.SetTitleColor(1, "XYZ")
gStyle.SetTitleFont(42, "XYZ")
gStyle.SetTitleSize(0.07, "XYZ")
gStyle.SetTitleXOffset(0.9)
gStyle.SetTitleYOffset(1.4)  ## was 1.25

##  For the axis labels:
gStyle.SetLabelColor(1, "XYZ")
gStyle.SetLabelFont(42, "XYZ")
gStyle.SetLabelOffset(0.007, "XYZ")
gStyle.SetLabelSize(0.06, "XYZ")
gStyle.SetNdivisions(505, "XYZ")

if (gSystem.DynamicPathName("libFWCoreFWLite.so", True)):
    gROOT.GetInterpreter().AddIncludePath(cmssw_base + '/src')
    gSystem.AddIncludePath('-I"' + cmssw_base + '/src"')
    if not RooFitInclude():
        workingdir = os.getcwd()
        print 'changing to', cmssw_base, 'directory'
        os.chdir(cmssw_base)
        RooFitInclude()
        print 'returning to working directory', workingdir
        os.chdir(workingdir)

print 'end of pyroot_logon'

if __name__ == '__main__':
    from ROOT import *