Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:44

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_2023',
0038                  'Run3_noMkFit',
0039                  'Run3_pp_on_PbPb',
0040                  'Run3_pp_on_PbPb_approxSiStripClusters',
0041                  'Run3_pp_on_PbPb_2023',
0042                  'Run3_pp_on_PbPb_approxSiStripClusters_2023',
0043                  'Run3_dd4hep',
0044                  'Run3_DDD',
0045                  'Run3_FastSim',
0046                  'Run3_2023_FastSim',
0047                  'Run3_2023_ZDC',
0048                  'Run3_2023_UPC',
0049                  'Run3_2024_ppRef',
0050                  'Run3_UPC',
0051                  'Phase2',
0052                  'Phase2C9',
0053                  'Phase2C10',
0054                  'Phase2C11',
0055                  'Phase2C12',
0056                  'Phase2C9_dd4hep',
0057                  'Phase2C10_dd4hep',
0058                  'Phase2C11_dd4hep',
0059                  'Phase2C11I13',
0060                  'Phase2C12_dd4hep',
0061                  'Phase2C11M9',
0062                  'Phase2C11I13M9',
0063                  'Phase2C11I13T25M9',
0064                  'Phase2C11I13T26M9',
0065                  'Phase2C17I13M9',
0066                  'Phase2C20I13M9',
0067                  'Phase2C22I13M9'
0068         ]
0069 
0070         internalUseMods = ['run2_common', 'run2_25ns_specific',
0071                            'run2_50ns_specific', 'run2_HI_specific',
0072                            'stage1L1Trigger', 'fastSim',
0073                            'peripheralPbPb', 'pA_2016',
0074                            'run2_HE_2017', 'stage2L1Trigger', 'stage2L1Trigger_2017', 'stage2L1Trigger_2018', 'stage2L1Trigger_2021',
0075                            'run2_HF_2017', 'run2_HCAL_2017', 'run2_HEPlan1_2017', 'run2_HB_2018','run2_HE_2018',
0076                            'run3_HB', 'run3_HFSL', 'run3_common', 'run3_RPC',
0077                            'phase1Pixel', 'run3_GEM', 'run2_GEM_2017',
0078                            'run2_CSC_2018',
0079                            'phase2_common', 'phase2_tracker',
0080                            'phase2_muon', 'phase2_GEM', 'phase2_GE0',
0081                            'phase2_hgcal', 'phase2_timing', 'phase2_hfnose', 'phase2_hgcalV10', 'phase2_hgcalV11', 'phase2_hgcalV12',
0082                            'phase2_timing_layer', 'phase2_etlV4', 'phase2_hcal', 'phase2_ecal','phase2_ecal_devel', 'phase2_ecalTP_devel',
0083                            'phase2_trigger',
0084                            'phase2_squarePixels', 'phase2_3DPixels',
0085                            'trackingLowPU', 'trackingPhase1',
0086                            'ctpps', 'ctpps_2016', 'ctpps_2017', 'ctpps_2018', 'ctpps_2022',
0087                            'trackingPhase2PU140','highBetaStar_2018',
0088                            'tracker_apv_vfp30_2016', 'pf_badHcalMitigationOff',
0089                            'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17',
0090                            'run3_miniAOD_12X',
0091                            'run2_nanoAOD_106Xv2',
0092                            'run3_nanoAOD_122', 'run3_nanoAOD_124',
0093                            'run3_ecal_devel',
0094                            'run3_upc',
0095                            'hcalHardcodeConditions', 'hcalSkipPacker',
0096                            'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018',
0097                            'bParking']
0098         internalUseModChains = ['run2_2017_noTrackingModifier', 'trackingMkFitProd']
0099 
0100         self.pythonCfgLines = {}
0101 
0102         for e in allEras:
0103             eObj=getattr(__import__('Configuration.Eras.Era_'+e+'_cff',globals(),locals(),[e],0),e)
0104             self.addEra(e,eObj)
0105             self.pythonCfgLines[e] = 'from Configuration.Eras.Era_'+e+'_cff import '+e
0106 
0107         for e in internalUseMods:
0108             eObj=getattr(__import__('Configuration.Eras.Modifier_'+e+'_cff',globals(),locals(),[e],0),e)
0109             self.addEra(e,eObj)
0110             self.pythonCfgLines[e] = 'from Configuration.Eras.Modifier_'+e+'_cff import '+e
0111 
0112         for e in internalUseModChains:
0113             eObj=getattr(__import__('Configuration.Eras.ModifierChain_'+e+'_cff',globals(),locals(),[e],0),e)
0114             self.addEra(e,eObj)
0115             self.pythonCfgLines[e] = 'from Configuration.Eras.ModifierChain_'+e+'_cff import '+e
0116 
0117 
0118     def addEra(self,name,obj):
0119         setattr(self,name,obj)
0120 
0121     def inspectModifier(self,m,details):
0122         print('      ',m.__dict__ ['_Modifier__processModifiers'])
0123 
0124     def inspectEra(self,e,details):
0125         print('\nEra:',e)
0126         print('   isChosen:',getattr(self,e)._isChosen())
0127         if details: print('   Modifiers:')
0128         nmod=0
0129         for value in getattr(self,e).__dict__['_ModifierChain__chain']:
0130             if isinstance(value, Modifier):
0131                 nmod=nmod+1
0132                 if details: self.inspectModifier(value,details)
0133         print('   ',nmod,'modifiers defined')
0134 
0135     def inspect(self,name=None,onlyChosen=False,details=True):
0136         if name==None:
0137             print('Inspecting the known eras', end=' ')
0138             if onlyChosen: print(' (all active)')
0139             else: print('(all eras defined)')
0140         else:
0141             print('Inspecting the '+name+' era', end=' ')
0142 
0143         allEras=[]
0144         for key, value in self.__dict__.items():
0145             if isinstance(value, ModifierChain): allEras.append(key)
0146 
0147         for e in allEras:
0148             if name is not None and name==e:
0149                 self.inspectEra(e,details)
0150             if name is None:
0151                 if not onlyChosen or getattr(self,e).isChosen():
0152                     self.inspectEra(e,details)
0153 
0154 eras=Eras()
0155 
0156 
0157 #eras.inspect()