SISCone
2.0.6
siscone
spherical
geom_2d.h
1
// -*- C++ -*-
3
// File: geom_2d.h //
4
// Description: header file for two-dimensional geometry tools //
5
// This file is part of the SISCone project. //
6
// WARNING: this is not the main SISCone trunk but //
7
// an adaptation to spherical coordinates //
8
// For more details, see http://projects.hepforge.org/siscone //
9
// //
10
// Copyright (c) 2006-2008 Gavin Salam and Gregory Soyez //
11
// //
12
// This program is free software; you can redistribute it and/or modify //
13
// it under the terms of the GNU General Public License as published by //
14
// the Free Software Foundation; either version 2 of the License, or //
15
// (at your option) any later version. //
16
// //
17
// This program is distributed in the hope that it will be useful, //
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
20
// GNU General Public License for more details. //
21
// //
22
// You should have received a copy of the GNU General Public License //
23
// along with this program; if not, write to the Free Software //
24
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
25
// //
26
// $Revision:: 268 $//
27
// $Date:: 2009-03-12 21:24:16 +0100 (Thu, 12 Mar 2009) $//
29
30
#ifndef __SPH_GEOM_2D_H__
31
#define __SPH_GEOM_2D_H__
32
33
#include <iostream>
34
#include <math.h>
35
#include <
siscone/defines.h
>
36
#include <siscone/geom_2d.h>
37
38
#ifndef M_PI
39
#define M_PI 3.141592653589793238462643383279502884197
40
#endif
41
42
namespace
siscone_spherical{
43
52
class
CSphtheta_phi_range
{
53
public
:
55
CSphtheta_phi_range
();
56
62
CSphtheta_phi_range
(
double
c_theta,
double
c_phi,
double
R);
63
66
CSphtheta_phi_range
&
operator =
(
const
CSphtheta_phi_range
&r);
67
72
int
add_particle
(
const
double
theta,
const
double
phi);
73
75
unsigned
int
theta_range
;
76
78
unsigned
int
phi_range
;
79
81
static
double
theta_min
;
82
static
double
theta_max
;
83
84
private
:
86
inline
unsigned
int
get_theta_cell(
double
theta){
87
return
(
unsigned
int
) (1 << ((int) (32*((theta-
theta_min
)/(
theta_max
-
theta_min
)))));
88
}
89
91
inline
unsigned
int
get_phi_cell(
double
phi){
92
return
(
unsigned
int
) (1 << ((int) (32*phi/
twopi
+16)%32));
93
}
94
};
95
100
bool
is_range_overlap(
const
CSphtheta_phi_range &r1,
const
CSphtheta_phi_range &r2);
101
107
const
CSphtheta_phi_range range_union(
const
CSphtheta_phi_range &r1,
const
CSphtheta_phi_range &r2);
108
109
}
110
111
#endif
siscone_spherical::CSphtheta_phi_range::phi_range
unsigned int phi_range
phi range as a binary coding of covered cells
Definition:
geom_2d.h:78
siscone_spherical::CSphtheta_phi_range::theta_range
unsigned int theta_range
theta range as a binary coding of covered cells
Definition:
geom_2d.h:75
siscone_spherical::CSphtheta_phi_range::theta_min
static double theta_min
extremal value for theta
Definition:
geom_2d.h:81
defines.h
siscone_spherical::CSphtheta_phi_range::operator=
CSphtheta_phi_range & operator=(const CSphtheta_phi_range &r)
assignment of range
Definition:
geom_2d.cpp:116
siscone_spherical::CSphtheta_phi_range::theta_max
static double theta_max
maximal value for theta (set to pi)
Definition:
geom_2d.h:82
twopi
const double twopi
definition of 2*M_PI which is useful a bit everyhere!
Definition:
defines.h:114
siscone_spherical::CSphtheta_phi_range::add_particle
int add_particle(const double theta, const double phi)
add a particle to the range
Definition:
geom_2d.cpp:128
siscone_spherical::CSphtheta_phi_range::CSphtheta_phi_range
CSphtheta_phi_range()
default ctor
Definition:
geom_2d.cpp:54
siscone_spherical::CSphtheta_phi_range
class for holding a covering range in eta-phi
Definition:
geom_2d.h:52
The
SISCone
project has been developed by
Gavin Salam
and
Gregory Soyez
Documentation generated for SISCone by
Doxygen
1.8.17