Anonymous avatar Anonymous committed 7ea6960

Cleand up FilteredAlgorithm, all is propagated to DecisionSvc

Comments (0)

Files changed (3)

AthenaBaseComps/FilteredAlgorithm.h

   StringArrayProperty      m_requireNames;
   /// Vector of names of Algorithms that this stream is vetoed by
   StringArrayProperty      m_vetoNames;
-  /// Vector of Algorithms that this stream accepts
-  std::vector<Algorithm*>* m_acceptAlgs;
-  /// Vector of Algorithms that this stream requires
-  std::vector<Algorithm*>* m_requireAlgs;
-  /// Vector of Algorithms that this stream is vetoed by
-  std::vector<Algorithm*>* m_vetoAlgs;
 
   ServiceHandle<IDecisionSvc> m_decSvc;
 
   /// Standard Destructor
   virtual ~FilteredAlgorithm();
 
-  /// Decode list of Algorithms that this stream accepts
-  StatusCode decodeAcceptAlgs( );
-  /// Decode list of Algorithms that this stream requires
-  StatusCode decodeRequireAlgs( );
-  /// Decode list of Algorithms that this stream is vetoed by
-  StatusCode decodeVetoAlgs( );
-
-  /// Handler for AcceptAlgs Property
-  void acceptAlgsHandler( Property& );
-  /// Handler for RequireAlgs Property
-  void requireAlgsHandler( Property& );
-  /// Handler for VetoAlgs Property
-  void vetoAlgsHandler( Property& );
-
-  /// Decode specified list of Algorithms
-  StatusCode decodeAlgorithms( StringArrayProperty& theNames,
-                               std::vector<Algorithm*>* theAlgs );
-
 public:
   /// \name implement IAlgorithm
   //@{
   /// Test whether this event should be output
   bool isEventAccepted( ) const;
 
-protected:
+
   FilteredAlgorithm(); //> not implemented
   FilteredAlgorithm (const FilteredAlgorithm&); //> not implemented
   FilteredAlgorithm& operator= (const FilteredAlgorithm&); //> not implemented
+2009-08-14  Balint Radics  <radbal@cern.ch>
+
+	* tagging AthenaBaseComps-00-03-02
+	* cleaned up FilteredAlgorithm
+	all is propagated to DecisionSvc
+	* M AthenaBaseComps/FilteredAlgorithm.cxx
+	* M AthenaBaseComps/FilteredAlgorithm.h
+
 2009-08-14  Paolo Calafiura  <calaf@lxcalaf.cern.ch>
 
 	* tagging AthenaBaseComps-00-03-01

src/FilteredAlgorithm.cxx

 FilteredAlgorithm::FilteredAlgorithm(const string& name, 
 				     ISvcLocator* pSvcLocator) :
   AthAlgorithm(name, pSvcLocator),
-  m_acceptAlgs(new vector<Algorithm*>),
-  m_requireAlgs(new vector<Algorithm*>),
-  m_vetoAlgs(new vector<Algorithm*>),
   m_decSvc("DecisionSvc/DecisionSvc",name)
 {
   assert( pSvcLocator );
                     "Filters which if any are passed disable output");
 
   declareProperty("decSvc", m_decSvc);
-  // Associate action handlers with the AcceptAlgs, 
-  // RequireAlgs & VetoAlgs properties
 
-  m_acceptNames.declareUpdateHandler(&FilteredAlgorithm::acceptAlgsHandler, this);
-  m_requireNames.declareUpdateHandler(&FilteredAlgorithm::requireAlgsHandler, this);
-  m_vetoNames.declareUpdateHandler   (&FilteredAlgorithm::vetoAlgsHandler, this);
 }
 
 // Standard Destructor
 FilteredAlgorithm::~FilteredAlgorithm()   {
-  delete m_acceptAlgs;
-  delete m_requireAlgs;
-  delete m_vetoAlgs;
+
 }
 
 // initialize data writer
   //  d. The event is rejected if any Algorithm in the veto list has been
   //     executed and has indicated that its filter has passed.
 
-   // Use IDecisionSvc, FilteredAlgorithm is a wrapper around DecisionSvc
-   status = m_decSvc.retrieve();
-   if (status.isFailure()) {
-     ATH_MSG_ERROR( "Cannot get IDecisionSvc interface." );
-     return(status);
-   } else {
-     ATH_MSG_DEBUG( "Found IDecisionSvc." );
+    // Use IDecisionSvc, FilteredAlgorithm is a wrapper around DecisionSvc
+    status = m_decSvc.retrieve();
+    if (status.isFailure()) {
+      ATH_MSG_ERROR( "Cannot get IDecisionSvc interface." );
+      return(status);
+    } else {
+      ATH_MSG_DEBUG( "Found IDecisionSvc." );
+    }
+
+    // Propagate the FilteredAlgorithm's Properties to IDecisionSvc
+    for(std::vector<std::string>::const_iterator it = m_acceptNames.value().begin(); it != m_acceptNames.value().end(); ++it){
+      msg(MSG::DEBUG) << "Trying to add " << (*it) << " of stream " << this->name() << " to AcceptAlg list" << endreq;
+      if(m_decSvc->addAcceptAlg((*it), this->name()) != StatusCode::SUCCESS)ATH_MSG_ERROR("Couldn't add acceptAlg");
+    }
+
+    for(std::vector<std::string>::const_iterator it = m_requireNames.value().begin(); it != m_requireNames.value().end(); ++it){
+      msg(MSG::DEBUG) << "Trying to add " << (*it) << " of stream " << this->name() << " to REquireAlg list" << endreq;
+      if(m_decSvc->addRequireAlg((*it), this->name()) != StatusCode::SUCCESS)ATH_MSG_ERROR("Couldn't add requireAlg");
+    }
+
+    for(std::vector<std::string>::const_iterator it = m_vetoNames.value().begin(); it != m_vetoNames.value().end(); ++it){
+      msg(MSG::DEBUG) << "Trying to add " << (*it) << " of stream " << this->name() << " to VetoAlg list" << endreq;
+      if(m_decSvc->addVetoAlg((*it), this->name()) != StatusCode::SUCCESS)ATH_MSG_ERROR("Couldn't add vetoAlg");
    }
 
-   // Propagate the FilteredAlgorithm's Properties to IDecisionSvc
-   for(std::vector<std::string>::const_iterator it = m_acceptNames.value().begin(); it != m_acceptNames.value().end(); ++it){
-     msg(MSG::DEBUG) << "Trying to add " << (*it) << " of stream " << this->name() << " to AcceptAlg list" << endreq;
-     if(m_decSvc->addAcceptAlg((*it), this->name()) != StatusCode::SUCCESS)ATH_MSG_ERROR("Couldn't add acceptAlg");
-   }
-
-   for(std::vector<std::string>::const_iterator it = m_requireNames.value().begin(); it != m_requireNames.value().end(); ++it){
-     msg(MSG::DEBUG) << "Trying to add " << (*it) << " of stream " << this->name() << " to REquireAlg list" << endreq;
-     if(m_decSvc->addRequireAlg((*it), this->name()) != StatusCode::SUCCESS)ATH_MSG_ERROR("Couldn't add requireAlg");
-   }
-
-   for(std::vector<std::string>::const_iterator it = m_vetoNames.value().begin(); it != m_vetoNames.value().end(); ++it){
-     msg(MSG::DEBUG) << "Trying to add " << (*it) << " of stream " << this->name() << " to VetoAlg list" << endreq;
-     if(m_decSvc->addVetoAlg((*it), this->name()) != StatusCode::SUCCESS)ATH_MSG_ERROR("Couldn't add vetoAlg");
-  }
-
-   /*
-   status = decodeAcceptAlgs( );
-   if( !status.isSuccess() )   
-   {
-     ATH_MSG_FATAL ("Unable to decodeAcceptAlgs.");
-     return status;
-   }
-   status = decodeRequireAlgs( );
-   if( !status.isSuccess() )   
-   {
-     ATH_MSG_FATAL ("Unable to decodeRequireAlgs.");
-     return status;
-   }
-   status = decodeVetoAlgs( );
-   if( !status.isSuccess() )   
-   {
-     ATH_MSG_FATAL ("Unable to decodeVetoAlgs.");
-     return status;
-   }
-
-   */
   ATH_MSG_DEBUG ("End initialize ");
   
   return status;
 }
 
-// terminate data writer
+
 StatusCode FilteredAlgorithm::finalize() 
 {
 
   return StatusCode::SUCCESS;
 }
 
-StatusCode
-FilteredAlgorithm::decodeAcceptAlgs( )
+bool FilteredAlgorithm::isEventAccepted( ) const
 {
-  StatusCode result = decodeAlgorithms( m_acceptNames, m_acceptAlgs );
-
-  if (m_acceptNames.value().size()) {
-    msg(MSG::DEBUG) << "Found AcceptNames: " ;
-      vector<string>::const_iterator first = m_acceptNames.value().begin();
-      vector<string>::const_iterator last  = m_acceptNames.value().end();
-      for (; first != last; ++first) {
-	msg(MSG::DEBUG) << (*first);
-      }
-      msg(MSG::DEBUG) << endreq;
-  }
-  else {
-    ATH_MSG_DEBUG ("No AcceptNames found ");
-  }
-
-  if (m_acceptAlgs->size()) {
-    msg(MSG::DEBUG) << "Found AcceptAlgs: " ;
-      vector<Algorithm*>::const_iterator first = m_acceptAlgs->begin();
-      vector<Algorithm*>::const_iterator last  = m_acceptAlgs->end();
-      for (; first != last; ++first) {
-	msg(MSG::DEBUG) << (*first)->name();
-      }
-      msg(MSG::DEBUG) << endreq;
-  }
-  else {
-    ATH_MSG_DEBUG ("No AcceptAlgs found ");
-  }
-
+  bool result = true;
+  result = m_decSvc->isEventAccepted(this->name());
   return result;
 }
 
-StatusCode
-FilteredAlgorithm::decodeRequireAlgs( )
-{
-  StatusCode result = decodeAlgorithms( m_requireNames, m_requireAlgs );
-
-  if (m_requireNames.value().size()) {
-    if ( msgLvl(MSG::DEBUG) ) {
-      msg(MSG::DEBUG) << "Found RequireNames: " ;
-      vector<string>::const_iterator first = m_requireNames.value().begin();
-      vector<string>::const_iterator last  = m_requireNames.value().end();
-      for (; first != last; ++first) {
-	msg(MSG::DEBUG) << (*first);
-      }
-      msg(MSG::DEBUG) << endreq;
-    }
-  }
-  else {
-    ATH_MSG_DEBUG ("No RequireNames found ");
-  }
-
-  if (m_requireAlgs->size()) {
-    if ( msgLvl(MSG::DEBUG) ) {
-      msg(MSG::DEBUG) << "Found RequireAlgs: " ;
-      vector<Algorithm*>::const_iterator first = m_requireAlgs->begin();
-      vector<Algorithm*>::const_iterator last  = m_requireAlgs->end();
-      for (; first != last; ++first) {
-	msg(MSG::DEBUG) << (*first)->name();
-      }
-      msg(MSG::DEBUG) << endreq;
-    }
-  }
-  else {
-    ATH_MSG_DEBUG ("No RequireAlgs found ");
-  }
-
-  return result;
-}
-
-StatusCode
-FilteredAlgorithm::decodeVetoAlgs( )
-{
-  StatusCode result = decodeAlgorithms( m_vetoNames, m_vetoAlgs );
-
-  if (m_vetoNames.value().size()) {
-    if ( msgLvl(MSG::DEBUG) ) {
-      msg(MSG::DEBUG) << "Found VetoNames: " ;
-      vector<string>::const_iterator first = m_vetoNames.value().begin();
-      vector<string>::const_iterator last  = m_vetoNames.value().end();
-      for (; first != last; ++first) {
-	msg(MSG::DEBUG) << (*first);
-      }
-      msg(MSG::DEBUG) << endreq;
-    }
-  }
-  else {
-    ATH_MSG_DEBUG ("No VetoNames found ");
-  }
-
-  if (m_vetoAlgs->size()) {
-    if ( msgLvl(MSG::DEBUG) ) {
-      msg (MSG::DEBUG) << "Found VetoAlgs: " ;
-      vector<Algorithm*>::const_iterator first = m_vetoAlgs->begin();
-      vector<Algorithm*>::const_iterator last  = m_vetoAlgs->end();
-      for (; first != last; ++first) {
-	msg(MSG::DEBUG) << (*first)->name();
-      }
-      msg(MSG::DEBUG) << endreq;
-    }
-  }
-  else {
-    ATH_MSG_DEBUG ("No VetoAlgs found ");
-  }
-
-  return result;
-}
-
-void
-FilteredAlgorithm::acceptAlgsHandler( Property& /* theProp */ )
-{
-  StatusCode sc;
-  if (!(sc = decodeAlgorithms( m_acceptNames, m_acceptAlgs )).isSuccess()) {
-    ATH_MSG_FATAL ("Unable to decode AcceptAlgs list");
-    throw GaudiException("Unable to decode AcceptAlgs list", name(), sc);
-  }
-}
-
-void
-FilteredAlgorithm::requireAlgsHandler( Property& /* theProp */ )
-{
-  StatusCode sc = decodeAlgorithms( m_requireNames, m_requireAlgs );
-  if( sc.isFailure() ) { 
-    ATH_MSG_FATAL ("Unable to decode RequireAlgs list");
-    throw GaudiException("Unable to decode RequireAlgs list", name(), sc);
-  }
-}
-
-void
-FilteredAlgorithm::vetoAlgsHandler( Property& /* theProp */ )
-{
-  StatusCode sc = decodeAlgorithms( m_vetoNames, m_vetoAlgs );
-  if( sc.isFailure() ) { 
-    ATH_MSG_FATAL ("Unable to decode VetoAlgs list");
-    throw GaudiException("Unable to decode VetoAlgs list", name(), sc);
-  }
-}
-
- 
-StatusCode
-FilteredAlgorithm::decodeAlgorithms( StringArrayProperty& theNames,
-				      vector<Algorithm*>* theAlgs )
-{
-
-  // Reset the list of Algorithms
-  theAlgs->clear( );
-
-  IAlgManager* theAlgMgr;
-  StatusCode result = serviceLocator( )->getService
-    ("ApplicationMgr",
-     IID_IAlgManager,
-     *pp_cast<IInterface>(&theAlgMgr));
-
-  if ( result.isSuccess( ) ) {
-
-    // Build the list of Algorithms from the names list
-    const vector<string> nameList = theNames.value( );
-    vector<string>::const_iterator it;
-    vector<string>::const_iterator itend = nameList.end( );
-    for (it = nameList.begin(); it != itend; it++) {
-
-      // Check whether the supplied name corresponds to an existing
-      // Algorithm object.
-      const string& theName = (*it);
-      IAlgorithm* theIAlg;
-      Algorithm*  theAlgorithm;
-      result = theAlgMgr->getAlgorithm( theName, theIAlg );
-      if ( result.isSuccess( ) ) {
-	theAlgorithm = dynamic_cast<Algorithm*>(theIAlg);
-	if (0==theAlgorithm) {
-	  result = StatusCode::FAILURE;
-	}
-      }
-      if ( result.isSuccess( ) ) {
-
-        // Check that the specified algorithm doesn't already exist in the list
-        vector<Algorithm*>::iterator ita;
-        vector<Algorithm*>::iterator itaend = theAlgs->end( );
-        for (ita = theAlgs->begin(); ita != itaend; ita++) {
-          Algorithm* existAlgorithm = (*ita);
-          if ( theAlgorithm == existAlgorithm ) {
-            result = StatusCode::FAILURE;
-            break;
-          }
-        }
-        if ( result.isSuccess( ) ) {
-          theAlgs->push_back( theAlgorithm );
-        }
-      } else {
-        ATH_MSG_INFO (theName << " doesn't exist - ignored");
-      }
-    }
-    result = StatusCode::SUCCESS;
-  } else {
-    ATH_MSG_FATAL ("Can't locate ApplicationMgr!!!");
-  }
-  return result;
-}
-
-bool
-FilteredAlgorithm::isEventAccepted( ) const
-{
-  bool result = true;
-  result = m_decSvc->isEventAccepted(this->name());
-
-
-//    // Loop over all Algorithms in the accept list to see
-//    // whether any have been executed and have their filter
-//    // passed flag set. Any match causes the event to be
-//    // provisionally accepted.
-//    if ( ! m_acceptAlgs->empty( ) ) {
-//      result = false;
-//      vector<Algorithm*>::iterator it;
-//      vector<Algorithm*>::iterator itend = m_acceptAlgs->end( );
-//      for (it = m_acceptAlgs->begin(); it != itend; it++) {
-//        Algorithm* theAlgorithm = (*it);
-//        if ( theAlgorithm->isExecuted( ) && theAlgorithm->filterPassed( ) ) {
-//          result = true;
-//          break;
-//        }
-//      }
-//    }
-
-//    // Loop over all Algorithms in the required list to see
-//    // whether all have been executed and have their filter
-//    // passed flag set. Any mismatch causes the event to be
-//    // rejected.
-//    if ( result && ! m_requireAlgs->empty( ) ) {
-//      vector<Algorithm*>::iterator it;
-//      vector<Algorithm*>::iterator itend = m_requireAlgs->end( );
-//      for (it = m_requireAlgs->begin(); it != itend; it++) {
-//        Algorithm* theAlgorithm = (*it);
-//        if ( ! theAlgorithm->isExecuted( ) || ! theAlgorithm->filterPassed( ) ) {
-//          result = false;
-//          break;
-//        }
-//      }
-//    }
-
-//    // Loop over all Algorithms in the veto list to see
-//    // whether any have been executed and have their filter
-//    // passed flag set. Any match causes the event to be
-//    // rejected.
-//    if ( result && ! m_vetoAlgs->empty( ) ) {
-//      vector<Algorithm*>::iterator it;
-//      vector<Algorithm*>::iterator itend = m_vetoAlgs->end( );
-//      for (it = m_vetoAlgs->begin(); it != itend; it++) {
-//        Algorithm* theAlgorithm = (*it);
-//        if ( theAlgorithm->isExecuted( ) && theAlgorithm->filterPassed( ) ) {
-//          result = false;
-//          break;
-//        }
-//      }
-//   }
-
-
-  return result;
-}
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.