/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/EventNavigator/EventNavigator-00-01-03/src/EventNavigator.cxx

Go to the documentation of this file.
00001 #include <iostream>
00002 
00003 #include "EventNavigator/EventNavigator.h"
00004 
00005 using namespace std;
00006 using namespace Event;
00007 
00008 // methods to retrieve physics objects corresponding given detector id
00009 
00010 RecEmcShowerVector EventNavigator::getEmcRecShowers ( int id )
00011 { 
00012   RecEmcShowerVector tmp;
00013   multimap <unsigned int, const RecEmcShower*>::iterator it;
00014   for (it=m_emcRecShowerId.equal_range(id).first; 
00015        it != m_emcRecShowerId.equal_range(id).second; 
00016        it++)
00017     tmp.push_back((*it).second);
00018   return tmp;
00019 }
00020 
00021 void EventNavigator::Print() 
00022 { 
00023   cout << "EventNavigator object:" << std::endl;
00024   cout << "  Mdc hits:    " << m_mcMdcMcHitsIdx.size() << endl;
00025   cout << "  Mdc tracks:  " << m_mcMdcTracksIdx.size() << endl;
00026   cout << "  Emc hits:    " << m_mcEmcMcHitsIdx.size() << endl;
00027   cout << "  Emc showers: " << m_mcEmcRecShowersIdx.size() << endl;
00028   cout << "  TABLES:" << endl;
00029   cout << "   m_mdcTracksWrtMcParticle " 
00030        << m_mdcTracksWrtMcParticle.size() << endl;
00031   cout << "   m_mcParticlesWrtMdcTrack " 
00032        << m_mcParticlesWrtMdcTrack.size() << endl;
00033   cout << "   m_mdcKalTracksWrtMcParticle " 
00034        << m_mdcKalTracksWrtMcParticle.size() << endl;
00035   cout << "   m_mcParticlesWrtMdcKalTrack " 
00036        << m_mcParticlesWrtMdcKalTrack.size() << endl;
00037   cout << "   m_mdcTracksWrtMcParticleP " 
00038        << m_mdcTracksWrtMcParticleP.size() << endl;
00039   cout << "   m_mcParticlesWrtMdcTrackP " 
00040        << m_mcParticlesWrtMdcTrackP.size() << endl;
00041   cout << "   m_mdcKalTracksWrtMcParticle " 
00042        << m_mdcKalTracksWrtMcParticleP.size() << endl;
00043   cout << "   m_mcParticlesWrtMdcKalTrack " 
00044        << m_mcParticlesWrtMdcKalTrackP.size() << endl;
00045   cout << "   m_mcParticlesWrtRecShower " 
00046        << m_mcParticlesWrtRecShower.size() << endl;
00047   cout << "   m_emcRecShowersWrtMcParticle " 
00048        << m_emcRecShowersWrtMcParticle.size() << endl; 
00049   cout << "   m_mcParticlesWrtEmcShowerP " 
00050        << m_mcParticlesWrtRecEmcShowerP.size() << endl;
00051   cout << "   m_emcRecShowersWrtMcParticle " 
00052        << m_emcRecShowersWrtMcParticleP.size() << endl;
00053 }
00054 
00055 
00056 //=====================================
00057 // MDC
00058 
00059 McParticleVector& EventNavigator::getMcParticles ( const RecMdcTrack* key )  
00060 {
00061   return m_mcParticlesWrtMdcTrack[key->trackId()];
00062 }
00063 
00064 McParticleVector& EventNavigator::getMcParticles ( const RecMdcKalTrack* key )  
00065 {
00066   return m_mcParticlesWrtMdcKalTrack[key->trackId()];
00067 }
00068 
00069 McParticleVector& EventNavigator::getMcParticles (const RecEmcShower* key ) 
00070 {
00071   return m_mcParticlesWrtRecShower[key->getShowerId().get_value()];
00072 }
00073 
00074 
00075 RecMdcTrackVector& EventNavigator::getMdcTracks  ( const McParticle* key ) 
00076 {
00077   return m_mdcTracksWrtMcParticle[key->trackIndex()];
00078 }
00079 
00080 RecMdcKalTrackVector& EventNavigator::getMdcKalTracks  ( const McParticle* key ) 
00081 {
00082   return m_mdcKalTracksWrtMcParticle[key->trackIndex()];
00083 }
00084 
00085 // Return number of hits contributed by the McParticle to given MdcTrack
00086 int EventNavigator::getMcParticleRelevance( const RecMdcTrack* key, const McParticle* value )
00087 {
00088    McParticleVectorP& vpair = m_mcParticlesWrtMdcTrackP[key->trackId()];                                
00089    McParticleVectorP::iterator it;                                                                      
00090   for (it=vpair.begin(); it!=vpair.end(); it++)
00091    {                                                                                                   
00092      if ( (*it).first == value )                                                                       
00093      {                                                                                               
00094        return (*it).second;
00095      }
00096    }                                                                                               
00097 }
00098 
00099 int EventNavigator::getMcParticleRelevance( const RecMdcKalTrack* key, const McParticle* value )     
00100 {
00101    McParticleVectorP& vpair = m_mcParticlesWrtMdcKalTrackP[key->trackId()];                                
00102    McParticleVectorP::iterator it;                                                                      
00103    for (it=vpair.begin(); it!=vpair.end(); it++)
00104    {                                                                                                   
00105      if ( (*it).first == value )                                                                       
00106      {                                                                                               
00107        return (*it).second;
00108      }
00109    }                                                                                               
00110 }   
00111 
00112 int EventNavigator::getMcParticleRelevance( const RecEmcShower* key, const McParticle* value )     
00113 {
00114    McParticleVectorP& vpair = m_mcParticlesWrtRecEmcShowerP[key->getShowerId().get_value()];                                
00115    McParticleVectorP::iterator it;                                                                      
00116    for (it=vpair.begin(); it!=vpair.end(); it++)
00117    {                                                                                                   
00118      if ( (*it).first == value )                                                                       
00119      {                                                                                               
00120        return (*it).second;
00121      }
00122    }                                                                                               
00123 }   
00124 
00125 RecEmcShowerVector& EventNavigator::getEmcRecShowers ( const McParticle* key ) 
00126 { 
00127   return m_emcRecShowersWrtMcParticle[key->trackIndex()];
00128 }
00129 
00130 // ==== Methods to store relations ====
00131 // store list of MdcTracks corresponding given McParticle
00132 void EventNavigator::addLink( const McParticle* key, const RecMdcTrack* value )
00133 {
00134   RecMdcTrackVectorP& vpair = m_mdcTracksWrtMcParticleP[key->trackIndex()];
00135   RecMdcTrackVectorP::iterator it;
00136   bool found = false;
00137   for (it=vpair.begin(); it!=vpair.end(); it++)
00138    {
00139      if ( (*it).first == value )
00140        {
00141          (*it).second++;
00142          found = true;
00143          break;
00144        }
00145    } 
00146 
00147    if( ! found )
00148      vpair.push_back( pair<const RecMdcTrack*,int>(value,1));
00149 
00150   RecMdcTrackVector& tmp = m_mdcTracksWrtMcParticle[key->trackIndex()];
00151   for (it=vpair.begin(); it!=vpair.end(); it++)
00152    {
00153      if((*it).second > m_mdcCut)
00154      {
00155        if (find(tmp.begin(),tmp.end(),(*it).first) == tmp.end() ) 
00156         {
00157            tmp.push_back((*it).first);
00158         }
00159      }
00160    }
00161 }
00162 
00163 // store list of MdcKalTracks corresponding given McParticle
00164 void EventNavigator::addLink( const McParticle* key, const RecMdcKalTrack* value )
00165 {
00166   RecMdcKalTrackVectorP& vpair = m_mdcKalTracksWrtMcParticleP[key->trackIndex()];
00167   RecMdcKalTrackVectorP::iterator it;
00168   bool found = false;
00169   for (it=vpair.begin(); it!=vpair.end(); it++)
00170    {
00171      if ( (*it).first == value )
00172        {
00173          (*it).second++;
00174          found = true;
00175          break;
00176        }
00177    } 
00178 
00179    if( ! found )
00180      vpair.push_back( pair<const RecMdcKalTrack*,int>(value,1));
00181 
00182   RecMdcKalTrackVector& tmp = m_mdcKalTracksWrtMcParticle[key->trackIndex()];
00183   for (it=vpair.begin(); it!=vpair.end(); it++)
00184    {
00185      if((*it).second > m_mdcCut)
00186      {
00187        if (find(tmp.begin(),tmp.end(),(*it).first) == tmp.end() ) 
00188         {
00189            tmp.push_back((*it).first);
00190         }
00191      }
00192    }
00193 }
00194 
00195 // store list of McParticles corresponding given MdcTrack
00196 void EventNavigator::addLink( const RecMdcTrack* key, const McParticle* value )
00197 {
00198   McParticleVectorP& vpair = m_mcParticlesWrtMdcTrackP[key->trackId()];
00199   McParticleVectorP::iterator it;
00200   bool found = false;
00201   for (it=vpair.begin(); it!=vpair.end(); it++)
00202    {
00203      if ( (*it).first == value )
00204        {
00205          (*it).second++;
00206          found = true;
00207          break;
00208        }
00209    } 
00210 
00211    if( ! found )
00212      vpair.push_back( pair<const McParticle*,int>(value,1));
00213 
00214   McParticleVector& tmp = m_mcParticlesWrtMdcTrack[key->trackId()];
00215   for (it=vpair.begin(); it!=vpair.end(); it++)
00216    {
00217      if((*it).second > m_mdcCut)
00218      {
00219        if (find(tmp.begin(),tmp.end(),(*it).first) == tmp.end() ) 
00220         {
00221            tmp.push_back((*it).first);
00222         }
00223      }
00224    }
00225 }
00226 
00227 
00228 // store list of McParticles corresponding given MdcKalTrack
00229 void EventNavigator::addLink( const RecMdcKalTrack* key, const McParticle* value )
00230 {
00231   McParticleVectorP& vpair = m_mcParticlesWrtMdcKalTrackP[key->trackId()];
00232   McParticleVectorP::iterator it;
00233   bool found = false;
00234   for (it=vpair.begin(); it!=vpair.end(); it++)
00235    {
00236      if ( (*it).first == value )
00237        {
00238          (*it).second++;
00239          found = true;
00240          break;
00241        }
00242    } 
00243 
00244    if( ! found )
00245      vpair.push_back( pair<const McParticle*,int>(value,1));
00246 
00247   McParticleVector& tmp = m_mcParticlesWrtMdcKalTrack[key->trackId()];
00248   for (it=vpair.begin(); it!=vpair.end(); it++)
00249    {
00250      if((*it).second > m_mdcCut)
00251      {
00252        if (find(tmp.begin(),tmp.end(),(*it).first) == tmp.end() ) 
00253         {
00254            tmp.push_back((*it).first);
00255         }
00256      }
00257    }
00258 }
00259 
00260 // store list of McParticles corresponding given EmcRecShower
00261 void EventNavigator::addLink( const RecEmcShower* key, const McParticle* value )
00262 {
00263 //  McParticleVector& tmp = m_mcParticlesWrtRecShower[((RecEmcShower*)key)->getShowerId().get_value()];
00264 //  if (find(tmp.begin(),tmp.end(),value) == tmp.end() ) 
00265 //    tmp.push_back(value);
00266 
00267   McParticleVectorP& vpair = m_mcParticlesWrtRecEmcShowerP[((RecEmcShower*)key)->getShowerId().get_value()];
00268   McParticleVectorP::iterator it;
00269   bool found = false;
00270   for (it=vpair.begin(); it!=vpair.end(); it++)
00271    {
00272      if ( (*it).first == value )
00273        {
00274          (*it).second++;
00275          found = true;
00276          break;
00277        }
00278    } 
00279 
00280    if( ! found )
00281      vpair.push_back( pair<const McParticle*,int>(value,1));
00282 
00283   McParticleVector& tmp = m_mcParticlesWrtRecShower[((RecEmcShower*)key)->getShowerId().get_value()];
00284   for (it=vpair.begin(); it!=vpair.end(); it++)
00285    {
00286        if (find(tmp.begin(),tmp.end(),(*it).first) == tmp.end() ) 
00287         {
00288            tmp.push_back((*it).first);
00289         }
00290    }
00291 }
00292 
00293 // store list of EmcRecShowers corresponding given McParticle
00294 void EventNavigator::addLink( const McParticle* key, const RecEmcShower* value )
00295 {
00296 //  RecEmcShowerVector& tmp = m_emcRecShowersWrtMcParticle[key->trackIndex()];
00297 //  if (find(tmp.begin(),tmp.end(),value) == tmp.end() ) 
00298 //    tmp.push_back(value);
00299   RecEmcShowerVectorP& vpair = m_emcRecShowersWrtMcParticleP[key->trackIndex()];
00300   RecEmcShowerVectorP::iterator it;
00301   bool found = false;
00302   for (it=vpair.begin(); it!=vpair.end(); it++)
00303    {
00304      if ( (*it).first == value )
00305        {
00306          (*it).second++;
00307          found = true;
00308          break;
00309        }
00310    } 
00311 
00312    if( ! found )
00313      vpair.push_back( pair<const RecEmcShower*,int>(value,1));
00314 
00315   RecEmcShowerVector& tmp = m_emcRecShowersWrtMcParticle[key->trackIndex()];
00316   for (it=vpair.begin(); it!=vpair.end(); it++)
00317    {
00318        if (find(tmp.begin(),tmp.end(),(*it).first) == tmp.end() ) 
00319         {
00320            tmp.push_back((*it).first);
00321         }
00322    }
00323 }
00324 

Generated on Tue Nov 29 22:58:28 2016 for BOSS_7.0.2 by  doxygen 1.4.7