3 #include <St_base/StMessMgr.h>
18 #include <StBFChain/StBFChain.h>
19 #include <tables/St_g2t_vertex_Table.h>
21 #include "StGenericVertexMaker/StiPPVertex/Vertex3D.h"
26 Vertex3D::Vertex3D() {
33 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;
38 Vertex3D::~Vertex3D(){
44 Vertex3D::clearEvent(){
55 Vertex3D::clearTracks(){
67 if( !trk->mTpc && !trk->mBtof && !trk->mCtb && !trk->mBemc && trk->mEemc )
return;
71 float pt=trk->dcaTrack.gP.Pt();
73 if (pt <cut_pT1)
return;
75 if (pt >cut_pT2)
return;
78 float sY=trk->dcaTrack.sigYloc;
80 if(sY>cut_sigY)
return;
83 hA[4]->Fill(trk->dcaTrack.sigZ);
90 Vertex3D::doExtrapolation(){
91 for(
unsigned int i=0;i<
track.size();i++) {
94 if( fabs(tr->
getChi2()-1.)>0.8)
continue;
100 if( fabs(tr->
getPt())<1.)
continue;
111 float minLx=9999, maxLx=0.;
112 for (;tNode!=eNode;++tNode){
114 if(!node->isValid())
continue;
116 StiHit *stiHit = node->getHit();
117 if (!stiHit)
continue;
119 if (node->getChi2()>1000)
continue;
120 if (!node->isFitted())
continue;
125 float sLy=sqrt(node->fitErrs()._cYY);
126 float sLz=sqrt(node->fitErrs()._cZZ);
127 float Rxy=sqrt(Lx*Lx+Ly*Ly);
128 if(minLx>Lx) minLx=Lx;
129 if(maxLx<Lx) maxLx=Lx;
130 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());
131 printf(
"TTm %.2f %.2f %.3f %.2f %.3f %f\n",node->x_g(),node->y_g(),sLy,node->z_g(),sLz,node->getAlpha());
135 for(
int iDir=0;iDir<2;iDir++) {
136 if(iDir==0) printf(
"extrapolate track toward vertex, innLx=%.1f\n",minLx);
137 if(iDir==1) printf(
"extrapolate track toward BSMD, outLx=%.1f\n",maxLx);
138 for(
int iI=0;iI<17;iI++) {
144 ret=node->
propagate(Lx,kCylindrical,kOutsideIn);
146 Lx=maxLx+iI*2;
if(Lx>250)
break;
148 ret=node->
propagate(Lx,kCylindrical,kInsideOut);
150 if(iI==0)cout<<
"TT track extrap node:"<< *node;
151 if(ret<0) {printf(
"prop in x=%f ret=%d, skip\n",Lx,ret);
continue;}
154 if(fabs(Ly)>40.)
break;
155 if(iDir==1 && fabs(Ly)>36.)
break;
156 node->propagateError();
157 float sLy=sqrt(node->fitErrs()._cYY);
158 float sLz=sqrt(node->fitErrs()._cZZ);
159 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());
160 printf(
"TT%d %.2f %.2f %.3f %.2f %.3f %f\n",iDir,node->x_g(),node->y_g(),sLy,node->z_g(),sLz,node->getAlpha());
171 Vertex3D::study(TVector3 r,
int eveID){
175 hA[1]->Fill(
track.size());
176 dumpPrimTracks4beamLine(Z0, eveID);
179 if (
track.size()<cut_numTrack)
return;
184 TList *Lyx= hYX[nHE]->GetListOfFunctions();
185 TList *Lyz= hYZ[nHE]->GetListOfFunctions();
190 for(
unsigned int i=0;i<
track.size();i++) {
192 float sig=tr.sigYloc;
200 float pyz=sqrt(py*py+pz*pz);
206 int width=int(3.* (0.2*0.2)/sig/sig);
210 ar=
new TArrow(x-ux,y-uy,x+ux,y+uy,head,
"|>");
211 ar->SetLineColor(kBlue); ar->SetLineWidth(width); Lyx->Add(ar);
213 ar=
new TArrow(z-vz,y-vy,z+vz,y+vy,head,
"|>");
214 ar->SetLineColor(kMagenta);ar->SetLineWidth(width); Lyz->Add(ar);
220 el=
new TEllipse(r.x(),r.y(),Rel,Rel); el->SetLineColor(kRed);el->SetLineStyle(2);
222 el=
new TEllipse(r.z(),r.y(),Rel,Rel); el->SetLineColor(kBlack);el->SetLineStyle(2);
226 St_DataSet *gds=StMaker::GetChain()->GetDataSet(
"geant");
228 St_g2t_vertex *g2t_ver=( St_g2t_vertex *)gds->
Find(
"g2t_vertex");
230 g2t_vertex_st *GVER= g2t_ver->GetTable();
231 float *GV=GVER->ge_x;
232 printf(
"#GGVER x=%.1f y=%.1f z=%.1f ",GV[0],GV[1],GV[2]);
235 el=
new TEllipse(GV[0],GV[1],Rel,Rel); el->SetLineColor(kRed);
238 el=
new TEllipse(GV[2],GV[1],Rel,Rel); el->SetLineColor(kBlack);
244 char tt[1000]; sprintf(tt,
"%s, mxPt=%.1f GeV/c",hYX[nHE]->GetTitle(), mxPt);
245 hYX[nHE]->SetTitle(tt);
248 sprintf(tt,
"%s, eveID=%d",hYZ[nHE]->GetTitle(), eveID);
249 hYZ[nHE]->SetTitle(tt);
252 hYZ[nHE]->GetXaxis()->Set(2,Z0-3,Z0+3);
260 Vertex3D::dumpPrimTracks4beamLine(
float z0,
int eveID) {
261 for(
unsigned int i=0;i<
track.size();i++) {
270 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);
StiKalmanTrackNode * getInnOutMostNode(int inot, int qua) const
Same for getNNodes(qua)
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.
Definition of Kalman 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.