Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-23 02:25:13

0001 #!/usr/bin/env python3
0002 
0003 import sys
0004 import argparse
0005 import Alignment.MillePedeAlignmentAlgorithm.mpslib.tools as mps_tools
0006 
0007 ################################################################################
0008 def main(argv = None):
0009     """Main routine of the script.
0010 
0011     Arguments:
0012     - `argv`: arguments passed to the main routine
0013     """
0014 
0015     if argv == None:
0016         argv = sys.argv[1:]
0017 
0018     parser = argparse.ArgumentParser(
0019         description="Prepare input db file for MillePede workflow.")
0020     parser.add_argument("-g", "--global-tag", dest="global_tag", required=True,
0021                         metavar="TAG",
0022                         help="global tag to extract the alignment payloads")
0023     parser.add_argument("-r", "--run-number", dest="run_number", required=True,
0024                         metavar="INTEGER", type=int,
0025                         help="run number to select IOV")
0026     parser.add_argument("-o", "--output-db", dest="output_db",
0027                         default="alignment_input.db", metavar="PATH",
0028                         help="name of the output file (default: '%(default)s')")
0029     args = parser.parse_args(argv)
0030 
0031     inputs = mps_tools.get_tags(args.global_tag,
0032                                 ["TrackerAlignmentRcd",
0033                                  "TrackerSurfaceDeformationRcd",
0034                                  "TrackerAlignmentErrorExtendedRcd"])
0035     for inp in inputs.values():
0036         inp["iovs"] = mps_tools.get_iovs(inp["connect"], inp["tag"])
0037     mps_tools.create_single_iov_db(inputs, args.run_number, args.output_db)
0038 
0039 
0040 ################################################################################
0041 if __name__ == "__main__":
0042     try:
0043         main()
0044     except KeyboardInterrupt:
0045         pass