Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:55:44

0001 // -*- C++ -*-
0002 ///////////////////////////////////////////////////////////////////////////////
0003 // File: hash.h                                                              //
0004 // Description: header file for classes hash_element and hash_cones          //
0005 // This file is part of the SISCone project.                                 //
0006 // WARNING: this is not the main SISCone trunk but                           //
0007 //          an adaptation to spherical coordinates                           //
0008 // For more details, see http://projects.hepforge.org/siscone                //
0009 //                                                                           //
0010 // Copyright (c) 2006-2008 Gavin Salam and Gregory Soyez                          //
0011 //                                                                           //
0012 // This program is free software; you can redistribute it and/or modify      //
0013 // it under the terms of the GNU General Public License as published by      //
0014 // the Free Software Foundation; either version 2 of the License, or         //
0015 // (at your option) any later version.                                       //
0016 //                                                                           //
0017 // This program is distributed in the hope that it will be useful,           //
0018 // but WITHOUT ANY WARRANTY; without even the implied warranty of            //
0019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             //
0020 // GNU General Public License for more details.                              //
0021 //                                                                           //
0022 // You should have received a copy of the GNU General Public License         //
0023 // along with this program; if not, write to the Free Software               //
0024 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
0025 //                                                                           //
0026 // $Revision::                                                              $//
0027 // $Date::                                                                  $//
0028 ///////////////////////////////////////////////////////////////////////////////
0029 
0030 #ifndef __SPH_HASH_H__
0031 #define __SPH_HASH_H__
0032 
0033 #include "momentum.h"
0034 
0035 namespace siscone_spherical{
0036 
0037 /**
0038  * \class sph_hash_element
0039  * information on store cones candidates.
0040  *
0041  * We store in this class the information used to count all 
0042  * protocones in a first pass. This first pass only count
0043  * cones with different references and test their stbility
0044  * with the parent-child particles (border particles).
0045  */
0046 class sph_hash_element{
0047  public:
0048   CSph3vector centre;  ///< centre of the cone
0049   bool is_stable;      ///< true if stable w.r.t. "border particles"
0050 
0051   sph_hash_element *next;  ///< pointer to the next element
0052 };
0053 
0054 /**
0055  * \class sph_hash_cones
0056  * list of cones candidates.
0057  *
0058  * We store in this class all the hash_elements and give
0059  * functions to manipulate them.
0060  */
0061 class sph_hash_cones{
0062  public:
0063   /// \param _Np      number of particles
0064   /// \param _radius  cone radius
0065   sph_hash_cones(int _Np, double _radius);
0066 
0067   /// destructor
0068   ~sph_hash_cones();
0069 
0070   /**
0071    * insert a new candidate into the hash.
0072    * \param v       4-momentum of te cone to add
0073    * \param parent  parent particle defining the cone
0074    * \param child   child particle defining the cone
0075    * \param p_io    whether the parent has to belong to the cone or not
0076    * \param c_io    whether the child has to belong to the cone or not
0077    * \return 0 on success, 1 on error
0078    */
0079   int insert(CSphmomentum *v, CSphmomentum *parent, CSphmomentum *child, bool p_io, bool c_io);
0080 
0081   /**
0082    * insert a new candidate into the hash.
0083    * \param v       4-momentum of te cone to add
0084    * Note, in this case, we assume stability. We also assume
0085    * that eta and phi are computed for v
0086    * \return 0 on success, 1 on error
0087    */
0088   int insert(CSphmomentum *v);
0089 
0090   /// the cone data itself
0091   sph_hash_element **hash_array;
0092 
0093   /// number of elements
0094   int n_cones;
0095 
0096   /// number of occupied cells
0097 #ifdef DEBUG_STABLE_CONES
0098   int n_occupied_cells;
0099 #endif
0100 
0101   /// number of cells-1
0102   int mask;
0103 
0104   /// circle radius (squared)
0105   /// NOTE: need to be set before any call to 'insert'
0106   double R2;
0107 
0108   /// its squreed tangent
0109   double tan2R;
0110 };
0111 
0112 }
0113 #endif