CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
trackerTree.py
Go to the documentation of this file.
1 ##########################################################################
2 ##
3 # Check if there is the trackerTree.root file.
4 ##
5 
6 import logging
7 import os
8 
9 from Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper \
10  import checked_out_MPS
11 import Alignment.MillePedeAlignmentAlgorithm.mpslib.tools as mps_tools
12 
13 
14 def check(config):
15  logger = logging.getLogger("mpsvalidate")
16  logger.info("Check if TrackerTree.root file exists")
17 
18  outputpath = os.path.join(config.jobDataPath, ".TrackerTree.root")
19 
20  # check if file exists
21  if not os.path.isfile(outputpath):
22  logger.info("TrackerTree.root file does not exist. It will be created now.")
23 
24  configpath = os.path.join(config.mpspath, "test", "trackerTree_cfg.py")
25  logger.info("Path to the config file: {0}".format(configpath))
26 
27  cmd = ["cmsRun", configpath, "outputFile="+outputpath]
28  if config.globalTag != None: cmd.append("globalTag="+config.globalTag)
29  if config.firstRun != None: cmd.append("firstRun="+config.firstRun)
30  mps_tools.run_checked(cmd, suppress_stderr = True)
31 
32  return os.path.abspath(outputpath)