#include <TMuiRoadOGroup.h>
Public Methods | |
| TMuiRoadOGroup (const short &arm, const float &z, const float &MutrWin, const float &MuidWin) | |
| Constructor. More... | |
| TMuiRoadOGroup (const TMuiRoadOGroup &source) | |
| Copy constructor. More... | |
| ~TMuiRoadOGroup () | |
| Destructor. More... | |
| void | SetGroup (const short &Group) |
| set the group index for this road. More... | |
| void | AttachRoad (TMuiRoadMapO::pointer road) |
| Attach the given road to this group. More... | |
| void | MergeGroup (TMuiRoadOGroup *sourceGroup) |
| Merge roads from another group to this group. More... | |
| void | RemoveRoad (TMuiRoadMapO::pointer road) |
| Remove the given road from this group. More... | |
| void | TMuiRoadOGroup::Clear () |
| size_t | GoldenIndex () const |
| Get the road index for "Golden" road in this group. More... | |
| short | Group () const |
| unique index of of this group. More... | |
| short | TotalRoads () const |
| How many roads in all does this group contain? More... | |
| TMuiRoadMapO::pointer | Road (int roadIndex) const |
| Pointer to the Nth road of this group. More... | |
| bool | IsGroup (TMuiRoadMapO::pointer road) |
| Does the road belong to this group. More... | |
| PHPoint | ProjectToZ (TMutFitPar fit_par, double ZPlane) |
| Project a TMutFitPar object to the the specified ZPlane. More... | |
Public Attributes | |
| vector< TMuiRoadMapO::pointer > | f_pRoads |
Private Methods | |
| void | MarkGolden () |
| Mark the "Golden" road in this group. More... | |
Private Attributes | |
| float | fZPlane |
| float | fMutrWin |
| float | fMuidWin |
| short | fGroup |
| size_t | fGoldenIndex |
| float | fChi2DOF |
| short | fArm |
| short | fTotalRoads |
Definition at line 19 of file TMuiRoadOGroup.h.
|
||||||||||||||||||||
|
Constructor.
Definition at line 17 of file TMuiRoadOGroup.cxx.
00019 : fZPlane(z),fMutrWin(MutrWin),fMuidWin(MuidWin), 00020 fGroup(-1),fGoldenIndex(0),fChi2DOF(100000.0), 00021 fArm(arm),fTotalRoads(0),f_pRoads(0) 00022 {} |
|
|
Copy constructor.
Definition at line 25 of file TMuiRoadOGroup.cxx.
00026 : fZPlane(source.fZPlane),fMutrWin(source.fMutrWin), 00027 fMuidWin(source.fMuidWin), 00028 fGroup(source.fGroup),fGoldenIndex(source.fGoldenIndex), 00029 fChi2DOF(source.fChi2DOF),fArm(source.fArm), 00030 fTotalRoads(source.fTotalRoads),f_pRoads(source.f_pRoads) 00031 {} |
|
|
Destructor.
Definition at line 34 of file TMuiRoadOGroup.cxx.
00034 {}
|
|
|
Attach the given road to this group.
Definition at line 75 of file TMuiRoadOGroup.cxx. References f_pRoads, and fTotalRoads. Referenced by mMuiRoadFinder1::flag_golden, and MergeGroup.
00076 {
00077 // Attach the road to the group.
00078 f_pRoads.push_back(road);
00079 fTotalRoads = f_pRoads.size();
00080 }
|
|
|
Get the road index for "Golden" road in this group.
Definition at line 57 of file TMuiRoadOGroup.cxx. References fGoldenIndex.
00058 {
00059 return fGoldenIndex;
00060 }
|
|
|
unique index of of this group.
Definition at line 65 of file TMuiRoadOGroup.cxx. References fGroup. Referenced by SetGroup.
00066 {
00067 return fGroup;
00068 }
|
|
|
Does the road belong to this group.
Definition at line 220 of file TMuiRoadOGroup.cxx. References f_pRoads, fArm, fMutrWin, fZPlane, and ProjectToZ.
00221 {
00222 vector<TMuiRoadMapO::pointer>::iterator i;
00223 short arm = road->get()->get_arm();
00224
00225 // Is the given road in the same arm as the group?
00226 if ( arm != fArm ) {
00227 return false;
00228 }
00229
00230 //
00231 if(f_pRoads.size()>=1500)
00232 {
00233 return false;
00234 }
00235
00236 // Grouping roads with following criteria:
00237 // 1. Project roads to MuTR Station 3, if they are in a certain window
00238 // 2. If pass 1, if all associated hits are in a certain window in each gap
00239
00240 // compare the given road with each road within this group
00241 bool St3IsGroup = false;
00242 PHPoint roadX = ProjectToZ(road->get()->get_fit_par(),fZPlane);
00243 for (i = f_pRoads.begin(); i != f_pRoads.end(); i++) {
00244 // Does the road already exist in the group?
00245 if( (*i)->get()->get_key() == road->get()->get_key() ){
00246 return false;
00247 }
00248 PHPoint iX = ProjectToZ((*i)->get()->get_fit_par(),fZPlane);
00249 if ( (fabs(iX.getX()- roadX.getX()) < fMutrWin) && (fabs(iX.getY()- roadX.getY()) < fMutrWin)){
00250 St3IsGroup=true;
00251 break;
00252 }
00253 }
00254 if(St3IsGroup == false)
00255 {
00256 return false;
00257 }
00258 // check associated clusters in each MuID gap
00259 int MatchingVHits = 0;
00260 int MatchingHHits = 0;
00261 int MinMatchHits = 1;
00262
00263 for (i = f_pRoads.begin(); i != f_pRoads.end(); i++)
00264 {
00265 //Loop over clusters and check for matches within window
00266 TMuiClusterMapO::const_key_iterator iclust1
00267 =road->get()->get_associated<TMuiClusterO>();
00268 TMuiClusterMapO::const_key_iterator iclust2
00269 =(*i)->get()->get_associated<TMuiClusterO>();
00270
00271 while(TMuiClusterMapO::const_pointer clust1 = iclust1.next())
00272 {
00273 iclust2 = (*i)->get()->get_associated<TMuiClusterO>();
00274 while(TMuiClusterMapO::const_pointer clust2 = iclust2.next())
00275 {
00276 if(clust1->get()->get_key()==clust2->get()->get_key())
00277 {
00278 if(clust1->get()->get_orientation()==0)
00279 {
00280 MatchingHHits++;
00281 }else{
00282 MatchingVHits++;
00283 }
00284 }
00285 }
00286 }
00287
00288
00289 }
00290
00291 if(MatchingVHits>=MinMatchHits && MatchingHHits>=MinMatchHits && St3IsGroup)
00292 {
00293 return true;
00294 }
00295
00296 return false;
00297
00298 }
|
|
|
Mark the "Golden" road in this group.
Definition at line 136 of file TMuiRoadOGroup.cxx. References f_pRoads, fZPlane, and ProjectToZ. Referenced by SetGroup.
00137 {
00138 // Mark the "golden" road in the group.
00139 // Lets sort the roads by their projections to station 3 of the MuTr
00140 // and choose the median. We may want to weight by Chi2.
00141 if(f_pRoads.size()>=1500)
00142 {
00143 cout<<"Road Group reached maximum entries: 1500\n";
00144 return;
00145 }
00146 double st3x, st3y;
00147 double st3xlist[1500];
00148 double st3ylist[1500];
00149 double Rst3xlist[1500];
00150 double Rst3ylist[1500];
00151 TMuiRoadMapO::pointer Rlist[1500];
00152 int xycount=0;
00153
00154 short Golden = 0;
00155 vector<TMuiRoadMapO::pointer>::iterator i;
00156 TMuiRoadMapO::pointer road = NULL;
00157 PHPoint st3p;
00158 for (i=f_pRoads.begin(); i != f_pRoads.end(); i++){
00159 road=(*i);
00160 st3p = ProjectToZ(road->get()->get_fit_par(),fZPlane);
00161 st3xlist[xycount] = st3p.getX();
00162 st3ylist[xycount] = st3p.getY();
00163 Rst3xlist[xycount] = st3p.getX();
00164 Rst3ylist[xycount] = st3p.getY();
00165 Rlist[xycount] = road;
00166 xycount++;
00167 }
00168 // Now lets calculate the median
00169 gsl_sort(st3xlist,1,xycount);
00170 gsl_sort(st3ylist,1,xycount);
00171 st3x = gsl_stats_median_from_sorted_data(st3xlist,1,xycount);
00172 st3y = gsl_stats_median_from_sorted_data(st3ylist,1,xycount);
00173 // Lets find the road the minimum distance from this
00174 double MinDist = 1E10;
00175 double ThisDist = 0.0;
00176 int med_id = 0;
00177 for (int rid = 0; rid < xycount; rid++)
00178 {
00179 ThisDist = sqrt((st3x-Rst3xlist[rid])*(st3x-Rst3xlist[rid])+(st3y-Rst3ylist[rid])*(st3y-Rst3ylist[rid]));
00180 if(ThisDist < MinDist)
00181 {
00182 MinDist = ThisDist;
00183 road = Rlist[rid];
00184 med_id = rid;
00185 }
00186 }
00187 //Now lets set this road as golden
00188 for (i=f_pRoads.begin(); i != f_pRoads.end(); i++){
00189 if( (*i) == road){
00190 Golden = 1;
00191 (*i)->get()->set_golden(Golden);
00192 }else{
00193 (*i)->get()->set_golden(0);
00194 }
00195 }
00196 }
|
|
|
Merge roads from another group to this group.
Definition at line 85 of file TMuiRoadOGroup.cxx. References AttachRoad, Road, and TotalRoads. Referenced by mMuiRoadFinder1::flag_golden.
00086 {
00087 if(sourceGroup==NULL)
00088 {
00089 return;
00090 }
00091 int roadIndex = 0;
00092 while(roadIndex < sourceGroup->TotalRoads())
00093 {
00094 AttachRoad(sourceGroup->Road(roadIndex));
00095 roadIndex++;
00096 }
00097 }
|
|
||||||||||||
|
Project a TMutFitPar object to the the specified ZPlane.
Definition at line 207 of file TMuiRoadOGroup.cxx. References fZPlane. Referenced by IsGroup, and MarkGolden.
00208 {
00209 PHPoint z_intersect;
00210 PHGeometry::intersectionLinePlane(
00211 PHLine(fit_par.get_point(),fit_par.get_tangent()),
00212 PHPlane(PHPoint(0,0,fZPlane),PHVector(0,0,1)),
00213 z_intersect
00214 );
00215 return z_intersect;
00216 }
|
|
|
Remove the given road from this group.
Definition at line 120 of file TMuiRoadOGroup.cxx. References f_pRoads, and fTotalRoads.
00121 {
00122 // Remove the road from the group.
00123 vector<TMuiRoadMapO::pointer>::iterator i;
00124 for (i=f_pRoads.begin(); i != f_pRoads.end(); i++){
00125 if((*i) == road){
00126 f_pRoads.erase(i);
00127 break;
00128 }
00129 }
00130 fTotalRoads = f_pRoads.size();
00131 }
|
|
|
Pointer to the Nth road of this group.
Definition at line 101 of file TMuiRoadOGroup.cxx. References f_pRoads. Referenced by MergeGroup.
|
|
|
set the group index for this road.
Definition at line 41 of file TMuiRoadOGroup.cxx. References f_pRoads, fGroup, Group, and MarkGolden. Referenced by mMuiRoadFinder1::flag_golden.
|
|
|
|
|
|
How many roads in all does this group contain?
Definition at line 203 of file TMuiRoadOGroup.cxx. References fTotalRoads. Referenced by MergeGroup.
00203 {return fTotalRoads;}
|
|
|
Definition at line 88 of file TMuiRoadOGroup.h. Referenced by AttachRoad, IsGroup, MarkGolden, RemoveRoad, Road, and SetGroup. |
|
|
Definition at line 85 of file TMuiRoadOGroup.h. Referenced by IsGroup. |
|
|
Definition at line 84 of file TMuiRoadOGroup.h. |
|
|
Definition at line 83 of file TMuiRoadOGroup.h. Referenced by GoldenIndex. |
|
|
Definition at line 82 of file TMuiRoadOGroup.h. |
|
|
Definition at line 80 of file TMuiRoadOGroup.h. |
|
|
Definition at line 79 of file TMuiRoadOGroup.h. Referenced by IsGroup. |
|
|
Definition at line 86 of file TMuiRoadOGroup.h. Referenced by AttachRoad, RemoveRoad, and TotalRoads. |
|
|
Definition at line 78 of file TMuiRoadOGroup.h. Referenced by IsGroup, MarkGolden, and ProjectToZ. |