CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/HLTriggerOffline/Egamma/python/EgammaValidation_cff.py

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 
00003 class dummy:
00004     pass
00005 
00006 samples=dummy()
00007 paths=dummy()
00008 
00009 ##########################################################
00010 # Define which preselections to run                      #
00011 ##########################################################
00012 
00013 samples.names = ['Wenu',
00014                  'Zee',
00015                  'GammaJet',
00016                  'DiGamma']
00017 samples.pdgid = [ 11,
00018                   11,
00019                   22,
00020                   22]
00021 samples.num   = [1,
00022                  2,
00023                  1,
00024                  2]
00025 
00026 #which triggers for which sample
00027 
00028 paths.Wenu = ['HLT_Ele10_LW_L1RDQM',
00029               'HLT_Ele15_SW_L1RDQM',
00030               'HLT_Ele10_LW_EleId_L1RDQM',
00031               'HLT_Ele15_SiStrip_L1RDQM']
00032 
00033 paths.Zee = paths.Wenu + ['HLT_DoubleEle5_SW_L1RDQM']
00034 
00035 paths.GammaJet = ['HLT_Photon10_L1R_DQM',
00036                   'HLT_Photon15_TrackIso_L1R_DQM',
00037                   'HLT_Photon15_LooseEcalIso_L1R_DQM',
00038                   'HLT_Photon25_LooseEcalIso_TrackIso_L1R_DQM']
00039 
00040 paths.DiGamma  = ['HLT_Photon10_L1R_DQM','HLT_DoublePhoton10_L1R_DQM']
00041 
00042 pathlumi = { 'HLT_Ele10_LW_L1RDQM':'8e29',
00043              'HLT_Ele15_SW_L1RDQM':'1e31',
00044              'HLT_Ele10_LW_EleId_L1RDQM':'8e29',
00045              'HLT_Ele15_SiStrip_L1RDQM':'8e29',
00046              'HLT_DoubleEle5_SW_L1RDQM':'8e29',
00047              'HLT_Photon10_L1R_DQM':'8e29',
00048              'HLT_Photon15_TrackIso_L1R_DQM':'8e29',
00049              'HLT_Photon15_LooseEcalIso_L1R_DQM':'8e29',
00050              'HLT_DoublePhoton10_L1R_DQM':'8e29',
00051              'HLT_Photon25_L1R_DQM':'1e31',
00052              'HLT_Photon25_LooseEcalIso_TrackIso_L1R_DQM':'1e31'}
00053 
00054 lumiprocess = { '8e29':'HLT',
00055                 '1e31':'HLT'
00056                 }
00057     
00058 
00059 ##########################################################
00060 # produce generated paricles in acceptance               #
00061 ##########################################################
00062 
00063 genp = cms.EDFilter("PdgIdAndStatusCandViewSelector",
00064     status = cms.vint32(3),
00065     src = cms.InputTag("genParticles"),
00066     pdgId = cms.vint32(11)  # replaced in loop
00067 )
00068 
00069 fiducial = cms.EDFilter("EtaPtMinCandViewSelector",
00070     src = cms.InputTag("genp"),
00071     etaMin = cms.double(-2.5),  # to be replaced in loop ?
00072     etaMax = cms.double(2.5),   # to be replaced in loop ?
00073     ptMin = cms.double(2.0)     # to be replaced in loop ?
00074 )
00075 
00076 ##########################################################
00077 # loop over samples to create modules and sequence       #
00078 ##########################################################
00079 
00080 tmp = cms.SequencePlaceholder("tmp")
00081 egammaSelectors = cms.Sequence(tmp) # no empty sequences allowed, start with dummy
00082 egammaValidators= cms.Sequence(tmp) # same
00083 
00084 #loop over samples
00085 for samplenum in range(len(samples.names)):
00086 
00087     # clone genParticles and select correct type
00088     genpartname = "genpart"+samples.names[samplenum]
00089     globals()[genpartname] = genp.clone()
00090     setattr(globals()[genpartname],"pdgId",cms.vint32(samples.pdgid[samplenum]) ) # set pdgId
00091     egammaSelectors *= globals()[genpartname]                            # add to sequence
00092 
00093     # clone generator fiducial region
00094     fiducialname = "fiducial"+samples.names[samplenum]
00095     globals()[fiducialname] = fiducial.clone()
00096     setattr(globals()[fiducialname],"src",cms.InputTag(genpartname) ) # set input collection
00097     egammaSelectors *= globals()[fiducialname]               # add to sequence
00098 
00099     # loop over triggers for each sample
00100     for trig in getattr(paths,samples.names[samplenum]):
00101         trigname = trig + samples.names[samplenum] 
00102         #import appropriate config snippet
00103         filename = "HLTriggerOffline.Egamma."+trig+"_cfi"
00104         trigdef =__import__( filename )
00105         import sys
00106         globals()[trigname] = getattr(sys.modules[filename],trig).clone()    # clone imported config
00107         setattr(globals()[trigname],"cutcollection",cms.InputTag(fiducialname))        # set preselacted generator collection
00108         setattr(globals()[trigname],"cutnum",cms.int32( samples.num[samplenum]  )) # cut value for preselection
00109         setattr(globals()[trigname],"pdgGen",cms.int32( samples.pdgid[samplenum])) #correct pdgId for MC matching
00110         getattr(globals()[trigname],'triggerobject').setProcessName( lumiprocess[pathlumi[trig]] )         #set proper process name
00111         for filterpset in getattr(globals()[trigname],'filters'):
00112             getattr(filterpset,'HLTCollectionLabels').setProcessName( lumiprocess[pathlumi[trig]] )
00113             for isocollections in getattr(filterpset,'IsoCollections'):
00114                 isocollections.setProcessName( lumiprocess[pathlumi[trig]])
00115 
00116         egammaValidators *= globals()[trigname]                      # add to sequence
00117 
00118 
00119 egammaSelectors.remove(tmp)  # remove the initial dummy
00120 egammaValidators.remove(tmp)
00121 
00122 # selectors go into separate "prevalidation" sequence
00123 egammaValidationSequence   = cms.Sequence( egammaValidators )
00124 egammaValidationSequenceFS = cms.Sequence( egammaValidators )