Example #1
0
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();
    }
  }
}
Example #2
0
int SWTrack::getFocusHid()
{
  int ifc = focusStatus/FOCUS_DOBJ/2-1;
  if (!(focusStatus & FOCUS_DOBJ) || ifc < 0) return -1;

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

  for (int i = 0; i < trk->GetNhits(); i++) {
    TrRecHitR *hit = trk->GetHit(i);
    if (hit && hit->GetLayer()-1 == ifc) return i;
  }

  return -1;
}
Example #3
0
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++;
  }
}
Example #4
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 #5
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 #6
0
File: trcls.C Project: krafczyk/AMS
void trcls(const char *fname, const char *oname, const char *tkdbc)
{
  AMSChain ch;
  TString sfn = fname;
  if (!sfn.Contains(".root")) sfn += "*.root";
  if (ch.Add(sfn) <= 0) return;

  Int_t ntr  = ch.GetNtrees();
  Int_t nent = ch.GetEntries();
  if (ntr <= 0 || nent <= 0) return;

  cout << "Ntr,Nent= " << ntr << " " << nent << endl;

  for (Int_t i = 0; i < ntr; i++)
    cout << ch.GetListOfFiles()->At(i)->GetTitle() << endl;

  Int_t   idata[13];
  Float_t fdata[28];

  TFile of(oname, "recreate");
  TTree *tree = new TTree("tree", "trcls");
  tree->Branch("idata", idata, "run/I:event/I:ient/I:time/I:tkml[9]/I");
  tree->Branch("fdata", fdata, "engc/F:enge/F:rgt/F:chrg/F:"
	                       "p0x/F:p0y/F:dzx/F:dzy/F:csqx/F:csqy/F:"
	                       "xcog[9]/F:ycog[9]/F");

  if (tkdbc && tkdbc[0] && tkdbc[0] != '0') {
    ch.GetEvent(0);
    TkDBc::Head->init(3, tkdbc);
  }
  TrExtAlignDB::OverLoadFlag = 0;

  Int_t malg = 2; // kAlcaraz | kMultScat
  Int_t pat0 = 3; // Inner only

  Int_t nevt = 0;
  Int_t nrsl = 0;
  Int_t npsl = 0;
  Int_t nfil = 0;
  Int_t intv = 10000;

  signal(SIGTERM, handler);
  signal(SIGINT,  handler);

  TStopwatch timer;
  timer.Start();

  for (Int_t ient = 0; ient < nent && !SigTERM; ient++) {
    AMSEventR *evt = ch.GetEvent(ient);
    nevt++;

    if (nevt%intv == 0 || nevt == nent) {
      Double_t tm = timer.RealTime();
      timer.Continue();
      cout << Form("%6d %6d %6d %7d (%5.1f%%) %4.0f sec (%4.1f kHz)",
		   nrsl, npsl, nfil, nevt,
		   100.*nevt/nent, tm, nevt/tm*1e-3)
	   << endl;
    }
    if (evt->nTrRecHit() >= 1600) continue;
    if (evt->nTrTrack () !=    1) continue;

    TrTrackR *trk = evt->pTrTrack(0);
    if (!trk) continue;

    Double_t chgp = TrCharge::GetQ(trk, 1);
    Double_t chgn = TrCharge::GetQ(trk, 0);
    if (chgp <= 0 || chgn <= 0) continue;

    Int_t mfp = trk->iTrTrackPar(malg, pat0, 0);
    if (mfp < 0) continue;

    Double_t rgtp = trk->GetRigidity(mfp);
    if (TMath::Abs(rgtp) < 5) continue;


    //////////////////// Recalc and refit ////////////////////
    trk->RecalcHitCoordinates();

    Int_t mf0 = trk->iTrTrackPar(malg, pat0, 2);
    if (mf0 < 0) continue;

    Double_t rgt0 = trk->GetRigidity(mf0);
    if (TMath::Abs(rgt0) < 10) continue;
    nrsl++;


    //////////////////// Pre-selection ////////////////////
    Bool_t psel = kTRUE;
    Int_t  span = (TrTrackSelection::GetSpanFlags(trk) & 0xff);
    if (!(span & TrTrackSelection::kMaxInt) ||
	!(span & TrTrackSelection::kAllPlane)) psel = kFALSE;

    if   (!(span & TrTrackSelection::kHalfL1N)) {
      if (!(span & TrTrackSelection::kHalfL9)) psel = kFALSE;

      AMSPoint pnt = trk->InterpolateLayerJ(9);
      if (TMath::Abs(pnt.x()) > 33) psel = kFALSE;
    }
    if (psel) npsl++;

    TrTrackR::AdvancedFitBits = 0x0f;

    TrRecon trec;
    Int_t nadd = trec.MergeExtHits(trk, mf0);
    if (!psel && nadd <= 0) continue;

    //////////////////// Remerge ////////////////////
    if (nadd > 0) {
      psel = kTRUE;
      span = (TrTrackSelection::GetSpanFlags(trk) & 0xff);
      if (!(span & TrTrackSelection::kMaxInt) ||
	  !(span & TrTrackSelection::kAllPlane)) psel = kFALSE;

      if   (!(span & TrTrackSelection::kHalfL1N)) {
	if (!(span & TrTrackSelection::kHalfL9)) psel = kFALSE;

	AMSPoint pnt = trk->InterpolateLayerJ(9);
	if (TMath::Abs(pnt.x()) > 33) psel = kFALSE;
      }
    }
    if (!psel) continue;

    idata[0] = evt->Run();
    idata[1] = evt->Event();
    idata[2] = ient;
    idata[3] = evt->fHeader.Time[0];

    EcalShowerR *ecal = evt->pEcalShower(0);
    fdata[0] = (ecal) ? ecal->EnergyC : 0;
    fdata[1] = (ecal) ? ecal->EnergyE : 0;
    fdata[2] = rgt0;
    fdata[3] = (chgp+chgn)/2;
    fdata[4] = trk->GetP0x(mf0);
    fdata[5] = trk->GetP0y(mf0);
    fdata[6] = trk->GetThetaXZ(mf0);
    fdata[7] = trk->GetThetaYZ(mf0);
    fdata[8] = trk->GetNormChisqX(mf0);
    fdata[9] = trk->GetNormChisqY(mf0);

    if (evt->nMCEventg() > 0) {
      MCEventgR *mcg = evt->pMCEventg(0);
      if (mcg) fdata[0] = mcg->Momentum;
    }

    Int_t   *tkml = &idata[ 4];
    Float_t *xcog = &fdata[10];
    Float_t *ycog = &fdata[19];
    for (Int_t i = 0; i < 9; i++) { tkml[i] = 0; xcog[i] = ycog[i] = 0; }

    for (Int_t i = 0; i < trk->GetNhits(); i++) {
      TrRecHitR *hit = trk->GetHit(i);
      if (!hit) continue;

      Int_t layer = hit->GetLayer();
      //if (layer != 8 && layer != 9) continue;

      Int_t il   = layer-1;//layer-8;
      Int_t tkid = hit->GetTkId();
      Int_t imlt = hit->GetResolvedMultiplicity();

      TrClusterR *clx = hit->GetXCluster();
      TrClusterR *cly = hit->GetYCluster();
      tkml[il] = TMath::Sign(imlt*1000+TMath::Abs(tkid), tkid);
      xcog[il] = (!clx) ? -(hit->GetDummyX()+640)
	       : clx->GetCofG()+clx->GetSeedAddress();
      ycog[il] = cly->GetCofG()+cly->GetSeedAddress();
    }

    tree->Fill();
    nfil++;
  }

  of.cd();
  tree->Write();
}
Example #7
0
void SWTrack::drawHits(QPainter *pnt)
{
  int *zly = (TkDBc::Head->GetSetup() == 3) ? &zLayer2[NLAY*lyrConf] : zLayer1;

  int zl1 = -200, zl2 = 200;
  for (int i = 0; i < NLAY; i++) {
    if (zly[i] > zl1) zl1 = zly[i];
    if (zly[i] < zl2) zl2 = zly[i];
  }

  int zl  = zl1-zl2;
  int px  = (wWid-zl)/2+LYR_PX+zl1;
  int py  = (wHei-tHei-LYR_H)/2+tHei+LYR_PY;
  int py1 = py+RES_H+LYR_D;
  int py2 = py-RES_H-LYR_D+LYR_H;
  int px1 = px-zl1-20;
  int px2 = px-zl2+20;

  int ifc = focusStatus/FOCUS_DOBJ/2-1;
  if (!(focusStatus & FOCUS_DOBJ)) ifc = -1;

  for (int i = 0; i < NLAY; i++) {
    if (zly[i] == 0) continue;
    pnt->setPen(QColor(100, 255, 200));
    pnt->drawLine(px-zly[i], py, px-zly[i], py+LYR_H);
    pnt->setPen((ifc == i) ? Qt::white : Qt::green);
    pnt->drawLine(px-zly[i]+1, py, px-zly[i]+1, py+LYR_H);
    pnt->setPen((ifc == i) ? Qt::gray : Qt::darkGreen);
    pnt->drawLine(px-zly[i]+2, py, px-zly[i]+2, py+LYR_H);

    pnt->setPen(Qt::green);
    drawText(pnt, px-zly[i]-3, py-17, Form("%d", i+1));
  }

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

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

  double rscx = 0.001, rscy = 0.001;

  int nhit = trk->GetNhits();

  for (int i = 0; i < nhit; i++) {
    TrRecHitR *hit = trk->GetHit(i);
    if (!hit) continue;

    int ily = hit->GetLayer()-1;
    if (zly[ily] == 0) continue;

    AMSPoint res = trk->GetResidualO(hit->GetLayer(), mfit);
    if (!hit->OnlyY() && abs(res.x()) > rscx) rscx = abs(res.x());
    if (!hit->OnlyX() && abs(res.y()) > rscy) rscy = abs(res.y());
  }

  rscx = (rscx < 0.005) ? (int)(rscx*2000)*0.0005 
       : (rscx < 1.000) ? (int)(rscx*200) *0.005
                        : (int)(rscx*20)  *0.05;
  rscy = (rscy < 0.005) ? (int)(rscy*2000)*0.0005 
       : (rscy < 1.000) ? (int)(rscy*200) *0.005
                        : (int)(rscy*20)  *0.05;

  int bx1, bx2, by1, by2;
  int n1 = 0, n2 = 0;

  int    idx[NLAY];
  double zht[NLAY];
  for (int i = 0; i < nhit; i++)
    zht[i] = trk->GetHit(i)->GetCoord().z();

  TMath::Sort(nhit, zht, idx);

  for (int i = 0; i < nhit; i++) {
    TrRecHitR *hit = trk->GetHit(idx[i]);
    int lay = hit->GetLayer();
    int ily = lay-1;
    if (zly[ily] == 0) continue;

    int x  = px-zly[ily];
    int y1 = py1-RES_H*trk->GetResidualO(lay, mfit).x()/rscx;
    int y2 = py2-RES_H*trk->GetResidualO(lay, mfit).y()/rscy;

    if (lyrSta[ily] == LSTA_HITT) {
      pnt->setPen(Qt::white);
      pnt->drawRect(x-3, y1-3, 6, 6);
      pnt->setPen((ifc == ily) ? Qt::darkGray : Qt::darkRed);
      pnt->drawRect(x-2, y1-2, 6, 6);
      pnt->fillRect(x-2, y1-2, 6, 6, 
		    (ifc == ily) ? QColor(Qt::gray) : QColor(Qt::red));

      if (n1++ > 0) {
	pnt->setPen(Qt::red);
	pnt->drawLine(bx1, by1, x, y1);
	pnt->setPen(Qt::darkRed);
	if (abs(x-bx1) > abs(y1-by1))
	  pnt->drawLine(bx1, by1+1, x, y1+1);
	else
	  pnt->drawLine(bx1+1, by1, x+1, y1);
      }
      bx1 = x;
      by1 = y1;
    }

    pnt->setPen(Qt::white);
    pnt->drawRect(x-3, y2-3, 6, 6);
    pnt->setPen((ifc == ily) ? Qt::darkGray : Qt::darkRed);
    pnt->drawRect(x-2, y2-2, 6, 6);
    pnt->fillRect(x-2, y2-2, 6, 6, 
		  (ifc == ily) ? QColor(Qt::gray) : QColor(Qt::red));

    if (n2++ > 0) {
      pnt->setPen(Qt::red);
      pnt->drawLine(bx2, by2, x, y2);
      pnt->setPen(Qt::darkRed);
      if (abs(x-bx2) > abs(y2-by2))
	pnt->drawLine(bx2, by2+1, x, y2+1);
      else
	pnt->drawLine(bx2+1, by2, x+1, y2);
    }
    bx2 = x;
    by2 = y2;
  }

  pnt->save();
  pnt->rotate(-90);
  pnt->setPen(QColor(255, 50, 50));
  drawText(pnt, -py1-14, px1-47, "ResX");
  drawText(pnt, -py2-14, px1-47, "ResY");
  drawText(pnt, -py1-20, px1-30, (rscx < 0.005) ? Form("%.0fum", rscx*2e4)
	                       : (rscx < 1.000) ? Form("%.1fmm", rscx*2e1)
	                                        : Form("%.1fcm", rscx*2));
  drawText(pnt, -py2-20, px1-30, (rscy < 0.005) ? Form("%.0fum", rscy*2e4)
	                       : (rscy < 1.000) ? Form("%.1fmm", rscy*2e1)
	                                        : Form("%.1fcm", rscy*2));
  pnt->restore();

  pnt->setPen(QColor(255, 30, 30));
  pnt->drawLine(px1, py1, px2, py1);
  pnt->drawLine(px1, py2, px2, py2);

  pnt->drawLine(px1-7, py1-RES_H, px1-7, py1+RES_H);
  pnt->drawLine(px1-9, py1-RES_H, px1-5, py1-RES_H);
  pnt->drawLine(px1-9, py1+RES_H, px1-5, py1+RES_H);

  pnt->drawLine(px1-7, py2-RES_H, px1-7, py2+RES_H);
  pnt->drawLine(px1-9, py2-RES_H, px1-5, py2-RES_H);
  pnt->drawLine(px1-9, py2+RES_H, px1-5, py2+RES_H);
}
Example #8
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 #9
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()));
    }
  }
}