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


C++ Event::run方法代码示例

本文整理汇总了C++中edm::Event::run方法的典型用法代码示例。如果您正苦于以下问题:C++ Event::run方法的具体用法?C++ Event::run怎么用?C++ Event::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edm::Event的用法示例。


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

示例1: analyze

void GlobalPositionRcdScan::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup)
{
  lastRun_ = evt.run();
  if (0 == firstRun_) firstRun_ = lastRun_;

  if (watcher_.check(evtSetup)) {
  
    edm::ESHandle<Alignments> globalPositionRcd;
    evtSetup.get<GlobalPositionRcd>().get(globalPositionRcd);

    std::cout << "=====================================================\n" 
	      << "GlobalPositionRcd content starting from run " << evt.run() << ":" << std::endl;
  
    for (std::vector<AlignTransform>::const_iterator i = globalPositionRcd->m_align.begin();
	 i != globalPositionRcd->m_align.end();  ++i) {
      std::cout << "  Component ";
      if (i->rawId() == DetId(DetId::Tracker).rawId()) {
	std::cout << "Tracker";
      }
      else if (i->rawId() == DetId(DetId::Muon).rawId()) {
	std::cout << "Muon   ";
      }
      else if (i->rawId() == DetId(DetId::Ecal).rawId()) {
	std::cout << "Ecal   ";
      }
      else if (i->rawId() == DetId(DetId::Hcal).rawId()) {
	std::cout << "Hcal   ";
      }
      else if (i->rawId() == DetId(DetId::Calo).rawId()) {
	std::cout << "Calo   ";
      }
      else {
	std::cout << "Unknown";
      }
      std::cout << " entry " << i->rawId() 
		<< "\n     translation " << i->translation() << "\n";
      const AlignTransform::Rotation hepRot(i->rotation());
      if (eulerAngles_) {
	std::cout << "     euler angles " << hepRot.eulerAngles() << std::endl;
      }
      if (alignAngles_) {
	const align::RotationType matrix(hepRot.xx(), hepRot.xy(), hepRot.xz(),
					 hepRot.yx(), hepRot.yy(), hepRot.yz(),
					 hepRot.zx(), hepRot.zy(), hepRot.zz());
	const AlgebraicVector angles(align::toAngles(matrix));
	std::cout << "     alpha, beta, gamma (" << angles[0] << ", " << angles[1] << ", "
		  << angles[2] << ')' << std::endl;
      }
      if (matrix_) {
	std::cout << "     rotation matrix " << hepRot << std::endl;
      }
    }
  }
}
开发者ID:ANSH0712,项目名称:cmssw,代码行数:54,代码来源:GlobalPositionRcdScan.cpp

示例2: inspectRecord

void AlignmentRcdScan::inspectRecord(const std::string & rcdname,
				     const edm::Event& evt, 
				     const edm::ESHandle<Alignments> & alignments)
{
  std::cout << rcdname << " content starting from run " << evt.run();
  
  if (verbose_==false) {
    std::cout << std::endl;
    return;
  }

  std::cout << " with " << alignments->m_align.size() << " entries" << std::endl;
  
  if (refAlignments_) {

    std::cout << "  Compared to previous record:" << std::endl;
    
    double meanX = 0;
    double rmsX = 0;
    double meanY = 0;
    double rmsY = 0;
    double meanZ = 0;
    double rmsZ = 0;
    double meanR = 0;
    double rmsR = 0;
    double dPhi;
    double meanPhi = 0;
    double rmsPhi = 0;
    
    std::vector<AlignTransform>::const_iterator iref = refAlignments_->m_align.begin();
    for (std::vector<AlignTransform>::const_iterator i = alignments->m_align.begin();
	 i != alignments->m_align.end();
	 ++i, ++iref) {
      
      meanX += i->translation().x() - iref->translation().x();
      rmsX += pow(i->translation().x() - iref->translation().x(), 2);
 
      meanY += i->translation().y() - iref->translation().y();
      rmsY += pow(i->translation().y() - iref->translation().y(), 2);
      
      meanZ += i->translation().z() - iref->translation().z();
      rmsZ += pow(i->translation().z() - iref->translation().z(), 2);
      
      meanR += i->translation().perp() - iref->translation().perp();
      rmsR += pow(i->translation().perp() - iref->translation().perp(), 2);

      dPhi = i->translation().phi() - iref->translation().phi();
      if (dPhi>TMath::Pi()) dPhi -= 2.0*TMath::Pi();
      if (dPhi<-TMath::Pi()) dPhi += 2.0*TMath::Pi();

      meanPhi += dPhi;
      rmsPhi += dPhi*dPhi;
    }

    meanX /= alignments->m_align.size();
    rmsX /= alignments->m_align.size();
    meanY /= alignments->m_align.size();
    rmsY /= alignments->m_align.size();
    meanZ /= alignments->m_align.size();
    rmsZ /= alignments->m_align.size();
    meanR /= alignments->m_align.size();
    rmsR /= alignments->m_align.size();
    meanPhi /= alignments->m_align.size();
    rmsPhi /= alignments->m_align.size();
    
    std::cout << "    mean X shift:   " 
	      << std::setw(12) << std::scientific << std::setprecision(3) << meanX
	      << " (RMS = " << sqrt(rmsX) << ")" << std::endl;
    std::cout << "    mean Y shift:   " 
	      << std::setw(12) << std::scientific << std::setprecision(3) << meanY
	      << " (RMS = " << sqrt(rmsY) << ")" << std::endl;
    std::cout << "    mean Z shift:   " 
	      << std::setw(12) << std::scientific << std::setprecision(3) << meanZ
	      << " (RMS = " << sqrt(rmsZ) << ")" << std::endl;
    std::cout << "    mean R shift:   " 
	      << std::setw(12) << std::scientific << std::setprecision(3) << meanR
	      << " (RMS = " << sqrt(rmsR) << ")" << std::endl;
    std::cout << "    mean Phi shift: " 
	      << std::setw(12) << std::scientific << std::setprecision(3) << meanPhi
	      << " (RMS = " << sqrt(rmsPhi) << ")" << std::endl;
    
    delete refAlignments_;
  }

  refAlignments_ = new Alignments(*alignments);

  std::cout << std::endl;
}
开发者ID:ANSH0712,项目名称:cmssw,代码行数:88,代码来源:AlignmentRcdScan.cpp


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