hepmc - Diff between revs 31 and 65
Subversion Repositories:
| Rev 31 | Rev 65 | |||
|---|---|---|---|---|
| Line 53... | Line 53... | |||
| 53 | 53 | |||
| 54 | namespace HepMC { | 54 | namespace HepMC { | |
| 55 | 55 | |||
| 56 | class GenParticle; | 56 | class GenParticle; | |
| 57 | 57 | |||
| - | 58 | //! The flow object | ||
| - | 59 | |||
| - | 60 | /// | ||
| - | 61 | /// \class Flow | ||
| - | 62 | /// The particle's flow object | ||
| - | 63 | /// keeps track of an arbitrary number of flow patterns within a graph | ||
| - | 64 | /// (i.e. color flow, charge flow, lepton number flow, ...) | ||
| - | 65 | /// Flow patterns are coded with an integer, in the same manner as in Herwig. | ||
| 58 | class Flow { | 66 | class Flow { | |
| 59 | 67 | |||
| - | 68 | /// for printing | ||
| 60 | friend std::ostream& operator<<( std::ostream& ostr, const Flow& f ); | 69 | friend std::ostream& operator<<( std::ostream& ostr, const Flow& f ); | |
| 61 | 70 | |||
| 62 | public: | 71 | public: | |
| - | 72 | /// default constructor | ||
| 63 | Flow( GenParticle* particle_owner = 0 ); | 73 | Flow( GenParticle* particle_owner = 0 ); | |
| - | 74 | /// copy | ||
| 64 | Flow( const Flow& ); | 75 | Flow( const Flow& ); | |
| 65 | virtual ~Flow(); | 76 | virtual ~Flow(); | |
| - | 77 | /// make a copy | ||
| 66 | Flow& operator=( const Flow& ); | 78 | Flow& operator=( const Flow& ); | |
| - | 79 | /// equality | ||
| 67 | bool operator==( const Flow& a ) const; //compares only flow | 80 | bool operator==( const Flow& a ) const; //compares only flow | |
| - | 81 | /// inequality | ||
| 68 | bool operator!=( const Flow& a ) const; //patterns not owner | 82 | bool operator!=( const Flow& a ) const; //patterns not owner | |
| 69 | 83 | |||
| - | 84 | /// print Flow information to ostr | ||
| 70 | void print( std::ostream& ostr = std::cout ) const; | 85 | void print( std::ostream& ostr = std::cout ) const; | |
| 71 | 86 | |||
| 72 | // returns all connected particles which have "code" in any of the | - | ||
| 73 | // num_indices beginning with index code_index. | - | ||
| - | 87 | /// returns all connected particles which have "code" in any of the | ||
| - | 88 | /// num_indices beginning with index code_index. | ||
| 74 | std::set<GenParticle*> connected_partners( int code, int code_index =1, | 89 | std::set<GenParticle*> connected_partners( int code, int code_index =1, | |
| 75 | int num_indices = 2 ) const; | 90 | int num_indices = 2 ) const; | |
| 76 | // same as connected_partners, but returns only those particles which | - | ||
| 77 | // are connected to <=1 other particles (i.e. the flow line "dangles" | - | ||
| 78 | // at these particles) | - | ||
| - | 91 | /// same as connected_partners, but returns only those particles which | ||
| - | 92 | /// are connected to <=1 other particles (i.e. the flow line "dangles" | ||
| - | 93 | /// at these particles) | ||
| 79 | std::set<GenParticle*> dangling_connected_partners( int code, | 94 | std::set<GenParticle*> dangling_connected_partners( int code, | |
| 80 | int code_index = 1, int num_indices = 2 ) const; | 95 | int code_index = 1, int num_indices = 2 ) const; | |
| 81 | 96 | |||
| 82 | //////////////////// | 97 | //////////////////// | |
| 83 | // access methods // | 98 | // access methods // | |
| 84 | //////////////////// | 99 | //////////////////// | |
| - | 100 | |||
| - | 101 | /// find particle owning this Flow | ||
| 85 | const GenParticle* particle_owner() const; | 102 | const GenParticle* particle_owner() const; | |
| - | 103 | /// flow code | ||
| 86 | int icode( int code_index = 1 ) const; | 104 | int icode( int code_index = 1 ) const; | |
| - | 105 | /// set flow code | ||
| 87 | Flow set_icode( int code_index, int code ); | 106 | Flow set_icode( int code_index, int code ); | |
| - | 107 | /// set unique flow code | ||
| 88 | Flow set_unique_icode( int code_index = 1 ); | 108 | Flow set_unique_icode( int code_index = 1 ); | |
| 89 | 109 | |||
| 90 | ////////////////////// | 110 | ////////////////////// | |
| 91 | // container access // | 111 | // container access // | |
| 92 | ////////////////////// | 112 | ////////////////////// | |
| 93 | 113 | |||
| - | 114 | /// return true if there is no flow container | ||
| 94 | bool empty() const; | 115 | bool empty() const; | |
| - | 116 | /// size of flow pattern container | ||
| 95 | int size() const; | 117 | int size() const; | |
| - | 118 | /// clear flow patterns | ||
| 96 | void clear(); | 119 | void clear(); | |
| - | 120 | /// empty flow pattern container | ||
| 97 | bool erase( int code_index ); | 121 | bool erase( int code_index ); | |
| 98 | 122 | |||
| - | 123 | /// iterator for flow pattern container | ||
| 99 | typedef std::map<int,int>::iterator iterator; | 124 | typedef std::map<int,int>::iterator iterator; | |
| - | 125 | /// const iterator for flow pattern container | ||
| 100 | typedef std::map<int,int>::const_iterator const_iterator; | 126 | typedef std::map<int,int>::const_iterator const_iterator; | |
| - | 127 | /// beginning of flow pattern container | ||
| 101 | iterator begin(); | 128 | iterator begin(); | |
| - | 129 | /// end of flow pattern container | ||
| 102 | iterator end(); | 130 | iterator end(); | |
| - | 131 | /// beginning of flow pattern container | ||
| 103 | const_iterator begin() const; | 132 | const_iterator begin() const; | |
| - | 133 | /// end of flow pattern container | ||
| 104 | const_iterator end() const; | 134 | const_iterator end() const; | |
| 105 | 135 | |||
| 106 | protected: // intended for internal use only | 136 | protected: // intended for internal use only | |
| 107 | void connected_partners( std::set<GenParticle*>* output, | 137 | void connected_partners( std::set<GenParticle*>* output, | |
| 108 | int code, | 138 | int code, | |
| Line 133... | Line 163... | |||
| 133 | inline Flow Flow::set_icode( int code_index, int code ) { | 163 | inline Flow Flow::set_icode( int code_index, int code ) { | |
| 134 | m_icode[code_index] = code; | 164 | m_icode[code_index] = code; | |
| 135 | return *this; | 165 | return *this; | |
| 136 | } | 166 | } | |
| 137 | inline Flow Flow::set_unique_icode( int flow_num ) { | 167 | inline Flow Flow::set_unique_icode( int flow_num ) { | |
| 138 | // use this method if you want to assign a unique flow code, but | - | ||
| 139 | // do not want the burden of choosing it yourself | - | ||
| - | 168 | /// use this method if you want to assign a unique flow code, but | ||
| - | 169 | /// do not want the burden of choosing it yourself | ||
| 140 | m_icode[flow_num] = size_t(this); | 170 | m_icode[flow_num] = size_t(this); | |
| 141 | return *this; | 171 | return *this; | |
| 142 | } | 172 | } | |
| 143 | inline bool Flow::empty() const { return (bool)m_icode.empty(); } | 173 | inline bool Flow::empty() const { return (bool)m_icode.empty(); } | |
| 144 | inline int Flow::size() const { return (int)m_icode.size(); } | 174 | inline int Flow::size() const { return (int)m_icode.size(); } | |
