Fork me on GitHub

source: svn/trunk/Utilities/HepMC/interface/TempParticleMap.h@ 477

Last change on this file since 477 was 349, checked in by severine ovyn, 16 years ago

first test

File size: 2.0 KB
Line 
1//--------------------------------------------------------------------------
2#ifndef HEPMC_TempParticleMap_H
3#define HEPMC_TempParticleMap_H
4
5//////////////////////////////////////////////////////////////////////////
6// garren@fnal.gov, October 2007
7//
8// Used by IO classes
9//////////////////////////////////////////////////////////////////////////
10
11#include <map>
12
13namespace HepMC {
14
15 class GenParticle;
16
17 //! TempParticleMap is a temporary GenParticle* container used during input.
18
19 ///
20 /// \class TempParticleMap
21 /// Used by IO classes for recoverable particle ordering.
22 /// Map GenParticle* against both outgoing vertex and particle order.
23 ///
24 class TempParticleMap {
25 public:
26 typedef std::map<HepMC::GenParticle*,int> TempMap;
27 typedef std::map<int,HepMC::GenParticle*> TempOrderMap;
28 typedef TempMap::iterator TempMapIterator;
29 typedef TempOrderMap::iterator orderIterator;
30
31 TempParticleMap()
32 : m_particle_to_end_vertex(), m_particle_order() {}
33
34 ~TempParticleMap() {}
35
36 TempMapIterator begin() { return m_particle_to_end_vertex.begin(); }
37 TempMapIterator end() { return m_particle_to_end_vertex.end(); }
38 orderIterator order_begin() { return m_particle_order.begin(); }
39 orderIterator order_end() { return m_particle_order.end(); }
40
41 int end_vertex( GenParticle* );
42
43 void addEndParticle( GenParticle*, int& );
44
45 private:
46 TempMap m_particle_to_end_vertex;
47 TempOrderMap m_particle_order;
48 };
49
50 inline int TempParticleMap::end_vertex( GenParticle* p )
51 {
52 //return m_particle_to_end_vertex[p]->second;
53 TempMapIterator it = m_particle_to_end_vertex.find(p);
54 if( it == end() ) return 0;
55 return m_particle_to_end_vertex[p];
56 }
57
58 inline void TempParticleMap::addEndParticle( GenParticle* p, int& end_vtx_code )
59 {
60 m_particle_order[p->barcode()] = p;
61 m_particle_to_end_vertex[p] = end_vtx_code;
62 }
63
64} // HepMC
65
66#endif // HEPMC_TempParticleMap_H
67//--------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.