Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:12:55

0001 from __future__ import print_function
0002 ##-----
0003 # Set job-specific inputs based on shell
0004 # the following enviromental variables
0005 # export COSMIC_MODE=True # or False
0006 # export JOB_NAME="CosmicStream112220"
0007 # export NEVENTS=1000
0008 # export ALL_HISTS=True
0009 # export TRIGGER_SET=HLT
0010 # export READ_LIST_FROM_FILE=False # or True
0011 # export INPUTFILES='' # root file(s)
0012 # export INPUTFILES_LIST='inputfile_BeamHaloExpress_120015.txt'
0013 # for details see https://twiki.cern.ch/twiki/bin/view/CMS/JetMETDQMPromptAnalysis
0014 ##-----
0015 import os
0016 import FWCore.ParameterSet.Config as cms
0017 #
0018 # --- [cosmic sequence (default=True)?]
0019 iscosmics = (os.environ.get('COSMIC_MODE','True'))
0020 print('iscosmics (default=True) = '+str(iscosmics))
0021 #
0022 # --- [name of job & output file (default=test)?]
0023 jobname = (os.environ.get('JOB_NAME','test'))
0024 print('jobname (default=test) = '+str(jobname))
0025 #
0026 # --- [number of events (default=1000)]
0027 nevents = int(os.environ.get('NEVENTS','1000'))
0028 print('nevents (default=1000)  = '+str(nevents))
0029 #
0030 # --- [turn on all histograms (default=True)?]
0031 allhist = (os.environ.get('ALL_HISTS','True'))
0032 print('allhist (default=True) = '+str(allhist))
0033 #
0034 #--- [read list of input files from a text file? or not (default=False)]
0035 read_from_file = (os.environ.get('READ_LIST_FROM_FILE','False'))
0036 print('read list of input files from a text file (default=False) = '+str(read_from_file))
0037 #
0038 #--- [trigger set (default=HLT)]
0039 trigger_set = (os.environ.get('TRIGGER_SET','HLT'))
0040 print('trigger set name (default=HLT) = '+str(trigger_set))
0041 #
0042 #--- [define list of input files]
0043 inputfiles = []
0044 if read_from_file=="True":
0045   #--- [name of the text file (default=inputfile_list_default.txt)]
0046   filename = (os.environ.get('INPUTFILES_LIST','inputfile_list_default.txt'))
0047   file=open(filename)
0048   print(file.read())
0049   f = open(filename)
0050   try:
0051     for line in f:
0052         inputfiles.append(line)
0053   finally:
0054     f.close()
0055 else:
0056   inputfiles = os.environ.get('INPUTFILES',
0057   '/store/data/BeamCommissioning09/MinimumBias/RECO/Dec19thReReco_341_v1/0001/02EC80FB-FEEC-DE11-B28D-00261894389E.root').split(",")
0058   #'/store/data/Commissioning09/MinimumBias/RECO/v4/000/102/347/F85D1BC6-A06A-DE11-BDF8-0019B9F581C9.root').split(",")
0059   #'/store/data/CRAFT09/Calo/RECO/v1/000/112/220/F0B768A4-5E93-DE11-B222-000423D94524.root').split(",")
0060 
0061 print('List of input files')
0062 print(inputfiles)
0063 #-----
0064 
0065 #
0066 #-----
0067 process = cms.Process("test")
0068 process.load("CondCore.DBCommon.CondDBSetup_cfi")
0069 
0070 process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
0071 process.load("Configuration.StandardSequences.MagneticField_cff")
0072 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0073 
0074 #
0075 # DQM
0076 #
0077 process.load("DQMServices.Core.DQM_cfg")
0078 
0079 process.load("DQMServices.Components.MEtoEDMConverter_cfi")
0080 
0081 #
0082 # HCALNoise module
0083 #
0084 process.load("RecoMET.METProducers.hcalnoiseinfoproducer_cfi")
0085 process.hcalnoise.refillRefVectors = cms.bool(True)
0086 process.hcalnoise.hcalNoiseRBXCollName = "hcalnoise"
0087 process.hcalnoise.requirePedestals = cms.bool(False)
0088 
0089 #
0090 # BeamHaloData producer
0091 #
0092 process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
0093 process.load("Configuration/StandardSequences/MagneticField_cff")
0094 process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff")
0095 process.load("RecoMET/Configuration/RecoMET_BeamHaloId_cff")
0096 process.GlobalTag.globaltag ='GR09_R_34X_V2::All'
0097 
0098 # the task - JetMET objects
0099 if iscosmics =="True":
0100   process.load("DQMOffline.JetMET.jetMETDQMOfflineSourceCosmic_cff")
0101 else:
0102   process.load("DQMOffline.JetMET.jetMETDQMOfflineSource_cff")
0103 
0104 process.jetMETAnalyzer.OutputMEsInRootFile = cms.bool(True)
0105 process.jetMETAnalyzer.OutputFileName = cms.string("jetMETMonitoring_%s.root" % jobname)
0106 process.jetMETAnalyzer.TriggerResultsLabel = cms.InputTag("TriggerResults","",trigger_set)
0107 process.jetMETAnalyzer.processname = cms.string(trigger_set)
0108 #process.jetMETAnalyzer.TriggerResultsLabel = cms.InputTag("TriggerResults","","HLT8E29")
0109 #process.jetMETAnalyzer.processname = cms.string("HLT8E29")
0110 
0111 if allhist=="True":
0112   process.jetMETAnalyzer.DoJetPtAnalysis = cms.untracked.bool(True)
0113   process.jetMETAnalyzer.DoJetPtCleaning = cms.untracked.bool(True)
0114   process.jetMETAnalyzer.DoIterativeCone = cms.untracked.bool(True)
0115 
0116 #process.jetMETAnalyzer.caloMETAnalysis.verbose = cms.int32(1)
0117 
0118 if allhist=="True":
0119   process.jetMETAnalyzer.caloMETAnalysis.allSelection       = cms.bool(True)
0120   process.jetMETAnalyzer.caloMETNoHFAnalysis.allSelection   = cms.bool(True)
0121   process.jetMETAnalyzer.caloMETHOAnalysis.allSelection     = cms.bool(True)
0122   process.jetMETAnalyzer.caloMETNoHFHOAnalysis.allSelection = cms.bool(True)
0123   process.jetMETAnalyzer.pfMETAnalysis.allSelection         = cms.bool(True)
0124   process.jetMETAnalyzer.tcMETAnalysis.allSelection         = cms.bool(True)
0125   process.jetMETAnalyzer.mucorrMETAnalysis.allSelection     = cms.bool(True)
0126 
0127 # the task - JetMET trigger
0128 process.load("DQMOffline.Trigger.JetMETHLTOfflineSource_cfi")
0129 
0130 # check # of bins
0131 process.load("DQMServices.Components.DQMStoreStats_cfi")
0132 
0133 # for igprof
0134 #process.IgProfService = cms.Service("IgProfService",
0135 #  reportFirstEvent            = cms.untracked.int32(0),
0136 #  reportEventInterval         = cms.untracked.int32(25),
0137 #  reportToFileAtPostEvent     = cms.untracked.string("| gzip -c > igdqm.%I.gz")
0138 #)
0139 
0140 #
0141 # /Wmunu/Summer09-MC_31X_V3-v1/GEN-SIM-RECO
0142 process.source = cms.Source("PoolSource",
0143     fileNames = cms.untracked.vstring(*inputfiles))
0144 
0145 #
0146 process.source.inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*')
0147 
0148 #
0149 process.maxEvents = cms.untracked.PSet(
0150     input = cms.untracked.int32( nevents )
0151 )
0152 process.Timing = cms.Service("Timing")
0153 
0154 ## # Comment this out or reconfigure to see error messages 
0155 process.MessageLogger = cms.Service("MessageLogger",
0156     debugModules = cms.untracked.vstring('jetMETAnalyzer'),
0157     cout = cms.untracked.PSet(
0158         default = cms.untracked.PSet(
0159             limit = cms.untracked.int32(0)
0160         ),
0161         jetMETAnalyzer = cms.untracked.PSet(
0162             limit = cms.untracked.int32(100)
0163         ),
0164         noLineBreaks = cms.untracked.bool(True),
0165         DEBUG = cms.untracked.PSet(
0166             limit = cms.untracked.int32(0)
0167         ),
0168         threshold = cms.untracked.string('DEBUG')
0169     ),
0170     categories = cms.untracked.vstring('jetMETAnalyzer'),
0171     destinations = cms.untracked.vstring('cout')
0172 )
0173 
0174 
0175 process.options = cms.untracked.PSet(
0176     wantSummary = cms.untracked.bool(True)
0177 )
0178 
0179 process.FEVT = cms.OutputModule("PoolOutputModule",
0180     outputCommands = cms.untracked.vstring('keep *_MEtoEDMConverter_*_*'),
0181     #outputCommands = cms.untracked.vstring('keep *'),
0182     fileName = cms.untracked.string("reco_DQM_%s.root" % jobname)
0183 )
0184 
0185 process.options = cms.untracked.PSet(
0186     wantSummary = cms.untracked.bool(True) ## default is false
0187 
0188 )
0189 
0190 if iscosmics=="True":
0191   process.p = cms.Path(process.hcalnoise
0192                      * process.BeamHaloId
0193                      * process.jetMETHLTOfflineSource
0194 #                    * process.jetMETDQMOfflineSource
0195                      * process.jetMETDQMOfflineSourceCosmic
0196                      * process.MEtoEDMConverter
0197                      * process.dqmStoreStats)
0198 else:
0199   process.p = cms.Path(process.hcalnoise
0200                      * process.BeamHaloId
0201                      * process.jetMETHLTOfflineSource
0202                      * process.jetMETDQMOfflineSource
0203 #                    * process.jetMETDQMOfflineSourceCosmic
0204                      * process.MEtoEDMConverter
0205                      * process.dqmStoreStats)
0206 
0207 process.outpath = cms.EndPath(process.FEVT)
0208 process.DQM.collectorHost = ''
0209 
0210