00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #define TMDCWireHit_INLINE_DEFINE_HERE
00014
00015 #include "TrkReco/TMDCUtil.h"
00016 #include "TrkReco/TMDCWire.h"
00017 #include "TrkReco/TMDCWireHit.h"
00018 #include "TrkReco/TMDCWireHitMC.h"
00019 #include "TrkReco/TTrackHEP.h"
00020
00021
00022
00023 #include "MdcTables/MdcTables.h"
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 TMDCWireHit::TMDCWireHit(TMDCWire * w, MdcRec_wirhit * r, float fudgeFactor)
00045 : _wire(w),
00046 _xyPosition(w->xyPosition()),
00047 _r(r),
00048 _state(r->stat),
00049 _track(0),
00050 _mc(0) {
00051 w->hit(this);
00052 _drift[0] = r->ddl;
00053 _drift[1] = r->ddr;
00054 _driftError[0] = r->erddl * fudgeFactor;
00055 _driftError[1] = r->erddr * fudgeFactor;
00056 if (w->axial()) _state |= WireHitAxial;
00057 else _state |= WireHitStereo;
00058 }
00059
00060 TMDCWireHit::~TMDCWireHit() {
00061 }
00062
00063 void
00064 TMDCWireHit::dump(const std::string & msg, const std::string & pre) const {
00065 std::cout << pre;
00066 std::cout << _wire->name();
00067 if (msg.find("state") != std::string::npos || msg.find("detail") != std::string::npos) {
00068 std::cout << ",state ";
00069 bitDisplay(_state);
00070 if (track()) std::cout << ",trk ";
00071 }
00072 if (msg.find("drift") != std::string::npos || msg.find("detail") != std::string::npos) {
00073 if (_state & WireHitLeftMask) std::cout << ", L";
00074 if (_state & WireHitRightMask) std::cout << ", R";
00075 std::cout<<" layer "<<_wire->layerId()<<" cell "<<_wire->localId();
00076 std::cout << ",dl " << _drift[0] << "+-" << _driftError[0];
00077 std::cout << ",dr " << _drift[1] << "+-" << _driftError[1];
00078 }
00079 if (msg.find("mc") != std::string::npos || msg.find("detail") != std::string::npos) {
00080 std::cout << ",hep ";
00081 if (mc()) {
00082 if (mc()->hep()) std::cout << mc()->hep()->id();
00083 else std::cout << "0";
00084 }
00085 else {
00086 std::cout << "0";
00087 }
00088 }
00089 std::cout << std::endl;
00090 }
00091
00092 HepPoint3D
00093 TMDCWireHit::position(unsigned lr) const {
00094 const HepPoint3D myHepZHat(0.0, 0.0, 1.0);
00095
00096 if (lr == WireHitLeft) {
00097 return _xyPosition
00098 - _drift[WireHitLeft] * myHepZHat.cross(_xyPosition.unit());
00099 }
00100
00101
00102 else {
00103 return _xyPosition
00104 + _drift[WireHitRight] * myHepZHat.cross(_xyPosition.unit());
00105 }
00106 }
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125