Common Tools Trigger Utility Class
__PrescaleWeightProvider__

Complete: 4

Introduction

Because the luminosity can vary significantly during a run, it is desirable to be able to change the trigger prescales without stopping the run. This would cause significant variations in the DQM histograms and thus make it difficult to compare them to reference material. The PrescaleWeightProvider utility tries to correct for this by producing a weight defined as the lowest combined (L1 * HLT) prescale of a passing path from a selected set of triggers.

PrescaleWeightProvider must be initialized at the beginning of a run and can be used to obtain a weight for every event by means of a function that returns an integer. If for any reason the weight cannot be calculated, the weight returned is 1 and anything using the weight is unchanged.

For Users

This section describes, how to use the utility class and its filter with an CMSSW package, where it already has been incorporated. The incorporation itself is described here.

For the installation, follow the recipes given for the CMSSW package you are working with.

Configuration Location

The configuration of the applied filters can be located as follows:

  • directly in the configuration of the EDM module;
  • separately in a configuration file fragment (*_cff.py) by a cms.PSet and then imported into the configuration of the EDM module. This can be a centrally maintained *_cff.py as well as an individual one per e.g. sub-system;
  • by subsequent definition of the needed configuration parameters in any configuration file, which has access to the EDM module's configuration, e.g. by importing it. This is supported by a tolerance of the utility class against missing configuration parameters, so that they do not need to be defined in all cases.
    TIPThis is the recommended approach.

Configuration Parameters

This section explains the meaning and usage of the filter's configuration parameters. The filter's behaviour in case of certain configuration values is described here.

cms.uint32 prescaleWeightVerbosityLevel (default: 0): Determines what information is written to logs. 0 or less means complete silence, more than 0 gives warning and error messages.

cms.InputTag prescaleWeightTriggerResults (default: "TriggerResults::HLT"): The trigger results to be used to check whether paths passed or failed. The process of this InputTag also determines which set of prescales is used.

cms.InputTag prescaleWeightL1GtTriggerMenuLite (default: "l1GtTriggerMenuLite"): The TriggerMenuLite to be used for technical triggers.

cms.vstring prescaleWeightHltPaths : This is the list of high level trigger paths that will be considered when calculating the weight. It has no default and must be specified by the user.

Error Checks

  • Availability of configuration:
    • Performed in c'tor
    • Check if the TriggerResults process or label are empty
    • Check if the L1GtTriggerMenuLite label is empty
    • Check if the list of requested HLT paths is empty
    • If any of the above is empty, a corresponding warning will be issued (unless the verbosity is set to silent) and asking for a weight will always return 1

  • Initialization for each run:
    • Check if it is possible to initialize the HLTConfigProvider and whether the latter has a positive size after initialization
    • Check whether it is possible to retrieve a valid TriggerMenuLite with the requested label
    • If any of these fail, a corresponding warning will be issued (unless the verbosity is set to silent) and asking for a weight will always return 1

  • During the retrieval of a weight for each event:
    • Check if it is possible to retrieve a valid TriggerResults object with the requested label
    • Check whether each of the requested HLT paths can be found in the HLTConfigProvider . If not, the path is skipped and a corresponding warning is given (if not running silent)
    • Check whether each HLT path provides exactly 1 seed. If not, warn and return 1
    • Check whether the L1 seed of each HLT can be parsed. A path can only be parsed if the only logical expression it uses is OR. If the path cannot be parsed, the HLT path will be skipped with a corresponding warning
    • Check whether it is possible to retrieve the prescale for each path in the L1 seed. If the error code is ever zero, the L1 path will be skipped. If no prescale is found for any of the L1 paths, a warning will be issued (if not silent) and the HLT path will be skipped
    • Check whether any requested HLT path provides a weight. If not, warn and return 1
  • Note: the PrescaleWeightProvider will always react to any error by returning 1 leading anything that uses it to act as though it did not exist. It will issue warnings if the verbosity is not 0, but it will not act as a check on faulty conditions (this must be done separately).

For Developers

Implementation Details

The PrescaleWeightProvider module is similar to EDM modules. It consists of:

  • a c'tor which takes the parameter set as an argument
  • an initRun() method to be called from EDM module's beginRun()
  • the prescaleWeight() function which returns the weight for every event

Its data members are:

  • one of type L1GtUtils to access the L1 prescales
  • one of type HLTConfigProvider to access HLT prescales
  • one of type L1GtTriggerMenuLite to convert the index of a technical L1 bit to its name
  • variables that store the configuration parameters
  • a vector for the L1 trigger names

Retrieval of Event Information

The HLTConfigProvider is initialized in the initRun() function and the L1GtTriggerMenuLite is also retrieved at that stage. The L1GtUtils object is setup once for every event when prescaleWeight() is called. The module also makes use of TriggerResults which are likewise retrieved once per event in prescaleWeight().

Weight Algorithm

Once all of the event information has been retrieved and all objects have been initialized, PrescaleWeightProvider attempts to calculate a weight. It does this by looping over all requested HLT paths and computing the single lowest L1 * HLT prescale for every passing path. Whether or not the HLT path passes for an event is determined using TriggerResults. If it does not pass, it is skipped. Otherwise, the HLT prescale and L1 seed are retrieved from HLTConfigProvider. The L1 seed is then given to a function (parseL1Seeds()) which checks that the logical expression only contains ORs and if so, returns a vector of L1 paths (if not, the HLT path is skipped). If the L1 seed consists of algorithm trigger bits, the paths are given directly to L1GtUtils to obtain the L1 prescale. If the trigger bits are technical, they are first converted from numbers to strings using the L1GtTriggerMenuLite and then given to L1GtUtils to get the prescale. L1GtUtils is also used to check whether the L1 path was passed (if not, it is skipped). As the HLT paths are looped over, the weight is set to the lowest L1 * HLT prescale and this weight is returned after the loop.

Adding the Filter to an EDM Module

First, follow the installation recipe as given in the release notes. Then (of course) add also the package containing the EDM module you want to adapt to your working area.

Adding it to the C++ Code

These steps are needed in order to make the filtering available for an EDM module:

  • CMS.BuildFile of the package containing your EDM module:
    • add the line
<use name=CommonTools/TriggerUtils>
  • Interface (*.h) of your EDM module:
    • add the line
#include "CommonTools/TriggerUtils/interface/PrescaleWeightProvider.h"
    • add a data member of the type PrescaleWeightProvider * to your module class, e.g.
class myDqmModule : public edm::EDAnalyzer {
[...]
  private:
    PrescaleWeightProvider * prescaleWeightProvider_;
[...]
}
  • Source (*.cc) of your EDM module:
    • call the c'tor from the EDM module's c'tor, e.g.
myDqmModule::myDqmModule( const edm::ParameterSet& conf_ ) {
[...]
  prescaleWeightProvider_( new PrescaleWeightProvider( conf_ ) );
[...]
}
    • destroy it again in the EDM module's d'tor, e.g.
myDqmModule::~myDqmModule() {
[...]
  delete prescaleWeightProvider_;
[...]
}
    • initialize the PrescaleWeightProvider for each run in the EDM module's beginRun() method, e.g.
void myDqmModule::beginRun( edm::Run& run, edm::EventSetup& setup ) {
[...]
  prescaleWeightProvider_->initRun( run, setup );
[...]
}
    • retrieve the weight for each event, e.g.
{void analyze( const edm::Event& event, const edm::EventSetup& setup ){
[...]
int myPrescaleWeight = prescaleWeightProvider_->prescaleWeight( event, setup );
[...]
}

Adding it to the Configuration

The configuration parameters have to be added to the configuration of your EDM module:

  • either by directly including them
  • or by means of a cms.PSet than can be included into the configuration, possibly imported from another configuration file fragment;
  • or by defining the needed configuration parameters in a higher level configuration file, where the EDM module is included, like e.g.
from SubSystem.Package.myModule_cfi import myModule
myModule.prescaleWeightVerbosityLevel      = cms.uint32( 0 )
myModule.prescaleWeightTriggerResults      = cms.InputTag( "TriggerResults::HLT" )
myModule.prescaleWeightL1GtTriggerMenuLite = cms.InputTag( "l1GtTriggerMenuLite" )
myModule.prescaleWeightHltPaths            = cms.vstring( "HLT_Mu9","HLT_Mu7" ) 

Validation

The code has been tested in CMSSW_3_6_0 and CMSSW_3_9_0_pre2 on a variety of potentially troublesome cases. It works as expected.

Development Plans

We are currently looking into providing an error for the weight returned.

Release Notes

Recipes will be added once the tag for the release is known.

-- AramAvetisyan - 31-Aug-2010

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r6 - 2010-09-08 - AramAvetisyan
 
    • 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