00001 //----------------------------------------------------------------------------- 00002 // $Id: TTrackHEP.cxx,v 1.4 2010/03/31 09:58:59 liucy Exp $ 00003 //----------------------------------------------------------------------------- 00004 // Filename : TTrackHEP.cc 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 #include "TrkReco/TTrackHEP.h" 00014 #include <vector> 00015 #include "MdcTables/HepevtTables.h" 00016 00017 AList<TTrackHEP> 00018 TTrackHEP::_list = AList<TTrackHEP>(); 00019 00020 void 00021 TTrackHEP::update(void) { 00022 if (_list.length()) HepAListDeleteAll(_list); 00023 00024 // unsigned n = BsCouTab(GEN_HEPEVT); 00025 // std::vector<Gen_hepevt>* genhep = GenHepevtCol::getGenHepevtCol(); 00026 unsigned n = GenHepevtCol::getGenHepevtCol()->size(); 00027 // unsigned n = genhep -> size(); 00028 00029 for (unsigned i = 0; i < n; i++) { 00030 // Gen_hepevt * h = *genhep[i]; 00031 Gen_hepevt* h = &(*GenHepevtCol::getGenHepevtCol())[i]; 00032 // (struct gen_hepevt *) BsGetEnt(GEN_HEPEVT, i + 1, BBS_No_Index); 00033 if (! h) { 00034 std::cout << "TTrackHEP::update !!! can not access to GEN_HEPEVT"; 00035 std::cout << std::endl; 00036 break; 00037 } 00038 00039 _list.append(new TTrackHEP(h)); 00040 } 00041 } 00042 00043 TTrackHEP::TTrackHEP(const Gen_hepevt * h) 00044 : _hep(h), 00045 _mother(0), 00046 _p(h->P[0], h->P[1], h->P[2], h->P[3]), 00047 _v(h->V[0], h->V[1], h->V[2]) { 00048 if (_hep->mother != 0) { 00049 // _mother = _list[_hep->mother-1]; 00050 _mother = _list[_hep->mother->id]; 00051 _mother->_children.append(this); 00052 } 00053 } 00054 00055 TTrackHEP::~TTrackHEP() { 00056 } 00057 00058 void 00059 TTrackHEP::dump(const std::string & msg, const std::string & pre) const { 00060 std::cout << pre; 00061 00062 std::cout << id() << ":"; 00063 std::cout << pType() << ":"; 00064 if (_mother) std::cout << _mother->id(); 00065 else std::cout << "-"; 00066 std::cout << ":"; 00067 std::cout << _p << ":" << _v; 00068 std::cout << std::endl; 00069 } 00070 00071 const AList<TTrackHEP> & 00072 TTrackHEP::list(void) { 00073 return _list; 00074 }