process.gemRecHits = cms.EDProducer("GEMRecHitProducer",
                                    recAlgoConfig = cms.PSet(),
                                    recAlgo = cms.string('GEMRecHitStandardAlgo'),
                                    gemDigiLabel = cms.InputTag("muonGEMDigis"),
                                    maskFile = cms.FileInPath(hotStripsFile),
                                    deadFile = cms.FileInPath(deadStripsFile),
                                    applyMasking = cms.bool(True)
                                    )

process.load('RecoMuon.TrackingTools.MuonServiceProxy_cff')

# Fast Efficiency - Get certified events from file
pyhtonModulesPath = os.path.abspath("runGEMCosmicStand_HighGranFastEff.py").split('QC8Test')[0]+'QC8Test/src/Analysis/GEMQC8/python/'
sys.path.insert(1,pyhtonModulesPath)
from readCertEvtsFromFile import GetCertifiedEvents
certEvts = GetCertifiedEvents(run_number)

process.HighGranFastEffQC8 = cms.EDProducer('HighGranFastEffQC8',
                                         process.MuonServiceProxy,
                                         verboseSimHit = cms.untracked.int32(1),
                                         recHitsInputLabel = cms.InputTag('gemRecHits'),
                                         maxClusterSize = cms.double(runConfig.maxClusterSize),
                                         minClusterSize = cms.double(runConfig.minClusterSize),
                                         tripEvents = cms.vstring(certEvts),
                                         nBinGlobalZR = cms.untracked.vdouble(200,200,200,150,180,250),
                                         RangeGlobalZR = cms.untracked.vdouble(564,572,786,794,786,802,110,260,170,350,100,350)
                                         )

process.TFileService = cms.Service("TFileService",
                                   fileName = cms.string('HighGranFastEff_'+strOutput)
                                   )
process.gemRecHits = cms.EDProducer(
    "GEMRecHitProducer",
    recAlgoConfig=cms.PSet(),
    recAlgo=cms.string('GEMRecHitStandardAlgo'),
    gemDigiLabel=cms.InputTag("muonGEMDigis"),
    maskFile=cms.FileInPath(hotStripsFile),
    deadFile=cms.FileInPath(deadStripsFile),
    applyMasking=cms.bool(False)  # See, nobody cares. :P
)

# Get certified events from file
pyhtonModulesPath = os.path.join(srcPath, "Analysis/GEMQC8/python/")
sys.path.insert(1, pyhtonModulesPath)
from readCertEvtsFromFile import GetCertifiedEvents
#certEvts = GetCertifiedEvents(run_number)
certEvts = GetCertifiedEvents(1)

# Reconstruction of muon track
process.load('RecoMuon.TrackingTools.MuonServiceProxy_cff')
process.MuonServiceProxy.ServiceParameters.Propagators.append(
    'StraightLinePropagator')

process.GEMCosmicMuonForQC8 = cms.EDProducer(
    "GEMCosmicMuonForQC8",
    process.MuonServiceProxy,
    gemRecHitLabel=cms.InputTag("gemRecHits"),
    maxClusterSize=cms.double(runConfig.maxClusterSize),
    minClusterSize=cms.double(runConfig.minClusterSize),
    trackChi2=cms.double(runConfig.trackChi2),
    trackResX=cms.double(runConfig.trackResX),
    trackResY=cms.double(runConfig.trackResY),