Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TrackSegmentCam Class Reference

#include <TrackSegmentCam.h>

List of all members.

Public Member Functions

 TrackSegmentCam (ClusterCam *clustm, ClusterCam *clust0, ClusterCam *clustp)
virtual ~TrackSegmentCam ()
void AddCluster (ClusterCam *clust)
bool ContainsCluster (ClusterCam *clust)
ClusterCamGetCluster (unsigned int i)
unsigned int GetEntries () const
int GetBegPlane () const
int GetEndPlane () const
int GetPlaneView () const
double GetBegDir ()
double GetBegTPos ()
double GetBegZPos () const
double GetEndDir ()
double GetEndTPos ()
double GetEndZPos () const
void AddSegment (TrackSegmentCam *segment)
bool IsAssoc (TrackSegmentCam *segment)
void AddAssocSegToBeg (TrackSegmentCam *seg)
void AddAssocSegToEnd (TrackSegmentCam *seg)
TrackSegmentCamGetAssocSegBeg (unsigned int i)
TrackSegmentCamGetAssocSegEnd (unsigned int i)
unsigned int GetNAssocSegBeg () const
unsigned int GetNAssocSegEnd () const
void AddPrefSegToBeg (TrackSegmentCam *seg)
void AddPrefSegToEnd (TrackSegmentCam *seg)
TrackSegmentCamGetPrefSegBeg (unsigned int i)
TrackSegmentCamGetPrefSegEnd (unsigned int i)
unsigned int GetNPrefSegBeg () const
unsigned int GetNPrefSegEnd () const
void AddMatchSegToBeg (TrackSegmentCam *seg)
void AddMatchSegToEnd (TrackSegmentCam *seg)
TrackSegmentCamGetMatchSegBeg (unsigned int i)
TrackSegmentCamGetMatchSegEnd (unsigned int i)
unsigned int GetNMatchSegBeg () const
unsigned int GetNMatchSegEnd () const
void SetTmpTrkFlag (int flag)
int GetTmpTrkFlag () const
void SetUID (int uid)
int GetUID () const
void SetTrkFlag (int flag)
int GetTrkFlag () const
void SetSeedSegment (TrackSegmentCam *segment)
TrackSegmentCamGetSeedSegment ()
void SetNPlanes (int nplanes)
int GetNPlanes () const
double GetScore (vector< TrackSegmentCam * > *BegSegBank=0, vector< TrackSegmentCam * > *EndSegBank=0)
double GetBegTime () const
double GetEndTime () const
void SetPartner (TrackSegmentCam *segment)
TrackSegmentCamGetPartner ()

Private Attributes

vector< ClusterCam * > ClustersInSegment
vector< TrackSegmentCam * > fBegAssociatedSegList
vector< TrackSegmentCam * > fEndAssociatedSegList
vector< TrackSegmentCam * > fBegPreferredSegList
vector< TrackSegmentCam * > fEndPreferredSegList
vector< TrackSegmentCam * > fBegMatchedSegList
vector< TrackSegmentCam * > fEndMatchedSegList
TrackSegmentCamfSeedSegment
TrackSegmentCamfPartner
int fUID
int fBegPlane
int fEndPlane
double fBegVtxZ
double fEndVtxZ
int fTrkFlag
int fTmpTrkFlag
int fPlaneView
int fNPlanes
double fBegTime
double fEndTime
const double StripWidth


Constructor & Destructor Documentation

TrackSegmentCam::TrackSegmentCam ClusterCam clustm,
ClusterCam clust0,
ClusterCam clustp
 

Definition at line 20 of file TrackSegmentCam.cxx.

00020                                                                                           :
00021   fSeedSegment(0), fPartner(0), fUID(0), fBegPlane(999), fEndPlane(-999), fBegVtxZ(999.), 
00022   fEndVtxZ(-999.), fTrkFlag(0), fTmpTrkFlag(0), fPlaneView(-1), fNPlanes(0), 
00023   fBegTime(0.), fEndTime(0.), StripWidth(4.108e-2)
00024 {
00025   fPlaneView=clust0->GetPlaneView();
00026   fBegTime=clust0->GetBegTime();
00027   fEndTime=clust0->GetEndTime();
00028 
00029   this->AddCluster(clustm); this->AddCluster(clust0); this->AddCluster(clustp);
00030 }

TrackSegmentCam::~TrackSegmentCam  )  [virtual]
 

Definition at line 35 of file TrackSegmentCam.cxx.

References ClustersInSegment, fBegAssociatedSegList, fBegMatchedSegList, fBegPreferredSegList, fEndAssociatedSegList, fEndMatchedSegList, and fEndPreferredSegList.

00036 {
00037   ClustersInSegment.clear();
00038   fBegAssociatedSegList.clear();
00039   fEndAssociatedSegList.clear();
00040   fBegPreferredSegList.clear();
00041   fEndPreferredSegList.clear();
00042   fBegMatchedSegList.clear();
00043   fEndMatchedSegList.clear();
00044 }


Member Function Documentation

void TrackSegmentCam::AddAssocSegToBeg TrackSegmentCam seg  ) 
 

Definition at line 370 of file TrackSegmentCam.cxx.

References fBegAssociatedSegList.

Referenced by AlgTrackCamList::NearDetectorTriplets().

00371 {
00372   fBegAssociatedSegList.push_back(seg);
00373   return;
00374 }

void TrackSegmentCam::AddAssocSegToEnd TrackSegmentCam seg  ) 
 

Definition at line 379 of file TrackSegmentCam.cxx.

References fEndAssociatedSegList.

Referenced by AlgTrackCamList::NearDetectorTriplets().

00380 {
00381   fEndAssociatedSegList.push_back(seg);
00382   return;
00383 }

void TrackSegmentCam::AddCluster ClusterCam clust  ) 
 

Definition at line 49 of file TrackSegmentCam.cxx.

References ClustersInSegment, ContainsCluster(), fBegPlane, fBegTime, fBegVtxZ, fEndPlane, fEndTime, fEndVtxZ, ClusterCam::GetBegTime(), ClusterCam::GetEndTime(), ClusterCam::GetPlane(), and ClusterCam::GetZPos().

Referenced by AddSegment().

00050 {
00051   if(clust) {
00052     if(this->ContainsCluster(clust)==false) 
00053       {
00054         ClustersInSegment.push_back(clust);
00055         if( fBegPlane > clust->GetPlane()){ fBegPlane = clust->GetPlane(); fBegVtxZ =  clust->GetZPos(); }
00056         if( fEndPlane < clust->GetPlane()){ fEndPlane = clust->GetPlane(); fEndVtxZ =  clust->GetZPos(); }
00057         
00058         if( clust->GetBegTime()<fBegTime ) { fBegTime=clust->GetBegTime(); }
00059         if( clust->GetEndTime()>fEndTime ) { fEndTime=clust->GetEndTime(); }
00060       }
00061   }
00062   
00063   return;
00064 }

void TrackSegmentCam::AddMatchSegToBeg TrackSegmentCam seg  ) 
 

Definition at line 442 of file TrackSegmentCam.cxx.

References fBegMatchedSegList.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::NearDetectorTriplets().

00443 {
00444   fBegMatchedSegList.push_back(seg);
00445   return;
00446 }

void TrackSegmentCam::AddMatchSegToEnd TrackSegmentCam seg  ) 
 

Definition at line 451 of file TrackSegmentCam.cxx.

References fEndMatchedSegList.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::NearDetectorTriplets().

00452 {
00453   fEndMatchedSegList.push_back(seg);
00454   return;
00455 }

void TrackSegmentCam::AddPrefSegToBeg TrackSegmentCam seg  ) 
 

Definition at line 406 of file TrackSegmentCam.cxx.

References fBegPreferredSegList.

Referenced by AlgTrackCamList::FindPreferredJoins().

00407 {
00408   fBegPreferredSegList.push_back(seg);
00409   return;
00410 }

void TrackSegmentCam::AddPrefSegToEnd TrackSegmentCam seg  ) 
 

Definition at line 415 of file TrackSegmentCam.cxx.

References fEndPreferredSegList.

Referenced by AlgTrackCamList::FindPreferredJoins().

00416 {
00417   fEndPreferredSegList.push_back(seg);
00418   return;
00419 }

void TrackSegmentCam::AddSegment TrackSegmentCam segment  ) 
 

Definition at line 91 of file TrackSegmentCam.cxx.

References AddCluster(), GetCluster(), and GetEntries().

Referenced by AlgTrackCamList::FindMatchedJoins(), AlgTrackCamList::Form2DTracks(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00092 {
00093   for(unsigned int i=0; i<segment->GetEntries(); ++i) {
00094     this->AddCluster(segment->GetCluster(i));    
00095   }
00096 
00097   return;
00098 }

bool TrackSegmentCam::ContainsCluster ClusterCam clust  ) 
 

Definition at line 69 of file TrackSegmentCam.cxx.

References ClustersInSegment.

Referenced by AddCluster(), and IsAssoc().

00070 {
00071   for(unsigned int i=0; i<ClustersInSegment.size(); ++i) {
00072     if(clust==ClustersInSegment[i]) {return true;}
00073   }
00074 
00075   return false;
00076 }

TrackSegmentCam * TrackSegmentCam::GetAssocSegBeg unsigned int  i  ) 
 

Definition at line 388 of file TrackSegmentCam.cxx.

References fBegAssociatedSegList.

Referenced by AlgTrackCamList::FindAllAssociations(), AlgTrackCamList::FindPreferredJoins(), and AlgTrackCamList::NearDetectorTriplets().

00389 {
00390   if(i<fBegAssociatedSegList.size()) {return fBegAssociatedSegList[i];}
00391   else return 0;
00392 }

TrackSegmentCam * TrackSegmentCam::GetAssocSegEnd unsigned int  i  ) 
 

Definition at line 397 of file TrackSegmentCam.cxx.

References fEndAssociatedSegList.

Referenced by AlgTrackCamList::FindAllAssociations(), AlgTrackCamList::FindPreferredJoins(), and AlgTrackCamList::NearDetectorTriplets().

00398 {
00399   if(i<fEndAssociatedSegList.size()) {return fEndAssociatedSegList[i];}
00400   else return 0;
00401 }

double TrackSegmentCam::GetBegDir  ) 
 

Definition at line 285 of file TrackSegmentCam.cxx.

References ClustersInSegment, fBegPlane, GetEntries(), HitCam::GetTPos(), and HitCam::GetZPos().

Referenced by AlgTrackCamList::FindMatchedJoins(), and IsAssoc().

00286 {
00287   double z=0.0,t=0.0;
00288   double sw=0.0,swx=0.0,swx2=0.0;
00289   double swy=0.0,swyx=0.0;
00290   unsigned int nclusters = this->GetEntries();
00291   unsigned int nhits = 0;
00292   HitCam* hit=0;
00293   for( unsigned int i=0; i<nclusters; ++i)
00294     {//find the clusters on the first plane in the segment
00295       if(ClustersInSegment[i]->GetPlane()<fBegPlane+10)
00296         {
00297           nhits = ClustersInSegment[i]->GetEntries();
00298 
00299           //loop over hits in cluster
00300           for(unsigned int j=0;j<nhits;++j)
00301             {
00302               hit = ClustersInSegment[i]->GetHit(j);
00303               if(hit)
00304                 {
00305                   z=hit->GetZPos(); t=hit->GetTPos();
00306                   sw+=1.0; swx+=z; swx2+=z*z; 
00307                   swy+=t; swyx+=t*z;;
00308                 }
00309             }
00310         }
00311     }
00312   if((swx*swx-sw*swx2)!=0) {return (swx*swy-sw*swyx)/(swx*swx-sw*swx2);}
00313   else return 0;
00314 }

int TrackSegmentCam::GetBegPlane  )  const
 

Definition at line 111 of file TrackSegmentCam.cxx.

Referenced by AlgTrackCamList::FindAllAssociations(), AlgTrackCamList::FindMatchedJoins(), AlgTrackCamList::FindPreferredJoins(), AlgTrackCamList::FirstUVComparison(), AlgTrackCamList::Form2DTracks(), AlgTrackCamList::Form3DTracks(), GetScore(), IsAssoc(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00112 {
00113   return fBegPlane;
00114 }

double TrackSegmentCam::GetBegTime  )  const [inline]
 

Definition at line 85 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::SecondUVComparison().

00085 { return fBegTime; };

double TrackSegmentCam::GetBegTPos  ) 
 

Definition at line 219 of file TrackSegmentCam.cxx.

References ClustersInSegment, GetEntries(), and HitCam::GetTPos().

Referenced by AlgTrackCamList::FindAllAssociations(), AlgTrackCamList::FindMatchedJoins(), AlgTrackCamList::FindPreferredJoins(), AlgTrackCamList::FirstUVComparison(), AlgTrackCamList::Form2DTracks(), IsAssoc(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00220 {
00221   double tot=0.0,begt=0.0;
00222   //Loop over clusters in segment
00223   unsigned int nclusters = this->GetEntries();
00224   unsigned int nhits = 0;
00225   HitCam* hit=0;
00226   for( unsigned int i=0; i<nclusters; ++i)
00227     {//find the clusters on the first plane in the segment
00228       if(ClustersInSegment[i]->GetPlane()==fBegPlane)
00229         {
00230           nhits = ClustersInSegment[i]->GetEntries();
00231 
00232           //loop over hits in cluster
00233           for(unsigned int j=0;j<nhits;++j)
00234             {
00235               hit = ClustersInSegment[i]->GetHit(j);
00236               if(hit)
00237                 {
00238                   begt+=hit->GetTPos();
00239                   tot+=1.0;
00240                 }
00241             }
00242         }
00243     }
00244   if(tot>0) return (begt/tot); 
00245   else return 0;
00246 }

double TrackSegmentCam::GetBegZPos  )  const
 

Definition at line 354 of file TrackSegmentCam.cxx.

Referenced by IsAssoc(), and AlgTrackCamList::Join2DTracks().

00355 {
00356   return fBegVtxZ;
00357 }

ClusterCam * TrackSegmentCam::GetCluster unsigned int  i  ) 
 

Definition at line 81 of file TrackSegmentCam.cxx.

References ClustersInSegment.

Referenced by AddSegment(), AlgTrackCamList::FirstUVComparison(), AlgTrackCamList::Form2DTracks(), AlgTrackCamList::Form3DTracks(), GetScore(), IsAssoc(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00082 {
00083   if(i<ClustersInSegment.size()) {return ClustersInSegment[i];}
00084   
00085   else {return 0;}
00086 }

double TrackSegmentCam::GetEndDir  ) 
 

Definition at line 319 of file TrackSegmentCam.cxx.

References ClustersInSegment, fEndPlane, GetEntries(), HitCam::GetTPos(), and HitCam::GetZPos().

Referenced by AlgTrackCamList::FindMatchedJoins(), and IsAssoc().

00320 {
00321   double z=0.0,t=0.0;
00322   double sw=0.0,swx=0.0,swx2=0.0;
00323   double swy=0.0,swyx=0.0;
00324   unsigned int nclusters = this->GetEntries();
00325   unsigned int nhits = 0;
00326   HitCam* hit=0;
00327   for( unsigned int i=0; i<nclusters; ++i)
00328     {//find the clusters on the first plane in the segment
00329       if(ClustersInSegment[i]->GetPlane()>fEndPlane-10)
00330         {
00331           nhits = ClustersInSegment[i]->GetEntries();
00332 
00333           //loop over hits in cluster
00334           for(unsigned int j=0;j<nhits;++j)
00335             {
00336               hit = ClustersInSegment[i]->GetHit(j);
00337               if(hit)
00338                 {
00339                   z=hit->GetZPos(); t=hit->GetTPos();
00340                   sw+=1.0; swx+=z; swx2+=z*z; 
00341                   swy+=t; swyx+=t*z;;
00342                 }
00343             }
00344         }
00345     }
00346   
00347   if((swx*swx-sw*swx2)!=0) {return (swx*swy-sw*swyx)/(swx*swx-sw*swx2);}
00348   else return 0;
00349 }

int TrackSegmentCam::GetEndPlane  )  const
 

Definition at line 119 of file TrackSegmentCam.cxx.

Referenced by AlgTrackCamList::FindAllAssociations(), AlgTrackCamList::FindMatchedJoins(), AlgTrackCamList::FindPreferredJoins(), AlgTrackCamList::FirstUVComparison(), AlgTrackCamList::Form2DTracks(), AlgTrackCamList::Form3DTracks(), GetScore(), IsAssoc(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00120 {
00121   return fEndPlane;
00122 }

double TrackSegmentCam::GetEndTime  )  const [inline]
 

Definition at line 86 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::SecondUVComparison().

00086 { return fEndTime; };

double TrackSegmentCam::GetEndTPos  ) 
 

Definition at line 252 of file TrackSegmentCam.cxx.

References ClustersInSegment, GetEntries(), and HitCam::GetTPos().

Referenced by AlgTrackCamList::FindAllAssociations(), AlgTrackCamList::FindMatchedJoins(), AlgTrackCamList::FindPreferredJoins(), AlgTrackCamList::FirstUVComparison(), AlgTrackCamList::Form2DTracks(), IsAssoc(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00253 {
00254   double tot=0.0,endt=0.0;
00255   //Loop over clusters in segment
00256   unsigned int nclusters = this->GetEntries();
00257   unsigned int nhits = 0;
00258   HitCam* hit=0;
00259   for( unsigned int i=0; i<nclusters; ++i)
00260     {//find the clusters on the first plane in the segment
00261       if(ClustersInSegment[i]->GetPlane()==fEndPlane)
00262         {
00263           nhits = ClustersInSegment[i]->GetEntries();
00264 
00265           //loop over hits in cluster
00266           for(unsigned int j=0;j<nhits;++j)
00267             {
00268               hit = ClustersInSegment[i]->GetHit(j);
00269               if(hit)
00270                 {
00271                   endt+=hit->GetTPos();
00272                   tot+=1.0;
00273                 }
00274             }
00275         }
00276     }
00277   if(tot>0) return (endt/tot); 
00278   else return 0;
00279 }

double TrackSegmentCam::GetEndZPos  )  const
 

Definition at line 362 of file TrackSegmentCam.cxx.

Referenced by IsAssoc(), and AlgTrackCamList::Join2DTracks().

00363 {
00364   return fEndVtxZ;
00365 }

unsigned int TrackSegmentCam::GetEntries  )  const
 

Definition at line 103 of file TrackSegmentCam.cxx.

References ClustersInSegment.

Referenced by AddSegment(), AlgTrackCamList::FindMatchedJoins(), AlgTrackCamList::FirstUVComparison(), AlgTrackCamList::Form2DTracks(), AlgTrackCamList::Form3DTracks(), GetBegDir(), GetBegTPos(), GetEndDir(), GetEndTPos(), GetScore(), IsAssoc(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00104 {
00105   return ClustersInSegment.size();
00106 }

TrackSegmentCam * TrackSegmentCam::GetMatchSegBeg unsigned int  i  ) 
 

Definition at line 460 of file TrackSegmentCam.cxx.

References fBegMatchedSegList.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::Form2DTracks().

00461 {
00462   if(i<fBegMatchedSegList.size()) {return fBegMatchedSegList[i];}
00463   else return 0;
00464 }

TrackSegmentCam * TrackSegmentCam::GetMatchSegEnd unsigned int  i  ) 
 

Definition at line 469 of file TrackSegmentCam.cxx.

References fEndMatchedSegList.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::Form2DTracks().

00470 {
00471   if(i<fEndMatchedSegList.size()) {return fEndMatchedSegList[i];}
00472   else return 0;
00473 }

unsigned int TrackSegmentCam::GetNAssocSegBeg  )  const [inline]
 

Definition at line 48 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindAllAssociations(), AlgTrackCamList::FindPreferredJoins(), and AlgTrackCamList::NearDetectorTriplets().

00048 {return fBegAssociatedSegList.size();};  

unsigned int TrackSegmentCam::GetNAssocSegEnd  )  const [inline]
 

Definition at line 49 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindAllAssociations(), AlgTrackCamList::FindPreferredJoins(), and AlgTrackCamList::NearDetectorTriplets().

00049 {return fEndAssociatedSegList.size();};  

unsigned int TrackSegmentCam::GetNMatchSegBeg  )  const [inline]
 

Definition at line 64 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::Form2DTracks().

00064 {return fBegMatchedSegList.size();};

unsigned int TrackSegmentCam::GetNMatchSegEnd  )  const [inline]
 

Definition at line 65 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::Form2DTracks().

00065 {return fEndMatchedSegList.size();};

int TrackSegmentCam::GetNPlanes  )  const [inline]
 

Definition at line 81 of file TrackSegmentCam.h.

00081 { return fNPlanes; };

unsigned int TrackSegmentCam::GetNPrefSegBeg  )  const [inline]
 

Definition at line 56 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindPreferredJoins().

00056 {return fBegPreferredSegList.size();};

unsigned int TrackSegmentCam::GetNPrefSegEnd  )  const [inline]
 

Definition at line 57 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::FindPreferredJoins().

00057 {return fEndPreferredSegList.size();};

TrackSegmentCam* TrackSegmentCam::GetPartner  )  [inline]
 

Definition at line 89 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::SecondUVComparison().

00089 {return (TrackSegmentCam*)(fPartner);};

int TrackSegmentCam::GetPlaneView  )  const
 

Definition at line 478 of file TrackSegmentCam.cxx.

Referenced by AlgTrackCamList::NearDetectorTriplets().

00479 {
00480   return fPlaneView;
00481 }

TrackSegmentCam * TrackSegmentCam::GetPrefSegBeg unsigned int  i  ) 
 

Definition at line 424 of file TrackSegmentCam.cxx.

References fBegPreferredSegList.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::FindPreferredJoins().

00425 {
00426   if(i<fBegPreferredSegList.size()) {return fBegPreferredSegList[i];}
00427   else return 0;
00428 }

TrackSegmentCam * TrackSegmentCam::GetPrefSegEnd unsigned int  i  ) 
 

Definition at line 433 of file TrackSegmentCam.cxx.

References fEndPreferredSegList.

Referenced by AlgTrackCamList::FindPreferredJoins().

00434 {
00435   if(i<fEndPreferredSegList.size())  {return fEndPreferredSegList[i];}
00436   else return 0;
00437 }

double TrackSegmentCam::GetScore vector< TrackSegmentCam * > *  BegSegBank = 0,
vector< TrackSegmentCam * > *  EndSegBank = 0
 

Definition at line 486 of file TrackSegmentCam.cxx.

References GetBegPlane(), HitCam::GetCharge(), GetCluster(), GetEndPlane(), ClusterCam::GetEntries(), GetEntries(), ClusterCam::GetHit(), ClusterCam::GetPlane(), HitCam::GetTPos(), and HitCam::GetZPos().

Referenced by AlgTrackCamList::Form2DTracks().

00487 {
00488   int begplane2, begplane1, endplane1, endplane2;
00489   int nplane, plane;
00490   
00491   vector<ClusterCam*> TempContainer;
00492   bool IsInTemp;
00493 
00494   
00495   //Store the beginning and end of the segment locally
00496   begplane1=this->GetBegPlane();
00497   endplane1=this->GetEndPlane();
00498   begplane2=this->GetBegPlane();
00499   endplane2=this->GetEndPlane();
00500   //
00501   //  begplane2============begplane1===========endplane1============endplane2
00502   //            BegSegBank             this              EndSegBank
00503   //
00504 
00505   // Store pointers to all clusters
00506   unsigned int nclusters = this->GetEntries();  
00507   for(unsigned int i=0; i<nclusters; ++i) {
00508     TempContainer.push_back(this->GetCluster(i));
00509   }
00510 
00511   unsigned int nsegments;
00512   unsigned int nclustersintemp;
00513   int tempplane;
00514   if(BegSegBank) {
00515     nsegments = (*BegSegBank).size();
00516     for(unsigned int j=0; j<nsegments; ++j) {
00517       //looking for the earliest plane in the Beginning Segments
00518       tempplane = (*BegSegBank)[j]->GetBegPlane();
00519       if(tempplane<begplane2) begplane2=tempplane;
00520       //Loop over clusters in this segment and add any we don't have
00521       nclusters=(*BegSegBank)[j]->GetEntries();
00522       for(unsigned int k=0; k<nclusters; ++k) {
00523         ClusterCam* clust = (*BegSegBank)[j]->GetCluster(k);
00524         
00525         IsInTemp=false;
00526         nclustersintemp = TempContainer.size();
00527         for(unsigned int l=0; l<nclustersintemp; ++l) {
00528           if(TempContainer[l]==clust) {IsInTemp=true; break;}
00529         }
00530         if(IsInTemp==false) {TempContainer.push_back(clust);}
00531       }
00532     }
00533   }
00534 
00535   if(EndSegBank) {
00536     nsegments = (*EndSegBank).size();
00537     for(unsigned int j=0; j<nsegments; ++j) {
00538       //looking for the latest plane in the End Segments
00539       tempplane = (*EndSegBank)[j]->GetEndPlane();
00540       if(tempplane>endplane2) endplane2=tempplane;
00541       //Loop over clusters in this segment and add any we don't have
00542       nclusters = (*EndSegBank)[j]->GetEntries();
00543       for(unsigned int k=0; k<nclusters; ++k) {
00544         ClusterCam* clust = (*EndSegBank)[j]->GetCluster(k);
00545         
00546         IsInTemp=false;
00547         nclustersintemp = TempContainer.size();
00548         for(unsigned int l=0; l<nclustersintemp; ++l) {
00549           if(TempContainer[l]==clust) {IsInTemp=true; break;}
00550         }
00551         if(IsInTemp==false) {TempContainer.push_back(clust);}
00552       }
00553     }
00554   }
00555 
00556   //Convert planes to a single view co-ordinate system where begplane2 = 0;
00557   begplane1-=begplane2; begplane1/=2;
00558   endplane1-=begplane2; endplane1/=2;
00559   endplane2-=begplane2; endplane2/=2;
00560 
00561   //calculate the number of planes we will be considering
00562   nplane=1+endplane2;
00563   double* T = new double[nplane];
00564   double* Z = new double[nplane];
00565   double* W = new double[nplane];
00566   for(int i=0; i<nplane; ++i) {T[i]=0.; Z[i]=0.; W[i]=0.;}
00567 
00568   int km, kp;  
00569   double m,c;
00570   double dt2,sn;
00571   double score, dstraightness, straightness, expected;
00572   double sw, swz, swt, swzt, swzz;
00573   unsigned int nhits;
00574 
00575   nclusters = TempContainer.size();
00576 
00577   for(unsigned int k=0; k<nclusters; ++k) {
00578     ClusterCam* clust = TempContainer[k];
00579     //Convert clust->GetPlane() to a single view co-ordinate system where begplane2 = 0;
00580     plane=(clust->GetPlane()-begplane2)/2;
00581 
00582     if(!(plane<0 || plane>=nplane)) {
00583       sw=0.; swz=0.; swt=0.;
00584       nhits = clust->GetEntries();
00585       for(unsigned int k1=0; k1<nhits; ++k1) {
00586         HitCam* hit = clust->GetHit(k1);
00587         
00588         swz+=hit->GetCharge()*hit->GetZPos();
00589         swt+=hit->GetCharge()*hit->GetTPos();
00590         sw+=hit->GetCharge();
00591       }
00592       
00593       if(sw>0.){
00594         Z[plane]=swz/sw; T[plane]=swt/sw;
00595         // Weight segments on planes spanned by seed segment. 
00596         // Deweight segments on other planes.
00597         if( plane+1>begplane1 && plane-1<endplane1 ) {W[plane]=5.;} 
00598         else {W[plane]=0.5;}
00599       }
00600     }
00601   }
00602     
00603     
00604   score=0.; straightness=0.; expected=0.;
00605   
00606   double w, t, z;
00607 
00608   for(int k=0; k<nplane; ++k) {
00609 
00610     if(W[k]>0.){
00611       swz=0.; swt=0.; swzz=0.; swzt=0.; sw=0.; sn=0.;
00612       dstraightness=0.;
00613 
00614       km=k-5; kp=k+5;
00615             
00616       if(km<0) {km=0;}
00617       if(kp>nplane-1) {kp=nplane-1;}
00618       
00619 
00620       // Fit this section
00621       for(int k1=km; k1<kp+1; ++k1){
00622         if(W[k1]>0.) {
00623           w=W[k1]; t=T[k1]; z=Z[k1];
00624 
00625           swz+=w*z; swt+=w*t; 
00626           swzz+=w*z*z; swzt+=w*z*t; 
00627           sw+=w; sn+=1.;
00628         }
00629       }
00630       
00631       // Calculate deviation from fit at this plane
00632       if(sn>2.){
00633         m=(sw*swzt-swz*swt)/(sw*swzz-swz*swz);
00634         c=(swt*swzz-swz*swzt)/(sw*swzz-swz*swz);
00635 
00636         dt2=pow(T[k]-(m*Z[k]+c),2);
00637 
00638         if(dt2<1.e-5) {straightness+=1;}
00639         else {straightness+=dt2/1.e-5;}
00640         expected+=1;
00641       }
00642     }
00643   }
00644 
00645   // Protect against divide by zero
00646   if(expected==0) {expected=1; straightness=1;}
00647   //  if(expected<4) {expected*=10;}
00648 
00649   score = 1.e4 + double(TempContainer.size()) - pow(straightness/expected,0.5);
00650 
00651   
00652 //   MSG("AlgTrackCamList", Msg::kVerbose) << " nclusters " << double(TempContainer.size()) 
00653 //                                      << " straightness " << pow(straightness/expected,0.5) 
00654 //                                      << " Score " << score 
00655 //                                      << " begplane " << this->GetBegPlane() << " endplane " << this->GetEndPlane()
00656 //                                      << " begtpos " << this->GetBegTPos() << " endtpos " << this->GetEndTPos() << endl;
00657 
00658 //   MSG("AlgTrackCamList", Msg::kVerbose) << "Clusters involved: " << endl;
00659   
00660 //   for(unsigned int i=0; i<TempContainer.size(); ++i) {
00661 //     MSG("AlgTrackCamList", Msg::kVerbose) << "plane " << TempContainer[i]->GetPlane() << " begtpos " << TempContainer[i]->GetBegTPos() 
00662 //                                        << " endtpos " << TempContainer[i]->GetEndTPos() << endl;
00663 //   }
00664 
00665 //   MSG("AlgTrackCamList", Msg::kVerbose) << "----------------------" << endl;
00666 
00667 
00668   if(score<0.) {score=0.;}
00669  
00670   if(T) {delete [] T;}
00671   if(Z) {delete [] Z;}
00672   if(W) {delete [] W;}
00673 
00674   return score;
00675 }

TrackSegmentCam* TrackSegmentCam::GetSeedSegment  )  [inline]
 

Definition at line 78 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::NearDetectorTriplets().

00078 {return (TrackSegmentCam*)(fSeedSegment);};

int TrackSegmentCam::GetTmpTrkFlag  )  const [inline]
 

Definition at line 69 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindPreferredJoins(), and AlgTrackCamList::Form2DTracks().

00069 { return fTmpTrkFlag; };

int TrackSegmentCam::GetTrkFlag  )  const [inline]
 

Definition at line 75 of file TrackSegmentCam.h.

00075 { return fTrkFlag; };

int TrackSegmentCam::GetUID  )  const [inline]
 

Definition at line 72 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FirstUVComparison(), AlgTrackCamList::Form2DTracks(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00072 { return fUID; };

bool TrackSegmentCam::IsAssoc TrackSegmentCam segment  ) 
 

Definition at line 127 of file TrackSegmentCam.cxx.

References ContainsCluster(), GetBegDir(), GetBegPlane(), GetBegTPos(), ClusterCam::GetBegTPos(), GetBegZPos(), GetCluster(), GetEndDir(), GetEndPlane(), GetEndTPos(), ClusterCam::GetEndTPos(), GetEndZPos(), GetEntries(), ClusterCam::GetPlane(), StripWidth, and win.

Referenced by AlgTrackCamList::FindMatchedJoins(), AlgTrackCamList::FindPreferredJoins(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00128 {
00129   unsigned int i;
00130   bool assoc=false;
00131   bool flag=false; 
00132   TrackSegmentCam* Seg1 = this;
00133   TrackSegmentCam* Seg2 = segment;
00134 
00135   //If the two clusters overlap at all
00136   if(Seg1->GetEndPlane()>=Seg2->GetBegPlane()){
00137     flag=true;
00138     //All clusters in Seg1 in planes overlapping Seg2 should also be in Seg2
00139     for(i=0;i<Seg1->GetEntries();i++){
00140       ClusterCam* clr = Seg1->GetCluster(i);
00141       if(clr->GetPlane()>=Seg2->GetBegPlane()){ 
00142         if(!(Seg2->ContainsCluster(clr))){
00143           flag=false; 
00144           break; //one mismatch is too many
00145         }
00146       }
00147     }
00148     if(flag)//only bother with 2nd check if 1st was ok
00149       {
00150         //All clusters in Seg2 in planes overlapping Seg1 should also be in Seg1
00151         for(i=0;i<Seg2->GetEntries();i++){
00152           ClusterCam* clr = Seg2->GetCluster(i);
00153           if(clr->GetPlane()<=Seg1->GetEndPlane()){ 
00154             if(!(Seg1->ContainsCluster(clr))){
00155               flag=false; 
00156               break; //one mismatch is too many 
00157             }
00158           }
00159         }
00160       }
00161     //If this is true and they overlap by more than one plane then they are associated
00162     if(Seg1->GetEndPlane()>Seg2->GetBegPlane()){ if(flag) assoc=true; }
00163   }
00164     //If the segments overlap by 1 or fewer planes need to do some more work...    
00165   if(Seg1->GetEndPlane()<=Seg2->GetBegPlane()){
00166     int idb(0),idb0(0);
00167     int bpln=Seg2->GetEndPlane()+1;
00168     //find the first (lowest plane no) two clusters in the second segment
00169     for(i=0;i<Seg2->GetEntries();i++){
00170       ClusterCam* clr = Seg2->GetCluster(i);
00171       if(clr->GetPlane()<bpln && clr->GetPlane()>Seg2->GetBegPlane()) {//+2){
00172         bpln=clr->GetPlane(); idb=i;
00173       }
00174       else{ if(clr->GetPlane()==Seg2->GetBegPlane()) idb0=i; }
00175     }
00176     ClusterCam* clrb = Seg2->GetCluster(idb); ClusterCam* clrb0 = Seg2->GetCluster(idb0);
00177     double bBegTPos = clrb->GetBegTPos(); double bEndTPos = clrb->GetEndTPos();
00178     double b0BegTPos = clrb0->GetBegTPos(); double b0EndTPos = clrb0->GetEndTPos();
00179 
00180     int ide(0),ide0(0);
00181     int epln=Seg1->GetBegPlane()-1;
00182     //find the last (highest plane no) two clusters in the first segment
00183     for(i=0;i<Seg1->GetEntries();i++){
00184       ClusterCam* clr = Seg1->GetCluster(i);
00185       if(clr->GetPlane()>epln && clr->GetPlane()<Seg1->GetEndPlane()) {//-2){
00186         epln=clr->GetPlane(); ide=i;
00187       }
00188       else{ if(clr->GetPlane()==Seg1->GetEndPlane()) ide0=i; }
00189     }
00190     ClusterCam* clre = Seg1->GetCluster(ide); ClusterCam* clre0 = Seg1->GetCluster(ide0);
00191     double eBegTPos = clre->GetBegTPos(); double eEndTPos = clre->GetEndTPos();
00192     double e0BegTPos = clre0->GetBegTPos(); double e0EndTPos = clre0->GetEndTPos();
00193     //Look at how these clusters overlap stripwise    
00194     if( ( bEndTPos-b0BegTPos>-2*StripWidth && b0EndTPos-bBegTPos>-2*StripWidth && eEndTPos-e0BegTPos>-2*StripWidth && e0EndTPos-eBegTPos>-2*StripWidth )
00195         || ( ( bBegTPos-b0BegTPos>-2*StripWidth && e0BegTPos-eBegTPos>-2*StripWidth ) || ( bEndTPos-b0EndTPos>-2*StripWidth && e0EndTPos-eEndTPos>-2*StripWidth ) )
00196         || ( ( bBegTPos-b0BegTPos<2*StripWidth && e0BegTPos-eBegTPos<2*StripWidth ) || ( bEndTPos-b0EndTPos<2*StripWidth && e0EndTPos-eEndTPos<2*StripWidth ) ) 
00197         ) {
00198       //if the segments overlap by 1 plane then we can now say if they are associated or not
00199       if(Seg2->GetBegPlane()==Seg1->GetEndPlane()){ if(flag) assoc=true; }
00200       else{
00201         double z1,z2,t1,t2,dt1,dt2,dir1,dir2,dirtmp,win;
00202         z1=Seg1->GetEndZPos();  z2=Seg2->GetBegZPos();
00203         t1=Seg1->GetEndTPos();  t2=Seg2->GetBegTPos();
00204         dir1=Seg1->GetEndDir(); dt1=t2-t1-dir1*(z2-z1); 
00205         dir2=Seg2->GetBegDir(); dt2=t2-t1-dir2*(z2-z1); 
00206         win=0.1+0.35*(z2-z1);   dirtmp=(1+dir1*dir2)/(sqrt(1+dir1*dir1)*sqrt(1+dir2*dir2));
00207         
00208         if( ( (dt1>-win&&dt1<win)||(dt2>-win&&dt2<win) ) && ( dirtmp>0.65 ) ) assoc=true; 
00209       }
00210     }
00211   }
00212   return assoc;
00213 }

void TrackSegmentCam::SetNPlanes int  nplanes  )  [inline]
 

Definition at line 80 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::Form2DTracks().

00080 { fNPlanes=nplanes; };

void TrackSegmentCam::SetPartner TrackSegmentCam segment  )  [inline]
 

Definition at line 88 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::SecondUVComparison().

00088 {fPartner = segment;};

void TrackSegmentCam::SetSeedSegment TrackSegmentCam segment  )  [inline]
 

Definition at line 77 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindMatchedJoins(), and AlgTrackCamList::NearDetectorTriplets().

00077 {fSeedSegment = segment;};

void TrackSegmentCam::SetTmpTrkFlag int  flag  )  [inline]
 

Definition at line 68 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindPreferredJoins(), and AlgTrackCamList::Form2DTracks().

00068 { fTmpTrkFlag=flag; };

void TrackSegmentCam::SetTrkFlag int  flag  )  [inline]
 

Definition at line 74 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::Form2DTracks().

00074 { fTrkFlag=flag; };

void TrackSegmentCam::SetUID int  uid  )  [inline]
 

Definition at line 71 of file TrackSegmentCam.h.

Referenced by AlgTrackCamList::FindMatchedJoins(), AlgTrackCamList::FirstUVComparison(), AlgTrackCamList::Form2DTracks(), AlgTrackCamList::Join2DTracks(), AlgTrackCamList::NearDetectorTriplets(), and AlgTrackCamList::SecondUVComparison().

00071 { fUID=uid; };


Member Data Documentation

vector<ClusterCam*> TrackSegmentCam::ClustersInSegment [private]
 

Definition at line 93 of file TrackSegmentCam.h.

Referenced by AddCluster(), ContainsCluster(), GetBegDir(), GetBegTPos(), GetCluster(), GetEndDir(), GetEndTPos(), GetEntries(), and ~TrackSegmentCam().

vector<TrackSegmentCam*> TrackSegmentCam::fBegAssociatedSegList [private]
 

Definition at line 94 of file TrackSegmentCam.h.

Referenced by AddAssocSegToBeg(), GetAssocSegBeg(), and ~TrackSegmentCam().

vector<TrackSegmentCam*> TrackSegmentCam::fBegMatchedSegList [private]
 

Definition at line 98 of file TrackSegmentCam.h.

Referenced by AddMatchSegToBeg(), GetMatchSegBeg(), and ~TrackSegmentCam().

int TrackSegmentCam::fBegPlane [private]
 

Definition at line 106 of file TrackSegmentCam.h.

Referenced by AddCluster(), and GetBegDir().

vector<TrackSegmentCam*> TrackSegmentCam::fBegPreferredSegList [private]
 

Definition at line 96 of file TrackSegmentCam.h.

Referenced by AddPrefSegToBeg(), GetPrefSegBeg(), and ~TrackSegmentCam().

double TrackSegmentCam::fBegTime [private]
 

Definition at line 114 of file TrackSegmentCam.h.

Referenced by AddCluster().

double TrackSegmentCam::fBegVtxZ [private]
 

Definition at line 108 of file TrackSegmentCam.h.

Referenced by AddCluster().

vector<TrackSegmentCam*> TrackSegmentCam::fEndAssociatedSegList [private]
 

Definition at line 95 of file TrackSegmentCam.h.

Referenced by AddAssocSegToEnd(), GetAssocSegEnd(), and ~TrackSegmentCam().

vector<TrackSegmentCam*> TrackSegmentCam::fEndMatchedSegList [private]
 

Definition at line 99 of file TrackSegmentCam.h.

Referenced by AddMatchSegToEnd(), GetMatchSegEnd(), and ~TrackSegmentCam().

int TrackSegmentCam::fEndPlane [private]
 

Definition at line 107 of file TrackSegmentCam.h.

Referenced by AddCluster(), and GetEndDir().

vector<TrackSegmentCam*> TrackSegmentCam::fEndPreferredSegList [private]
 

Definition at line 97 of file TrackSegmentCam.h.

Referenced by AddPrefSegToEnd(), GetPrefSegEnd(), and ~TrackSegmentCam().

double TrackSegmentCam::fEndTime [private]
 

Definition at line 115 of file TrackSegmentCam.h.

Referenced by AddCluster().

double TrackSegmentCam::fEndVtxZ [private]
 

Definition at line 109 of file TrackSegmentCam.h.

Referenced by AddCluster().

int TrackSegmentCam::fNPlanes [private]
 

Definition at line 113 of file TrackSegmentCam.h.

TrackSegmentCam* TrackSegmentCam::fPartner [private]
 

Definition at line 103 of file TrackSegmentCam.h.

int TrackSegmentCam::fPlaneView [private]
 

Definition at line 112 of file TrackSegmentCam.h.

TrackSegmentCam* TrackSegmentCam::fSeedSegment [private]
 

Definition at line 101 of file TrackSegmentCam.h.

int TrackSegmentCam::fTmpTrkFlag [private]
 

Definition at line 111 of file TrackSegmentCam.h.

int TrackSegmentCam::fTrkFlag [private]
 

Definition at line 110 of file TrackSegmentCam.h.

int TrackSegmentCam::fUID [private]
 

Definition at line 105 of file TrackSegmentCam.h.

const double TrackSegmentCam::StripWidth [private]
 

Definition at line 116 of file TrackSegmentCam.h.

Referenced by IsAssoc().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:24 2010 for loon by  doxygen 1.3.9.1