Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:27

0001 
0002 import FWCore.ParameterSet.Config as cms
0003 import sys
0004 
0005 process = cms.Process("TestElectrons")
0006 
0007 process.load("FWCore.MessageService.MessageLogger_cfi")
0008 process.MessageLogger.cerr.FwkReport.reportEvery = 100
0009 
0010 process.load("Configuration.StandardSequences.GeometryDB_cff")
0011 process.load("Configuration.StandardSequences.MagneticField_cff")
0012 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0013 # NOTE: the pick the right global tag!
0014 #    for PHYS14 scenario PU4bx50 : global tag is ???
0015 #    for PHYS14 scenario PU20bx25: global tag is PHYS14_25_V1
0016 #  as a rule, find the global tag in the DAS under the Configs for given dataset
0017 #process.GlobalTag.globaltag = 'PHYS14_25_V1::All'
0018 from Configuration.AlCa.GlobalTag import GlobalTag
0019 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '')
0020 
0021 #
0022 # Define input data to read
0023 #
0024 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1000) )
0025 #AOD test files dataset :/RelValZEE_13/CMSSW_8_0_21-PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/GEN-SIM-RECO
0026 inputFilesAOD = cms.untracked.vstring(
0027     '/store/relval/CMSSW_8_0_21/RelValZEE_13/GEN-SIM-RECO/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/105EBFE7-9198-E611-8604-0025905B85D2.root',
0028 '/store/relval/CMSSW_8_0_21/RelValZEE_13/GEN-SIM-RECO/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/483FD411-9498-E611-9427-0025905B85D2.root',
0029 '/store/relval/CMSSW_8_0_21/RelValZEE_13/GEN-SIM-RECO/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/4ACA8789-A498-E611-A54C-0025905B858E.root',
0030 '/store/relval/CMSSW_8_0_21/RelValZEE_13/GEN-SIM-RECO/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/5A20FA98-9498-E611-9DB0-0CC47A78A33E.root',
0031 '/store/relval/CMSSW_8_0_21/RelValZEE_13/GEN-SIM-RECO/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/6694D992-9098-E611-8461-0CC47A4D768E.root',
0032 '/store/relval/CMSSW_8_0_21/RelValZEE_13/GEN-SIM-RECO/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/7887DD0D-9498-E611-8D98-0CC47A4C8E64.root',
0033 '/store/relval/CMSSW_8_0_21/RelValZEE_13/GEN-SIM-RECO/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/845B6ABD-9098-E611-A2E3-0CC47A78A4BA.root',
0034 '/store/relval/CMSSW_8_0_21/RelValZEE_13/GEN-SIM-RECO/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/A8877C9C-A498-E611-8EFF-0025905A607E.root',
0035 
0036 
0037     #'file:/opt/ppd/scratch/harper/mcTestFiles/ZToEE_NNPDF30_13TeV-powheg_M_200_400_PUSpring16_80X_mcRun2_asymptotic_2016_v3-v2_FE668C0A-8B09-E611-ACDE-B083FED76DBD.root'
0038     )    
0039 #AOD test files dataset :/RelValZEE_13/CMSSW_8_0_21-PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/MINIAODSIM
0040 inputFilesMiniAOD = cms.untracked.vstring(  
0041     '/store/relval/CMSSW_8_0_21/RelValZEE_13/MINIAODSIM/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/0E6B945E-A498-E611-BD29-0CC47A78A30E.root',
0042     '/store/relval/CMSSW_8_0_21/RelValZEE_13/MINIAODSIM/PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/10000/EE70625F-A498-E611-8CC7-0CC47A4D766C.root',
0043     )
0044 
0045 # Set up input/output depending on the format
0046 # You can list here either AOD or miniAOD files, but not both types mixed
0047 #
0048 
0049 print(sys.argv[2])
0050 useAOD = bool(int(sys.argv[2]))
0051 
0052 if useAOD == True :
0053     inputFiles = inputFilesAOD
0054     outputFile = "electron_ntuple.root"
0055     print("AOD input files are used")
0056 else :
0057     inputFiles = inputFilesMiniAOD
0058     outputFile = "electron_ntuple_mini.root"
0059     print("MiniAOD input files are used")
0060 process.source = cms.Source ("PoolSource", fileNames = inputFiles )                             
0061 
0062 #
0063 # Set up electron ID (VID framework)
0064 #
0065 
0066 from PhysicsTools.SelectorUtils.tools.vid_id_tools import *
0067 # turn on VID producer, indicate data format  to be
0068 # DataFormat.AOD or DataFormat.MiniAOD, as appropriate 
0069 if useAOD == True :
0070     dataFormat = DataFormat.AOD
0071 else :
0072     dataFormat = DataFormat.MiniAOD
0073 
0074 switchOnVIDElectronIdProducer(process, dataFormat)
0075 
0076 # define which IDs we want to produce
0077 my_id_modules = [sys.argv[3]]
0078 
0079 #add them to the VID producer
0080 for idmod in my_id_modules:
0081     setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection)
0082 
0083 # Make sure to add the ID sequence upstream from the user analysis module
0084 process.p = cms.Path(process.egmGsfElectronIDSequence)