Пример #1
0
int main() {
  typedef GloballyPositioned<float>           Frame;
  Surface::RotationType rot;
  Surface::PositionType pos( 1, 2, 3);

  BoundPlane plane( pos, rot);

 std::cout << "size of Frame " << sizeof(Frame) << std::endl;
 std::cout << "size of Surface " << sizeof(Surface) << std::endl;
 std::cout << "size of Plane " << sizeof(Plane) << std::endl;
 std::cout << "size of BoundPlane " << sizeof(BoundPlane) << std::endl;

  LocalPoint lp(0,0,0);
  cout << plane.toGlobal(lp)  << ", delta = " << plane.toGlobal(lp)-pos << endl;

  double eps = 1.e-10;
  Point3DBase< float, LocalTag> f2(eps,eps,eps);
  cout << plane.toGlobal(f2) << ", delta = " << plane.toGlobal(f2)-pos << endl;
  
  Point3DBase< double, GlobalTag> nom( 1, 2, 3);
  Point3DBase< double, LocalTag> dlp(0,0,0);
  cout << plane.toGlobal(dlp) << ", delta = " << plane.toGlobal(dlp)-nom << endl;

  Point3DBase< double, LocalTag> d2(eps,eps,eps);
  cout << plane.toGlobal(d2) << ", delta = " << plane.toGlobal(d2)-nom << endl;
 
  Point3DBase< double, GlobalTag> dgp( 0.1, 0.2, 0.3);
  Vector3DBase< double, GlobalTag> dgv( 0.1, 0.2, 0.3);
  Vector3DBase< double, LocalTag> dlv( 0.1, 0.2, 0.3);

  st();
  Point3DBase<double, LocalTag>   p1 =  plane.toLocal(dgp);
  Vector3DBase<double, LocalTag>  v1 = plane.toLocal(dgv);
  Vector3DBase<double, GlobalTag> g1 = plane.toGlobal(dlv);
  en();
  cout << p1 << endl;
  cout << v1 << endl;
  cout << g1 << endl;

  double a[3];
  double v[3] = { dgv.x(), dgv.y(), dgv.z() };
  double r[9] = { rot.xx(), rot.xy(), rot.xz(),
		  rot.yx(), rot.yy(), rot.yz(),
		  rot.zx(), rot.zy(), rot.zz()
  };

  st();
  for (int i=0; i<3; i++) {
    int j=3*i;
    a[i] = r[j]*v[0] + r[j+1]*v[1] + r[j+2]*v[2];
  }
  en();

  Vector3DBase<double, LocalTag>  v2(a[0],a[1],a[2]);
  cout << v2 << endl;
   


}
Пример #2
0
void ComputeTransformation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
  edm::ESHandle<DTGeometry> dtGeometry;
  iSetup.get<MuonGeometryRecord>().get(dtGeometry);

  edm::ESHandle<CSCGeometry> cscGeometry;
  iSetup.get<MuonGeometryRecord>().get(cscGeometry);

  std::ofstream output;
  output.open(m_fileName.c_str());
  output << "rotation = {}" << std::endl;

  for (int wheel = -2; wheel <= 2; wheel++) {
    for (int station = 1; station <= 4; station++) {
      for (int sector = 1; sector <= 14; sector++) {
        if (station != 4 and sector > 12)
          continue;
        DTChamberId id(wheel, station, sector);
        // globalcoords = rot * localcoords
        Surface::RotationType rot = dtGeometry->idToDet(id)->surface().rotation();
        output << "rotation[\"DT\", " << wheel << ", " << station << ", 0, " << sector << "] = [[" << rot.xx() << ", "
               << rot.xy() << ", " << rot.xz() << "], [" << rot.yx() << ", " << rot.yy() << ", " << rot.yz() << "], ["
               << rot.zx() << ", " << rot.zy() << ", " << rot.zz() << "]]" << std::endl;
      }
    }
  }

  for (int endcap = 1; endcap <= 2; endcap++) {
    for (int station = 1; station <= 4; station++) {
      for (int ring = 1; ring <= 3; ring++) {
        if (station > 1 and ring == 3)
          continue;
        for (int sector = 1; sector <= 36; sector++) {
          if (station > 1 && ring == 1 && sector > 18)
            continue;
          CSCDetId id(endcap, station, ring, sector);
          // globalcoords = rot * localcoords
          Surface::RotationType rot = cscGeometry->idToDet(id)->surface().rotation();
          output << "rotation[\"CSC\", " << endcap << ", " << station << ", " << ring << ", " << sector << "] = [["
                 << rot.xx() << ", " << rot.xy() << ", " << rot.xz() << "], [" << rot.yx() << ", " << rot.yy() << ", "
                 << rot.yz() << "], [" << rot.zx() << ", " << rot.zy() << ", " << rot.zz() << "]]" << std::endl;
        }
      }
    }
  }
}