00001 //----------------------------------------------------------------------------- 00002 // $Id: TTrackHEP.h,v 1.6 2010/03/31 09:58:59 liucy Exp $ 00003 //----------------------------------------------------------------------------- 00004 // Filename : TTrackHEP.h 00005 // Section : Tracking 00006 // Owner : Yoshi Iwasaki 00007 // Email : yoshihito.iwasaki@kek.jp 00008 //----------------------------------------------------------------------------- 00009 // Description : A class to represent a GEN_HEPEVT particle in tracking. 00010 // See http://bsunsrv1.kek.jp/~yiwasaki/tracking/ 00011 //----------------------------------------------------------------------------- 00012 00013 #ifndef TTrackHEP_FLAG_ 00014 #define TTrackHEP_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/Alist/AList.h" 00027 #include "CLHEP/Vector/ThreeVector.h" 00028 #include "CLHEP/Vector/LorentzVector.h" 00029 //#include "tables/hepevt.h" 00030 #include "MdcTables/HepevtTables.h" 00031 #include "TrkReco/TMDC.h" 00032 00033 using CLHEP::Hep3Vector; 00034 using CLHEP::HepLorentzVector; 00035 00037 class TTrackHEP { 00038 00039 public: 00041 static const AList<TTrackHEP> & list(void); 00042 00044 static TTrackHEP * hep(const Gen_hepevt *); 00045 00046 private: 00048 static void update(void); 00049 00050 private: 00052 TTrackHEP(const Gen_hepevt *); 00053 00054 public: 00056 virtual ~TTrackHEP(); 00057 00058 public: 00060 std::string name(void) const; 00061 00063 unsigned id(void) const; 00064 00066 int status(void) const; 00067 00069 int pType(void) const; 00070 00072 TTrackHEP * mother(void) const; 00073 00075 TTrackHEP * child(unsigned i) const; 00076 00078 // const VectorL & p(void) const; 00079 const HepLorentzVector & p(void) const; 00080 00082 const Hep3Vector & v(void) const; 00083 00085 void dump(const std::string & message = std::string(""), 00086 const std::string & prefix = std::string("")) const; 00087 00089 const AList<TMDCWireHitMC> & hits(void) const; 00090 00092 const Gen_hepevt * gen(void) const; 00093 00094 private: 00095 const Gen_hepevt * _hep; 00096 TTrackHEP * _mother; 00097 AList<TTrackHEP> _children; 00098 // const VectorL _p; 00099 const HepLorentzVector _p; 00100 const Hep3Vector _v; 00101 AList<TMDCWireHitMC> _hits; 00102 00103 private:// static members 00104 static AList<TTrackHEP> _list; 00105 00106 friend void TMDC::updateMC(void); 00107 }; 00108 00109 //----------------------------------------------------------------------------- 00110 00111 #ifdef TRKRECO_NO_INLINE 00112 #define inline 00113 #else 00114 #undef inline 00115 #define TTrackHEP_INLINE_DEFINE_HERE 00116 #endif 00117 00118 #ifdef TTrackHEP_INLINE_DEFINE_HERE 00119 00120 inline 00121 unsigned 00122 TTrackHEP::id(void) const { 00123 return _hep->id - 1; 00124 } 00125 00126 inline 00127 int 00128 TTrackHEP::status(void) const { 00129 return _hep->isthep; 00130 } 00131 00132 inline 00133 int 00134 TTrackHEP::pType(void) const { 00135 return _hep->idhep; 00136 } 00137 00138 inline 00139 TTrackHEP * 00140 TTrackHEP::mother(void) const { 00141 return _mother; 00142 } 00143 00144 inline 00145 TTrackHEP * 00146 TTrackHEP::child(unsigned i) const { 00147 return _children[i]; 00148 } 00149 00150 inline 00151 const HepLorentzVector & 00152 TTrackHEP::p(void) const { 00153 return _p; 00154 } 00155 00156 inline 00157 const Hep3Vector & 00158 TTrackHEP::v(void) const { 00159 return _v; 00160 } 00161 00162 inline 00163 TTrackHEP * 00164 TTrackHEP::hep(const Gen_hepevt * h) { 00165 if (! h) return 0; 00166 unsigned id = h->id - 1; 00167 return _list[id]; 00168 } 00169 00170 inline 00171 const AList<TMDCWireHitMC> & 00172 TTrackHEP::hits(void) const { 00173 return _hits; 00174 } 00175 00176 inline 00177 std::string 00178 TTrackHEP::name(void) const { 00179 return "mc" + itostring(id()); 00180 } 00181 00182 inline 00183 const Gen_hepevt * 00184 TTrackHEP::gen(void) const { 00185 return _hep; 00186 } 00187 00188 #endif 00189 00190 #undef inline 00191 00192 #endif /* TTrackHEP_FLAG_ */