PageRenderTime 55ms CodeModel.GetById 6ms app.highlight 44ms RepoModel.GetById 2ms app.codeStats 0ms

/ElectroWeakAnalysis/WENu/test/pat_WenuVBTF_ntuple_forData.py

https://github.com/aivanov-cern/cmssw
Python | 250 lines | 201 code | 16 blank | 33 comment | 0 complexity | d1ccab4f662c55977e5a04cfedcc941b MD5 | raw file
  1##   #########################################################
  2##
  3##   Configuration for the production of the ICHEP VBTF ntuple
  4##   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5##   MC, spring10
  6##
  7##   Nikolaos Rompotis - Imperial College London
  8##   22 June 2010
  9##
 10##   #########################################################
 11import FWCore.ParameterSet.Config as cms
 12
 13process = cms.Process("PAT")
 14
 15
 16
 17process.options = cms.untracked.PSet(
 18    Rethrow = cms.untracked.vstring('ProductNotFound')
 19)
 20
 21#process.MessageLogger = cms.Service(
 22#        "MessageLogger",
 23#            categories = cms.untracked.vstring('info', 'debug','cout')
 24#            )
 25
 26
 27process.load("FWCore.MessageService.MessageLogger_cfi")
 28process.MessageLogger.cerr.threshold = cms.untracked.string("INFO")
 29process.MessageLogger.cerr.FwkSummary = cms.untracked.PSet(
 30       reportEvery = cms.untracked.int32(1000000),
 31          limit = cms.untracked.int32(10000000)
 32       )
 33process.MessageLogger.cerr.FwkReport = cms.untracked.PSet(
 34      reportEvery = cms.untracked.int32(100000),
 35         limit = cms.untracked.int32(10000000)
 36      )
 37process.options = cms.untracked.PSet(
 38       wantSummary = cms.untracked.bool(True)
 39       )
 40
 41
 42
 43
 44# source
 45process.source = cms.Source("PoolSource", 
 46     fileNames = cms.untracked.vstring(
 47    # SOME DATA FILE TO BE PUT HERE
 48    #'rfio:/castor/cern.ch/user/r/rompotis/DATA_STUDIES/Spring10/sample_WminusToENu-CTEQ66-powheg_Spring10-START3X_V26_AODSIM-v2.root',
 49    #'file:rfio:/castor/cern.ch/user/r/rompotis/DATA_STUDIES/Spring10/sample_WenuSpring10START3X_V26_S09-v1_AODSIM.root',
 50    'rfio:/castor/cern.ch/cms/store/relval/CMSSW_3_9_1/RelValZEE/GEN-SIM-RECO/START39_V3-v1/0062/187296DA-39E4-DF11-A172-003048679296.root'
 51    )
 52)
 53process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1000) )
 54
 55## Load additional processes
 56process.load("Configuration.StandardSequences.Geometry_cff")
 57process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
 58## global tags:
 59process.GlobalTag.globaltag = cms.string('START39_V3::All') 
 60
 61process.load("Configuration.StandardSequences.MagneticField_cff")
 62
 63
 64################################################################################################
 65###    P r e p a r a t i o n      o f    t h e    P A T    O b j e c t s   f r o m    A O D  ###
 66################################################################################################
 67
 68## pat sequences to be loaded:
 69#process.load("PhysicsTools.PFCandProducer.PF2PAT_cff")
 70process.load("PhysicsTools.PatAlgos.patSequences_cff")
 71#process.load("PhysicsTools.PatAlgos.triggerLayer1.triggerProducer_cff")
 72##
 73#
 74## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 75## MET creation     <=== WARNING: YOU MAY WANT TO MODIFY THIS PART OF THE CODE       %%%%%%%%%%%%%
 76##                                specify the names of the MET collections that you need here %%%%
 77##                                                                                             #%%
 78## if you don't specify anything the default MET is the raw Calo MET                           #%%
 79process.caloMET = process.patMETs.clone(                                                       #%%
 80    metSource = cms.InputTag("met","","RECO"),
 81    addTrigMatch = cms.bool(False),
 82    addMuonCorrections = cms.bool(False),
 83    addGenMET = cms.bool(False),
 84)
 85process.tcMET = process.patMETs.clone(                                                         #%%
 86    metSource = cms.InputTag("tcMet","","RECO"),
 87    addTrigMatch = cms.bool(False),
 88    addMuonCorrections = cms.bool(False),
 89    addGenMET = cms.bool(False),
 90)
 91process.pfMET = process.patMETs.clone(                                                         #%%
 92    metSource = cms.InputTag("pfMet","","RECO"),
 93    addTrigMatch = cms.bool(False),
 94    addMuonCorrections = cms.bool(False),
 95    addGenMET = cms.bool(False),
 96)
 97## specify here what you want to have on the plots! <===== MET THAT YOU WANT ON THE PLOTS  %%%%%%%
 98myMetCollection   = 'caloMET'
 99myPfMetCollection =   'pfMET'
100myTcMetCollection =   'tcMET'
101## modify the sequence of the MET creation:                                                    #%%
102process.makePatMETs = cms.Sequence(process.caloMET*process.tcMET*process.pfMET)
103## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
104## modify the final pat sequence: keep only electrons + METS (muons are needed for met corrections)
105process.load("RecoEgamma.EgammaIsolationAlgos.egammaIsolationSequence_cff")
106#process.patElectronIsolation = cms.Sequence(process.egammaIsolationSequence)
107
108process.patElectrons.isoDeposits = cms.PSet()
109process.patElectrons.userIsolation = cms.PSet()
110process.patElectrons.addElectronID = cms.bool(True)
111process.patElectrons.electronIDSources = cms.PSet(
112    simpleEleId95relIso= cms.InputTag("simpleEleId95relIso"),
113    simpleEleId90relIso= cms.InputTag("simpleEleId90relIso"),
114    simpleEleId85relIso= cms.InputTag("simpleEleId85relIso"),
115    simpleEleId80relIso= cms.InputTag("simpleEleId80relIso"),
116    simpleEleId70relIso= cms.InputTag("simpleEleId70relIso"),
117    simpleEleId60relIso= cms.InputTag("simpleEleId60relIso"),
118    simpleEleId95cIso= cms.InputTag("simpleEleId95cIso"),
119    simpleEleId90cIso= cms.InputTag("simpleEleId90cIso"),
120    simpleEleId85cIso= cms.InputTag("simpleEleId85cIso"),
121    simpleEleId80cIso= cms.InputTag("simpleEleId80cIso"),
122    simpleEleId70cIso= cms.InputTag("simpleEleId70cIso"),
123    simpleEleId60cIso= cms.InputTag("simpleEleId60cIso"),    
124    )
125##
126process.patElectrons.addGenMatch = cms.bool(False)
127process.patElectrons.embedGenMatch = cms.bool(False)
128process.patElectrons.usePV = cms.bool(False)
129##
130process.load("ElectroWeakAnalysis.WENu.simpleEleIdSequence_cff")
131#
132process.patElectronIDs = cms.Sequence(process.simpleEleIdSequence)
133process.makePatElectrons = cms.Sequence(process.patElectronIDs*process.patElectrons)
134# process.makePatMuons may be needed depending on how you calculate the MET
135process.makePatCandidates = cms.Sequence(process.makePatElectrons+process.makePatMETs)
136process.patDefaultSequence = cms.Sequence(process.makePatCandidates)
137##
138##  ################################################################################
139##
140##  the filter to select the candidates from the data samples
141##
142##
143## WARNING: you may want to modify this item:
144HLT_process_name = "HLT"   # REDIGI for the Spring10 production traditional MC / HLT for the powheg samples or data
145# trigger path selection
146HLT_path_name     = "HLT_Photon10_L1R" #= "HLT_Ele15_LW_L1R" #
147# trigger filter name
148HLT_filter_name  =  "hltL1NonIsoHLTNonIsoSinglePhotonEt10HcalIsolFilter"
149#
150
151
152process.wenuFilter = cms.EDFilter('WenuCandidateFilter',
153                                  ### the input collections needed:
154                                  electronCollectionTag = cms.untracked.InputTag("patElectrons","","PAT"),
155                                  metCollectionTag = cms.untracked.InputTag(myMetCollection,"","PAT"),
156                                  pfMetCollectionTag = cms.untracked.InputTag(myPfMetCollection,"","PAT"),
157                                  tcMetCollectionTag = cms.untracked.InputTag(myTcMetCollection,"","PAT"),
158                                  triggerCollectionTag = cms.untracked.InputTag("TriggerResults","",HLT_process_name),
159                                  triggerEventTag = cms.untracked.InputTag("hltTriggerSummaryAOD","",HLT_process_name),
160                                  hltpath = cms.untracked.string(HLT_path_name), 
161                                  hltpathFilter = cms.untracked.InputTag(HLT_filter_name,"",HLT_process_name),
162                                  ebRecHits = cms.untracked.InputTag("reducedEcalRecHitsEB"),
163                                  eeRecHits = cms.untracked.InputTag("reducedEcalRecHitsEE"),
164                                  PrimaryVerticesCollection = cms.untracked.InputTag("offlinePrimaryVertices"),
165                                  ### here the preselection is applied
166                                  # fiducial cuts:
167                                  BarrelMaxEta = cms.untracked.double(1.4442),
168                                  EndCapMinEta = cms.untracked.double(1.566),
169                                  EndCapMaxEta = cms.untracked.double(2.5),
170                                  # demand ecal driven electron:
171                                  useEcalDrivenElectrons = cms.untracked.bool(True),
172                                  # demand offline spike cleaning with the Swiss Cross criterion:
173                                  useSpikeRejection = cms.untracked.bool(False),
174                                  spikeCleaningSwissCrossCut = cms.untracked.double(0.95),
175                                  # demand geometrically matched to an HLT object with ET>15GeV
176                                  useTriggerInfo = cms.untracked.bool(False),
177                                  electronMatched2HLT = cms.untracked.bool(True),
178                                  electronMatched2HLT_DR = cms.untracked.double(0.1),
179                                  useHLTObjectETCut = cms.untracked.bool(True),
180                                  hltObjectETCut = cms.untracked.double(15.),
181                                  useExtraTrigger = cms.untracked.bool(False),
182                                  # ET Cut in the SC
183                                  ETCut = cms.untracked.double(20.),                                  
184                                  METCut = cms.untracked.double(0.),
185                                  # reject events with a 2nd electron with ET > 20 that passes the WP95%
186                                  vetoSecondElectronEvents = cms.untracked.bool(False),
187                                  storeSecondElectron = cms.untracked.bool(True),
188                                  ETCut2ndEle = cms.untracked.double(20.),
189                                  vetoSecondElectronIDType = cms.untracked.string("simpleEleId95relIso"),
190                                  vetoSecondElectronIDSign = cms.untracked.string("="),
191                                  vetoSecondElectronIDValue = cms.untracked.double(7.),
192                                  # Other parameters of the code - leave them as they are
193                                  useValidFirstPXBHit = cms.untracked.bool(False),
194                                  useConversionRejection = cms.untracked.bool(False),
195                                  useExpectedMissingHits = cms.untracked.bool(False),
196                                  maxNumberOfExpectedMissingHits = cms.untracked.int32(1),
197                                  # calculate some new cuts
198                                  calculateValidFirstPXBHit = cms.untracked.bool(True),
199                                  calculateExpectedMissingHits = cms.untracked.bool(True),
200                                  )
201####################################################################################
202##
203## the W selection that you prefer included in another cfg
204from ElectroWeakAnalysis.WENu.simpleCutBasedSpring10SelectionBlocks_cfi import *
205
206selection_inverse = cms.PSet (
207    deta_EB_inv = cms.untracked.bool(True),
208    deta_EE_inv = cms.untracked.bool(True)
209    )
210
211####################################################################################
212#
213# we need to store jet information, hence we have to produce the jets:
214process.load("JetMETCorrections.Configuration.DefaultJEC_cff")
215#process.load("JetMETCorrections.Configuration.JetCorrectionProducers_cff")
216process.jetSequence = cms.Sequence( process.ak5CaloJetsL2L3  )
217process.pfjetAK5Sequence = cms.Sequence( process.ak5PFJetsL2L3 )
218
219process.ourJetSequence = cms.Sequence( process.jetSequence * process.pfjetAK5Sequence )
220
221
222
223##
224## and the plot creator
225process.plotter = cms.EDAnalyzer('WenuPlots',
226                                 # selection in use: wont be used - we have usePrecalcID true later
227                                 selection_80relIso,
228                                 selection_inverse,
229                                 # The selection to be used here:
230                                 usePrecalcID = cms.untracked.bool(True),
231                                 usePrecalcIDType = cms.untracked.string('simpleEleId80relIso'),
232                                 usePrecalcIDSign = cms.untracked.string('='),
233                                 usePrecalcIDValue = cms.untracked.double(7),
234                                 # some extra information on the ntuple production:
235                                 includeJetInformationInNtuples = cms.untracked.bool(True),
236                                 caloJetCollectionTag = cms.untracked.InputTag('ak5CaloJetsL2L3'),
237                                 pfJetCollectionTag = cms.untracked.InputTag('ak5PFJetsL2L3'),
238                                 DRJetFromElectron = cms.untracked.double(0.3),
239                                 #
240                                 wenuCollectionTag = cms.untracked.InputTag("wenuFilter","selectedWenuCandidates","PAT"),
241                                 WENU_VBTFselectionFileName = cms.untracked.string("WENU_VBTFselection.root"),
242                                 WENU_VBTFpreseleFileName = cms.untracked.string("WENU_VBTFpreselection.root"),
243                                 DatasetTag =  cms.untracked.int32(100),
244                                 storeExtraInformation = cms.untracked.bool(True),
245                                 storeAllSecondElectronVariables = cms.untracked.bool(True),
246                                 )
247#
248process.p = cms.Path( process.ourJetSequence*process.patDefaultSequence*process.wenuFilter*process.plotter)
249
250