本文整理汇总了C++中MaterialManager::materialsBetween方法的典型用法代码示例。如果您正苦于以下问题:C++ MaterialManager::materialsBetween方法的具体用法?C++ MaterialManager::materialsBetween怎么用?C++ MaterialManager::materialsBetween使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaterialManager
的用法示例。
在下文中一共展示了MaterialManager::materialsBetween方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv ){
if( argc != 8 ) {
std::cout << " usage: print_materials compact.xml x0 y0 z0 x1 y1 z1 " << std::endl
<< " -> prints the materials on a straight line between the two given points ( unit is cm) "
<< std::endl ;
exit(1) ;
}
std::string inFile = argv[1] ;
std::stringstream sstr ;
sstr << argv[2] << " " << argv[3] << " " << argv[4] << " " << argv[5] << " " << argv[6] << " " << argv[7] ;
double x0,y0,z0,x1,y1,z1 ;
sstr >> x0 ;
sstr >> y0 ;
sstr >> z0 ;
sstr >> x1 ;
sstr >> y1 ;
sstr >> z1 ;
LCDD& lcdd = LCDD::getInstance();
lcdd.fromCompact( inFile );
Vector3D p0( x0, y0, z0 ) ;
Vector3D p1( x1, y1, z1 ) ;
MaterialManager matMgr ;
const MaterialVec& materials = matMgr.materialsBetween( p0 , p1 ) ;
std::cout << std::endl << " ####### materials between the two points : " << p0 << "*cm and " << p1 << "*cm : " << std::endl ;
double sum_x0 = 0 ;
double sum_lambda = 0 ;
double path_length = 0 ;
for( unsigned i=0,n=materials.size();i<n;++i){
Material mat = materials[i].first ;
double length = materials[i].second ;
double nx0 = length / mat.radLength() ;
sum_x0 += nx0 ;
double nLambda = length / mat.intLength() ;
sum_lambda += nLambda ;
path_length += length ;
std::cout << " " << mat << " thickness: " << length << " path_length:" << path_length << " integrated_X0: " << sum_x0 << " integrated_lambda: " << sum_lambda << std::endl ;
}
std::cout << "############################################################################### " << std::endl << std::endl ;
const MaterialData& avMat = matMgr.createAveragedMaterial( materials ) ;
std::cout << " averaged Material : " << " Z: " << avMat.Z() << " A: " << avMat.A() << " densitiy: " << avMat.density()
<< " radiationLength: " << avMat.radiationLength()
<< " interactionLength: " << avMat.interactionLength() << std::endl << std::endl ;
std::cout << " Total length : " << path_length / dd4hep::mm << " mm " << std::endl ;
std::cout << " Integrated radiation lengths : " << path_length / avMat.radiationLength() << " X0 " << std::endl ;
std::cout << " Integrated interaction lengths : " << path_length / avMat.interactionLength() << " lambda " << std::endl ;
std::cout << "############################################################################### " << std::endl << std::endl ;
return 0;
}