Config Editor Developers Page

Complete: 2
Detailed Review status

PAT Tools

The configuration tools provided by PAT allow the users to fit configuration files to their analysis, changing the PAT workflow as well as the event content. The PAT tools can be found in CMS.PhysicsTools/PatAlgos/python/tools folder, and a detailed description for CMSSW_3_5_3 release is available at SWGuidePATTools page. A typical PAT analysis can be created starting from a standard configuration file (CMS.PhysicsTools/PatAlgos/test) applying PAT tools in order to customize the user analysis.

The ConfigEditor is a graphical tool which allows to edit, not just to browse, configuration file to create PAT analysis. The integration of PAT tools within the GUI of the ConfigEditor requires an object oriented structure. The developers can find below instructions on how to migrate their own tools to this structure in order to allow their integration and usage in the ConfigEditor.

The ConfigToolBase class

The previous PAT tools structure consisted of a collection of functions. The new one is organized in classes inheriting from a base class common to all tools: the ConfigToolBase class. It is placed in the FWCore/GuiBrowsers package under the python folder The majority of methods is already implemented in the base class.

New design for tools

In order to include a tool in a configuration file by making use of the Config Editor, the developer needs to modify the tool according to a class based structure which extends the tool's functionalities providing more flexibility and allowing their integration with the graphical interface of the Config Editor.

In order to move the standard tool to the new design, start from the empty skeleton you can find in FWCore/GuiBrowsers/test and follow each step as below:

  • Put the tool name in place of the class name "ToolName" and insert the tool description between quotes. Change also the value for _label, assigning to it the class instance name.
 class ToolName(ConfigToolBase):
    """ Tool description

  • In the constructor:
    • add each tool parameter using the addParameter method specifying:
      • name, parName,
      • default value, parDefaultValue
      • description, parDescription - leave it as an empty string if description missing
      • type, Type, if no default value is specified
      • which are the supported values (allowededValues) for this parameters if there are, otherwise do not specify this argument
      • whether the None is supported or not (acceptNoneValue)
def __init__(self):
        self.addParameter(self._defaultParameters,'parName',parDefaultValue, parDescription, Type=parType, allowedValues=supportedValues, acceptNoneValue=isNoneallowed)
        self.addParameter(self._defaultParameters,'parName2',parDefaultValue, parDescription, Type=parType, allowedValues=supportedValues, acceptNoneValue=isNoneallowed)
    • set tool comment writing it between quotes (the comment will be included in the dumped code)
self._comment = "" 

  • In function __call__ just replace parNames with tool parameter names (leave default values set to None).
def __call__(self,process,
                 parName1     = None,
                 parName2     = None) :
        if  parName is None:
        if  parName2 is None:
  • In toolCode method rename parameter names. Put here the code from your tool without changing anything!
def toolCode(self, process):       
  • Remember to call, AFTER the end of the class block, an instance of the class using the same name as your old tool (it must be different from class name, even just for an upper/lower case) . It allows the user to run old configuration files without changing any line of code, although the new tool structure is very different from previous one.

How to use new tools

To test and apply tool, include it as usual and call it as it was a simple function:

from FWCore.GuiBrowsers.emptyTools import *
toolName(process, parName1, parName2)


Find examples of tools migrated at new design at CMS.PhysicsTools/PatAlgos/python/tools, and examples of their usage in CMS.PhysicsTools/PatAlgos/test.

Please, note that configuration files written using old PAT tools are still up to date, nothing has been changed in configuration.

Review status

Reviewer/Editor and Date (copy from screen) Comments
AndreasHinzmann - 03 Mar 2010 create page
AnnapaolaDeCosa - 24-Mar-2010 included ConfigToolBase description

Responsible: AnnapaolaDeCosa
Last reviewed by: AndreasHinzmann - 03 Mar 2010

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r6 - 2010-12-13 - AndreasHinzmann
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback