Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-15 23:01:02

0001 import FWCore.ParameterSet.Config as cms
0002 from  FWCore.ParameterSet.Config import ModifierChain,Modifier
0003 
0004 class Eras (object):
0005     """
0006     Dummy container for all the cms.Modifier instances that config fragments
0007     can use to selectively configure depending on what scenario is active.
0008     """
0009     def __init__(self):
0010         allEras=['Run1_pA',
0011                  'Run1_peripheralPbPb',
0012                  'Run2_50ns',
0013                  'Run2_50ns_HIPM',
0014                  'Run2_25ns',
0015                  'Run2_25ns_HIPM',
0016                  'Run2_25ns_peripheralPbPb',
0017                  'Run2_HI',
0018                  'Run2_2016',
0019                  'Run2_2016_HIPM',
0020                  'Run2_2016_trackingLowPU',
0021                  'Run2_2016_pA',
0022                  'Run2_2016_UPC',
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_2024',
0039                  'Run3_2025',
0040                  'Run3_noMkFit',
0041                  'Run3_pp_on_PbPb',
0042                  'Run3_pp_on_PbPb_approxSiStripClusters',
0043                  'Run3_pp_on_PbPb_2023',
0044                  'Run3_pp_on_PbPb_approxSiStripClusters_2023',
0045                  'Run3_pp_on_PbPb_2024',
0046                  'Run3_pp_on_PbPb_approxSiStripClusters_2024',
0047                  'Run3_pp_on_PbPb_2025',
0048                  'Run3_pp_on_PbPb_approxSiStripClusters_2025',
0049                  'Run3_dd4hep',
0050                  'Run3_DDD',
0051                  'Run3_FastSim',
0052                  'Run3_2023_FastSim',
0053                  'Run3_2023_ZDC',
0054                  'Run3_2023_UPC',
0055                  'Run3_2024_ppRef',
0056                  'Run3_2024_UPC',
0057                  'Run3_2024_FastSim',
0058                  'Run3_2025_UPC',
0059                  'Run3_2025_OXY',
0060                  'Run3_2025_UPC_OXY',
0061                  'Run3_2025_FastSim',
0062                  'Phase2',
0063                  'Phase2_noMkFit',
0064                  'Phase2C9',
0065                  'Phase2C9_noMkFit',
0066                  'Phase2C10',
0067                  'Phase2C10_noMkFit',
0068                  'Phase2C11',
0069                  'Phase2C11_noMkFit',
0070                  'Phase2C12',
0071                  'Phase2C12_noMkFit',
0072                  'Phase2C9_dd4hep',
0073                  'Phase2C9_dd4hep_noMkFit',
0074                  'Phase2C10_dd4hep',
0075                  'Phase2C10_dd4hep_noMkFit',
0076                  'Phase2C11_dd4hep',
0077                  'Phase2C11_dd4hep_noMkFit',
0078                  'Phase2C11I13',
0079                  'Phase2C11I13_noMkFit',
0080                  'Phase2C12_dd4hep',
0081                  'Phase2C12_dd4hep_noMkFit',
0082                  'Phase2C11M9',
0083                  'Phase2C11M9_noMkFit',
0084                  'Phase2C11I13M9',
0085                  'Phase2C11I13M9_noMkFit',
0086                  'Phase2C11I13T25M9',
0087                  'Phase2C11I13T25M9_noMkFit',
0088                  'Phase2C11I13T26M9',
0089                  'Phase2C11I13T26M9_noMkFit',
0090                  'Phase2C17I13M9',
0091                  'Phase2C17I13M9_noMkFit',
0092                  'Phase2C20I13M9',
0093                  'Phase2C20I13M9_noMkFit', 
0094                  'Phase2C22I13M9',
0095                  'Phase2C22I13M9_noMkFit',
0096                  'Phase2C26I13M9',
0097                  'Phase2C26I13M9_noMkFit'
0098         ]
0099 
0100         internalUseMods = ['run2_common', 'run2_25ns_specific',
0101                            'run2_50ns_specific', 'run2_HI_specific',
0102                            'stage1L1Trigger', 'fastSim',
0103                            'peripheralPbPb', 'pA_2016',
0104                            'run2_HE_2017', 'stage2L1Trigger', 'stage2L1Trigger_2017', 'stage2L1Trigger_2018', 'stage2L1Trigger_2021',
0105                            'run2_HF_2017', 'run2_HCAL_2017', 'run2_HEPlan1_2017', 'run2_HB_2018','run2_HE_2018',
0106                            'run3_HB', 'run3_HFSL', 'run3_common', 'run3_RPC',
0107                            'phase1Pixel', 'run3_GEM', 'run2_GEM_2017',
0108                            'run3_SiPixel_2025',
0109                            'run2_CSC_2018',
0110                            'phase2_common', 'phase2_tracker',
0111                            'phase2_muon', 'phase2_GEM', 'phase2_GE0',
0112                            'phase2_hgcal', 'phase2_timing', 'phase2_hfnose', 'phase2_hgcalV10', 'phase2_hgcalV11', 'phase2_hgcalV12',
0113                            'phase2_timing_layer', 'phase2_etlV4', 'phase2_hcal', 'phase2_ecal','phase2_ecal_devel', 'phase2_ecalTP_devel',
0114                            'phase2_trigger',
0115                            'phase2_squarePixels', 'phase2_3DPixels',
0116                            'trackingLowPU', 'trackingPhase1',
0117                            'ctpps', 'ctpps_2016', 'ctpps_2017', 'ctpps_2018', 'ctpps_2022',
0118                            'trackingPhase2PU140','highBetaStar',
0119                            'tracker_apv_vfp30_2016', 'pf_badHcalMitigationOff',
0120                            'run2_nanoAOD_106Xv2',
0121                            'run3_nanoAOD_pre142X',
0122                            'run3_ecal_devel',
0123                            'run3_upc', 'run3_oxygen',
0124                            'hcalHardcodeConditions', 'hcalSkipPacker',
0125                            'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018',
0126                            'bParking']
0127         internalUseModChains = ['run2_2017_noTrackingModifier', 'trackingMkFitProd']
0128 
0129         self.pythonCfgLines = {}
0130 
0131         for e in allEras:
0132             eObj=getattr(__import__('Configuration.Eras.Era_'+e+'_cff',globals(),locals(),[e],0),e)
0133             self.addEra(e,eObj)
0134             self.pythonCfgLines[e] = 'from Configuration.Eras.Era_'+e+'_cff import '+e
0135 
0136         for e in internalUseMods:
0137             eObj=getattr(__import__('Configuration.Eras.Modifier_'+e+'_cff',globals(),locals(),[e],0),e)
0138             self.addEra(e,eObj)
0139             self.pythonCfgLines[e] = 'from Configuration.Eras.Modifier_'+e+'_cff import '+e
0140 
0141         for e in internalUseModChains:
0142             eObj=getattr(__import__('Configuration.Eras.ModifierChain_'+e+'_cff',globals(),locals(),[e],0),e)
0143             self.addEra(e,eObj)
0144             self.pythonCfgLines[e] = 'from Configuration.Eras.ModifierChain_'+e+'_cff import '+e
0145 
0146 
0147     def addEra(self,name,obj):
0148         setattr(self,name,obj)
0149 
0150     def inspectModifier(self,m,details):
0151         print('      ',m.__dict__ ['_Modifier__processModifiers'])
0152 
0153     def inspectEra(self,e,details):
0154         print('\nEra:',e)
0155         print('   isChosen:',getattr(self,e)._isChosen())
0156         if details: print('   Modifiers:')
0157         nmod=0
0158         for value in getattr(self,e).__dict__['_ModifierChain__chain']:
0159             if isinstance(value, Modifier):
0160                 nmod=nmod+1
0161                 if details: self.inspectModifier(value,details)
0162         print('   ',nmod,'modifiers defined')
0163 
0164     def inspect(self,name=None,onlyChosen=False,details=True):
0165         if name==None:
0166             print('Inspecting the known eras', end=' ')
0167             if onlyChosen: print(' (all active)')
0168             else: print('(all eras defined)')
0169         else:
0170             print('Inspecting the '+name+' era', end=' ')
0171 
0172         allEras=[]
0173         for key, value in self.__dict__.items():
0174             if isinstance(value, ModifierChain): allEras.append(key)
0175 
0176         for e in allEras:
0177             if name is not None and name==e:
0178                 self.inspectEra(e,details)
0179             if name is None:
0180                 if not onlyChosen or getattr(self,e).isChosen():
0181                     self.inspectEra(e,details)
0182 
0183 eras=Eras()
0184 
0185 
0186 #eras.inspect()