Author: Evan K. Friis, UC Davis The PFTauEfficiencyAssociator produces ValueMap<pat::LookupTableRecord>s associating an expected efficiency (or fake rate, from QCD) for a reco::PFTau given its kinematics. The default configuration parameterizes the eff/fake rate by pt, eta and jet width and stores the information in a TH3. ''' import FWCore.ParameterSet.Config as cms from RecoTauTag.TauAnalysisTools.tools.ntupleDefinitions import pftau_expressions, common_expressions from RecoTauTag.TauAnalysisTools.fakeRate.histogramConfiguration import makeCuts from RecoTauTag.TauAnalysisTools.fakeRate.associatorTools import * # Get the histogram selection definitions. We don't need to worry about what # the denominator is here, we just need the names disc_configs = makeCuts(denominator="1") protoEffciencyAssociator = cms.EDProducer("PFTauEfficiencyAssociatorFromTH3", PFTauProducer = cms.InputTag("shrinkingConePFTauProducer"), xAxisFunction = pftau_expressions.jetPt, yAxisFunction = cms.string("abs(%s)" % pftau_expressions.jetEta.value()), zAxisFunction = pftau_expressions.jetWidth, efficiencySources = cms.PSet( filename = cms.string("/afs/cern.ch/user/f/friis/public/TauPeformance_QCD_BCtoMu.root"), # each efficiency source needs to be defined as a separate PSet ) ) # Build the list of efficiency sources from the histogram production # configuration disc_configs MuEnrichedQCDEffSources = add_eff_sources(prefix="fr",
to_build = [ (source, source_info) for source, source_info in sources.iteritems() if source in build_list ] for source, source_info in to_build: for location in list(source_info['sources'].keys()): print "Parsing %s logs" % location xSec, filterEff = source_info['sources'][location] nEvents = getNEvents("%s/*.stderr" % location, "path") weight = normalizeToOneInverseNanoBarn( xSec, nEvents, filterEff) # Update the info source_info['sources'][location] = ( xSec, filterEff, nEvents, weight) for source, source_info in to_build: print '===========================' print source for loc, (xSec, filterEff, nEvents, weight) in source_info['sources'].iteritems(): print "Loc: %s, nEvents: %i, weight %f" % (loc, nEvents, weight) for source, source_info in to_build: # Build file list files_and_weights = [] for loc, (xSec, filterEff, nEvents, weight) in source_info['sources'].iteritems(): for file in glob.glob("%s/*.root" % loc): files_and_weights.append((file, weight)) make_plots(files_and_weights, selections=makeCuts(denominator), **source_info)
for source, source_info in to_build: # Print out some info print '===========================' print source for loc, (xSec, filterEff, nEvents, weight) in source_info['sources'].iteritems(): print "Loc: %s, nEvents: %i, weight %f" % (loc, nEvents, weight) # Build file list if not options.ls: files_and_weights = [] for loc, (xSec, filterEff, nEvents, weight) in source_info['sources'].iteritems(): # Loop over the files to use for this run for file in nthOfEveryMItems( options.job, options.njobs, glob.glob(os.path.join(working_dir, "%s/*.root" % loc))): files_and_weights.append((file, weight)) # Change the output filename to reflect the batch job source_info['output_file'] = source_info['output_file'].replace( '.root', '_%i.root' % options.job) source_info['output_file'] = os.path.join(working_dir, source_info['output_file']) # Temporarily switch back to jetpt/eta make_plots(files_and_weights, selections=makeCuts(denominator), x_expr="$jetPt", y_expr="abs($jetEta)", **source_info)
Author: Evan K. Friis, UC Davis The PFTauEfficiencyAssociator produces ValueMap<pat::LookupTableRecord>s associating an expected efficiency (or fake rate, from QCD) for a reco::PFTau given its kinematics. The default configuration parameterizes the eff/fake rate by pt, eta and jet width and stores the information in a TH3. ''' import FWCore.ParameterSet.Config as cms from RecoTauTag.TauAnalysisTools.tools.ntupleDefinitions import pftau_expressions, common_expressions from RecoTauTag.TauAnalysisTools.fakeRate.histogramConfiguration import makeCuts from RecoTauTag.TauAnalysisTools.fakeRate.associatorTools import * # Get the histogram selection definitions. We don't need to worry about what # the denominator is here, we just need the names disc_configs = makeCuts(denominator="1") protoEffciencyAssociator = cms.EDProducer( "PFTauEfficiencyAssociatorFromTH3", PFTauProducer=cms.InputTag("shrinkingConePFTauProducer"), xAxisFunction=pftau_expressions.jetPt, yAxisFunction=cms.string("abs(%s)" % pftau_expressions.jetEta.value()), zAxisFunction=pftau_expressions.jetWidth, efficiencySources=cms.PSet( filename=cms.string( "/afs/cern.ch/user/f/friis/public/TauPeformance_QCD_BCtoMu.root"), # each efficiency source needs to be defined as a separate PSet )) # Build the list of efficiency sources from the histogram production # configuration disc_configs