/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/KalFitWire.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------
00002 // File from KalFit module
00003 //
00004 // Filename : KalFitWires.cc
00005 //------------------------------------------------------------------------
00006 // Description : 
00007 //------------------------------------------------------------------------
00008 // Modif :
00009 //------------------------------------------------------------------------
00010 #ifndef _DEFINE_WIRE_H_
00011 #define _DEFINE_WIRE_H_
00012 
00013 #define WireHit 1
00014 #define WireHitInvalid 2
00015 #define WireHitAppended 4
00016 #define WireHitAppendedorInvalid 6
00017 #define WireNeighbor0 8
00018 #define WireNeighbor1 16
00019 #define WireNeighbor2 32
00020 #define WireNeighbor3 64
00021 #define WireNeighbor4 128
00022 #define WireNeighbor5 256
00023 
00024 #ifndef M_PI
00025 #define M_PI 3.14159265358979323846
00026 #endif
00027 
00028 #include "KalFitAlg/lpav/Lpav.h"
00029 
00030 //#ifndef CLHEP_POINT3D_H
00031 #include "CLHEP/Geometry/Point3D.h"
00032 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00033 typedef HepGeom::Point3D<double> HepPoint3D;
00034 #endif
00035 //#endif
00036 #include "KalFitAlg/KalFitLayer_Mdc.h"
00037 
00038  using CLHEP::HepVector; 
00039  using CLHEP::Hep3Vector;
00040  using CLHEP::HepMatrix;
00041  using CLHEP::HepSymMatrix;
00042 
00043  using namespace CLHEP;
00044 
00046 class KalFitWire{
00047 
00048   enum { NREGION = 3 };
00049   static const double A[NREGION];
00050   enum { NLAYER = 50 };
00051   static const double F[NLAYER];
00052 
00053 public:
00055   KalFitWire(const int localID,
00056            const KalFitLayer_Mdc & layer,
00057            const HepPoint3D & fwd,
00058            const HepPoint3D & bck,
00059            KalFitWire * const vt,
00060            unsigned int geoID,
00061            unsigned int stereo);
00062 
00063   KalFitWire();  
00064 
00066   ~KalFitWire(void);
00067 
00069   unsigned int localId(void) const { return localId_; }
00070   const KalFitLayer_Mdc & layer(void) const { return layer_; }
00071   KalFitWire ** neighborPtr(void) {return neighbor_;}
00072   unsigned int state(void) const { return state_; }
00073   unsigned stateAND(const unsigned mask) const;
00074   unsigned int geoID(void) const { return geoID_; }
00075   unsigned int stereo(void) const { return stereo_; }
00076 
00078   double distance(void) const;
00079 
00081   double distance_z(void) const;
00082 
00083   void state(const unsigned int i) { state_=i; }
00084   void stateOR(const unsigned mask);
00085   void stateXOR(const unsigned mask);
00086   void stateORXOR(const unsigned mask);
00087   void sagcoef(void);
00088   void ddl(const double d) { ddl_ = d;  }  
00089   void ddr(const double d) { ddr_ = d;  }  
00090 
00092   HepPoint3D fwd(void) const { return fwd_; }
00093   HepPoint3D bck(void) const { return bck_; }
00094   HepPoint3D xyPosition(void) const { return xyPosition_; }
00095   double Acoef(void) const {  return A_; }
00096   double lzx(void) const {  return lzx_; }
00097   void chk_left_and_right(void);
00098 
00099   // 
00100   double x(void) const { return x_;}
00101   double y(void) const { return y_;}
00102 
00104   int z(const Lpav & la, double &  z) const;
00105   
00106   double phi(void) const;
00107 
00109   double distance(const double distance);
00110 
00111 private:  
00112   const KalFitWire * left(void) const;
00113   const KalFitWire * right(void) const;
00114   const KalFitWire * innerLeft(KalFitWire * const vtWire) const;
00115   const KalFitWire * innerRight(KalFitWire * const vtWire) const;
00116   const KalFitWire * outerLeft(KalFitWire * const vtWire) const;
00117   const KalFitWire * outerRight(KalFitWire * const vtWire) const;
00118 
00119 private:
00120   int localId_;
00121   double A_;
00122   double lzx_;
00123   HepPoint3D fwd_;
00124   HepPoint3D bck_;
00125   const KalFitLayer_Mdc & layer_;
00126   HepPoint3D xyPosition_;
00127   unsigned int state_;
00128   KalFitWire * neighbor_[6];
00129   unsigned int geoID_;
00130   unsigned int stereo_;
00131   double ddl_, ddr_;
00132   double distance_;
00133   double x_;
00134   double y_;
00135   double dx_;
00136   double dy_;
00137 
00138 };
00139 
00140 #ifdef KalFitWire_NO_INLINE
00141 #define inline
00142 #else
00143 #undef inline
00144 #define KalFitWire_INLINE_DEFINE_HERE
00145 #endif
00146 
00147 #ifdef KalFitWire_INLINE_DEFINE_HERE
00148 inline 
00149 unsigned KalFitWire::stateAND(const unsigned mask) const
00150 {
00151   return state_&mask;
00152 }
00153 
00154 inline
00155 void
00156 KalFitWire::stateOR(const unsigned mask)
00157 {
00158   state_|=mask;
00159 }
00160 
00161 inline
00162 void
00163 KalFitWire::stateXOR(const unsigned mask)
00164 {
00165   state_^=mask;
00166 }
00167 
00168 inline
00169 void
00170 KalFitWire::stateORXOR(const unsigned mask)
00171 {
00172   state_=(state_|mask)^mask;
00173 }
00174 
00175 inline 
00176 double
00177 KalFitWire::phi(void) const
00178 {
00179   return M_PI*(layer_.offset()+2*localId_)/(double)layer_.superLayer().nWire();  
00180 }
00181 
00182 inline
00183 double
00184 KalFitWire::distance(void) const
00185 {
00186   return distance_;
00187 }
00188 
00189 inline
00190 double
00191 KalFitWire::distance_z(void) const
00192 {
00193   return distance_ * fabs(layer_.tanSlant());
00194 }
00195 
00196 inline
00197 double
00198 KalFitWire::distance(const double distance)
00199 {
00200   return distance_ = distance;
00201 }
00202 
00203 inline
00204 int
00205 KalFitWire::z(const Lpav & la, double &  z) const{
00206   HepVector center = la.center();
00207   double rho = la.radius();
00208   double dx2 = center(1) - x_;
00209   double dy2 = center(2) - y_;
00210   double par1 = dx_*dx_ + dy_*dy_;
00211   double par2 = (dx_*dx2 + dy_*dy2)/par1;
00212   double par3 = dx_*dy2 - dy_*dx2;
00213   double par4 = rho*rho*par1 -  par3*par3;
00214   if (par4<0.) return 0;
00215   par4 = sqrt(par4)/par1;
00216   double delta = par2 + par4;
00217   if (delta>=0. && delta<1.){
00218     z = layer_.zb()+delta*(layer_.zf()-layer_.zb());
00219     return 1;
00220   }else{
00221     delta = par2 - par4;
00222     if (delta>=0. && delta<1.){
00223       z = layer_.zb()+delta*(layer_.zf()-layer_.zb());
00224       return 1;
00225     }
00226   }
00227   return 0;
00228 }
00229 
00230 #endif
00231 #undef inline
00232 
00233 #endif /* _DEFINE_WIRE_H_ */

Generated on Tue Nov 29 23:13:23 2016 for BOSS_7.0.2 by  doxygen 1.4.7