Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-19 01:11:40

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 from  FWCore.ParameterSet.Config import ModifierChain,Modifier
0004 
0005 class Eras (object):
0006     """
0007     Dummy container for all the cms.Modifier instances that config fragments
0008     can use to selectively configure depending on what scenario is active.
0009     """
0010     def __init__(self):
0011         allEras=['Run1_pA',
0012                  'Run1_peripheralPbPb',
0013                  'Run2_50ns',
0014                  'Run2_50ns_HIPM',
0015                  'Run2_25ns',
0016                  'Run2_25ns_HIPM',
0017                  'Run2_25ns_peripheralPbPb',
0018                  'Run2_HI',
0019                  'Run2_2016',
0020                  'Run2_2016_HIPM',
0021                  'Run2_2016_trackingLowPU',
0022                  'Run2_2016_pA',
0023                  'Run2_2017',
0024                  'Run2_2017_noMkFit',
0025                  'Run2_2017_FastSim', #new modifier for Phase1 FastSim, skips the muon GEM sequence
0026                  'Run2_2017_trackingRun2',
0027                  'Run2_2017_trackingLowPU',
0028                  'Run2_2017_pp_on_XeXe',
0029                  'Run2_2017_ppRef',
0030                  'Run2_2018',
0031                  'Run2_2018_FastSim', #new modifier for Phase1 FastSim, skips the muon GEM sequence
0032                  'Run2_2018_pp_on_AA',
0033                  'Run2_2018_pp_on_AA_noHCALmitigation',
0034                  'Run2_2018_highBetaStar',
0035                  'Run2_2018_noMkFit',
0036                  'Run3',
0037                  'Run3_noMkFit',
0038                  'Run3_pp_on_PbPb',
0039                  'Run3_dd4hep',
0040                  'Run3_DDD',
0041                  'Run3_FastSim',
0042                  'Phase2',
0043                  'Phase2C9',
0044                  'Phase2C10',
0045                  'Phase2C11',
0046                  'Phase2C12',
0047                  'Phase2C9_dd4hep',
0048                  'Phase2C10_dd4hep',
0049                  'Phase2C11_dd4hep',
0050                  'Phase2C11I13',
0051                  'Phase2C12_dd4hep',
0052                  'Phase2C11M9',
0053                  'Phase2C11I13M9',
0054                  'Phase2C11I13T25M9',
0055                  'Phase2C11I13T26M9',
0056                  'Phase2C11I13T29M9',
0057                  'Phase2C17I13M9'
0058         ]
0059 
0060         internalUseMods = ['run2_common', 'run2_25ns_specific',
0061                            'run2_50ns_specific', 'run2_HI_specific',
0062                            'stage1L1Trigger', 'fastSim',
0063                            'peripheralPbPb', 'pA_2016',
0064                            'run2_HE_2017', 'stage2L1Trigger', 'stage2L1Trigger_2017', 'stage2L1Trigger_2018', 'stage2L1Trigger_2021',
0065                            'run2_HF_2017', 'run2_HCAL_2017', 'run2_HEPlan1_2017', 'run2_HB_2018','run2_HE_2018', 
0066                            'run3_HB', 'run3_HFSL', 'run3_common', 'run3_RPC',
0067                            'phase1Pixel', 'run3_GEM', 'run2_GEM_2017',
0068                            'run2_CSC_2018',
0069                            'phase2_common', 'phase2_tracker',
0070                            'phase2_muon', 'phase2_GEM', 'phase2_GE0',
0071                            'phase2_hgcal', 'phase2_timing', 'phase2_hfnose', 'phase2_hgcalV10', 'phase2_hgcalV11', 'phase2_hgcalV12',
0072                            'phase2_timing_layer', 'phase2_etlV4', 'phase2_hcal', 'phase2_ecal','phase2_ecal_devel',
0073                            'phase2_trigger',
0074                            'phase2_squarePixels', 'phase2_3DPixels', 'phase2_brickedPixels',
0075                            'trackingLowPU', 'trackingPhase1', 'ctpps', 'ctpps_2016', 'ctpps_2017', 'ctpps_2018', 'ctpps_2021', 'trackingPhase2PU140','highBetaStar_2018',
0076                            'tracker_apv_vfp30_2016', 'pf_badHcalMitigationOff', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X',
0077                            'run2_nanoAOD_94XMiniAODv1', 'run2_nanoAOD_94XMiniAODv2', 'run2_nanoAOD_94X2016',
0078                            'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'run2_nanoAOD_106Xv2', 'run3_nanoAOD_devel',
0079                            'hcalHardcodeConditions', 'hcalSkipPacker',
0080                            'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018',
0081                            'bParking']
0082         internalUseModChains = ['run2_2017_noTrackingModifier', 'trackingMkFitProd']
0083 
0084         self.pythonCfgLines = {}
0085 
0086         for e in allEras:
0087             eObj=getattr(__import__('Configuration.Eras.Era_'+e+'_cff',globals(),locals(),[e],0),e)
0088             self.addEra(e,eObj)
0089             self.pythonCfgLines[e] = 'from Configuration.Eras.Era_'+e+'_cff import '+e
0090 
0091         for e in internalUseMods:
0092             eObj=getattr(__import__('Configuration.Eras.Modifier_'+e+'_cff',globals(),locals(),[e],0),e)
0093             self.addEra(e,eObj)
0094             self.pythonCfgLines[e] = 'from Configuration.Eras.Modifier_'+e+'_cff import '+e
0095 
0096         for e in internalUseModChains:
0097             eObj=getattr(__import__('Configuration.Eras.ModifierChain_'+e+'_cff',globals(),locals(),[e],0),e)
0098             self.addEra(e,eObj)
0099             self.pythonCfgLines[e] = 'from Configuration.Eras.ModifierChain_'+e+'_cff import '+e
0100 
0101 
0102     def addEra(self,name,obj):
0103         setattr(self,name,obj)
0104 
0105     def inspectModifier(self,m,details):
0106         print('      ',m.__dict__ ['_Modifier__processModifiers'])
0107 
0108     def inspectEra(self,e,details):
0109         print('\nEra:',e)
0110         print('   isChosen:',getattr(self,e)._isChosen())
0111         if details: print('   Modifiers:')
0112         nmod=0
0113         for value in getattr(self,e).__dict__['_ModifierChain__chain']:
0114             if isinstance(value, Modifier):
0115                 nmod=nmod+1
0116                 if details: self.inspectModifier(value,details)
0117         print('   ',nmod,'modifiers defined')
0118 
0119     def inspect(self,name=None,onlyChosen=False,details=True):
0120         if name==None:
0121             print('Inspecting the known eras', end=' ')
0122             if onlyChosen: print(' (all active)')
0123             else: print('(all eras defined)')
0124         else:
0125             print('Inspecting the '+name+' era', end=' ')
0126 
0127         allEras=[]
0128         for key, value in self.__dict__.items():
0129             if isinstance(value, ModifierChain): allEras.append(key)
0130 
0131         for e in allEras:
0132             if name is not None and name==e:
0133                 self.inspectEra(e,details)
0134             if name is None:
0135                 if not onlyChosen or getattr(self,e).isChosen():
0136                     self.inspectEra(e,details)
0137 
0138 eras=Eras()
0139 
0140 
0141 #eras.inspect()