13 #include <StEvent/StGlobalTrack.h>
15 #include <StBFChain/StBFChain.h>
16 #include <tables/St_g2t_vertex_Table.h>
24 Vertex3D::Vertex3D() {
31 LOG_INFO <<Form(
"Vertex3D::initRun() params:track glob %.1f<PT(GeV/c)<%.1f, sigY<%.1fcm, nTrack>%d ", cut_pT1, cut_pT2, cut_sigY, cut_numTrack)<<endm;
36 Vertex3D::~Vertex3D(){
42 Vertex3D::clearEvent(){
53 Vertex3D::clearTracks(){
65 if( !trk->mTpc && !trk->mBtof && !trk->mCtb && !trk->mBemc && trk->mEemc )
return;
69 float pt=trk->dcaTrack.gP.Pt();
71 if (pt <cut_pT1)
return;
73 if (pt >cut_pT2)
return;
76 float sY=trk->dcaTrack.sigYloc;
78 if(sY>cut_sigY)
return;
81 hA[4]->Fill(trk->dcaTrack.sigZ);
87 void Vertex3D::doExtrapolation()
89 #if 0 // Looks like this function is doing nothing
90 for(
unsigned int i=0;i<
track.size();i++) {
93 if( fabs(tr->
getChi2()-1.)>0.8)
continue;
99 if( fabs(tr->
getPt())<1.)
continue;
107 float minLx=9999, maxLx=0.;
108 for (;tNode!=eNode;++tNode){
110 if(!node->isValid())
continue;
112 StiHit *stiHit = node->getHit();
113 if (!stiHit)
continue;
115 if (node->getChi2()>1000)
continue;
116 if (!node->isFitted())
continue;
121 float sLy=sqrt(node->fitErrs()._cYY);
122 float sLz=sqrt(node->fitErrs()._cZZ);
123 float Rxy=sqrt(Lx*Lx+Ly*Ly);
124 if(minLx>Lx) minLx=Lx;
125 if(maxLx<Lx) maxLx=Lx;
126 printf(
"iN=%d Lx=%.2f Ly=%.2f %.2f Lz=%.2f %.2f Rxy=%.1f gX=%.2f gY=%.2f \n",iN,Lx,Ly,sLy,Lz,sLz,Rxy,node->x_g(),node->y_g());
127 printf(
"TTm %.2f %.2f %.3f %.2f %.3f %f\n",node->x_g(),node->y_g(),sLy,node->z_g(),sLz,node->getAlpha());
131 for(
int iDir=0;iDir<2;iDir++) {
132 if(iDir==0) printf(
"extrapolate track toward vertex, innLx=%.1f\n",minLx);
133 if(iDir==1) printf(
"extrapolate track toward BSMD, outLx=%.1f\n",maxLx);
134 for(
int iI=0;iI<17;iI++) {
140 ret=node->
propagate(Lx,kCylindrical,kOutsideIn);
142 Lx=maxLx+iI*2;
if(Lx>250)
break;
144 ret=node->
propagate(Lx,kCylindrical,kInsideOut);
146 if(iI==0)cout<<
"TT track extrap node:"<< *node;
147 if(ret<0) {printf(
"prop in x=%f ret=%d, skip\n",Lx,ret);
continue;}
150 if(fabs(Ly)>40.)
break;
151 if(iDir==1 && fabs(Ly)>36.)
break;
152 node->propagateError();
153 float sLy=sqrt(node->fitErrs()._cYY);
154 float sLz=sqrt(node->fitErrs()._cZZ);
155 printf(
"%diN=%d Lx=%.2f Ly=%.2f %.2f Lz=%.2f %.2f gX=%.2f gY=%.2f\n",iDir,iI,Lx,Ly,sLy,Lz,sLz,node->x_g(),node->y_g());
156 printf(
"TT%d %.2f %.2f %.3f %.2f %.3f %f\n",iDir,node->x_g(),node->y_g(),sLy,node->z_g(),sLz,node->getAlpha());
168 Vertex3D::study(TVector3 r,
int eveID){
172 hA[1]->Fill(
track.size());
173 dumpPrimTracks4beamLine(Z0, eveID);
176 if (
track.size()<cut_numTrack)
return;
181 TList *Lyx= hYX[nHE]->GetListOfFunctions();
182 TList *Lyz= hYZ[nHE]->GetListOfFunctions();
187 for(
unsigned int i=0;i<
track.size();i++) {
189 float sig=tr.sigYloc;
197 float pyz=sqrt(py*py+pz*pz);
203 int width=int(3.* (0.2*0.2)/sig/sig);
207 ar=
new TArrow(x-ux,y-uy,x+ux,y+uy,head,
"|>");
208 ar->SetLineColor(kBlue); ar->SetLineWidth(width); Lyx->Add(ar);
210 ar=
new TArrow(z-vz,y-vy,z+vz,y+vy,head,
"|>");
211 ar->SetLineColor(kMagenta);ar->SetLineWidth(width); Lyz->Add(ar);
217 el=
new TEllipse(r.x(),r.y(),Rel,Rel); el->SetLineColor(kRed);el->SetLineStyle(2);
219 el=
new TEllipse(r.z(),r.y(),Rel,Rel); el->SetLineColor(kBlack);el->SetLineStyle(2);
223 St_DataSet *gds=StMaker::GetChain()->GetDataSet(
"geant");
225 St_g2t_vertex *g2t_ver=( St_g2t_vertex *)gds->
Find(
"g2t_vertex");
227 g2t_vertex_st *GVER= g2t_ver->GetTable();
228 float *GV=GVER->ge_x;
229 printf(
"#GGVER x=%.1f y=%.1f z=%.1f ",GV[0],GV[1],GV[2]);
232 el=
new TEllipse(GV[0],GV[1],Rel,Rel); el->SetLineColor(kRed);
235 el=
new TEllipse(GV[2],GV[1],Rel,Rel); el->SetLineColor(kBlack);
241 char tt[1000]; sprintf(tt,
"%s, mxPt=%.1f GeV/c",hYX[nHE]->GetTitle(), mxPt);
242 hYX[nHE]->SetTitle(tt);
245 sprintf(tt,
"%s, eveID=%d",hYZ[nHE]->GetTitle(), eveID);
246 hYZ[nHE]->SetTitle(tt);
249 hYZ[nHE]->GetXaxis()->Set(2,Z0-3,Z0+3);
256 void Vertex3D::dumpPrimTracks4beamLine(
float z0,
int eveID)
260 for(
unsigned int i=0;i<
track.size();i++) {
269 printf(
"track4beamLine %f %f %f %f %f %f %f %f %f %d %f %.1f %d \n",x,y,z,px,py,pz,er->_cYY,er->_cZY,er->_cZZ , tr.nFitPoint,tr.gChi2,z0,eveID);
277 Vertex3D::trackChi2QA(
float z0) {
278 for(
unsigned int i=0;i<
track.size();i++) {
280 float chi2dof=tr.gChi2;
281 hA[10]->Fill(chi2dof);
282 hA[11]->Fill(chi2dof,1./tr.gP.Pt());
283 hA[12]->Fill(chi2dof,tr.gP.Eta());
284 hA[13]->Fill(chi2dof,z0);
285 hA[14]->Fill(chi2dof,tr.nFitPoint);
286 hA[15]->Fill(chi2dof,tr.gP.Phi());
294 Vertex3D:: initHisto (TObjArray*HList){
295 TList *L=0; TLine *ln=0;
float yMax=1e6; TH1* h=0;
297 memset(hA,0,
sizeof(hA));
300 hA[0]=
new TH1F(
"v3D_myStat",
"3DVF my statistics;cases",15,0.5,15.5);
301 hA[1]=h=
new TH1F(
"v3D_inTr",
"# of input tracks, 3DVF; # of tracks",30,-0.5,29.5);
302 ln=
new TLine(cut_numTrack-0.5,0,cut_numTrack-0.5,yMax);
303 ln->SetLineColor(kRed); ln->SetLineStyle(2);
304 L= h->GetListOfFunctions(); L->Add(ln);
306 hA[2]=h=
new TH1F(
"v3D_inPt",
"PT , input tracks 3DVF; global PT (GeV) ",100,0,25);
307 L= h->GetListOfFunctions();
308 ln=
new TLine(cut_pT1,0,cut_pT1,yMax);
309 ln->SetLineColor(kRed); ln->SetLineStyle(2); L->Add(ln);
310 ln=
new TLine(cut_pT2,0,cut_pT2,yMax);
311 ln->SetLineColor(kRed); ln->SetLineStyle(2); L->Add(ln);
313 hA[3]=h=
new TH1F(
"v3D_inSigY",
"sig(Yloc) @DCA , input tracks 3DVF; sig(Ylocal) (cm) ",30,0,1.2);
314 ln=
new TLine(cut_sigY,0,cut_sigY,yMax);
315 ln->SetLineColor(kRed); ln->SetLineStyle(2);
316 L= h->GetListOfFunctions(); L->Add(ln);
319 hA[4]=
new TH1F(
"v3D_inSigZ",
"sig(Z) @DCA , input tracks 3DVF; sig(Z) (cm) ",30,0,1.5);
321 hA[5]=
new TH1F(
"v3D_myStat2",
"3DVF track extrapolaton statistics;cases",15,0.5,15.5);
324 hA[10]=
new TH1F(
"v3D_chi1",
"#chi2/DOF best prim track candidates; #chi^{2}/DOF", 100,0,5);
325 hA[11]=
new TH2F(
"v3D_chi2",
"#chi2(1/PT) best prim track candidates; #chi^{2}/DOF; 1GeV/PT ", 30,0,3,30,0,2);
326 hA[12]=
new TH2F(
"v3D_chi3",
"#chi2(eta) best prim track candidates; #chi^{2}/DOF; eta ", 30,0,3,30,-2,2);
327 hA[13]=
new TH2F(
"v3D_chi4",
"#chi2(zVert) best prim track candidates; #chi^{2}/DOF; zVertex(cm) ", 30,0,3,30,-150,150);
328 hA[14]=
new TH2F(
"v3D_chi5",
"#chi2(nFitPoints) best prim track candidates; #chi^{2}/DOF; nFitPoints ", 30,0,3,25,0,50);
329 hA[15]=
new TH2F(
"v3D_chi6",
"#chi2(phi) best prim track candidates; #chi^{2}/DOF; #phi (rad) ", 30,0,3,30,-3.2,3.2);
331 for(
int i=0;i<mxHA;i++)
332 if(hA[i]) HList->Add(hA[i]);
336 memset(hYX,0,
sizeof(hYX));
337 memset(hYZ,0,
sizeof(hYZ));
341 for(
int i=0;i<mxHE;i++) {
342 char tt1[100], tt2[1000];
343 sprintf(tt1,
"v3D_eve%dYX",i);
344 sprintf(tt2,
"Y-X glob tracks at DCA, ieve=%d; X (cm); Y(cm); ",i);
345 hYX[i]=
new TH2F(tt1,tt2,2,-mxR1,mxR1,2,-mxR1,mxR1);
348 sprintf(tt1,
"v3D_eve%dYZ",i);
349 sprintf(tt2,
"Y-Z glob tracks at DCA, ieve=%d; Z (cm); Y(cm); ",i);
350 hYZ[i]=
new TH2F(tt1,tt2,2,-mxR1,mxR1,2,-mxR1,mxR1);
int propagate(StiKalmanTrackNode *p, const StiDetector *tDet, int dir)
Propagates a track encapsulated by the given node "p" to the given detector "tDet".
Definition of Kalman Track.
approximtion of track as stright line @ DCA to beamLine=0,0
StiKalmanTrackNode * getOuterMostNode(int qua=0) const
Accessor method returns the outer most node associated with the track.
int getFitPointCount(int detectorId=0) const
Returns the number of hits associated and used in the fit of this track.
StiKalmanTrackNode * getInnerMostNode(int qua=0) const
Accessor method returns the inner most node associated with the track.
double getCurvature() const
Return the curvature of the track at its inner most point.
double getPseudoRapidity() const
Return the pseudorapidity of the track.
double getPhi() const
Return azimuthal angle at inner most point of the track.
virtual TDataSet * Find(const char *path) const
double getPt() const
Calculates and returns the transverse momentum of the track at the inner most node.