Fork me on GitHub

source: git/external/fastjet/plugins/SISCone/quadtree.h@ ba65969

ImprovedOutputFile Timing dual_readout llp 3.3.3pre14
Last change on this file since ba65969 was 35cdc46, checked in by Pavel Demin <demin@…>, 10 years ago

upgrade FastJet to version 3.1.0-beta.1, upgrade Nsubjettiness to version 2.1.0, add SoftKiller version 1.0.0

  • Property mode set to 100644
File size: 5.0 KB
Line 
1// -*- C++ -*-
2///////////////////////////////////////////////////////////////////////////////
3// File: quadtree.h //
4// Description: header file for quadtree management (Cquadtree class) //
5// This file is part of the SISCone project. //
6// For more details, see http://projects.hepforge.org/siscone //
7// //
8// Copyright (c) 2006 Gavin Salam and Gregory Soyez //
9// //
10// This program is free software; you can redistribute it and/or modify //
11// it under the terms of the GNU General Public License as published by //
12// the Free Software Foundation; either version 2 of the License, or //
13// (at your option) any later version. //
14// //
15// This program is distributed in the hope that it will be useful, //
16// but WITHOUT ANY WARRANTY; without even the implied warranty of //
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
18// GNU General Public License for more details. //
19// //
20// You should have received a copy of the GNU General Public License //
21// along with this program; if not, write to the Free Software //
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
23// //
24// $Revision:: 123 $//
25// $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $//
26///////////////////////////////////////////////////////////////////////////////
27
28#ifndef __QUADTREE_H__
29#define __QUADTREE_H__
30
31#include "momentum.h"
32#include <stdio.h>
33
34namespace siscone{
35
36/**
37 * \class Cquadtree
38 * \brief Implementation of a 2D quadtree.
39 *
40 * This class implements the traditional two-dimensional quadtree.
41 * The elements at each node are of 'Cmomentum' type.
42 */
43class Cquadtree{
44 public:
45 /// default ctor
46 Cquadtree();
47
48 /// ctor with initialisation (see init for details)
49 Cquadtree(double _x, double _y, double _half_size_x, double _half_size_y);
50
51 /// default destructor
52 /// at destruction, everything is destroyed except
53 /// physical values at the leaves
54 ~Cquadtree();
55
56 /**
57 * init the tree.
58 * By initializing the tree, we mean setting the cell parameters
59 * and preparing the object to act as a seed for a new tree.
60 * \param _x x-position of the center
61 * \param _y y-position of the center
62 * \param _half_size_x x-size of the cell
63 * \param _half_size_y y-size of the cell
64 * \return 0 on success, 1 on error. Note that if the cell or its
65 * parent is already filled, we return an error.
66 */
67 int init(double _x, double _y, double _half_size_x, double _half_size_y);
68
69 /**
70 * adding a particle to the tree.
71 * This method adds one vector to the quadtree structure which
72 * is updated consequently.
73 * \param v_add vector to add
74 * \return 0 on success 1 on error
75 */
76 int add(Cmomentum *v_add);
77
78 /**
79 * circle intersection.
80 * computes the intersection with a circle of given centre and radius.
81 * The output takes the form of a quadtree with all squares included
82 * in the circle.
83 * \param cx circle centre x coordinate
84 * \param cy circle centre y coordinate
85 * \param cR2 circle radius SQUARED
86 * \return the checksum for that intersection
87 */
88 Creference circle_intersect(double cx, double cy, double cR2);
89
90 /**
91 * output a data file for drawing the grid.
92 * This can be used to output a data file containing all the
93 * grid subdivisions. The file contents is as follows:
94 * first and second columns give center of the cell, the third
95 * gives the size.
96 * \param flux opened stream to write to
97 * \return 0 on success, 1 on error
98 */
99 int save(FILE *flux);
100
101 /**
102 * output a data file for drawing the tree leaves.
103 * This can be used to output a data file containing all the
104 * tree leaves. The file contents is as follows:
105 * first and second columns give center of the cell, the third
106 * gives the size.
107 * \param flux opened stream to write to
108 * \return 0 on success, 1 on error
109 */
110 int save_leaves(FILE *flux);
111
112 double centre_x; ///< x-position of the centre of the cell
113 double centre_y; ///< y-position of the centre of the cell
114 double half_size_x; ///< HALF size of the cell
115 double half_size_y; ///< HALF size of the cell
116
117 Cmomentum *v; ///< physical contents
118
119 Cquadtree* children[2][2]; ///< sub-cells ( 0,1->left-right; 0,1->bottom,top)
120 bool has_child; ///< true if not a leaf
121};
122
123}
124#endif
Note: See TracBrowser for help on using the repository browser.