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


C++ TGeoRotation::MultiplyBy方法代码示例

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


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

示例1: AddMirrors

void AddMirrors(AOpticalComponent* opt)
{
  // dummy hexagonal prism to cut a spherical mirror
  TGeoPgon* mirCut = new TGeoPgon("mirCut", 0., 360., 6, 2);
  mirCut->DefineSection(0, -100*mm, 0, kMirrorD/2.);
  mirCut->DefineSection(1,  100*mm, 0, kMirrorD/2.);

  double theta = TMath::ASin(kMirrorD/TMath::Sqrt(3)/kMirrorR)*TMath::RadToDeg();
  TGeoSphere* mirSphere = new TGeoSphere("mirSphere", kMirrorR, kMirrorR + kMirrorT, 180. - theta, 180.);
  TGeoTranslation* transZ = new TGeoTranslation("transZ", 0, 0, kMirrorR);
  transZ->RegisterYourself();
  TGeoCompositeShape* mirComposite = new TGeoCompositeShape("mirComposite", "mirSphere:transZ*mirCut");
  AMirror* mirror = new AMirror("mirror", mirComposite);

  const int kNMirror = 88;
  double dx = kMirrorD/TMath::Sqrt(3);
  double dy = kMirrorD/2.;
  double x[kNMirror] = {0, 0, 0, 0, 0, 0, 0, 0,
                        1.5*dx, 1.5*dx, 1.5*dx, 1.5*dx, 1.5*dx,
                        1.5*dx, 1.5*dx, 1.5*dx, 1.5*dx, 1.5*dx,
                        -1.5*dx, -1.5*dx, -1.5*dx, -1.5*dx, -1.5*dx,
                        -1.5*dx, -1.5*dx, -1.5*dx, -1.5*dx, -1.5*dx,
                        3*dx, 3*dx, 3*dx, 3*dx, 3*dx,
                        3*dx, 3*dx, 3*dx, 3*dx,
                        -3*dx, -3*dx, -3*dx, -3*dx, -3*dx,
                        -3*dx, -3*dx, -3*dx, -3*dx,
                        4.5*dx, 4.5*dx, 4.5*dx, 4.5*dx,
                        4.5*dx, 4.5*dx, 4.5*dx, 4.5*dx,
                        -4.5*dx, -4.5*dx, -4.5*dx, -4.5*dx,
                        -4.5*dx, -4.5*dx, -4.5*dx, -4.5*dx,
                        6*dx, 6*dx, 6*dx, 6*dx,
                        6*dx, 6*dx, 6*dx,
                        -6*dx, -6*dx, -6*dx, -6*dx,
                        -6*dx, -6*dx, -6*dx,
                        7.5*dx, 7.5*dx, 7.5*dx,
                        7.5*dx, 7.5*dx, 7.5*dx,
                        -7.5*dx, -7.5*dx, -7.5*dx,
                        -7.5*dx, -7.5*dx, -7.5*dx};

  double y[kNMirror] = {2*dy, 4*dy, 6*dy, 8*dy, -2*dy, -4*dy, -6*dy, -8*dy,
                        1*dy, 3*dy, 5*dy, 7*dy, 9*dy,
                        -1*dy, -3*dy, -5*dy, -7*dy, -9*dy,
                        1*dy, 3*dy, 5*dy, 7*dy, 9*dy,
                        -1*dy, -3*dy, -5*dy, -7*dy, -9*dy,
                        0*dy, 2*dy, 4*dy, 6*dy, 8*dy,
                        -2*dy, -4*dy, -6*dy, -8*dy,
                        0*dy, 2*dy, 4*dy, 6*dy, 8*dy,
                        -2*dy, -4*dy, -6*dy, -8*dy,
                        1*dy, 3*dy, 5*dy, 7*dy,
                        -1*dy, -3*dy, -5*dy, -7*dy,
                        1*dy, 3*dy, 5*dy, 7*dy,
                        -1*dy, -3*dy, -5*dy, -7*dy,
                        0*dy, 2*dy, 4*dy, 6*dy,
                        -2*dy, -4*dy, -6*dy,
                        0*dy, 2*dy, 4*dy, 6*dy,
                        -2*dy, -4*dy, -6*dy,
                        1*dy, 3*dy, 5*dy,
                        -1*dy, -3*dy, -5*dy,
                        1*dy, 3*dy, 5*dy,
                        -1*dy, -3*dy, -5*dy};

  for(int i = 0; i < kNMirror; i++){
    double r2d = TMath::RadToDeg();
    double r2 = TMath::Power(x[i], 2) + TMath::Power(y[i], 2);
    double z = kF - TMath::Sqrt(TMath::Power(kF, 2) - r2);

    // each mirror center is relocated from the origin (0, 0, 0) to (x, y, z)
    TGeoTranslation* trans = new TGeoTranslation(Form("mirTrans%d", i), x[i], y[i], z);

    // and is rotated to compose a DC optics
    double phi = TMath::ATan2(y[i], x[i])*r2d;
    TGeoRotation* rot = new TGeoRotation(Form("mirRot%d", i), - phi + 90., 0, 0);
    theta = TMath::ATan2(TMath::Sqrt(r2), 2*kF - z)*r2d;
    TGeoRotation* rot2 = new TGeoRotation("", phi - 90., theta, 0);
    rot->MultiplyBy(rot2, 0);
    
    // make a matrix from translation and rotation matrices
    TGeoCombiTrans* combi = new TGeoCombiTrans(*trans, *rot);

    // finally add this mirror to the world
    opt->AddNode(mirror, i + 1, combi);
  } // i
}
开发者ID:ROBAST,项目名称:ROBAST,代码行数:83,代码来源:DaviesCotton.C

示例2: initializeTGeoDescription


//.........这里部分代码省略.........
       yc = siPlaneYPosition( *itrPlaneId );
       zc = siPlaneZPosition( *itrPlaneId );
       
       // Get sensor orientation
       alpha = siPlaneXRotation( *itrPlaneId ); // [rad]
       beta  = siPlaneYRotation( *itrPlaneId ); // [rad]
       gamma = siPlaneZRotation( *itrPlaneId ); // [rad]
       
       // Spatial translations of the sensor center
       string stTranslationName = "matrixTranslationSensor";
       stTranslationName.append( strId.str() );
       TGeoTranslation* pMatrixTrans = new TGeoTranslation( stTranslationName.c_str(), xc, yc, zc );
       //ALL clsses deriving from TGeoMatrix are not owned by the ROOT geometry manager, invoking RegisterYourself() transfers
       //ownership and thus ROOT will clean up
       pMatrixTrans->RegisterYourself();      
       
       // Spatial rotation around sensor center
       // TGeoRotation requires Euler angles in degrees
       string stRotationName = "matrixRotationSensorX";
       stRotationName.append( strId.str() );
       TGeoRotation* pMatrixRotX = new TGeoRotation( stRotationName.c_str(), 0.,  alpha*DEG, 0.);                // around X axis
       stRotationName = "matrixRotationSensorY";
       stRotationName.append( strId.str() );
       TGeoRotation* pMatrixRotY = new TGeoRotation( stRotationName.c_str(), 90., beta*DEG,  0.);                // around Y axis (combination of rotation around Z axis and new X axis)
       stRotationName = "matrixRotationSensorBackY";
       stRotationName.append( strId.str() );
       TGeoRotation* pMatrixRotY1 = new TGeoRotation( stRotationName.c_str(), -90., 0.,  0.);                    // restoration of original orientation (valid in small angle approximataion ~< 15 deg)
       stRotationName = "matrixRotationSensorZ";
       stRotationName.append( strId.str() );
       TGeoRotation* pMatrixRotZ = new TGeoRotation( stRotationName.c_str(), 0. , 0.,        gamma*DEG);         // around Z axis
       
       // Combined rotation in several steps
       TGeoRotation* pMatrixRot = new TGeoRotation( *pMatrixRotX );
       pMatrixRot->MultiplyBy( pMatrixRotY );
       pMatrixRot->MultiplyBy( pMatrixRotY1 );
       pMatrixRot->MultiplyBy( pMatrixRotZ );
       pMatrixRot->RegisterYourself();      
      
       pMatrixRotX->RegisterYourself();
       pMatrixRotY->RegisterYourself();
       pMatrixRotY1->RegisterYourself(); 
       pMatrixRotZ->RegisterYourself();
 
       // Combined translation and orientation
       TGeoCombiTrans* combi = new TGeoCombiTrans( *pMatrixTrans, *pMatrixRot );
       combi->RegisterYourself();   
 
       // Construction of sensor objects
       
       // Construct object medium. Required for radiation length determination

       // assume SILICON, though all information except of radiation length is ignored
       double a       = 28.085500;     
       double z       = 14.000000;
       double density = 2.330000;
       double radl    = siPlaneMediumRadLen( *itrPlaneId );
       double absl    = 45.753206;
       string stMatName = "materialSensor";
       stMatName.append( strId.str() );
       TGeoMaterial* pMat = new TGeoMaterial( stMatName.c_str(), a, z, density, radl, absl );
       pMat->SetIndex( 1 );
       // Medium: medium_Sensor_SILICON
       int numed   = 0;  // medium number
       double par[8];
       par[0]  = 0.000000; // isvol
       par[1]  = 0.000000; // ifield
开发者ID:kdoonan,项目名称:eutelescope,代码行数:67,代码来源:EUTelGeometryTelescopeGeoDescription.cpp


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