Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-10 02:51:32

0001 from __future__ import print_function
0002 
0003 import sys
0004 import os
0005 import FWCore.ParameterSet.Config as cms
0006 
0007 print('Number of arguments:', len(sys.argv), 'arguments.')
0008 print('Argument List:', str(sys.argv))
0009 # first arg : cmsRun
0010 # second arg : name of the _cfg file
0011 # third arg : sample name (ex. ZEE_14)
0012 
0013 from electronValidationCheck_Env import env
0014 
0015 cmsEnv = env() # be careful, cmsEnv != cmsenv. cmsEnv is local
0016 
0017 cmsEnv.checkSample() # check the sample value
0018 cmsEnv.checkValues()
0019 
0020 import DQMOffline.EGamma.electronDataDiscovery as dd
0021 
0022 if cmsEnv.beginTag() == 'Run2_2017':
0023     from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
0024     process = cms.Process("electronValidation",Run2_2017)
0025 elif cmsEnv.beginTag() == 'Run3':
0026     from Configuration.Eras.Era_Run3_cff import Run3
0027     process = cms.Process('electronValidation', Run3) 
0028 else:
0029     from Configuration.Eras.Era_Phase2_cff import Phase2
0030     process = cms.Process('electronValidation',Phase2)
0031 
0032 #process.options = cms.untracked.PSet( )
0033 
0034 process.DQMStore = cms.Service("DQMStore")
0035 process.load("DQMServices.Components.DQMStoreStats_cfi")
0036 from DQMServices.Components.DQMStoreStats_cfi import *
0037 dqmStoreStats.runOnEndJob = cms.untracked.bool(True)
0038 
0039 print("reading files ...")
0040 max_number = -1 # number of events
0041 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(max_number))
0042 
0043 data = os.environ['data']
0044 flist = dd.getCMSdata(data)
0045 print(flist)
0046 process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(*flist))
0047 
0048 #process.source = cms.Source ("PoolSource",
0049 #eventsToProcess = cms.untracked.VEventRange('1:2682-1:2682'),
0050 #eventsToProcess = cms.untracked.VEventRange('1:8259-1:8259'),
0051 #eventsToProcess = cms.untracked.VEventRange('1:10-1:10'),
0052 #fileNames = cms.untracked.vstring([
0053 #        'file:PAT_249120E2-D1EC-E611-83C2-0CC47A7C347A.root',
0054 #        'file:PAT_76F9AD07-D3EC-E611-AA87-0CC47A745250.root',
0055 #        'file:PAT_FA0E1D02-D5EC-E611-B8CA-0025905A6080.root',
0056 #        'file:PAT_EE728E01-D5EC-E611-9DC5-0025905A6126.root',
0057 #        '/store/relval/CMSSW_9_1_0_pre2/RelValSingleElectronPt10/MINIAODSIM/90X_upgrade2017_realistic_v20-v1/00000/66B5E60E-5619-E711-8E17-0CC47A4D7632.root',
0058 #        '/store/relval/CMSSW_9_1_0_pre2/RelValSingleElectronPt10/MINIAODSIM/90X_upgrade2017_realistic_v20-v1/00000/BC08FC0E-5619-E711-98E5-0CC47A4D760C.root',
0059 #    ]),
0060 #secondaryFileNames = cms.untracked.vstring() )
0061 #process.source.fileNames.extend(dd.search())
0062 print("reading files done")
0063 
0064 process.load('Configuration.StandardSequences.Services_cff')
0065 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0066 process.load("FWCore.MessageService.MessageLogger_cfi")
0067 process.load('Configuration.EventContent.EventContent_cff')
0068 process.load('SimGeneral.MixingModule.mixNoPU_cfi')
0069 process.load('Configuration.StandardSequences.GeometryDB_cff')
0070 process.load('Configuration.StandardSequences.MagneticField_38T_cff')
0071 process.load('Configuration.StandardSequences.RawToDigi_cff')
0072 process.load('Configuration.StandardSequences.Reconstruction_cff')
0073 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0074 process.load("Configuration.StandardSequences.EDMtoMEAtJobEnd_cff") # new
0075 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0076 
0077 from Configuration.AlCa.autoCond import autoCond
0078 #process.GlobalTag.globaltag = os.environ['TEST_GLOBAL_TAG']#+'::All'
0079 process.GlobalTag.globaltag = '122X_mcRun4_realistic_v1'
0080 #process.GlobalTag.globaltag = '113X_mcRun4_realistic_v4'
0081 #process.GlobalTag.globaltag = '93X_mc2017_realistic_v1'
0082 
0083 # FOR DATA REDONE FROM RAW, ONE MUST HIDE IsoFromDeps
0084 # CONFIGURATION
0085 process.load("Validation.RecoEgamma.electronIsoFromDeps_cff")
0086 process.load("Validation.RecoEgamma.ElectronIsolation_cfi")
0087 process.load("Validation.RecoEgamma.ElectronMcSignalValidatorMiniAOD_cfi")
0088 
0089 print("miniAODElectronIsolation call")
0090 from Validation.RecoEgamma.electronValidationSequenceMiniAOD_cff import miniAODElectronIsolation # as _ElectronIsolationCITK
0091 process.miniAODElectronIsolation = miniAODElectronIsolation
0092 print("miniAODElectronIsolation clone done")
0093 
0094 # load DQM
0095 process.load("DQMServices.Core.DQM_cfg")
0096 process.load("DQMServices.Components.DQMEnvironment_cfi")
0097 
0098 #process.printContent = printContent
0099 
0100 process.EDM = cms.OutputModule("PoolOutputModule",
0101 outputCommands = cms.untracked.vstring('drop *',"keep *_MEtoEDMConverter_*_*"),
0102 #fileName = cms.untracked.string(TEST_HISTOS_FILE)
0103 fileName = cms.untracked.string(os.environ['outputFile'])#.replace(".root", "_a.root"))
0104 )
0105 
0106 process.electronMcSignalValidatorMiniAOD.InputFolderName = cms.string("EgammaV/ElectronMcSignalValidatorMiniAOD")
0107 process.electronMcSignalValidatorMiniAOD.OutputFolderName = cms.string("EgammaV/ElectronMcSignalValidatorMiniAOD")
0108 
0109 #process.p = cms.Path(process.ElectronIsolation * process.electronMcSignalValidatorMiniAOD * process.MEtoEDMConverter ) # * process.dqmStoreStats
0110 #process.p = cms.Path(process.electronMcSignalValidatorMiniAOD * process.MEtoEDMConverter * process.dqmStoreStats)
0111 process.p = cms.Path( process.miniAODElectronIsolation * process.ElectronIsolation * process.electronMcSignalValidatorMiniAOD * process.MEtoEDMConverter ) #  process.printContent *
0112 process.outpath = cms.EndPath(
0113 process.EDM,
0114 )