Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-11 03:38:27

0001 import FWCore.ParameterSet.Config as cms
0002 import argparse
0003 
0004 parser = argparse.ArgumentParser(description='Test reduced ProcessHistory')
0005 parser.add_argument("--input", type=str, help="Input file")
0006 parser.add_argument("--bypassVersionCheck", action="store_true", help="Bypass version check")
0007 parser.add_argument("--expectNewLumi", action="store_true", help="Set this if a new lumi is expected between the original files")
0008 parser.add_argument("--expectNewRun", action="store_true", help="Set this if a new run is expected between the original files")
0009 
0010 args = parser.parse_args()
0011 
0012 process = cms.Process("READ")
0013 
0014 from IOPool.Input.modules import PoolSource
0015 process.source = PoolSource(
0016     fileNames = [f"file:{args.input}"],
0017     bypassVersionCheck = args.bypassVersionCheck,
0018 )
0019 
0020 from FWCore.Framework.modules import TestMergeResults, RunLumiEventAnalyzer
0021 process.testmerge = TestMergeResults(
0022     expectedBeginRunProd = [10001, 20004, 10003],
0023     expectedEndRunProd = [100001, 200004, 100003],
0024     expectedBeginLumiProd = [101, 204, 103],
0025     expectedEndLumiProd = [1001, 2004, 1003],
0026 
0027     expectedBeginRunNew = [10001, 10002, 10003],
0028     expectedEndRunNew = [100001, 100002, 100003],
0029     expectedBeginLumiNew = [101, 102, 103],
0030     expectedEndLumiNew = [1001, 1002, 1003],
0031     expectedProcessHistoryInRuns = [
0032         'PROD',
0033         'MERGETWOFILES',
0034         'READ'
0035     ]
0036 )
0037 def setWithMergeAndCopyEntry(p, value):
0038     p[1] = value
0039     p[3:5] = p[0:2]
0040 if args.expectNewLumi or args.expectNewRun:
0041     setWithMergeAndCopyEntry(process.testmerge.expectedBeginRunProd, 10002)
0042     setWithMergeAndCopyEntry(process.testmerge.expectedEndRunProd, 100002)
0043     setWithMergeAndCopyEntry(process.testmerge.expectedBeginLumiProd, 102)
0044     setWithMergeAndCopyEntry(process.testmerge.expectedEndLumiProd, 1002)
0045 
0046 process.test = RunLumiEventAnalyzer(
0047     expectedRunLumiEvents = [
0048         1, 0, 0, # beginRun
0049         1, 1, 0, # beginLumi
0050         1, 1, 1,
0051         1, 1, 2,
0052         1, 1, 3,
0053         1, 1, 4,
0054         1, 1, 5,
0055         1, 1, 6,
0056         1, 1, 7,
0057         1, 1, 8,
0058         1, 1, 9,
0059         1, 1, 10,
0060         1, 1, 101,
0061         1, 1, 102,
0062         1, 1, 103,
0063         1, 1, 104,
0064         1, 1, 105,
0065         1, 1, 106,
0066         1, 1, 107,
0067         1, 1, 108,
0068         1, 1, 109,
0069         1, 1, 110,
0070         1, 1, 0, # endLumi
0071         1, 0, 0, # endRun
0072     ]
0073 )
0074 endFirstFileIndex = 3*(10+2)
0075 if args.expectNewLumi:
0076     process.test.expectedRunLumiEvents = process.test.expectedRunLumiEvents[:endFirstFileIndex] + [
0077         1, 1, 0, # endLumi
0078         1, 0, 0, # endRun
0079         1, 0, 0, # beginRun
0080         1, 1, 0, # beginLumi
0081         1, 1, 201,
0082         1, 1, 202,
0083         1, 1, 203,
0084         1, 1, 204,
0085         1, 1, 205,
0086         1, 1, 206,
0087         1, 1, 207,
0088         1, 1, 208,
0089         1, 1, 209,
0090         1, 1, 210,
0091         1, 1, 0, # endLumi
0092         1, 0, 0, # endRun
0093     ]
0094 elif args.expectNewRun:
0095     process.test.expectedRunLumiEvents = process.test.expectedRunLumiEvents[:endFirstFileIndex] + [
0096         1, 1, 0, # endLumi
0097         1, 0, 0, # endRun
0098         1, 0, 0, # beginRun
0099         1, 2, 0, # beginLumi
0100         1, 2, 201,
0101         1, 2, 202,
0102         1, 2, 203,
0103         1, 2, 204,
0104         1, 2, 205,
0105         1, 2, 206,
0106         1, 2, 207,
0107         1, 2, 208,
0108         1, 2, 209,
0109         1, 2, 210,
0110         1, 2, 0, # endLumi
0111         1, 0, 0, # endRun
0112     ]
0113 
0114 process.p = cms.Path(
0115     process.testmerge +
0116     process.test
0117 )