Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:15:33

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 // For more details, see http://projects.hepforge.org/siscone                //
0007 //                                                                           //
0008 // Copyright (c) 2006 Gavin Salam and Gregory Soyez                          //
0009 //                                                                           //
0010 // This program is free software; you can redistribute it and/or modify      //
0011 // it under the terms of the GNU General Public License as published by      //
0012 // the Free Software Foundation; either version 2 of the License, or         //
0013 // (at your option) any later version.                                       //
0014 //                                                                           //
0015 // This program is distributed in the hope that it will be useful,           //
0016 // but WITHOUT ANY WARRANTY; without even the implied warranty of            //
0017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             //
0018 // GNU General Public License for more details.                              //
0019 //                                                                           //
0020 // You should have received a copy of the GNU General Public License         //
0021 // along with this program; if not, write to the Free Software               //
0022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
0023 //                                                                           //
0024 // $Revision::                                                              $//
0025 // $Date::                                                                  $//
0026 ///////////////////////////////////////////////////////////////////////////////
0027 
0028 #ifndef __VICINITY_H__
0029 #define __VICINITY_H__
0030 
0031 #include <vector>
0032 #include <list>
0033 #include "momentum.h"
0034 #include "defines.h"
0035 #include "quadtree.h"
0036 
0037 namespace siscone{
0038 
0039   
0040 
0041 /**
0042  * \class Cvicinity_inclusion
0043  * \brief a class to keep track of inclusion status in cone and in cocircular region
0044  *        while using minimal resources
0045  */
0046 class Cvicinity_inclusion {
0047 public:
0048   /// default ctor
0049   Cvicinity_inclusion() : cone(false), cocirc(false) {}
0050 
0051   bool cone;    ///< flag for particle inclusion in the cone
0052   bool cocirc;  ///< flag for particle inclusion in the border
0053 };
0054 
0055 
0056 /**
0057  * \class Cvicinity_elm
0058  * \brief element in the vicinity of a parent.
0059  *
0060  * class used to manage one points in the vicinity 
0061  * of a parent point.
0062  */
0063 class Cvicinity_elm{
0064  public:
0065   /// pointer to the second borderline particle
0066   Cmomentum *v;
0067 
0068   /// variable to tell if the particle is inside or outside the cone 
0069   Cvicinity_inclusion *is_inside;   
0070 
0071   // centre variables
0072   double eta;              ///< eta coordinate of the center
0073   double phi;              ///< phi coordinate of the center
0074   double angle;            ///< angle with parent
0075   bool side;               ///< true if angle on the positive side, false otherwise
0076   double cocircular_range; ///< amount by which the angle can be varied while
0077                            ///< maintaining this point within co-circularity margin
0078 
0079   /// list of elements co-circular with this one
0080   /// NB: empty list uses less mem than vector
0081   std::list<Cvicinity_elm * > cocircular;                                          
0082 };
0083 
0084 /// ordering pointers to Cvicinity_elm
0085 bool ve_less(Cvicinity_elm *ve1, Cvicinity_elm *ve2);
0086 
0087 
0088 /**
0089  * \class Cvicinity
0090  * \brief list of element in the vicinity of a parent.
0091  *
0092  * class used to manage the points which are in the vicinity 
0093  * of a parent point.
0094  */
0095 class Cvicinity{
0096  public:
0097   /// default constructor
0098   Cvicinity();
0099 
0100   /// constructor with initialisation (see set_particle_list)
0101   Cvicinity(std::vector<Cmomentum> &_particle_list);
0102 
0103   /// default destructor
0104   ~Cvicinity();
0105 
0106   /**
0107    * set the particle_list
0108    * \param _particle_list   list of particles (type Cmomentum)
0109    */ 
0110   void set_particle_list(std::vector<Cmomentum> &_particle_list);
0111 
0112   /**
0113    * build the vicinity list from the list of points.
0114    * \param _parent    reference particle
0115    * \param _VR        vicinity radius
0116    */
0117   void build(Cmomentum *_parent, double _VR);
0118 
0119   // cone kinematical information
0120   Cmomentum *parent;         ///< parent vector
0121   double VR;                 ///< radius of the vicinity
0122   double VR2;                ///< squared radius of the vicinity
0123   double R;                  ///< normal radius
0124   double R2;                 ///< squared normal radius
0125   double inv_R_EPS_COCIRC;   ///< R / EPSILON_COCIRCULAR
0126   double inv_R_2EPS_COCIRC;  ///< R / (2*EPSILON_COCIRCULAR)
0127 
0128   // particle list information
0129   int n_part;                                 ///< number of particles
0130   std::vector<Cmomentum> plist;               ///< the list of particles
0131   std::vector<Cvicinity_inclusion> pincluded; ///< the inclusion state of particles
0132   Cvicinity_elm *ve_list;                     ///< list of vicinity elements built from particle list (size=2*n)
0133 #ifdef USE_QUADTREE_FOR_STABILITY_TEST
0134   Cquadtree *quadtree;                        ///< quadtree used for final stability tests
0135 #endif
0136 
0137   // vicinity information
0138   std::vector<Cvicinity_elm*> vicinity;       ///< list of points in parent's vicinity
0139   unsigned int vicinity_size;                 ///< number of elements in vicinity
0140 
0141  protected:
0142   /**
0143    * append a particle to the 'vicinity' list after
0144    * having tested it and computed the angular-ordering quantities
0145    * \param v   vector to test
0146    */
0147   void append_to_vicinity(Cmomentum *v);
0148 
0149   // internal variables
0150   double pcx;    ///< parent centre (eta)
0151   double pcy;    ///< parent centre (phi)
0152 };
0153 
0154 }
0155 
0156 #endif