33 TNtuple *MakeTrsNtuple() {
35 trstest =
new TNtuple(
"trs",
"trs",
36 "xgeant:ygeant:zgeant:crossAngle:tanl:xtphit:ytphit:ztphit:q");
39 void FillTrsNtuple(
StChain *theChain,TNtuple *trstest) {
41 int tphitIdx,indexIdx,geantIdx,indexIdx,geantNrow,tphitNrow,indexNrow;
42 int geantKey,tphitKey;
47 St_g2t_tpc_hit *geantObj=
48 (St_g2t_tpc_hit*)iter0(
".make/geant/.data/g2t_tpc_hit");
49 if(!geantObj) { printf(
"Error 96.\n");
return; }
50 g2t_tpc_hit_st *geantTbl=(g2t_tpc_hit_st*) geantObj->GetTable();
51 if(!geantTbl) { printf(
"Error 396.\n");
return; }
52 geantNrow=geantObj->GetNRows();
54 St_tcl_tpc_index *indexObj=iter0(
".make/tpc_hits/.data/index");
55 if(!indexObj) { printf(
"Error 66.\n");
return; }
56 tcl_tpc_index_st *indexTbl=(tcl_tpc_index_st*) indexObj->GetTable();
57 if(!indexTbl) { printf(
"Error 396.\n");
return; }
58 indexNrow=indexObj->GetNRows();
60 St_tcl_tphit *tphitObj=iter0(
".make/tpc_hits/.data/tphit");
61 if(!tphitObj) { printf(
"Error 76.\n");
return; }
62 tcl_tphit_st *tphitTbl=(tcl_tphit_st*) tphitObj->GetTable();
63 if(!tphitTbl) { printf(
"Error 396.\n");
return; }
64 tphitNrow=tphitObj->GetNRows();
66 for(indexIdx=0;indexIdx<indexNrow;indexIdx++) {
68 geantKey=indexTbl[indexIdx].key1;
69 for(geantIdx=geantNrow-1;geantIdx>=0;geantIdx--) {
70 if(geantTbl[geantIdx].
id==geantKey)
break;
72 if(geantIdx<0) { printf(
"no match key1 (%d).\n",geantKey);
continue; }
74 tphitKey=indexTbl[indexIdx].key2;
75 for(tphitIdx=tphitNrow-1;tphitIdx>=0;tphitIdx--) {
76 if(tphitTbl[tphitIdx].
id==tphitKey)
break;
78 if(tphitIdx<0) { printf(
"no match key2 (%d).\n",tphitKey);
continue; }
80 p0=geantTbl[geantIdx].p[0];
81 p1=geantTbl[geantIdx].p[1];
82 p2=geantTbl[geantIdx].p[2];
85 (Float_t)(geantTbl[geantIdx].x[0]),
86 (Float_t)(geantTbl[geantIdx].x[1]),
87 (Float_t)(geantTbl[geantIdx].x[2]),
88 (Float_t)(atan2(p0,p1)),
89 (Float_t)(atan(p2/sqrt(p0*p0+p1*p1))),
90 (Float_t)(tphitTbl[tphitIdx].x),
91 (Float_t)(tphitTbl[tphitIdx].y),
92 (Float_t)(tphitTbl[tphitIdx].z),
93 (Float_t)(tphitTbl[tphitIdx].q)