hasROOT = True except ImportError : Print('ROOT library not found, histogram book keeping disabled') hasROOT = False #-------------------------------------------------------------------------- ########################################################################### # Load 8L sector bank #-------------------------------------------------------------------------- Print('Load sector in ' + filename_XL_sector) LX_sector_bank = ftkutils.PatternBank(filename_XL_sector) LX_sector_bank.LoadPatterns() # create a KD-Tree representation for this bank LX_kdtree_bank = LX_sector_bank.BuildKDTree() #-------------------------------------------------------------------------- ########################################################################### # Parse region ID and subregion ID from the 8L sector bank name # e.g. from 1st passed arg: sectors_raw_8L_16M_reg'7'_sub'14'.patt.bz2 #-------------------------------------------------------------------------- regid = None subid = None
import os.path # setup the environment name7L = sys.argv[1] nsubregions = int(sys.argv[2]) try: import ROOT hasROOT = True except ImportError: print "ROOT library not found, histogram book keeping disabled" hasROOT = False # load the sector from the 1st file (7-layer bank) print "Load sector in", name7L sectbank7L = ftkutils.PatternBank(name7L) sectbank7L.LoadPatterns() # create a KD-Tree representation for this bank kdtreebank7L = sectbank7L.BuildKDTree() # get the subregion ID regid = None subid = None name7L_items = name7L.split("_") for item in name7L_items: if item[0:3] == "reg": regid = int(item.split(".")[0][3:]) print "Region", regid elif item[0:3] == "sub": subid = int(item.split(".")[0][3:]) print "Sub-region", subid