Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 ///////////////////////////////////////////////////////////////////////////////
0003 // File: vicinity.h                                                          //
0004 // Description: header file for particle vicinity (Cvicinity class)          //
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_VICINITY_H__
0031 #define __SPH_VICINITY_H__
0032 
0033 #include <siscone/vicinity.h>
0034 #include <vector>
0035 #include <list>
0036 #include "momentum.h"
0037 #include <siscone/defines.h>
0038 #ifdef USE_QUADTREE_FOR_STABILITY_TEST
0039 #include <siscone/quadtree.h>
0040 #endif
0041 
0042 namespace siscone_spherical{
0043 
0044   
0045 /**
0046  * \class CSphvicinity_elm
0047  * \brief element in the vicinity of a parent.
0048  *
0049  * class used to manage one points in the vicinity 
0050  * of a parent point.
0051  */
0052 class CSphvicinity_elm{
0053  public:
0054   /// pointer to the second borderline particle
0055   CSphmomentum *v;
0056 
0057   /// variable to tell if the particle is inside or outside the cone 
0058   siscone::Cvicinity_inclusion *is_inside;   
0059 
0060   // centre variables
0061   CSph3vector centre;         ///< direction of the centre
0062   double angle;            ///< angle with parent
0063   bool side;               ///< true if angle on the positive side, false otherwise
0064   double cocircular_range; ///< amount by which the angle can be varied while
0065                            ///< maintaining this point within co-circularity margin
0066 
0067   /// list of elements co-circular with this one
0068   /// NB: empty list uses less mem than vector
0069   std::list<CSphvicinity_elm * > cocircular;                                          
0070 };
0071 
0072 /// ordering pointers to CSphvicinity_elm
0073 bool ve_less(CSphvicinity_elm *ve1, CSphvicinity_elm *ve2);
0074 
0075 
0076 /**
0077  * \class CSphvicinity
0078  * \brief list of element in the vicinity of a parent.
0079  *
0080  * class used to manage the points which are in the vicinity 
0081  * of a parent point.
0082  */
0083 class CSphvicinity{
0084  public:
0085   /// default constructor
0086   CSphvicinity();
0087 
0088   /// constructor with initialisation (see set_particle_list)
0089   CSphvicinity(std::vector<CSphmomentum> &_particle_list);
0090 
0091   /// default destructor
0092   ~CSphvicinity();
0093 
0094   /**
0095    * set the particle_list
0096    * \param _particle_list   list of particles (type CSphmomentum)
0097    */ 
0098   void set_particle_list(std::vector<CSphmomentum> &_particle_list);
0099 
0100   /**
0101    * build the vicinity list from the list of points.
0102    * \param _parent    reference particle
0103    * \param _VR        vicinity radius
0104    */
0105   void build(CSphmomentum *_parent, double _VR);
0106 
0107   // cone kinematical information
0108   CSphmomentum *parent;      ///< parent vector
0109   double VR;                 ///< radius of the vicinity
0110   double VR2;                ///< squared radius of the vicinity
0111   double cosVR;              ///< cosine of the radius of the vicinity
0112   double R;                  ///< normal radius
0113   double R2;                 ///< squared normal radius
0114   double tan2R;              ///< squared tangent of the normal radius
0115   double D2_R;               ///< euclidian distance (squared) corresp. to the arc R
0116   double inv_R_EPS_COCIRC;   ///< R / EPSILON_COCIRCULAR
0117   double inv_R_2EPS_COCIRC;  ///< R / (2*EPSILON_COCIRCULAR)
0118 
0119   // particle list information
0120   int n_part;                                 ///< number of particles
0121   std::vector<CSphmomentum> plist;            ///< the list of particles
0122   /// the inclusion state of particles
0123   std::vector<siscone::Cvicinity_inclusion> pincluded; 
0124   CSphvicinity_elm *ve_list;                  ///< list of vicinity elements built from particle list (size=2*n)
0125 #ifdef USE_QUADTREE_FOR_STABILITY_TEST
0126   siscone::Cquadtree *quadtree;               ///< quadtree used for final stability tests
0127 #endif
0128 
0129   // vicinity information
0130   std::vector<CSphvicinity_elm*> vicinity;    ///< list of points in parent's vicinity
0131   unsigned int vicinity_size;                 ///< number of elements in vicinity
0132 
0133  protected:
0134   /**
0135    * append a particle to the 'vicinity' list after
0136    * having tested it and computed the angular-ordering quantities
0137    * \param v   vector to test
0138    */
0139   void append_to_vicinity(CSphmomentum *v);
0140 
0141   // internal variables
0142   CSph3vector parent_centre;    ///< parent centre
0143   CSph3vector angular_dir1;     ///< main direction to measure angles
0144   CSph3vector angular_dir2;     ///< second direction to measure angles (sign)
0145 };
0146 
0147 }
0148 
0149 #endif