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


C++ Output::Fill方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
          return 1;
        }
        if( j == 0 ) evt_wt = wgt_tmp;
        if( evt_wt > 0 && pdfwgts[j] > 0 )
          pdfwgts[j] = wgt_tmp / evt_wt;
        else
          pdfwgts[j] = 1.0;
        if( pdfwgts[j] < 0 )
          pdfwgts[j] = 0.0;
      }
#endif
     
      float vx,vy,vz;
      f>> vx >> vy >>vz;
      
      bool finished_particles = false;
      if( !f.eof())
      {
	if (StandardWeight == 0. && Unweight){
	  StandardWeight = evt_wt;
	  std::cout << "Standard Weight  = " <<  StandardWeight << std::endl;
	}
      }
      else
      {
        finished_file = true;
      }

      Bool_t keeper = kTRUE;
      if (Unweight){
	Double_t weight_ratio=  TMath::Abs(evt_wt/StandardWeight);
	if (weight_ratio > 1.){
	  std::cout << "This event has a weight = " << weight_ratio <<" times the value of Standard Weight" << std::endl;
	}	  
	if (random.Rndm() > weight_ratio)
	  keeper = kFALSE;
      }
      if (Unweight)
      	evt_wt = TMath::Abs(evt_wt) / evt_wt ;
      
      //
      // read event weight for each PDF set
      //
      double weight_PDF[44];
      if(PDF_reweight) {
	for(int j=0; j<44; j++) (f_weights[j]) >> weight_PDF[i];
      }
      
      // save PDF information into the root file
      //      output->setPDFWeights(weight_PDF);
      if (keeper) {
	if(PDF_reweight) output->NewEvent( evn, evt_wt, 0 , vx,vy,vz, weight_PDF, 44);
	else 
   {
     output->NewEvent( evn, evt_wt, 0 , vx,vy,vz , Q2 , x1 , x2 , flav1 , flav2 , pdfwgts );
   }
      }
      
      //bool doFlip = false;
      //doFlip = ( random.Rndm() > 0.5); 
      
      // this loops over particles in an event
      while( ! finished_particles && !f.eof()) {
	int id;
	f >> id;
	if( id == 0 )
	  finished_particles = true;
	else {
	  float px,py,pz,E;
	  f>> px >> py >> pz >> E;
	  int origin, udk;
	  f >> origin >> udk;
	  //std::cout << id << " " << px << " " << py << " " << pz << " " << E << std::endl;
	  
	  // do the occaisional CP inversion
	  // flip W+ -> W-, e+->e-, nu -> nu-bar and invert all momenta
	  //if( doFlip ) {
	  // id is isajet ids
	  //  if( id != 10 ) id = -id;  // photon == anti-photon
	  //  px = -px;
	  //  py = -py;
	  //  pz = -pz;
	  //}
	  if(keeper)
	   output->AddParticle( id, px,py,pz,E,origin);
	}
      }
      if (keeper){
	output->Fill();	
      }
      if( f.eof()) finished_file = true;
    }
    f.close();
  }
  
  output->Write();
  of = output->Tree()->GetCurrentFile();
  of->Close();
  return 0;
};
开发者ID:rafaellopesdesa,项目名称:wmass_pythia_interface,代码行数:101,代码来源:tupleMaker.cpp


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