File indexing completed on 2024-06-13 03:23:10
0001 import os
0002 import FWCore.ParameterSet.Config as cms
0003
0004
0005
0006
0007 process = cms.Process("ApeSkim")
0008
0009
0010
0011
0012 import FWCore.ParameterSet.VarParsing as VarParsing
0013 import sys
0014 options = VarParsing.VarParsing ('standard')
0015 options.register('fileList', None, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "File list name")
0016 options.register('outputName', None, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Output file name")
0017 options.register('trackSelection', "MinBias", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Track selection")
0018 options.register('globalTag', None, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Global Tag")
0019
0020 options.register('maxFileSize', 350000, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "Max number of events to be processed")
0021
0022
0023 options.parseArguments()
0024
0025
0026
0027
0028
0029
0030 process.load("FWCore.MessageService.MessageLogger_cfi")
0031 process.MessageLogger.AlignmentTrackSelector=dict()
0032 process.MessageLogger.cerr.INFO.limit = 0
0033 process.MessageLogger.cerr.default.limit = -1
0034 process.MessageLogger.cerr.AlignmentTrackSelector = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0035 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
0036
0037
0038
0039
0040 process.options = cms.untracked.PSet(
0041 wantSummary = cms.untracked.bool(True),
0042 )
0043
0044
0045
0046
0047
0048
0049 outputName = "{}.root".format(options.outputName)
0050 outputFileSize = options.maxFileSize
0051 trackSelection = options.trackSelection
0052 globalTag = options.globalTag
0053 maxEvents = options.maxEvents
0054
0055
0056
0057
0058 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0059 from Configuration.AlCa.GlobalTag import GlobalTag
0060 process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '')
0061 print("Using global tag "+process.GlobalTag.globaltag._value)
0062
0063 process.load("Configuration.StandardSequences.Services_cff")
0064 process.load("Configuration.Geometry.GeometryRecoDB_cff")
0065 process.load("Configuration.StandardSequences.MagneticField_cff")
0066 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
0067
0068 import importlib
0069 conditions = importlib.import_module("Alignment.APEEstimation.conditions.dataset_{}_cff".format(options.outputName))
0070 conditions.applyConditions(process)
0071
0072 path, fn = os.path.split(options.fileList)
0073 import sys
0074 sys.path.append(path)
0075 fileList = importlib.import_module(fn.split(".")[0])
0076 process.source = fileList.source
0077
0078
0079
0080
0081
0082 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(maxEvents) )
0083
0084
0085
0086
0087 import Alignment.APEEstimation.AlignmentTrackSelector_cff as AlignmentTrackSelector
0088
0089
0090 if trackSelection in ["SingleMu", "SingleMuon"]:
0091 trackSelector = AlignmentTrackSelector.MuSkimSelector
0092 elif trackSelection == "GenSim":
0093 trackSelector = AlignmentTrackSelector.genSimSkimSelector
0094 elif trackSelection in ["DoubleMu", "DoubleMuon"]:
0095 trackSelector = AlignmentTrackSelector.DoubleMuSkimSelector
0096 elif trackSelection in ["MinBias", "MinimumBias"]:
0097 trackSelector = AlignmentTrackSelector.MinBiasSkimSelector
0098 elif trackSelection == "Cosmics":
0099 trackSelector = AlignmentTrackSelector.CosmicsSkimSelector
0100 else:
0101 print("Unknown trackSelection %s, exiting"%(trackSelection))
0102 exit(1)
0103
0104 process.MuSkim = trackSelector
0105
0106 import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
0107 process.seqTrackselRefit = trackselRefit.getSequence(process, trackSelector.src.getModuleLabel())
0108
0109
0110
0111
0112
0113 process.path = cms.Path(
0114 process.offlineBeamSpot*
0115 process.seqTrackselRefit*
0116 process.MuSkim
0117 )
0118
0119
0120
0121
0122 EventSelection = cms.PSet(
0123 SelectEvents = cms.untracked.PSet(
0124 SelectEvents = cms.vstring('path')
0125 )
0126 )
0127
0128
0129
0130
0131
0132 process.out = cms.OutputModule("PoolOutputModule",
0133
0134 fileName = cms.untracked.string(outputName),
0135
0136 maxSize = cms.untracked.int32(outputFileSize),
0137 dropMetaData = cms.untracked.string("DROPPED"),
0138
0139 SelectEvents = EventSelection.SelectEvents,
0140 outputCommands = cms.untracked.vstring(
0141 'drop *',
0142 ),
0143 )
0144 process.load("Alignment.APEEstimation.PrivateSkim_EventContent_cff")
0145 process.out.outputCommands.extend(process.ApeSkimEventContent.outputCommands)
0146
0147
0148
0149
0150
0151 process.outpath = cms.EndPath(process.out)