Exemple #1
0
def resetDir(dirName, resetOutDir, verb = True):
  Assert("Tried to resetDir with empty directory name",dirName != "")
  if verb: log.info(blue(" - Resetting directory(")+yellow(dirName)+blue(",")+red(resetOutDir)+blue(")"))

  if os.path.isdir(dirName):
    if resetOutDir:
      filesInDir = os.listdir(dirName)
      for fileNow in filesInDir:
        os.system("rm -v "+dirName+"/"+fileNow)
  else:
    os.system("mkdir -vp  "+dirName)
Exemple #2
0
def runOneANNZ():
  cmnd = glob.exeName+" " ; cmndPrint = ""
  for key in glob.annz:
    if key == "":
      continue
    if key == "generalOpt":
      cmnd += str(glob.annz[key])+" " ; cmndPrint += blue(str(glob.annz[key]))+" , "

    cmnd      += key+"="+"\'"+str(glob.annz[key])+"\' "
    cmndPrint += blue(str(key))+red(str("="))+"\'"+green(str(glob.annz[key]))+"\' , "

  if glob.pars["logFileName"] != "":
    cmnd += " > "+glob.pars["logFileName"]+"_annz 2>&1"  ; cmndPrint += purple(" > "+glob.pars["logFileName"]+"_annz 2>&1")

  log.info(yellow(" - Will run "+glob.exeName+" with the following user-options: ")) ; log.info("   "+cmndPrint) ; log.info("")

  return os.system(cmnd)
Exemple #3
0
def initROOT():

  if "ROOTSYS" in os.environ and glob.useDefinedROOTSYS:
    log.info(blue(" - Found defined ")+green("ROOTSYS")+blue(" = \"")+yellow(os.environ["ROOTSYS"])+blue("\". Setting glob.rootHome to match"))
    glob.rootHome = os.environ["ROOTSYS"]

  rootExeDir  = glob.rootHome+"/bin/"
  rootExe     = rootExeDir+"/root"
  rootHomeLib = glob.rootHome+"/lib/"

  Assert("Found rootHome = "+glob.rootHome+" which does not exist... Please set this in commonImports.py to the" \
         +" ROOT installation directory !",os.path.isdir(glob.rootHome))

  Assert("Did not find ROOT executable, expected as "+rootExe+"  ..." \
         +" Is ROOT properly installed ? Is glob.rootHome set to match ?",os.path.isfile(rootExe))

  # add the bin directory of ROOT as first in the PATH, to make sure that the correct bin/root-config is used in the Makefile
  os.environ["PATH"] = rootExeDir+":"+os.environ["PATH"]

  if not "ROOTSYS" in os.environ:
    os.environ["ROOTSYS"] = glob.rootHome
    log.info(blue(" - Setting ")+green("ROOTSYS")+blue(" = \"")+yellow(os.environ["ROOTSYS"])+blue("\""))

  elif glob.rootHome != os.environ["ROOTSYS"]:
    os.environ["ROOTSYS"] = glob.rootHome
    log.info(blue(" - Setting ")+green("ROOTSYS")+blue(" = \"")+yellow(os.environ["ROOTSYS"])+blue("\""))

  else:
    log.info(blue(" - Will use ")+green("ROOTSYS")+blue(" = \"")+yellow(os.environ["ROOTSYS"])+blue("\""))

  if not "LD_LIBRARY_PATH" in os.environ:
    os.environ["LD_LIBRARY_PATH"] = rootHomeLib
    log.info(blue(" - Setting ")+green("LD_LIBRARY_PATH")+blue(" = \"")+yellow(os.environ["LD_LIBRARY_PATH"])+blue("\""))

  elif not (rootHomeLib) in os.environ["LD_LIBRARY_PATH"]:
    os.environ["LD_LIBRARY_PATH"] = rootHomeLib+":"+os.environ["LD_LIBRARY_PATH"]
    log.info(blue(" - Adding to ")+green("LD_LIBRARY_PATH")+blue(" \"")+yellow(rootHomeLib)+blue("\""))

  else:
    log.info(blue(" - Found ")+green("LD_LIBRARY_PATH")+blue(" = \"")+yellow(os.environ["LD_LIBRARY_PATH"])+blue("\""))

  return