Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:19

0001 #!/usr/bin/env python3
0002 """
0003 Configuration file to be used as input in unit tests of the utility hltFindDuplicates.
0004 
0005 The configuration is made of modules labelled "d*" and "m*".
0006 
0007 Details on the configuration.
0008  - For each group of modules (d* and m*),
0009    - modules are ordered in 3 levels (e.g. d1*, d2*, d3*), and
0010    - for every level, there are two versions (*x and *y) of the module (e.g. d1x, d1y).
0011  - The *x (*y) modules depend only on *x (*y) modules, and not on *y (*x) modules.
0012  - The *2* modules depend on *1* modules.
0013  - The *3* modules depend on *1* and *2* modules.
0014  - The m* modules are the counterparts of the d* modules.
0015    - The m* modules do not depend on d* modules (and viceversa).
0016    - A given m{1,2,3}{x,y} module may or may not be a duplicate of the corresponding d* module.
0017 
0018 The --mode option determines how the ED modules are configured.
0019 
0020   - mode == 0:
0021      the m* modules are duplicates of the corresponding d* modules.
0022 
0023   - mode == 1:
0024      one parameter in m1y is changed compared to d1y
0025      and this makes all the m*y modules unique,
0026      while the m*x modules should ultimately
0027      be identified as duplicates of the d*x modules.
0028 """
0029 import FWCore.ParameterSet.Config as cms
0030 
0031 import os
0032 import argparse
0033 
0034 parser = argparse.ArgumentParser(
0035     prog = 'python3 '+os.path.basename(__file__),
0036     formatter_class = argparse.RawDescriptionHelpFormatter,
0037     description = __doc__,
0038     argument_default = argparse.SUPPRESS,
0039 )
0040 
0041 parser.add_argument("--mode",
0042     type = int,
0043     default = 0,
0044     choices = [0,1],
0045     help = "Choose how to configure the modules."
0046 )
0047 
0048 args,_ = parser.parse_known_args()
0049 
0050 process = cms.Process('TEST')
0051 
0052 ### "d*" modules: the duplicates
0053 ###  - the *x (*y) modules depend only on *x (*y) modules, and not on *y (*x) modules
0054 ###  - the *2* modules depend on *1* modules
0055 ###  - the *3* modules depend on *1* and *2* modules
0056 process.d1x = cms.EDProducer('P1',
0057     p1 = cms.InputTag('rawDataCollector'),
0058     p2 = cms.bool(False),
0059     p3 = cms.vbool(False, True),
0060     p4 = cms.uint32(1),
0061     p5 = cms.vuint32(1,2,3),
0062     p6 = cms.int32(-1),
0063     p7 = cms.vint32(-1,2,-3),
0064     p8 = cms.double(1.1),
0065     p9 = cms.vdouble(2.3, 4.5)
0066 )
0067 
0068 process.d1y = process.d1x.clone()
0069 
0070 process.d2x = cms.EDFilter('F2',
0071     p1 = cms.vint32(1, 2, 3),
0072     p2 = cms.VInputTag('d1x'),
0073     p3 = cms.PSet(
0074         theStrings = cms.vstring('keyword1', 'keyword2')
0075     )
0076 )
0077 
0078 process.d2y = process.d2x.clone( p2 = ['d1y'] )
0079 
0080 process.d3x = cms.EDAnalyzer('A3',
0081     p1 = cms.VPSet(
0082         cms.PSet(
0083             pset_a = cms.PSet(
0084                 tag1 = cms.InputTag('d1x')
0085             ),
0086             pset_b = cms.PSet(
0087                 tag2 = cms.InputTag('d2x')
0088             ),
0089         )
0090     ),
0091     p2 = cms.PSet(
0092         p_a = cms.PSet(
0093             p_b = cms.PSet(
0094                 p_c = cms.VInputTag('d2x', 'd1x')
0095             )
0096         )
0097     )
0098 )
0099 
0100 process.d3y = process.d3x.clone()
0101 process.d3y.p1[0].pset_a.tag1 = 'd1y'
0102 process.d3y.p1[0].pset_b.tag2 = 'd2y'
0103 process.d3y.p2.p_a.p_b.p_c = ['d2y', 'd1y']
0104 
0105 ### m* modules
0106 ###  - the m* modules are the counterparts of the d* modules
0107 ###  - m* modules do not depend on d* modules (and viceversa)
0108 ###  - if the mode "unique-m*y" is chosen,
0109 ###    one parameter in m1y is changed compared to d1y
0110 ###    and this makes all the m*y modules unique,
0111 ###    while the m*x modules should ultimately
0112 ###    be flagged as duplicates of the d*x modules
0113 process.m1x = process.d1x.clone()
0114 
0115 if args.mode == 0:
0116     process.m1y = process.d1y.clone()
0117 elif args.mode == 1:
0118     process.m1y = process.d1y.clone( p2 = True )
0119 
0120 process.m2x = process.d2x.clone( p2 = ['m1x'] )
0121 process.m2y = process.d2y.clone( p2 = ['m1y'] )
0122 process.m3x = process.d3x.clone()
0123 
0124 process.m3x.p1[0].pset_a.tag1 = 'm1x'
0125 process.m3x.p1[0].pset_b.tag2 = 'm2x'
0126 process.m3x.p2.p_a.p_b.p_c = ['m2x', 'm1x']
0127 
0128 process.m3y = process.d3y.clone()
0129 process.m3y.p1[0].pset_a.tag1 = 'm1y'
0130 process.m3y.p1[0].pset_b.tag2 = 'm2y'
0131 process.m3y.p2.p_a.p_b.p_c = ['m2y', 'm1y']