CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/Validation/RecoTau/python/tools/validator.py

Go to the documentation of this file.
00001 
00002 '''
00003 
00004 Modify a process to produce Validation plots for reco::Taus
00005 
00006 
00007 '''
00008 
00009 import FWCore.ParameterSet.Config as cms
00010 import Validation.RecoTau.tools.prototypes as proto
00011 
00012 
00013 def validate(process, algorithm, algorithm_info, sequence,
00014              discriminators=None, suffix=""):
00015     '''
00016     Given a producer and a list of discriminators,
00017     construct a sequence that selects taus passing each discriminator
00018     in turn and then plots quantities of the filtered taus.
00019 
00020     These new modules will be added to the [sequence].
00021     '''
00022 
00023     # This returns a function that registers a module in the process and adds
00024     # it to the given sequence.
00025     builder = proto.make_process_adder(process, sequence)
00026 
00027     # Make histograms of our RAW taus
00028     raw_plots = proto.tau_plotter.clone(
00029         src = cms.InputTag(algorithm_info['producer'])
00030     )
00031     # FIXME is it possible this will double count?
00032     # Add to process
00033     builder(algorithm + suffix + "Select" + "noSelection" +  "Plots", raw_plots)
00034     # Select and plot those passing each of the discriminators
00035     current_tau_src = algorithm_info['producer']
00036 
00037     for discriminator in discriminators:
00038         selector = proto.tau_disc_selector.clone(
00039             src = cms.InputTag(current_tau_src),
00040             discriminator = cms.InputTag(discriminator)
00041         )
00042         #current_tau_src = algorithm + "Select" + discriminator
00043         current_tau_src = algorithm + suffix + "Select" + discriminator
00044         builder(current_tau_src, selector)
00045         # Now make plots of those taus passing this selector
00046         plotter = proto.tau_plotter.clone(
00047             src = cms.InputTag(current_tau_src)
00048         )
00049         builder(current_tau_src + "Plots", plotter)