CMS 3D CMS Logo

pat::PATTrigProducer Class Reference

Produces a CandidateCollection of trigger objects. More...

#include <PhysicsTools/PatAlgos/plugins/PATTrigProducer.h>

Inheritance diagram for pat::PATTrigProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 PATTrigProducer (const edm::ParameterSet &iConfig)
 ~PATTrigProducer ()

Private Member Functions

virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)

Private Attributes

edm::InputTag filterName_
edm::InputTag triggerEvent_


Detailed Description

Produces a CandidateCollection of trigger objects.

A CandidateCollection of trigger objects from a given filter is produced from trigger information available in AOD.

Author:
Volker Adler
Version:
Id
PATTrigProducer.h,v 1.2 2008/06/08 12:24:03 vadler Exp

Definition at line 36 of file PATTrigProducer.h.


Constructor & Destructor Documentation

PATTrigProducer::PATTrigProducer ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 19 of file PATTrigProducer.cc.

00019                                                                :
00020   // initialize
00021   triggerEvent_ (iConfig.getParameter<InputTag>( "triggerEvent" ) ),
00022   filterName_   (iConfig.getParameter<InputTag>( "filterName" ) )
00023 {
00024   produces<TriggerPrimitiveCollection>();
00025 }

PATTrigProducer::~PATTrigProducer (  ) 

Definition at line 28 of file PATTrigProducer.cc.

00029 {
00030 }


Member Function Documentation

void PATTrigProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 33 of file PATTrigProducer.cc.

References filterName_, edm::Event::getByLabel(), edm::InputTag::label(), LogDebug, reco::Particle::p4(), edm::errors::ProductNotFound, ptr, edm::Event::put(), and triggerEvent_.

00034 {
00035   auto_ptr<TriggerPrimitiveCollection> patTrigCandidates( new TriggerPrimitiveCollection );
00036   Handle<TriggerEvent> triggerEvent;
00037   try { // In this case, we want to act differently compared to the usual behaviour on "ProductNotFound" exception thrown by Event::getByLabel.
00038     iEvent.getByLabel( triggerEvent_, triggerEvent );
00039     size_type nFilters = triggerEvent->sizeFilters();
00040     if ( nFilters == 0 ) {
00041       LogDebug( "noTriggerFilters" ) << "PATTrigProducer: The TriggerEvent of this event contains no filter information at all!";
00042     } else {
00043       size_type iFilter = triggerEvent->filterIndex( filterName_ );
00044       if ( iFilter == nFilters ) {
00045         LogDebug( "noTriggerFilter" ) << "PATTrigProducer: The TriggerEvent of this event contains no filter information on filter " << filterName_.label() << "!";
00046       } else {
00047         const Vids &                    triggerIds     = triggerEvent->filterIds( iFilter );
00048         const Keys &                    triggerKeys    = triggerEvent->filterKeys( iFilter );
00049         const TriggerObjectCollection & triggerObjects = triggerEvent->getObjects();
00050         assert( triggerIds.size() == triggerKeys.size() );
00051         for ( size_type idx = 0; idx < triggerKeys.size(); ++idx ) {
00052           const TriggerObject triggerObject = triggerObjects.at( triggerKeys.at( idx ) );
00053           auto_ptr<TriggerPrimitive> ptr( new TriggerPrimitive( triggerObject.particle().p4(), filterName_.label(), triggerIds.at( idx ), triggerObject.id() ) );
00054           patTrigCandidates->push_back( ptr );
00055         }
00056       } 
00057     }
00058   } catch( Exception exc ) {
00059     if ( exc.categoryCode() == errors::ProductNotFound ) {
00060       LogWarning( "noTriggerEvent" ) << "PATTrigProducer: No TriggerEvent " << triggerEvent_.label() << " found!";
00061     } else {
00062       throw exc;
00063     }
00064   }
00065   iEvent.put( patTrigCandidates );
00066 }


Member Data Documentation

edm::InputTag pat::PATTrigProducer::filterName_ [private]

Definition at line 48 of file PATTrigProducer.h.

Referenced by produce().

edm::InputTag pat::PATTrigProducer::triggerEvent_ [private]

Definition at line 47 of file PATTrigProducer.h.

Referenced by produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:49:44 2009 for CMSSW by  doxygen 1.5.4