00001 /*************************************************************************** 00002 * 00003 * $Id: StHit.cxx,v 2.25 2012/01/24 03:05:08 perev Exp $ 00004 * 00005 * Author: Thomas Ullrich, Sept 1999 00006 *************************************************************************** 00007 * 00008 * Description: 00009 * 00010 *************************************************************************** 00011 * 00012 * $Log: StHit.cxx,v $ 00013 * Revision 2.25 2012/01/24 03:05:08 perev 00014 * Cleanup 00015 * 00016 * Revision 2.24 2011/10/17 00:13:49 fisyak 00017 * Add handles for IdTruth info 00018 * 00019 * Revision 2.23 2011/01/21 18:30:45 fisyak 00020 * fix setFlag with UShort_t 00021 * 00022 * Revision 2.22 2009/11/23 16:34:06 fisyak 00023 * Cleanup, remove dependence on dst tables, clean up software monitors 00024 * 00025 * Revision 2.21 2009/11/10 00:40:17 ullrich 00026 * Changed print-out format. 00027 * 00028 * Revision 2.20 2006/02/14 21:04:31 perev 00029 * WarnOff 00030 * 00031 * Revision 2.19 2006/01/19 21:49:41 ullrich 00032 * Changed order of initializer in constructor. 00033 * 00034 * Revision 2.18 2005/07/19 21:34:10 perev 00035 * quality ==> qaTruth to avoid misleading 00036 * 00037 * Revision 2.17 2005/07/06 18:57:48 fisyak 00038 * Add StHit print out 00039 * 00040 * Revision 2.16 2004/10/13 16:10:52 ullrich 00041 * Fixed bug in operator== 00042 * 00043 * Revision 2.15 2004/08/06 15:37:09 fisyak 00044 * Add clster id 00045 * 00046 * Revision 2.14 2004/07/30 22:28:31 fisyak 00047 * Add transient pointer to next Hit 00048 * 00049 * Revision 2.13 2004/07/15 16:36:24 ullrich 00050 * Removed all clone() declerations and definitions. Use StObject::clone() only. 00051 * 00052 * Revision 2.12 2004/03/30 15:59:08 calderon 00053 * Added method to set mFitFlag (new chain no longer uses tables, so must set 00054 * this by hand). 00055 * 00056 * Revision 2.11 2004/01/13 21:01:32 fisyak 00057 * Add Truth and Quality information from simulation 00058 * 00059 * Revision 2.10 2001/04/05 04:00:51 ullrich 00060 * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs. 00061 * 00062 * Revision 2.9 2001/03/24 03:34:50 perev 00063 * clone() -> clone() const 00064 * 00065 * Revision 2.8 2001/03/06 21:04:30 ullrich 00066 * Modified detector() method. Replaced switch 00067 * statement by simple static_cast. 00068 * 00069 * Revision 2.7 2000/12/08 20:21:07 genevb 00070 * Changed kTofPatchId -> kTofId 00071 * 00072 * Revision 2.6 2000/07/28 23:29:42 calderon 00073 * Added handling of Fit Flag: use this flag to tell if the point 00074 * is used in the fit. 00075 * 00076 * Revision 2.5 2000/07/28 19:49:28 akio 00077 * Change in Detector Id for Endcap SMD 00078 * 00079 * Revision 2.4 2000/06/07 09:43:17 ullrich 00080 * Changed return type of flag() to unsigned int 00081 * 00082 * Revision 2.3 2000/06/01 21:38:53 ullrich 00083 * Added member mFlag and access member flag() and setFlag(). 00084 * 00085 * Revision 2.2 2000/05/19 18:33:14 ullrich 00086 * Minor changes (add const) to cope with modified StArray. 00087 * 00088 * Revision 2.1 1999/10/28 22:25:47 ullrich 00089 * Adapted new StArray version. First version to compile on Linux and Sun. 00090 * 00091 * Revision 2.0 1999/10/12 18:42:17 ullrich 00092 * Completely Revised for New Version 00093 * 00094 **************************************************************************/ 00095 #include "StHit.h" 00096 #include "StTrack.h" 00097 #include "StTrackNode.h" 00098 #include "StTrackDetectorInfo.h" 00099 00100 static const char rcsid[] = "$Id: StHit.cxx,v 2.25 2012/01/24 03:05:08 perev Exp $"; 00101 00102 ClassImp(StHit) 00103 00104 //______________________________________________________________________________ 00105 StHit::StHit() 00106 { 00107 mHardwarePosition = 0; 00108 mCharge = 0; 00109 mTrackRefCount = 0; 00110 mFlag = mFitFlag = 0; 00111 mIdTruth = mQuality = 0; 00112 mId = 0; 00113 mNextHit = 0; 00114 } 00115 00116 //______________________________________________________________________________ 00117 StHit::StHit(const StThreeVectorF& p, 00118 const StThreeVectorF& e, 00119 unsigned int hp, float q, unsigned char c, UShort_t idTruth, UShort_t quality, UShort_t id) 00120 :StMeasuredPoint(p),mHardwarePosition(hp),mPositionError(e),mCharge(q), 00121 mId(id),mIdTruth(idTruth),mQuality(quality),mFitFlag(0),mTrackRefCount(c),mFlag(0),mNextHit(0) 00122 { 00123 } 00124 00125 //______________________________________________________________________________ 00126 StHit::~StHit() { /* noop */ } 00127 00128 //______________________________________________________________________________ 00129 int StHit::operator==(const StHit& h) const 00130 { 00131 return h.mPosition == mPosition && 00132 h.mPositionError == h.mPositionError && 00133 h.mCharge == mCharge && 00134 h.mHardwarePosition == mHardwarePosition && 00135 h.mFlag == mFlag && 00136 h.mIdTruth == mIdTruth && 00137 h.mQuality == mQuality && 00138 h.mId == mId && 00139 h.mNextHit == mNextHit; 00140 } 00141 00142 //______________________________________________________________________________ 00143 int StHit::operator!=(const StHit& h) const 00144 { 00145 return !(*this == h); // use operator==() 00146 } 00147 00148 //______________________________________________________________________________ 00149 void StHit::setCharge(float val) { mCharge = val; } 00150 00151 //______________________________________________________________________________ 00152 void StHit::setTrackReferenceCount(unsigned char val) { mTrackRefCount = val; } 00153 00154 //______________________________________________________________________________ 00155 void StHit::setFitFlag(unsigned char val) { mFitFlag = val; } 00156 00157 //______________________________________________________________________________ 00158 void StHit::setHardwarePosition(unsigned int val) { mHardwarePosition = val; } 00159 00160 //______________________________________________________________________________ 00161 void StHit::setPositionError(const StThreeVectorF& e) { mPositionError = e; } 00162 00163 //______________________________________________________________________________ 00164 float StHit::charge() const { return mCharge; } 00165 00166 //______________________________________________________________________________ 00167 unsigned int StHit::flag() const { return static_cast<unsigned int>(mFlag); } 00168 00169 //______________________________________________________________________________ 00170 int StHit::usedInFit() const { return static_cast<int>(mFitFlag); } 00171 00172 //______________________________________________________________________________ 00173 unsigned int StHit::trackReferenceCount() const { return static_cast<unsigned int>(mTrackRefCount); } 00174 00175 //______________________________________________________________________________ 00176 StDetectorId StHit::detector() const 00177 { 00178 return static_cast<StDetectorId>(bits(0, 4)); 00179 } 00180 00181 //______________________________________________________________________________ 00182 StThreeVectorF StHit::positionError() const { return mPositionError; } 00183 00184 //______________________________________________________________________________ 00185 StMatrixF StHit::covariantMatrix() const 00186 { 00187 // for now the diagonal elements is all we have 00188 StMatrixF m(3,3); 00189 m(1,1) = mPositionError.x()*mPositionError.x(); 00190 m(2,2) = mPositionError.y()*mPositionError.y(); 00191 m(3,3) = mPositionError.z()*mPositionError.z(); 00192 return m; 00193 } 00194 00195 00196 //______________________________________________________________________________ 00197 void StHit::setIdTruth(int idtru,int qatru) 00198 { 00199 if (qatru==0) qatru = (idtru>>16); 00200 idtru = idtru&((1<<16)-1); 00201 mIdTruth = (UShort_t)(idtru); 00202 mQuality = (UShort_t) qatru; 00203 } 00204 00205 //______________________________________________________________________________ 00206 int StHit::idTruth() const 00207 { 00208 return mIdTruth; 00209 } 00210 00211 //______________________________________________________________________________ 00212 ostream& operator<<(ostream& os, const StHit& v) 00213 { 00214 os << Form("id %5i ",v.id()) << *((const StMeasuredPoint *)&v ); 00215 if (v.charge() > 1) os << Form(" q(ADC) %6.1f", v.charge()); 00216 else os << Form(" q(keV) %6.2f", 1e6*v.charge()); 00217 os << Form(" idT %4i qa %2i fl %2i us %1i",v.idTruth(), v.qaTruth(), v.flag(), v.usedInFit()); 00218 return os; 00219 } 00220 00221 //______________________________________________________________________________ 00222 void StHit::Print(Option_t *option) const {cout << *this << endl;}
1.5.9