#include <mMuiEvalO.h>
Public Methods | |
| mMuiEvalO () | |
| virtual | ~mMuiEvalO () |
| virtual PHBoolean | event (PHCompositeNode *) |
Private Methods | |
| void | set_interface_ptrs (PHCompositeNode *top_node) |
| void | evaluate () |
| void | associate_mchit () |
| void | associate_mctrk () |
| void | fill_road_eval (TMuiRoadMapO::pointer, TMutMCTrkMap::pointer, TMuiEvalMap::pointer) |
| std::pair< UShort_t, UShort_t > | get_true_hits (TMuiRoadMapO::pointer, TMutMCTrkMap::pointer) |
| UShort_t | get_n_maskhit (TMutMCTrkMap::pointer) |
| void | fill_eval_res (TMuiRoadMapO::pointer, TMutMCTrkMap::pointer, TMuiEvalMap::pointer) |
Private Attributes | |
| const mMuiEvalOPar * | _mod_par |
| TMuiHitMapO * | _hit_map |
| TMuiClusterMapO * | _cluster_map |
| TMuiRoadMapO * | _road_map |
| TMuiEvalMap * | _eval_map |
| TMutMCTrkMap * | _mctrk_map |
| PHTimeServer::timer | _timer |
| Timer. More... | |
|
|
constructor Definition at line 21 of file mMuiEvalO.cxx.
00021 : 00022 _timer( PHTimeServer::get()->insert_new( "mMuiEvalO" ) ) 00023 { 00024 name = "mMuiEvalO"; 00025 MUTOO::TRACE("initializing module " + std::string(name.getString())); 00026 } |
|
|
destructor Definition at line 29 of file mMuiEvalO.cxx.
00029 {;}
|
|
|
Definition at line 166 of file mMuiEvalO.cxx. References _cluster_map. Referenced by event.
00167 {
00168 // TMuiMCHits are associated with TMuiHit objects after running the
00169 // mMuiResponse module. It is convienient here to associate TMuiMCHit's
00170 // with TMuiClusters since these are associated with TMuiRoad objects and
00171 // are used in the reconstruction.
00172 // So here we loop over TMuiCluster objects -- trace through their
00173 // association tree until we get to the underlying TMuiMCHit and make
00174 // the association between TMuiMCHit and TMuiCluster explicit.
00175 //
00176
00177 TMuiClusterMapO::iterator cluster_iter = _cluster_map->range();
00178 while(TMuiClusterMapO::pointer cluster_ptr = cluster_iter.next()) {
00179 //
00180 TMuiHitMapO::key_iterator hit_iter = cluster_ptr->get()->get_associated<TMuiHitO>();
00181 if(!hit_iter.at_end()){
00182 TMuiHitMapO::pointer hit_ptr = hit_iter.current();
00183 //
00184 TMuiMCHitMapO::key_iterator mc_hit_iter = hit_ptr->get()->get_associated<TMuiMCHitO>();
00185 while(TMuiMCHitMapO::pointer mc_hit_ptr = mc_hit_iter.next()){
00186 // Promote the association (TMuiMCHit -- TMuiCluster)
00187 //
00188 PHKey::associate(mc_hit_ptr,cluster_ptr);
00189 }
00190 }
00191 }
00192 return;
00193 }
|
|
|
Definition at line 196 of file mMuiEvalO.cxx. References _mctrk_map, and _road_map. Referenced by event.
00197 {
00198 typedef std::pair<int, int> roadid_pair;
00199 typedef std::vector<roadid_pair> roadid_list;
00200
00201 // Get iterator to all TMuiRoad's in map
00202 //
00203 TMuiRoadMapO::iterator road_iter = _road_map->range();
00204
00205 // Loop over TMuiRoads [
00206 // Find associated TMuiClusters
00207 // Loop over all the associated TMuiClusters [
00208 // Find associated TMuiMCHits
00209 // Loop over all the associated TMuiMCHits [
00210 // Find associated TMutMCTrks
00211 // Select the most contributed MC track to the track.
00212 // ]
00213 // ]
00214 //
00215 // Associate this TMutMCTrk with the TMuiRoad.
00216 // ]
00217
00218 while(TMuiRoadMapO::pointer road_ptr = road_iter.next()){
00219 TMuiClusterMapO::const_key_iterator cluster_iter =
00220 road_ptr->get()->get_associated<TMuiClusterO>();
00221
00222 // Container for the pointers of all the MC tracks which has
00223 // contributed at least a MC hit to the reconstructed track,
00224 // this container is a vector of pairs.
00225 // In each pair, the first
00226 // element is an int recording how many MC hits this MC track has contributed to the track
00227 // and the the second is the pointer to the MC track
00228 //
00229 roadid_list road_counter;
00230 while(TMuiClusterMapO::const_pointer cluster_ptr = cluster_iter.next()) {
00231
00232 TMuiMCHitMapO::const_key_iterator mc_hit_iter =
00233 cluster_ptr->get()->get_associated<TMuiMCHitO>();
00234
00235 while(TMuiMCHitMapO::const_pointer mc_hit_ptr = mc_hit_iter.next()){
00236
00237 TMutMCTrkMap::key_iterator mc_trk_iter =
00238 mc_hit_ptr->get()->get_associated<TMutMCTrk>();
00239
00240 while(TMutMCTrkMap::pointer mc_trk_ptr=mc_trk_iter.next()){
00241 bool already_in = false;
00242 roadid_list::iterator list_iter = road_counter.begin();
00243
00244 // Loop over all the pairs, matching the mc track pointer with
00245 // this mc tracker
00246 // IF find the matching, pair.first + 1
00247 // else make a new pair and push it back into the vector
00248 //
00249 for(; list_iter!=road_counter.end(); ++list_iter) {
00250
00251 if(list_iter->second==(mc_trk_ptr->get()->get_track_id())){
00252 list_iter->first=list_iter->first+1;
00253 already_in=true;
00254 }
00255 }
00256 if(already_in==false) {
00257 road_counter.push_back(std::make_pair(1,
00258 mc_trk_ptr->get()->get_track_id()));
00259 }
00260 }
00261 }
00262 }
00263 // Search for the primary contributor to the track, and
00264 // associate them together.
00265 //
00266 int max_hit =0;
00267 int max_track_id =0;
00268 roadid_list::iterator list_iter = road_counter.begin();
00269 for(; list_iter!=road_counter.end(); ++list_iter) {
00270
00271 if(list_iter->first>max_hit) {
00272 max_track_id = list_iter->second;
00273 max_hit = list_iter->first;
00274 }
00275 }
00276 TMutMCTrkMap::iterator mc_trk_iter = _mctrk_map->range();
00277 while(TMutMCTrkMap::pointer mc_trk_ptr = mc_trk_iter.next()){
00278
00279 if((mc_trk_ptr->get()->get_track_id())==max_track_id) {
00280 PHKey::associate(mc_trk_ptr, road_ptr);
00281 }
00282 }
00283 }
00284 return;
00285 }
|
|
|
fill the eval_map Definition at line 114 of file mMuiEvalO.cxx. References _eval_map, _mctrk_map, fill_eval_res, fill_road_eval, and TMuiEvalMap::insert_new. Referenced by event.
00115 {
00116 // Loop over all the MC tracks [
00117 // Insert a new eval object to eval map for each road.
00118 // Find associated found roads.
00119 // If no associated road found, fill one eval object with created hits,etc.
00120 // If associated roads found:
00121 // Fill TMuiRoadEval field in TMuiEval object for each associated track.
00122 // Fill TMuiEvalRes list in TMuiEval object.
00123 // Associate TMuiEval with TMuiRoad
00124 // ]
00125
00126 TMutMCTrkMap::iterator mc_trk_iter = _mctrk_map->range();
00127 while(TMutMCTrkMap::pointer mc_trk_ptr = mc_trk_iter.next()){
00128
00129 TMuiMCHitMapO::key_iterator mc_hit_iter =
00130 mc_trk_ptr->get()->get_associated<TMuiMCHitO>();
00131
00132 TMuiRoadMapO::key_iterator road_iter =
00133 mc_trk_ptr->get()->get_associated<TMuiRoadO>();
00134
00135 // If no found track associated with this MC track,
00136 // fill one eval entry (anyway) with not so much eval info..
00137 //
00138 if (!road_iter.count()){
00139 TMuiEvalMap::iterator eval_iter =
00140 _eval_map->insert_new(mc_trk_ptr->get()->get_arm());
00141 fill_road_eval(0, mc_trk_ptr, eval_iter.current());
00142 PHKey::associate(mc_trk_ptr, eval_iter.current());
00143 }
00144
00145 // Fill the TMuiRoadEval object contained in the TMuiEval object
00146 //
00147 while(TMuiRoadMapO::pointer road_ptr = road_iter.next()){
00148 TMuiEvalMap::iterator eval_iter =
00149 _eval_map->insert_new(mc_trk_ptr->get()->get_arm());
00150 fill_road_eval(road_ptr, mc_trk_ptr, eval_iter.current());
00151
00152 // Fill the TMuiEvalRes list contained in the TMuiEval object
00153 //
00154 fill_eval_res(road_ptr, mc_trk_ptr, eval_iter.current());
00155
00156 // Associate the TMuiEval object with the TMuiRoad
00157 //
00158 PHKey::associate(road_ptr,eval_iter.current());
00159 PHKey::associate(mc_trk_ptr,eval_iter.current());
00160 }
00161 }
00162 return;
00163 }
|
|
|
Event method Definition at line 33 of file mMuiEvalO.cxx. References _eval_map, _mctrk_map, _mod_par, _timer, associate_mchit, associate_mctrk, evaluate, mMuiEvalOPar::get_pr_mode, TMuiParBase::get_verbosity, mMuiEvalOPar::NORMAL, MUIOO::PRINT, set_interface_ptrs, and MUIOO::TRACE.
00034 {
00035 _timer.get()->restart();
00036
00037 try {
00038 // Reset IOC pointers
00039 //
00040 set_interface_ptrs(top_node);
00041
00042 // Unless we ran perfect pattern recogniton promote
00043 // the TMuiMCHit associations to TMuiCluster and
00044 // determine the principal contributor to the
00045 // TMutMCTrk
00046 //
00047 if(_mod_par->get_pr_mode() == mMuiEvalOPar::NORMAL) {
00048 // associate TMuiMCHits with TMuiCluster
00049 //
00050 associate_mchit();
00051 if( _mod_par->get_verbosity() >= MUIOO::MAX ) {
00052 MUIOO::PRINT(std::cout, " After associate_mc_hit");
00053 _mctrk_map->print();
00054 }
00055
00056 // associate TMutMCTrk with TMuiRoad
00057 //
00058 associate_mctrk();
00059 if( _mod_par->get_verbosity() >= MUIOO::MAX ) {
00060 MUIOO::PRINT(std::cout, " After associate_mc_trk");
00061 _mctrk_map->print();
00062 }
00063 }
00064
00065 // Do the evaluation
00066 //
00067 evaluate();
00068 if( _mod_par->get_verbosity() >= MUIOO::MAX ) {
00069 MUIOO::PRINT(std::cout, " After evaluate");
00070 _mctrk_map->print();
00071 }
00072
00073 }
00074 catch(std::exception& e) {
00075 MUIOO::TRACE(e.what());
00076 return False;
00077 }
00078
00079 _timer.get()->stop();
00080 if(_mod_par->get_verbosity() >= MUIOO::SOME) _timer.get()->print();
00081 // If verbose dump the contents of the eval map
00082 //
00083 if(_mod_par->get_verbosity() >= MUIOO::ALOT) _eval_map->print();
00084
00085 return True;
00086 }
|
|
||||||||||||||||
|
Definition at line 423 of file mMuiEvalO.cxx. References TMuiEvalRes::get_px_true, TMuiEvalRes::get_py_true, TMuiEvalRes::get_pz_true, MUIOO::pt, TMuiEvalRes::set_arm, TMuiEvalRes::set_orientation, TMuiEvalRes::set_panel, TMuiEvalRes::set_phi_true, TMuiEvalRes::set_plane, TMuiEvalRes::set_px_true, TMuiEvalRes::set_py_true, TMuiEvalRes::set_pz_true, TMuiEvalRes::set_theta_true, TMuiEvalRes::set_x_true, TMuiEvalRes::set_y_true, and TMuiEvalRes::set_z_true. Referenced by evaluate.
00426 {
00427 // TBI-> In Working Progress.
00428 // Loop over all the TMuiClusterO which are associated with TMutTrk [
00429 // Pickup the TMutMChit which is associated with TMuiClusterO.
00430 // Define a buffer for TMuiEvalRes object.
00431 // Fill the fields of TMuiEvalRes object.
00432 // ]
00433 //
00434
00435 TMuiClusterMapO::const_key_iterator cluster_iter =
00436 road_ptr->get()->get_associated<TMuiClusterO>();
00437
00438 while(TMuiClusterMapO::const_pointer cluster_ptr=cluster_iter.next()){
00439
00440 TMuiMCHitMapO::const_key_iterator mchit_iter = cluster_ptr->get()->get_associated<TMuiMCHitO>();
00441
00442 if(mchit_iter.count()<1) {
00443 continue;
00444 }
00445
00446 while(TMuiMCHitMapO::const_pointer mchit_ptr = mchit_iter.next()){
00447 TMuiEvalRes eval_res;
00448
00450 eval_res.set_arm(cluster_ptr->get()->get_arm());
00451 eval_res.set_plane(cluster_ptr->get()->get_plane());
00452 eval_res.set_panel(cluster_ptr->get()->get_panel());
00453 eval_res.set_orientation(cluster_ptr->get()->get_orientation());
00454
00456 eval_res.set_x_true(mchit_ptr->get()->get_x());
00457 eval_res.set_y_true(mchit_ptr->get()->get_y());
00458 eval_res.set_z_true(mchit_ptr->get()->get_z());
00459 eval_res.set_px_true(mchit_ptr->get()->get_px());
00460 eval_res.set_py_true(mchit_ptr->get()->get_py());
00461 eval_res.set_pz_true(mchit_ptr->get()->get_pz());
00462 Float_t pt = sqrt((eval_res.get_px_true())*(eval_res.get_px_true())+
00463 (eval_res.get_py_true())*(eval_res.get_py_true()));
00464 Float_t ptot = sqrt((eval_res.get_px_true())*(eval_res.get_px_true())+
00465 (eval_res.get_py_true())*(eval_res.get_py_true())+
00466 (eval_res.get_pz_true())*(eval_res.get_pz_true()));
00467
00468 if(pt==0){
00469 eval_res.set_theta_true(0.0);
00470 eval_res.set_phi_true(-999.0);
00471 }
00472 else{
00473 eval_res.set_theta_true(acos((eval_res.get_pz_true())/ptot));
00474 // We set phi angle range from -PI to PI. If py < 0, we give phi a
00475 // value less than 0.
00476 if(eval_res.get_py_true()>0){
00477 eval_res.set_phi_true(acos((eval_res.get_px_true())/pt));
00478 }
00479 else{
00480 eval_res.set_phi_true(-1.0*acos((eval_res.get_px_true())/pt));
00481 }
00482 }
00483 eval_ptr->get()->push_eval_res_list(eval_res);
00484 }
00485 }
00486 }
|
|
||||||||||||||||
|
Definition at line 288 of file mMuiEvalO.cxx. References get_n_maskhit, get_true_hits, TMuiRoadEval::set_n_masked_hits, TMuiRoadEval::set_n_reco_ghost_hits, TMuiRoadEval::set_n_reco_true_hits, TMuiRoadEval::set_n_true_hits, TMuiRoadEval::set_ptot_true_vx, TMuiRoadEval::set_px_true_vx, TMuiRoadEval::set_py_true_vx, and TMuiRoadEval::set_pz_true_vx. Referenced by evaluate.
00291 {
00292 // Buffer for TMuiRoadEval field in TMuiEval class.
00293 //
00294 TMuiRoadEval road_eval;
00295
00296 // Total hits of MC track and what planes are hit.
00297 //
00298 UShort_t nhits_mc=0;
00299
00300 // Loop over TMuiMCHitO associated with TMutMCTrk
00301 //
00302 TMuiMCHitMapO::key_iterator mc_hit_iter = mctrk_ptr->get()->get_associated<TMuiMCHitO>();
00303 while(TMuiMCHitMapO::pointer mc_hit_ptr = mc_hit_iter.next()){
00304
00305 UShort_t plane = mc_hit_ptr->get()->get_plane();
00306 // Loop over assoicated TMuiClusterO
00307 //
00308 TMuiClusterMapO::key_iterator cluster_iter = mc_hit_ptr->get()->get_associated<TMuiClusterO>();
00309 while(TMuiClusterMapO::pointer cluster_ptr = cluster_iter.next()){
00310 // Bit pack cluster pattern associated with this road
00311 //
00312 nhits_mc |= 1 << (plane*MUIOO::MAX_ORIENTATION + cluster_ptr->get()->get_orientation());
00313 }
00314 }
00315
00316 // Set hit true hit mask
00317 //
00318 road_eval.set_n_true_hits(nhits_mc);
00319
00320 // Total masked hit for MC track.
00321 //
00322 UShort_t nhits_mask = get_n_maskhit(mctrk_ptr);
00323 road_eval.set_n_masked_hits(nhits_mask);
00324
00325 // Number of hits in a TMuiRoadO which are from primary contributor.
00326 //
00327 if (road_ptr) {
00328 // get_true_hits returns the true hit pattern and the ghost hit pattern
00329 // as a bit mask
00330 //
00331 std::pair<UShort_t, UShort_t> masks = get_true_hits(road_ptr,mctrk_ptr);
00332 road_eval.set_n_reco_true_hits(masks.first);
00333 road_eval.set_n_reco_ghost_hits(masks.second);
00334 }
00335
00336 // MC Track momentum at primary vertex
00337 //
00338 road_eval.set_px_true_vx(mctrk_ptr->get()->get_px_orig());
00339 road_eval.set_py_true_vx(mctrk_ptr->get()->get_py_orig());
00340 road_eval.set_pz_true_vx(mctrk_ptr->get()->get_pz_orig());
00341 road_eval.set_ptot_true_vx(mctrk_ptr->get()->get_ptot_orig());
00342
00343 // Fill TMuiRoadEval field of TMuiEval object.
00344 //
00345 eval_ptr->get()->set_road_eval(road_eval);
00346
00347 return;
00348 }
|
|
|
Definition at line 391 of file mMuiEvalO.cxx. References TMuiMCTwoPack::MASKED, and TMuiMCHitO::twopack_list. Referenced by fill_road_eval.
00392 {
00393 // Loop over associated TMuiMCHitO
00394 // Loop over twopack list
00395 // if two pack status is MASKED
00396 // set the bit for current plane in mask
00397 // ]
00398 // ]
00399 // ]
00400 UShort_t mask=0;
00401 typedef TMuiMCHitO::twopack_list twopack_list;
00402 typedef TMuiMCHitO::twopack_list::iterator twopack_iterator;
00403
00404 TMuiMCHitMapO::const_key_iterator mchit_iter =
00405 mctrk_ptr->get()->get_associated<TMuiMCHitO>();
00406 while(TMuiMCHitMapO::const_pointer mchit_ptr = mchit_iter.next()){
00407
00408 // Get an iterator for list of TMuiMCTwoPack from TMuiMCHit
00409 //
00410 twopack_list* twopacks = mchit_ptr->get()->get_mutable_twopack_list();
00411 twopack_iterator twopack_iter = twopacks->begin();
00412 for(;twopack_iter!=twopacks->end();++twopack_iter){
00413 if(twopack_iter->get_status() == TMuiMCTwoPack::MASKED) {
00414 UShort_t index = mchit_ptr->get()->get_plane()*MUIOO::MAX_ORIENTATION +
00415 twopack_iter->get_orient();
00416 mask |= 1 << index;
00417 }
00418 }
00419 }
00420 return mask;
00421 }
|
|
||||||||||||
|
Definition at line 351 of file mMuiEvalO.cxx. Referenced by fill_road_eval.
00353 {
00354 // Loop for all the associated TMuiClusterO [
00355 // Loop for all the associated TMuiMCHitO [
00356 // If(this associated MC track has the same roadid as primary contributor) [
00357 // n_true_hits+1;
00358 // ]
00359 // ]
00360 // ]
00361 // Mod: Pack planes hit into n_true_hits rather than just recording total number of hits
00362
00363 // Note in the below we bit pack the actual bit pattern into the word as opposed to
00364 // just keeping track of the totals.
00365 //
00366 UShort_t n_true_hits=0, n_ghost_hits=0;
00367 TMuiClusterMapO::const_key_iterator clus_iter = road_ptr->get()->get_associated<TMuiClusterO>();
00368 while(TMuiClusterMapO::const_pointer clus_ptr=clus_iter.next()){
00369
00370 UShort_t mask = clus_ptr->get()->get_plane()*MUIOO::MAX_ORIENTATION+ clus_ptr->get()->get_orientation();
00371
00372 // Iterator to all associated clusters
00373 //
00374 TMuiMCHitMapO::const_key_iterator mchit_iter = clus_ptr->get()->get_associated<TMuiMCHitO>();
00375
00376 // If no associated TMuiMCHit then increment the ghost counter
00377 //
00378 if(mchit_iter.count() == 0) n_ghost_hits |= 1 << mask;
00379 while(TMuiMCHitMapO::const_pointer mchit_ptr=mchit_iter.next()){
00380 if( mchit_ptr->get()->get_track_id() == mctrk_ptr->get()->get_track_id() ) {
00381 n_true_hits |= 1<<mask;
00382 } else {
00383 n_ghost_hits |= 1<<mask;
00384 }
00385 }
00386 }
00387 return std::make_pair(n_true_hits,n_ghost_hits);
00388 }
|
|
|
Reset IOC Definition at line 90 of file mMuiEvalO.cxx. References _cluster_map, _eval_map, _hit_map, _mctrk_map, _mod_par, and _road_map. Referenced by event.
00091 {
00092 // module runtime parameters
00093 //
00094 _mod_par = TMutNode<mMuiEvalOPar>::find_node(top_node,"mMuiEvalOPar");
00095 // TMuiHit IOC
00096 //
00097 _hit_map = TMutNode<TMuiHitMapO>::find_node(top_node,"TMuiHitMapO");
00098 // TMuiCluster IOC
00099 //
00100 _cluster_map = TMutNode<TMuiClusterMapO>::find_node(top_node,"TMuiClusterMapO");
00101 // TMuiRoad IOC
00102 //
00103 _road_map = TMutNode<TMuiRoadMapO>::find_node(top_node,"TMuiRoadMapO");
00104 // TMutMCTrk IOC
00105 //
00106 _mctrk_map = TMutNode<TMutMCTrkMap>::find_node(top_node,"TMutMCTrkMap");
00107 // TMuiEval IOC
00108 //
00109 _eval_map = TMutNode<TMuiEvalMap>::find_node(top_node,"TMuiEvalMap");
00110 }
|
|
|
Definition at line 40 of file mMuiEvalO.h. Referenced by associate_mchit, and set_interface_ptrs. |
|
|
Definition at line 42 of file mMuiEvalO.h. Referenced by evaluate, event, and set_interface_ptrs. |
|
|
Definition at line 39 of file mMuiEvalO.h. Referenced by set_interface_ptrs. |
|
|
Definition at line 43 of file mMuiEvalO.h. Referenced by associate_mctrk, evaluate, event, and set_interface_ptrs. |
|
|
Definition at line 38 of file mMuiEvalO.h. Referenced by event, and set_interface_ptrs. |
|
|
Definition at line 41 of file mMuiEvalO.h. Referenced by associate_mctrk, and set_interface_ptrs. |
|
|
Timer.
Definition at line 46 of file mMuiEvalO.h. Referenced by event. |