示例#1
0
文件: swtrack.cpp 项目: krafczyk/AMS
void SWTrack::updateEvent(AMSEventR *event)
{
  rEvent = event;

  int mf0 = TrTrackR::DefaultFitID;

  int mfit[NPAR] = { mf0, mf0 | TrTrackR::kFitLayer8,
		          mf0 | TrTrackR::kFitLayer9,
		          mf0 | TrTrackR::kFitLayer8 | TrTrackR::kFitLayer9 };

  for (int i = 0; i < NLAY; i++) lyrSta[i] = 0;
  for (int i = 0; i < NPAR; i++) fitPar[i] = 0;

  TrTrackR *trk;
  for (int t = tID; t >= 0; t--) {
    trk = rEvent->pTrTrack(t);
    if (trk) {
      tID = t;
      break;
    }
  }
  if (!trk) return;

  for (int i = 0; i < NPAR; i++)
    if (trk->ParExists(mfit[i])) fitPar[i] = mfit[i];

  if (fID < 0 || !trk->ParExists(mfit[fID])) {
    for (int i = 0; i < NPAR; i++)
      if (trk->ParExists(mfit[i])) {
	fID = i;
	break;
      }
  }
  if (fID < 0) return;

  for (int i = 0; i < trk->GetNhits(); i++) {
    TrRecHitR *hit = trk->GetHit(i);
    int ily = hit->GetLayer()-1;
    if (hit->OnlyY()) lyrSta[ily] = LSTA_HITY;
    else lyrSta[ily] = LSTA_HITT;
  }

  for (int i = 0; i < NLAY; i++) {
    if (lyrSta[i] == 0) {
      AMSPoint pnt;
      AMSDir dir;
      trk->Interpolate(TkDBc::Head->GetZlayer(i+1), pnt, dir);
      TkSens sens(pnt, 0);
      lyrSta[i] = sens.GetLadTkID();
    }
  }
}
示例#2
0
文件: swladder.cpp 项目: krafczyk/AMS
void SWLadder::fillTrkVec()
{
  nTrk = 0;

  int layer = abs(tkID)/100;
  for (int i = 0; rEvent && i < rEvent->nTrTrack(); i++) {
    TrTrackR *trk = rEvent->pTrTrack(i);
    if (!trk) continue;

    int hid = -1;
    for (int j = 0; j < trk->GetNhits(); j++) {
      TrRecHitR *hit = trk->GetHit(j);
      if (!hit) continue;
      if (hit->GetLayer() == layer) {
	hid = j;
	if (hit->GetTkId() != tkID) continue;
	for (int k = 0; k < drawObj.size(); k++) {
	  if ((drawObj[k].atrb & ATR_TRK) &&
	      rEvent->pTrRecHit(drawObj[k].idx) == hit)
	    drawObj[k].atrb |= ATR_TRID*(i+1);
	}
      }
    }
    if (hid >= 0) continue;

    AMSPoint pnt;
    AMSDir dir;
    trk->Interpolate(TkDBc::Head->GetZlayer(layer), pnt, dir);
    TkSens sens(pnt, 0);
    if (sens.GetLadTkID() != tkID) continue;

    double sax = TkDBc::Head->_ssize_active[0];
    double say = TkDBc::Head->_ssize_active[1];

    DrawObj dobj;    
    dobj.idx  = i;
    dobj.mult = sens.GetMultIndex();
    dobj.col1 = Qt::yellow;
    dobj.col2 = Qt::darkYellow;
    dobj.atrb = ATR_TRK | ATR_TRID*(i+1);
    dobj.x = SEN_SX*sens.GetSensCoo().x()/sax+SEN_DX*sens.GetSensor();;
    dobj.y = SEN_SY-SEN_SY*sens.GetSensCoo().y()/say;
    drawObj.push_back(dobj);

    nTrk++;
  }
}