00001 // $Id: MdcSWire.h,v 1.6 2011/12/05 00:46:23 zhangy Exp $ // -*-c++-*- 00002 // header file for a class called "MdcSWire" 00003 #ifndef MDCSWIRE_H 00004 #define MDCSWIRE_H 00005 00006 #include "MdcGeom/MdcSagTraj.h" 00007 #include "CLHEP/Geometry/Point3D.h" 00008 #include "CLHEP/Vector/ThreeVector.h" 00009 #include <iostream> 00010 00011 #ifndef ENABLE_BACKWARDS_COMPATIBILITY 00012 typedef HepGeom::Point3D<double> HepPoint3D; 00013 #endif 00014 00015 00016 using CLHEP::Hep3Vector; 00017 00018 class MdcLayer; 00019 00020 class MdcSWire { 00021 00022 public: 00023 // Constructor. 00024 MdcSWire(HepPoint3D &eastP, HepPoint3D &westP, double sag = 0, int id =0, int cell=0); 00025 // Destructor 00026 ~MdcSWire(){}; 00027 00028 public: // Extractors 00029 00030 // Selectors (const) 00031 double getSag(void) const { return _sag; } 00032 const HepPoint3D* getEastPoint(void) const { return &_east; } 00033 const HepPoint3D* getWestPoint(void) const { return &_west; } 00034 const MdcSagTraj* getTraj(void) const { return &_traj; } 00035 double xEast(void) const { return _east.x(); } 00036 double yEast(void) const { return _east.y(); } 00037 double zEast(void) const { return _east.z(); } 00038 double xWest(void) const { return _west.x(); } 00039 double yWest(void) const { return _west.y(); } 00040 double zWest(void) const { return _west.z(); } 00041 double xMid (void) const { return rMid() * cos(phi()); } 00042 double yMid (void) const { return rMid() * sin(phi()); } 00043 double rEnd (void) const { return _rend; } 00044 const MdcLayer* layer(void) const { return _lay; } 00045 int Id(void) const { return _id; }//wire number in Mdc 00046 int cell(void) const { return _cell; } //local cell number in layer 00047 double zLength(void) const { return getEastPoint()->z()- getWestPoint()->z(); } 00048 double dPhiz (void) const { return _twist; } 00049 double zEndDC(void) const { return 0.5*zLength(); } 00050 double rMid (void) const { return rEnd() * cos( dPhiz() ); } 00051 double phiE (void) const { return _phiend; } 00052 double phi (void) const { return _phiend + _twist; } 00053 double stereo(void) const 00054 { return 2.*rEnd()*sin(dPhiz())/zLength(); } 00055 double stDip (void) const { return rEnd() - rMid(); } 00056 // in the local MDC reference 00057 double radiusDC(double z) const { return rEnd() - stDip() * (1.- 00058 z*z/(zEndDC()*zEndDC())); } 00059 //double phiDC (double z) const { return phi() + dPhizDC(z); }//yzhang fix 2011-12-02 00060 double phiDC (double z) const { return phi() - dPhizDC(z); } 00061 double xWireDC (double z) const { return radiusDC(z)*cos(phiDC(z)); } 00062 double yWireDC (double z) const { return radiusDC(z)*sin(phiDC(z)); } 00063 double dPhizDC (double z) const { return atan2( z*stereo(),rMid() ); } 00064 00065 // direction axis defining the local coordinate system of the sense 00066 // wire (eventually needed by calibration) 00067 Hep3Vector yAxis( double z=0. ); 00068 const Hep3Vector& zAxis( void ) const { return _traj.rawDirection(); } 00069 00070 void print(std::ostream &o) const; 00071 void printInfo(std::ostream &o) const; 00072 00073 protected: 00074 void setLayerPtr(const MdcLayer* lay) { _lay =lay; } 00075 00076 private: 00077 00078 friend class MdcLayer; 00079 MdcSagTraj _traj; // wire trajectory 00080 HepPoint3D _east; // wire position at backward endplate (mm) 00081 HepPoint3D _west; // wire position at west endplate (mm) 00082 const MdcLayer* _lay; // pointer to layer to which the wire belongs 00083 double _rend; // radius at backward endplate(mm) 00084 double _phiend; // phi angle at backward endplate 00085 double _twist; // twist angle between mid and bakcward chamber=a/2 00086 double _sag; // wire sagitta 00087 int _id; // sense wire identifier in mdc 00088 int _cell; // sense wire (cell) identifier (local) 00089 }; 00090 00091 #endif /* MdcSWire_CLASS */ 00092