Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:10

0001 //--------------------------------------------------------------------------
0002 #ifndef HEPMC_TempParticleMap_H
0003 #define HEPMC_TempParticleMap_H
0004 
0005 //////////////////////////////////////////////////////////////////////////
0006 // garren@fnal.gov, October 2007
0007 //
0008 // Used by IO classes
0009 //////////////////////////////////////////////////////////////////////////
0010 
0011 #include <map>
0012 
0013 namespace HepMC {
0014 
0015     class GenParticle;
0016 
0017     //! TempParticleMap is a temporary GenParticle* container used during input.
0018 
0019     ///
0020     /// \class  TempParticleMap
0021     /// Used by IO classes for recoverable particle ordering.
0022     /// Map GenParticle* against both outgoing vertex and particle order.
0023     ///
0024     class TempParticleMap {
0025     public:
0026         typedef std::map<HepMC::GenParticle*,int> TempMap;
0027         typedef std::map<int,HepMC::GenParticle*> TempOrderMap;
0028     typedef TempMap::iterator     TempMapIterator;
0029     typedef TempOrderMap::iterator  orderIterator;
0030     
0031     TempParticleMap() 
0032     : m_particle_to_end_vertex(), m_particle_order() {}
0033     
0034     ~TempParticleMap() {}
0035     
0036     TempMapIterator begin() { return m_particle_to_end_vertex.begin(); }
0037     TempMapIterator end() { return m_particle_to_end_vertex.end(); }
0038     orderIterator order_begin() { return m_particle_order.begin(); }
0039     orderIterator order_end() { return m_particle_order.end(); }
0040     
0041     int end_vertex( GenParticle* );
0042     
0043     void addEndParticle( GenParticle*, int& );
0044     
0045     private:
0046         TempMap       m_particle_to_end_vertex;
0047     TempOrderMap  m_particle_order;
0048     };
0049     
0050     inline int TempParticleMap::end_vertex( GenParticle* p )
0051     { 
0052         //return m_particle_to_end_vertex[p]->second; 
0053     TempMapIterator it = m_particle_to_end_vertex.find(p);
0054     if( it == end() ) return 0;
0055     return m_particle_to_end_vertex[p];
0056     }
0057 
0058     inline void TempParticleMap::addEndParticle( GenParticle* p, int& end_vtx_code )
0059     {
0060     m_particle_order[p->barcode()] = p;
0061         m_particle_to_end_vertex[p] = end_vtx_code;
0062     }        
0063 
0064 } // HepMC
0065 
0066 #endif  // HEPMC_TempParticleMap_H
0067 //--------------------------------------------------------------------------