BCReco Class Reference

#include <BCReco.h>

Inheritance diagram for BCReco:

JobCModule CfgObserver List of all members.

Public Member Functions

 BCReco (const char *version)
 ~BCReco ()
JobCResult Reco (EDMEventHandle &evt)
JobCResult Ana (const EDMEventHandle &evt)
void Update (const CfgConfig &c)

Private Member Functions

void DoCrossings (float z1, float z2, float z3)
void HitAssoc ()
void TrkFind ()
void ViewMatch ()
void MakeHistos ()
 ......................................................................
void MatchSU ()
void MatchTV ()
void TrkFit ()
void FitTMinuit ()
void FitLSQ ()
void CleanUpTrk ()
void FillNt ()
void Clear ()

Private Attributes

std::vector< Hit * > fBCHitList [3][4]
std::list< AssocHit_t * > fBCAHitList [3][4]
std::list< CandPair_t * > fCandTrk [4]
std::list< CandTrajectory_t * > fCandTraj
std::list< TrackFit_t * > fTrackFit
int fNTrack
TTree * fNtTree
 Ntuple tree.
BCRecoNtfNtuple
 Branch for the ntuple tree.
TMinuit * fMinuit
 MINUIT interface.
TH1F * fTrkFindHisto [4]
 Predicted wire - hit wire in TrkFind.
TH1F * fViewMatchHisto [3][4]
 Predicted wire - hit wire in ViewMatch.
TH1F * fnTrackHisto
 Number of tracks.
TH1F * fx1Histo
 x1
TH1F * fy1Histo
 y1
TH1F * fx3Histo
 x3
TH1F * fy3Histo
 y3
TH1F * fdxdzHisto
 dx/dz
TH1F * fdydzHisto
 dy/dz
TH1F * fdsdzHisto
 ds/dz
TH1F * ftargetxHisto
 x at target
TH1F * ftargetyHisto
 y at target
TH2F * ftargetxyHisto
 x:y at target
TH2F * fBC3xyHisto
 x:y
TH2F * fBC3xdxdzHisto
 x:dx/dz
TH2F * fBC3ydydzHisto
 y:dy/dz
TH1F * fChi2Histo
 chi2
TH1F * fRChi2Histo
 Reduced chi2.
TH1F * fFinalTrkHisto
 Distance(Fit track - hit wire).
int fDebug
int fPrintLevel
int fN_TrkFind
int fN_ViewMatch
int fMaxItr
int fNWireItr
float fWidth_TrkFit
float fWidthTrks
int fFitFunc
int fMaxNWirePerChamber
int fMaxTotalNWire

Classes

struct  AssocHit_t
struct  CandPair_t
struct  CandTrajectory_t
struct  TrackFit_t

Detailed Description

Definition at line 68 of file BCReco.h.


Constructor & Destructor Documentation

BCReco::BCReco ( const char *  version  ) 

Definition at line 171 of file BCReco.cxx.

References fDebug, fMinuit, fPrintLevel, fTrkFindHisto, fViewMatchHisto, gsCotAng, gsDelX, gsFCN(), gsXWire1, kBC1, kNPlane, MakeHistos(), and JobCModule::SetCfgVersion().

00171                                   : 
00172   JobCModule("BCReco"),
00173   fNTrack(0),
00174   fNtTree(0),
00175   fNtuple(new BCRecoNt),
00176   fMinuit(new TMinuit(4)),
00177   fnTrackHisto(0),
00178   fx1Histo(0),
00179   fy1Histo(0),
00180   fx3Histo(0),
00181   fy3Histo(0),
00182   fdxdzHisto(0),
00183   fdydzHisto(0),
00184   fdsdzHisto(0),
00185   ftargetxHisto(0),
00186   ftargetyHisto(0),
00187   ftargetxyHisto(0),
00188   fBC3xyHisto(0),
00189   fBC3xdxdzHisto(0),
00190   fBC3ydydzHisto(0),
00191   fChi2Histo(0),
00192   fRChi2Histo(0),
00193   fFinalTrkHisto(0),
00194   fDebug(1),
00195   fPrintLevel(-1),
00196   fN_TrkFind(5),
00197   fN_ViewMatch(3),
00198   fMaxItr(30),
00199   fNWireItr(3),
00200   fWidth_TrkFit(0.5),
00201   fWidthTrks(0.5),
00202   fFitFunc(0),
00203   fMaxNWirePerChamber(10),
00204   fMaxTotalNWire(25)
00205 {
00206   // Do this first to load default configuration
00207   this->SetCfgVersion(version);
00208 
00209   for (int iplane=0; iplane < GDCGeom::kNPlane; ++iplane) {
00210     gsCotAng[iplane] = 1./
00211       tan(M_PI/2.-GDCGeom::Id(GDCGeom::kBC1).GetWrAng(iplane+1));
00212     gsDelX[iplane] = GDCGeom::Id(GDCGeom::kBC1).GetWrDx(iplane+1);
00213     gsXWire1[iplane] = gsDelX[iplane]*
00214       (GDCGeom::Id(GDCGeom::kBC1).GetMaxWire(iplane+1)/2.-0.5);
00215   }
00216 
00217   for (int iplane=0; iplane < GDCGeom::kNPlane; ++iplane) {
00218     fTrkFindHisto[iplane] = 0;
00219     for (int ichamber=0; ichamber<3; ++ichamber)
00220       fViewMatchHisto[ichamber][iplane] = 0;
00221   }
00222 
00223   fMinuit->SetFCN(gsFCN);
00224   fMinuit->SetPrintLevel(fPrintLevel);
00225 
00226   if (fDebug) MakeHistos();
00227 }

BCReco::~BCReco (  ) 

Definition at line 314 of file BCReco.cxx.

References fBC3xdxdzHisto, fBC3xyHisto, fBC3ydydzHisto, fChi2Histo, fdsdzHisto, fdxdzHisto, fdydzHisto, fFinalTrkHisto, fnTrackHisto, fNtTree, fNtuple, fRChi2Histo, ftargetxHisto, ftargetxyHisto, ftargetyHisto, fTrkFindHisto, fViewMatchHisto, fx1Histo, fx3Histo, fy1Histo, fy3Histo, and Write().

00315 {
00316   for (int iplane=0; iplane<4; ++iplane) {
00317     if (fTrkFindHisto[iplane]) { 
00318       fTrkFindHisto[iplane]->Write(); 
00319       delete fTrkFindHisto[iplane]; 
00320     }
00321     for (int ichamber=0; ichamber<3; ++ichamber)
00322       if (fViewMatchHisto[ichamber][iplane]) { 
00323     fViewMatchHisto[ichamber][iplane]->Write(); 
00324     delete fViewMatchHisto[ichamber][iplane]; 
00325       }
00326   }
00327 
00328   if (fnTrackHisto) {
00329     fnTrackHisto->Write();
00330     delete fnTrackHisto;
00331   }
00332   if (fx1Histo) {
00333     fx1Histo->Write();
00334     delete fx1Histo;
00335   }
00336   if (fy1Histo) {
00337     fy1Histo->Write();
00338     delete fy1Histo;
00339   }
00340   if (fx3Histo) {
00341     fx3Histo->Write();
00342     delete fx3Histo;
00343   }
00344   if (fy3Histo) {
00345     fy3Histo->Write();
00346     delete fy3Histo;
00347   }
00348   if (fdxdzHisto) {
00349     fdxdzHisto->Write();
00350     delete fdxdzHisto;
00351   }
00352   if (fdydzHisto) {
00353     fdydzHisto->Write();
00354     delete fdydzHisto;
00355   }
00356   if (fdsdzHisto) {
00357     fdsdzHisto->Write();
00358     delete fdsdzHisto;
00359   }
00360   if (ftargetxHisto) {
00361     ftargetxHisto->Write();
00362     delete ftargetxHisto;
00363   }
00364   if (ftargetyHisto) {
00365     ftargetyHisto->Write();
00366     delete ftargetyHisto;
00367   }
00368   if (ftargetxyHisto) {
00369     ftargetxyHisto->Write();
00370     delete ftargetxyHisto;
00371   }
00372   if (fBC3xyHisto) {
00373     fBC3xyHisto->Write();
00374     delete fBC3xyHisto;
00375   }
00376   if (fBC3xdxdzHisto) {
00377     fBC3xdxdzHisto->Write();
00378     delete fBC3xdxdzHisto;
00379   }
00380   if (fBC3ydydzHisto) {
00381     fBC3ydydzHisto->Write();
00382     delete fBC3ydydzHisto;
00383   }
00384   if (fChi2Histo) {
00385     fChi2Histo->Write();
00386     delete fChi2Histo;
00387   }
00388   if (fRChi2Histo) {
00389     fRChi2Histo->Write();
00390     delete fRChi2Histo;
00391   }
00392   if (fFinalTrkHisto) {
00393     fFinalTrkHisto->Write();
00394     delete fFinalTrkHisto;
00395   }
00396 
00397   if (fNtTree) {
00398     fNtTree->Write();
00399     delete fNtTree;
00400     delete fNtuple;
00401   }
00402 }


Member Function Documentation

JobCResult BCReco::Ana ( const EDMEventHandle evt  )  [virtual]

Reimplemented from JobCModule.

Definition at line 651 of file BCReco.cxx.

References JobCModule::kPassed.

00652 {
00653   return JobCModule::kPassed;
00654 }

void BCReco::CleanUpTrk (  )  [private]

Definition at line 1429 of file BCReco.cxx.

References BCReco::TrackFit_t::chi2, fNTrack, fTrackFit, fWidthTrks, BCReco::TrackFit_t::x1, BCReco::TrackFit_t::x3, BCReco::TrackFit_t::y1, and BCReco::TrackFit_t::y3.

Referenced by Reco().

01430 {
01431   //====================================================================
01432   // A clean up step is performed. This step loops over all trajectory
01433   // candidates and compares the parameters, if the parameters fall
01434   // within some window (fWidthTrks) the two candidates are declared to
01435   // be the same and the candidate with the best chi-squired is chosen.
01436   //====================================================================
01437   
01438   std::list<TrackFit_t*>::iterator trackFitItr(fTrackFit.begin());
01439   std::list<TrackFit_t*>::iterator trackFitItrEnd(fTrackFit.end());  
01440   std::list<TrackFit_t*>::iterator trackFitItr1;
01441   for ( ; trackFitItr != trackFitItrEnd; ++trackFitItr) {
01442     trackFitItr1 = trackFitItr;
01443     for ( trackFitItr1++; trackFitItr1 != trackFitItrEnd; 
01444       ++trackFitItr1) {
01445       
01446       TrackFit_t* t1 = *trackFitItr;
01447       TrackFit_t* t2 = *trackFitItr1;
01448       if ( fabs(t1->x1 - t2->x1) < fWidthTrks &&
01449        fabs(t1->y1 - t2->y1) < fWidthTrks &&
01450        fabs(t1->x3 - t2->x3) < fWidthTrks &&
01451        fabs(t1->y3 - t2->y3) < fWidthTrks ) {
01452     // One of the tracks needs to be deleted
01453 
01454     fNTrack--;
01455     if (t1->chi2 <= t2->chi2) {
01456       delete t2;
01457       std::list<TrackFit_t*>::iterator saveItr(trackFitItr1);
01458       saveItr--;
01459       fTrackFit.erase(trackFitItr1);
01460       trackFitItr1 = saveItr;
01461     }
01462     else {
01463       delete t1;
01464       std::list<TrackFit_t*>::iterator saveItr(trackFitItr);
01465       saveItr++;
01466       fTrackFit.erase(trackFitItr);
01467       if (saveItr != fTrackFit.begin()) saveItr--;
01468       trackFitItr = saveItr;
01469       break;
01470     }
01471       }
01472     }
01473   }
01474 
01475   if (fNTrack>1) {
01476     trackFitItr = fTrackFit.begin();
01477     trackFitItrEnd = fTrackFit.end();
01478     for ( ; trackFitItr != trackFitItrEnd; ++trackFitItr) {
01479       (*trackFitItr)->goldenTrk = 3;
01480     }
01481   }
01482 
01483   if (fDebug) fnTrackHisto->Fill(fNTrack);
01484 
01485   // Fill histograms for dx/dz && dy/dz
01486   if (fDebug && fNTrack == 1) {
01487     float x1, y1;
01488     float x3, y3;
01489     float z1, z3;
01490     float dx, dy, dz;
01491 
01492     z1 = (GDCGeom::Id(GDCGeom::kBC1).GetZPos(2) 
01493       + GDCGeom::Id(GDCGeom::kBC1).GetZPos(3))/2.;
01494     z3 = (GDCGeom::Id(GDCGeom::kBC3).GetZPos(2) 
01495       + GDCGeom::Id(GDCGeom::kBC3).GetZPos(3))/2.;
01496 
01497     TrackFit_t* fitTrack = *fTrackFit.begin();
01498     x1 = fitTrack->x1;
01499     y1 = fitTrack->y1;
01500     x3 = fitTrack->x3;
01501     y3 = fitTrack->y3;
01502 
01503     dx = x3 - x1;
01504     dy = y3 - y1;
01505     dz = z3 - z1;
01506 
01507     fx1Histo->Fill(x1);
01508     fy1Histo->Fill(y1);
01509     fx3Histo->Fill(x3);
01510     fy3Histo->Fill(y3);
01511 
01512     fdxdzHisto->Fill(dx/dz*1000);
01513     fdydzHisto->Fill(dy/dz*1000);
01514     fdsdzHisto->Fill(sqrt(dx/dz*dx/dz + dy/dz*dy/dz + 1));
01515     fChi2Histo->Fill(fitTrack->chi2);
01516     fRChi2Histo->Fill(fitTrack->chi2/fitTrack->nHit);
01517 
01518     ftargetxHisto->Fill(x3+dx/dz*2000); // x position at target
01519     ftargetyHisto->Fill(y3+dy/dz*2000); // y position at target
01520     ftargetxyHisto->Fill(x3+dx/dz*2000, y3+dy/dz*2000); // position at target
01521     fBC3xyHisto->Fill(x3, y3);
01522     fBC3xdxdzHisto->Fill(x3, dx/dz*1000);
01523     fBC3ydydzHisto->Fill(y3, dy/dz*1000);
01524 
01525     for (int i=0; i<GDCGeom::kNBCPlane; ++i) 
01526       fFinalTrkHisto->Fill(gsResidual[i]);
01527   }
01528 
01529   if (fDebug>1) {
01530     trackFitItr=fTrackFit.begin();
01531     trackFitItrEnd = fTrackFit.end();  
01532     for (; trackFitItr != trackFitItrEnd; ++trackFitItr) {
01533       std::cout << "Track Fit " 
01534         << "x1 = " << (*trackFitItr)->x1 << " "
01535         << "y1 = " << (*trackFitItr)->y1 << " "
01536         << "x3 = " << (*trackFitItr)->x3 << " "
01537         << "y3 = " << (*trackFitItr)->y3 << std::endl;
01538     }
01539   }
01540 }

void BCReco::Clear (  )  [private]

Definition at line 1612 of file BCReco.cxx.

References fBCAHitList, fBCHitList, fCandTraj, fCandTrk, fTrackFit, and kNBC.

Referenced by Reco().

01613 {
01614 //======================================================================
01615 // Delete all objects that got stored in vectors and clear all vectors
01616 //======================================================================
01617   fNTrack = 0;
01618 
01619   for (int i = 0; i < GDCGeom::kNBC; ++i) {
01620     for (int j = 0; j < GDCGeom::kNPlane; ++j) {
01621       std::vector<Hit*>::iterator itr(fBCHitList[i][j].begin());
01622       std::vector<Hit*>::iterator itrEnd(fBCHitList[i][j].end());
01623       for ( ; itr != itrEnd; ++itr) delete (*itr);
01624       fBCHitList[i][j].clear();
01625 
01626       std::list<AssocHit_t*>::iterator itrA(fBCAHitList[i][j].begin());
01627       std::list<AssocHit_t*>::iterator itrAEnd(fBCAHitList[i][j].end());
01628       for ( ; itrA != itrAEnd; ++itrA) delete (*itrA);
01629       fBCAHitList[i][j].clear();
01630     }
01631   }
01632 
01633   for (int i = 0; i < GDCGeom::kNPlane; ++i) {
01634     std::list<CandPair_t*>::iterator itr(fCandTrk[i].begin());
01635     std::list<CandPair_t*>::iterator itrEnd(fCandTrk[i].end());
01636     for ( ; itr != itrEnd; ++itr) delete (*itr);
01637     fCandTrk[i].clear();
01638   }
01639 
01640   std::list<CandTrajectory_t*>::iterator itrC(fCandTraj.begin());
01641   std::list<CandTrajectory_t*>::iterator itrCEnd(fCandTraj.end());
01642   for ( ; itrC != itrCEnd; ++itrC) delete (*itrC);
01643   fCandTraj.clear();
01644 
01645   std::list<TrackFit_t*>::iterator itrT(fTrackFit.begin());
01646   std::list<TrackFit_t*>::iterator itrTEnd(fTrackFit.end());
01647   for ( ; itrT != itrTEnd; ++itrT) delete (*itrT);
01648   fTrackFit.clear();
01649 }

void BCReco::DoCrossings ( float  z1,
float  z2,
float  z3 
) [private]

Definition at line 534 of file BCReco.cxx.

References BCReco::TrackFit_t::chi2, DistanceWireLine(), fBCHitList, fNTrack, fTrackFit, fWidth_TrkFit, BCCrossing::GetCrossing(), BCReco::TrackFit_t::goldenTrk, gsResidual, gsWire, kBC1, BCReco::TrackFit_t::nHit, BCReco::TrackFit_t::wire, x, BCReco::TrackFit_t::x1, BCReco::TrackFit_t::x3, x3, y, BCReco::TrackFit_t::y1, y1, BCReco::TrackFit_t::y3, and y3.

Referenced by Reco().

00535 {
00536   int nTmp = 0;
00537   float x1, x3, y1, y3;
00538   float x[3],y[3];
00539   int w[3] = {0,0,0};
00540   for (int ichamber=0; ichamber<3; ichamber++) {
00541     std::list<Crossing*> crossing(0);
00542     BCCrossing c;
00543   
00544     bool hasCrossing = c.GetCrossing(ichamber, fBCHitList[ichamber],
00545                      crossing);
00546     
00547     if (hasCrossing) {
00548       if (crossing.size() == 1) {
00549       Crossing* cross = crossing.front();
00550       x[ichamber] = cross->x();
00551       y[ichamber] = cross->y();
00552       w[ichamber] = cross->w();
00553       nTmp++;
00554       }
00555     }
00556   }
00557   
00558   if (nTmp>=2) {
00559     if (w[0] == 0) {
00560       x1 = x[1] + (x[2]-x[1])/(z3-z2)*(z1-z2);
00561       y1 = y[1] + (y[2]-y[1])/(z3-z2)*(z1-z2);
00562       x3 = x[2];
00563       y3 = y[2];
00564     }
00565     else if (w[1] == 0) {
00566       x1 = x[0];
00567       y1 = y[0];
00568       x3 = x[2];
00569       y3 = y[2];
00570     }
00571     else if (w[2] == 0) {
00572       x1 = x[0];
00573       y1 = y[0];
00574       x3 = x[0] + (x[1]-x[0])/(z2-z1)*(z3-z1);
00575       y3 = y[0] + (y[1]-y[0])/(z2-z1)*(z3-z1);  
00576     }
00577     else if (w[1] <= w[0] && w[1] <= w[2]) {
00578       x1 = x[0];
00579       y1 = y[0];
00580       x3 = x[2];
00581       y3 = y[2];
00582     }
00583     else if (w[0] < w[1] && w[0] <= w[2]) {
00584       x1 = x[1] + (x[2]-x[1])/(z3-z2)*(z1-z2);
00585       y1 = y[1] + (y[2]-y[1])/(z3-z2)*(z1-z2);
00586       x3 = x[2];
00587       y3 = y[2];
00588     }
00589     else if (w[2] < w[0] && w[2] < w[1]) {
00590       x1 = x[0];
00591       y1 = y[0];
00592       x3 = x[0] + (x[1]-x[0])/(z2-z1)*(z3-z1);
00593       y3 = y[0] + (y[1]-y[0])/(z2-z1)*(z3-z1);
00594     }
00595 
00596     // loop thru all raw hits and find the wire closest to the track
00597     for (int ichamber=0; ichamber<3; ichamber++)
00598       for (int iplane=0; iplane<4; iplane++) {
00599     std::vector<Hit*>::iterator 
00600       hitItr(fBCHitList[ichamber][iplane].begin());
00601     std::vector<Hit*>::iterator 
00602       hitItrEnd(fBCHitList[ichamber][iplane].end());
00603     
00604     double tmpD = 9999;
00605     gsWire[iplane+ichamber*4] = -1;
00606     gsResidual[iplane+ichamber*4] = 9999.;
00607     for ( ; hitItr != hitItrEnd; ++hitItr) {
00608       int wire = (*hitItr)->wire();
00609       double d = DistanceWireLine(iplane+ichamber*4,wire,x1,y1,x3,y3);
00610       
00611       if (d<tmpD && d<fWidth_TrkFit) {
00612         tmpD = d;
00613         gsWire[iplane+ichamber*4] = wire;
00614         gsResidual[iplane+ichamber*4] = d;
00615       }
00616     }
00617       }
00618     
00619     TrackFit_t* trkfit = new TrackFit_t;
00620     int        nHit = 0;
00621     double     chi2 = 0.0;
00622     
00623     trkfit->x1        = x1;
00624     trkfit->y1        = y1;
00625     trkfit->x3        = x3;
00626     trkfit->y3        = y3;
00627     
00628     for (int i=0; i<GDCGeom::kNBCPlane; i++) {
00629       trkfit->wire[i]    = gsWire[i];
00630       if (gsWire[i]>0) {
00631     nHit++;
00632     double d = DistanceWireLine(i,gsWire[i],trkfit->x1,trkfit->y1,
00633                     trkfit->x3, trkfit->y3);
00634     chi2 =+ d*d;
00635       }
00636     }
00637     trkfit->chi2 = chi2/nHit
00638       /(GDCGeom::Id(GDCGeom::kBC1).GetWrSep(1)
00639     *GDCGeom::Id(GDCGeom::kBC1).GetWrSep(1)/12);
00640     
00641     trkfit->nHit      = nHit;
00642     trkfit->goldenTrk = 2;
00643     
00644     fTrackFit.push_back(trkfit);
00645     fNTrack++;
00646   }
00647 }

void BCReco::FillNt (  )  [private]

Definition at line 1544 of file BCReco.cxx.

References BCRecoNt::chi2, fNtTree, fNtuple, fTrackFit, BCRecoNt::goldenTrk, BCRecoNt::nHit, BCRecoNt::ntrack, BCRecoNt::wire, BCRecoNt::x1, BCRecoNt::x3, BCRecoNt::y1, and BCRecoNt::y3.

Referenced by Reco().

01545 {
01546 //======================================================================
01547 // Store track information in the event
01548 // ONLY if total number of tracks < 10 !!!
01549 //======================================================================
01550 
01551   std::list<TrackFit_t*>::iterator trackFitItr(fTrackFit.begin());
01552   std::list<TrackFit_t*>::iterator trackFitItrEnd(fTrackFit.end());
01553 
01554   int iTrack = 0;
01555 
01556   for ( ; trackFitItr != trackFitItrEnd; ++trackFitItr) {
01557     fNtuple->nHit[iTrack]      = (*trackFitItr)->nHit;
01558     fNtuple->x1[iTrack]        = (*trackFitItr)->x1;
01559     fNtuple->y1[iTrack]        = (*trackFitItr)->y1;
01560     fNtuple->x3[iTrack]        = (*trackFitItr)->x3;
01561     fNtuple->y3[iTrack]        = (*trackFitItr)->y3;
01562     fNtuple->chi2[iTrack]      = (*trackFitItr)->chi2;
01563     fNtuple->goldenTrk[iTrack] = (*trackFitItr)->goldenTrk;
01564     for (int i=0; i<GDCGeom::kNBCPlane; i++) {
01565       fNtuple->wire[iTrack][i] = (*trackFitItr)->wire[i];
01566     }
01567 
01568     ++iTrack;
01569   }
01570   
01571   fNtuple->ntrack = iTrack;
01572   
01573   for (int j=iTrack; j<10; j++) {
01574     fNtuple->nHit[j]      = 0;
01575     fNtuple->x1[j]        = 9999.;
01576     fNtuple->y1[j]        = 9999.;
01577     fNtuple->x3[j]        = 9999.;
01578     fNtuple->y3[j]        = 9999.;
01579     fNtuple->chi2[j]      = 9999.;
01580     fNtuple->goldenTrk[j] = 9999;
01581     for (int i=0; i<GDCGeom::kNBCPlane; i++) fNtuple->wire[j][i] = -1;
01582   }
01583   
01584   if (iTrack==0) {
01585     fNtuple->nHit[iTrack] = 0;
01586     fNtuple->chi2[iTrack] = 9999.;
01587     for (int i=0; i<GDCGeom::kNBCPlane; i++) fNtuple->wire[iTrack][i] = -1;
01588   }
01589   
01590   if (fNtTree) fNtTree->Fill();
01591 }

void BCReco::FitLSQ (  )  [private]

Definition at line 1237 of file BCReco.cxx.

References alpha, DistanceWireLine(), fBCHitList, fCandTraj, fNTrack, fNWireItr, fTrackFit, fWidth_TrkFit, gsResidual, gsWire, kBC1, kBC2, kBC3, kNBC, p, BCReco::CandTrajectory_t::x1, BCReco::CandTrajectory_t::x3, x3, BCReco::CandTrajectory_t::y1, y1, BCReco::CandTrajectory_t::y3, and y3.

Referenced by TrkFit().

01238 {
01239   // Takes the candidate wire pairs from view pairings and performs a
01240   // least-squared fit with the 12 planes of wires to four parameters.
01241 
01242   std::list<CandTrajectory_t*>::iterator candTrajItr(fCandTraj.begin());
01243   std::list<CandTrajectory_t*>::iterator candTrajItrEnd(fCandTraj.end());
01244 
01245   double x1, y1;  // space points in BC1
01246   double x3, y3;  // space points in BC3
01247 
01248   bool noFit = false;
01249   
01250   const GDCGeom* geom[GDCGeom::kNBC] = {
01251     &GDCGeom::Id(GDCGeom::kBC1),
01252     &GDCGeom::Id(GDCGeom::kBC2),
01253     &GDCGeom::Id(GDCGeom::kBC3)
01254   };
01255 
01256 
01257   static float z1 = (geom[0]->GetZPos(2) + 
01258              geom[0]->GetZPos(3))/2.;  // middle pos. of chamber 1
01259   static float z3 = (geom[2]->GetZPos(2) + 
01260              geom[2]->GetZPos(3))/2.;  // middle pos. of chamber 3 
01261   
01262   float sep[GDCGeom::kNBCPlane]; // wire spacing (cm)
01263   float d1w[GDCGeom::kNBCPlane]; // distance of wire 1 from the origin (cm)
01264   float c[GDCGeom::kNBCPlane][4]; // geometric constants (angles of wires?)
01265   double coordinate[4];  // dummy array to store init. and final pos. of trk
01266   
01267   // Loop over every trajectory and fit it, store results into
01268   // fTrackFit list
01269   for ( ; candTrajItr != candTrajItrEnd; ++candTrajItr) {
01270     TrackFit_t* trackFit = new TrackFit_t;
01271     CandTrajectory_t* candTraj = *candTrajItr;
01272     ++fNTrack;
01273     
01274     for (int nItr=0; nItr<fNWireItr; nItr++) {
01275       x1 = candTraj->x1;
01276       y1 = candTraj->y1;
01277       x3 = candTraj->x3;
01278       y3 = candTraj->y3;
01279       
01280       // loop thru all raw hits and find the wire closest to the track
01281       for (int ichamber=0; ichamber<GDCGeom::kNBC; ichamber++) {
01282     for (int iplane=0; iplane<GDCGeom::kNPlane; iplane++) {
01283       int planeIndx = iplane + ichamber * GDCGeom::kNPlane;
01284 
01285       std::vector<Hit*>::iterator 
01286         hitItr(fBCHitList[ichamber][iplane].begin());
01287       std::vector<Hit*>::iterator 
01288         hitItrEnd(fBCHitList[ichamber][iplane].end());
01289       
01290       double tmpD = 9999;
01291       gsWire[planeIndx] = -1;
01292       gsResidual[planeIndx] = 9999.;
01293       for ( ; hitItr != hitItrEnd; ++hitItr) {
01294         int wire = (*hitItr)->wire();
01295         double d = DistanceWireLine(planeIndx,wire,x1,y1,x3,y3);
01296         
01297         if (d<tmpD && d<fWidth_TrkFit) {
01298           tmpD = d;
01299           gsWire[planeIndx]    = wire;
01300           gsResidual[planeIndx] = d;
01301         }
01302       }
01303     }
01304       }    
01305   
01306       /*
01307       // loop thru associated hits and ...????
01308       for (int i=0; i<GDCGeom::kNBCPlane; i++) {
01309       if (candTraj->ahit[i]!=NULL) {
01310       if (candTraj->ahit[i]->twoHits == false)
01311       gsWire[i] = int(candTraj->ahit[i]->aHitWire);
01312       else {
01313       int hit1 = candTraj->ahit[i]->hit1->wire();
01314       int hit2 = candTraj->ahit[i]->hit2->wire();
01315       double d1 = 9999.;
01316       double d2 = 9999.;
01317       if (hit1>0) d1 = DistanceWireLine(i,hit1,x1,y1,x3,y3);
01318       if (hit2>0) d2 = DistanceWireLine(i,hit2,x1,y1,x3,y3);
01319       if (d1<d2)
01320       gsWire[i] = hit1;
01321       else
01322       gsWire[i] = hit2;
01323       }
01324       }
01325       else
01326       gsWire[i] = -1;
01327       }
01328       */
01329       for (int ichamber = 0; ichamber < GDCGeom::kNBC; ichamber++) {
01330     for (int iplane=0; iplane < GDCGeom::kNPlane; iplane++) {
01331       int planeIndx = iplane + (ichamber * 4);
01332 
01333       float alpha = geom[ichamber]->GetWrAng(iplane+1) - M_PI/2.;
01334       
01335       sep[planeIndx] = geom[ichamber]->GetWrSep(iplane+1);
01336       
01337       d1w[planeIndx] = geom[ichamber]->GetD1W(iplane+1);
01338       
01339       float sa = sin(alpha);
01340       float ca = cos(alpha);
01341       
01342       float z = geom[ichamber]->GetZPos(iplane+1);
01343       c[planeIndx][0] = (z3 - z)*ca/(z1 - z3)/sep[planeIndx];
01344       c[planeIndx][1] = (z3 - z)*sa/(z1 - z3)/sep[planeIndx];
01345       c[planeIndx][2] = (z - z1)*ca/(z1 - z3)/sep[planeIndx];
01346       c[planeIndx][3] = (z - z1)*sa/(z1 - z3)/sep[planeIndx];
01347     }
01348       }
01349       
01350       int weight[12];
01351       for (int i=0; i < GDCGeom::kNBCPlane; i++) {
01352     if (gsWire[i]>0) weight[i] = 1;
01353     else             weight[i] = 0;
01354       }
01355       
01356       double array[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
01357       double wire[4] = {0,0,0,0};
01358       for (int i = 0; i < GDCGeom::kNBCPlane; i++) {
01359     for (int j = 0; j < 16; ++j) {
01360       array[j] += weight[i] * c[i][j/4] * c[i][j%4];
01361     }
01362 
01363     for (int j = 0; j < 4; ++j) {
01364       // Subtract 1. since wire number starts from 1
01365       wire[j] += weight[i]*c[i][j]*
01366         (gsWire[i] - 1. - d1w[i]/sep[i]);
01367     }
01368       }
01369       
01370       TMatrixD cc(4,4);
01371       cc.SetMatrixArray(array);
01372       
01373       double det;
01374       cc.Invert(&det);
01375 
01376       if (det == 0.) {
01377     noFit = true;
01378     break;
01379       }
01380 
01381       TMatrixD w(4,1);
01382       w.SetMatrixArray(wire);
01383       
01384       TMatrixD p(4,1);
01385       p = cc*w;
01386       
01387       p.GetMatrix2Array(coordinate);
01388       
01389       candTraj->x1 = coordinate[0];
01390       candTraj->y1 = coordinate[1];
01391       candTraj->x3 = coordinate[2];
01392       candTraj->y3 = coordinate[3];
01393     }
01394     
01395     if (noFit == true) break;
01396     
01397     trackFit->x1 = coordinate[0];
01398     trackFit->y1 = coordinate[1];
01399     trackFit->x3 = coordinate[2];
01400     trackFit->y3 = coordinate[3];
01401     
01402     int nHit = 0;
01403     for (int i=0; i<GDCGeom::kNBCPlane; i++) {
01404       trackFit->wire[i] = gsWire[i];
01405       if (gsWire[i]>0) nHit++;
01406     }
01407     trackFit->nHit = nHit;
01408     
01409     // Calculate chi**2
01410     double chi2 = 0.0;
01411     
01412     for (int i=0; i < GDCGeom::kNBCPlane; ++i) {
01413       if (gsWire[i] > 0) {
01414     double d = DistanceWireLine(i,gsWire[i],trackFit->x1,trackFit->y1,
01415                     trackFit->x3, trackFit->y3);
01416     chi2 =+ d*d;
01417       }
01418     }
01419     trackFit->chi2 = chi2/nHit
01420       /(geom[0]->GetWrSep(1) * geom[0]->GetWrSep(1)/12);
01421     
01422     trackFit->goldenTrk = 1;
01423     fTrackFit.push_back(trackFit);
01424   }
01425 }

void BCReco::FitTMinuit (  )  [private]

Definition at line 1137 of file BCReco.cxx.

References BCReco::TrackFit_t::chi2, DistanceWireLine(), fBCHitList, fCandTraj, fMaxItr, fMinuit, fNTrack, fTrackFit, fWidth_TrkFit, BCReco::TrackFit_t::goldenTrk, gsResidual, gsWire, kNBC, BCReco::TrackFit_t::nHit, BCReco::TrackFit_t::wire, BCReco::TrackFit_t::x1, BCReco::TrackFit_t::x3, x3, BCReco::TrackFit_t::y1, y1, BCReco::TrackFit_t::y3, and y3.

Referenced by TrkFit().

01138 {
01139   std::list<CandTrajectory_t*>::iterator candTrajItr(fCandTraj.begin());
01140   std::list<CandTrajectory_t*>::iterator candTrajItrEnd(fCandTraj.end());
01141 
01142   double x1, y1;  // space points in BC1
01143   double x3, y3;  // space points in BC3
01144 
01145   int ierr;
01146   double arglist[10];
01147   double x1err, y1err;
01148   double x3err, y3err;
01149   double chi2, fedm, errdef;
01150   int npari, nparx;
01151   
01152   for ( ; candTrajItr != candTrajItrEnd; ++candTrajItr) {
01153     CandTrajectory_t* candTraj = *candTrajItr;
01154     TrackFit_t* trackFit = new TrackFit_t;
01155     ++fNTrack;
01156 
01157     x1 = candTraj->x1;
01158     y1 = candTraj->y1;
01159     x3 = candTraj->x3;
01160     y3 = candTraj->y3;
01161     
01162     for (int itr=0; itr<fMaxItr; ++itr) {
01163       ierr = 0;
01164       arglist[0] = 1.;
01165       fMinuit->mnexcm("SET ERR", arglist, 1, ierr);
01166       fMinuit->mnparm(0, "x1", x1, 0.01, 0, 0, ierr);
01167       fMinuit->mnparm(1, "y1", y1, 0.01, 0, 0, ierr);
01168       fMinuit->mnparm(2, "x3", x3, 0.01, 0, 0, ierr);
01169       fMinuit->mnparm(3, "y3", y3, 0.01, 0, 0, ierr);
01170       
01171       arglist[0] = 10.;
01172       arglist[1] = 1.0;
01173       fMinuit->mnexcm("MIGRAD", arglist, 2, ierr);
01174       
01175       fMinuit->GetParameter(0, x1, x1err);
01176       fMinuit->GetParameter(1, y1, y1err);
01177       fMinuit->GetParameter(2, x3, x3err);
01178       fMinuit->GetParameter(3, y3, y3err);
01179       
01180       fMinuit->mnstat(chi2, fedm, errdef, npari, nparx, ierr);
01181     }
01182     
01183     // loop thru all raw hits and find the wire closest to the track
01184     for (int ichamber=0; ichamber<GDCGeom::kNBC; ichamber++)
01185       for (int iplane=0; iplane<GDCGeom::kNPlane; iplane++) {
01186     std::vector<Hit*>::iterator 
01187       hitItr(fBCHitList[ichamber][iplane].begin());
01188     std::vector<Hit*>::iterator 
01189       hitItrEnd(fBCHitList[ichamber][iplane].end());
01190     
01191     double tmpD = 9999;
01192     gsWire[iplane+ichamber*4] = -1;
01193     gsResidual[iplane+ichamber*4] = 9999.;
01194     for ( ; hitItr != hitItrEnd; ++hitItr) {
01195       int wire = (*hitItr)->wire();
01196       double d = DistanceWireLine(iplane+ichamber*4,wire,x1,y1,x3,y3);
01197       
01198       if (d<tmpD && d<fWidth_TrkFit) {
01199         tmpD = d;
01200         gsWire[iplane+ichamber*4]    = wire;
01201         gsResidual[iplane+ichamber*4] = d;
01202       }
01203     }
01204       }
01205     
01206     /*
01207       for (int i=0; i<GDCGeom::kNBCPlane; i++)
01208       if (candTraj->ahit[i] != NULL) {
01209       gsWire[i]  = int(candTraj->ahit[i]->aHitWire);
01210       gsResidual[i] = DistanceWireLine(i,gsWire[i],x1,y1,x3,y3);
01211       }
01212       else {
01213       gsWire[i] = -1;
01214       gsResidual[i] = 9999.;
01215       }
01216     */
01217     
01218     int nHit = 0;
01219     for (int i=0; i<GDCGeom::kNBCPlane; ++i)
01220       if (gsWire[i]>0) nHit++;
01221     
01222     trackFit->nHit = nHit;
01223     for (int i=0; i<GDCGeom::kNBCPlane; i++)
01224       trackFit->wire[i] = gsWire[i];
01225     trackFit->x1   = x1;
01226     trackFit->y1   = y1;
01227     trackFit->x3   = x3;
01228     trackFit->y3   = y3;
01229     trackFit->chi2 = chi2;
01230     trackFit->goldenTrk = 1;
01231     fTrackFit.push_back(trackFit);
01232   }
01233 }

void BCReco::HitAssoc (  )  [private]

Definition at line 658 of file BCReco.cxx.

References BCReco::AssocHit_t::aHitWire, fBCAHitList, fBCHitList, fDebug, BCReco::AssocHit_t::hit1, BCReco::AssocHit_t::hit2, kNBC, kNPlane, and BCReco::AssocHit_t::twoHits.

Referenced by Reco().

00659 {
00660 //======================================================================
00661 // Hit Association: reduce the number of first and last chamber
00662 // combinations.  The adjacent hits within each plane are found and
00663 // grouped together.
00664 // If w_{i+1} = w_i+1, then only w_i+0.5 is entered into the list.
00665 //======================================================================
00666   for (int ichamber=0; ichamber<GDCGeom::kNBC; ++ichamber)
00667     for (int iplane=0; iplane<GDCGeom::kNPlane; ++iplane) {
00668       std::vector<Hit*>::iterator wireItr
00669     (fBCHitList[ichamber][iplane].begin());
00670       std::vector<Hit*>::iterator wireItrEnd
00671     (fBCHitList[ichamber][iplane].end());
00672 
00673       AssocHit_t* aHitInfo = 0;
00674       for ( ; wireItr != wireItrEnd; ++wireItr) {
00675     Hit* thisHit = *wireItr;
00676 
00677     if (aHitInfo && 
00678         ((aHitInfo->aHitWire + 1) == thisHit->wire())) {
00679       // This wire is already has a neighbor in the list, so 
00680       // we just modify the previous entry
00681       assert(!fBCAHitList[ichamber][iplane].empty());
00682 
00683       aHitInfo->aHitWire += 0.5;
00684       aHitInfo->hit2      = thisHit;
00685       aHitInfo->twoHits   = true;
00686     }
00687     else {
00688       aHitInfo = new AssocHit_t;
00689       aHitInfo->aHitWire = thisHit->wire();
00690       aHitInfo->hit1     = thisHit;
00691       aHitInfo->hit2     = thisHit;
00692       aHitInfo->twoHits  = false;
00693       fBCAHitList[ichamber][iplane].push_back(aHitInfo);      
00694     }
00695       }
00696     }
00697 
00698   if (fDebug>1) {
00699     std::cout << "Hit Association" << std::endl;
00700     for (int ichamber=0; ichamber<GDCGeom::kNBC; ++ichamber)
00701       for (int iplane=0; iplane<GDCGeom::kNPlane; ++iplane) {
00702     std::list<AssocHit_t*>::iterator wireItr
00703       (fBCAHitList[ichamber][iplane].begin());
00704     std::list<AssocHit_t*>::iterator wireItrEnd
00705       (fBCAHitList[ichamber][iplane].end());
00706     for ( ; wireItr != wireItrEnd; ++wireItr) {
00707       AssocHit_t* thisHit = (*wireItr);
00708       std::cout << "Chamber " << ichamber << "  "
00709             << "Plane " << iplane << "  "
00710             << thisHit->aHitWire << " "
00711             << thisHit->hit1->wire() << " "
00712             << thisHit->hit2->wire() << " "
00713             << thisHit->hit1->tdc() << " "
00714             << thisHit->hit2->tdc() << " "
00715             << thisHit->twoHits << " "
00716             << std::endl;
00717     }
00718       }
00719   }
00720 }

void BCReco::MakeHistos (  )  [private]

......................................................................

Definition at line 231 of file BCReco.cxx.

References fBC3xdxdzHisto, fBC3xyHisto, fBC3ydydzHisto, fChi2Histo, fdsdzHisto, fdxdzHisto, fdydzHisto, fFinalTrkHisto, fnTrackHisto, fNtTree, fNtuple, fRChi2Histo, ftargetxHisto, ftargetxyHisto, ftargetyHisto, fTrkFindHisto, fViewMatchHisto, fx1Histo, fx3Histo, fy1Histo, and fy3Histo.

Referenced by BCReco().

00232 {
00233   fNtTree = new TTree("fBCnt","BC Track Fit Ntuple");
00234   fNtTree->Branch("fBCnt", "BCRecoNt", &fNtuple);
00235   fTrkFindHisto[0] = new TH1F("fTrkFindHisto_u",
00236                   "Predicted wire - Hit wire (u-view)",
00237                   640, -320., 320.);
00238   fTrkFindHisto[1] = new TH1F("fTrkFindHisto_v",
00239                   "Predicted wire - Hit wire (v-view)",
00240                   640, -320., 320.);
00241   fTrkFindHisto[2] = new TH1F("fTrkFindHisto_s",
00242                   "Predicted wire - Hit wire (s-view)",
00243                   640, -320., 320.);
00244   fTrkFindHisto[3] = new TH1F("fTrkFindHisto_t",
00245                   "Predicted wire - Hit wire (t-view)",
00246                   640, -320., 320.);
00247 
00248   fViewMatchHisto[0][0] = new TH1F("fViewMatchHisto_ch1_u",
00249                    "Predicted wire - Hit wire (u-view)",
00250                    640, -320., 320.);
00251   fViewMatchHisto[0][1] = new TH1F("fViewMatchHisto_ch1_v",
00252                    "Predicted wire - Hit wire (v-view)",
00253                    640, -320., 320.);
00254   fViewMatchHisto[0][2] = new TH1F("fViewMatchHisto_ch1_s",
00255                    "Predicted wire - Hit wire (s-view)",
00256                    640, -320., 320.);
00257   fViewMatchHisto[0][3] = new TH1F("fViewMatchHisto_ch1_t",
00258                    "Predicted wire - Hit wire (t-view)",
00259                    640, -320., 320.);
00260 
00261   fViewMatchHisto[1][0] = new TH1F("fViewMatchHisto_ch2_u",
00262                    "Predicted wire - Hit wire (u-view)",
00263                    640, -320., 320.);
00264   fViewMatchHisto[1][1] = new TH1F("fViewMatchHisto_ch2_v",
00265                    "Predicted wire - Hit wire (v-view)",
00266                    640, -320., 320.);
00267   fViewMatchHisto[1][2] = new TH1F("fViewMatchHisto_ch2_s",
00268                    "Predicted wire - Hit wire (s-view)",
00269                    640, -320., 320.);
00270   fViewMatchHisto[1][3] = new TH1F("fViewMatchHisto_ch2_t",
00271                    "Predicted wire - Hit wire (t-view)",
00272                    640, -320., 320.);
00273 
00274   fViewMatchHisto[2][0] = new TH1F("fViewMatchHisto_ch3_u",
00275                    "Predicted wire - Hit wire (u-view)",
00276                    640, -320., 320.);
00277   fViewMatchHisto[2][1] = new TH1F("fViewMatchHisto_ch3_v",
00278                    "Predicted wire - Hit wire (v-view)",
00279                    640, -320., 320.);
00280   fViewMatchHisto[2][2] = new TH1F("fViewMatchHisto_ch3_s",
00281                    "Predicted wire - Hit wire (s-view)",
00282                    640, -320., 320.);
00283   fViewMatchHisto[2][3] = new TH1F("fViewMatchHisto_ch3_t",
00284                    "Predicted wire - Hit wire (t-view)",
00285                    640, -320., 320.);
00286 
00287   fnTrackHisto = new TH1F("fnTrackHisto", "Number of Track", 10, 0, 10);
00288   fx1Histo = new TH1F("fx1Histo","x1", 200, -10., 10.);
00289   fy1Histo = new TH1F("fy1Histo","y1", 200, -10., 10.);
00290   fx3Histo = new TH1F("fx3Histo","x3", 200, -10., 10.);
00291   fy3Histo = new TH1F("fy3Histo","y3", 200, -10., 10.);
00292   fdxdzHisto = new TH1F("fdxdzHisto","dx/dz", 200, -5., 5.);
00293   fdydzHisto = new TH1F("fdydzHisto","dy/dz", 200, -5., 5.);
00294   fdsdzHisto = new TH1F("fdsdzHisto","ds/dz", 200, 0.9999, 1.0001);
00295   ftargetxHisto = new TH1F("ftargetxHisto","x at target", 200, -10., 10.);
00296   ftargetyHisto = new TH1F("ftargetyHisto","y at target", 200, -10., 10.);
00297   ftargetxyHisto = new TH2F("ftargetxyHisto", "y:x", 200, -10.,10., 
00298                 200,-10.,10.);
00299   fBC3xyHisto = new TH2F("fBC3xyHisto", "y:x", 
00300              200, -10., 10., 200,-10.,10.);
00301   fBC3xdxdzHisto = new TH2F("fBC3xdxdzHisto", "x:dxdz", 
00302                 200, -10.,10., 200,-5.,5.);
00303   fBC3ydydzHisto = new TH2F("fBC3ydydzHisto", "y:dydz", 
00304                 200, -10.,10., 200,-5.,5.);
00305   fChi2Histo = new TH1F("fChi2Histo","Chi2", 4000, 0., 2000.);
00306   fRChi2Histo = new TH1F("fRChi2Histo","Reduced Chi2", 400, 0., 200.);
00307   fFinalTrkHisto = new TH1F("fFinalTrkHisto",
00308                 "Distance(Fit Track - Hit wire)", 
00309                 100, 0., 0.5);
00310 }

void BCReco::MatchSU (  )  [private]

Definition at line 837 of file BCReco.cxx.

References BCReco::CandTrajectory_t::ahit, BCReco::AssocHit_t::aHitWire, fBCAHitList, fCandTraj, fCandTrk, fDebug, fN_ViewMatch, fViewMatchHisto, gsCotAng, gsDelX, gsXWire1, BCReco::AssocHit_t::hit1, BCReco::AssocHit_t::hit2, kBC1, kBC3, kNBC, NULL, x, BCReco::CandTrajectory_t::x1, BCReco::CandTrajectory_t::x3, x3, y, BCReco::CandTrajectory_t::y1, y1, BCReco::CandTrajectory_t::y3, and y3.

Referenced by ViewMatch().

00838 {  
00839   float xu, xs, yu, ys;      // x- or y-intercepts of a wire in u & s views
00840   float x1, x3, y1, y3, z1, z3;
00841   float x, y, z;
00842   float w;                   // predicted wire number
00843 
00844   // u-s view pairings
00845   z1 = (GDCGeom::Id(GDCGeom::kBC1).GetZPos(1)
00846     + GDCGeom::Id(GDCGeom::kBC1).GetZPos(3))/2.;
00847   z3 = (GDCGeom::Id(GDCGeom::kBC3).GetZPos(1)
00848     + GDCGeom::Id(GDCGeom::kBC3).GetZPos(3))/2.;
00849 
00850   std::list<CandPair_t*>::iterator uCandTrkItr(fCandTrk[0].begin());
00851   std::list<CandPair_t*>::iterator uCandTrkItrEnd(fCandTrk[0].end());
00852   std::list<CandPair_t*>::iterator sCandTrkItr(fCandTrk[2].begin());
00853   std::list<CandPair_t*>::iterator sCandTrkItrEnd(fCandTrk[2].end());
00854 
00855   for ( ; uCandTrkItr != uCandTrkItrEnd; ++uCandTrkItr) {
00856     CandPair_t* pair0 = *uCandTrkItr;
00857 
00858     for (sCandTrkItr=fCandTrk[2].begin();
00859      sCandTrkItr != sCandTrkItrEnd; ++sCandTrkItr) {
00860       CandPair_t* pair2 = *sCandTrkItr;
00861 
00862       xu = gsXWire1[0] - gsDelX[0]*(pair0->hit1->aHitWire-1);
00863       xs = gsXWire1[2] - gsDelX[2]*(pair2->hit1->aHitWire-1);
00864       yu = -xu*gsCotAng[0];
00865       ys = -xs*gsCotAng[2];
00866       
00867       x1 = (ys-yu)/(gsCotAng[0] - gsCotAng[2]);
00868       y1 = (ys*gsCotAng[0]-yu*gsCotAng[2])/(gsCotAng[0] - gsCotAng[2]);
00869 
00870       xu = gsXWire1[0] - gsDelX[0]*(pair0->hit3->aHitWire-1);
00871       xs = gsXWire1[2] - gsDelX[2]*(pair2->hit3->aHitWire-1);
00872       yu = -xu*gsCotAng[0];
00873       ys = -xs*gsCotAng[2];
00874 
00875       x3 = (ys-yu)/(gsCotAng[0] - gsCotAng[2]);
00876       y3 = (ys*gsCotAng[0]-yu*gsCotAng[2])/(gsCotAng[0] - gsCotAng[2]);
00877 
00878       CandTrajectory_t* candTraj = new CandTrajectory_t;
00879 
00880       candTraj->x1  = x1;
00881       candTraj->y1  = y1;
00882       candTraj->x3  = x3;
00883       candTraj->y3  = y3;
00884 
00885       candTraj->ahit[0]  = pair0->hit1;
00886       candTraj->ahit[2]  = pair2->hit1;
00887       candTraj->ahit[4]  = pair0->hit2;
00888       candTraj->ahit[6]  = pair2->hit2;
00889       candTraj->ahit[8]  = pair0->hit3;
00890       candTraj->ahit[10] = pair2->hit3;
00891       candTraj->ahit[1]  = NULL;
00892       candTraj->ahit[3]  = NULL;
00893       candTraj->ahit[5]  = NULL;
00894       candTraj->ahit[7]  = NULL;
00895       candTraj->ahit[9]  = NULL;
00896       candTraj->ahit[11] = NULL;
00897 
00898       int num = 0;
00899 
00900       std::list<AssocHit_t*>::iterator wItr;
00901       std::list<AssocHit_t*>::iterator wItrEnd;
00902 
00903       for (int ichamber=0; ichamber< GDCGeom::kNBC; ++ichamber) {
00904     const GDCGeom& geomID = GDCGeom::Id(ichamber);
00905     for (int iplane=1; iplane<4; iplane=iplane+2) {
00906       bool hasHit = false;
00907 
00908       wItr = fBCAHitList[ichamber][iplane].begin();
00909       wItrEnd = fBCAHitList[ichamber][iplane].end();
00910 
00911       z = geomID.GetZPos(iplane+1); 
00912       x = x1 + (x3-x1)/(z3-z1)*(z-z1);
00913       y = y1 + (y3-y1)/(z3-z1)*(z-z1);
00914 
00915       w = (y/gsCotAng[iplane]-x+gsXWire1[iplane])/gsDelX[iplane]+1;
00916 
00917       float minD = 320.;
00918       float diff = 320.;
00919       for ( ; wItr != wItrEnd; ++wItr) {
00920         AssocHit_t* thisHit = *wItr;
00921 
00922         if ((w-fN_ViewMatch)<= thisHit->aHitWire 
00923         && (w+fN_ViewMatch)>= thisHit->aHitWire) {
00924           hasHit = true;
00925           if (diff < fabs(w-thisHit->aHitWire) 
00926           || wItr==fBCAHitList[ichamber][iplane].begin()) {
00927         diff = fabs(w-thisHit->aHitWire);
00928 
00929         if (iplane==1)
00930           switch (ichamber) {
00931           case 0: candTraj->ahit[1] = thisHit; break;
00932           case 1: candTraj->ahit[5] = thisHit; break;
00933           case 2: candTraj->ahit[9] = thisHit; break;
00934           }
00935         else
00936           switch (ichamber) {
00937           case 0: candTraj->ahit[3]  = thisHit; break;
00938           case 1: candTraj->ahit[7]  = thisHit; break;
00939           case 2: candTraj->ahit[11] = thisHit; break;
00940           }
00941           }
00942         }
00943         if (fabs(w-thisHit->aHitWire) < minD) {
00944           minD = w-thisHit->aHitWire;
00945         }
00946       }
00947       if (fViewMatchHisto[ichamber][iplane] && minD!=320.)
00948         fViewMatchHisto[ichamber][iplane]->Fill(minD);
00949 
00950       if (!hasHit) ++num;
00951       if (!fDebug && num>1) break;
00952     }
00953       }
00954 
00955       if (num<=1) {
00956     fCandTraj.push_back(candTraj);
00957 
00958     if (fDebug>2) {
00959       std::cout << "View Match 1 " 
00960             << "x1 = " << candTraj->x1 << " "
00961             << "y1 = " << candTraj->y1 << " "
00962             << "x3 = " << candTraj->x3 << " "
00963             << "y3 = " << candTraj->y3 << std::endl;
00964       for (int i=0; i<GDCGeom::kNBCPlane; i++)
00965         if (candTraj->ahit[i]!=NULL)
00966           std::cout << candTraj->ahit[i]->aHitWire << " ";
00967       std::cout << std::endl;
00968     }
00969       }
00970       else delete candTraj;
00971     }
00972   }
00973 }

void BCReco::MatchTV (  )  [private]

Definition at line 977 of file BCReco.cxx.

References BCReco::CandTrajectory_t::ahit, BCReco::AssocHit_t::aHitWire, fBCAHitList, fCandTraj, fCandTrk, fDebug, fN_ViewMatch, fViewMatchHisto, gsCotAng, gsDelX, gsXWire1, BCReco::AssocHit_t::hit1, BCReco::AssocHit_t::hit2, kBC1, kBC3, kNBC, NULL, x, BCReco::CandTrajectory_t::x1, BCReco::CandTrajectory_t::x3, x3, y, BCReco::CandTrajectory_t::y1, y1, BCReco::CandTrajectory_t::y3, and y3.

Referenced by ViewMatch().

00977                      {
00978   float xt, xv, yt, yv;      // x- or y-intercepts of a wire in t & u views
00979   float x1, x3, y1, y3, z1, z3;
00980   float x, y, z;
00981   float w;                   // predicted wire number
00982 
00983   // v-t view pairings
00984   z1 = (GDCGeom::Id(GDCGeom::kBC1).GetZPos(2)
00985     + GDCGeom::Id(GDCGeom::kBC1).GetZPos(4))/2.;
00986   z3 = (GDCGeom::Id(GDCGeom::kBC3).GetZPos(2)
00987     + GDCGeom::Id(GDCGeom::kBC3).GetZPos(4))/2.;
00988 
00989   std::list<CandPair_t*>::iterator vCandTrkItr(fCandTrk[1].begin());
00990   std::list<CandPair_t*>::iterator vCandTrkItrEnd(fCandTrk[1].end());
00991   std::list<CandPair_t*>::iterator tCandTrkItr(fCandTrk[3].begin());
00992   std::list<CandPair_t*>::iterator tCandTrkItrEnd(fCandTrk[3].end());
00993 
00994   for ( ; vCandTrkItr != vCandTrkItrEnd; ++vCandTrkItr) {
00995     CandPair_t* pair1 = *vCandTrkItr;
00996 
00997     for (tCandTrkItr=fCandTrk[3].begin();
00998      tCandTrkItr != tCandTrkItrEnd; ++tCandTrkItr) {
00999       CandPair_t* pair3 = *tCandTrkItr;
01000 
01001       xv = gsXWire1[1] - gsDelX[1]*(pair1->hit1->aHitWire-1);
01002       xt = gsXWire1[3] - gsDelX[3]*(pair3->hit1->aHitWire-1);
01003       yv = -xv*gsCotAng[1];
01004       yt = -xt*gsCotAng[3];
01005       
01006       x1 = (yt-yv)/(gsCotAng[1] - gsCotAng[3]);
01007       y1 = (yt*gsCotAng[1]-yv*gsCotAng[3])/(gsCotAng[1] - gsCotAng[3]);
01008 
01009       xv = gsXWire1[1] - gsDelX[1]*(pair1->hit3->aHitWire-1);
01010       xt = gsXWire1[3] - gsDelX[3]*(pair3->hit3->aHitWire-1);
01011       yv = -xv*gsCotAng[1];
01012       yt = -xt*gsCotAng[3];
01013 
01014       x3 = (yt-yv)/(gsCotAng[1] - gsCotAng[3]);
01015       y3 = (yt*gsCotAng[1]-yv*gsCotAng[3])/(gsCotAng[1] - gsCotAng[3]);
01016       
01017       CandTrajectory_t* candTraj = new CandTrajectory_t;
01018 
01019       candTraj->x1  = x1;
01020       candTraj->y1  = y1;
01021       candTraj->x3  = x3;
01022       candTraj->y3  = y3;
01023 
01024       candTraj->ahit[0]  = NULL;
01025       candTraj->ahit[2]  = NULL;
01026       candTraj->ahit[4]  = NULL;
01027       candTraj->ahit[6]  = NULL;
01028       candTraj->ahit[8]  = NULL;
01029       candTraj->ahit[10] = NULL;
01030       candTraj->ahit[1]  = pair1->hit1;
01031       candTraj->ahit[3]  = pair3->hit1;
01032       candTraj->ahit[5]  = pair1->hit2;
01033       candTraj->ahit[7]  = pair3->hit2;
01034       candTraj->ahit[9]  = pair1->hit3;
01035       candTraj->ahit[11] = pair3->hit3;
01036 
01037       int num = 0;
01038 
01039       std::list<AssocHit_t*>::iterator wItr;
01040       std::list<AssocHit_t*>::iterator wItrEnd;
01041 
01042       for (int ichamber=0; ichamber< GDCGeom::kNBC; ++ichamber) {
01043     const GDCGeom& geomID = GDCGeom::Id(ichamber);
01044     for (int iplane=0; iplane<GDCGeom::kNPlane; iplane=iplane+2) {
01045       bool hasHit = false;
01046 
01047       z = geomID.GetZPos(iplane+1); 
01048       x = x1 + (x3-x1)/(z3-z1)*(z-z1);
01049       y = y1 + (y3-y1)/(z3-z1)*(z-z1);
01050 
01051       w = (y/gsCotAng[iplane]-x+gsXWire1[iplane])/gsDelX[iplane]+1;
01052 
01053       float minD = 320.;
01054       float diff = 320;
01055 
01056       wItr = fBCAHitList[ichamber][iplane].begin();
01057       wItrEnd = fBCAHitList[ichamber][iplane].end();
01058       for ( ; wItr != wItrEnd; ++wItr) {
01059         AssocHit_t* thisHit = *wItr;
01060         if ((w-fN_ViewMatch) <= thisHit->aHitWire
01061         &&(w+fN_ViewMatch) >= thisHit->aHitWire) {        
01062           hasHit = true;
01063           if (diff < fabs(w-thisHit->aHitWire)
01064           || wItr==fBCAHitList[ichamber][iplane].begin()) {
01065         diff = fabs(w-thisHit->aHitWire);
01066         if (iplane==0)
01067           switch (ichamber) {
01068           case 0: candTraj->ahit[0] = thisHit; break;
01069           case 1: candTraj->ahit[4] = thisHit; break;
01070           case 2: candTraj->ahit[8] = thisHit; break;
01071           }
01072         else
01073           switch (ichamber) {
01074           case 0: candTraj->ahit[2]  = thisHit; break;
01075           case 1: candTraj->ahit[6]  = thisHit; break;
01076           case 2: candTraj->ahit[10] = thisHit; break;
01077           }
01078           }
01079         }
01080         if (fabs(w-thisHit->aHitWire) < minD) {
01081           minD = w-thisHit->aHitWire;
01082         }
01083       }
01084       if (fViewMatchHisto[ichamber][iplane] && minD!=320.)
01085         fViewMatchHisto[ichamber][iplane]->Fill(minD);
01086 
01087       if (!hasHit) ++num;
01088       if (!fDebug && num>1) break;
01089     }
01090       }
01091  
01092       if (num<=1) {
01093     fCandTraj.push_back(candTraj);
01094 
01095     if (fDebug>2) {
01096       std::cout << "View Match 2 " 
01097             << "x1 = " << candTraj->x1 << " "
01098             << "y1 = " << candTraj->y1 << " "
01099             << "x3 = " << candTraj->x3 << " "
01100             << "y3 = " << candTraj->y3 << std::endl;
01101       for (int i=0; i<GDCGeom::kNBCPlane; i++)
01102         if (candTraj->ahit[i]!=NULL)
01103           std::cout << candTraj->ahit[i]->aHitWire << " ";
01104       std::cout << std::endl;
01105     }
01106       }
01107       else delete candTraj;
01108     }
01109   }
01110 }

JobCResult BCReco::Reco ( EDMEventHandle evt  )  [virtual]

Reimplemented from JobCModule.

Definition at line 406 of file BCReco.cxx.

References EDMEventHandle::Cal(), CleanUpTrk(), Clear(), DoCrossings(), EDMEventHeader::Event(), BCRecoNt::evt, fBCHitList, fCandTraj, FillNt(), fMaxNWirePerChamber, fMaxTotalNWire, fNTrack, fNtuple, fTrackFit, EDMDataBucket::Get(), EDMDataBucket::GetFolder(), EDMEventHandle::Header(), HitAssoc(), kBC1, kBC2, kBC3, JobCModule::kFailed, kNBC, kNPlane, JobCModule::kPassed, EDMDataBucket::MakeFolder(), EDMDataBucket::Put(), EDMEventHandle::Reco(), EDMEventHeader::Run(), BCRecoNt::run, BCRecoNt::sub, EDMEventHeader::SubRun(), TrkFind(), TrkFit(), ViewMatch(), x3, y1, and y3.

00407 {
00408 
00409   if (evt.Reco().GetFolder("./bc")==0) {
00410     evt.Reco().MakeFolder("./bc");
00411   }
00412   if (evt.Reco().GetFolder("./bc/linefit")==0) {
00413     evt.Reco().MakeFolder("./bc/linefit");
00414   }
00415 
00416   // Record header information to ntuple
00417   fNtuple->run = evt.Header().Run();
00418   fNtuple->sub = evt.Header().SubRun();
00419   fNtuple->evt = evt.Header().Event();
00420 
00421   // Extract wire hits from the event
00422   const char* dir1 = "./bc1";
00423   const char* dir2 = "./bc2";
00424   const char* dir3 = "./bc3";
00425 
00426   int nWire = 0;
00427 
00428   // Use Calibrated data
00429   std::vector<const DCWire*> bc1digit;
00430   std::vector<const DCWire*> bc2digit;
00431   std::vector<const DCWire*> bc3digit;
00432 
00433   try { 
00434     evt.Cal().Get(dir1, bc1digit); 
00435     if ((int) bc1digit.size() > fMaxNWirePerChamber) return kFailed;
00436     nWire += bc1digit.size();
00437   }
00438   catch (EDMException e) { return JobCModule::kFailed; }
00439   try { 
00440     evt.Cal().Get(dir2, bc2digit); 
00441     if ((int) bc2digit.size() > fMaxNWirePerChamber) return kFailed;
00442     nWire += bc2digit.size();
00443   }
00444   catch (EDMException e) { return JobCModule::kFailed; }
00445   try { 
00446     evt.Cal().Get(dir3, bc3digit); 
00447     if ((int) bc3digit.size() > fMaxNWirePerChamber) return kFailed;
00448     nWire += bc3digit.size();
00449   }
00450   catch (EDMException e) { return JobCModule::kFailed; }
00451 
00452   if (nWire > fMaxTotalNWire) return kFailed;
00453   
00454   for (int i=0; i<int(bc1digit.size()); ++i) {
00455     short t = bc1digit[i]->GetTime();
00456     if (t>-20 && t<40) {
00457       Hit* hit = new Hit(bc1digit[i]->GetWire(), t);
00458       fBCHitList[0][bc1digit[i]->GetPlane()-1].push_back(hit);
00459     }
00460   }
00461 
00462   for (int i=0; i<int(bc2digit.size()); ++i) {
00463     short t = bc2digit[i]->GetTime();
00464     if (t>-20 && t<40) {
00465       Hit* hit = new Hit(bc2digit[i]->GetWire(), t);
00466       fBCHitList[1][bc2digit[i]->GetPlane()-1].push_back(hit);
00467     }
00468   }
00469 
00470   for (int i=0; i<int(bc3digit.size()); ++i) {
00471     short t = bc3digit[i]->GetTime();
00472     if (t>-20 && t<40) {
00473       Hit* hit = new Hit(bc3digit[i]->GetWire(), t);
00474       fBCHitList[2][bc3digit[i]->GetPlane()-1].push_back(hit);
00475     }
00476   }
00477 
00478   for (int ichamber=0; ichamber<GDCGeom::kNBC; ++ichamber) {
00479     for (int iplane=0; iplane<GDCGeom::kNPlane; ++iplane) {
00480       sort(fBCHitList[ichamber][iplane].begin(), 
00481        fBCHitList[ichamber][iplane].end(),
00482        HitComp());
00483     }
00484   }
00485 
00486   HitAssoc();
00487   TrkFind();
00488   ViewMatch();
00489   TrkFit();
00490   CleanUpTrk();
00491 
00492   float z1, z2, z3;
00493   z1 = (GDCGeom::Id(GDCGeom::kBC1).GetZPos(1)
00494     + GDCGeom::Id(GDCGeom::kBC1).GetZPos(3))/2.;
00495   z2 = (GDCGeom::Id(GDCGeom::kBC2).GetZPos(1)
00496     + GDCGeom::Id(GDCGeom::kBC2).GetZPos(3))/2.;
00497   z3 = (GDCGeom::Id(GDCGeom::kBC3).GetZPos(1)
00498     + GDCGeom::Id(GDCGeom::kBC3).GetZPos(3))/2.;
00499 
00500   if (fCandTraj.empty()) DoCrossings(z1, z2, z3);
00501 
00502   // Fill the ntuple
00503   if (fNTrack<=10) FillNt();
00504 
00505   // Store the line fit in the event
00506   float x1, y1;
00507   float x3, y3;
00508   int   wire[12];
00509 
00510   std::list<TrackFit_t*>::iterator trackFitItr(fTrackFit.begin());
00511   std::list<TrackFit_t*>::iterator trackFitItrEnd(fTrackFit.end());
00512 
00513   for ( ; trackFitItr != trackFitItrEnd; ++trackFitItr) {
00514     x1 = (*trackFitItr)->x1;
00515     y1 = (*trackFitItr)->y1;
00516     x3 = (*trackFitItr)->x3;
00517     y3 = (*trackFitItr)->y3;
00518 
00519     for (int i=0; i<12; i++)
00520       wire[i] = (*trackFitItr)->wire[i];
00521 
00522     BCLine l(x1, y1, z1, x3, y3, z3, wire, (*trackFitItr)->goldenTrk);
00523 
00524     evt.Reco().Put(l, "./bc/linefit");
00525   }
00526 
00527   Clear();
00528 
00529   return JobCModule::kPassed;
00530 }

void BCReco::TrkFind (  )  [private]

Definition at line 724 of file BCReco.cxx.

References c1, fBCAHitList, fCandTrk, fN_TrkFind, fTrkFindHisto, kBC1, kBC2, kBC3, and kNPlane.

Referenced by Reco().

00725 {
00726 //======================================================================
00727 // Track Finding
00728 // - Loops through all pairs of associated hits in BC1 and BC3.
00729 // - Search a road +-n wires wide (fN_TrkFind) around the prediction w2
00730 //   in the list of hits BC2
00731 // - Pairs passing this test are kept in track candidate list (fCandTrk)
00732 //======================================================================
00733   for (int iplane=0; iplane<GDCGeom::kNPlane; ++iplane) {
00734     float z1, z2, z3;
00735     float c1, c2;      // geometric constants
00736 
00737     z1 = GDCGeom::Id(GDCGeom::kBC1).GetZPos(iplane+1);
00738     z2 = GDCGeom::Id(GDCGeom::kBC2).GetZPos(iplane+1);
00739     z3 = GDCGeom::Id(GDCGeom::kBC3).GetZPos(iplane+1);
00740     c1 = (z3-z2)/(z3-z1);  
00741     c2 = (z2-z1)/(z3-z1);
00742 
00743     std::list<AssocHit_t*>::iterator w1Itr(fBCAHitList[0][iplane].begin());
00744     std::list<AssocHit_t*>::iterator w1ItrEnd(fBCAHitList[0][iplane].end());
00745 
00746     for ( ; w1Itr != w1ItrEnd; ++w1Itr) {
00747       AssocHit_t* hit0 = *w1Itr;
00748 
00749       std::list<AssocHit_t*>::iterator w3Itr(fBCAHitList[2][iplane].begin());
00750       std::list<AssocHit_t*>::iterator w3ItrEnd(fBCAHitList[2][iplane].end());
00751     
00752       for ( ; w3Itr != w3ItrEnd; ++w3Itr) {
00753     AssocHit_t* hit2 = *w3Itr;
00754     
00755     float w2;      // predicted wire in BC2
00756     w2 = c1*hit0->aHitWire + c2*hit2->aHitWire;
00757 
00758     std::list<AssocHit_t*>::iterator 
00759       w2Itr(fBCAHitList[1][iplane].begin());
00760     std::list<AssocHit_t*>::iterator 
00761       w2ItrEnd(fBCAHitList[1][iplane].end());
00762 
00763     float minD = 320.;
00764     for ( ; w2Itr != w2ItrEnd; ++w2Itr) {
00765       AssocHit_t* hit1 = *w2Itr;
00766 
00767       if ((w2-fN_TrkFind)<= hit1->aHitWire &&
00768           (w2+fN_TrkFind)>= hit1->aHitWire) {
00769         CandPair_t* candPair = new CandPair_t;  // pairs of candidates
00770         candPair->hit1 = hit0;
00771         candPair->hit2 = hit1;
00772         candPair->hit3 = hit2;
00773         fCandTrk[iplane].push_back(candPair);
00774       }
00775       if (fabs(w2 - hit1->aHitWire) < minD) {
00776         minD = w2 - hit1->aHitWire;
00777       }
00778     }
00779     if (fTrkFindHisto[iplane] && minD!=320.) {
00780       fTrkFindHisto[iplane]->Fill(minD);
00781     }
00782       }
00783     }
00784   }
00785 
00786   if (fDebug>1) {
00787     std::cout << "Track Find" << std::endl;
00788     for (int iplane=0; iplane<GDCGeom::kNPlane; ++iplane) {
00789       std::list<CandPair_t*>::iterator candTrkItr(fCandTrk[iplane].begin());
00790       std::list<CandPair_t*>::iterator candTrkItrEnd(fCandTrk[iplane].end());
00791 
00792       for ( ; candTrkItr != candTrkItrEnd; ++candTrkItr) {
00793     CandPair_t* thisPair = (*candTrkItr);
00794     std::cout << "Plane " << iplane << " "
00795           << thisPair->hit1->aHitWire << " "
00796           << thisPair->hit2->aHitWire << " "
00797           << thisPair->hit3->aHitWire
00798           << std::endl;
00799       }
00800     } 
00801   }
00802 }

void BCReco::TrkFit (  )  [private]

Definition at line 1114 of file BCReco.cxx.

References fFitFunc, FitLSQ(), FitTMinuit(), and fNTrack.

Referenced by Reco().

01115 {
01116   fNTrack = 0;
01117 
01118   switch (fFitFunc) {
01119   case 0: // TMinuit
01120     FitTMinuit();
01121     return;
01122 
01123   case 1: // LSQ
01124     FitLSQ();
01125     return;
01126 
01127   default:
01128     std::cerr << "Invalid BCReco fit function " << fFitFunc
01129           << std::endl;
01130     exit(-1);
01131     break;
01132   }
01133 }

void BCReco::Update ( const CfgConfig c  )  [virtual]

Implements CfgObserver.

Definition at line 1595 of file BCReco.cxx.

References fDebug, fFitFunc, fMaxItr, fMaxNWirePerChamber, fMaxTotalNWire, fN_TrkFind, fN_ViewMatch, fNWireItr, fPrintLevel, fWidth_TrkFit, and fWidthTrks.

01596 {
01597   c("Debug").       Get(fDebug);
01598   c("PrintLevel").  Get(fPrintLevel);
01599   c("N_TrkFind").   Get(fN_TrkFind);
01600   c("N_ViewMatch"). Get(fN_ViewMatch);
01601   c("MaxItr").      Get(fMaxItr);
01602   c("NWireItr").    Get(fNWireItr);
01603   c("Width_TrkFit").Get(fWidth_TrkFit);
01604   c("WidthTrks").   Get(fWidthTrks);
01605   c("FitFunc").     Get(fFitFunc);
01606   c("MaxNWirePerChamber").Get(fMaxNWirePerChamber);
01607   c("MaxTotalNWire").Get(fMaxTotalNWire);
01608 }

void BCReco::ViewMatch (  )  [private]

Definition at line 806 of file BCReco.cxx.

References ct, fCandTraj, fDebug, MatchSU(), MatchTV(), and NULL.

Referenced by Reco().

00807 {
00808 //======================================================================
00809 // View Matching
00810 // - Loop over track candidate list.
00811 // - Predict wire indices in complementary views.
00812 // - Form straight line 3D trajectory.
00813 //======================================================================
00814   MatchSU();
00815   MatchTV();
00816 
00817   if (fDebug>1) {
00818     std::cout << "View Match Trajectory " << std::endl;
00819     std::list<CandTrajectory_t*>::iterator candTrajItr(fCandTraj.begin());
00820     std::list<CandTrajectory_t*>::iterator candTrajItrEnd(fCandTraj.end());
00821     for ( ; candTrajItr != candTrajItrEnd; ++candTrajItr) {
00822       CandTrajectory_t* ct = *candTrajItr;
00823       std::cout << "x1 = " << ct->x1 << " "
00824         << "y1 = " << ct->y1 << " "
00825         << "x3 = " << ct->x3 << " "
00826         << "y3 = " << ct->y3 << std::endl;
00827       for (int i=0; i<GDCGeom::kNBCPlane; i++)
00828     if (ct->ahit[i]!=NULL)
00829       std::cout << ct->ahit[i]->aHitWire << " ";
00830       std::cout << std::endl;
00831     }
00832   }
00833 }


Member Data Documentation

TH2F* BCReco::fBC3xdxdzHisto [private]

x:dx/dz

Definition at line 153 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH2F* BCReco::fBC3xyHisto [private]

x:y

Definition at line 152 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH2F* BCReco::fBC3ydydzHisto [private]

y:dy/dz

Definition at line 154 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

std::list<AssocHit_t*> BCReco::fBCAHitList[3][4] [private]

Definition at line 129 of file BCReco.h.

Referenced by Clear(), HitAssoc(), MatchSU(), MatchTV(), and TrkFind().

std::vector<Hit*> BCReco::fBCHitList[3][4] [private]

Definition at line 128 of file BCReco.h.

Referenced by Clear(), DoCrossings(), FitLSQ(), FitTMinuit(), HitAssoc(), and Reco().

std::list<CandTrajectory_t*> BCReco::fCandTraj [private]

Definition at line 131 of file BCReco.h.

Referenced by Clear(), FitLSQ(), FitTMinuit(), MatchSU(), MatchTV(), Reco(), and ViewMatch().

std::list<CandPair_t*> BCReco::fCandTrk[4] [private]

Definition at line 130 of file BCReco.h.

Referenced by Clear(), MatchSU(), MatchTV(), and TrkFind().

TH1F* BCReco::fChi2Histo [private]

chi2

Definition at line 155 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

int BCReco::fDebug [private]

Definition at line 161 of file BCReco.h.

Referenced by BCReco(), HitAssoc(), MatchSU(), MatchTV(), Update(), and ViewMatch().

TH1F* BCReco::fdsdzHisto [private]

ds/dz

Definition at line 148 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH1F* BCReco::fdxdzHisto [private]

dx/dz

Definition at line 146 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH1F* BCReco::fdydzHisto [private]

dy/dz

Definition at line 147 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH1F* BCReco::fFinalTrkHisto [private]

Distance(Fit track - hit wire).

Definition at line 157 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

int BCReco::fFitFunc [private]

Definition at line 170 of file BCReco.h.

Referenced by TrkFit(), and Update().

int BCReco::fMaxItr [private]

Definition at line 165 of file BCReco.h.

Referenced by FitTMinuit(), and Update().

int BCReco::fMaxNWirePerChamber [private]

Definition at line 171 of file BCReco.h.

Referenced by Reco(), and Update().

int BCReco::fMaxTotalNWire [private]

Definition at line 172 of file BCReco.h.

Referenced by Reco(), and Update().

TMinuit* BCReco::fMinuit [private]

MINUIT interface.

Definition at line 138 of file BCReco.h.

Referenced by BCReco(), and FitTMinuit().

int BCReco::fN_TrkFind [private]

Definition at line 163 of file BCReco.h.

Referenced by TrkFind(), and Update().

int BCReco::fN_ViewMatch [private]

Definition at line 164 of file BCReco.h.

Referenced by MatchSU(), MatchTV(), and Update().

int BCReco::fNTrack [private]

Definition at line 133 of file BCReco.h.

Referenced by CleanUpTrk(), DoCrossings(), FitLSQ(), FitTMinuit(), Reco(), and TrkFit().

TH1F* BCReco::fnTrackHisto [private]

Number of tracks.

Definition at line 141 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TTree* BCReco::fNtTree [private]

Ntuple tree.

Definition at line 135 of file BCReco.h.

Referenced by FillNt(), MakeHistos(), and ~BCReco().

BCRecoNt* BCReco::fNtuple [private]

Branch for the ntuple tree.

Definition at line 136 of file BCReco.h.

Referenced by FillNt(), MakeHistos(), Reco(), and ~BCReco().

int BCReco::fNWireItr [private]

Definition at line 166 of file BCReco.h.

Referenced by FitLSQ(), and Update().

int BCReco::fPrintLevel [private]

Definition at line 162 of file BCReco.h.

Referenced by BCReco(), and Update().

TH1F* BCReco::fRChi2Histo [private]

Reduced chi2.

Definition at line 156 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH1F* BCReco::ftargetxHisto [private]

x at target

Definition at line 149 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH2F* BCReco::ftargetxyHisto [private]

x:y at target

Definition at line 151 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH1F* BCReco::ftargetyHisto [private]

y at target

Definition at line 150 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

std::list<TrackFit_t*> BCReco::fTrackFit [private]

Definition at line 132 of file BCReco.h.

Referenced by CleanUpTrk(), Clear(), DoCrossings(), FillNt(), FitLSQ(), FitTMinuit(), and Reco().

TH1F* BCReco::fTrkFindHisto[4] [private]

Predicted wire - hit wire in TrkFind.

Definition at line 139 of file BCReco.h.

Referenced by BCReco(), MakeHistos(), TrkFind(), and ~BCReco().

TH1F* BCReco::fViewMatchHisto[3][4] [private]

Predicted wire - hit wire in ViewMatch.

Definition at line 140 of file BCReco.h.

Referenced by BCReco(), MakeHistos(), MatchSU(), MatchTV(), and ~BCReco().

float BCReco::fWidth_TrkFit [private]

Definition at line 168 of file BCReco.h.

Referenced by DoCrossings(), FitLSQ(), FitTMinuit(), and Update().

float BCReco::fWidthTrks [private]

Definition at line 169 of file BCReco.h.

Referenced by CleanUpTrk(), and Update().

TH1F* BCReco::fx1Histo [private]

x1

Definition at line 142 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH1F* BCReco::fx3Histo [private]

x3

Definition at line 144 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH1F* BCReco::fy1Histo [private]

y1

Definition at line 143 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().

TH1F* BCReco::fy3Histo [private]

y3

Definition at line 145 of file BCReco.h.

Referenced by MakeHistos(), and ~BCReco().


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 08:03:58 2009 for MIPP(E907) by  doxygen 1.4.7