cms-jet / JetToolbox

Python framework for configuration of jet tools via the jet toolbox.
https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetToolbox
7 stars 36 forks source link

Issue with Tasks implementation for 9X #51

Closed kpedro88 closed 6 years ago

kpedro88 commented 7 years ago

It was pointed out to me today that running my group's ntuple code in 92X (https://github.com/TreeMaker/TreeMaker/tree/Run2_2017) produces a file called jettoolbox.root, even though we haven't explicitly requested it.

The problem seems to be that the implementation of Tasks in the toolbox always adds this to the config:

process.out = cms.OutputModule("PoolOutputModule",
    fileName = cms.untracked.string('jettoolbox.root'),
    outputCommands = cms.untracked.vstring('keep *_ak8PFJetsCHSCleanPrunedMass_*_*', 
        'keep *_NjettinessAK8CHSClean_*_*', 
        'keep *_selectedPatJetsAK8PFCHSClean_*_*', 
        'drop *_selectedPatJetsAK8PFCHSClean_calo*_*', 
        'drop *_selectedPatJetsAK8PFCHSClean_tagInfos_*', 
        'drop *_selectedPatJets*_genJets_*', 
        'drop recoGenJets_*_*_*', 
        'drop *_selectedclean_tagInfos_*', 
        'keep *_patCaloMet_*_*', 
        'keep *_patCaloMet_*_*', 
        'keep *_patCaloMet_*_*')
)
process.endpath = cms.EndPath(process.out, process.myTask)

I'm not sure what the best solution is, but there needs to be some way for the user to turn this off.

kpedro88 commented 7 years ago

Maybe you can use some cms.Process accessors to check if there's already a path/endpath created, and if so, just associate the jet toolbox task with that (only creating the new endpath if nothing else is available)? https://github.com/cms-sw/cmssw/blob/CMSSW_9_1_X/FWCore/ParameterSet/python/Config.py#L210-L217