/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/TrkReco/TrkReco-00-08-59-patch4-slc6tag/TrkReco/TMLink.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // $Id: TMLink.h,v 1.17 2012/05/28 05:16:29 maoh Exp $
00003 //-----------------------------------------------------------------------------
00004 // Filename : TMLink.h
00005 // Section  : Tracking
00006 // Owner    : Yoshi Iwasaki
00007 // Email    : yoshihito.iwasaki@kek.jp
00008 //-----------------------------------------------------------------------------
00009 // Description : A class to relate TMDCWireHit and TTrack objects.
00010 //               See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
00011 //-----------------------------------------------------------------------------
00012 
00013 #ifndef TMLink_FLAG_
00014 #define TMLink_FLAG_
00015 
00016 #include <iostream>
00017 
00018 #ifdef TRKRECO_DEBUG_DETAIL
00019 #ifndef TRKRECO_DEBUG
00020 #define TRKRECO_DEBUG
00021 #endif
00022 #endif
00023 #define HEP_SHORT_NAMES
00024 #include <string>
00025 #ifndef CLHEP_POINT3D_H
00026 #include "CLHEP/Geometry/Point3D.h"
00027 #endif
00028 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00029     typedef HepGeom::Point3D<double> HepPoint3D;
00030 #endif
00031 
00032 #include "CLHEP/Alist/ConstAList.h"
00033 #include "TrkReco/TMDCWire.h"
00034 #include "TrkReco/TMDCWireHit.h"
00035 //#include "TrkReco/TMDCWire.h"
00036 //#include "TrkReco/TMDCClust.h"
00037 
00038 class TTrackHEP;
00039 
00040 class TTrack;
00041 
00043 class TMLink {
00044 
00045   public:
00047 /*    TMLink(TTrack * track = 0,
00048           const TMDCWireHit * hit = 0,
00049           const HepPoint3D & position = HepPoint3D());*/
00050     TMLink(TTrack * track = 0,
00051           const TMDCWireHit * hit = 0,
00052           const HepPoint3D & position = HepPoint3D(),
00053           const HepPoint3D & positionD = HepPoint3D(),
00054           const double = 0.0);
00055 
00057     TMLink(const TMLink &);
00058 
00060     virtual ~TMLink();
00061 
00062   public:// Selectors
00064     void dump(const std::string & message = std::string(""),
00065               const std::string & prefix = std::string("")) const;
00066 
00068     const TMDCWireHit * hit(void) const;
00069 
00071     const TMDCWire * const wire(void) const;
00072 
00074     TTrack * track(void) const;
00075 
00077     double pull(void) const;
00078 
00080     const HepPoint3D & xyPosition(void) const;
00081 
00083     const HepPoint3D & positionOnWire(void) const;
00084 
00086     const HepPoint3D & positionOnTrack(void) const;
00087 
00089     double dPhi(void) const;
00090 
00092     unsigned leftRight(void) const;
00093 
00095     int zStatus(void) const;
00096 
00098     int zPair(void) const;
00099 
00101     const HepPoint3D & position(void) const;
00102     const HepPoint3D & positionD(void) const;
00103 
00104   
00106     double distance(void) const;
00107      
00108     double distance(double);
00109 
00110     double distancenew(void)const;
00111 
00113     TMLink * neighbor(unsigned int) const;
00114 
00116     TMLink * link(void) const;
00117 
00118 // S.Suzuki added
00120     //    int usecathode(void) const;
00121 
00123     //    TMDCClust * getmclust(void) const;
00124 // end S.Suzuki
00125 
00127     const HepPoint3D & arcZ(const unsigned = 0) const;
00128 
00129   public:// tmp
00130 //    const HepPoint3D & conf(void) const;
00131     const HepPoint3D & conf(const HepPoint3D & conf);
00132 
00133   public:// Modifiers
00135     void update(const HepPoint3D & onTrack,
00136                 const HepPoint3D & onWire,
00137                 unsigned leftRight,
00138                 double pull);
00139 
00141     const TMDCWireHit * hit(const TMDCWireHit *);
00142 
00144     TTrack * track(TTrack *);
00145 
00147     const HepPoint3D & positionOnWire(const HepPoint3D &);
00148     const HepPoint3D & positionOnWire(double p[3]);
00149 
00151     const HepPoint3D & positionOnTrack(const HepPoint3D &);
00152     const HepPoint3D & positionOnTrack(double p[3]);
00153 
00155     double dPhi(double);
00156 
00158     const HepPoint3D & position(const HepPoint3D &);
00159     const HepPoint3D & positionD(const HepPoint3D &);
00160 
00162     void neighbor(unsigned int, TMLink *);
00163 
00165     TMLink * link(TMLink *);
00166 
00168     unsigned leftRight(unsigned);
00169 
00171     double pull(double);
00172 
00174     int zStatus(int);
00175 
00177     int zPair(int);
00178 
00179 // S.Suzuki added
00180 
00182     //    void setusecathode(int);
00183 
00185     //    void setmclust(TMDCClust *);
00186 
00188     //    void setZphiBeforeCathode(float);
00189 
00190 // end S.Suzuki
00191 
00193     const HepPoint3D & arcZ(const HepPoint3D &, const unsigned = 0);
00194     const unsigned fit2D(const unsigned &);
00195     unsigned fit2D(void);
00196 
00197   public:// Drift distance
00199     float drift(void) const;
00200     float drift(unsigned) const;
00201     float drift(float, unsigned);
00202     double cDrift(void) const;
00203     double cDrift(unsigned) const;
00204     double cDrift(double, unsigned);
00205 
00207     float dDrift(void) const;
00208     float dDrift(unsigned) const;
00209     float dDrift(float, unsigned);
00210 
00212     unsigned tsfTag(void) const;
00213     unsigned tsfTag(unsigned);
00214 
00216     double tof(void) const;
00217     double tof(double);
00218 
00220     void setDriftTime(double);
00221     double getDriftTime(void);
00222 
00224    double DriftTime(double,double) const;
00225   private:
00226     TTrack * _track;
00227     const TMDCWireHit * _hit;
00228     HepPoint3D _onTrack;
00229     HepPoint3D _onWire;
00230     HepPoint3D _position;
00231     HepPoint3D _positionD;
00232     double _dPhi;
00233     unsigned _leftRight;
00234     float _drift[2];
00235     float _dDrift[2];
00236 
00237     double _cDrift[2];
00238 
00239     int _zStatus;
00240     int _zPair;
00241     double _pull;
00242     double _distance;
00243     TMLink * _neighbor[6];
00244     TMLink * _link;
00245 
00246     //...tmp...
00247     HepPoint3D _conf;
00248 
00249     double _tof;
00250     double _drifttime;
00251 
00252    //-- S. Suzuki added -------
00253     //    int _usecathode;
00254     //    float _ZphiBeforeCathode;
00255     //    TMDCClust * _mclust;
00256     //-- S. Suzuki added end ---
00257 
00258     HepPoint3D _arcZ[4];
00259     unsigned _fit2D;
00260     unsigned _tsfTag;
00261 };
00262 
00263 // Utility functions
00264 
00266 const TTrackHEP &
00267 Links2HEP(const AList<TMLink> & links);
00268 
00270 unsigned
00271 NSuperLayers(const AList<TMLink> & links);
00272 
00273 unsigned
00274 NSuperLayers(const AList<TMLink> & links, unsigned minNHits);
00275 
00276 unsigned
00277 NMissingAxialSuperLayers(const AList<TMLink> & links);
00278 
00280 unsigned
00281 NLayers(const AList<TMLink> & links);
00282 
00284 void
00285 NHits(const AList<TMLink> & links, unsigned nHits[50]);
00286 
00288 void
00289 NHitsSuperLayer(const AList<TMLink> & links, unsigned nHits[11]);
00290 
00292 AList<TMLink>
00293 AxialHits(const AList<TMLink> & links);
00294 
00296 AList<TMLink>
00297 StereoHits(const AList<TMLink> & links);
00298 
00300 unsigned
00301 NAxialHits(const AList<TMLink> & links);
00302 
00304 unsigned
00305 NStereoHits(const AList<TMLink> & links);
00306 
00308 unsigned
00309 Width(const AList<TMLink> &);
00310 
00312 AList<TMLink>
00313 Edges(const AList<TMLink> &);
00314 
00316 AList<TMLink>
00317 SameLayer(const AList<TMLink> & list, const TMLink & a);
00318 AList<TMLink>
00319 SameLayer(const AList<TMLink> & list, unsigned id);
00320 
00322 AList<TMLink>
00323 SameSuperLayer(const AList<TMLink> & list, const TMLink & a);
00324 AList<TMLink> 
00325 SameSuperLayer(const AList<TMLink> & list, unsigned id);
00326 
00328 unsigned
00329 SuperLayer(const AList<TMLink> & list);
00330 unsigned
00331 SuperLayer(const AList<TMLink> & list, unsigned minNHits);
00332 
00334 TMLink *
00335 InnerMost(const AList<TMLink> & links);
00336 TMLink *
00337 OuterMost(const AList<TMLink> & links);
00338 
00340 AList<TMLink>
00341 InOut(const AList<TMLink> &);
00342 
00343 template <class T> class CAList;
00344 
00346 void
00347 SeparateCores(const AList<TMLink> & input,
00348               AList<TMLink> & cores,
00349               AList<TMLink> & nonCores);
00350 
00351 AList<TMLink>
00352 Cores(const AList<TMLink> & input);
00353 
00355 void
00356 Dump(const CAList<TMLink> & links,
00357      const std::string & message = std::string(""),
00358      const std::string & prefix = std::string(""));
00359 void
00360 Dump(const TMLink & link,
00361      const std::string & message = std::string(""),
00362      const std::string & prefix = std::string(""));
00363 
00365 #if defined(__GNUG__)
00366 int
00367 SortByWireId(const TMLink ** a, const TMLink ** b);
00368 int
00369 SortByX(const TMLink ** a, const TMLink ** b);
00370 #else
00371 extern "C" int
00372 SortByWireId(const void* a, const void* b);
00373 extern "C" int
00374 SortByX(const void* a, const void* b);
00375 #endif
00376 
00377 //-----------------------------------------------------------------------------
00378 
00379 #ifdef TMLink_NO_INLINE
00380 #define inline
00381 #else
00382 #undef inline
00383 #define TMLink_INLINE_DEFINE_HERE
00384 #endif
00385 
00386 #ifdef TMLink_INLINE_DEFINE_HERE
00387 
00388 inline
00389 const TMDCWireHit *
00390 TMLink::hit(void) const {
00391     return _hit;
00392 }
00393 
00394 inline
00395 TTrack *
00396 TMLink::track(void) const {
00397     return _track;
00398 }
00399 
00400 inline
00401 const TMDCWireHit *
00402 TMLink::hit(const TMDCWireHit * a) {
00403     return _hit = a;
00404 }
00405 
00406 inline
00407 TTrack *
00408 TMLink::track(TTrack * a) {
00409     return _track = a;
00410 }
00411 
00412 inline
00413 void
00414 TMLink::update(const HepPoint3D & onTrack,
00415               const HepPoint3D & onWire,
00416               unsigned leftRight,
00417               double pull) {
00418     _onTrack = onTrack;
00419     _onWire = onWire;
00420     _leftRight = leftRight;
00421     _pull = pull;
00422 }
00423 
00424 inline
00425 double
00426 TMLink::pull(void) const {
00427     return _pull;
00428 }
00429 
00430 inline
00431 double
00432 TMLink::pull(double a) {
00433     return _pull = a;
00434 }
00435 
00436 inline
00437 const HepPoint3D &
00438 TMLink::positionOnWire(void) const {
00439     return _onWire;
00440 }
00441 
00442 inline
00443 const HepPoint3D &
00444 TMLink::positionOnTrack(void) const {
00445     return _onTrack;
00446 }
00447 
00448 inline
00449 const HepPoint3D &
00450 TMLink::positionOnWire(const HepPoint3D & a) {
00451     return _onWire = a;
00452 }
00453 
00454 inline
00455 const HepPoint3D &
00456 TMLink::positionOnWire(double p[3]) {
00457     _onWire.setX(p[0]);
00458     _onWire.setY(p[1]);
00459     _onWire.setZ(p[2]);
00460     return _onWire;
00461 }
00462 
00463 inline
00464 const HepPoint3D &
00465 TMLink::positionOnTrack(const HepPoint3D & a) {
00466     return _onTrack = a;
00467 }
00468 
00469 inline
00470 const HepPoint3D &
00471 TMLink::positionOnTrack(double p[3]) {
00472     _onTrack.setX(p[0]);
00473     _onTrack.setY(p[1]);
00474     _onTrack.setZ(p[2]);
00475     return _onTrack;
00476 }
00477 
00478 inline
00479 unsigned
00480 TMLink::leftRight(void) const {
00481     return _leftRight;
00482 }
00483 
00484 inline
00485 unsigned
00486 TMLink::leftRight(unsigned a) {
00487     return _leftRight = a;
00488 }
00489 
00490 inline
00491 double
00492 TMLink::dPhi(void) const {
00493     return _dPhi;
00494 }
00495 
00496 inline
00497 double
00498 TMLink::dPhi(double a) {
00499     return _dPhi = a;
00500 }
00501 
00502 inline
00503 const HepPoint3D &
00504 TMLink::position(void) const {
00505     return _position;
00506 }
00507 
00508 inline
00509 const HepPoint3D &
00510 TMLink::position(const HepPoint3D & a) {
00511     return _position = a;
00512 }
00513 
00514 inline
00515 const HepPoint3D &
00516 TMLink::positionD(void) const {
00517     return _positionD;
00518 }
00519                                                                                                                              
00520 inline
00521 const HepPoint3D &
00522 TMLink::positionD(const HepPoint3D & a) {
00523     return _positionD = a;
00524 }
00525 
00526 // inline
00527 // const HepPoint3D &
00528 // TMLink::conf(void) const {
00529 //     return _conf;
00530 // }
00531 
00532 inline
00533 const HepPoint3D &
00534 TMLink::conf(const HepPoint3D & a) {
00535     return _conf = a;
00536 }
00537 
00538 inline
00539 void 
00540 TMLink::neighbor(unsigned n, TMLink * neighbor){
00541   if(n <= 6)
00542     _neighbor[n] = neighbor;
00543 }
00544 
00545 inline
00546 TMLink *
00547 TMLink::neighbor(unsigned n) const {
00548   if(n <= 6)
00549     return _neighbor[n];
00550   return NULL;
00551 }
00552 
00553 inline
00554 TMLink *
00555 TMLink::link(void) const {
00556     return _link;
00557 }
00558 
00559 inline
00560 TMLink *
00561 TMLink::link(TMLink * a) {
00562     return _link = a;
00563 }
00564 
00565 inline
00566 double
00567 TMLink::distance(void) const {
00568 
00569     return (_onTrack-_onWire).mag() ;
00570 }
00571 inline
00572 double
00573 TMLink::distancenew(void) const {
00574 
00575 
00576         return _distance;
00577 
00578 }
00579 
00580 inline
00581 double
00582 TMLink::distance(double a)  {
00583 
00584         _distance=a ;
00585 }
00586 //inline
00587 //const TMDCWire * const
00588 //TMLink::wire(void) const {
00589 //    if (_hit) return _hit->wire();
00590 //    return NULL;
00591 //}
00592 
00593 //zangsl 040518 move the following two fun. to TMLink.cxx file
00594 /*
00595 inline
00596 const TMDCWire * const
00597 TMLink::wire(void) const {
00598     if (_hit) return _hit->wire();
00599     return NULL;
00600 }
00601 
00602 inline
00603 const HepPoint3D &
00604 TMLink::xyPosition(void) const {
00605     return _hit->wire()->xyPosition();
00606 }
00607 */
00608 
00609 inline
00610 int
00611 TMLink::zStatus(void) const {
00612     return _zStatus;
00613 }
00614 
00615 inline
00616 int
00617 TMLink::zStatus(int a) {
00618     return _zStatus = a;
00619 }
00620 
00621 inline
00622 int
00623 TMLink::zPair(void) const {
00624     return _zPair;
00625 }
00626 
00627 inline
00628 int
00629 TMLink::zPair(int a) {
00630     return _zPair = a;
00631 }
00632 
00633 /*
00634 //-- S. Suzuki added -------
00635 inline
00636 int 
00637 TMLink::usecathode(void) const {
00638     return _usecathode;
00639 }
00640 
00641 inline
00642 void
00643 TMLink::setusecathode(int a) {
00644     _usecathode = a ;
00645 }
00646 
00647 inline 
00648 TMDCClust *
00649 TMLink::getmclust(void) const {
00650     return _mclust;
00651 }
00652 
00653 inline
00654 void
00655 TMLink::setmclust(TMDCClust * a) {
00656     _mclust = a ;
00657 }
00658 
00659 //-- S. Suzuki added end ----
00660 */
00661 
00662 inline
00663 const HepPoint3D &
00664 TMLink::arcZ(const unsigned i) const {
00665   if(i < 4)return _arcZ[i];
00666   std::cerr << "Error!! Please stop!!.....arcZ of TMLink!!! in TrkReco." << std::endl;
00667   return _arcZ[0];
00668 }
00669 
00670 inline
00671 const HepPoint3D & 
00672 TMLink::arcZ(const HepPoint3D &az, const unsigned i){
00673   if(i < 4)return _arcZ[i] = az;
00674   std::cerr << "Error!! Please stop!!.....arcZ of TMLink!!! in TrkReco." << std::endl;
00675   return _arcZ[0];
00676 }
00677 
00678 //inline
00679 //void
00680 //TMLink::setZphiBeforeCathode(float a) {
00681 //      _ZphiBeforeCathode = a;
00682 //}
00683 
00684 inline
00685 const unsigned 
00686 TMLink::fit2D(const unsigned &f) {
00687   return _fit2D = f;
00688 }
00689 
00690 inline
00691 unsigned 
00692 TMLink::fit2D(void) {
00693   return _fit2D;
00694 }
00695 
00696 inline
00697 float
00698 TMLink::drift(unsigned a) const {
00699     return _drift[a];
00700 }
00701 
00702 inline
00703 float
00704 TMLink::drift(float b, unsigned a) {
00705     return _drift[a] = b;
00706 }
00707 
00708 inline
00709 double
00710 TMLink::cDrift(unsigned a) const {
00711     return _cDrift[a];
00712 }
00713                                                                                                                                                
00714 inline
00715 double
00716 TMLink::cDrift(double b, unsigned a) {
00717     return _cDrift[a] = b;
00718 }
00719 
00720 inline
00721 float
00722 TMLink::dDrift(unsigned a) const {
00723     return _dDrift[a];
00724 }
00725 
00726 inline
00727 float
00728 TMLink::dDrift(float b, unsigned a) {
00729     return _dDrift[a] = b;
00730 }
00731 
00732 inline
00733 float
00734 TMLink::drift(void) const {
00735     return (_drift[0] + _drift[1]) / 2.;
00736 }
00737                                                                                                                                                
00738 inline
00739 double
00740 TMLink::cDrift(void) const {
00741     return (_cDrift[0] + _cDrift[1]) / 2.;
00742 }
00743 
00744 inline
00745 float
00746 TMLink::dDrift(void) const {
00747     return (_dDrift[0] + _dDrift[1]) / 2.;
00748 }
00749 
00750 inline
00751 unsigned
00752 TMLink::tsfTag(void) const {
00753         return _tsfTag;
00754 }
00755 
00756 inline
00757 unsigned
00758 TMLink::tsfTag(unsigned a) {
00759         return _tsfTag = a;
00760 }
00761 
00762 inline
00763 double
00764 TMLink::tof(void) const {
00765   return _tof;
00766 }
00767 
00768 inline
00769 double
00770 TMLink::tof(double a) {
00771   return _tof = a;
00772 }
00773 
00774 inline
00775 double
00776 TMLink::getDriftTime(void) {
00777   return _drifttime;
00778 }
00779 
00780 inline
00781 void
00782 TMLink::setDriftTime(double time){
00783 _drifttime = time;
00784 
00785  }
00786 #endif
00787 
00788 #undef inline
00789 
00790 #endif /* TMLink_FLAG_ */

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