CMS 3D CMS Logo

pat::TriggerEvent Class Reference

Analysis-level trigger object class. More...

#include <DataFormats/PatCandidates/interface/TriggerEvent.h>

List of all members.

Public Member Functions

TriggerFilterRefVector acceptedFilters () const
TriggerPathRefVector acceptedPaths () const
bool addObjectMatchResult (const edm::OrphanHandle< TriggerObjectMatch > &trigMatches, const std::string &labelMatcher)
bool addObjectMatchResult (const edm::Handle< TriggerObjectMatch > &trigMatches, const std::string &labelMatcher)
bool addObjectMatchResult (const TriggerObjectMatchRefProd &trigMatches, const std::string &labelMatcher)
 objects related
const TriggerFilterfilter (const std::string &labelFilter) const
 filters related
std::vector< std::string > filterCollections (const std::string &labelFilter) const
bool filterInPath (const TriggerFilterRef &filterRef, const std::string &namePath) const
TriggerObjectRefVector filterObjects (const std::string &labelFilter) const
TriggerPathRefVector filterPaths (const TriggerFilterRef &filterRef) const
const TriggerFilterCollectionfilters () const
unsigned indexFilter (const std::string &labelFilter) const
unsigned indexPath (const std::string &namePath) const
std::string nameHltTable () const
TriggerFilterRefVector objectFilters (const TriggerObjectRef &objectRef) const
bool objectInFilter (const TriggerObjectRef &objectRef, const std::string &labelFilter) const
bool objectInPath (const TriggerObjectRef &objectRef, const std::string &namePath) const
TriggerPathRefVector objectPaths (const TriggerObjectRef &objectRef) const
TriggerObjectRefVector objects (unsigned filterId) const
const TriggerObjectCollectionobjects () const
const TriggerPathpath (const std::string &namePath) const
 paths related
TriggerFilterRefVector pathFilters (const std::string &namePath) const
TriggerFilterRefVector pathModules (const std::string &namePath, bool all=true) const
 x-collection related
TriggerObjectRefVector pathObjects (const std::string &namePath) const
const TriggerPathCollectionpaths () const
void setAccept (bool accept)
void setError (bool error)
void setFilters (const edm::Handle< TriggerFilterCollection > &handleTriggerFilters)
 filters related
void setNameHltTable (const std::string &name)
 event related
void setObjects (const edm::Handle< TriggerObjectCollection > &handleTriggerObjects)
 objects related
void setPaths (const edm::Handle< TriggerPathCollection > &handleTriggerPaths)
 paths related
void setRun (bool run)
 TriggerEvent (const std::string &nameHltTable, bool run, bool accept, bool error)
 constructor from values
 TriggerEvent ()
 constructors and desctructor
std::vector< std::string > triggerMatchers () const
 trigger matches
const TriggerObjectMatchtriggerObjectMatchResult (const std::string &labelMatcher) const
const TriggerObjectMatchContainertriggerObjectMatchResults () const
bool wasAccept () const
bool wasError () const
bool wasRun () const
virtual ~TriggerEvent ()

Private Attributes

bool accept_
bool error_
TriggerFilterRefProd filters_
 filters related data members
std::string nameHltTable_
 event related data members
TriggerObjectMatchContainer objectMatchResults_
TriggerObjectRefProd objects_
 objects related data members
TriggerPathRefProd paths_
 paths related data members
bool run_


Detailed Description

Analysis-level trigger object class.

TriggerEvent implements a container for trigger event's information within the 'pat' namespace. It has the following data members:

Author:
Volker Adler
Version:
Id
TriggerEvent.h,v 1.1.2.4 2009/04/28 18:34:09 vadler Exp

Definition at line 40 of file TriggerEvent.h.


Constructor & Destructor Documentation

pat::TriggerEvent::TriggerEvent (  )  [inline]

constructors and desctructor

Definition at line 61 of file TriggerEvent.h.

References objectMatchResults_.

00061 { objectMatchResults_.clear(); };

TriggerEvent::TriggerEvent ( const std::string &  nameHltTable,
bool  run,
bool  accept,
bool  error 
)

constructor from values

Definition at line 15 of file TriggerEvent.cc.

References objectMatchResults_.

00015                                                                                               :
00016   nameHltTable_( nameHltTable ),
00017   run_( run ),
00018   accept_( accept ),
00019   error_( error )
00020 {
00021   objectMatchResults_.clear();
00022 }

virtual pat::TriggerEvent::~TriggerEvent (  )  [inline, virtual]

Definition at line 63 of file TriggerEvent.h.

00063 {};


Member Function Documentation

TriggerFilterRefVector TriggerEvent::acceptedFilters (  )  const

Definition at line 80 of file TriggerEvent.cc.

References begin, filters(), indexFilter(), and edm::RefVector< C, T, F >::push_back().

00081 {
00082   TriggerFilterRefVector theAcceptedFilters;
00083   for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00084     if ( iFilter->status() == 1 ) {
00085       const std::string labelFilter( iFilter->label() );
00086       const TriggerFilterRef filterRef( filters(), indexFilter( labelFilter ) );
00087       theAcceptedFilters.push_back( filterRef );
00088     }
00089   }
00090   return theAcceptedFilters;
00091 }

TriggerPathRefVector TriggerEvent::acceptedPaths (  )  const

Definition at line 46 of file TriggerEvent.cc.

References begin, indexPath(), paths(), and edm::RefVector< C, T, F >::push_back().

00047 {
00048   TriggerPathRefVector theAcceptedPaths;
00049   for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00050     if ( iPath->wasAccept() ) {
00051       const std::string namePath( iPath->name() );
00052       const TriggerPathRef pathRef( paths(), indexPath( namePath ) );
00053       theAcceptedPaths.push_back( pathRef );
00054     }
00055   }
00056   return theAcceptedPaths;
00057 }

bool TriggerEvent::addObjectMatchResult ( const edm::OrphanHandle< TriggerObjectMatch > &  trigMatches,
const std::string &  labelMatcher 
)

Definition at line 109 of file TriggerEvent.cc.

References addObjectMatchResult().

00110 {
00111   return addObjectMatchResult( TriggerObjectMatchRefProd( trigMatches ), labelMatcher );
00112 }

bool TriggerEvent::addObjectMatchResult ( const edm::Handle< TriggerObjectMatch > &  trigMatches,
const std::string &  labelMatcher 
)

Definition at line 105 of file TriggerEvent.cc.

References addObjectMatchResult().

00106 {
00107   return addObjectMatchResult( TriggerObjectMatchRefProd( trigMatches ), labelMatcher );
00108 }

bool TriggerEvent::addObjectMatchResult ( const TriggerObjectMatchRefProd trigMatches,
const std::string &  labelMatcher 
)

objects related

Definition at line 95 of file TriggerEvent.cc.

References end, find(), objectMatchResults_, and triggerObjectMatchResults().

Referenced by addObjectMatchResult().

00096 {
00097   if ( triggerObjectMatchResults()->find( labelMatcher ) == triggerObjectMatchResults()->end() ) {
00098     objectMatchResults_[ labelMatcher ] = trigMatches;
00099     return true;
00100   }
00101   edm::LogWarning( "existingObjectMatchResult" ) << "Tried adding trigger object match result from " << labelMatcher << ", although existing.\n"
00102                                                  << "Skipped.";
00103   return false;
00104 }

const TriggerFilter * TriggerEvent::filter ( const std::string &  labelFilter  )  const

filters related

Definition at line 61 of file TriggerEvent.cc.

References begin, and filters().

Referenced by filterCollections(), filterObjects(), and objectInFilter().

00062 {
00063   for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00064     if ( iFilter->label() == labelFilter ) {
00065       return &*iFilter;
00066     }
00067   }
00068   return 0;
00069 }

std::vector< std::string > TriggerEvent::filterCollections ( const std::string &  labelFilter  )  const

Definition at line 168 of file TriggerEvent.cc.

References asciidump::at, collection, filter(), pat::TriggerFilter::hasObjectKey(), and objects().

00169 {
00170   std::vector< std::string > theFilterCollections;
00171   for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00172     if ( filter( labelFilter )->hasObjectKey( iObject ) ) {
00173       bool found( false );
00174       std::string objectCollection( objects()->at( iObject ).collection() );
00175       for ( std::vector< std::string >::const_iterator iC = theFilterCollections.begin(); iC != theFilterCollections.end(); ++iC ) {
00176         if ( *iC == objectCollection ) {
00177           found = true;
00178           break;
00179         }
00180       }
00181       if ( ! found ) {
00182         theFilterCollections.push_back( objectCollection );
00183       }
00184     }
00185   }
00186   return theFilterCollections;
00187 }

bool TriggerEvent::filterInPath ( const TriggerFilterRef filterRef,
const std::string &  namePath 
) const

Definition at line 153 of file TriggerEvent.cc.

References begin, edm::RefVector< C, T, F >::end(), and pathFilters().

00154 {
00155   for ( TriggerFilterRefVector::const_iterator iFilter = pathFilters( namePath ).begin(); iFilter != pathFilters( namePath ).end(); ++iFilter ) {
00156     if ( filterRef == *iFilter ) {
00157       return true;
00158     }
00159   }
00160   return false;
00161 }

TriggerObjectRefVector TriggerEvent::filterObjects ( const std::string &  labelFilter  )  const

Definition at line 189 of file TriggerEvent.cc.

References filter(), pat::TriggerFilter::hasObjectKey(), objects(), and edm::RefVector< C, T, F >::push_back().

Referenced by pathObjects().

00190 {
00191   TriggerObjectRefVector theFilterObjects;
00192   for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00193     if ( filter( labelFilter )->hasObjectKey( iObject ) ) {
00194       const TriggerObjectRef objectRef( objects(), iObject );
00195       theFilterObjects.push_back( objectRef );
00196     }
00197   }
00198   return theFilterObjects;
00199 }

TriggerPathRefVector TriggerEvent::filterPaths ( const TriggerFilterRef filterRef  )  const

Definition at line 163 of file TriggerEvent.cc.

00164 {
00165   return TriggerPathRefVector();
00166 }

const TriggerFilterCollection* pat::TriggerEvent::filters (  )  const [inline]

Definition at line 84 of file TriggerEvent.h.

References filters_, and edm::RefProd< C >::get().

Referenced by acceptedFilters(), filter(), indexFilter(), objectFilters(), pathFilters(), and pathModules().

00084 { return filters_.get(); };           // returns 0 if RefProd is null

unsigned TriggerEvent::indexFilter ( const std::string &  labelFilter  )  const

Definition at line 71 of file TriggerEvent.cc.

References asciidump::at, filters(), label, and size.

Referenced by acceptedFilters(), objectFilters(), and pathModules().

00072 {
00073   unsigned iFilter = 0;
00074   while ( iFilter < filters()->size() && filters()->at( iFilter ).label() != labelFilter ) {
00075     ++iFilter;
00076   }
00077   return iFilter;
00078 }

unsigned TriggerEvent::indexPath ( const std::string &  namePath  )  const

Definition at line 37 of file TriggerEvent.cc.

References asciidump::at, name, paths(), and size.

Referenced by acceptedPaths(), and objectPaths().

00038 {
00039   unsigned iPath = 0;
00040   while ( iPath < paths()->size() && paths()->at( iPath ).name() != namePath ) {
00041     ++iPath;
00042   }
00043   return iPath;
00044 }

std::string pat::TriggerEvent::nameHltTable (  )  const [inline]

Definition at line 70 of file TriggerEvent.h.

References nameHltTable_.

00070 { return nameHltTable_; };

TriggerFilterRefVector TriggerEvent::objectFilters ( const TriggerObjectRef objectRef  )  const

Definition at line 205 of file TriggerEvent.cc.

References begin, filters(), indexFilter(), objectInFilter(), and edm::RefVector< C, T, F >::push_back().

00206 {
00207   TriggerFilterRefVector theObjectFilters;
00208   for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00209     const std::string labelFilter( iFilter->label() );
00210     if ( objectInFilter( objectRef, labelFilter ) ) {
00211       const TriggerFilterRef filterRef( filters(), indexFilter( labelFilter ) );
00212       theObjectFilters.push_back( filterRef );
00213     }
00214   }
00215   return theObjectFilters;
00216 }

bool TriggerEvent::objectInFilter ( const TriggerObjectRef objectRef,
const std::string &  labelFilter 
) const

Definition at line 201 of file TriggerEvent.cc.

References filter(), pat::TriggerFilter::hasObjectKey(), and edm::Ref< C, T, F >::key().

Referenced by objectFilters(), and objectInPath().

00201                                                                                                            {
00202   return filter( labelFilter )->hasObjectKey( objectRef.key() );
00203 }

bool TriggerEvent::objectInPath ( const TriggerObjectRef objectRef,
const std::string &  namePath 
) const

Definition at line 230 of file TriggerEvent.cc.

References begin, edm::RefVector< C, T, F >::end(), objectInFilter(), and pathFilters().

Referenced by objectPaths().

00231 {
00232   for ( TriggerFilterRefVector::const_iterator iFilter = pathFilters( namePath ).begin(); iFilter != pathFilters( namePath ).end(); ++iFilter ) {
00233     if ( objectInFilter( objectRef, ( *iFilter )->label() ) ) {
00234       return true;
00235     }
00236   }
00237   return false;
00238 }

TriggerPathRefVector TriggerEvent::objectPaths ( const TriggerObjectRef objectRef  )  const

Definition at line 240 of file TriggerEvent.cc.

References begin, indexPath(), objectInPath(), paths(), and edm::RefVector< C, T, F >::push_back().

00241 {
00242   TriggerPathRefVector theObjectPaths;
00243   for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00244     const std::string namePath( iPath->name() );
00245     if ( objectInPath( objectRef, namePath ) ) {
00246       const TriggerPathRef pathRef( paths(), indexPath( namePath ) );
00247       theObjectPaths.push_back( pathRef );
00248     }
00249   }
00250   return theObjectPaths;
00251 }

TriggerObjectRefVector TriggerEvent::objects ( unsigned  filterId  )  const

Definition at line 114 of file TriggerEvent.cc.

References objects(), and edm::RefVector< C, T, F >::push_back().

00115 {
00116   TriggerObjectRefVector theObjects;
00117   for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00118     if ( objects()->at( iObject ).hasFilterId( filterId ) ) {
00119       const TriggerObjectRef objectRef( objects(), iObject );
00120       theObjects.push_back( objectRef );
00121     }
00122   }
00123   return theObjects;
00124 }

const TriggerObjectCollection* pat::TriggerEvent::objects (  )  const [inline]

Definition at line 94 of file TriggerEvent.h.

References edm::RefProd< C >::get(), and objects_.

Referenced by filterCollections(), filterObjects(), and objects().

00094 { return objects_.get(); };                                             // returns 0 if RefProd is null

const TriggerPath * TriggerEvent::path ( const std::string &  namePath  )  const

paths related

Definition at line 27 of file TriggerEvent.cc.

References begin, and paths().

Referenced by pathFilters(), and pathModules().

00028 {
00029   for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00030     if ( namePath == iPath->name() ) {
00031       return &*iPath;
00032     }
00033   }
00034   return 0;
00035 }

TriggerFilterRefVector TriggerEvent::pathFilters ( const std::string &  namePath  )  const

Definition at line 143 of file TriggerEvent.cc.

References asciidump::at, pat::TriggerPath::filterIndices(), filters(), path(), and edm::RefVector< C, T, F >::push_back().

Referenced by filterInPath(), objectInPath(), and pathObjects().

00144 {
00145   TriggerFilterRefVector thePathFilters;
00146   for ( unsigned iF = 0; iF < path( namePath )->filterIndices().size(); ++iF ) {
00147     const TriggerFilterRef filterRef( filters(), path( namePath )->filterIndices().at( iF ) );
00148     thePathFilters.push_back( filterRef );
00149   }
00150   return thePathFilters;
00151 }

TriggerFilterRefVector TriggerEvent::pathModules ( const std::string &  namePath,
bool  all = true 
) const

x-collection related

Definition at line 128 of file TriggerEvent.cc.

References asciidump::at, filters(), indexFilter(), pat::TriggerPath::lastActiveFilterSlot(), pat::TriggerPath::modules(), server-conf-online::modules, path(), edm::RefVector< C, T, F >::push_back(), and size.

00129 {
00130   TriggerFilterRefVector thePathFilters;
00131   if ( path( namePath )->modules().size() == 0 ) {
00132     return thePathFilters;
00133   }
00134   const unsigned onePastLastFilter = all ? path( namePath )->modules().size() : path( namePath )->lastActiveFilterSlot() + 1;
00135   for ( unsigned iM = 0; iM < onePastLastFilter; ++iM ) {
00136     const std::string labelFilter( path( namePath )->modules().at( iM ) );
00137     const TriggerFilterRef filterRef( filters(), indexFilter( labelFilter ) ); // NULL, if filter was not in trigger::TriggerEvent
00138     thePathFilters.push_back( filterRef );
00139   }
00140   return thePathFilters;
00141 }

TriggerObjectRefVector TriggerEvent::pathObjects ( const std::string &  namePath  )  const

Definition at line 218 of file TriggerEvent.cc.

References begin, edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), filterObjects(), pathFilters(), and edm::RefVector< C, T, F >::push_back().

00219 {
00220   TriggerObjectRefVector thePathObjects;
00221   for ( TriggerFilterRefVector::const_iterator iFilter = pathFilters( namePath ).begin(); iFilter != pathFilters( namePath ).end(); ++iFilter ) {
00222     const std::string labelFilter( ( *iFilter )->label() );
00223     for ( TriggerObjectRefVector::const_iterator iObject = filterObjects( labelFilter ).begin(); iObject != filterObjects( labelFilter ).end(); ++iObject ) {
00224       thePathObjects.push_back( *iObject );
00225     }
00226   }
00227   return thePathObjects;
00228 }

const TriggerPathCollection* pat::TriggerEvent::paths (  )  const [inline]

Definition at line 77 of file TriggerEvent.h.

References edm::RefProd< C >::get(), and paths_.

Referenced by acceptedPaths(), indexPath(), objectPaths(), and path().

00077 { return paths_.get(); };          // returns 0 if RefProd is null

void pat::TriggerEvent::setAccept ( bool  accept  )  [inline]

Definition at line 68 of file TriggerEvent.h.

References accept_.

00068 { accept_       = accept; };

void pat::TriggerEvent::setError ( bool  error  )  [inline]

Definition at line 69 of file TriggerEvent.h.

00069 { error         = error; };

void pat::TriggerEvent::setFilters ( const edm::Handle< TriggerFilterCollection > &  handleTriggerFilters  )  [inline]

filters related

Definition at line 83 of file TriggerEvent.h.

References filters_.

00083 { filters_ = TriggerFilterRefProd( handleTriggerFilters ); };

void pat::TriggerEvent::setNameHltTable ( const std::string &  name  )  [inline]

event related

Definition at line 66 of file TriggerEvent.h.

References nameHltTable_.

00066 { nameHltTable_ = name; };

void pat::TriggerEvent::setObjects ( const edm::Handle< TriggerObjectCollection > &  handleTriggerObjects  )  [inline]

objects related

Definition at line 90 of file TriggerEvent.h.

References objects_.

00090 { objects_ = TriggerObjectRefProd( handleTriggerObjects ); };

void pat::TriggerEvent::setPaths ( const edm::Handle< TriggerPathCollection > &  handleTriggerPaths  )  [inline]

paths related

Definition at line 76 of file TriggerEvent.h.

References paths_.

00076 { paths_ = TriggerPathRefProd( handleTriggerPaths ); };

void pat::TriggerEvent::setRun ( bool  run  )  [inline]

Definition at line 67 of file TriggerEvent.h.

References run_.

00067 { run_          = run; };

std::vector< std::string > TriggerEvent::triggerMatchers (  )  const

trigger matches

Definition at line 255 of file TriggerEvent.cc.

References begin, and triggerObjectMatchResults().

Referenced by pat::helper::TriggerMatchHelper::triggerMatchObjects().

00256 {
00257   std::vector< std::string > theMatchers;
00258   for ( TriggerObjectMatchContainer::const_iterator iMatch = triggerObjectMatchResults()->begin(); iMatch != triggerObjectMatchResults()->end(); ++iMatch ) {
00259     theMatchers.push_back( iMatch->first );
00260   }
00261   return theMatchers;
00262 }

const TriggerObjectMatch * TriggerEvent::triggerObjectMatchResult ( const std::string &  labelMatcher  )  const

Definition at line 264 of file TriggerEvent.cc.

References end, find(), and triggerObjectMatchResults().

Referenced by pat::helper::TriggerMatchHelper::triggerMatchCandidates(), and pat::helper::TriggerMatchHelper::triggerMatchObject().

00265 {
00266   const TriggerObjectMatchContainer::const_iterator iMatch( triggerObjectMatchResults()->find( labelMatcher ) );
00267   if ( iMatch != triggerObjectMatchResults()->end() ) {
00268     return iMatch->second.get();
00269   }
00270   return 0;
00271 }

const TriggerObjectMatchContainer* pat::TriggerEvent::triggerObjectMatchResults (  )  const [inline]

Definition at line 112 of file TriggerEvent.h.

References objectMatchResults_.

Referenced by addObjectMatchResult(), triggerMatchers(), and triggerObjectMatchResult().

00112 { return &objectMatchResults_; };

bool pat::TriggerEvent::wasAccept (  )  const [inline]

Definition at line 72 of file TriggerEvent.h.

References accept_.

00072 { return accept_; };

bool pat::TriggerEvent::wasError (  )  const [inline]

Definition at line 73 of file TriggerEvent.h.

References error_.

00073 { return error_; };

bool pat::TriggerEvent::wasRun (  )  const [inline]

Definition at line 71 of file TriggerEvent.h.

References run_.

00071 { return run_; };


Member Data Documentation

bool pat::TriggerEvent::accept_ [private]

Definition at line 45 of file TriggerEvent.h.

Referenced by setAccept(), and wasAccept().

bool pat::TriggerEvent::error_ [private]

Definition at line 46 of file TriggerEvent.h.

Referenced by wasError().

TriggerFilterRefProd pat::TriggerEvent::filters_ [private]

filters related data members

Definition at line 52 of file TriggerEvent.h.

Referenced by filters(), and setFilters().

std::string pat::TriggerEvent::nameHltTable_ [private]

event related data members

Definition at line 43 of file TriggerEvent.h.

Referenced by nameHltTable(), and setNameHltTable().

TriggerObjectMatchContainer pat::TriggerEvent::objectMatchResults_ [private]

Definition at line 56 of file TriggerEvent.h.

Referenced by addObjectMatchResult(), TriggerEvent(), and triggerObjectMatchResults().

TriggerObjectRefProd pat::TriggerEvent::objects_ [private]

objects related data members

Definition at line 55 of file TriggerEvent.h.

Referenced by objects(), and setObjects().

TriggerPathRefProd pat::TriggerEvent::paths_ [private]

paths related data members

Definition at line 49 of file TriggerEvent.h.

Referenced by paths(), and setPaths().

bool pat::TriggerEvent::run_ [private]

Definition at line 44 of file TriggerEvent.h.

Referenced by setRun(), and wasRun().


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