00001
00002
00003
00004
00005
00006 #include "DataFormats/PatCandidates/interface/TriggerEvent.h"
00007
00008
00009 using namespace pat;
00010
00011
00012
00013
00014
00015
00016 TriggerEvent::TriggerEvent() :
00017 nameL1Menu_(),
00018 nameHltTable_(),
00019 run_(),
00020 accept_(),
00021 error_(),
00022 physDecl_(),
00023 lhcFill_(),
00024 beamMode_(),
00025 beamMomentum_(),
00026 intensityBeam1_(),
00027 intensityBeam2_(),
00028 bstMasterStatus_(),
00029 turnCount_(),
00030 bCurrentStart_(),
00031 bCurrentStop_(),
00032 bCurrentAvg_()
00033 {
00034 objectMatchResults_.clear();
00035 }
00036
00037
00038
00039 TriggerEvent::TriggerEvent( const std::string & nameHltTable, bool run, bool accept, bool error, bool physDecl ) :
00040 nameL1Menu_(),
00041 nameHltTable_( nameHltTable ),
00042 run_( run ),
00043 accept_( accept ),
00044 error_( error ),
00045 physDecl_( physDecl ) ,
00046 lhcFill_(),
00047 beamMode_(),
00048 beamMomentum_(),
00049 intensityBeam1_(),
00050 intensityBeam2_(),
00051 bstMasterStatus_(),
00052 turnCount_(),
00053 bCurrentStart_(),
00054 bCurrentStop_(),
00055 bCurrentAvg_()
00056 {
00057 objectMatchResults_.clear();
00058 }
00059
00060
00061
00062 TriggerEvent::TriggerEvent( const std::string & nameL1Menu, const std::string & nameHltTable, bool run, bool accept, bool error, bool physDecl ) :
00063 nameL1Menu_( nameL1Menu ),
00064 nameHltTable_( nameHltTable ),
00065 run_( run ),
00066 accept_( accept ),
00067 error_( error ),
00068 physDecl_( physDecl ) ,
00069 lhcFill_(),
00070 beamMode_(),
00071 beamMomentum_(),
00072 intensityBeam1_(),
00073 intensityBeam2_(),
00074 bstMasterStatus_(),
00075 turnCount_(),
00076 bCurrentStart_(),
00077 bCurrentStop_(),
00078 bCurrentAvg_()
00079 {
00080 objectMatchResults_.clear();
00081 }
00082
00083
00084
00085
00086
00087
00088 const TriggerAlgorithmRefVector TriggerEvent::algorithmRefs() const
00089 {
00090 TriggerAlgorithmRefVector theAlgorithms;
00091 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00092 const std::string nameAlgorithm( iAlgorithm->name() );
00093 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00094 theAlgorithms.push_back( algorithmRef );
00095 }
00096 return theAlgorithms;
00097 }
00098
00099
00100
00101 const TriggerAlgorithm * TriggerEvent::algorithm( const std::string & nameAlgorithm ) const
00102 {
00103 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00104 if ( nameAlgorithm == iAlgorithm->name() ) return &*iAlgorithm;
00105 }
00106 return 0;
00107 }
00108
00109
00110
00111 const TriggerAlgorithmRef TriggerEvent::algorithmRef( const std::string & nameAlgorithm ) const
00112 {
00113 for ( TriggerAlgorithmRefVector::const_iterator iAlgorithm = algorithmRefs().begin(); iAlgorithm != algorithmRefs().end(); ++iAlgorithm ) {
00114 if ( nameAlgorithm == ( *iAlgorithm )->name() ) return *iAlgorithm;
00115 }
00116 return TriggerAlgorithmRef();
00117 }
00118
00119
00120
00121 std::string TriggerEvent::nameAlgorithm( const unsigned bitAlgorithm, const bool techAlgorithm ) const
00122 {
00123 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00124 if ( bitAlgorithm == iAlgorithm->bit() && techAlgorithm == iAlgorithm->techTrigger() ) return iAlgorithm->name();
00125 }
00126 return std::string( "" );
00127 }
00128
00129
00130
00131 unsigned TriggerEvent::indexAlgorithm( const std::string & nameAlgorithm ) const
00132 {
00133 unsigned iAlgorithm( 0 );
00134 while ( iAlgorithm < algorithms()->size() && algorithms()->at( iAlgorithm ).name() != nameAlgorithm ) ++iAlgorithm;
00135 return iAlgorithm;
00136 }
00137
00138
00139
00140 TriggerAlgorithmRefVector TriggerEvent::acceptedAlgorithms() const
00141 {
00142 TriggerAlgorithmRefVector theAcceptedAlgorithms;
00143 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00144 if ( iAlgorithm->decision() ) {
00145 const std::string nameAlgorithm( iAlgorithm->name() );
00146 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00147 theAcceptedAlgorithms.push_back( algorithmRef );
00148 }
00149 }
00150 return theAcceptedAlgorithms;
00151 }
00152
00153
00154
00155 TriggerAlgorithmRefVector TriggerEvent::acceptedAlgorithmsGtl() const
00156 {
00157 TriggerAlgorithmRefVector theAcceptedAlgorithms;
00158 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00159 if ( iAlgorithm->gtlResult() ) {
00160 const std::string nameAlgorithm( iAlgorithm->name() );
00161 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00162 theAcceptedAlgorithms.push_back( algorithmRef );
00163 }
00164 }
00165 return theAcceptedAlgorithms;
00166 }
00167
00168
00169
00170 TriggerAlgorithmRefVector TriggerEvent::techAlgorithms() const
00171 {
00172 TriggerAlgorithmRefVector theTechAlgorithms;
00173 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00174 if ( iAlgorithm->techTrigger() ) {
00175 const std::string nameAlgorithm( iAlgorithm->name() );
00176 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00177 theTechAlgorithms.push_back( algorithmRef );
00178 }
00179 }
00180 return theTechAlgorithms;
00181 }
00182
00183
00184
00185 TriggerAlgorithmRefVector TriggerEvent::acceptedTechAlgorithms() const
00186 {
00187 TriggerAlgorithmRefVector theAcceptedTechAlgorithms;
00188 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00189 if ( iAlgorithm->techTrigger() && iAlgorithm->decision() ) {
00190 const std::string nameAlgorithm( iAlgorithm->name() );
00191 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00192 theAcceptedTechAlgorithms.push_back( algorithmRef );
00193 }
00194 }
00195 return theAcceptedTechAlgorithms;
00196 }
00197
00198
00199
00200 TriggerAlgorithmRefVector TriggerEvent::acceptedTechAlgorithmsGtl() const
00201 {
00202 TriggerAlgorithmRefVector theAcceptedTechAlgorithms;
00203 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00204 if ( iAlgorithm->techTrigger() && iAlgorithm->gtlResult() ) {
00205 const std::string nameAlgorithm( iAlgorithm->name() );
00206 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00207 theAcceptedTechAlgorithms.push_back( algorithmRef );
00208 }
00209 }
00210 return theAcceptedTechAlgorithms;
00211 }
00212
00213
00214
00215 TriggerAlgorithmRefVector TriggerEvent::physAlgorithms() const
00216 {
00217 TriggerAlgorithmRefVector thePhysAlgorithms;
00218 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00219 if ( ! iAlgorithm->techTrigger() ) {
00220 const std::string nameAlgorithm( iAlgorithm->name() );
00221 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00222 thePhysAlgorithms.push_back( algorithmRef );
00223 }
00224 }
00225 return thePhysAlgorithms;
00226 }
00227
00228
00229
00230 TriggerAlgorithmRefVector TriggerEvent::acceptedPhysAlgorithms() const
00231 {
00232 TriggerAlgorithmRefVector theAcceptedPhysAlgorithms;
00233 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00234 if ( ! iAlgorithm->techTrigger() && iAlgorithm->decision() ) {
00235 const std::string nameAlgorithm( iAlgorithm->name() );
00236 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00237 theAcceptedPhysAlgorithms.push_back( algorithmRef );
00238 }
00239 }
00240 return theAcceptedPhysAlgorithms;
00241 }
00242
00243
00244
00245 TriggerAlgorithmRefVector TriggerEvent::acceptedPhysAlgorithmsGtl() const
00246 {
00247 TriggerAlgorithmRefVector theAcceptedPhysAlgorithms;
00248 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00249 if ( ! iAlgorithm->techTrigger() && iAlgorithm->gtlResult() ) {
00250 const std::string nameAlgorithm( iAlgorithm->name() );
00251 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00252 theAcceptedPhysAlgorithms.push_back( algorithmRef );
00253 }
00254 }
00255 return theAcceptedPhysAlgorithms;
00256 }
00257
00258
00259
00260 const TriggerConditionRefVector TriggerEvent::conditionRefs() const
00261 {
00262 TriggerConditionRefVector theConditions;
00263 for ( TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end(); ++iCondition ) {
00264 const std::string nameCondition( iCondition->name() );
00265 const TriggerConditionRef conditionRef( conditions_, indexCondition( nameCondition ) );
00266 theConditions.push_back( conditionRef );
00267 }
00268 return theConditions;
00269 }
00270
00271
00272
00273 const TriggerCondition * TriggerEvent::condition( const std::string & nameCondition ) const
00274 {
00275 for ( TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end(); ++iCondition ) {
00276 if ( nameCondition == iCondition->name() ) return &*iCondition;
00277 }
00278 return 0;
00279 }
00280
00281
00282
00283 const TriggerConditionRef TriggerEvent::conditionRef( const std::string & nameCondition ) const
00284 {
00285 for ( TriggerConditionRefVector::const_iterator iCondition = conditionRefs().begin(); iCondition != conditionRefs().end(); ++iCondition ) {
00286 if ( nameCondition == ( *iCondition )->name() ) return *iCondition;
00287 }
00288 return TriggerConditionRef();
00289 }
00290
00291
00292
00293 unsigned TriggerEvent::indexCondition( const std::string & nameCondition ) const
00294 {
00295 unsigned iCondition( 0 );
00296 while ( iCondition < conditions()->size() && conditions()->at( iCondition ).name() != nameCondition ) ++iCondition;
00297 return iCondition;
00298 }
00299
00300
00301
00302 TriggerConditionRefVector TriggerEvent::acceptedConditions() const
00303 {
00304 TriggerConditionRefVector theAcceptedConditions;
00305 for ( TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end(); ++iCondition ) {
00306 if ( iCondition->wasAccept() ) {
00307 const std::string nameCondition( iCondition->name() );
00308 const TriggerConditionRef conditionRef( conditions_, indexCondition( nameCondition ) );
00309 theAcceptedConditions.push_back( conditionRef );
00310 }
00311 }
00312 return theAcceptedConditions;
00313 }
00314
00315
00316
00317 const TriggerPathRefVector TriggerEvent::pathRefs() const
00318 {
00319 TriggerPathRefVector thePaths;
00320 for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00321 const std::string namePath( iPath->name() );
00322 const TriggerPathRef pathRef( paths_, indexPath( namePath ) );
00323 thePaths.push_back( pathRef );
00324 }
00325 return thePaths;
00326 }
00327
00328
00329
00330 const TriggerPath * TriggerEvent::path( const std::string & namePath ) const
00331 {
00332 for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00333 if ( namePath == iPath->name() ) return &*iPath;
00334 }
00335 return 0;
00336 }
00337
00338
00339
00340 const TriggerPathRef TriggerEvent::pathRef( const std::string & namePath ) const
00341 {
00342 for ( TriggerPathRefVector::const_iterator iPath = pathRefs().begin(); iPath != pathRefs().end(); ++iPath ) {
00343 if ( namePath == ( *iPath )->name() ) return *iPath;
00344 }
00345 return TriggerPathRef();
00346 }
00347
00348
00349
00350 unsigned TriggerEvent::indexPath( const std::string & namePath ) const
00351 {
00352 unsigned iPath( 0 );
00353 while ( iPath < paths()->size() && paths()->at( iPath ).name() != namePath ) ++iPath;
00354 return iPath;
00355 }
00356
00357
00358
00359 TriggerPathRefVector TriggerEvent::acceptedPaths() const
00360 {
00361 TriggerPathRefVector theAcceptedPaths;
00362 for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00363 if ( iPath->wasAccept() ) {
00364 const std::string namePath( iPath->name() );
00365 const TriggerPathRef pathRef( paths_, indexPath( namePath ) );
00366 theAcceptedPaths.push_back( pathRef );
00367 }
00368 }
00369 return theAcceptedPaths;
00370 }
00371
00372
00373
00374 const TriggerFilterRefVector TriggerEvent::filterRefs() const
00375 {
00376 TriggerFilterRefVector theFilters;
00377 for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00378 const std::string labelFilter( iFilter->label() );
00379 const TriggerFilterRef filterRef( filters_, indexFilter( labelFilter ) );
00380 theFilters.push_back( filterRef );
00381 }
00382 return theFilters;
00383 }
00384
00385
00386
00387 const TriggerFilter * TriggerEvent::filter( const std::string & labelFilter ) const
00388 {
00389 for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00390 if ( labelFilter == iFilter->label() ) return &*iFilter;
00391 }
00392 return 0;
00393 }
00394
00395
00396
00397 const TriggerFilterRef TriggerEvent::filterRef( const std::string & labelFilter ) const
00398 {
00399 for ( TriggerFilterRefVector::const_iterator iFilter = filterRefs().begin(); iFilter != filterRefs().end(); ++iFilter ) {
00400 if ( labelFilter == ( *iFilter )->label() ) return *iFilter;
00401 }
00402 return TriggerFilterRef();
00403 }
00404
00405
00406
00407 unsigned TriggerEvent::indexFilter( const std::string & labelFilter ) const
00408 {
00409 unsigned iFilter( 0 );
00410 while ( iFilter < filters()->size() && filters()->at( iFilter ).label() != labelFilter ) ++iFilter;
00411 return iFilter;
00412 }
00413
00414
00415
00416 TriggerFilterRefVector TriggerEvent::acceptedFilters() const
00417 {
00418 TriggerFilterRefVector theAcceptedFilters;
00419 for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00420 if ( iFilter->status() == 1 ) {
00421 const std::string labelFilter( iFilter->label() );
00422 const TriggerFilterRef filterRef( filters_, indexFilter( labelFilter ) );
00423 theAcceptedFilters.push_back( filterRef );
00424 }
00425 }
00426 return theAcceptedFilters;
00427 }
00428
00429
00430
00431 const TriggerObjectRefVector TriggerEvent::objectRefs() const
00432 {
00433 TriggerObjectRefVector theObjects;
00434 for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00435 const TriggerObjectRef objectRef( objects_, iObject );
00436 theObjects.push_back( objectRef );
00437 }
00438 return theObjects;
00439 }
00440
00441
00442
00443 TriggerObjectRefVector TriggerEvent::objects( trigger::TriggerObjectType triggerObjectType ) const
00444 {
00445 TriggerObjectRefVector theObjects;
00446 for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00447 if ( objects()->at( iObject ).hasTriggerObjectType( triggerObjectType ) ) {
00448 const TriggerObjectRef objectRef( objects_, iObject );
00449 theObjects.push_back( objectRef );
00450 }
00451 }
00452 return theObjects;
00453 }
00454
00455
00456
00457 TriggerConditionRefVector TriggerEvent::algorithmConditions( const std::string & nameAlgorithm ) const
00458 {
00459 TriggerConditionRefVector theAlgorithmConditions;
00460 if ( algorithm( nameAlgorithm ) ) {
00461 for ( unsigned iC = 0; iC < algorithm( nameAlgorithm )->conditionKeys().size(); ++iC ) {
00462 const TriggerConditionRef conditionRef( conditions_, algorithm( nameAlgorithm )->conditionKeys().at( iC ) );
00463 theAlgorithmConditions.push_back( conditionRef );
00464 }
00465 }
00466 return theAlgorithmConditions;
00467 }
00468
00469
00470
00471 bool TriggerEvent::conditionInAlgorithm( const TriggerConditionRef & conditionRef, const std::string & nameAlgorithm ) const
00472 {
00473 TriggerConditionRefVector theConditions = algorithmConditions( nameAlgorithm );
00474 for ( TriggerConditionRefVectorIterator iCondition = theConditions.begin(); iCondition != theConditions.end(); ++iCondition ) {
00475 if ( conditionRef == *iCondition ) return true;
00476 }
00477 return false;
00478 }
00479
00480
00481
00482 TriggerAlgorithmRefVector TriggerEvent::conditionAlgorithms( const TriggerConditionRef & conditionRef ) const
00483 {
00484 TriggerAlgorithmRefVector theConditionAlgorithms;
00485 size_t cAlgorithms( 0 );
00486 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00487 const std::string nameAlgorithm( iAlgorithm->name() );
00488 if ( conditionInAlgorithm( conditionRef, nameAlgorithm ) ) {
00489 const TriggerAlgorithmRef algorithmRef( algorithms_, cAlgorithms );
00490 theConditionAlgorithms.push_back( algorithmRef );
00491 }
00492 ++cAlgorithms;
00493 }
00494 return theConditionAlgorithms;
00495 }
00496
00497
00498
00499 std::vector< std::string > TriggerEvent::conditionCollections( const std::string & nameCondition ) const
00500 {
00501 std::vector< std::string > theConditionCollections;
00502 if ( condition( nameCondition ) ) {
00503 for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00504 if ( condition( nameCondition )->hasObjectKey( iObject ) ) {
00505 bool found( false );
00506 std::string objectCollection( objects()->at( iObject ).collection() );
00507 for ( std::vector< std::string >::const_iterator iC = theConditionCollections.begin(); iC != theConditionCollections.end(); ++iC ) {
00508 if ( *iC == objectCollection ) {
00509 found = true;
00510 break;
00511 }
00512 }
00513 if ( ! found ) {
00514 theConditionCollections.push_back( objectCollection );
00515 }
00516 }
00517 }
00518 }
00519 return theConditionCollections;
00520 }
00521
00522
00523
00524 TriggerObjectRefVector TriggerEvent::conditionObjects( const std::string & nameCondition ) const
00525 {
00526 TriggerObjectRefVector theConditionObjects;
00527 if ( condition( nameCondition ) ) {
00528 for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00529 if ( condition( nameCondition )->hasObjectKey( iObject ) ) {
00530 const TriggerObjectRef objectRef( objects_, iObject );
00531 theConditionObjects.push_back( objectRef );
00532 }
00533 }
00534 }
00535 return theConditionObjects;
00536 }
00537
00538
00539
00540 bool TriggerEvent::objectInCondition( const TriggerObjectRef & objectRef, const std::string & nameCondition ) const {
00541 if ( condition( nameCondition ) ) return condition( nameCondition )->hasObjectKey( objectRef.key() );
00542 return false;
00543 }
00544
00545
00546
00547 TriggerConditionRefVector TriggerEvent::objectConditions( const TriggerObjectRef & objectRef ) const
00548 {
00549 TriggerConditionRefVector theObjectConditions;
00550 for ( TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end(); ++iCondition ) {
00551 const std::string nameCondition( iCondition->name() );
00552 if ( objectInCondition( objectRef, nameCondition ) ) {
00553 const TriggerConditionRef conditionRef( conditions_, indexCondition( nameCondition ) );
00554 theObjectConditions.push_back( conditionRef );
00555 }
00556 }
00557 return theObjectConditions;
00558 }
00559
00560
00561
00562 TriggerObjectRefVector TriggerEvent::algorithmObjects( const std::string & nameAlgorithm ) const
00563 {
00564 TriggerObjectRefVector theAlgorithmObjects;
00565 TriggerConditionRefVector theConditions = algorithmConditions( nameAlgorithm );
00566 for ( TriggerConditionRefVectorIterator iCondition = theConditions.begin(); iCondition != theConditions.end(); ++iCondition ) {
00567 const std::string nameCondition( ( *iCondition )->name() );
00568 TriggerObjectRefVector theObjects = conditionObjects( nameCondition );
00569 for ( TriggerObjectRefVectorIterator iObject = theObjects.begin(); iObject != theObjects.end(); ++iObject ) {
00570 theAlgorithmObjects.push_back( *iObject );
00571 }
00572 }
00573 return theAlgorithmObjects;
00574 }
00575
00576
00577
00578 bool TriggerEvent::objectInAlgorithm( const TriggerObjectRef & objectRef, const std::string & nameAlgorithm ) const
00579 {
00580 TriggerConditionRefVector theConditions = algorithmConditions( nameAlgorithm );
00581 for ( TriggerConditionRefVectorIterator iCondition = theConditions.begin(); iCondition != theConditions.end(); ++iCondition ) {
00582 if ( objectInCondition( objectRef, ( *iCondition )->name() ) ) return true;
00583 }
00584 return false;
00585 }
00586
00587
00588
00589 TriggerAlgorithmRefVector TriggerEvent::objectAlgorithms( const TriggerObjectRef & objectRef ) const
00590 {
00591 TriggerAlgorithmRefVector theObjectAlgorithms;
00592 for ( TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end(); ++iAlgorithm ) {
00593 const std::string nameAlgorithm( iAlgorithm->name() );
00594 if ( objectInAlgorithm( objectRef, nameAlgorithm ) ) {
00595 const TriggerAlgorithmRef algorithmRef( algorithms_, indexAlgorithm( nameAlgorithm ) );
00596 theObjectAlgorithms.push_back( algorithmRef );
00597 }
00598 }
00599 return theObjectAlgorithms;
00600 }
00601
00602
00603
00604 TriggerFilterRefVector TriggerEvent::pathModules( const std::string & namePath, bool all ) const
00605 {
00606 TriggerFilterRefVector thePathFilters;
00607 if ( path( namePath ) && path( namePath )->modules().size() > 0 ) {
00608 const unsigned onePastLastFilter = all ? path( namePath )->modules().size() : path( namePath )->lastActiveFilterSlot() + 1;
00609 for ( unsigned iM = 0; iM < onePastLastFilter; ++iM ) {
00610 const std::string labelFilter( path( namePath )->modules().at( iM ) );
00611 const TriggerFilterRef filterRef( filters_, indexFilter( labelFilter ) );
00612 thePathFilters.push_back( filterRef );
00613 }
00614 }
00615 return thePathFilters;
00616 }
00617
00618
00619
00620 TriggerFilterRefVector TriggerEvent::pathFilters( const std::string & namePath, bool firing ) const
00621 {
00622 TriggerFilterRefVector thePathFilters;
00623 if ( path( namePath ) ) {
00624 for ( unsigned iF = 0; iF < path( namePath )->filterIndices().size(); ++iF ) {
00625 const TriggerFilterRef filterRef( filters_, path( namePath )->filterIndices().at( iF ) );
00626 if ( ( ! firing ) || filterRef->isFiring() ) thePathFilters.push_back( filterRef );
00627 }
00628 }
00629 return thePathFilters;
00630 }
00631
00632
00633
00634 bool TriggerEvent::filterInPath( const TriggerFilterRef & filterRef, const std::string & namePath, bool firing ) const
00635 {
00636 TriggerFilterRefVector theFilters = pathFilters( namePath, firing );
00637 for ( TriggerFilterRefVectorIterator iFilter = theFilters.begin(); iFilter != theFilters.end(); ++iFilter ) {
00638 if ( filterRef == *iFilter ) return true;
00639 }
00640 return false;
00641 }
00642
00643
00644
00645 TriggerPathRefVector TriggerEvent::filterPaths( const TriggerFilterRef & filterRef, bool firing ) const
00646 {
00647 TriggerPathRefVector theFilterPaths;
00648 size_t cPaths( 0 );
00649 for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00650 const std::string namePath( iPath->name() );
00651 if ( filterInPath( filterRef, namePath, firing ) ) {
00652 const TriggerPathRef pathRef( paths_, cPaths );
00653 theFilterPaths.push_back( pathRef );
00654 }
00655 ++cPaths;
00656 }
00657 return theFilterPaths;
00658 }
00659
00660
00661
00662 std::vector< std::string > TriggerEvent::filterCollections( const std::string & labelFilter ) const
00663 {
00664 std::vector< std::string > theFilterCollections;
00665 if ( filter( labelFilter ) ) {
00666 for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00667 if ( filter( labelFilter )->hasObjectKey( iObject ) ) {
00668 bool found( false );
00669 std::string objectCollection( objects()->at( iObject ).collection() );
00670 for ( std::vector< std::string >::const_iterator iC = theFilterCollections.begin(); iC != theFilterCollections.end(); ++iC ) {
00671 if ( *iC == objectCollection ) {
00672 found = true;
00673 break;
00674 }
00675 }
00676 if ( ! found ) {
00677 theFilterCollections.push_back( objectCollection );
00678 }
00679 }
00680 }
00681 }
00682 return theFilterCollections;
00683 }
00684
00685
00686
00687 TriggerObjectRefVector TriggerEvent::filterObjects( const std::string & labelFilter ) const
00688 {
00689 TriggerObjectRefVector theFilterObjects;
00690 if ( filter( labelFilter ) ) {
00691 for ( unsigned iObject = 0; iObject < objects()->size(); ++iObject ) {
00692 if ( filter( labelFilter )->hasObjectKey( iObject ) ) {
00693 const TriggerObjectRef objectRef( objects_, iObject );
00694 theFilterObjects.push_back( objectRef );
00695 }
00696 }
00697 }
00698 return theFilterObjects;
00699 }
00700
00701
00702
00703 bool TriggerEvent::objectInFilter( const TriggerObjectRef & objectRef, const std::string & labelFilter ) const {
00704 if ( filter( labelFilter ) ) return filter( labelFilter )->hasObjectKey( objectRef.key() );
00705 return false;
00706 }
00707
00708
00709
00710 TriggerFilterRefVector TriggerEvent::objectFilters( const TriggerObjectRef & objectRef, bool firing ) const
00711 {
00712 TriggerFilterRefVector theObjectFilters;
00713 for ( TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter ) {
00714 const std::string labelFilter( iFilter->label() );
00715 if ( objectInFilter( objectRef, labelFilter ) ) {
00716 const TriggerFilterRef filterRef( filters_, indexFilter( labelFilter ) );
00717 if ( ( ! firing ) || iFilter->isFiring() ) theObjectFilters.push_back( filterRef );
00718 }
00719 }
00720 return theObjectFilters;
00721 }
00722
00723
00724
00725 TriggerObjectRefVector TriggerEvent::pathObjects( const std::string & namePath, bool firing ) const
00726 {
00727 TriggerObjectRefVector thePathObjects;
00728 TriggerFilterRefVector theFilters = pathFilters( namePath, firing );
00729 for ( TriggerFilterRefVectorIterator iFilter = theFilters.begin(); iFilter != theFilters.end(); ++iFilter ) {
00730 const std::string labelFilter( ( *iFilter )->label() );
00731 TriggerObjectRefVector theObjects = filterObjects( labelFilter );
00732 for ( TriggerObjectRefVectorIterator iObject = theObjects.begin(); iObject != theObjects.end(); ++iObject ) {
00733 thePathObjects.push_back( *iObject );
00734 }
00735 }
00736 return thePathObjects;
00737 }
00738
00739
00740
00741 bool TriggerEvent::objectInPath( const TriggerObjectRef & objectRef, const std::string & namePath, bool firing ) const
00742 {
00743 TriggerFilterRefVector theFilters = pathFilters( namePath, firing );
00744 for ( TriggerFilterRefVectorIterator iFilter = theFilters.begin(); iFilter != theFilters.end(); ++iFilter ) {
00745 if ( objectInFilter( objectRef, ( *iFilter )->label() ) ) return true;
00746 }
00747 return false;
00748 }
00749
00750
00751
00752 TriggerPathRefVector TriggerEvent::objectPaths( const TriggerObjectRef & objectRef, bool firing ) const
00753 {
00754 TriggerPathRefVector theObjectPaths;
00755 for ( TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath ) {
00756 const std::string namePath( iPath->name() );
00757 if ( objectInPath( objectRef, namePath, firing ) ) {
00758 const TriggerPathRef pathRef( paths_, indexPath( namePath ) );
00759 theObjectPaths.push_back( pathRef );
00760 }
00761 }
00762 return theObjectPaths;
00763 }
00764
00765
00766
00767 bool TriggerEvent::addObjectMatchResult( const TriggerObjectMatchRefProd & trigMatches, const std::string & labelMatcher )
00768 {
00769 if ( triggerObjectMatchResults()->find( labelMatcher ) == triggerObjectMatchResults()->end() ) {
00770 objectMatchResults_[ labelMatcher ] = trigMatches;
00771 return true;
00772 }
00773 return false;
00774 }
00775
00776
00777
00778 std::vector< std::string > TriggerEvent::triggerMatchers() const
00779 {
00780 std::vector< std::string > theMatchers;
00781 for ( TriggerObjectMatchContainer::const_iterator iMatch = triggerObjectMatchResults()->begin(); iMatch != triggerObjectMatchResults()->end(); ++iMatch ) theMatchers.push_back( iMatch->first );
00782 return theMatchers;
00783 }
00784
00785
00786
00787 const TriggerObjectMatch * TriggerEvent::triggerObjectMatchResult( const std::string & labelMatcher ) const
00788 {
00789 const TriggerObjectMatchContainer::const_iterator iMatch( triggerObjectMatchResults()->find( labelMatcher ) );
00790 if ( iMatch != triggerObjectMatchResults()->end() ) return iMatch->second.get();
00791 return 0;
00792 }