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

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------
00002 // File from KalFit module
00003 //
00004 // Filename : KalFitWire.cc
00005 //------------------------------------------------------------------------
00006 // Description : Description of a Mdc Wire
00007 //------------------------------------------------------------------------
00008 // Modif :
00009 //------------------------------------------------------------------------
00010 #include "CLHEP/Geometry/Point3D.h"
00011 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00012 typedef HepGeom::Point3D<double> HepPoint3D;
00013 #endif
00014 #include "KalFitAlg/KalFitWire.h"
00015 #include "KalFitAlg/KalFitLayer_Mdc.h"
00016 #include "KalFitAlg/KalFitSuper_Mdc.h"
00017 
00018 const double KalFitWire::A[NREGION] = { 8.5265E-7, 
00019                                       1.1368E-6, 
00020                                       1.2402E-6};
00021 const double KalFitWire::F[NLAYER] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00022                                     47.2,46.6,47.0,46,45,46.7,46,45,44.6,
00023                                     45.9,45.9,45.3,44.5,44.0,46.0,45.6,
00024                                     44.2,43.6,44.0,43.5,43.1,42.9,42.4,
00025                                     42.7,42.5,42.2,41,42,42,42,41.4,42.5,
00026                                     43.0,43.2,43.4,43.4};
00027 const double L49_2 = 220.4*220.4;
00028 
00029 // constructor
00030 KalFitWire::KalFitWire(const int localID,
00031                    const KalFitLayer_Mdc & layer,
00032                    const HepPoint3D & fwd,
00033                    const HepPoint3D & bck,
00034                    KalFitWire * const vt,
00035                    unsigned int geoID,
00036                    unsigned int stereo):
00037   localId_(localID), fwd_(fwd), bck_(bck), layer_(layer), 
00038   state_(WireHitInvalid), geoID_(geoID), stereo_(stereo), 
00039   ddl_(0), ddr_(0), distance_(0) {
00040 
00041   int layer_ID = layer_.layerId();
00042   xyPosition_ = 0.5 * (fwd_+bck_);
00043   if (!stereo_){
00044     dx_ = 0;
00045     dy_ = 0;
00046     x_ = xyPosition_.x();
00047     y_ = xyPosition_.y();
00048   } else {
00049     dx_ = (double)fwd_.x() - (double)bck_.x();
00050     dy_ = (double)fwd_.y() - (double)bck_.y();
00051     x_ = bck_.x();
00052     y_ = bck_.y();
00053   }
00054   // Wire sag coeff
00055   Hep3Vector wire_;
00056   wire_ = (CLHEP::Hep3Vector)fwd - (CLHEP::Hep3Vector)bck;
00057   lzx_ = sqrt(wire_.z()*wire_.z()+wire_.x()*wire_.x());
00058 
00059   // problem with layer_ and its id inside sagcoef ?!!
00060   //  sagcoef();
00061   if (layer_ID < 3)
00062     A_ = A[0];
00063   else {
00064     if (layer_ID< 14)
00065       A_ = A[1];
00066     else if (layer_ID < 50){
00067       double f_current(F[layer_ID]);
00068       double l(wire_.mag());
00069       A_ = A[2]*F[49]*F[49]*L49_2/(f_current*f_current*l*l);
00070     } else
00071       std::cout << "*** PROBLEM WIRE !!!!! " << std::endl;
00072   }
00073 
00074   // Neighbor :
00075   neighbor_[0] = (KalFitWire *) innerLeft(vt);
00076   neighbor_[1] = (KalFitWire *) innerRight(vt);
00077 
00078   neighbor_[2] = (KalFitWire *) left();
00079   neighbor_[3] = (KalFitWire *) right();
00080 
00081   neighbor_[4] = (KalFitWire *) outerLeft(vt);
00082   neighbor_[5] = (KalFitWire *) outerRight(vt);
00083 
00084 }
00085 
00086 KalFitWire::KalFitWire():
00087   localId_(0), fwd_(0,0,0), bck_(0,0,0), layer_(*(KalFitLayer_Mdc *)NULL), 
00088   state_(WireHitInvalid), x_(0), y_(0), dx_(0), dy_(0)
00089 {
00090   // Neighbor :
00091   neighbor_[0] = NULL;
00092   neighbor_[1] = NULL;
00093   neighbor_[2] = NULL;
00094   neighbor_[3] = NULL;
00095   neighbor_[4] = NULL;
00096   neighbor_[5] = NULL;
00097 }
00098 
00099 // destructor
00100 KalFitWire::~KalFitWire(void){}
00101 
00102 // wire sag coefficient determination :
00103 void KalFitWire::sagcoef(void){
00104 
00105   Hep3Vector wire_;
00106   wire_ =(CLHEP::Hep3Vector)fwd_ - (CLHEP::Hep3Vector)bck_;
00107   int layer_ID = layer_.layerId();
00108 
00109   if (layer_ID < 3){
00110     A_ = A[0];
00111   } else {
00112     if (layer_ID< 14){
00113       A_ = A[1];
00114     } else if (layer_ID < 50){
00115       double f_current(F[layer_ID]);
00116       double l(wire_.mag());
00117       A_ = A[2]*F[49]*F[49]*L49_2/(f_current*f_current*l*l);
00118     } else {
00119       std::cout << "*** PROBLEM WIRE !!!!! " << std::endl;
00120     }
00121   }
00122 }
00123 
00124 const KalFitWire * KalFitWire::left(void) const{
00125   const KalFitWire * tmp = this;
00126   if (!localId_) tmp += layer_.superLayer().nWire();
00127   return --tmp;
00128 }
00129 
00130 const KalFitWire * KalFitWire::right(void) const{
00131   const KalFitWire * tmp = this;
00132   if (localId_==layer_.superLayer().localMaxId()){
00133     tmp -= layer_.superLayer().nWire();
00134   }
00135   return ++tmp;
00136 }
00137 
00138 const KalFitWire * KalFitWire::innerLeft(KalFitWire * const vtWire) const{
00139 
00140   if (!layer_.localLayerId()) return vtWire;
00141   const KalFitWire * tmp = this;
00142   if (layer_.offset()&1){
00143     tmp -= layer_.superLayer().nWire();
00144   }else{
00145     if (localId_) tmp -= layer_.superLayer().nWire();
00146     --tmp;
00147   }
00148   return tmp; 
00149 }
00150 
00151 const KalFitWire * KalFitWire::innerRight(KalFitWire * const vtWire) const{
00152    if (!layer_.localLayerId()) return vtWire;
00153   const KalFitWire * tmp = this;
00154   if (layer_.offset()&1){
00155     if (localId_==layer_.superLayer().localMaxId()){
00156       tmp -= layer_.superLayer().nWire();
00157     }
00158     tmp -= (layer_.superLayer().nWire()-1);
00159   }else{
00160     tmp -= layer_.superLayer().nWire();
00161   }
00162   return tmp; 
00163 }
00164 
00165 const KalFitWire * KalFitWire::outerLeft(KalFitWire * const vtWire) const{
00166   if (layer_.localLayerId()==layer_.superLayer().layerMaxId()) return vtWire;
00167   const KalFitWire * tmp = this;
00168   if (layer_.offset()&1){
00169     tmp += layer_.superLayer().nWire();
00170   }else{
00171     if (!localId_) tmp += layer_.superLayer().nWire();
00172     tmp += (layer_.superLayer().nWire()-1);
00173   }
00174   return tmp;  
00175 }
00176 
00177 const KalFitWire * KalFitWire::outerRight(KalFitWire * const vtWire) const{
00178   if (layer_.localLayerId()==layer_.superLayer().layerMaxId()) return vtWire;
00179   const KalFitWire * tmp = this;
00180   if (layer_.offset()&1){
00181     if (localId_^layer_.superLayer().localMaxId()){
00182       tmp += layer_.superLayer().nWire();
00183     }
00184     tmp++;
00185   }else{
00186     tmp += layer_.superLayer().nWire();
00187   }
00188   return tmp;
00189 }
00190 
00191 // Check left and right side to see if there is hit valid
00192 void KalFitWire::chk_left_and_right(void) {
00193   if (((**(neighbor_+2)).state_&WireHit)&&
00194       ((**(neighbor_+3)).state_&WireHit)){
00195     state_ |= WireHitInvalid;
00196     (**(neighbor_+2)).state_ |= WireHitInvalid;
00197     (**(neighbor_+3)).state_ |= WireHitInvalid;
00198   }
00199 }
00200 
00201  

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