Example #1
0
QString &InfoText::TrackInfo(AMSEventR *event, int itrk)
{
  static QString str;
  str = "";

  if (!event) return str;

  TrTrackR *trk = event->pTrTrack(itrk);
  if (!trk) return str;

  int id1 = TrTrackR::kChoutko;
  int id2 = TrTrackR::kChoutko+TrTrackR::kMultScat;
  if (!trk->ParExists(id1)) id1 = TrTrackR::kLinear;
  if (!trk->ParExists(id2)) id2 = id1;
  if (!trk->ParExists(id1)) return str;

  int fpat[8];
  for (int i = 0; i < 8; i++) fpat[i] = 0;
  for (int i = 0; i < trk->GetNhits(); i++) {
    TrRecHitR *hit = trk->GetHit(i);
    int ily = hit->GetLayer()-1;
    if (hit->OnlyY()) fpat[ily] = 1;
    else fpat[ily] = 2;
  }
  TString spat;
  for (int i = 0; i < 8; i++) {
    if (fpat[i] == 0) spat += "_";
    if (fpat[i] == 1) spat += "Y";
    if (fpat[i] == 2) spat += "O";
  }

  str += Form("Track[%d]\n", itrk);
  str += Form("  nHit: %d\n",    trk->GetNhits());
  str += Form("  nHitXY: %d\n",  trk->GetNhitsXY());
  str += Form("  Pattern: %d [%s]\n", trk->GetPattern(), spat.Data());
  str += "\n";
  str += Form("  Rigidity (noMS): %.2f\n", trk->GetRigidity(id1));
  str += Form("  Rigidity (Fast): %.2f\n", trk->GetRigidity(id2));
  str += Form("   errRinv (Fast): %.2f\n", trk->GetErrRinv (id2));
  str += "\n";
  str += Form("  Chi2Fast:    %.2f\n",     trk->GetChisq   (id2));
  str += Form("    Chi2X/Ndf: %.2f/%d\n",  trk->GetChisqX  (id2), 
	                                  trk->GetNdofX   (id2));
  str += Form("    Chi2Y/Ndf: %.2f/%d\n",  trk->GetChisqY  (id2), 
	                                  trk->GetNdofY   (id2));
  str += "\n";
  str += Form("  P0:    (%.2f, %.2f, %.2f)\n",  
	      trk->GetP0x(id2), trk->GetP0y(id2), trk->GetP0z(id2));
  str += Form("  th/ph: (%.1f, %.1f)\n",  
	      trk->GetTheta(id2)*TMath::RadToDeg(),
	      trk->GetPhi  (id2)*TMath::RadToDeg());

  for (int i = 0; i < trk->GetNhits(); i++) {
    TrRecHitR *hit = trk->GetHit(i);
    if (!hit) continue;
    int lay = hit->GetLayer();
    str += Form("\nHit[%d]\n  ", i);
    str += hit->Info(i);
    str += Form("Residual: %.4f %.4f\n", trk->GetResidualO(lay).x(),
		                         trk->GetResidualO(lay).y());
  }

  return str;
}
Example #2
0
void SWTrack::drawInfobar(QPainter *pnt)
{
  pnt->fillRect(QRect(0, 0, wWid-2, tHei), QColor(0, 0, 0, 200));
  drawButtons(pnt);

  TrTrackR *trk = rEvent->pTrTrack(tID);
  if (!trk) return;

  int mfit = (0 <= fID && fID < NPAR) ? fitPar[fID] : 0;
  if (mfit <= 0) return;

  TString hpat;
  for (int i = 0; i < NLAY; i++) {
    if      (lyrSta[i] == LSTA_HITY) hpat += "Y";
    else if (lyrSta[i] == LSTA_HITT) hpat += "O";
    else                             hpat += "_";
  }

  pnt->setPen(Qt::white);
  drawText(pnt,  28, 10, Form("Track [%d]", tID));
  drawText(pnt, 100, 10, Form("nHit: %d",    trk->GetNhits()));
  drawText(pnt, 170, 10, Form("nHitXY: %d",  trk->GetNhitsXY()));
  drawText(pnt, 270, 10, Form("fPat: %s",  hpat.Data()));
  drawText(pnt,  28, 30, Form("Fit %d", fitPar[fID]));
  drawText(pnt, 100, 30, Form("chi2/Ndf (X): %.2f/%d", 
			      trk->GetChisqX(mfit), trk->GetNdofX(mfit)));
  drawText(pnt, 270, 30, Form("chi2/Ndf (Y): %.2f/%d", 
			      trk->GetChisqY(mfit), trk->GetNdofY(mfit)));
  drawText(pnt, 100, 50, Form("rigidity: %.2f", trk->GetRigidity(mfit)));
  drawText(pnt, 270, 50, Form("errRinv: %.2f",  trk->GetErrRinv(mfit)));

  int ifc = focusStatus/FOCUS_DOBJ/2-1;
  if ((focusStatus & FOCUS_DOBJ) && ifc >= 0) {
    int iht = getFocusHid();
    TrRecHitR *hit = trk->GetHit(iht);

    if (hit) {
      char cf1 = (hit->OnlyY()) ? 'G' : '_';
      char cf2 = (hit->checkstatus(AMSDBc::USED)) ? 'T' : '_';

      int lay = hit->GetLayer();
      drawText(pnt,  40, 70, Form("Hit [%d]", iht));
      drawText(pnt,  90, 70, Form("TkID: %d", hit->GetTkId()));
      drawText(pnt, 180, 70, Form("Flag: %c%c", cf1, cf2));
      drawText(pnt, 250, 70, Form("Residual: %.4f %.4f", 
				  trk->GetResidualO(lay, mfit).x(),
				  trk->GetResidualO(lay, mfit).y()));
    }
    else if (abs(lyrSta[ifc]) > 10) {
      int tkid = lyrSta[ifc];

      int nclx = 0, ncly = 0, nhit = 0, nhtt = 0, nhtg = 0;
      for (int i = 0; rEvent && i < rEvent->nTrCluster(); i++) {
	TrClusterR *cls = rEvent->pTrCluster(i);
	if (!cls || cls->GetTkId() != tkid) continue;
	if (cls->GetSide() == 0) nclx++; 
	else ncly++;
      }
      for (int i = 0; rEvent && i < rEvent->nTrRecHit(); i++) {
	TrRecHitR *hit = rEvent->pTrRecHit(i);
	if (!hit || hit->GetTkId() != tkid) continue;
	nhit++;
	if (hit->checkstatus(AMSDBc::USED)) nhtt++;
	else if (hit->OnlyY()) nhtg++;
      }

      drawText(pnt,  40, 70, "Ladder");
      drawText(pnt,  90, 70, Form("TkID: %d", tkid));
      drawText(pnt, 170, 70, Form("nClsX/Y: %d/%d", nclx, ncly));
      drawText(pnt, 270, 70, Form("nHit/T/G: %d/%d/%d", nhit, nhtt, nhtg));
    }
  }
}
Example #3
0
QString &InfoText::EventInfo(AMSEventR *event)
{
  static QString str;

  str = "";
  if (!event) return str;

  QDateTime qdt;
  qdt.setTime_t(event->fHeader.Time[0]);

  int num[8][2];

  time_t *tt = (time_t*)event->fHeader.Time;
  str += Form("Run: %10d\nEvent: %7d\n"
	      "FineTime: %d\nTime: %s\n"
	      "TimeDiff: %d\n\n"
	      "nRawClusters: %3d\nnClusters: %3d\n"
	      "nRecHits: %3d\nnTracks: %3d\n",
	      event->Run(),  event->Event(), 
	      event->fHeader.Time[1], //ctime(tt),
	      qdt.toLocalTime().toString(Qt::SystemLocaleShortDate)
	         .toAscii().data(),
	      event->pLevel1()->TrigTime[4], 
	      event->nTrRawCluster(), event->nTrCluster(), 
	      event->nTrRecHit(), event->nTrTrack());

  str += "Tracks:\n";
  for (int i = 0; i < event->nTrTrack(); i++) {
    TrTrackR *trk = event->pTrTrack(i);
    if (!trk) continue;

    str += Form(" nHit: %d nHitXY: %d", trk->GetNhits(), trk->GetNhitsXY());
    str += Form(" Rigidity : %.2f", trk->GetRigidity());
    str += Form(" Chi2: %.2f\n", trk->GetChisq());
  }

  for (int i = 0; i < 8; i++) num[i][0] = num[i][1]=0;
  str += "RawClusters:\n";

  for (int i = 0; i < event->nTrRawCluster(); i++){
    TrRawClusterR *cc = event->pTrRawCluster(i);
    if (cc) num[cc->GetLayer()-1][cc->GetSide()]++; 
  }
  for (int i = 0; i < 8; i++)
    str += Form("Layer %d:    S: %3d    K: %3d  \n",
		i+1, num[i][0], num[i][1]);  
  str += "\n";

  for (int i = 0; i < 8; i++) num[i][0] = num[i][1]=0;
  str += "Clusters:\n";

  for (int i = 0; i < event->nTrCluster(); i++){
    TrClusterR* cc = event->pTrCluster(i);
    if (cc) num[cc->GetLayer()-1][cc->GetSide()]++; 
  }

  for (int i = 0; i < 8; i++)
    str += Form("Layer %d:    S: %3d    K: %3d  \n",
		i+1, num[i][0],num[i][1]);  
  str += "\n";

  for (int i = 0; i < 8; i++) num[i][0] = num[i][1]=0;
  str += "RecHits:\n";
  
  for (int i = 0; i< event->nTrRecHit(); i++){
    TrRecHitR* cc = event->pTrRecHit(i);
    if (cc) num[cc->GetLayer()-1][0]++; 
  }
  
  for (int i = 0; i < 8; i++)
    str += Form("Layer %d:     %3d     \n", i+1, num[i][0]);  

  return str;
}
Example #4
0
void SWLadder::drawInfobar(QPainter *pnt)
{
  pnt->fillRect(0, 0, wWid-2, tHei, QColor(0, 0, 0, 200));
  drawClose(pnt);
  drawMore (pnt);

  pnt->setPen(Qt::white);
  drawText(pnt,  28, 10, "Ladder");
  drawText(pnt,  80, 10, Form(" TkID: %d", tkID));
  drawText(pnt, 170, 10, Form("nClsX: %d", nClsX));
  drawText(pnt, 240, 10, Form("nClsY: %d", nClsY));
  drawText(pnt,  78, 30, Form(" nSen: %d", nSen ));
  drawText(pnt, 175, 30, Form(" nHit: %d", nHit ));
  drawText(pnt, 241, 30, Form("nHitT: %d", nHitT));
  drawText(pnt, 310, 30, Form("nHitG: %d", nHitG));

  if (focusStatus & FOCUS_DOBJ) {
    DrawObj dobj = drawObj.at(focusStatus/FOCUS_DOBJ/2-1);
    if ((dobj.atrb & ATR_CLSX) || (dobj.atrb & ATR_CLSY)) {
      TrClusterR *cls = rEvent->pTrCluster(dobj.idx);
      double sig = cls->GetTotSignal(TrClusterR::kAsym);
      drawText(pnt,  27, 50, Form("Cluster    Side: %d", cls->GetSide()));
      drawText(pnt, 140, 50, Form("Seed: %d", cls->GetAddress()
				             +cls->GetSeedIndex()));
      drawText(pnt, 220, 50, Form("Len: %d",  cls->GetLength()));
      drawText(pnt, 270, 50, Form("Signal: %.0f", sig));
      if (dobj.atrb & ATR_CLSX)
	drawText(pnt, 350, 50, Form("Mult: %d", dobj.mult));
    }
    else if (dobj.atrb & ATR_HIT) {
      TrRecHitR *hit = rEvent->pTrRecHit(dobj.idx);
      char cf1 = (hit->OnlyY()) ? 'G' : '_';
      char cf2 = (hit->checkstatus(AMSDBc::USED)) ? 'T' : '_';
      AMSPoint coo = hit->GetCoord(dobj.mult);
      drawText(pnt,  48, 50, Form("Hit     Flag: %c%c", cf1, cf2));
      drawText(pnt, 150, 50, Form("Coo: (%.2f, %.2f, %.2f)",
				  coo.x(), coo.y(), coo.z()));
      drawText(pnt, 350, 50, Form("Mult: %d",   dobj.mult));
    }
    else if (dobj.atrb & ATR_TRK) {
      TrTrackR *trk = rEvent->pTrTrack(dobj.idx);
      int fpat[8];
      for (int i = 0; i < 8; i++) fpat[i] = 0;

      TString hpat;
      for (int i = 0; i < trk->GetNhits(); i++) {
	TrRecHitR *hit = trk->GetHit(i);
	int ily = hit->GetLayer()-1;
	fpat[ily] = (hit->OnlyY()) ? 1 : 2;
      }
      for (int i = 0; i < 8; i++) {
	if      (fpat[i] == 1) hpat += "Y";
	else if (fpat[i] == 2) hpat += "O";
	else                   hpat += "_";
      }

      drawText(pnt,  48, 50, "Track");
      drawText(pnt, 100, 50, Form("nHit: %d",   trk->GetNhits()));
      drawText(pnt, 170, 50, Form("nHitXY: %d", trk->GetNhitsXY()));
      drawText(pnt, 270, 50, Form("fPat: %s",   hpat.Data()));
    }
  }
}