Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:03

0001 import FWCore.ParameterSet.Config as cms
0002 from FWCore.ParameterSet.VarParsing import VarParsing
0003 
0004 varOptions = VarParsing('analysis')
0005 varOptions.register(
0006     "isMC",
0007     False,
0008     VarParsing.multiplicity.singleton,
0009     VarParsing.varType.bool,
0010     "setup MC as in/out put"
0011     )
0012 varOptions.parseArguments()
0013 
0014 process = cms.Process('GETGBR')
0015 
0016 process.load('Configuration.StandardSequences.Services_cff')
0017 process.load('FWCore.MessageService.MessageLogger_cfi')
0018 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0019 process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff')
0020 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0021 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0022 
0023 process.MessageLogger.cerr.threshold = ''
0024 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
0025 
0026 
0027 process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
0028         calibratedPatElectrons = cms.PSet(
0029         initialSeed = cms.untracked.uint32(1),
0030         engineName = cms.untracked.string('TRandom3')
0031         ),
0032         calibratedElectrons = cms.PSet(
0033         initialSeed = cms.untracked.uint32(1),
0034         engineName = cms.untracked.string('TRandom3')
0035         ),
0036                                                    )
0037 process.maxEvents = cms.untracked.PSet(
0038     input = cms.untracked.int32(varOptions.maxEvents)
0039 )
0040 
0041 # Input source
0042 if not varOptions.isMC :    
0043     process.source = cms.Source("PoolSource",
0044                                 fileNames = cms.untracked.vstring(
0045             '/store/data/Run2016B/DoubleEG/MINIAOD/PromptReco-v2/000/275/073/00000/C281D9DB-5235-E611-8663-02163E0122D7.root'
0046             )
0047                                 )
0048 
0049 else:
0050     process.source = cms.Source("PoolSource",
0051                                 fileNames = cms.untracked.vstring(
0052             '/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/FE69D710-7E6D-E511-A2F0-008CFA197FAC.root',
0053             '/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/FC529DE1-736D-E511-9386-008CFA1CB8A8.root',
0054             '/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/E66EB7F4-776D-E511-98A1-008CFA0A5A94.root',
0055             '/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/E6C6E3D4-9F6D-E511-B817-008CFA197D2C.root',
0056             '/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/E6D897DA-836D-E511-B02B-008CFA56D894.root',
0057             '/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/EA0DB6DD-836D-E511-878E-008CFA14F9D4.root',
0058             '/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/EA0FBE97-7E6D-E511-8172-008CFA197A5C.root',
0059             '/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/EA90F1B8-5D6D-E511-9265-008CFA1C64B0.root',
0060             '/store/mc/RunIISpring15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/F8F8A7A4-726D-E511-A351-008CFA166008.root'
0061             )
0062                                 )
0063     
0064 from Configuration.AlCa.GlobalTag import GlobalTag
0065 #process.GlobalTag = GlobalTag(process.GlobalTag, '74X_dataRun2_Prompt_v4', '')
0066 
0067 if varOptions.isMC:
0068     process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc'  , '')
0069 else:
0070     process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')
0071     
0072 process.selectedElectrons = cms.EDFilter("PATElectronSelector",
0073                                          src = cms.InputTag("slimmedElectrons"),
0074                                          cut = cms.string("pt > 8 && ((abs(eta)<1.479 && pfIsolationVariables().sumChargedHadronPt/pt < 0.1 && abs(deltaEtaSuperClusterTrackAtVtx)<0.0126 && abs(deltaPhiSuperClusterTrackAtVtx)<0.107 && hcalOverEcal<0.186 && passConversionVeto && pfIsolationVariables().sumNeutralHadronEt/pt < 0.1 && pfIsolationVariables().sumPhotonEt/pt < 0.1 && full5x5_sigmaIetaIeta<0.012) || (abs(eta)>1.479 && pfIsolationVariables().sumChargedHadronPt/pt < 0.1 && abs(deltaEtaSuperClusterTrackAtVtx)<0.0109 && abs(deltaPhiSuperClusterTrackAtVtx)<0.217 && hcalOverEcal<0.09 && passConversionVeto && pfIsolationVariables().sumNeutralHadronEt/pt < 0.1 && pfIsolationVariables().sumPhotonEt/pt < 0.1 && full5x5_sigmaIetaIeta<0.034))")
0075 )
0076 
0077 process.load('EgammaAnalysis.ElectronTools.calibratedElectronsRun2_cfi')
0078 process.calibratedPatElectrons.electrons = "selectedElectrons"
0079 process.calibratedPatElectrons.isMC = False
0080 if varOptions.isMC:
0081     process.calibratedPatElectrons.isMC = False
0082 
0083 process.zeeUncalib = cms.EDProducer("CandViewShallowCloneCombiner",
0084                                     decay = cms.string("selectedElectrons@+ selectedElectrons@-"),
0085                                     cut   = cms.string("min(daughter(0).pt,daughter(1).pt) > 15 && mass > 50"),
0086                                     )
0087 
0088 process.zeeCalib = process.zeeUncalib.clone(
0089     decay = cms.string("calibratedPatElectrons@+ calibratedPatElectrons@-"),
0090     )
0091 
0092 process.zeeUncalibTree = cms.EDFilter("ProbeTreeProducer",
0093                                       src = cms.InputTag("zeeUncalib"),
0094                                       variables = cms.PSet(
0095         mass = cms.string("mass"),
0096         massErr = cms.string("0.5 * mass * sqrt( pow( daughter(0).masterClone.p4Error('P4_COMBINATION') / daughter(0).masterClone.p4('P4_COMBINATION').P(), 2 ) + "+
0097                              "pow( daughter(0).masterClone.p4Error('P4_COMBINATION') / daughter(0).masterClone.p4('P4_COMBINATION').P(), 2 ) ) "),
0098         l1pt = cms.string("daughter(0).pt"),
0099         l2pt = cms.string("daughter(1).pt"),
0100         l1eta = cms.string("daughter(0).eta"),
0101         l2eta = cms.string("daughter(1).eta"),
0102         ),
0103                                       flags = cms.PSet(),
0104                                       )
0105 
0106 process.zeeCalibTree = process.zeeUncalibTree.clone(
0107     src = cms.InputTag("zeeCalib"),
0108     )
0109 
0110 process.path = cms.Path(process.selectedElectrons + process.calibratedPatElectrons +
0111                         process.zeeUncalib + process.zeeUncalibTree +
0112                         process.zeeCalib + process.zeeCalibTree
0113                         )
0114 
0115 outputfilename = 'plots_data.root'
0116 if varOptions.isMC:
0117     outputfilename = 'plots_mc2.root'
0118 process.TFileService = cms.Service("TFileService", 
0119                                    fileName = cms.string(outputfilename),
0120                                    closeFileFast = cms.untracked.bool(True)
0121                                    )
0122