2 #include "StiPullEvent.h"
4 #if ROOT_VERSION_CODE < 331013
14 StiPullEvent::StiPullEvent()
15 :mTrksG(
"StiPullTrk",100)
16 ,mTrksP(
"StiPullTrk",100)
17 ,mHitsG(
"StiPullHit",100)
18 ,mHitsP(
"StiPullHit",100)
19 ,mHitsR(
"StiPullHit",100)
21 mHitsG.SetOwner(0); mHitsP.SetOwner(0); mHitsR.SetOwner(0);
25 void StiPullTrk::Clear(
const char*)
27 memset(mBeg,0,mEnd-mBeg+1);
30 StiPullTrk::StiPullTrk()
35 void StiPullTrk::Print(
const char* option)
const
37 if (!option) option=
"";
38 printf(
"StiPullTrk::Print(%s)\n",option);
43 void StiPullHit::Clear(
const char*)
45 memset(mBeg,0,mEnd-mBeg+1);
48 StiPullHit::StiPullHit()
53 void StiPullHit::Print(
const char* option)
const
55 if (!option) option=
"";
56 printf(
"StiPullHit::Print(%s)\n",option);
57 printf(
"mTrackNumber=%d mHardwarePosition=%u \n"
58 ,mTrackNumber,mHardwarePosition);
59 printf(
"mNormalRefAngle=%g mNormaYOffset=%g mZCenter=%g\n"
60 ,mNormalRefAngle,mNormalYOffset,mZCenter);
62 printf(
"lXHit=%g \tlYHit %g(%g)\tlZHit %g(%g)\n"
67 printf(
"lXFit=%g \tlYFit %g(%g)\tlZFit %g(%g)\n"
72 printf(
"lYPul %g(%g)\tlZPul %g(%g)\n"
77 printf(
"gRHit=%g \tgPHit %g(%g)\tgZHit %g(%g)\n"
82 printf(
"gRFit=%g \tgPFit %g(%g)\tgZFit %g(%g)\n"
87 printf(
"gPPul %g(%g)\tgZPul %g(%g)\n"
94 int StiPullHit::TestIt()
101 TClonesArray *hits = &mHitsG+gloPrim;
102 int iHit = hits->GetLast()+1;
106 if (!hit.mDetector)
return;
108 if (hit.mDetector==kTpcId) i=1;
109 if (hit.mDetector==kSvtId) i=2;
110 if (hit.mDetector==kSsdId) i=3;
111 if (hit.mDetector==kPxlId) i=4;
112 if (hit.mDetector==kIstId) i=5;
113 if (!i || i>3)
return;
117 void StiPullEvent::Add(
StiPullTrk &trk,
int gloPrim)
119 TClonesArray *trks = &mTrksG+gloPrim;
120 int iTrk = trks->GetLast()+1;
123 assert(trk.mTrackNumber);
128 const int *StiPullEvent::GetNHits()
const
133 void StiPullEvent::Clear(
const char*)
135 mHitsG.Clear();mHitsP.Clear();mHitsR.Clear();
136 mTrksG.Clear();mTrksP.Clear();
137 memset(mVtx,0,
sizeof(mVtx));
138 memset(mEtx,0,
sizeof(mEtx));
140 memset(mNTrks,0,
sizeof(mNTrks));
141 memset(mNHits,0,
sizeof(mNHits));
145 void StiPullEvent::Finish()
147 static int nCall=0; nCall++;
148 int iTkG=0,iTkP=0,iHiG=0,iHiP=0,idP=0,idG=0;
151 int nHiG = mHitsG.GetLast()+1;
152 int nHiP = mHitsP.GetLast()+1;
153 for (iTkG=0;iTkG<mNTrks[0];iTkG++) {
154 trkG=(
StiPullTrk*)mTrksG[iTkG]; idG = trkG->mTrackNumber;
156 if (iTkP<mNTrks[1]) {
157 trkP=(
StiPullTrk*)mTrksP[iTkP]; idP = trkP->mTrackNumber;
161 vertex = trkP->mVertex;
163 for(;iHiP<nHiP; iHiP ++) {
164 hiP = (
StiPullHit*)mHitsP[iHiP];
if (idP!=hiP->mTrackNumber)
break;
166 hiP->mTrackNumber=iTkG+1; hiP->mVertex=vertex;
168 assert(nHits==trkP->nAllHits || nHits-1==trkP->nAllHits);
169 trkP->mTrackNumber= iTkG+1; iTkP++;
173 for(;iHiG<nHiG; iHiG ++) {
174 hiG = (
StiPullHit*)mHitsG[iHiG];
if (idG!=hiG->mTrackNumber)
break;
176 hiG->mTrackNumber=iTkG+1; hiG->mVertex=vertex;
178 assert(nHits==trkG->nAllHits);
179 trkG->mVertex = vertex;
180 trkG->mTrackNumber= iTkG+1;