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

Go to the documentation of this file.
00001 #ifndef EventNavigator_H
00002 #define EventNavigator_H 
00003 
00004 #include <map>
00005 
00006 #include "GaudiKernel/Kernel.h"
00007 #include "GaudiKernel/StreamBuffer.h"
00008 #include "GaudiKernel/DataObject.h"
00009 
00010 #include "EventModel/EventModel.h"
00011 
00012 // Monte-Carlo data
00013 #include "McTruth/McParticle.h"
00014 #include "McTruth/MdcMcHit.h"
00015 #include "McTruth/EmcMcHit.h"
00016 #include "McTruth/TofMcHit.h"
00017 #include "McTruth/MucMcHit.h"
00018 
00019 // MDC reconstructed data
00020 #include "MdcRecEvent/RecMdcTrack.h"
00021 #include "MdcRecEvent/RecMdcKalTrack.h"
00022 #include "MdcRecEvent/RecMdcHit.h"
00023 
00024 // EMC reconstructed data
00025 #include "EmcRecEventModel/RecEmcShower.h"
00026 
00027 // TOF reconstructed data
00028 class RecBTofTrack;
00029 class RecBTofHit;
00030 class RecETofTrack;
00031 class RecETofHit;
00032 
00033 // MUC reconstructed data
00034 class RecMucTrack;
00035 class RecMucHit;
00036 
00037 // Digi information
00038 class MdcDigi;
00039 
00040 class BesNavigatorInit;
00041 
00042 //using namespace Event;
00043 
00044 typedef std::multimap <int, int> IndexMap;
00045 typedef std::vector < pair<const Event::McParticle*,int> > McParticleVectorP;
00046 typedef std::vector < pair<const RecMdcTrack*,int> >    RecMdcTrackVectorP;
00047 typedef std::vector < pair<const RecMdcKalTrack*,int> > RecMdcKalTrackVectorP;
00048 typedef std::vector < pair<const RecEmcShower*,int> > RecEmcShowerVectorP;
00049 typedef std::vector <const Event::McParticle*>       McParticleVector;
00050 typedef std::vector <const RecMdcTrack*>      RecMdcTrackVector;
00051 typedef std::vector <const RecMdcKalTrack*>   RecMdcKalTrackVector;
00052 typedef std::vector <const Event::MdcMcHit*>  MdcMcHitVector;
00053 typedef std::vector <const RecMdcHit*>        RecMdcHitVector;
00054 typedef std::vector <const MdcDigi*>          MdcDigiVector;
00055 typedef std::vector <const Event::EmcMcHit*>  EmcMcHitVector;
00056 typedef std::vector <const RecEmcShower*>     RecEmcShowerVector;
00057 
00058 static const CLID CLID_EventNavigator = 5101;
00059 
00060 // Class EventNavigator
00061 
00062 // Provides relation tables to make correspondence between BES3 
00063 // reconstructed data and Monte-Carlo truth
00064 
00065 // History: A.Zhemchugov. Created with MDC navigation, 20 Jan 2006 
00066 //          A.Zhemchugov. EMC navigation  added,       23 Nov 2006
00067 //          A.Zhemchugov. Migrated to new EventModel,  03 Apr 2008
00068 //          A.Zhemchugov. Cut on number of common hits in MDC introduced, 13 Jun 2009
00069 //          A.Zhemchugov. Store Event Navigator to DST, 17 Aug 2011 
00070 //          A.Zhemchugov. Add methods to access McParticle relevance, 07 Aug 2012
00071 
00072 class EventNavigator : public DataObject                                                {
00073     
00074  public:
00075     
00076   EventNavigator() : DataObject() 
00077     {
00078         m_mdcCut = 7;
00079     }
00080     
00081   virtual ~EventNavigator() {}
00082     
00084   virtual const CLID& clID() const { return EventNavigator::classID(); }
00085   static const CLID& classID() { return CLID_EventNavigator; }
00086 
00087   void Print();
00088 
00089   // Set cut on the minimum number of common hits of 
00090   // the MDC tracks and McParticles to make correspondence (default is 2)
00091   void setMdcCut( int cut ) { m_mdcCut = cut; };
00092 
00093   //******** Methods to retrieve objPtr via id *******
00094   const Event::McParticle* getMcParticle ( int id ) { return m_mcParticleId[id]; };
00095   // MDC
00096   const RecMdcTrack*   getMdcTrack   ( int id ) { return m_mdcTrackId[id]; };
00097   const RecMdcKalTrack*   getMdcKalTrack   ( int id ) { return m_mdcKalTrackId[id]; };
00098 
00099   // return MdcMcHits corresponding given detector Id
00100   MdcMcHitVector    getMdcMcHits   ( int id );
00101 
00102   const RecMdcHit*  getMdcRecHit  ( int id ) { return m_mdcRecHitId[id]; };
00103   const MdcDigi*    getMdcDigi    ( int id ) { return m_mdcDigiId[id]; };
00104   // EMC
00105   RecEmcShowerVector getEmcRecShowers ( int id );
00106   EmcMcHitVector     getEmcMcHits     ( int id );
00107   
00108   //******** Methods to handle persistency ************
00109   IndexMap& getMcMdcMcHitsIdx(){return m_mcMdcMcHitsIdx;}
00110   IndexMap& getMcMdcTracksIdx(){return m_mcMdcTracksIdx;}
00111   IndexMap& getMcEmcMcHitsIdx(){return m_mcEmcMcHitsIdx;}
00112   IndexMap& getMcEmcRecShowersIdx(){return m_mcEmcRecShowersIdx;}
00113   void setMcMdcMcHitsIdx(IndexMap& map){m_mcMdcMcHitsIdx=map;}
00114   void setMcMdcTracksIdx(IndexMap& map){m_mcMdcTracksIdx=map;}
00115   void setMcEmcMcHitsIdx(IndexMap& map){m_mcEmcMcHitsIdx=map;}
00116   void setMcEmcRecShowersIdx(IndexMap& map){m_mcEmcRecShowersIdx=map;}
00117 
00118   //******** Main methods to retrieve relations *******
00119   // MC particle
00120   McParticleVector& getMcParticles  ( const RecMdcTrack* key ); 
00121   McParticleVector& getMcParticles  ( const RecMdcKalTrack* key ); 
00122   McParticleVector& getMcParticles  ( const RecEmcShower* key );
00123 
00124   int getMcParticleRelevance( const RecMdcTrack* key, const Event::McParticle* value );
00125   int getMcParticleRelevance( const RecMdcKalTrack* key, const Event::McParticle* value );
00126   int getMcParticleRelevance( const RecEmcShower* key, const Event::McParticle* value );
00127 
00128   // MDC Tracks
00129   RecMdcTrackVector&    getMdcTracks     ( const Event::McParticle* key );
00130   RecMdcKalTrackVector& getMdcKalTracks  ( const Event::McParticle* key );
00131 
00132   // Reconstructed EMC showers
00133   RecEmcShowerVector&   getEmcRecShowers ( const Event::McParticle* key );
00134 
00135   //******** Auxillary methods to retrieve relations **
00136   /*
00137   RecMdcHitVector&  getMdcRecHits   ( const McParticle* key );
00138   MdcMcHitVector&   getMdcMcHits    ( const RecMdcTrack* key );
00139   RecMdcHitVector&  getMdcRecHits   ( const MdcMcHit* key );
00140   MdcMcHitVector&   getMdcMcHits    ( const RecMdcHit* key );
00141   
00142   EmcMcHitVector& getEmcMcHits     ( const RecEmcShower* key ); 
00143   */
00144 
00145 
00146   friend class BesNavigatorInit;
00147 
00148  protected:
00149   
00150   // ==== Methods to store id->objPtr lookup maps ====
00151   void addIdLink ( int id, Event::McParticle* ptr ) { m_mcParticleId[id] = ptr; };
00152   
00153   // MDC info
00154   void addIdLink ( int id, RecMdcTrack* ptr ) { 
00155     m_mdcTrackId[id] = ptr; 
00156   };
00157   
00158   void addIdLink ( int id, RecMdcKalTrack* ptr ) { 
00159     m_mdcKalTrackId[id] = ptr; 
00160   };
00161 
00162   void addIdLink ( unsigned int id, RecEmcShower* ptr ) { 
00163     m_emcRecShowerId.insert(pair<int, RecEmcShower*>(id,ptr)); 
00164   };
00165   
00166   // ==== Methods to store relations ====
00167   // store list of MdcTracks corresponding given McParticle
00168   void addLink( const Event::McParticle* key, const RecMdcTrack* value );
00169   
00170   // store list of McParticles corresponding given MdcTrack
00171   void addLink( const RecMdcTrack* key, const Event::McParticle* value );
00172   
00173   // store list of MdcKalTracks corresponding given McParticle
00174   void addLink( const Event::McParticle* key, const RecMdcKalTrack* value );
00175   
00176   // store list of McParticles corresponding given MdcKalTrack
00177   void addLink( const RecMdcKalTrack* key, const Event::McParticle* value );
00178 
00179   // store list of McParticles corresponding given EmcRecShower
00180   void addLink( const RecEmcShower* key, const Event::McParticle* value );
00181   
00182   // store list of EmcShowers corresponding given McParticle
00183   void addLink( const Event::McParticle* key, const RecEmcShower* value );
00184   
00185  private:
00186   // === lookup maps of id->objPtr relations ===
00187   std::map <int, const Event::McParticle*> m_mcParticleId;
00188 
00189   // MDC info
00190   std::map <int, const RecMdcTrack*>  m_mdcTrackId;
00191   std::map <int, const RecMdcKalTrack*>  m_mdcKalTrackId;
00192   std::map <int, const MdcDigi*>   m_mdcDigiId;
00193   std::multimap <unsigned int, const Event::MdcMcHit*>  m_mdcMcHitId;
00194   std::map <unsigned int, const RecMdcHit*> m_mdcRecHitId;
00195 
00196   // ===== relations =====
00197   // relation tables to be returned by query
00198   std::map <int, RecMdcTrackVector>  m_mdcTracksWrtMcParticle;
00199   std::map <int, McParticleVector>   m_mcParticlesWrtMdcTrack;
00200   std::map <int, RecMdcKalTrackVector>  m_mdcKalTracksWrtMcParticle;
00201   std::map <int, McParticleVector>   m_mcParticlesWrtMdcKalTrack;
00202 
00203   // internal version of relation tables to keep number of the same hits for each pair McParticle-MdcTrack
00204   std::map <int, RecMdcTrackVectorP>    m_mdcTracksWrtMcParticleP;
00205   std::map <int, McParticleVectorP>     m_mcParticlesWrtMdcTrackP;
00206   std::map <int, RecMdcKalTrackVectorP> m_mdcKalTracksWrtMcParticleP;
00207   std::map <int, McParticleVectorP>     m_mcParticlesWrtMdcKalTrackP;
00208  
00209   // EMC info
00210   std::multimap <unsigned int, const RecEmcShower*>  m_emcRecShowerId;
00211   std::multimap <unsigned int, const Event::EmcMcHit*>      m_emcMcHitId;
00212 
00213   // ===== relations =====
00214   std::map <int, McParticleVector>      m_mcParticlesWrtRecShower;
00215   std::map <int, RecEmcShowerVector>    m_emcRecShowersWrtMcHit;
00216   std::map <int, RecEmcShowerVector>    m_emcRecShowersWrtMcParticle;
00217   std::map <int, EmcMcHitVector>        m_emcMcHitsWrtRecShower;
00218   // internal version of relation tables to keep number of the same hits for each pair McParticle-EmcRecShower
00219   std::map <int, RecEmcShowerVectorP>   m_emcRecShowersWrtMcParticleP;
00220   std::map <int, McParticleVectorP>     m_mcParticlesWrtRecEmcShowerP;
00221 
00222   // persistency
00223   IndexMap m_mcMdcTracksIdx; // id is the same for RecMdcTrack and RecMdcKalTrack
00224   IndexMap m_mcMdcMcHitsIdx;
00225   IndexMap m_mcEmcRecShowersIdx;
00226   IndexMap m_mcEmcMcHitsIdx;
00227 
00228   int m_mdcCut;
00229 };
00230 
00231 #endif    // EventNavigator_H
00232 

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