//=============================================================================
// Main execution
//=============================================================================
StatusCode ConjugateNeutralPID::execute()
{

  debug() << "==> Execute" << endmsg;
  ++m_nEvents;  // Increment event counter

  setFilterPassed( false );

  const LHCb::Particle::ConstVector& inparts = this->i_particles();
  verbose() << "Retrieved " << inparts.size() << " particles from local storage" << endmsg;

  // Apply the ChangePIDTool to the particles.
  std::vector<LHCb::Particle> outparts = m_changePIDTool->changePID( inparts );

  // Save each of the modified Particles to the local storage.
  std::vector<LHCb::Particle>::iterator i;
  for( i = outparts.begin(); i != outparts.end(); i++ )
  {
    const LHCb::Particle *deskPart = this->markTree( &(*i) );
    if( !deskPart )
    {
      err() << " Unable to save particle" << endmsg;
      return StatusCode::FAILURE;
    }
  }

  if( !outparts.empty() )
  {
    setFilterPassed( true );
    ++m_nAccepted;   // Increment accepted event counter
    m_nCandidates += outparts.size();  // Increment candidate counter

    debug() << "Saved " << outparts.size() << " from " << inparts.size()
            << " candidates" << endmsg;
  }
  else
  {
    debug() << "Writing nothing to output" << endmsg;
  }

  return StatusCode::SUCCESS ;
}
Exemplo n.º 2
0
StatusCode
Prescaler::execute()
{
  ++m_seen;
  float fraction = (float(100.0) * (float)(m_pass+1)) / (float)m_seen;
  if ( fraction > m_percentPass ) {
    setFilterPassed( false );
    info() << name() << ":Prescaler::execute - filter failed" << endmsg;
  } else {
    info() << name() << ":Prescaler::execute - filter passed" << endmsg;
    ++m_pass;
  }
  return StatusCode::SUCCESS;
}
 // ==========================================================================
 /// the standard execution of the algorithm
 virtual StatusCode execute() 
 {
   // get the particles 
   const LHCb::Particle::ConstVector& parts = this->i_particles();
   //
   setFilterPassed ( !parts.empty() ) ;
   //
   for ( LHCb::Particle::ConstVector::const_iterator i = parts.begin() ; 
         i != parts.end(); ++i )
   {
     const LHCb::ParticleProperty * pp = ppSvc()->find((*i)->particleID());
     if ( pp ) { ++counter(pp->name()); }
   }
   //
   return StatusCode::SUCCESS ;
 }
Exemplo n.º 4
0
//=============================================================================
// Main execution
//=============================================================================
StatusCode GaudiSequencer::execute() {

  if ( m_measureTime ) m_timerTool->start( m_timer );

  if (msgLevel(MSG::DEBUG)) debug() << "==> Execute" << endmsg;

  StatusCode result = StatusCode::SUCCESS;

  bool seqPass = !m_modeOR; //  for OR, result will be false, unless (at least) one is true
                            //  for AND, result will be true, unless (at least) one is false
                            //    also see comment below ....

  std::vector<AlgorithmEntry>::const_iterator itE;
  for ( itE = m_entries.begin(); m_entries.end() != itE; ++itE ) {
    Algorithm* myAlg = itE->algorithm();
    if ( ! myAlg->isEnabled() ) continue;
    if ( ! myAlg->isExecuted() ) {
      if ( m_measureTime ) m_timerTool->start( itE->timer() );
      result = myAlg->sysExecute();
      if ( m_measureTime ) m_timerTool->stop( itE->timer() );
      myAlg->setExecuted( true );
      if ( ! result.isSuccess() ) break;  //== Abort and return bad status
    }
    //== Check the returned status
    if ( !m_ignoreFilter ) {
      bool passed = myAlg->filterPassed();
      if (msgLevel(MSG::VERBOSE))
        verbose() << "Algorithm " << myAlg->name() << " returned filter passed "
                  << (passed ? "true" : "false") << endmsg;
      if ( itE->reverse() ) passed = !passed;


      //== indicate our own result. For OR, exit as soon as true.
      //        If no more, will exit with false.
      //== for AND, exit as soon as false. Else, will be true (default)

      // if not short-circuiting, make sure we latch iPass to 'true' in
      // OR mode (i.e. it is sufficient for one item to be true in order
      // to be true at the end, and thus we start out at 'false'), and latch
      // to 'false' in AND mode (i.e. it is sufficient for one item to
      // be false to the false in the end, and thus we start out at 'true')
      // -- i.e. we should not just blindly return the 'last' passed status!

      // or to put it another way: in OR mode, we don't care about things
      // which are false, as they leave our current state alone (provided
      // we stared as 'false'!), and in AND mode, we keep our current
      // state until someone returns 'false' (provided we started as 'true')
      if ( m_modeOR ? passed : !passed ) {
        seqPass = passed;
        if (msgLevel(MSG::VERBOSE))
          verbose() << "SeqPass is now " << (seqPass ? "true" : "false") << endmsg;
        if (m_shortCircuit) break;
      }
    }

  }
  if (msgLevel(MSG::VERBOSE))
      verbose() << "SeqPass is " << (seqPass ? "true" : "false") << endmsg;
  if ( !m_ignoreFilter && !m_entries.empty() ) setFilterPassed( seqPass );
  setExecuted( true );

  if ( m_measureTime ) m_timerTool->stop( m_timer );

  return m_returnOK ? StatusCode::SUCCESS : result;
}
Exemplo n.º 5
0
 StatusCode execute() {
   setFilterPassed(((++m_counter) % 2) == 0);
   return StatusCode::SUCCESS;
 }