File: testBug6740.cc

package info (click to toggle)
clhep 2.1.4.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,012 kB
  • sloc: cpp: 50,094; sh: 6,694; makefile: 2,694; perl: 28
file content (32 lines) | stat: -rw-r--r-- 707 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

#include <iostream>
#include <cmath>
#include <float.h>

#include "CLHEP/Geometry/Point3D.h"
#include "CLHEP/Vector/ThreeVector.h"

typedef HepGeom::Point3D<double> HepPoint3D;

int main(int, char **) {

  CLHEP::Hep3Vector d(10,0,0);
  HepPoint3D a(0,0,0);
  HepPoint3D pv(1,1,1);
  
  float expected = 1.41421;
  int numbad = 0;

  CLHEP::Hep3Vector dist = a-pv; // this does not compile anymore 
  CLHEP::Hep3Vector Cross = dist.cross(d.unit()); 
  std::cout << Cross.mag() << std::endl;
  
  float result = Cross.mag();
  float eps = 1.0e-5;
  if( std::fabs(result - expected) >  eps ) {
    ++numbad;
    std::cout << "Expected " << expected << " got " << result << std::endl;
  }
  return numbad;

}