8 #include "StPeCGeant.h"
9 #include "tables/St_g2t_track_Table.h"
10 #include "tables/St_g2t_vertex_Table.h"
11 #include "StMuDSTMaker/COMMON/StMuDst.h"
12 #include "StMuDSTMaker/COMMON/StMuEvent.h"
13 #include "StMuDSTMaker/COMMON/StMuTrack.h"
14 #include "StMuDSTMaker/COMMON/StMuMcTrack.h"
15 #include "StMuDSTMaker/COMMON/StMuMcVertex.h"
21 pPart =
new TClonesArray (
"StPeCParticle", 10);
25 StPeCGeant::~StPeCGeant() {
29 void StPeCGeant::clear() {
42 Int_t StPeCGeant::fill (
TDataSet* geant ) {
46 St_g2t_track* trk = 0 ;
47 trk = (St_g2t_track *)geant->
Find(
"g2t_track") ;
57 printf (
"StPeCGeant::fill: tracks not found \n" ) ;
61 int nTracks = trk->GetNRows() ;
63 g2t_track_st* trkT = trk->GetTable() ;
71 TClonesArray &pParticle = *pPart ;
74 printf (
"StPeCGeant::fill: %i tracks found \n", nTracks ) ;
76 for (
int i = 0 ; i < nTracks ; i++ ) {
79 vert = trkT[i].start_vertex_p ;
80 if ( vert != 1 ) continue ;
87 gPt = ::sqrt(px*px+py*py);
89 if ( gPsi < 0 ) gPsi += M_PI ;
90 gMass = ::sqrt(e*e-gPt*gPt-gPz*gPz);
92 float theta = atan2(gPt,gPz);
93 gEta = -::log(tan(theta/2.)) ;
94 gY = 0.5*::log((e+gPz)/(e-gPz));
96 St_g2t_vertex* vtx = 0 ;
97 vtx = (St_g2t_vertex *)geant->
Find(
"g2t_vertex") ;
99 printf (
"StPeCGeant::fill: vertex not found \n" ) ;
102 g2t_vertex_st* vtxT = vtx->GetTable() ;
104 gZVertex = vtxT->ge_x[2] ;
109 Int_t StPeCGeant::fill (
StMuDst * mu ) {
114 LOG_INFO <<
"StPeCGeant::fill: using MuDst ++++++++++++++++++++++++++++++++++++++++++++++++++++---------- " << endm;
116 printf (
"StPeCGeant::fill: MC event not found \n" ) ;
120 TClonesArray *MuMcTracks = mu->mcArray(1);
121 TClonesArray *MuMcVertices = mu->mcArray(0);
123 int nTracks = MuMcTracks->GetEntriesFast();
124 LOG_INFO <<
"StPeCGeant::fill: "<<nTracks<<
" tracks found "<<endm;
131 TClonesArray &pParticle = *pPart ;
135 for (Int_t kg = 0; kg < nTracks; kg++) {
140 LOG_INFO <<
"StPeCGeant::fill Geant pid: "<<mcTrack->GePid()<<endm;
143 if(mcTrack->GePid()==8 || mcTrack->GePid()==9){
144 px += mcTrack->Pxyz().x();
145 py += mcTrack->Pxyz().y();
146 gPz += mcTrack->Pxyz().z();
151 gPt = ::sqrt(px*px+py*py);
153 if ( gPsi < 0 ) gPsi += M_PI ;
154 gMass = ::sqrt(e*e-gPt*gPt-gPz*gPz);
156 float theta = atan2(gPt,gPz);
157 gEta = -::log(tan(theta/2.)) ;
158 gY = 0.5*::log((e+gPz)/(e-gPz));
170 gZVertex = mcVertex->XyzV().z() ;
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
virtual TDataSet * Find(const char *path) const