BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TTrackHEP.cxx
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TTrackHEP.cxx,v 1.4 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TTrackHEP.cc
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : yoshihito.iwasaki@kek.jp
8//-----------------------------------------------------------------------------
9// Description : A class to represent a GEN_HEPEVT particle in tracking.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#include "TrkReco/TTrackHEP.h"
14#include "MdcTables/HepevtTables.h"
15#include <vector>
16
17AList<TTrackHEP> TTrackHEP::_list = AList<TTrackHEP>();
18
19void TTrackHEP::update( void ) {
20 if ( _list.length() ) HepAListDeleteAll( _list );
21
22 // unsigned n = BsCouTab(GEN_HEPEVT);
23 // std::vector<Gen_hepevt>* genhep = GenHepevtCol::getGenHepevtCol();
24 unsigned n = GenHepevtCol::getGenHepevtCol()->size();
25 // unsigned n = genhep -> size();
26
27 for ( unsigned i = 0; i < n; i++ )
28 {
29 // Gen_hepevt * h = *genhep[i];
30 Gen_hepevt* h = &( *GenHepevtCol::getGenHepevtCol() )[i];
31 // (struct gen_hepevt *) BsGetEnt(GEN_HEPEVT, i + 1, BBS_No_Index);
32 if ( !h )
33 {
34 std::cout << "TTrackHEP::update !!! can not access to GEN_HEPEVT";
35 std::cout << std::endl;
36 break;
37 }
38
39 _list.append( new TTrackHEP( h ) );
40 }
41}
42
43TTrackHEP::TTrackHEP( const Gen_hepevt* h )
44 : _hep( h )
45 , _mother( 0 )
46 , _p( h->P[0], h->P[1], h->P[2], h->P[3] )
47 , _v( h->V[0], h->V[1], h->V[2] ) {
48 if ( _hep->mother != 0 )
49 {
50 // _mother = _list[_hep->mother-1];
51 _mother = _list[_hep->mother->id];
52 _mother->_children.append( this );
53 }
54}
55
57
58void TTrackHEP::dump( const std::string& msg, const std::string& pre ) const {
59 std::cout << pre;
60
61 std::cout << id() << ":";
62 std::cout << pType() << ":";
63 if ( _mother ) std::cout << _mother->id();
64 else std::cout << "-";
65 std::cout << ":";
66 std::cout << _p << ":" << _v;
67 std::cout << std::endl;
68}
69
70const AList<TTrackHEP>& TTrackHEP::list( void ) { return _list; }
double P(RecMdcKalTrack *trk)
const Int_t n
static vector< Gen_hepevt > * getGenHepevtCol(void)
unsigned id(void) const
returns an id started from 0.
int pType(void) const
returns particle type.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition TTrackHEP.cxx:58
virtual ~TTrackHEP()
Destructor.
Definition TTrackHEP.cxx:56
static const AList< TTrackHEP > & list(void)
returns a list of TTrackHEP's.
Definition TTrackHEP.cxx:70