Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:33

0001 from __future__ import print_function
0002 
0003 import os
0004 import FWCore.ParameterSet.Config as cms
0005 
0006 process = cms.Process("Demo")
0007 
0008 #--- [read list of input files from a text file? or not (default=False)]
0009 read_from_file = (os.environ.get('READ_LIST_FROM_FILE','False'))
0010 print('read list of input files from a text file (default=False) = '+str(read_from_file))
0011 #
0012 #
0013 # --- [do harvesting (default=True)? or read in histogram files]
0014 harvesting = (os.environ.get('HARVESTING',True))
0015 print('harvesting (default=True) = '+str(harvesting))
0016 #
0017 # --- [reference histogram (default=jetMETMonitoring_test.root)]
0018 reference_histogram_file = (os.environ.get('REFERENCE_HISTOGRAM_FILE','jetMETMonitoring_test.root'))
0019 print('reference_histogram_file = '+str(reference_histogram_file))
0020 #
0021 # --- [input file(s) for harvesting/certification (default=reco_DQM_test.root)]
0022 input_files = []
0023 if read_from_file=="True":
0024   #--- [name of the text file (default=inputfile_list_default.txt)]
0025   filename = (os.environ.get('INPUTFILES_LIST','inputfile_list_default.txt'))
0026   file=open(filename)
0027   print(file.read())
0028   f = open(filename)
0029   try:
0030     for line in f:
0031         input_files.append(line)
0032   finally:
0033     f.close()
0034 else:
0035   input_root_files = os.environ.get('INPUTEDMFILES','file:reco_DQM_test.root').split(",")
0036   print('input_root_files = '+str(input_root_files))
0037   print()
0038   
0039   if harvesting:
0040     for file in input_root_files:        # Second Example
0041       input_files.append(str(file))
0042     else:
0043       test_histogram_file = os.environ.get('TEST_HISTOGRAM_FILE','jetMETMonitoring_test.root')
0044       print('test_histogram_file = '+str(test_histogram_file))
0045 print()
0046     
0047 
0048 
0049 #-----------------------------
0050 process.load("FWCore.MessageService.MessageLogger_cfi")
0051 process.load("DQMServices.Core.DQM_cfg")
0052 process.DQM.collectorHost = ''
0053 
0054 #-----------------------------
0055 # DQM Environment & Specify inputs
0056 #-----------------------------
0057 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1)
0058 )
0059 
0060 #
0061 #--- When read in RECO file including EDM from ME
0062 process.source = cms.Source("PoolSource",
0063     processingMode = cms.untracked.string('RunsAndLumis'),
0064     fileNames = cms.untracked.vstring(input_files)
0065 )
0066 
0067 #-----
0068 
0069 process.load('Configuration/StandardSequences/EDMtoMEAtRunEnd_cff')
0070 process.dqmSaver.referenceHandling = cms.untracked.string('all')
0071 #
0072 cmssw_version = os.environ.get('CMSSW_VERSION','CMSSW_X_Y_Z')
0073 Workflow = '/JetMET/'+str(cmssw_version)+'/Harvesting'
0074 process.dqmSaver.workflow = Workflow
0075 
0076 #-----------------------------
0077 # Specify root file including reference histograms
0078 #-----------------------------
0079 
0080 #-----------------------------
0081 # Locate a directory in DQMStore
0082 #-----------------------------
0083 from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
0084 process.dqmInfoJetMET = DQMEDAnalyzer('DQMEventInfo',
0085                 subSystemFolder = cms.untracked.string('JetMET')
0086                 )
0087 
0088 #-----------------------------
0089 # JetMET Certification Module 
0090 #-----------------------------
0091 process.load("DQMOffline.JetMET.dataCertificationJetMET_cff")
0092 
0093 if harvesting:
0094   print()
0095 else:
0096   process.dataCertificationJetMET.fileName = cms.untracked.string(test_histogram_file)
0097 
0098 #-----------------------------
0099 # 
0100 #-----------------------------
0101 process.load("DQMOffline.Trigger.JetMETHLTOfflineClient_cfi")
0102 from DQMOffline.Trigger.JetMETHLTOfflineClient_cfi import *
0103 
0104 #-----------------------------
0105 # 
0106 #-----------------------------
0107 #process.p = cms.Path(process.dqmInfoJetMET*process.dataCertificationJetMET)
0108 
0109 process.p = cms.Path(process.EDMtoME
0110                      * process.dqmInfoJetMET
0111                      * process.jetMETHLTOfflineClient
0112                      * process.dataCertificationJetMETSequence
0113                      * process.dqmSaver)
0114