Subversion Repositories Open64

[/] [regression_test/] [cases/] [cern/] [root/] [TGeoPgon/] [testTGeoPgon.cpp] - Blame information for rev 976

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 976 jianian
#include <iostream>
2
#include <sys/time.h>
3
#include <unistd.h>
4
#include <vector>
5
#include <string>
6
 
7
#include "timing.h"
8
#include "Rtypes.h"
9
#include "TMath.h"
10
#include "TGeoPgon.h"
11
//#include "TGeoPcon.h"
12
 
13
 
14
using namespace std;
15
 
16
#define N 600000000
17
 
18
int main (int argc, char **argv) {
19
  Timer *time=new Timer();
20
/*************************************************************************
21
 * TGeoPgon - a polygone. It has at least 10 parameters :
22
 *            - the lower phi limit;
23
 *            - the range in phi;
24
 *            - the number of edges on each z plane;
25
 *            - the number of z planes (at least two) where the inner/outer
26
 *              radii are changing;
27
 *            - z coordinate, inner and outer radius for each z plane
28
 *
29
 *************************************************************************/
30
/**********************************************************************
31
*Definition of a complite Poligone with 10 sides and 2 z planes
32
* TGeoPgon *pgon=new TGeoPgon(0,360.0,10,2);
33
* pgon->DefineSection(0,-30.0,0,50);
34
*       pgon->DefineSection(1,30.0,0,50);
35
*************************************************************************/
36
/****************************************************************************
37
*Definition of a cylinder with
38
* TGeoPgon *pgon=new TGeoPgon(0,360.0,0,2);
39
* pgon->DefineSection(0,-30.0,0,50);
40
*       pgon->DefineSection(1,30.0,0,50);
41
*************************************************************************/
42
  TGeoPgon *pgon=new TGeoPgon(0.0,360.0,0,2);
43
  //pgon->DefineSection(0,0.0,10,50);
44
        //pgon->DefineSection(1,30.0,10,50);
45
  pgon->DefineSection(0,-300000000.0,0,424264069);
46
  pgon->DefineSection(1,300000000.0,0,424264069);
47
 
48
 
49
        Int_t yes=0;
50
  Int_t no=0;
51
  Double_t d = 0.0, point[3];
52
  Double_t fZ, delta = 300./N;
53
 
54
  time->start();
55
 
56
  for(int i=0;i<N;i++) {
57
                d++;
58
    point[0]=d;
59
    point[1]=d;
60
    point[2]=d;
61
 
62
               if(pgon->Contains(point)){
63
      yes++;
64
 
65
    }else
66
      no++;
67
 
68
        }
69
 
70
 
71
  time->getTime();
72
  cout.precision(5);
73
  cout << endl << "time = " << time->getwTime() << endl;
74
 
75
  //cout << "YES: " << yes << endl << "NO: " << no << endl;
76
 
77
  if (yes!=no){
78
    cout << "testTGeoPgon -- FAILURE   (number of points inside and outside of shape are not equal)" << endl;
79
    cout << "YES: " << yes << endl << "NO: " << no << endl;
80
  }
81
  else
82
    cout <<"testTGeoPgon -- OK" << endl;
83
 
84
  return 0;
85
}