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

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // $Id: TMDCWire.h,v 1.8 2011/07/31 02:50:49 liucy Exp $
00003 //-----------------------------------------------------------------------------
00004 // Filename : TMDCWire.h
00005 // Section  : Tracking MDC
00006 // Owner    : Yoshi Iwasaki
00007 // Email    : yoshihito.iwasaki@kek.jp
00008 //-----------------------------------------------------------------------------
00009 // Description : A class to represent a wire in MDC.
00010 //               See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
00011 //-----------------------------------------------------------------------------
00012 
00013 #ifndef TMDCWire_FLAG_
00014 #define TMDCWire_FLAG_
00015 
00016 #ifdef TRKRECO_DEBUG_DETAIL
00017 #ifndef TRKRECO_DEBUG
00018 #define TRKRECO_DEBUG
00019 #endif
00020 #endif
00021 
00022 // itostring
00023 #include "CLHEP/String/Strings.h"
00024 
00025 #define HEP_SHORT_NAMES
00026 #include "CLHEP/Geometry/Vector3D.h"
00027 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00028     typedef HepGeom::Vector3D<double> HepVector3D;
00029 #endif
00030 
00031 #ifndef CLHEP_POINT3D_H
00032 #include "CLHEP/Geometry/Point3D.h"
00033 #endif
00034 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00035     typedef HepGeom::Point3D<double> HepPoint3D;
00036 #endif
00037 
00038 #include "TrkReco/TMDCLayer.h"
00039 
00040 #define WireInnerLeft 0
00041 #define WireInnerRight 1
00042 #define WireLeft 2
00043 #define WireRight 3
00044 #define WireOuterLeft 4
00045 #define WireOuterRight 5
00046 
00047 //struct geocdc_wire;
00048 class MdcGeoWire;
00049 class TMDC;
00050 class TMDCTsf;
00051 class TMDCWireHit;
00052 class TMDCWireHitMC;
00053 
00055 class TMDCWire {
00056 
00057   public:
00059     TMDCWire(const MdcGeoWire *, TMDCLayer *);
00060 
00062     virtual ~TMDCWire();
00063 
00064   public:// Selectors
00066     unsigned id(void) const;
00067 
00069     unsigned localId(void) const;
00070 
00072     unsigned layerId(void) const;
00073 
00075     unsigned localLayerId(void) const;
00076 
00078     unsigned superLayerId(void) const;
00079 
00081     unsigned axialStereoLayerId(void) const;
00082 
00084     const MdcGeoWire * geocdc(void) const;
00085 
00087     const TMDCLayer * const layer(void) const;
00088 
00090     const TMDCWireHit * const hit(void) const;
00091 
00093     const TMDCTsf * const tsf(void) const;
00094 
00096     unsigned state(void) const;
00097 
00099     bool axial(void) const;
00100 
00102     bool stereo(void) const;
00103 
00105     bool innerPart(void) const;
00106 
00108     bool mainPart(void) const;
00109 
00111     const TMDCWire * const neighbor(unsigned) const;
00112 
00114     bool consective(const TMDCWire &) const;
00115 
00117     bool adjacent(const TMDCWire &) const;
00118 
00120     int localIdForPlus(void) const;
00121 
00123     int localIdForMinus(void) const;
00124 
00126     const HepPoint3D & forwardPosition(void) const;
00127 
00129     const HepPoint3D & backwardPosition(void) const;
00130     double * backwardPosition(double p[3]) const;
00131     const double & tension(void) const;
00133     const HepPoint3D & xyPosition(void) const;
00134     double * xyPosition(double p[3]) const;
00135     const HepPoint3D  xyPosition(double z) const;
00137     const HepVector3D & direction(void) const;
00138 
00140     void wirePosition(float zPosition,
00141                       HepPoint3D & xyPosition,
00142                       HepPoint3D & backwardPosition,
00143                       HepVector3D & direction) const;
00144 
00146     float cellSize(void) const;
00147 
00149     int localIdDifference(const TMDCWire &) const;
00150 
00152     std::string name(void) const;
00153 
00155     void dump(const std::string & message = std::string(""),
00156               const std::string & prefix = std::string("")) const;
00157 
00158   public:// Modifiers
00160     const TMDCWireHit * const hit(const TMDCWireHit * const);
00161 
00163     const TMDCWireHitMC * const hit(TMDCWireHitMC * const);
00164 
00166     TMDCTsf * tsf(TMDCTsf *);
00167 
00169     unsigned state(unsigned newState);
00170 
00172     void clear(void);
00173 
00174   private:
00175     unsigned _state;
00176     const TMDCWireHit * _hit;
00177     AList<TMDCWireHitMC> _mcHits;
00178 
00179     unsigned _id;
00180     unsigned _localId;
00181     unsigned _layerId;
00182     const TMDCLayer * _layer;
00183     TMDCTsf * _tsf;
00184     HepPoint3D _xyPosition;
00185     HepPoint3D _forwardPosition;
00186     HepPoint3D _backwardPosition;
00187     double _tension;
00188     HepVector3D _direction;
00189     const MdcGeoWire * _geo;
00190 
00191     static TMDC * _cdc;
00192 };
00193 
00194 //-----------------------------------------------------------------------------
00195 
00196 #ifdef TMDCWire_NO_INLINE
00197 #define inline
00198 #else
00199 #undef inline
00200 #define TMDCWire_INLINE_DEFINE_HERE
00201 #endif
00202 
00203 #ifdef TMDCWire_INLINE_DEFINE_HERE
00204 
00205 inline
00206 unsigned
00207 TMDCWire::id(void) const {
00208     return _id;
00209 }
00210 
00211 inline
00212 unsigned
00213 TMDCWire::localId(void) const {
00214     return _localId;
00215 }
00216 
00217 inline
00218 unsigned
00219 TMDCWire::layerId(void) const {
00220     return _layerId;
00221 }
00222 
00223 inline
00224 unsigned
00225 TMDCWire::superLayerId(void) const {
00226     return _layer->superLayerId();
00227 }
00228 
00229 inline
00230 unsigned
00231 TMDCWire::localLayerId(void) const {
00232     return _layer->localLayerId();
00233 }
00234 
00235 inline
00236 const MdcGeoWire *
00237 TMDCWire::geocdc(void) const {
00238     return _geo;
00239 }
00240 
00241 inline
00242 const TMDCLayer * const
00243 TMDCWire::layer(void) const {
00244     return _layer;
00245 }
00246 
00247 inline
00248 const TMDCTsf * const
00249 TMDCWire::tsf(void) const {
00250     return _tsf;
00251 }
00252 
00253 inline
00254 TMDCTsf *
00255 TMDCWire::tsf(TMDCTsf * t) {
00256     return _tsf = t;
00257 }
00258 
00259 inline
00260 unsigned
00261 TMDCWire::state(void) const {
00262     return _state;
00263 }
00264 
00265 inline
00266 unsigned
00267 TMDCWire::state(unsigned a) {
00268     return _state = a;
00269 }
00270 
00271 inline
00272 void
00273 TMDCWire::clear(void) {
00274     _state = 0;
00275     _hit = 0;
00276     _mcHits.removeAll();
00277 }
00278 
00279 inline
00280 const TMDCWireHit * const
00281 TMDCWire::hit(const TMDCWireHit * const h) {
00282     return _hit = h;
00283 }
00284 
00285 inline
00286 const TMDCWireHit * const
00287 TMDCWire::hit(void) const {
00288     return _hit;
00289 }
00290 
00291 inline
00292 const TMDCWireHitMC * const
00293 TMDCWire::hit(TMDCWireHitMC * const a) {
00294     _mcHits.append(a);
00295     return a;
00296 }
00297 
00298 inline
00299 const HepPoint3D &
00300 TMDCWire::forwardPosition(void) const {
00301     return _forwardPosition;
00302 }
00303 
00304 inline
00305 const HepPoint3D &
00306 TMDCWire::backwardPosition(void) const {
00307     return _backwardPosition;
00308 }
00309 
00310 inline
00311 const double &
00312 TMDCWire::tension(void) const {
00313         return _tension;
00314 }
00315 
00316 inline
00317 double *
00318 TMDCWire::backwardPosition(double p[3]) const {
00319     p[0] = _backwardPosition.x();
00320     p[1] = _backwardPosition.y();
00321     p[2] = _backwardPosition.z();
00322     return p;
00323 }
00324 
00325 inline
00326 const HepPoint3D &
00327 TMDCWire::xyPosition(void) const {
00328     return _xyPosition;
00329 }
00330 
00331 inline
00332 double *
00333 TMDCWire::xyPosition(double a[3]) const {
00334     a[0] = _xyPosition.x();
00335     a[1] = _xyPosition.y();
00336     a[2] = 0.;
00337     return a;
00338 }
00339 
00340 inline
00341 const HepVector3D &
00342 TMDCWire::direction(void) const {
00343     return _direction;
00344 }
00345 
00346 inline
00347 bool
00348 TMDCWire::axial(void) const {
00349     return _layer->axial();
00350 }
00351 
00352 inline
00353 bool
00354 TMDCWire::stereo(void) const {
00355     return _layer->stereo();
00356 }
00357 
00358 inline
00359 unsigned
00360 TMDCWire::axialStereoLayerId(void) const {
00361     return _layer->axialStereoLayerId();
00362 }
00363 
00364 inline
00365 bool
00366 TMDCWire::innerPart(void) const {
00367     if (_layerId < 14) return true;
00368     return false;
00369 }
00370 
00371 inline
00372 bool
00373 TMDCWire::mainPart(void) const {
00374     if (_layerId > 13) return true;
00375     return false;
00376 }
00377 
00378 inline
00379 float
00380 TMDCWire::cellSize(void) const {
00381     if (_layer) {
00382         return _layer->cellSize();
00383     }
00384     else {
00385 #ifdef TRKRECO_DEBUG
00386         std::cout << "TMDCWire::cellSize !!! can't return cell size";
00387         std::cout << " because no pointer to a layer" << std::endl;
00388 #endif
00389         return 0.;
00390     }
00391 }
00392 
00393 inline
00394 bool
00395 TMDCWire::consective(const TMDCWire & w) const {
00396     if (neighbor(2) == & w) return true;
00397     else if (neighbor(3) == & w) return true;
00398     return false;
00399 }
00400 
00401 inline
00402 bool
00403 TMDCWire::adjacent(const TMDCWire & w) const {
00404     for (unsigned i = 0; i < 6; i++)
00405         if (neighbor(i) == & w)
00406             return true;
00407     return false;
00408 }
00409 
00410 inline
00411 std::string
00412 TMDCWire::name(void) const {
00413     if (axial())
00414         return itostring(_layerId) + std::string("-") + itostring(_localId);
00415     return itostring(_layerId) + std::string("=") + itostring(_localId);
00416 }
00417 
00418 #endif
00419 
00420 #undef inline
00421 
00422 #endif /* TMDCWire_FLAG_ */
00423 

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