CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DataFormats/PatCandidates/src/TriggerEvent.cc

Go to the documentation of this file.
00001 //
00002 // $Id: TriggerEvent.cc,v 1.14.2.2 2011/04/07 09:36:49 vadler Exp $
00003 //
00004 
00005 
00006 #include "DataFormats/PatCandidates/interface/TriggerEvent.h"
00007 
00008 
00009 using namespace pat;
00010 
00011 
00012 // Constructors and Destructor
00013 
00014 
00015 // Constructor from values, HLT only
00016 TriggerEvent::TriggerEvent( const std::string & nameHltTable, bool run, bool accept, bool error, bool physDecl ) :
00017   nameHltTable_( nameHltTable ),
00018   run_( run ),
00019   accept_( accept ),
00020   error_( error ),
00021   physDecl_( physDecl )
00022 {
00023   objectMatchResults_.clear();
00024 }
00025 
00026 
00027 // Constructor from values, HLT and L1/GT
00028 TriggerEvent::TriggerEvent( const std::string & nameL1Menu, const std::string & nameHltTable, bool run, bool accept, bool error, bool physDecl ) :
00029   nameL1Menu_( nameL1Menu ),
00030   nameHltTable_( nameHltTable ),
00031   run_( run ),
00032   accept_( accept ),
00033   error_( error ),
00034   physDecl_( physDecl )
00035 {
00036   objectMatchResults_.clear();
00037 }
00038 
00039 
00040 // Methods
00041 
00042 
00043 // Get a pointer to a certain L1 algorithm by name
00044 const TriggerAlgorithm * TriggerEvent::algorithm( const std::string & nameAlgorithm ) const
00045 {
00046   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00047     if ( nameAlgorithm == iAlgorithm->name() ) return &*iAlgorithm;
00048   }
00049   return 0;
00050 }
00051 
00052 
00053 // Get the name of a certain L1 algorithm in the event collection by bit number physics or technical algorithms,
00054 std::string TriggerEvent::nameAlgorithm( const unsigned bitAlgorithm, const bool techAlgorithm ) const
00055 {
00056   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00057     if ( bitAlgorithm == iAlgorithm->bit() && techAlgorithm == iAlgorithm->techTrigger() ) return iAlgorithm->name();
00058   }
00059   return std::string( "" );
00060 }
00061 
00062 
00063 // Get the index of a certain L1 algorithm in the event collection by name
00064 unsigned TriggerEvent::indexAlgorithm( const std::string & nameAlgorithm ) const
00065 {
00066   unsigned iAlgorithm( 0 );
00067   while ( iAlgorithm < algorithms()->size() && algorithms()->at( iAlgorithm ).name() != nameAlgorithm ) ++iAlgorithm;
00068   return iAlgorithm;
00069 }
00070 
00071 
00072 // Get a vector of references to all succeeding L1 algorithms
00073 TriggerAlgorithmRefVector TriggerEvent::acceptedAlgorithms() const
00074 {
00075   TriggerAlgorithmRefVector theAcceptedAlgorithms;
00076   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00077     if ( iAlgorithm->decision() ) {
00078       const std::string nameAlgorithm( iAlgorithm->name() );
00079       const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00080       theAcceptedAlgorithms.push_back( algorithmRef );
00081     }
00082   }
00083   return theAcceptedAlgorithms;
00084 }
00085 
00086 
00087 // Get a vector of references to all L1 algorithms succeeding on the GTL board
00088 TriggerAlgorithmRefVector TriggerEvent::acceptedAlgorithmsGtl() const
00089 {
00090   TriggerAlgorithmRefVector theAcceptedAlgorithms;
00091   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00092     if ( iAlgorithm->gtlResult() ) {
00093       const std::string nameAlgorithm( iAlgorithm->name() );
00094       const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00095       theAcceptedAlgorithms.push_back( algorithmRef );
00096     }
00097   }
00098   return theAcceptedAlgorithms;
00099 }
00100 
00101 
00102 // Get a vector of references to all technical L1 algorithms
00103 TriggerAlgorithmRefVector TriggerEvent::techAlgorithms() const
00104 {
00105   TriggerAlgorithmRefVector theTechAlgorithms;
00106   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00107     if ( iAlgorithm->techTrigger() ) {
00108       const std::string nameAlgorithm( iAlgorithm->name() );
00109       const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00110       theTechAlgorithms.push_back( algorithmRef );
00111     }
00112   }
00113   return theTechAlgorithms;
00114 }
00115 
00116 
00117 // Get a vector of references to all succeeding technical L1 algorithms
00118 TriggerAlgorithmRefVector TriggerEvent::acceptedTechAlgorithms() const
00119 {
00120   TriggerAlgorithmRefVector theAcceptedTechAlgorithms;
00121   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00122     if ( iAlgorithm->techTrigger() && iAlgorithm->decision() ) {
00123       const std::string nameAlgorithm( iAlgorithm->name() );
00124       const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00125       theAcceptedTechAlgorithms.push_back( algorithmRef );
00126     }
00127   }
00128   return theAcceptedTechAlgorithms;
00129 }
00130 
00131 
00132 // Get a vector of references to all technical L1 algorithms succeeding on the GTL board
00133 TriggerAlgorithmRefVector TriggerEvent::acceptedTechAlgorithmsGtl() const
00134 {
00135   TriggerAlgorithmRefVector theAcceptedTechAlgorithms;
00136   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00137     if ( iAlgorithm->techTrigger() && iAlgorithm->gtlResult() ) {
00138       const std::string nameAlgorithm( iAlgorithm->name() );
00139       const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00140       theAcceptedTechAlgorithms.push_back( algorithmRef );
00141     }
00142   }
00143   return theAcceptedTechAlgorithms;
00144 }
00145 
00146 
00147 // Get a vector of references to all physics L1 algorithms
00148 TriggerAlgorithmRefVector TriggerEvent::physAlgorithms() const
00149 {
00150   TriggerAlgorithmRefVector thePhysAlgorithms;
00151   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00152     if ( ! iAlgorithm->techTrigger() ) {
00153       const std::string nameAlgorithm( iAlgorithm->name() );
00154       const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00155       thePhysAlgorithms.push_back( algorithmRef );
00156     }
00157   }
00158   return thePhysAlgorithms;
00159 }
00160 
00161 
00162 // Get a vector of references to all succeeding physics L1 algorithms
00163 TriggerAlgorithmRefVector TriggerEvent::acceptedPhysAlgorithms() const
00164 {
00165   TriggerAlgorithmRefVector theAcceptedPhysAlgorithms;
00166   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00167     if ( ! iAlgorithm->techTrigger() && iAlgorithm->decision() ) {
00168       const std::string nameAlgorithm( iAlgorithm->name() );
00169       const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00170       theAcceptedPhysAlgorithms.push_back( algorithmRef );
00171     }
00172   }
00173   return theAcceptedPhysAlgorithms;
00174 }
00175 
00176 
00177 // Get a vector of references to all physics L1 algorithms succeeding on the GTL board
00178 TriggerAlgorithmRefVector TriggerEvent::acceptedPhysAlgorithmsGtl() const
00179 {
00180   TriggerAlgorithmRefVector theAcceptedPhysAlgorithms;
00181   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00182     if ( ! iAlgorithm->techTrigger() && iAlgorithm->gtlResult() ) {
00183       const std::string nameAlgorithm( iAlgorithm->name() );
00184       const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00185       theAcceptedPhysAlgorithms.push_back( algorithmRef );
00186     }
00187   }
00188   return theAcceptedPhysAlgorithms;
00189 }
00190 
00191 
00192 // Get a pointer to a certain L1 condition by name
00193 const TriggerCondition * TriggerEvent::condition( const std::string & nameCondition ) const
00194 {
00195   for ( TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end(); ++iCondition ) {
00196     if ( nameCondition == iCondition->name() ) return &*iCondition;
00197   }
00198   return 0;
00199 }
00200 
00201 
00202 // Get the index of a certain L1 condition in the event collection by name
00203 unsigned TriggerEvent::indexCondition( const std::string & nameCondition ) const
00204 {
00205   unsigned iCondition( 0 );
00206   while ( iCondition < conditions()->size() && conditions()->at( iCondition ).name() != nameCondition ) ++iCondition;
00207   return iCondition;
00208 }
00209 
00210 
00211 // Get a vector of references to all succeeding L1 conditions
00212 TriggerConditionRefVector TriggerEvent::acceptedConditions() const
00213 {
00214   TriggerConditionRefVector theAcceptedConditions;
00215   for ( TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end(); ++iCondition ) {
00216     if ( iCondition->wasAccept() ) {
00217       const std::string nameCondition( iCondition->name() );
00218       const TriggerConditionRef conditionRef( conditions_, indexCondition( nameCondition ) );
00219       theAcceptedConditions.push_back( conditionRef );
00220     }
00221   }
00222   return theAcceptedConditions;
00223 }
00224 
00225 
00226 // Get a pointer to a certain HLT path by name
00227 const TriggerPath * TriggerEvent::path( const std::string & namePath ) const
00228 {
00229   for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00230     if ( namePath == iPath->name() ) return &*iPath;
00231   }
00232   return 0;
00233 }
00234 
00235 
00236 // Get the index of a certain HLT path in the event collection by name
00237 unsigned TriggerEvent::indexPath( const std::string & namePath ) const
00238 {
00239   unsigned iPath( 0 );
00240   while ( iPath < paths()->size() && paths()->at( iPath ).name() != namePath ) ++iPath;
00241   return iPath;
00242 }
00243 
00244 
00245 // Get a vector of references to all succeeding HLT paths
00246 TriggerPathRefVector TriggerEvent::acceptedPaths() const
00247 {
00248   TriggerPathRefVector theAcceptedPaths;
00249   for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00250     if ( iPath->wasAccept() ) {
00251       const std::string namePath( iPath->name() );
00252       const TriggerPathRef pathRef( paths_, indexPath( namePath ) );
00253       theAcceptedPaths.push_back( pathRef );
00254     }
00255   }
00256   return theAcceptedPaths;
00257 }
00258 
00259 
00260 // Get a pointer to a certain HLT filter by label
00261 const TriggerFilter * TriggerEvent::filter( const std::string & labelFilter ) const
00262 {
00263   for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00264     if ( iFilter->label() == labelFilter ) return &*iFilter;
00265   }
00266   return 0;
00267 }
00268 
00269 
00270 // Get the index of a certain HLT filter in the event collection by label
00271 unsigned TriggerEvent::indexFilter( const std::string & labelFilter ) const
00272 {
00273   unsigned iFilter( 0 );
00274   while ( iFilter < filters()->size() && filters()->at( iFilter ).label() != labelFilter ) ++iFilter;
00275   return iFilter;
00276 }
00277 
00278 
00279 // Get a vector of references to all succeeding HLT filters
00280 TriggerFilterRefVector TriggerEvent::acceptedFilters() const
00281 {
00282   TriggerFilterRefVector theAcceptedFilters;
00283   for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00284     if ( iFilter->status() == 1 ) {
00285       const std::string labelFilter( iFilter->label() );
00286       const TriggerFilterRef filterRef( filters_, indexFilter( labelFilter ) );
00287       theAcceptedFilters.push_back( filterRef );
00288     }
00289   }
00290   return theAcceptedFilters;
00291 }
00292 
00293 
00294 // Get a vector of references to all trigger objects by trigger object type
00295 TriggerObjectRefVector TriggerEvent::objects( trigger::TriggerObjectType triggerObjectType ) const
00296 {
00297   TriggerObjectRefVector theObjects;
00298   for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00299     if ( objects()->at( iObject ).hasTriggerObjectType( triggerObjectType ) ) {
00300       const TriggerObjectRef objectRef( objects_, iObject );
00301       theObjects.push_back( objectRef );
00302     }
00303   }
00304   return theObjects;
00305 }
00306 
00307 
00308 // Get a vector of references to all conditions assigned to a certain algorithm given by name
00309 TriggerConditionRefVector TriggerEvent::algorithmConditions( const std::string & nameAlgorithm ) const
00310 {
00311   TriggerConditionRefVector theAlgorithmConditions;
00312   if ( algorithm( nameAlgorithm ) ) {
00313     for ( unsigned iC = 0; iC < algorithm( nameAlgorithm )->conditionKeys().size(); ++iC ) {
00314       const TriggerConditionRef conditionRef( conditions_, algorithm( nameAlgorithm )->conditionKeys().at( iC ) );
00315       theAlgorithmConditions.push_back( conditionRef );
00316     }
00317   }
00318   return theAlgorithmConditions;
00319 }
00320 
00321 
00322 // Checks, if a condition is assigned to a certain algorithm given by name
00323 bool TriggerEvent::conditionInAlgorithm( const TriggerConditionRef & conditionRef, const std::string & nameAlgorithm ) const
00324 {
00325   TriggerConditionRefVector theConditions = algorithmConditions( nameAlgorithm );
00326   for ( TriggerConditionRefVectorIterator iCondition = theConditions.begin(); iCondition != theConditions.end(); ++iCondition ) {
00327     if ( conditionRef == *iCondition ) return true;
00328   }
00329   return false;
00330 }
00331 
00332 
00333 // Get a vector of references to all algorithms, which have a certain condition assigned
00334 TriggerAlgorithmRefVector TriggerEvent::conditionAlgorithms( const TriggerConditionRef & conditionRef ) const
00335 {
00336   TriggerAlgorithmRefVector theConditionAlgorithms;
00337   size_t cAlgorithms( 0 );
00338   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00339     const std::string nameAlgorithm( iAlgorithm->name() );
00340     if ( conditionInAlgorithm( conditionRef, nameAlgorithm ) ) {
00341       const TriggerAlgorithmRef algorithmRef( algorithms_, cAlgorithms );
00342       theConditionAlgorithms.push_back( algorithmRef );
00343     }
00344     ++cAlgorithms;
00345   }
00346   return theConditionAlgorithms;
00347 }
00348 
00349 
00350 // Get a list of all trigger object collections used in a certain condition given by name
00351 std::vector< std::string > TriggerEvent::conditionCollections( const std::string & nameCondition ) const
00352 {
00353   std::vector< std::string > theConditionCollections;
00354   if ( condition( nameCondition ) ) {
00355     for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00356       if ( condition( nameCondition )->hasObjectKey( iObject ) ) {
00357         bool found( false );
00358         std::string objectCollection( objects()->at( iObject ).collection() );
00359         for ( std::vector< std::string >::const_iterator iC = theConditionCollections.begin(); iC != theConditionCollections.end(); ++iC ) {
00360           if ( *iC == objectCollection ) {
00361             found = true;
00362             break;
00363           }
00364         }
00365         if ( ! found ) {
00366           theConditionCollections.push_back( objectCollection );
00367         }
00368       }
00369     }
00370   }
00371   return theConditionCollections;
00372 }
00373 
00374 
00375 // Get a vector of references to all objects, which were used in a certain condition given by name
00376 TriggerObjectRefVector TriggerEvent::conditionObjects( const std::string & nameCondition ) const
00377 {
00378   TriggerObjectRefVector theConditionObjects;
00379   if ( condition( nameCondition ) ) {
00380     for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00381       if ( condition( nameCondition )->hasObjectKey( iObject ) ) {
00382         const TriggerObjectRef objectRef( objects_, iObject );
00383         theConditionObjects.push_back( objectRef );
00384       }
00385     }
00386   }
00387   return theConditionObjects;
00388 }
00389 
00390 
00391 // Checks, if an object was used in a certain condition given by name
00392 bool TriggerEvent::objectInCondition( const TriggerObjectRef & objectRef, const std::string & nameCondition ) const {
00393   if ( condition( nameCondition ) ) return condition( nameCondition )->hasObjectKey( objectRef.key() );
00394   return false;
00395 }
00396 
00397 
00398 // Get a vector of references to all conditions, which have a certain object assigned
00399 TriggerConditionRefVector TriggerEvent::objectConditions( const TriggerObjectRef & objectRef ) const
00400 {
00401   TriggerConditionRefVector theObjectConditions;
00402   for ( TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end(); ++iCondition ) {
00403     const std::string nameCondition( iCondition->name() );
00404     if ( objectInCondition( objectRef, nameCondition ) ) {
00405       const TriggerConditionRef conditionRef( conditions_, indexCondition( nameCondition ) );
00406       theObjectConditions.push_back( conditionRef );
00407     }
00408   }
00409   return theObjectConditions;
00410 }
00411 
00412 
00413 // Get a vector of references to all objects, which were used in a certain algorithm given by name
00414 TriggerObjectRefVector TriggerEvent::algorithmObjects( const std::string & nameAlgorithm ) const
00415 {
00416   TriggerObjectRefVector    theAlgorithmObjects;
00417   TriggerConditionRefVector theConditions = algorithmConditions( nameAlgorithm );
00418   for ( TriggerConditionRefVectorIterator iCondition = theConditions.begin(); iCondition != theConditions.end(); ++iCondition ) {
00419     const std::string nameCondition( ( *iCondition )->name() );
00420     TriggerObjectRefVector theObjects = conditionObjects( nameCondition );
00421     for ( TriggerObjectRefVectorIterator iObject = theObjects.begin(); iObject != theObjects.end(); ++iObject ) {
00422       theAlgorithmObjects.push_back( *iObject );
00423     }
00424   }
00425   return theAlgorithmObjects;
00426 }
00427 
00428 
00429 // Checks, if an object was used in a certain algorithm given by name
00430 bool TriggerEvent::objectInAlgorithm( const TriggerObjectRef & objectRef, const std::string & nameAlgorithm ) const
00431 {
00432   TriggerConditionRefVector theConditions = algorithmConditions( nameAlgorithm );
00433   for ( TriggerConditionRefVectorIterator iCondition = theConditions.begin(); iCondition != theConditions.end(); ++iCondition ) {
00434     if ( objectInCondition( objectRef, ( *iCondition )->name() ) ) return true;
00435   }
00436   return false;
00437 }
00438 
00439 
00440 // Get a vector of references to all algorithms, which have a certain object assigned
00441 TriggerAlgorithmRefVector TriggerEvent::objectAlgorithms( const TriggerObjectRef & objectRef ) const
00442 {
00443   TriggerAlgorithmRefVector theObjectAlgorithms;
00444   for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00445     const std::string nameAlgorithm( iAlgorithm->name() );
00446     if ( objectInAlgorithm( objectRef, nameAlgorithm ) ) {
00447       const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00448       theObjectAlgorithms.push_back( algorithmRef );
00449     }
00450   }
00451   return theObjectAlgorithms;
00452 }
00453 
00454 
00455 // Get a vector of references to all modules assigned to a certain path given by name
00456 TriggerFilterRefVector TriggerEvent::pathModules( const std::string & namePath, bool all ) const
00457 {
00458   TriggerFilterRefVector thePathFilters;
00459   if ( path( namePath ) && path( namePath )->modules().size() > 0 ) {
00460     const unsigned onePastLastFilter = all ? path( namePath )->modules().size() : path( namePath )->lastActiveFilterSlot() + 1;
00461     for ( unsigned iM = 0; iM < onePastLastFilter; ++iM ) {
00462       const std::string labelFilter( path( namePath )->modules().at( iM ) );
00463       const TriggerFilterRef filterRef( filters_, indexFilter( labelFilter ) );
00464       thePathFilters.push_back( filterRef );
00465     }
00466   }
00467   return thePathFilters;
00468 }
00469 
00470 
00471 // Get a vector of references to all active HLT filters assigned to a certain path given by name
00472 TriggerFilterRefVector TriggerEvent::pathFilters( const std::string & namePath ) const
00473 {
00474   TriggerFilterRefVector thePathFilters;
00475   if ( path( namePath ) ) {
00476     for ( unsigned iF = 0; iF < path( namePath )->filterIndices().size(); ++iF ) {
00477       const TriggerFilterRef filterRef( filters_, path( namePath )->filterIndices().at( iF ) );
00478       thePathFilters.push_back( filterRef );
00479     }
00480   }
00481   return thePathFilters;
00482 }
00483 
00484 
00485 // Checks, if a filter is assigned to and was run in a certain path given by name
00486 bool TriggerEvent::filterInPath( const TriggerFilterRef & filterRef, const std::string & namePath ) const
00487 {
00488   TriggerFilterRefVector theFilters = pathFilters( namePath );
00489   for ( TriggerFilterRefVectorIterator iFilter = theFilters.begin(); iFilter != theFilters.end(); ++iFilter ) {
00490     if ( filterRef == *iFilter ) return true;
00491   }
00492   return false;
00493 }
00494 
00495 
00496 // Get a vector of references to all paths, which have a certain filter assigned
00497 TriggerPathRefVector TriggerEvent::filterPaths( const TriggerFilterRef & filterRef ) const
00498 {
00499   TriggerPathRefVector theFilterPaths;
00500   size_t cPaths( 0 );
00501   for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00502     const std::string namePath( iPath->name() );
00503     if ( filterInPath( filterRef, namePath ) ) {
00504       const TriggerPathRef pathRef( paths_, cPaths );
00505       theFilterPaths.push_back( pathRef );
00506     }
00507     ++cPaths;
00508   }
00509   return theFilterPaths;
00510 }
00511 
00512 
00513 // Get a list of all trigger object collections used in a certain filter given by name
00514 std::vector< std::string > TriggerEvent::filterCollections( const std::string & labelFilter ) const
00515 {
00516   std::vector< std::string > theFilterCollections;
00517   if ( filter( labelFilter ) ) {
00518     for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00519       if ( filter( labelFilter )->hasObjectKey( iObject ) ) {
00520         bool found( false );
00521         std::string objectCollection( objects()->at( iObject ).collection() );
00522         for ( std::vector< std::string >::const_iterator iC = theFilterCollections.begin(); iC != theFilterCollections.end(); ++iC ) {
00523           if ( *iC == objectCollection ) {
00524             found = true;
00525             break;
00526           }
00527         }
00528         if ( ! found ) {
00529           theFilterCollections.push_back( objectCollection );
00530         }
00531       }
00532     }
00533   }
00534   return theFilterCollections;
00535 }
00536 
00537 
00538 // Get a vector of references to all objects, which were used in a certain filter given by name
00539 TriggerObjectRefVector TriggerEvent::filterObjects( const std::string & labelFilter ) const
00540 {
00541   TriggerObjectRefVector theFilterObjects;
00542   if ( filter( labelFilter ) ) {
00543     for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00544       if ( filter( labelFilter )->hasObjectKey( iObject ) ) {
00545         const TriggerObjectRef objectRef( objects_, iObject );
00546         theFilterObjects.push_back( objectRef );
00547       }
00548     }
00549   }
00550   return theFilterObjects;
00551 }
00552 
00553 
00554 // Checks, if an object was used in a certain filter given by name
00555 bool TriggerEvent::objectInFilter( const TriggerObjectRef & objectRef, const std::string & labelFilter ) const {
00556   if ( filter( labelFilter ) ) return filter( labelFilter )->hasObjectKey( objectRef.key() );
00557   return false;
00558 }
00559 
00560 
00561 // Get a vector of references to all filters, which have a certain object assigned
00562 TriggerFilterRefVector TriggerEvent::objectFilters( const TriggerObjectRef & objectRef ) const
00563 {
00564   TriggerFilterRefVector theObjectFilters;
00565   for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00566     const std::string labelFilter( iFilter->label() );
00567     if ( objectInFilter( objectRef, labelFilter ) ) {
00568       const TriggerFilterRef filterRef( filters_, indexFilter( labelFilter ) );
00569       theObjectFilters.push_back( filterRef );
00570     }
00571   }
00572   return theObjectFilters;
00573 }
00574 
00575 
00576 // Get a vector of references to all objects, which were used in a certain path given by name
00577 TriggerObjectRefVector TriggerEvent::pathObjects( const std::string & namePath ) const
00578 {
00579   TriggerObjectRefVector thePathObjects;
00580   TriggerFilterRefVector theFilters = pathFilters( namePath );
00581   for ( TriggerFilterRefVectorIterator iFilter = theFilters.begin(); iFilter != theFilters.end(); ++iFilter ) {
00582     const std::string labelFilter( ( *iFilter )->label() );
00583     TriggerObjectRefVector theObjects = filterObjects( labelFilter );
00584     for ( TriggerObjectRefVectorIterator iObject = theObjects.begin(); iObject != theObjects.end(); ++iObject ) {
00585       thePathObjects.push_back( *iObject );
00586     }
00587   }
00588   return thePathObjects;
00589 }
00590 
00591 
00592 // Checks, if an object was used in a certain path given by name
00593 bool TriggerEvent::objectInPath( const TriggerObjectRef & objectRef, const std::string & namePath ) const
00594 {
00595   TriggerFilterRefVector theFilters = pathFilters( namePath );
00596   for ( TriggerFilterRefVectorIterator iFilter = theFilters.begin(); iFilter != theFilters.end(); ++iFilter ) {
00597     if ( objectInFilter( objectRef, ( *iFilter )->label() ) ) return true;
00598   }
00599   return false;
00600 }
00601 
00602 
00603 // Get a vector of references to all paths, which have a certain object assigned
00604 TriggerPathRefVector TriggerEvent::objectPaths( const TriggerObjectRef & objectRef ) const
00605 {
00606   TriggerPathRefVector theObjectPaths;
00607   for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00608     const std::string namePath( iPath->name() );
00609     if ( objectInPath( objectRef, namePath ) ) {
00610       const TriggerPathRef pathRef( paths_, indexPath( namePath ) );
00611       theObjectPaths.push_back( pathRef );
00612     }
00613   }
00614   return theObjectPaths;
00615 }
00616 
00617 
00618 // Add a pat::TriggerObjectMatch association
00619 bool TriggerEvent::addObjectMatchResult( const TriggerObjectMatchRefProd & trigMatches, const std::string & labelMatcher )
00620 {
00621   if ( triggerObjectMatchResults()->find( labelMatcher ) == triggerObjectMatchResults()->end() ) {
00622     objectMatchResults_[ labelMatcher ] = trigMatches;
00623     return true;
00624   }
00625   return false;
00626 }
00627 
00628 
00629 // Get a list of all linked trigger matches
00630 std::vector< std::string > TriggerEvent::triggerMatchers() const
00631 {
00632   std::vector< std::string > theMatchers;
00633   for ( TriggerObjectMatchContainer::const_iterator iMatch = triggerObjectMatchResults()->begin(); iMatch != triggerObjectMatchResults()->end(); ++iMatch ) theMatchers.push_back( iMatch->first );
00634   return theMatchers;
00635 }
00636 
00637 
00638 // Get a pointer to a certain trigger match given by label
00639 const TriggerObjectMatch * TriggerEvent::triggerObjectMatchResult( const std::string & labelMatcher ) const
00640 {
00641   const TriggerObjectMatchContainer::const_iterator iMatch( triggerObjectMatchResults()->find( labelMatcher ) );
00642   if ( iMatch != triggerObjectMatchResults()->end() ) return iMatch->second.get();
00643   return 0;
00644 }