Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

TMui1DRoadMapO.cxx

Go to the documentation of this file.
00001 #include<TMui1DRoadMapO.h>
00002 #include<TMuiClusterMapO.h>
00003 #include<PHKeyIterator.h>
00004 #include<PHConstKeyIterator.h>
00005 
00006 
00007 TMui1DRoadMapO::TMui1DRoadMapO() : _count(0) {;}
00008 
00009 
00010 TMui1DRoadMapO::TMui1DRoadMapO(PHKey::map_key_type map_key) : PHMap<PHKey::key_type, TMui1DRoadO, TMui1DRoadO_v1>(map_key), _count(0){;}
00011 
00012 
00013 TMui1DRoadMapO::iterator TMui1DRoadMapO::insert_new(UShort_t arm, UShort_t panel, UShort_t orientation)
00014 {  
00015   // Get the new index from the roll count;
00016   //
00017   UShort_t index = get_roll_count();
00018   
00019   // get the key for the new cluster
00020   //
00021   TMuiKeyGen::key_type key = TMuiKeyGen::get_key(arm,
00022                                                  0, //Plane not relevant for 1D roads
00023                                                  panel,
00024                                                  orientation,
00025                                                  index);
00026   // full key
00027   //
00028   Key full_key(get_map_key(),key);
00029   
00030   // insert cluster
00031   //
00032   insert(full_key, new value_imp_type(full_key,
00033                                       arm,
00034                                       panel,
00035                                       orientation,
00036                                       index));
00037   
00038   // okay not so efficient 
00039   //
00040   return find(full_key);
00041 }
00042 
00043 TMui1DRoadMapO::iterator TMui1DRoadMapO::insert_new(TMui1DRoadMapO::pointer roadptr)
00044 {
00045   // count the number of tracks to determine the new index
00046   //
00047   TMuiKeyGen::key_range range = TMuiKeyGen::get_key_range(roadptr->get()->get_arm(),
00048                                                           0,
00049                                                           roadptr->get()->get_panel(),
00050                                                           roadptr->get()->get_orientation()
00051                                                           );
00052   
00053   Key lower(get_map_key(),range.first);
00054   Key upper(get_map_key(),range.second);
00055   UShort_t index = find(lower,upper).count();
00056   
00057   // get the key for the new cluster
00058   //
00059   TMuiKeyGen::key_type key = TMuiKeyGen::get_key(roadptr->get()->get_arm(),
00060                                                  0, //Plane not relevant for 1D roads
00061                                                  roadptr->get()->get_panel(),
00062                                                  roadptr->get()->get_orientation(),
00063                                                  index);
00064   // full key
00065   //
00066   Key full_key(get_map_key(),key);
00067   
00068   // insert cluster
00069   //
00070   insert(full_key, new value_imp_type(full_key,roadptr->get()));
00071 
00072   // okay not so efficient
00073   //
00074   TMui1DRoadMapO::iterator thisKey = find(full_key);
00075 
00076   // Now we have to associate all clusters in the roadptr
00077   // to the one we just created.
00078   TMuiClusterMapO::key_iterator iClust = 
00079     roadptr->get()->get_associated<TMuiClusterO>();
00080   while (TMuiClusterMapO::pointer pClust = iClust.next())
00081   {
00082     PHKey::associate(thisKey.current(),pClust);
00083   }
00084 
00085   return thisKey;
00086 }
00087 
00088 
00089 TMui1DRoadMapO::iterator 
00090 TMui1DRoadMapO::get(UShort_t arm)               
00091 {
00092   // key range associated with this plane
00093   //
00094   TMuiKeyGen::key_range range = TMuiKeyGen::get_key_range(arm);
00095   // return the iterator with specified range
00096   //
00097   Key lower(get_map_key(),range.first);
00098   Key upper(get_map_key(),range.second);
00099   return find(lower,upper);
00100 }
00101 
00102 
00103 TMui1DRoadMapO::const_iterator 
00104 TMui1DRoadMapO::get(UShort_t arm) const         
00105 {
00106   // key range associated with this plane
00107   //
00108   TMuiKeyGen::key_range range = TMuiKeyGen::get_key_range(arm);
00109   // return the iterator with specified range
00110   //
00111   Key lower(get_map_key(),range.first);
00112   Key upper(get_map_key(),range.second);
00113   return find(lower,upper);
00114 }
00115 
00116 TMui1DRoadMapO::iterator
00117 TMui1DRoadMapO::get(UShort_t arm,
00118                     UShort_t panel,
00119                     UShort_t orientation)
00120 {
00121   // key range associated with this plane
00122   //
00123 TMuiKeyGen::key_range range = TMuiKeyGen::get_key_range(arm,
00124                                                         0,
00125                                                         panel,
00126                                                         orientation
00127                                                         );
00128   // return the iterator with specified range
00129   //
00130   Key lower(get_map_key(),range.first);
00131   Key upper(get_map_key(),range.second);
00132   return find(lower,upper);
00133 }
00134 
00135 
00136 TMui1DRoadMapO::const_iterator
00137 TMui1DRoadMapO::get(UShort_t arm,
00138                     UShort_t panel,
00139                     UShort_t orientation) const
00140 {
00141   // key range associated with this plane
00142   //
00143 TMuiKeyGen::key_range range = TMuiKeyGen::get_key_range(arm,
00144                                                         0,
00145                                                         panel,
00146                                                         orientation
00147                                                         );
00148   // return the iterator with specified range
00149   //
00150   Key lower(get_map_key(),range.first);
00151   Key upper(get_map_key(),range.second);
00152   return find(lower,upper);
00153 }

MUIOO: PHENIX Muon Identifier Analysis Framework. Documentation by doxygen
Last modified: