#include <mMuiRoadFinder1.h>
Public Member Functions | |
mMuiRoadFinder1 () | |
virtual | ~mMuiRoadFinder1 () |
PHBoolean | event (PHCompositeNode *baseNode) |
Private Member Functions | |
PHBoolean | find_1droads () |
PHBoolean | find_2droads () |
PHBoolean | cut_1droads () |
int | track_seed (TMui1DRoadMapO::pointer road1dptr, int iLoop, int iSearch) |
void | set_interface_ptrs (PHCompositeNode *baseNode) |
int | make2d (TMuiRoadMapO::pointer cRoad, TMui1DRoadMapO::pointer pRoadH, TMui1DRoadMapO::pointer pRoadV) |
int | fit1d (TMui1DRoadMapO::pointer road1dptr) |
double | ClusterDistance (TMui1DRoadMapO::pointer road1dptr, TMuiClusterMapO::pointer clustptr) |
bool | intersectionOK (TMuiClusterMapO::const_pointer clustH, TMuiClusterMapO::const_pointer clustV) const |
int | flag_golden () |
Private Attributes | |
const mMuiRoadFinder1Par * | _mod_par |
TMuiRoadMapO * | _roadmap |
TMui1DRoadMapO * | _road1dmap |
TMuiClusterMapO * | _clustermap |
PHTimeServer::timer | _timer |
@ingroup modules
Definition at line 19 of file mMuiRoadFinder1.h.
|
Constructor. Definition at line 40 of file mMuiRoadFinder1.cxx.
00040 : 00041 _roadmap(0), 00042 _road1dmap(0), 00043 _clustermap(0), 00044 _timer( PHTimeServer::get()->insert_new("mMuiRoadFinder1") ) 00045 00046 {} |
|
Destructor. Definition at line 25 of file mMuiRoadFinder1.h.
00025 {} |
|
Definition at line 855 of file mMuiRoadFinder1.cxx. Referenced by track_seed().
00856 { 00857 PHVector dirV = road1dptr->get()->get_fit_par().get_tangent( road1dptr->get()->get_arm() ); 00858 PHPoint panelX = TMuiGeometry::Geom()->FindIntersection( 00859 road1dptr->get()->get_arm(), 00860 clustptr->get()->get_plane(), 00861 clustptr->get()->get_panel(), 00862 road1dptr->get()->get_fit_par().get_point(), 00863 dirV 00864 ); 00865 00866 double distance = (road1dptr->get()->get_orientation()==0) 00867 ? abs(panelX.getY() - clustptr->get()->get_centroidpos().getY()) 00868 : abs(panelX.getX() - clustptr->get()->get_centroidpos().getX()); 00869 00870 return distance; 00871 } |
|
Definition at line 88 of file mMuiRoadFinder1.cxx. References _mod_par, _road1dmap, TMui1DRoadMapO::get(), mMuiRoadFinder1Par::get_max_xref_1d(), mMuiRoadFinder1Par::get_max_yref_1d(), mMuiRoadFinder1Par::get_min_fired_gaps(), mMuiRoadFinder1Par::get_min_last_gap_1d(), and TMuiParBase::get_verbosity(). Referenced by event().
00089 { 00090 for(int iArm = 0; iArm < TMuiChannelId::kArmsTotal; iArm++) 00091 { 00092 //Now we have a list of roads tracked all the way through the 00093 //detector. Before we add them to the 1D Road Container 00094 //perform all the 1DRoad Cuts except the Duplicate cut. 00095 00096 00097 TMui1DRoadMapO::iterator iRoad1 = _road1dmap->get(iArm); 00098 00099 while(TMui1DRoadMapO::pointer pRoad1 = iRoad1.next()) { 00100 00101 // Ok we found a road already, we need to know 00102 // whether we should save it or not 00103 // check road quality... 00104 // 00105 if( _mod_par->get_verbosity() >= MUIOO::MAX ) { 00106 cout<<"Checking Road: "<<endl; 00107 pRoad1->get()->print(); 00108 } 00109 00110 // 1. last plane of the road 00111 bool LastPlaneOK = false; 00112 if ( pRoad1->get()->get_depth() >= _mod_par->get_min_last_gap_1d() ) LastPlaneOK = true; 00113 00114 // 2. positon at reference plane 00115 bool VertexCutOK = false; 00116 00117 TMutFitPar roadfit = pRoad1->get()->get_fit_par(); 00118 if(pRoad1->get()->get_orientation()==0) { 00119 if ( fabs(roadfit.get_y()) <= _mod_par->get_max_yref_1d() ) VertexCutOK = true; 00120 } else { 00121 if ( fabs(roadfit.get_x()) <= _mod_par->get_max_xref_1d() ) 00122 VertexCutOK = true; 00123 } 00124 00125 // 3. number of gaps contain hits 00126 bool FiredGapsOK = false; 00127 00128 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00129 cout 00130 <<"Testing FiredGaps: G " << pRoad1->get()->get_gapbit() 00131 << " N " << pRoad1->get()->get_numfired() << endl; 00132 00133 if ( pRoad1->get()->get_numfired() > _mod_par->get_min_fired_gaps()) FiredGapsOK = true; 00134 00135 // Here is our criteria for a candidate road 00136 // at this stage. 00137 // i.e. 1) There are at least two gaps containing hits 00138 // 2) LastPlane of the road passes last plane cut 00139 // 3) Reference position passes vertex cut 00140 00141 00142 // At this point we are only cutting exact duplicates 00143 // resulting from the multiple seed loops 00144 00145 if ( LastPlaneOK && VertexCutOK&& FiredGapsOK ){ 00146 int NumHits1 = 0; 00147 int NumHits2 = 0; 00148 TMui1DRoadMapO::iterator iRoad2 = iRoad1; 00149 while(TMui1DRoadMapO::pointer pRoad2 = iRoad2.next()) { 00150 if(pRoad1->get()->get_orientation() != pRoad2->get()->get_orientation()) continue; 00151 00152 TMuiClusterMapO::const_key_iterator iclust1 =pRoad1->get()->get_associated<TMuiClusterO>(); 00153 TMuiClusterMapO::const_key_iterator iclust2 =pRoad2->get()->get_associated<TMuiClusterO>(); 00154 00155 NumHits1 = iclust1.count(); 00156 NumHits2 = iclust2.count(); 00157 00158 if(NumHits1!=NumHits2) continue; 00159 00160 short SharedHits1D = 0; 00161 while(TMuiClusterMapO::const_pointer clust1 = iclust1.next()) { 00162 00163 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00164 clust1->get()->get_key().print(); 00165 00166 iclust2.reset(); 00167 while(TMuiClusterMapO::const_pointer clust2 = iclust2.next()) { 00168 00169 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00170 clust2->get()->get_key().print(); 00171 00172 if(clust1->get()->get_key()==clust2->get()->get_key()) SharedHits1D++; 00173 } 00174 } 00175 00176 if( _mod_par->get_verbosity() >= MUIOO::MAX ) { 00177 if(pRoad1->get()->get_panel()==pRoad1->get()->get_panel()){ 00178 cout 00179 <<"Checked for duplicate: SharedHits("<<SharedHits1D<<") " 00180 <<NumHits1<<"/"<<NumHits2<<endl; 00181 pRoad1->get()->print(); 00182 pRoad2->get()->print(); 00183 } 00184 } 00185 00186 if(SharedHits1D==NumHits1){ 00187 00188 if( _mod_par->get_verbosity() >= MUIOO::MAX ) { 00189 cout<<"Duplicate road found with "<<SharedHits1D<<" shared hits"<<endl; 00190 pRoad1->get()->print(); 00191 pRoad2->get()->print(); 00192 } 00193 00194 // Instead of erasing now. Lets flagit by 00195 // setting its depth to 0. 00196 // Later we'll come back and erase all. 00197 pRoad2->get()->set_depth(0); 00198 00199 } // if SharedHits1D==NumHits1 00200 } //while(pRoad2 00201 00202 } else { 00203 00204 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00205 cout 00206 <<"Cutting 1d road: " << "LastPlaneOK "<<LastPlaneOK 00207 <<" VertexCutOK " << VertexCutOK 00208 <<" FiredGapsOK " <<FiredGapsOK 00209 <<endl; 00210 00211 // Instead of erasing now. Lets flagit by 00212 // setting its depth to 0. 00213 // Later we'll come back and erase all. 00214 pRoad1->get()->set_depth(0); 00215 } 00216 00217 }//while(pRoad1 00218 iRoad1 = _road1dmap->get(iArm); 00219 while(TMui1DRoadMapO::pointer pRoad1 = iRoad1.next()) 00220 if(pRoad1->get()->get_depth()==0) _road1dmap->erase(pRoad1->get()->get_key()); 00221 00222 }//for(iArm.. 00223 00224 return 0; 00225 } |
|
Definition at line 49 of file mMuiRoadFinder1.cxx. References _mod_par, _road1dmap, _roadmap, _timer, cut_1droads(), find_1droads(), find_2droads(), flag_golden(), TMuiRoadMapO::get(), TMui1DRoadMapO::get(), TMuiParBase::get_verbosity(), MUIOO::PRINT(), and set_interface_ptrs().
00049 { 00050 00051 _timer.get()->restart(); 00052 00053 try { 00054 set_interface_ptrs(top_node); 00055 00056 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00057 MUIOO::PRINT( cout, "mMuiRoadFinder1::event" ); 00058 00059 find_1droads(); 00060 cut_1droads(); 00061 find_2droads(); 00062 flag_golden(); 00063 00064 if( _mod_par->get_verbosity() >= MUIOO::MAX ) { 00065 00066 TMui1DRoadMapO::iterator iroad = _road1dmap->get(0); 00067 cout<<" Finished road finding with "<< iroad.count() << " 1d roads.\n"; 00068 00069 while(TMui1DRoadMapO::pointer roadptr = iroad.next()) 00070 roadptr->get()->print(); 00071 00072 TMuiRoadMapO::iterator iroad2 = _roadmap->get(0); 00073 cout<<" Finished road finding with "<< iroad2.count() << " 2d roads.\n"; 00074 00075 while(TMuiRoadMapO::pointer roadptr = iroad2.next()) 00076 roadptr->get()->print(); 00077 MUIOO::PRINT( cout, "**" ); 00078 } 00079 00080 } catch( exception& e ) { cout << e.what() << endl; } 00081 00082 00083 _timer.get()->stop(); 00084 return 0; 00085 } |
|
Definition at line 228 of file mMuiRoadFinder1.cxx. References _clustermap, _mod_par, _road1dmap, fit1d(), TMuiClusterMapO::get(), mMuiRoadFinder1Par::get_max_occupancy_per_arm(), mMuiRoadFinder1Par::get_num_seed_loops(), mMuiRoadFinder1Par::get_search_order(), TMuiParBase::get_verbosity(), TMui1DRoadMapO::insert_new(), and track_seed(). Referenced by event().
00229 { 00230 00231 short Count0,iPlane0, iPlane1; 00232 EOrient_t orient; 00233 int rawcountperarm[2] = {0}; 00234 00235 rawcountperarm[0] = _clustermap->get(0).count(); 00236 // JLN - the index below is now fixed 07/25/03 00237 rawcountperarm[1] = _clustermap->get(1).count(); 00238 00239 for (short iArm=0; iArm<TMuiChannelId::kArmsTotal; iArm++) { 00240 00241 if(rawcountperarm[iArm]>_mod_par->get_max_occupancy_per_arm()) { 00242 cout<<PHWHERE<<" Skipping analysis of arm "<<iArm<<" with too many hits "<<rawcountperarm[iArm]<<endl; 00243 continue; 00244 } 00245 00246 for (short iorient=0; iorient<TMuiChannelId::kOrientations; iorient++) { 00247 00248 orient = (iorient == 0) ? kHORIZ : kVERT; 00249 00250 for( short iLoop=0; iLoop<_mod_par->get_num_seed_loops(); iLoop++) { 00251 00252 // checkout the seed gap(s) from search order 00253 iPlane0 = _mod_par->get_search_order(iLoop,0); 00254 iPlane1 = _mod_par->get_search_order(iLoop,1); 00255 00256 //Create a temporary list of roads for this search order. 00257 // one-seed/two-seed-gap method, by pass iPlane0 00258 short TotalPanel0 = (iPlane0 == -1) ? 1:TMuiChannelId::kPanelsPerPlane; // two-seed-gap method 00259 00260 for (short iPanel0=0; iPanel0<TotalPanel0; iPanel0++) { 00261 00262 TMuiClusterMapO::iterator iclust0; 00263 if (iPlane0 != -1) iclust0 = _clustermap->get(iArm,iPlane0,iPanel0,orient); 00264 Count0 = (iPlane0 == -1)? (1) : iclust0.count(); 00265 00266 for( short idClust0=0; idClust0<Count0; idClust0++ ) { 00267 TMuiClusterMapO::pointer clust0ptr = iclust0.next(); 00268 for (short iPanel1=0; iPanel1<TMuiChannelId::kPanelsPerPlane; iPanel1++) { 00269 00270 TMuiClusterMapO::iterator iclust1 = _clustermap->get(iArm,iPlane1,iPanel1,orient);; 00271 while(TMuiClusterMapO::pointer pC1 = iclust1.next()) { 00272 00273 // this check should be useless unless strong bug. 00274 if (!(pC1->get())) continue; 00275 00276 // Found seed cluster(s), create a new 1D road 00277 // object, and attach cluster pC1 (and pC0, if 2 seed gaps) 00278 00279 TMui1DRoadMapO::pointer road1D = (_road1dmap->insert_new(iArm,iPanel1,orient)).current(); 00280 00281 if (!(road1D->get())) { 00282 cout << PHWHERE << ":failed to create 1D road!" << endl; 00283 continue; 00284 } 00285 00286 if (iPlane0 != -1 ) { 00287 //If Two Gap seed set vertex weight to 0 00288 PHKey::associate(road1D, clust0ptr); 00289 road1D->get()->set_fitweight(0, 0.0); 00290 00291 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00292 cout 00293 << "mMuiRoadFinder1::find_1droads - associate 1DRoad=" << road1D->get()->get_key().get_obj_key() 00294 << " cluster " << clust0ptr->get()->get_key().get_obj_key() << endl; 00295 00296 } else { 00297 //If One Seed gap method use vertex in fits. 00298 road1D->get()->set_fitweight(0, 1.0); 00299 } 00300 00301 PHKey::associate(road1D, pC1); 00302 00303 if( _mod_par->get_verbosity() >= MUIOO::MAX ) { 00304 cout 00305 << "mMuiRoadFinder1::find_1droads - associate 1DRoad=" << road1D->get()->get_key().get_obj_key() 00306 << " cluster " << pC1->get()->get_key().get_obj_key() << endl; 00307 cout<<"Begin tracking seed: iLoop("<< iLoop << ") Panel ("<<iPanel1 <<")"<<endl; 00308 road1D->get()->print(); 00309 pC1->get()->print(); 00310 } 00311 00312 track_seed(road1D,iLoop,2); 00313 00314 fit1d(road1D); 00315 00316 }//for (iClust1) 00317 }//for(iPanel1) 00318 }//for(iClust0) 00319 }//for(iPanel0) 00320 } //short (short iLoop ...) 00321 } // for (short iorient ...) 00322 } // for(iArm ...) 00323 return True; 00324 } |
|
Definition at line 327 of file mMuiRoadFinder1.cxx. References _mod_par, _road1dmap, _roadmap, TMui1DRoadMapO::get(), mMuiRoadFinder1Par::get_max_del_last_gap(), mMuiRoadFinder1Par::get_max_del_total_hits(), mMuiRoadFinder1Par::get_max_xchisq(), mMuiRoadFinder1Par::get_max_xref_2d(), mMuiRoadFinder1Par::get_max_ychisq(), mMuiRoadFinder1Par::get_max_yref_2d(), mMuiRoadFinder1Par::get_min_last_gap_2d(), TMuiRoadMapO::insert_new(), intersectionOK(), and make2d(). Referenced by event().
00327 { 00328 00329 // found all possible horizontal and vertical roads in both arms 00330 // construct 2D roads 00331 for (short iArm=0; iArm<TMuiChannelId::kArmsTotal; iArm++) { 00332 00333 TMui1DRoadMapO::iterator iRoadH = _road1dmap->get(iArm); 00334 while(TMui1DRoadMapO::pointer pRoadH = iRoadH.next()) { 00335 00336 if(pRoadH->get()->get_orientation()==1) continue; 00337 00338 TMui1DRoadMapO::iterator iRoadV = _road1dmap->get(iArm); 00339 while(TMui1DRoadMapO::pointer pRoadV = iRoadV.next()) { 00340 if(pRoadV->get()->get_orientation()==0) continue; 00341 00342 00343 // What are our criteria for accepting a road 00344 // as valid? Check them here. 00345 // 1. difference of total number clusters in vRoad and in hRoad 00346 // 2. difference of last gaps in vRoad and hRoad 00347 // 3. InterSection OK or not (if X Y clusters in each gap are 00348 // in same panel or overlap region) 00349 // 4. Reference position check 00350 // 5. Chisquare check 00351 // 6. Last Plane check 00352 // 7. Duplicate road check 00353 00354 // JLN - bug fix - added fabs around the depth differenece 07/25/03 00355 bool LastGapDeltaOK = false; 00356 00357 if (abs(pRoadH->get()->get_depth() - pRoadV->get()->get_depth()) <= _mod_par->get_max_del_last_gap() ) 00358 LastGapDeltaOK = true; 00359 00360 // JLN - bug fix - added fabs around the hits differenece 07/25/03 00361 bool TotalHitsDeltaOK = false; 00362 if(abs(pRoadH->get()->get_nhit() - pRoadV->get()->get_nhit()) <= _mod_par->get_max_del_total_hits() ) 00363 TotalHitsDeltaOK = true; 00364 00365 bool IntersectionOK = true; 00366 TMuiClusterMapO::const_key_iterator iClustH =pRoadH->get()->get_associated<TMuiClusterO>(); 00367 00368 while(TMuiClusterMapO::const_pointer pClustH = iClustH.next()) { 00369 00370 TMuiClusterMapO::const_key_iterator iClustV =pRoadV->get()->get_associated<TMuiClusterO>(); 00371 while(TMuiClusterMapO::const_pointer pClustV = iClustV.next()) { 00372 00373 if(pClustH->get()->get_plane()!=pClustV->get()->get_plane()) continue; 00374 if( !(intersectionOK(pClustH,pClustV)) ){ 00375 IntersectionOK = false; 00376 break; 00377 } 00378 00379 } 00380 } 00381 00382 bool VertexCutOK = false; 00383 TMutFitPar fitH = pRoadH->get()->get_fit_par(); 00384 TMutFitPar fitV = pRoadV->get()->get_fit_par(); 00385 00386 if ( fabs(fitH.get_y()) <= _mod_par->get_max_yref_2d() && 00387 fabs(fitV.get_x()) <= _mod_par->get_max_xref_2d() ) VertexCutOK = true; 00388 00389 bool ChiSquareCutOK = false; 00390 if ( fitV.get_chi_square() <= _mod_par->get_max_xchisq() 00391 && fitH.get_chi_square() <= _mod_par->get_max_ychisq() ) ChiSquareCutOK = true; 00392 00393 bool minLastGapOK = false; 00394 if (pRoadH->get()->get_depth() >= _mod_par->get_min_last_gap_2d() 00395 || pRoadV->get()->get_depth() >= _mod_par->get_min_last_gap_2d()) minLastGapOK = true; 00396 00397 if ( LastGapDeltaOK && 00398 TotalHitsDeltaOK && 00399 IntersectionOK && 00400 VertexCutOK && 00401 ChiSquareCutOK && 00402 minLastGapOK 00403 ) { 00404 TMuiRoadMapO::iterator iRoad = _roadmap->insert_new(iArm); 00405 make2d(iRoad.current(),pRoadH,pRoadV); 00406 }// if(pass cuts .. 00407 } // for ( vRoad .. 00408 } // for ( hRoad .. 00409 }//for(iArm ... 00410 return 0; 00411 } |
|
Definition at line 685 of file mMuiRoadFinder1.cxx. References _mod_par, TMuiParBase::get_verbosity(), mMuiRoadFinder1Par::get_weight_par_1d(), mMuiRoadFinder1Par::get_xvert(), mMuiRoadFinder1Par::get_yvert(), and mMuiRoadFinder1Par::get_zvert(). Referenced by find_1droads(), and track_seed().
00686 { 00687 double z[mMuiRoadFinder1Par::NUMFITPOINTS+1]={0.0}; 00688 double x[mMuiRoadFinder1Par::NUMFITPOINTS+1]={0.0}; 00689 double w[mMuiRoadFinder1Par::NUMFITPOINTS+1]={0.0}; 00690 double cov00=0, cov11=0, cov22=0; 00691 int npoints = 0; 00692 double slope = 0.0, 00693 intercept = 0.0, 00694 chisq = 0.0, 00695 hit_zmin = 1E10, 00696 hit_zmax = 0.0; 00697 double dx = 0; 00698 double dz = 0; 00699 00700 z[npoints] = _mod_par->get_zvert(); 00701 x[npoints] = (road1dptr->get()->get_orientation()==0) 00702 ? _mod_par->get_yvert() : _mod_par->get_xvert(); 00703 w[npoints] = _mod_par->get_weight_par_1d(0); 00704 npoints++; 00705 00706 TMuiClusterMapO::const_key_iterator iclust =road1dptr->get()->get_associated<TMuiClusterO>(); 00707 00708 if( _mod_par->get_verbosity() >= MUIOO::MAX ) { 00709 cout << "mMuiRoadFinder1::fit1d" <<endl; 00710 road1dptr->get()->print(); 00711 cout << "Associated cluster count(" << iclust.count() <<")"<<endl; 00712 } 00713 00714 road1dptr->get()->set_nhit(iclust.count()); 00715 00716 while(TMuiClusterMapO::const_pointer clustptr = iclust.next()) { 00717 00718 PHPoint centroid = clustptr->get()->get_centroidpos(); 00719 PHPoint sigma = clustptr->get()->get_centroidsigma(); 00720 road1dptr->get()->set_gapbit( road1dptr->get()->get_gapbit() | (0x1<<clustptr->get()->get_plane())); 00721 00722 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00723 cout 00724 << "mMuiRoadFinder1::fit1d - road=" << road1dptr->get()->get_key().get_obj_key() 00725 << " cluster plane=" << clustptr->get()->get_plane() 00726 << " key=" << clustptr->get()->get_key().get_obj_key() << endl; 00727 00728 if(road1dptr->get()->get_depth() < clustptr->get()->get_plane()) { 00729 road1dptr->get()->set_depth(clustptr->get()->get_plane()); 00730 00731 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00732 cout 00733 << "mMuiRoadFinder1::fit1d - 1DRoad=" << road1dptr->get()->get_key().get_obj_key() 00734 << " depth=" << clustptr->get()->get_plane() << endl; 00735 00736 } 00737 00738 z[npoints] = centroid.getZ(); 00739 if(abs(z[npoints])<abs(hit_zmin)) hit_zmin = z[npoints]; 00740 if(abs(z[npoints])>abs(hit_zmax)) hit_zmax = z[npoints]; 00741 00742 if (road1dptr->get()->get_orientation() == 0) { 00743 x[npoints] = centroid.getY(); 00744 w[npoints] = 1.0/(sigma.getY()*sigma.getY()); 00745 } else { 00746 x[npoints] = centroid.getX(); 00747 w[npoints] = 1.0/(sigma.getX()*sigma.getX()); 00748 } 00749 /* 00750 check that a point at this exact location was not already added 00751 - this can happen if we have the split cluster mode - neighboring fired tubes 00752 would be added as separate clusters, but have the same exact coordinates in one 00753 orientation (but not both) 00754 */ 00755 bool too_close = false; 00756 int ipoint = npoints - 1; 00757 while (!too_close && ipoint>=0) { 00758 dx = fabs(x[npoints] - x[ipoint]); 00759 dz = fabs(z[npoints] - z[ipoint]); 00760 00761 if (dx<0.001 && dz<0.001) { 00762 too_close = true; 00763 } 00764 ipoint--; 00765 } 00766 00767 if (!too_close) npoints++; 00768 if(npoints>6) break; 00769 } 00770 00771 // remove vertex point from fit if we have enough points to make a line without it 00772 if (npoints > 2) { 00773 00774 // move all points one index backward 00775 for (int ipoint = 1; ipoint<npoints; ipoint++) { 00776 x[ipoint-1] = x[ipoint]; 00777 z[ipoint-1] = z[ipoint]; 00778 w[ipoint-1] = w[ipoint]; 00779 } 00780 00781 // decrement number of points 00782 npoints--; 00783 00784 // set the first fitweight to 0 00785 road1dptr->get()->set_fitweight( 0, 0 ); 00786 } 00787 00788 // end kludge 00789 00790 // replace utiLineFit with gsl; converted fit variables from floats to doubles 00791 int status = gsl_fit_wlinear(z,1,w,1,x,1,npoints, 00792 &intercept,&slope,&cov00,&cov11,&cov22,&chisq); 00793 if(status!= 0 ) { 00794 cout<<PHWHERE<<" Unable to fit MuID road." << endl; 00795 return -1; 00796 } 00797 00798 /* 00799 // debug printout 00800 cout << PHWHERE 00801 << " slope " << slope 00802 << " intercept " << intercept 00803 << " sigma_slope " << sqrt(fabs(cov22)) 00804 << " sigma_intercept " << sqrt(fabs(cov00)) 00805 << " cov00 " << cov00 00806 << " cov11 " << cov11 00807 << " cov22 " << cov22 00808 << " chisq " << chisq 00809 << endl; 00810 // end debug printout 00811 */ 00812 double dydz, dxdz, xint, yint; 00813 double sig_x2, sig_y2, sig_dxdz2, sig_dydz2; 00814 if (road1dptr->get()->get_orientation() == 0) { 00815 00816 dxdz = 0.0; 00817 dydz = slope; 00818 xint = 0.0; 00819 yint = intercept; 00820 00821 sig_x2 = 0; 00822 sig_y2 = cov00; 00823 sig_dxdz2 = 0; 00824 sig_dydz2 = cov22; 00825 00826 } else { 00827 00828 dxdz = slope; 00829 dydz = 0.0; 00830 xint = intercept; 00831 yint = 0.0; 00832 00833 sig_x2 = cov00; 00834 sig_y2 = 0; 00835 sig_dxdz2 = cov22; 00836 sig_dydz2 = 0; 00837 00838 } 00839 00840 TMutFitPar fitpar1d(xint,yint,0.0,dxdz,dydz,chisq); 00841 fitpar1d.set_z_begin(hit_zmin); 00842 fitpar1d.set_z_end(hit_zmax); 00843 00844 // set the covariance matrix 00845 fitpar1d.set_covar( 0, 0, sig_x2 ); 00846 fitpar1d.set_covar( 1, 1, sig_y2 ); 00847 fitpar1d.set_covar( 2, 2, sig_dxdz2 ); 00848 fitpar1d.set_covar( 3, 3, sig_dydz2 ); 00849 00850 road1dptr->get()->set_fit_par(fitpar1d); 00851 return 0; 00852 } |
|
Definition at line 915 of file mMuiRoadFinder1.cxx. References _mod_par, _roadmap, TMuiRoadOGroup::AttachRoad(), TMuiRoadMapO::get(), mMuiRoadFinder1Par::get_mui_window(), mMuiRoadFinder1Par::get_mut_window(), mMuiRoadFinder1Par::get_mut_z_north(), mMuiRoadFinder1Par::get_mut_z_south(), TMuiParBase::get_verbosity(), TMuiRoadOGroup::MergeGroup(), and TMuiRoadOGroup::SetGroup(). Referenced by event().
00916 { 00917 //Loop over arms 00918 for (short iArm=0; iArm<TMuiChannelId::kArmsTotal; iArm++) { 00919 // Reject ghost by grouping the roads 00920 vector<TMuiRoadOGroup*> pGroup; 00921 vector<TMuiRoadOGroup*>::iterator ig; 00922 00923 TMuiRoadOGroup* iGroup; 00924 TMuiRoadMapO::iterator iRoad = _roadmap->get(iArm); 00925 while(TMuiRoadMapO::pointer road2D = iRoad.next()) { 00926 00927 bool InGroup = false; 00928 iGroup=NULL; 00929 for(ig=pGroup.begin();ig!=pGroup.end();ig++) 00930 if ((*ig)->IsGroup(road2D)) { 00931 if(!InGroup) { 00932 00933 //This is the first group associated with the road 00934 (*ig)->AttachRoad(road2D); 00935 iGroup = (*ig); 00936 00937 }else{ 00938 00939 // This road has already been associated with a road 00940 // Instead of adding it to two groups lets merge this into the first 00941 // then remove the first group 00942 iGroup->MergeGroup(*ig); 00943 TMuiRoadOGroup* removedGroup = (*ig); 00944 delete removedGroup; // Delete the new TMuiRoadOGroup object 00945 pGroup.erase(ig); // Remove the Group pointer from the list. 00946 ig--; // Decrement the iterator since erase incremented 00947 00948 } 00949 InGroup = true; 00950 } 00951 00952 if( !InGroup){ 00953 00954 // This road doesn't belong to any group, create a new group 00955 float MutrZ; 00956 if(iArm == 0) MutrZ = _mod_par->get_mut_z_south(); 00957 else MutrZ = _mod_par->get_mut_z_north(); 00958 00959 iGroup = new TMuiRoadOGroup(iArm,MutrZ,_mod_par->get_mut_window(),_mod_par->get_mui_window()); 00960 iGroup->AttachRoad(road2D); 00961 pGroup.push_back(iGroup); 00962 00963 } 00964 00965 } 00966 00967 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00968 cout<<PHWHERE<<" Mark Golden Roads"<< endl; 00969 00970 // set group index and golden mark for each road object 00971 // The golden flags are saved in the TMui2DRoads 00972 short ngroup = pGroup.size(); 00973 for(short i=0; i<ngroup; i++){ 00974 iGroup = pGroup[i]; 00975 iGroup->SetGroup(i); 00976 } 00977 00978 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00979 cout<<PHWHERE<<" Destroy Group Objects"<< endl; 00980 00981 // destroy the all group objects 00982 for(short i=0; i<ngroup; i++) delete pGroup[i]; 00983 00984 }//for(iArm... 00985 return 0; 00986 } |
|
Definition at line 887 of file mMuiRoadFinder1.cxx. Referenced by find_2droads().
00889 { 00890 TMuiGeometry* geom = TMuiGeometry::Geom(); 00891 // Is the intersection point inside the panel(s) containing the H and 00892 // V clusters? 00893 TMuiPanelGeo* ph = geom->getPanel(clustH->get()->get_arm(), 00894 clustH->get()->get_plane(), 00895 clustH->get()->get_panel()); 00896 TMuiPanelGeo* pv = geom->getPanel(clustV->get()->get_arm(), 00897 clustV->get()->get_plane(), 00898 clustV->get()->get_panel()); 00899 00900 PHPoint hpoint = clustH->get()->get_centroidpos(); 00901 PHPoint vpoint = clustV->get()->get_centroidpos(); 00902 00903 PHPoint h1_local = ph->TransformToPanel(hpoint); 00904 PHPoint v1_local = ph->TransformToPanel(vpoint); 00905 00906 PHPoint h2_local = pv->TransformToPanel(hpoint); 00907 PHPoint v2_local = pv->TransformToPanel(vpoint); 00908 00909 return (ph->IsInPanel(v1_local.getX(), h1_local.getY(), 0.0) && 00910 pv->IsInPanel(v2_local.getX(), h2_local.getY(), 0.0) ); 00911 00912 } |
|
Definition at line 594 of file mMuiRoadFinder1.cxx. References _mod_par, and TMuiParBase::get_verbosity(). Referenced by find_2droads().
00597 { 00598 00599 TMutFitPar fitH = pRoadH->get()->get_fit_par(); 00600 TMutFitPar fitV = pRoadV->get()->get_fit_par(); 00601 00602 // associate horizontal road clusters to road 00603 TMuiClusterMapO::key_iterator iClustH =pRoadH->get()->get_associated<TMuiClusterO>(); 00604 while(TMuiClusterMapO::pointer pClust = iClustH.next()) PHKey::associate(pClust, cRoad); 00605 00606 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00607 cout << "mMuiRoadFinder1::make2d - road=" << cRoad->get()->get_key().get_obj_key() 00608 << " 1DRoad=" << pRoadH->get()->get_key().get_obj_key() 00609 << " clusters=" << iClustH.count() 00610 << endl; 00611 00612 // associate vertical road clusters to road 00613 TMuiClusterMapO::key_iterator iClustV =pRoadV->get()->get_associated<TMuiClusterO>(); 00614 while(TMuiClusterMapO::pointer pClust = iClustV.next()) PHKey::associate(pClust,cRoad); 00615 00616 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00617 cout << "mMuiRoadFinder1::make2d - road=" << cRoad->get()->get_key().get_obj_key() 00618 << " 1DRoad=" << pRoadV->get()->get_key().get_obj_key() 00619 << " clusters=" << iClustV.count() 00620 << endl; 00621 00622 cRoad->get()->set_nhit(pRoadH->get()->get_nhit() + pRoadV->get()->get_nhit()); 00623 00624 //Combine the FitPar of the 1D roads 00625 TMutFitPar fit2d; 00626 fit2d.set_x(fitV.get_x()); 00627 fit2d.set_y(fitH.get_y()); 00628 fit2d.set_z(fitH.get_z()); 00629 fit2d.set_dxdz(fitV.get_dxdz()); 00630 fit2d.set_dydz(fitH.get_dydz()); 00631 if(pRoadV->get()->get_depth()>pRoadH->get()->get_depth()) { 00632 cRoad->get()->set_depth(pRoadV->get()->get_depth()); 00633 fit2d.set_z_end(fitV.get_z_end()); 00634 } else { 00635 cRoad->get()->set_depth(pRoadH->get()->get_depth()); 00636 fit2d.set_z_end(fitH.get_z_end()); 00637 } 00638 00639 fit2d.set_z_begin( (abs(fitH.get_z_begin())<abs(fitV.get_z_begin()) ) 00640 ? fitH.get_z_begin() 00641 : fitV.get_z_begin() ); 00642 00643 int vDOF = pRoadV->get()->get_nhit() + (int)(pRoadV->get()->get_fitweight(0)) - 2; 00644 int hDOF = pRoadH->get()->get_nhit() + (int)(pRoadH->get()->get_fitweight(0)) - 2 ; 00645 00646 cRoad->get()->set_freedom(vDOF+hDOF); 00647 00648 // JLN - fix bug - should be OR of H and V 00649 cRoad->get()->set_gapbit(pRoadH->get()->get_gapbit() | (pRoadV->get()->get_gapbit() << 5)); 00650 00651 // DS - the vertical and horizontal fits have chi-square values, not divided 00652 // by ndof. For consistency with other chi-square values, 00653 // the 2d road values are reduced chi-squares though, i.e. divided by ndof 00654 double chisq = fitV.get_chi_square() + fitH.get_chi_square(); 00655 double reduced_chisq( ((vDOF + hDOF) >0 ) ? chisq/(vDOF + hDOF) : 0.0 ); 00656 fit2d.set_chi_square( reduced_chisq ); 00657 00658 /* 00659 set covariance matrix. Is the sum of the two 1D covariance matrices 00660 since all 'unused' elements there have been set to 0 00661 */ 00662 for( unsigned int i=0; i<4; i++ ) 00663 for( unsigned int j=0; j<4; j++ ) 00664 fit2d.set_covar( i, j, fitV.get_covar( i, j ) + fitH.get_covar( i, j ) ); 00665 00666 cRoad->get()->set_fit_par(fit2d); 00667 00668 // previously not set parameters 00669 cRoad->get()->set_road_quality(chisq); 00670 UShort_t gapmatch = pRoadH->get()->get_gapbit() & pRoadV->get()->get_gapbit(); 00671 if (gapmatch != 0) cRoad->get()->set_max_hit_plane(2); 00672 else cRoad->get()->set_max_hit_plane(1); 00673 00674 // associate the 1D roads to the road 00675 PHKey::associate( cRoad, pRoadH ); 00676 PHKey::associate( cRoad, pRoadV ); 00677 00678 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00679 cout << "mMuiRoadFinder1::make2d - depth=" << cRoad->get()->get_depth() << " gapbit=" << int( cRoad->get()->get_gapbit() ) << endl; 00680 00681 return 0; 00682 } |
|
Definition at line 874 of file mMuiRoadFinder1.cxx. References _clustermap, _mod_par, _road1dmap, and _roadmap. Referenced by event().
00875 { 00876 // module runtime parameters 00877 _mod_par = TMutNode<mMuiRoadFinder1Par>::find_node(top_node,"mMuiRoadFinder1Par"); 00878 00879 // IOC 00880 _roadmap = TMutNode<TMuiRoadMapO>::find_node(top_node,"TMuiRoadMapO"); 00881 _road1dmap = TMutNode<TMui1DRoadMapO>::find_node(top_node,"TMui1DRoadMapO"); 00882 _clustermap = TMutNode<TMuiClusterMapO>::find_node(top_node,"TMuiClusterMapO"); 00883 00884 } |
|
Definition at line 414 of file mMuiRoadFinder1.cxx. References _clustermap, _mod_par, _road1dmap, ClusterDistance(), muioo_cluster_distance::distance, fit1d(), TMuiClusterMapO::get(), mMuiRoadFinder1Par::get_max_clusters_per_gap_search(), mMuiRoadFinder1Par::get_mui_window(), mMuiRoadFinder1Par::get_num_seed_loops(), mMuiRoadFinder1Par::get_search_length(), mMuiRoadFinder1Par::get_search_order(), TMuiParBase::get_verbosity(), TMui1DRoadMapO::insert_new(), and muioo_cluster_distance::pCluster. Referenced by find_1droads().
00415 { 00416 00417 double Win = _mod_par->get_mui_window(); 00418 if(road1dptr->get()->get_associated<TMuiClusterO>().count() == 1) Win = 2.0 * Win; 00419 00420 // fit the road 00421 fit1d(road1dptr); 00422 00423 //Invalid iLoop 00424 if(iLoop>=_mod_par->get_num_seed_loops()) { 00425 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00426 cout << "mMuiRoadFinder1::track_seed - [iloop] aborted for 1DRoad " << road1dptr->get()->get_key().get_obj_key() << endl; 00427 return 0; 00428 } 00429 00430 // End this recursion loop over search planes 00431 if(iSearch>=_mod_par->get_search_length(iLoop)){ 00432 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00433 cout << "mMuiRoadFinder1::track_seed - [isearch] aborted for 1DRoad " << road1dptr->get()->get_key().get_obj_key() << endl; 00434 return 0; 00435 } 00436 00437 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00438 cout<< "mMuiRoadFinder1::track_seed - Tracking seed: iLoop("<<iLoop<<") iSearch("<<iSearch<<")\n"; 00439 00440 //First get list of clusters in panel 00441 // and order them by their distance from seed projection 00442 TMuiClusterMapO::iterator iclusts = 00443 _clustermap->get(road1dptr->get()->get_arm(), 00444 _mod_par->get_search_order(iLoop, iSearch), 00445 road1dptr->get()->get_panel(), 00446 road1dptr->get()->get_orientation() 00447 ); 00448 00449 // Loop over all clusters in the panel 00450 // and project the road to the current panel; 00451 // if in the window append to local copy 00452 // then sort by distance 00453 std::vector<muioo_cluster_distance> clusterList; 00454 muioo_cluster_distance tmp_cd; 00455 double clust_dist = 0.0; 00456 bool clustInPanel = false; 00457 00458 while(TMuiClusterMapO::pointer clustptr = iclusts.next()) { 00459 00460 clust_dist = ClusterDistance(road1dptr,clustptr); 00461 /* 00462 JLN - this was MuidWindow, but changed to use Win 00463 (as defined above to double in case of first hit) - 00464 07/25/03 00465 */ 00466 if(clust_dist < Win) { 00467 tmp_cd.distance = clust_dist; 00468 tmp_cd.pCluster = clustptr; 00469 clusterList.push_back(tmp_cd); 00470 } 00471 } 00472 00473 /* 00474 If there's no cluster found 00475 lets look for clusters in the adjacent panels, but 00476 continue to consider a candidate with no hit in the 00477 current panel, ie Hardware Inefficiency 00478 */ 00479 00480 if( _mod_par->get_verbosity() >= MUIOO::MAX ) 00481 cout<<"Found "<<clusterList.size()<<" in the current panel "<<endl; 00482 00483 if(clusterList.size()>0) clustInPanel=true; 00484 00485 if(!clustInPanel) 00486 for (short iPanel=0; iPanel<TMuiChannelId::kPanelsPerPlane; iPanel++) { 00487 00488 //Skip non-adjacent panels 00489 if(!( 00490 (iPanel = ((iPanel + 1)% TMuiChannelId::kPanelsPerPlane)) 00491 ||((iPanel + TMuiChannelId::kPanelsPerPlane - 1)% TMuiChannelId::kPanelsPerPlane) 00492 )) continue; 00493 00494 TMuiClusterMapO::iterator iclustsNA = 00495 _clustermap->get(road1dptr->get()->get_arm(), 00496 _mod_par->get_search_order(iLoop, iSearch), 00497 iPanel, 00498 road1dptr->get()->get_orientation() 00499 ); 00500 00501 while(TMuiClusterMapO::pointer clustptr = iclustsNA.next()) { 00502 00503 if(!clustptr) break; 00504 00505 // Get the displacement of cluster pc to road1D 00506 clust_dist = ClusterDistance(road1dptr,clustptr); 00507 00508 // Consider all of the clusters within the window 00509 // JLN - again MuidWindow -> Win - 07/25/03 00510 if ( clust_dist < Win ) { 00511 tmp_cd.pCluster=clustptr; 00512 tmp_cd.distance = clust_dist; 00513 clusterList.push_back(tmp_cd); 00514 } 00515 00516 } //while(iClust) 00517 } //if(!clustInPanel) 00518 00519 //Let's sort the list by the distance from projection 00520 sort(clusterList.begin(), clusterList.end(), muioo_cluster_distance_sort()); 00521 00522 // First case: No clusters in any panel so go to next search gap 00523 if((!clustInPanel&& (clusterList.size()==0))) track_seed(road1dptr , iLoop, iSearch+1); 00524 else if(!clustInPanel) { 00525 00526 //Second case: no clust in current panel but in adjacent 00527 // track a copy without clusters 00528 TMui1DRoadMapO::pointer new1droadptr = (_road1dmap->insert_new(road1dptr)).current(); 00529 00530 if( _mod_par->get_verbosity() >= MUIOO::MAX ) { 00531 cout<<"Copied 1DRoad\n"; 00532 cout<<"Original:\n"; 00533 road1dptr->get()->print(); 00534 cout<<"Copy:\n"; 00535 new1droadptr->get()->print(); 00536 } 00537 00538 track_seed(new1droadptr, iLoop, iSearch+1); 00539 00540 } 00541 00542 // Loop over all clusters up to maxClustersPerGapSearch 00543 // Create a copy (if not last) 00544 // Add cluster to copy and track_seed 00545 int newRoadCount = 0; 00546 vector<muioo_cluster_distance>::iterator lastEntry = clusterList.end(); 00547 lastEntry--; 00548 00549 for(vector<muioo_cluster_distance>::iterator iClustCand = clusterList.begin(); 00550 iClustCand != clusterList.end(); iClustCand++){ 00551 if(iClustCand == lastEntry || (newRoadCount == _mod_par->get_max_clusters_per_gap_search()-1)){ 00552 00553 PHKey::associate(road1dptr,(*iClustCand).pCluster); 00554 00555 if( _mod_par->get_verbosity() >= MUIOO::ALOT ) 00556 cout 00557 << "mMuiRoadFinder1::track_seed - associate 1DRoad=" << road1dptr->get()->get_key().get_obj_key() 00558 << " cluster " << (*iClustCand).pCluster->get()->get_key().get_obj_key() << endl; 00559 00560 track_seed(road1dptr, iLoop, iSearch+1); 00561 break; 00562 00563 } else { 00564 00565 TMui1DRoadMapO::pointer new1droadptr = (_road1dmap->insert_new(road1dptr)).current(); 00566 00567 if( _mod_par->get_verbosity() >= MUIOO::MAX ) { 00568 cout<<"Copied 1DRoad\n"; 00569 cout<<"Original:\n"; 00570 road1dptr->get()->print(); 00571 cout<<"Copy:\n"; 00572 new1droadptr->get()->print(); 00573 } 00574 00575 PHKey::associate(new1droadptr,(*iClustCand).pCluster); 00576 00577 if( _mod_par->get_verbosity() >= MUIOO::ALOT ) 00578 cout 00579 << "mMuiRoadFinder1::track_seed - associate 1DRoad=" << new1droadptr->get()->get_key().get_obj_key() 00580 << " cluster " << (*iClustCand).pCluster->get()->get_key().get_obj_key() << endl; 00581 00582 // this looks wrong. Should not we call it for the new road (?) 00583 track_seed(road1dptr, iLoop, iSearch+1); 00584 newRoadCount++; 00585 00586 } 00587 00588 } 00589 clusterList.clear(); 00590 return 0; 00591 } |
|
Definition at line 60 of file mMuiRoadFinder1.h. Referenced by find_1droads(), set_interface_ptrs(), and track_seed(). |
|
Definition at line 57 of file mMuiRoadFinder1.h. Referenced by cut_1droads(), event(), find_1droads(), find_2droads(), fit1d(), flag_golden(), make2d(), set_interface_ptrs(), and track_seed(). |
|
Definition at line 59 of file mMuiRoadFinder1.h. Referenced by cut_1droads(), event(), find_1droads(), find_2droads(), set_interface_ptrs(), and track_seed(). |
|
Definition at line 58 of file mMuiRoadFinder1.h. Referenced by event(), find_2droads(), flag_golden(), and set_interface_ptrs(). |
|
Definition at line 61 of file mMuiRoadFinder1.h. Referenced by event(). |