import FWCore.ParameterSet.Config as cms
import os

process = cms.Process("DQM")
process.load("DQMServices.Core.DQM_cfg")

process.load("DQM.HLTEvF.HLTMonitor_cff")
process.load("DQM.HLTEvF.HLTMonitorClient_cff")
process.load("DQM.TrigXMonitor.HLTScalers_cfi")
process.load("DQM.TrigXMonitorClient.HLTScalersClient_cfi")
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.hlts.l1GtData = cms.InputTag("l1GtUnpack","","DQM")
process.hlts.dqmFolder = cms.untracked.string("HLT/HLTScalers_SM")
process.hltsClient.dqmFolder = cms.untracked.string("HLT/HLTScalers_SM")
process.p = cms.EndPath(process.hlts+process.hltsClient)

process.load("Configuration.StandardSequences.GeometryPilot2_cff")
process.load("Configuration.StandardSequences.MagneticField_cff")
process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff" )
process.GlobalTag.connect   = 'frontier://FrontierProd/CMS_COND_31X_GLOBALTAG'
process.GlobalTag.pfnPrefix = cms.untracked.string('frontier://FrontierProd/') 
process.GlobalTag.globaltag = cms.string('GR10_H_V9::All')
process.es_prefer_GlobalTag = cms.ESPrefer('PoolDBESSource','GlobalTag') 

#SiStrip Local Reco
process.SiStripDetInfoFileReader = cms.Service("SiStripDetInfoFileReader")
process.TkDetMap = cms.Service("TkDetMap")

process.GlobalTrackingGeometryESProducer = cms.ESProducer( "GlobalTrackingGeometryESProducer" )

process.load("DQMServices.Components.DQMEnvironment_cfi")

process.maxEvents = cms.untracked.PSet(
    input = cms.untracked.int32(-1)
)

process.source = cms.Source("PoolSource",
    fileNames = cms.untracked.vstring(
        'file:inputfile.root'
    )
)

process.pp = cms.Path(process.dqmEnv+process.dqmSaver)
process.DQMStore.verbose = 0
process.DQM.collectorHost = 'localhost'
process.DQM.collectorPort = 9190
process.dqmSaver.dirName = '.'
process.dqmSaver.producer = 'DQM'
#process.hltResults.plotAll = True
process.dqmSaver.convention = 'Offline'
process.dqmSaver.workflow = os.environ['WORKFLOW']
process.dqmEnv.subSystemFolder = 'HLT'
process.dqmSaver.saveByRun = 1
#process.dqmSaver.saveAtJobEnd = True

process.options = cms.untracked.PSet(
    wantSummary = cms.untracked.bool(True)
)

