Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation/RecoEgamma Code simplification v1 #36393

Merged
merged 9 commits into from
Dec 9, 2021
303 changes: 111 additions & 192 deletions Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e
}

// supercluster related distributions
if (isEEflag) {
else if (isEEflag) {
h1_scl_SigIEtaIEta_mAOD_endcaps->Fill(bestGsfElectron.scSigmaIEtaIEta());
h1_ele_dEtaSc_propVtx_mAOD_endcaps->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
h1_ele_dPhiCl_propOut_mAOD_endcaps->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void ElectronMcSignalPostValidator::finalize(DQMStore::IBooker& iBooker, DQMStor
bookH1andDivide(iBooker, iGetter, "absetaEff", "mc_AbsEta_matched", "mc_AbsEta", "|#eta|", "Efficiency", "");
bookH1andDivide(iBooker, iGetter, "ptEff", "mc_Pt_matched", "mc_Pt", "p_{T} (GeV/c)", "Efficiency", "");
bookH1andDivide(iBooker, iGetter, "phiEff", "mc_Phi_matched", "mc_Phi", "#phi (rad)", "Efficiency", "");
bookH2andDivide(iBooker, iGetter, "ptEtaEff", "mc_PtEta_matched", "mc_PtEta", "#eta", "p_{T} (GeV/c)", "");
//bookH2andDivide(iBooker, iGetter, "ptEtaEff", "mc_PtEta_matched", "mc_PtEta", "#eta", "p_{T} (GeV/c)", "");

edm::LogInfo("ElectronMcSignalPostValidator::finalize") << "q-misid calculation";
bookH1andDivide(iBooker, iGetter, "etaQmisid", "mc_Eta_matched_qmisid", "mc_Eta", "#eta", "q misId", "");
Expand Down
399 changes: 149 additions & 250 deletions Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion Validation/RecoEgamma/test/ElectronMcFakePostValidation_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
if cmsEnv.beginTag() == 'Run2_2017':
from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
process = cms.Process("electronPostValidation",Run2_2017)
elif cmsEnv.beginTag() == 'Run3':
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process('electronValidation', Run3)
else:
from Configuration.Eras.Era_Phase2_cff import Phase2
process = cms.Process('electronPostValidation',Phase2)
Expand All @@ -34,10 +37,22 @@
from DQMServices.Components.DQMStoreStats_cfi import *
dqmStoreStats.runOnEndJob = cms.untracked.bool(True)

# others
# import of standard configurations
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2026D76Reco_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.StandardSequences.DQMSaverAtRunEnd_cff')
process.load('Configuration.StandardSequences.Harvesting_cff')

process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))

print('= inputPostFile : %s' % os.environ['inputPostFile'])
t1 = os.environ['inputPostFile'].split('.')
localFileInput = os.environ['inputPostFile'].replace(".root", "_a.root") #
localFileInput = os.environ['inputPostFile']#.replace(".root", "_a.root") #
# Source
process.source = cms.Source ("PoolSource",fileNames = cms.untracked.vstring("file:" + localFileInput),
secondaryFileNames = cms.untracked.vstring(),)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
from __future__ import print_function

import sys
import os
import DQMOffline.EGamma.electronDataDiscovery as dd
import FWCore.ParameterSet.Config as cms

print('Number of arguments:', len(sys.argv), 'arguments.')
print('Argument List:', str(sys.argv))
# first arg : cmsRun
# second arg : name of the _cfg file
# third arg : sample name (ex. ZEE_14)

from electronValidationCheck_Env import env

cmsEnv = env() # be careful, cmsEnv != cmsenv. cmsEnv is local

cmsEnv.checkSample() # check the sample value
cmsEnv.checkValues()

import DQMOffline.EGamma.electronDataDiscovery as dd

if cmsEnv.beginTag() == 'Run2_2017':
from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
process = cms.Process("electronValidation",Run2_2017)
process = cms.Process("electronValidation", Run2_2017)
elif cmsEnv.beginTag() == 'Run3':
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process('electronValidation', Run3)
else:
from Configuration.Eras.Era_Phase2_cff import Phase2
process = cms.Process('electronValidation',Phase2)
process = cms.Process('electronValidation', Phase2)

process.DQMStore = cms.Service("DQMStore")
process.load("DQMServices.Components.DQMStoreStats_cfi")
from DQMServices.Components.DQMStoreStats_cfi import *

dqmStoreStats.runOnEndJob = cms.untracked.bool(True)

#max_skipped = 165
max_number = -1 # 10 # number of events
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(max_number))
#process.source = cms.Source ("PoolSource",skipEvents = cms.untracked.uint32(max_skipped), fileNames = cms.untracked.vstring(),secondaryFileNames = cms.untracked.vstring())

process.source = cms.Source ("PoolSource", fileNames = cms.untracked.vstring(),secondaryFileNames = cms.untracked.vstring()) # std value
process.source.fileNames.extend(dd.search()) # to be commented for local run only
data = os.environ['data']
flist = dd.getCMSdata(data)
print(flist)
process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(*flist))

# process.source = cms.Source ("PoolSource", fileNames = cms.untracked.vstring(),secondaryFileNames = cms.untracked.vstring()) # std value
# process.source.fileNames.extend(dd.search()) # to be commented for local run only

#process.source = cms.Source ("PoolSource",
# fileNames = cms.untracked.vstring(
Expand Down Expand Up @@ -59,7 +77,8 @@

from Configuration.AlCa.autoCond import autoCond
#process.GlobalTag.globaltag = os.environ['TEST_GLOBAL_TAG']#+'::All'
process.GlobalTag.globaltag = '93X_upgrade2023_realistic_v2'
process.GlobalTag.globaltag = '122X_mcRun4_realistic_v1'
#process.GlobalTag.globaltag = '93X_upgrade2023_realistic_v2'
#process.GlobalTag.globaltag = '93X_upgrade2023_realistic_v0'
#process.GlobalTag.globaltag = '93X_mc2017_realistic_v1'

Expand All @@ -73,10 +92,10 @@
process.load("DQMServices.Components.DQMEnvironment_cfi")

process.EDM = cms.OutputModule("PoolOutputModule",
outputCommands = cms.untracked.vstring('drop *',"keep *_MEtoEDMConverter_*_*"),
fileName = cms.untracked.string(os.environ['outputFile'].replace(".root", "_a.root"))
#fileName = cms.untracked.string('electronHistos.ValFullZEEStartup_13_gedGsfE_a.root') # for local run only
)
outputCommands = cms.untracked.vstring('drop *',"keep *_MEtoEDMConverter_*_*"),
fileName = cms.untracked.string(os.environ['outputFile'])#.replace(".root", "_a.root"))
#fileName = cms.untracked.string('electronHistos.ValFullZEEStartup_13_gedGsfE_a.root') # for local run only
)

process.electronMcFakeValidator.InputFolderName = cms.string("EgammaV/ElectronMcFakeValidator")
process.electronMcFakeValidator.OutputFolderName = cms.string("EgammaV/ElectronMcFakeValidator")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
if cmsEnv.beginTag() == 'Run2_2017':
from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
process = cms.Process("electronPostValidation",Run2_2017)
elif cmsEnv.beginTag() == 'Run3':
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process('electronValidation', Run3)
else:
from Configuration.Eras.Era_Phase2_cff import Phase2
process = cms.Process('electronPostValidation',Phase2)
Expand Down Expand Up @@ -52,7 +55,7 @@

print('= inputPostFile : %s' % os.environ['inputPostFile'])
t1 = os.environ['inputPostFile'].split('.')
localFileInput = os.environ['inputPostFile'].replace(".root", "_a.root") #
localFileInput = os.environ['inputPostFile']#.replace(".root", "_a.root") #
# Source
process.source = cms.Source ("PoolSource",fileNames = cms.untracked.vstring("file:" + localFileInput),
secondaryFileNames = cms.untracked.vstring(),)
Expand All @@ -62,7 +65,8 @@

from Configuration.AlCa.autoCond import autoCond
#process.GlobalTag.globaltag = os.environ['TEST_GLOBAL_TAG']#+'::All'
process.GlobalTag.globaltag = '113X_mcRun4_realistic_v4'
process.GlobalTag.globaltag = '122X_mcRun4_realistic_v1'
#process.GlobalTag.globaltag = '113X_mcRun4_realistic_v4'
#process.GlobalTag.globaltag = '93X_mc2017_realistic_v1'

process.dqmSaver.workflow = '/electronHistos/' + t1[1] + '/RECO3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
if cmsEnv.beginTag() == 'Run2_2017':
from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
process = cms.Process("electronPostValidation",Run2_2017)
elif cmsEnv.beginTag() == 'Run3':
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process('electronValidation', Run3)
else:
from Configuration.Eras.Era_Phase2_cff import Phase2
process = cms.Process('electronPostValidation',Phase2)
Expand All @@ -31,13 +34,24 @@
# actually read in the DQM root file
process.load("DQMServices.Components.DQMFileReader_cfi")

# others
# import of standard configurations
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2026D76Reco_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.StandardSequences.DQMSaverAtRunEnd_cff')
process.load('Configuration.StandardSequences.Harvesting_cff')

from DQMServices.Components.DQMStoreStats_cfi import *
dqmStoreStats.runOnEndJob = cms.untracked.bool(True)

process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))

t1 = os.environ['inputPostFile'].split('.')
localFileInput = os.environ['inputPostFile'].replace(".root", "_a.root") #
localFileInput = os.environ['inputPostFile']#.replace(".root", "_a.root") #
# Source
process.source = cms.Source ("PoolSource",fileNames = cms.untracked.vstring("file:" + localFileInput),
secondaryFileNames = cms.untracked.vstring(),)
Expand All @@ -47,7 +61,9 @@

from Configuration.AlCa.autoCond import autoCond
#process.GlobalTag.globaltag = os.environ['TEST_GLOBAL_TAG']#+'::All'
process.GlobalTag.globaltag = '93X_upgrade2023_realistic_v2'
process.GlobalTag.globaltag = '122X_mcRun4_realistic_v1'
#process.GlobalTag.globaltag = '122X_mcRun4_realistic_v1'
#process.GlobalTag.globaltag = '93X_upgrade2023_realistic_v2'
#process.GlobalTag.globaltag = '93X_upgrade2023_realistic_v0'
#process.GlobalTag.globaltag = '93X_mc2017_realistic_v1'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
if cmsEnv.beginTag() == 'Run2_2017':
from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
process = cms.Process("electronPostValidation",Run2_2017)
elif cmsEnv.beginTag() == 'Run3':
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process('electronValidation', Run3)
else:
from Configuration.Eras.Era_Phase2_cff import Phase2
process = cms.Process('electronPostValidation',Phase2)
Expand Down Expand Up @@ -42,15 +45,14 @@
process.load('Configuration.StandardSequences.DQMSaverAtRunEnd_cff')
process.load('Configuration.StandardSequences.Harvesting_cff')


from DQMServices.Components.DQMStoreStats_cfi import *
dqmStoreStats.runOnEndJob = cms.untracked.bool(True)

process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))

print('= inputPostFile : %s' % os.environ['inputPostFile'])
t1 = os.environ['inputPostFile'].split('.')
localFileInput = os.environ['inputPostFile'].replace("_a.root", ".root") #
localFileInput = os.environ['inputPostFile']#.replace(".root", "_a.root") #
# Source
process.source = cms.Source ("PoolSource",fileNames = cms.untracked.vstring("file:" + localFileInput),
secondaryFileNames = cms.untracked.vstring(),)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# third arg : sample name (ex. ZEE_14)

from electronValidationCheck_Env import env

cmsEnv = env() # be careful, cmsEnv != cmsenv. cmsEnv is local

cmsEnv.checkSample() # check the sample value
Expand All @@ -21,6 +22,9 @@
if cmsEnv.beginTag() == 'Run2_2017':
from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
process = cms.Process("electronValidation",Run2_2017)
elif cmsEnv.beginTag() == 'Run3':
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process('electronValidation', Run3)
else:
from Configuration.Eras.Era_Phase2_cff import Phase2
process = cms.Process('electronValidation',Phase2)
Expand All @@ -38,6 +42,7 @@

data = os.environ['data']
flist = dd.getCMSdata(data)
print(flist)
process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(*flist))

#process.source = cms.Source ("PoolSource",
Expand Down Expand Up @@ -71,7 +76,8 @@

from Configuration.AlCa.autoCond import autoCond
#process.GlobalTag.globaltag = os.environ['TEST_GLOBAL_TAG']#+'::All'
process.GlobalTag.globaltag = '113X_mcRun4_realistic_v4'
process.GlobalTag.globaltag = '122X_mcRun4_realistic_v1'
#process.GlobalTag.globaltag = '113X_mcRun4_realistic_v4'
#process.GlobalTag.globaltag = '93X_mc2017_realistic_v1'

# FOR DATA REDONE FROM RAW, ONE MUST HIDE IsoFromDeps
Expand All @@ -94,7 +100,7 @@
process.EDM = cms.OutputModule("PoolOutputModule",
outputCommands = cms.untracked.vstring('drop *',"keep *_MEtoEDMConverter_*_*"),
#fileName = cms.untracked.string(TEST_HISTOS_FILE)
fileName = cms.untracked.string(os.environ['outputFile'].replace(".root", "_a.root"))
fileName = cms.untracked.string(os.environ['outputFile'])#.replace(".root", "_a.root"))
)

process.electronMcSignalValidatorMiniAOD.InputFolderName = cms.string("EgammaV/ElectronMcSignalValidatorMiniAOD")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
from __future__ import print_function

import sys
import os
import DQMOffline.EGamma.electronDataDiscovery as dd
import FWCore.ParameterSet.Config as cms

print('Number of arguments:', len(sys.argv), 'arguments.')
print('Argument List:', str(sys.argv))
# first arg : cmsRun
# second arg : name of the _cfg file
# third arg : sample name (ex. ZEE_14)

from electronValidationCheck_Env import env

cmsEnv = env() # be careful, cmsEnv != cmsenv. cmsEnv is local

cmsEnv.checkSample() # check the sample value
cmsEnv.checkValues()

import DQMOffline.EGamma.electronDataDiscovery as dd

if cmsEnv.beginTag() == 'Run2_2017':
from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
process = cms.Process("electronValidation",Run2_2017)
elif cmsEnv.beginTag() == 'Run3':
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process('electronValidation', Run3)
else:
from Configuration.Eras.Era_Phase2_cff import Phase2
process = cms.Process('electronValidation',Phase2)

process.DQMStore = cms.Service("DQMStore")
process.load("DQMServices.Components.DQMStoreStats_cfi")
from DQMServices.Components.DQMStoreStats_cfi import *

dqmStoreStats.runOnEndJob = cms.untracked.bool(True)

#max_skipped = 165
max_number = -1 # 10 # number of events
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(max_number))
#process.source = cms.Source ("PoolSource",skipEvents = cms.untracked.uint32(max_skipped), fileNames = cms.untracked.vstring(),secondaryFileNames = cms.untracked.vstring())

process.source = cms.Source ("PoolSource", fileNames = cms.untracked.vstring(),secondaryFileNames = cms.untracked.vstring()) # std value
process.source.fileNames.extend(dd.search()) # to be commented for local run only
data = os.environ['data']
flist = dd.getCMSdata(data)
print(flist)
process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(*flist))

#process.source = cms.Source ("PoolSource", fileNames = cms.untracked.vstring(),secondaryFileNames = cms.untracked.vstring()) # std value
#process.source.fileNames.extend(dd.search()) # to be commented for local run only

#process.source = cms.Source ("PoolSource",
# fileNames = cms.untracked.vstring(
Expand Down Expand Up @@ -58,7 +76,8 @@

from Configuration.AlCa.autoCond import autoCond
#process.GlobalTag.globaltag = os.environ['TEST_GLOBAL_TAG']#+'::All'
process.GlobalTag.globaltag = '93X_upgrade2023_realistic_v2'
process.GlobalTag.globaltag = '122X_mcRun4_realistic_v1'
#process.GlobalTag.globaltag = '93X_upgrade2023_realistic_v2'
#process.GlobalTag.globaltag = '93X_upgrade2023_realistic_v0'
#process.GlobalTag.globaltag = '93X_mc2017_realistic_v1'

Expand All @@ -72,10 +91,10 @@
process.load("DQMServices.Components.DQMEnvironment_cfi")

process.EDM = cms.OutputModule("PoolOutputModule",
outputCommands = cms.untracked.vstring('drop *',"keep *_MEtoEDMConverter_*_*"),
fileName = cms.untracked.string(os.environ['outputFile'].replace(".root", "_a.root"))
#fileName = cms.untracked.string('electronHistos.ValFullZEEStartup_13_gedGsfE_a.root') # for local run only
)
outputCommands = cms.untracked.vstring('drop *',"keep *_MEtoEDMConverter_*_*"),
fileName = cms.untracked.string(os.environ['outputFile'])#.replace(".root", "_a.root"))
#fileName = cms.untracked.string('electronHistos.ValFullZEEStartup_13_gedGsfE_a.root') # for local run only
)

process.electronMcSignalValidatorPt1000.InputFolderName = cms.string("EgammaV/ElectronMcSignalValidatorPt1000")
process.electronMcSignalValidatorPt1000.OutputFolderName = cms.string("EgammaV/ElectronMcSignalValidatorPt1000")
Expand Down
Loading