当前位置: 首页>>代码示例>>C++>>正文


C++ tuples::Tuple类代码示例

本文整理汇总了C++中tuples::Tuple的典型用法代码示例。如果您正苦于以下问题:C++ Tuple类的具体用法?C++ Tuple怎么用?C++ Tuple使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Tuple类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fillVertex

//=========================================================================
// fill vertex stuff
//=========================================================================
StatusCode TupleToolGeometry::fillVertex( const LHCb::VertexBase* vtx,
                                          const std::string& vtx_name,
                                          Tuples::Tuple& tuple ) const
{
  bool test = true ;

  // decay vertex information:
  if ( !vtx )
  {
    Gaudi::XYZPoint pt(-999.,-999.,-999.) ; // arbitrary point
    test &= tuple->column(  vtx_name+"_", pt );
    test &= tuple->column(  vtx_name + "_XERR", -999. );
    test &= tuple->column(  vtx_name + "_YERR", -999. );
    test &= tuple->column(  vtx_name + "_ZERR", -999. );
    test &= tuple->column(  vtx_name + "_CHI2", -999. );
    test &= tuple->column(  vtx_name + "_NDOF", -1 );
    test &= tuple->matrix(  vtx_name + "_COV_", Gaudi::SymMatrix3x3()  );
  }
  else
  {
    test &= tuple->column( vtx_name+"_", vtx->position() );
    const Gaudi::SymMatrix3x3 & m = vtx->covMatrix ();
    test &= tuple->column(  vtx_name + "_XERR", std::sqrt( m(0,0) ) );
    test &= tuple->column(  vtx_name + "_YERR", std::sqrt( m(1,1) ) );
    test &= tuple->column(  vtx_name + "_ZERR", std::sqrt( m(2,2) ) );
    test &= tuple->column(  vtx_name + "_CHI2", vtx->chi2() );
    test &= tuple->column(  vtx_name + "_NDOF", vtx->nDoF() );
    test &= tuple->matrix(  vtx_name + "_COV_", m );
  }

  // --------------------------------------------------
  if (!test) Warning("Error in fillVertex "+vtx_name,1).ignore();
  return StatusCode(test) ;

}
开发者ID:Burney222,项目名称:Master-Make-Based,代码行数:38,代码来源:TupleToolGeometry.cpp

示例2: fillBPV

//=========================================================================
//  Fill PV for related PV
//=========================================================================
StatusCode TupleToolGeometry::fillBPV( const VertexBase* primVtx
                                       , const Particle* P
                                       , const std::string& prefix
                                       , Tuples::Tuple& tuple
                                       , const std::string& trail) const {
  bool test = true ;

  double ip=0, chi2=0;
  if ( !primVtx )
  {
    ++counter("No BPV for "+prefix);
    test &= tuple->column( prefix + "_IP"+trail, -999. );
    test &= tuple->column( prefix + "_IPCHI2"+trail, -999. );
  }
  else
  {
    test &= m_dist->distance ( P, primVtx, ip, chi2 );
    if ( !test )
    {
      ip   = -1;
      chi2 = -1;
    }
    test &= tuple->column( prefix + "_IP"+trail, ip );
    test &= tuple->column( prefix + "_IPCHI2"+trail, chi2 );
  }

  if (!test) Warning("Error in fillBPV "+prefix,1).ignore();
  return StatusCode(test) ;
}
开发者ID:Burney222,项目名称:Master-Make-Based,代码行数:32,代码来源:TupleToolGeometry.cpp

示例3:

// ============================================================================
StatusCode GaudiPython::TupleDecorator::column
( const Tuples::Tuple&  tuple ,
  const std::string&    name  ,
  IOpaqueAddress*       value )
{
  if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
  return tuple->column( name , value ) ;
}
开发者ID:atlas-org,项目名称:gaudi,代码行数:9,代码来源:TupleDecorator.cpp

示例4: Error

// ============================================================================
StatusCode GaudiPython::TupleDecorator::matrix
( const Tuples::Tuple&            tuple ,
  const std::string&              name   ,
  const CLHEP::HepGenMatrix&      data  )
{
  if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
  if ( 1 > data.num_col()   )
  { return tuple ->
      Error  ("GP:matrix(2): illegal fixed matrix num_col" ) ; }
  if ( 1 > data.num_row()   )
  { return tuple ->
      Error  ("GP:matrix(2): illegal fixed matrix num_row" ) ; }
  return tuple->matrix( name , data , data.num_row() , data.num_col() ) ;
}
开发者ID:atlas-org,项目名称:gaudi,代码行数:15,代码来源:TupleDecorator.cpp

示例5: fill

//=============================================================================
// Fill the tuple
//=============================================================================
StatusCode TupleToolTrackPosition::fill( const LHCb::Particle *, const LHCb::Particle *   part,
                                         const std::string &   head, Tuples::Tuple &   tuple )
{

  const std::string prefix=fullName(head);
  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Fill" << endmsg;

  bool test=true;

  double X=-999999;
  double Y=-999999;


  if( part && part->proto() && part->proto()->track() )
  {

    if ( msgLevel(MSG::VERBOSE) ) verbose() << "extrapolating track to Z="<< m_Z << endmsg;

    LHCb::State aState=LHCb::State();
    //const LHCb::Track aTrack= *(part->proto()->track());
    StatusCode sc=m_extrapolator->stateFromTrajectory(aState,*(part->proto()->track()),m_Z);
    if(sc.isSuccess())
    {
      X=aState.x();
      Y=aState.y();
    }

  }

  test &= tuple->column( prefix+"_X", X );
  test &= tuple->column( prefix+"_Y", Y );

  return StatusCode(test);
}
开发者ID:Burney222,项目名称:Master-Make-Based,代码行数:37,代码来源:TupleToolTrackPosition.cpp

示例6: fill

//=============================================================================
StatusCode TupleToolCaloHypo::fill(const Particle* , const Particle* P
                                   ,const std::string& head
                                   ,Tuples::Tuple& tuple ){

  const std::string prefix=fullName(head);


  if( NULL == P )return StatusCode::SUCCESS;
  if( NULL == P->proto() )return StatusCode::SUCCESS;
  if( 0 != P->charge() && !m_charged)return StatusCode::SUCCESS;

  bool filltuple = true;
  const SmartRefVector<LHCb::CaloHypo>& hypos = P->proto()->calo();
  bool hasCalo = true;
  bool hasBremCalo = false;
  if( 0 == hypos.size() )hasCalo = false;
  if( 1 < hypos.size() )hasBremCalo = true;
  filltuple &= tuple->column( prefix+"_hasCaloHypo", (int) hasCalo );
  if( !isPureNeutralCalo( P ) && m_brem )
    filltuple &= tuple->column( prefix+"_hasBremCaloHypo", (int) hasBremCalo );



  using namespace CaloDataType;
  // select hypos
  const LHCb::CaloHypo* hypo = NULL;
  const LHCb::CaloHypo* hypo2 = NULL;
  for( SmartRefVector<CaloHypo>::const_iterator ih = hypos.begin() ; hypos.end() != ih ; ++ih){
    if( !isPureNeutralCalo( P ) ){
      if( (*ih)->hypothesis() == LHCb::CaloHypo::EmCharged)hypo = *ih;
      else hypo2 = *ih;
    }else hypo = *ih;
  }
  //fill tuple
  for( int id = 0 ; id < Last ; ++id){
    int mask = ( P->charge() == 0 ) ? 0x1 : 0x2;
    if( useData( id , mask ) ){
      double val  =  (NULL != hypo && hasCalo)    ? m_estimator->data(hypo, (DataType) id ,0.) : 0.;      
      filltuple &= tuple->column( prefix+"_CaloHypo_"+Name[id], val );
    }
    if( P->charge() != 0 && m_brem && useData( id , 0x1 ) ){
      double bval =  (NULL != hypo2 && hasBremCalo) ? m_estimator->data(hypo2,(DataType) id ,0.) : 0.;
      filltuple &= tuple->column( prefix+"_BremCaloHypo_"+Name[id], bval );
    }
  }
  return StatusCode(filltuple);
}
开发者ID:Burney222,项目名称:Master-Make-Based,代码行数:48,代码来源:TupleToolCaloHypo.cpp

示例7: column

// ============================================================================
StatusCode GaudiPython::TupleDecorator::column
( const Tuples::Tuple& tuple ,
  const std::string&   name  ,
  const int            value ,
  const int            minv  ,
  const int            maxv  )
{
  if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
  return tuple -> column ( name , value , minv , maxv ) ;
}
开发者ID:atlas-org,项目名称:gaudi,代码行数:11,代码来源:TupleDecorator.cpp

示例8: fillFlight

//=========================================================================
// fill flight distance, angle...
//=========================================================================
StatusCode TupleToolGeometry::fillFlight( const VertexBase* oriVtx,
                                          const Particle* P,
                                          const std::string& prefix,
                                          Tuples::Tuple& tuple,
                                          const std::string& trail ) const
{
  bool test = true ;
  // --------------------------------------------------
  if ( !oriVtx )
  {
    test &= tuple->column( prefix + "_FD"+trail, -999. );
    test &= tuple->column( prefix + "_FDCHI2"+trail, -999. );
    test &= tuple->column( prefix + "_DIRA"+trail, -999.);
  }
  else
  {

    // flight distance
    double dist = 0;
    double chi2 = 0 ;
    StatusCode sc = m_dist->distance( oriVtx, P->endVertex(), dist, chi2 );
    if ( sc.isFailure() ) return sc ;

    test &= tuple->column( prefix + "_FD"+trail, dist );
    test &= tuple->column( prefix + "_FDCHI2"+trail, chi2 );
    // --------------------------------------------------
    // cosine of (flight distance) dot (momentum):
    // find the origin vertex. Either the primary or the origin in the
    // decay
    test &= tuple->column( prefix + "_DIRA"+trail, dira(oriVtx,P) );
  }

  if (!test) Warning("Error in fillFlight "+prefix,1).ignore();
  return StatusCode(test);
}
开发者ID:Burney222,项目名称:Master-Make-Based,代码行数:38,代码来源:TupleToolGeometry.cpp

示例9: fill

StatusCode TupleToolVtxIsoln::fill( const Particle* mother
                                    , const Particle* P
                                    , const std::string& head
                                    , Tuples::Tuple& tuple ){

  const std::string prefix = fullName(head);
  Assert( P && mother, "This should not happen, you are inside TupleToolVtxIsoln.cpp :(" );
  // Check the ExtraInfo
  bool test = true ;
  if ( P->isBasicParticle() ) return StatusCode::SUCCESS ;
  // Fill tuple
  if ( P->hasInfo(m_indices.first) )
  {
    double def = -999999. ;
    double val ;
    for (int index = m_indices.first; index != m_indices.last; ++index)
    {
      val = P->info(index, def) ;
      test &= tuple->column(prefix+"_"+m_varNames[index], val);
    }
  }
  else
  {
    m_isolationTool->calculateExtraInfo(P, P) ;
    double val ;
    int result ;
    for (int index = m_indices.first; index != m_indices.last; ++index)
    {
      std::string name ;
      result = m_isolationTool->getInfo(index, val, name) ;
      if ( !result ) continue ;
      test &= tuple->column(prefix+"_"+name, val);
    }
  }
  return StatusCode(test) ;
}
开发者ID:Burney222,项目名称:Master-Make-Based,代码行数:36,代码来源:TupleToolVtxIsoln.cpp

示例10: Warning

// ============================================================================
StatusCode GaudiPython::TupleDecorator::matrix
( const Tuples::Tuple&            tuple ,
  const std::string&              name   ,
  const GaudiPython::Matrix&      data  ,
  const Tuples::TupleObj::MIndex  cols  )  // fixed !!!
{
  if ( !tuple.valid() ) { return StatusCode::FAILURE ; }
  if ( data.empty()   )
  { return tuple ->
      Warning ("GP:matrix(1): empty fixed matrix, skip matrix "    ) ; }
  if ( cols != data.front().size() )
  { return tuple ->
      Error  ("GP:matrix(1): mismatch in fixed matrix dimensions!" ) ; }
  return tuple -> matrix ( name , data , data.size() , cols  ) ;
}
开发者ID:atlas-org,项目名称:gaudi,代码行数:16,代码来源:TupleDecorator.cpp

示例11: fill

//=============================================================================
// Fill
//=============================================================================
StatusCode TupleToolSelResults::fill( Tuples::Tuple& tup)
{
  const std::string prefix = fullName();
  bool test = true;
  for ( std::vector<std::string>::const_iterator s = m_selections.begin() ;
        s != m_selections.end(); ++s )
  {
    test &= tup->column(prefix+(*s),m_selTool->isSelected(*s));
    if (!test)
    {
      err() << "Cannot fill variable name " << prefix+(*s) << endmsg ;
      break;
    }
  }
  return StatusCode(test) ;
}
开发者ID:Burney222,项目名称:Master-Make-Based,代码行数:19,代码来源:TupleToolSelResults.cpp

示例12: fill

StatusCode TupleToolTagging::fill( const Particle* mother
                                   , const Particle* P
                                   , const std::string& head
                                   , Tuples::Tuple& tuple )
{
  const std::string prefix=fullName(head);

  Assert( P && mother && m_dva && m_tagging,
          "Should not happen, you are inside TupleToolTagging.cpp" );

  std::string loc = objectLocation( P->parent() );

  // nothing to tag on something which is not a B
  if( !P->particleID().hasBottom() ) return StatusCode::SUCCESS;

  if( msgLevel( MSG::DEBUG ) ){
    debug() << " Going to Save Tagging information for B candidate "
            << endreq;
  }

  FlavourTag theTag;
  FlavourTags* tags = NULL;
  bool check = false;

  StatusCode sc=StatusCode::SUCCESS;

  boost::replace_all( loc, "/Particles", "/FlavourTags" );
  if( m_useFTonDST ) {
    if( exist < LHCb::FlavourTags > (loc,IgnoreRootInTES))
      tags = get< LHCb::FlavourTags > (loc,IgnoreRootInTES );
  }
  
  if (tags) {
    for(FlavourTags::const_iterator it = tags->begin(); it != tags->end(); ++it) {
      if( P != (**it).taggedB()) continue;
      theTag =  **it;
      check = true;
    }
    if (!check) sc = StatusCode::FAILURE;
  } else {
    const VertexBase* v = m_dva->bestVertex( mother );
    const RecVertex* vtx = dynamic_cast<const RecVertex*>(v);
    if( !vtx ){
      sc = m_tagging->tag( theTag, P );
    } else {
      sc = m_tagging->tag( theTag, P, vtx );
    }
  }
  // try to find unphysical defaults
  int dec = 0;
  double omega = 0.5;
  int decOS = 0;
  double omegaOS = 0.5;

  if( sc ){
    dec = theTag.decision();
    omega = theTag.omega(); // predicted wrong tag fraction.
    decOS = theTag.decisionOS();
    omegaOS = theTag.omegaOS(); // predicted wrong tag fraction.
  } else {
    Warning("The tagging algorithm failed");
  }

  bool test = true;
  test &= tuple->column( prefix+"_TAGDECISION" , dec );
  test &= tuple->column( prefix+"_TAGOMEGA" , omega );
  test &= tuple->column( prefix+"_TAGDECISION_OS" , decOS );
  test &= tuple->column( prefix+"_TAGOMEGA_OS" , omegaOS );

  int taggers_code = 0;
  // intialize tagger by tagger W :

  std::vector<Tagger> taggers = theTag.taggers();

  for(size_t i=0; i<taggers.size(); ++i) {
    int tdec = taggers[i].decision();

    if(tdec) switch ( taggers[i].type() ) {
    case Tagger::OS_Charm    : taggers_code +=1000000000 *(tdec+2); break;
    case Tagger::SS_Proton   : taggers_code += 100000000 *(tdec+2); break;
    case Tagger::OS_nnetKaon : taggers_code +=  10000000 *(tdec+2); break;
    case Tagger::SS_nnetKaon : taggers_code +=   1000000 *(tdec+2); break;
    case Tagger::OS_Muon     : taggers_code +=    100000 *(tdec+2); break;
    case Tagger::OS_Electron : taggers_code +=     10000 *(tdec+2); break;
    case Tagger::OS_Kaon     : taggers_code +=      1000 *(tdec+2); break;
    case Tagger::SS_Kaon     : taggers_code +=       100 *(tdec+2); break;
    case Tagger::SS_Pion     : taggers_code +=        10 *(tdec+2); break;
    case Tagger::VtxCharge   : taggers_code +=         1 *(tdec+2); break;

    }
  }
  
  test &= tuple->column( prefix+"_TAGGER" , taggers_code);
 
  if(isVerbose())  
  {    
    // Initialize all columns to default values
    for(size_t i=0; i<m_activeTaggers.size(); i++) {
        std::string active = m_activeTaggers[i];

//.........这里部分代码省略.........
开发者ID:Burney222,项目名称:Master-Make-Based,代码行数:101,代码来源:TupleToolTagging.cpp

示例13: fillMinIP

//=========================================================================
//  Fill PV for all PV
//=========================================================================
StatusCode TupleToolGeometry::fillMinIP( const Particle* P,
                                         const std::string& prefix,
                                         Tuples::Tuple& tuple ) const
{
  bool test = true ;
  // minimum IP
  double ipmin = -1;
  double minchi2 = -1 ;

  double ipminnextbest = -1;
  double minchi2nextbest = -1;
  if(msgLevel(MSG::VERBOSE)) verbose() << "Looking for Min IP"  << endmsg  ;
  const RecVertex::Range PV = m_dva->primaryVertices();
  if(msgLevel(MSG::VERBOSE)) verbose() << "PV size: "  << PV.size() << endmsg  ;
  std::vector<double> ips, ipchi2s, diras;
  if ( !PV.empty() )
  {
    if(msgLevel(MSG::VERBOSE)) verbose() << "Filling IP " << prefix + "_MINIP : "
                                         << P << " PVs:" << PV.size() << endmsg ;

    for ( RecVertex::Range::const_iterator pv = PV.begin() ; pv!=PV.end() ; ++pv)
    {
      RecVertex newPV(**pv);
      if (m_refitPVs)
      {

        StatusCode scfit = m_pvReFitter->remove(P, &newPV);
        if(!scfit) { Warning("ReFitter fails!",StatusCode::SUCCESS,10).ignore(); continue; }
      }

      double ip, chi2;
      //StatusCode test2 = m_dist->distance ( P, *pv, ip, chi2 );

      LHCb::VertexBase* newPVPtr = (LHCb::VertexBase*)&newPV;
      StatusCode test2 = m_dist->distance ( P, newPVPtr, ip, chi2 );
      ips.push_back(ip);
      ipchi2s.push_back(chi2);
      if (P->endVertex()) diras.push_back(dira(newPVPtr,P));
      if( test2 && isVerbose() )
      {
        if ((ip<ipmin) || (ipmin<0.))
        {
          ipminnextbest = ipmin;
          ipmin = ip ;
        }
        else
        {
          if((ip < ipminnextbest) || (ipminnextbest < 0))
          {
            ipminnextbest = ip;
          }
        }

        if ((chi2<minchi2) || (minchi2<0.))
        {
          minchi2nextbest = minchi2;
          minchi2 = chi2 ;
        }
        else
        {
          if((chi2 < minchi2nextbest) || (minchi2nextbest < 0))
          {
            minchi2nextbest = chi2;
          }
        }
      }
    }
  }
  if (isVerbose()){
    if ( msgLevel(MSG::VERBOSE) )
    {
      verbose() << "Filling IP " << prefix + "_MINIP " << ipmin << " at " << minchi2 << endmsg  ;
      verbose() << "Filling IP next best " << prefix + "_MINIP " << ipminnextbest << " at "
                << minchi2nextbest << endmsg  ;
    }
    test &= tuple->column( prefix + "_MINIP", ipmin );
    test &= tuple->column( prefix + "_MINIPCHI2", minchi2 );
    
    test &= tuple->column( prefix + "_MINIPNEXTBEST", ipminnextbest );
    test &= tuple->column( prefix + "_MINIPCHI2NEXTBEST", minchi2nextbest );
  }
  if (m_fillMultiPV){
    test &= tuple->farray( prefix + "_AllIP", ips, "nPV", m_maxPV );
    test &= tuple->farray( prefix + "_AllIPchi2", ipchi2s, "nPV", m_maxPV );
    if (!diras.empty()) test &= tuple->farray( prefix + "_AllDIRA", diras, "nPV", m_maxPV );
    // --------------------------------------------------
  }
  
  if(msgLevel(MSG::VERBOSE))
    verbose() << "Return from fillMinIP: " << prefix  << " " << test << endmsg;
  if (!test)  Warning("Error in fillMinIP",1,StatusCode::FAILURE);
  return StatusCode(test) ;
}
开发者ID:Burney222,项目名称:Master-Make-Based,代码行数:96,代码来源:TupleToolGeometry.cpp


注:本文中的tuples::Tuple类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。