hepmc  Blame information for rev 103
Rev  Author  Line No.  Line 

2  garren  1 

2  #ifndef HEPMC_GEN_EVENT_H 

3  #define HEPMC_GEN_EVENT_H 

4  
5  ////////////////////////////////////////////////////////////////////////// 

6  // Matt.Dobbs@Cern.CH, September 1999, refer to: 

7  // M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for 

8  // High Energy Physics", Computer Physics Communications (to be published). 

9  // 

10  // Event record for MC generators (for use at any stage of generation) 

11  ////////////////////////////////////////////////////////////////////////// 

12  // 

13  // This class is intended as both a "container class" ( to store a MC 

14  // event for interface between MC generators and detector simulation ) 

15  // and also as a "work in progress class" ( that could be used inside 

16  // a generator and modified as the event is built ). 

17  // 

18  // Iterators are provided which allow the user to easily obtain a 

19  // list of particles or vertices in an event  this list can be filled 

20  // subject to some sort of selection criteria. Examples are given below 

21  // ( see HepMC::copy_if and std::copy ) 

22  
65  garren  23  /// 
24  /// \namespace HepMC 

25  /// All classes in the HepMC packages are in the HepMC namespace 

26  /// 

2  garren  27  namespace HepMC { 
65  garren  28  
2  garren  29  // To create a list from an iterator, use: (i.e. for a list of particles); 
30  // #include <algorithm> 

31  // list<GenParticle*> thelist; 

32  // copy( evt>particles_begin(), evt>particles_end(), 

33  // back_inserter(thelist) ); 

34  // to create a list subject to a condition (predicate) use: 

35  // list<GenParticle*> thelist; 

36  // HepMC::copy_if( evt>particles_begin(), evt>particles_end(), 

37  // back_inserter(thelist), is_photon() ); 

38  // where is_photon() is a predicate like: 

39  // class is_photon { 

40  // public: 

41  // bool operator() ( const GenParticle* p ) { 

42  // if ( p && p>pdg_id() == 22 ) return 1; 

43  // return 0; 

44  // } 

45  // }; 

46  // which the user defines herself. 

65  garren  47  
48  /// define the type of iterator to use 

2  garren  49  template <class InputIterator, class OutputIterator, class Predicate> 
50  void copy_if( InputIterator first, InputIterator last, OutputIterator out, 

51  Predicate pred ) { 

52  for ( ; first != last; ++first ) { if ( pred(*first) ) out = *first; } 

53  } 

54  } // HepMC 

55  
56  // Since a container of all vertices in the event is maintained, the time 

57  // required to loop over all vertices (or particles) is very fast  and 

58  // the user does not gain much by first making his own list. 

59  // (this is not true for the GenVertex:: versions of these iterators, which 

60  // allow you to specify the vertex starting point and range) 

61  
62  // Data Members: 

63  // signal_process_id() The integer ID that uniquely specifies this signal 

64  // process, i.e. MSUB in Pythia. It is necessary to 

65  // package this with each event rather than with the run 

66  // because many processes may be generated within one 

67  // run. 

68  // event_number() Strictly speaking we cannot think of any reason that 

69  // an event would need to know its own event number, it 

70  // is more likely something that would be assigned by 

71  // a database. It is included anyway (tradition?) since 

72  // we expect it may be useful for debugging. It can 

73  // be reset later by a database. 

103  garren  74  // mpi() The number of multi parton interactions in the event. 
75  // This is NOT beam pileup. Set to 1 by default. 

2  garren  76  // signal_process_vertex() pointer to the vertex containing the signal process 
77  // weights() Vector of doubles which specify th weight of the evnt, 

78  // the first entry will be the "event weight" used for 

79  // hit and miss etc., but a general vector is used to 

80  // allow for reweighting etc. We envision a list of 

81  // WeightTags to be included with a run class which 

82  // would specify the meaning of the Weights . 

83  // random_states() Vector of integers which specify the random number 

84  // generator's state for this event. It is left to the 

85  // generator to make use of this. We envision a vector of 

86  // RndmStatesTags to be included with a run class which 

87  // would specify the meaning of the random_states. 

88  // 

89  /////////////////////// 

90  // Memory allocation // 

91  /////////////////////// 

92  // When a vertex (particle) is added to a event (vertex), it is "adopted" 

93  // and becomes the responsibility of the event (vertex) to delete that 

94  // particle. 

95  // objects responsible for deleting memory: 

96  // events delete included vertices 

97  // each vertex deletes its outgoing particles which do not have decay 

98  // vertices 

99  // each vertex deletes its incoming particles which do not 

100  // have creation vertices 

101  // 

102  //////////////////////// 

103  // About the Barcodes // 

104  //////////////////////// 

105  //  each vertex or particle has a barcode, which is just an integer which 

106  // uniquely identifies it inside the event (i.e. there is a one to one 

107  // mapping between particle memory addresses and particle barcodes... and 

108  // the same applied for vertices) 

109  //  The value of a barcode has NO MEANING and NO ORDER! 

110  // For the user's convenience, when an event is read in via an IO_method 

111  // from an indexed list (like the HEPEVT common block), then the index will 

112  // become the barcode for that particle. 

113  //  particle barcodes are always positive integers 

114  // vertex barcodes are always negative integers 

115  // The barcodes are chosen and set automatically when a vertex or particle 

116  // comes under the ownership of an event (i.e. it is contained in an event). 

117  //  You can tell when a particle or vertex is owned, because its 

118  // parent_event() return value will return a pointer to the event which owns 

119  // it (or null if its an orphan). 

120  // 

121  
122  #include "HepMC/GenVertex.h" 

123  #include "HepMC/GenParticle.h" 

124  #include "HepMC/WeightContainer.h" 

14  garren  125  #include "HepMC/HeavyIon.h" 
36  garren  126  #include "HepMC/PdfInfo.h" 
2  garren  127  #include <map> 
128  #include <vector> 

129  #include <algorithm> 

130  #include <iostream> 

131  
132  namespace HepMC { 

133  
65  garren  134  //! The GenEvent class is the core of HepMC 
135  
136  /// 

137  /// \class GenEvent 

138  /// HepMC::GenEvent contains information about generated particles. 

139  /// GenEvent is structured as a set of vertices which contain the particles. 

140  /// 

2  garren  141  class GenEvent { 
142  friend class GenParticle; 

143  friend class GenVertex; 

144  public: 

92  garren  145  /// default constructor creates null pointers to HeavyIon and PdfInfo 
2  garren  146  GenEvent( int signal_process_id = 0, int event_number = 0, 
147  GenVertex* signal_vertex = 0, 

148  const WeightContainer& weights = std::vector<double>(), 

92  garren  149  const std::vector<long int>& randomstates = std::vector<long int>() ); 
150  /// explicit constructor that takes HeavyIon and PdfInfo 

151  GenEvent( int signal_process_id, int event_number, 

152  GenVertex* signal_vertex, const WeightContainer& weights, 

153  const std::vector<long int>& randomstates, 

154  const HeavyIon& ion, const PdfInfo& pdf ); 

65  garren  155  GenEvent( const GenEvent& inevent ); //!< deep copy 
156  GenEvent& operator=( const GenEvent& inevent ); //!< make a deep copy 

157  virtual ~GenEvent(); //!<deletes all vertices/particles in this evt 

2  garren  158  
65  garren  159  void print( std::ostream& ostr = std::cout ) const; //!< dumps to ostr 
2  garren  160  
65  garren  161  /// assign a barcode to a particle 
2  garren  162  GenParticle* barcode_to_particle( int barCode ) const; 
65  garren  163  /// assign a barcode to a vertex 
2  garren  164  GenVertex* barcode_to_vertex( int barCode ) const; 
165  
166  //////////////////// 

167  // access methods // 

168  //////////////////// 

169  
65  garren  170  int signal_process_id() const; //!< unique signal process id 
171  int event_number() const; //!< event number 

103  garren  172  int mpi() const; //!< number of multi parton interactions 
65  garren  173  double event_scale() const; //!< energy scale, see hepph/0109068 
174  double alphaQCD() const; //!< QCD coupling, see hepph/0109068 

175  double alphaQED() const; //!< QED coupling, see hepph/0109068 

176  /// pointer to the vertex containing the signal process 

2  garren  177  GenVertex* signal_process_vertex() const; 
178  
65  garren  179  /// direct access to the weights container is allowed. 
180  /// Thus you can use myevt.weights()[2]; 

181  /// to access element 2 of the weights. 

182  /// or use myevt.weights().push_back( mywgt ); to add an element. 

183  /// and you can set the weights with myevt.weights() = myvector; 

184  WeightContainer& weights(); //!< direct access to WeightContainer 

185  const WeightContainer& weights() const; //!< direct access to WeightContainer 

2  garren  186  
65  garren  187  /// access the HeavyIon container if it exists 
92  garren  188  HeavyIon* const heavy_ion() const; 
189  HeavyIon* heavy_ion(); 

65  garren  190  /// access the PdfInfo container if it exists 
92  garren  191  PdfInfo* const pdf_info() const; 
192  PdfInfo* pdf_info(); 

14  garren  193  
65  garren  194  /// vector of integers containing information about the random state 
2  garren  195  std::vector<long int> random_states() const; 
196  
65  garren  197  void set_signal_process_id( int id ); //!< set unique signal process id 
198  void set_event_number( int eventno ); //!< set event number 

103  garren  199  void set_mpi( int ); //!< set number of multi parton interactions 
65  garren  200  void set_event_scale( double scale ); //!< set energy scale 
201  void set_alphaQCD( double a ); //!< set QCD coupling 

202  void set_alphaQED( double a ); //!< set QED coupling 

203  
204  /// set pointer to the vertex containing the signal process 

2  garren  205  void set_signal_process_vertex( GenVertex* ); 
65  garren  206  /// provide random state information 
2  garren  207  void set_random_states( const std::vector<long int>& randomstates ); 
208  
65  garren  209  /// provide a pointer to the HeavyIon container 
92  garren  210  void set_heavy_ion( const HeavyIon& ion ); 
65  garren  211  /// provide a pointer to the PdfInfo container 
92  garren  212  void set_pdf_info( const PdfInfo& p ); 
14  garren  213  
65  garren  214  /// how many particle barcodes exist? 
2  garren  215  int particles_size() const; 
65  garren  216  /// return true if there are no particle barcodes 
2  garren  217  bool particles_empty() const; 
65  garren  218  /// how many vertex barcodes exist? 
2  garren  219  int vertices_size() const; 
65  garren  220  /// return true if there are no vertex barcodes 
2  garren  221  bool vertices_empty() const; 
222  
96  garren  223  //////////////////// 
224  // change methods // 

225  //////////////////// 

226  
65  garren  227  bool add_vertex( GenVertex* vtx ); //!< adds to evt and adopts 
96  garren  228  bool remove_vertex( GenVertex* vtx ); //!< erases vtx from evt 
229  void clear(); //!< empties the entire event 

2  garren  230  
231  public: 

232  /////////////////////////////// 

233  // vertex_iterators // 

234  /////////////////////////////// 

235  // Note: the XXX_iterator is "resolvable" as XXX_const_iterator, but 

236  // not the reverse, which is consistent with STL, 

237  // see Musser, Derge, Saini 2ndEd. p. 69,70. 

65  garren  238  
239  //! const vertex iterator 

240  
241  /// \class vertex_const_iterator 

242  /// HepMC::GenEvent::vertex_const_iterator 

243  /// is used to iterate over all vertices in the event. 

2  garren  244  class vertex_const_iterator : 
245  public std::iterator<std::forward_iterator_tag,GenVertex*,ptrdiff_t>{ 

246  // Iterates over all vertices in this event 

247  public: 

65  garren  248  /// constructor requiring vertex information 
2  garren  249  vertex_const_iterator( 
250  const 

251  std::map<int,GenVertex*,std::greater<int> >::const_iterator& i) 

252  : m_map_iterator(i) {} 

253  vertex_const_iterator() {} 

65  garren  254  /// copy constructor 
2  garren  255  vertex_const_iterator( const vertex_const_iterator& i ) 
256  { *this = i; } 

257  virtual ~vertex_const_iterator() {} 

65  garren  258  /// make a copy 
2  garren  259  vertex_const_iterator& operator=( const vertex_const_iterator& i ) 
260  { m_map_iterator = i.m_map_iterator; return *this; } 

65  garren  261  /// return a pointer to a GenVertex 
2  garren  262  GenVertex* operator*(void) const { return m_map_iterator>second; } 
65  garren  263  /// Prefix increment 
2  garren  264  vertex_const_iterator& operator++(void) //Prefix increment 
265  { ++m_map_iterator; return *this; } 

65  garren  266  /// Postfix increment 
2  garren  267  vertex_const_iterator operator++(int) //Postfix increment 
268  { vertex_const_iterator out(*this); ++(*this); return out; } 

65  garren  269  /// equality 
2  garren  270  bool operator==( const vertex_const_iterator& a ) const 
271  { return m_map_iterator == a.m_map_iterator; } 

65  garren  272  /// inequality 
2  garren  273  bool operator!=( const vertex_const_iterator& a ) const 
274  { return !(m_map_iterator == a.m_map_iterator); } 

275  protected: 

65  garren  276  /// const iterator to a vertex map 
2  garren  277  std::map<int,GenVertex*,std::greater<int> >::const_iterator 
278  m_map_iterator; 

279  }; 

280  friend class vertex_const_iterator; 

65  garren  281  /// begin vertex iteration 
2  garren  282  vertex_const_iterator vertices_begin() const 
283  { return GenEvent::vertex_const_iterator( 

284  m_vertex_barcodes.begin() ); } 

65  garren  285  /// end vertex iteration 
2  garren  286  vertex_const_iterator vertices_end() const 
287  { return GenEvent::vertex_const_iterator( 

288  m_vertex_barcodes.end() ); } 

289  
65  garren  290  
291  //! nonconst vertex iterator 

292  
293  /// \class vertex_iterator 

294  /// HepMC::GenEvent::vertex_iterator 

295  /// is used to iterate over all vertices in the event. 

2  garren  296  class vertex_iterator : 
297  public std::iterator<std::forward_iterator_tag,GenVertex*,ptrdiff_t>{ 

298  // Iterates over all vertices in this event 

299  public: 

65  garren  300  /// constructor requiring vertex information 
2  garren  301  vertex_iterator( 
302  const 

303  std::map<int,GenVertex*,std::greater<int> >::iterator& i ) 

304  : m_map_iterator( i ) {} 

305  vertex_iterator() {} 

65  garren  306  /// copy constructor 
2  garren  307  vertex_iterator( const vertex_iterator& i ) { *this = i; } 
308  virtual ~vertex_iterator() {} 

65  garren  309  /// make a copy 
2  garren  310  vertex_iterator& operator=( const vertex_iterator& i ) { 
311  m_map_iterator = i.m_map_iterator; 

312  return *this; 

313  } 

65  garren  314  /// const vertex iterator 
2  garren  315  operator vertex_const_iterator() const 
316  { return vertex_const_iterator(m_map_iterator); } 

65  garren  317  /// return a pointer to a GenVertex 
2  garren  318  GenVertex* operator*(void) const 
319  { return m_map_iterator>second; } 

65  garren  320  /// Prefix increment 
2  garren  321  vertex_iterator& operator++(void) //Prefix increment 
322  { ++m_map_iterator; return *this; } 

65  garren  323  /// Postfix increment 
2  garren  324  vertex_iterator operator++(int) //Postfix increment 
325  { vertex_iterator out(*this); ++(*this); return out; } 

65  garren  326  /// equality 
2  garren  327  bool operator==( const vertex_iterator& a ) const 
328  { return m_map_iterator == a.m_map_iterator; } 

65  garren  329  /// inequality 
2  garren  330  bool operator!=( const vertex_iterator& a ) const 
331  { return !(m_map_iterator == a.m_map_iterator); } 

332  protected: 

65  garren  333  /// iterator to the vertex map 
2  garren  334  std::map<int,GenVertex*,std::greater<int> >::iterator 
335  m_map_iterator; 

336  }; 

337  friend class vertex_iterator; 

65  garren  338  /// begin vertex iteration 
2  garren  339  vertex_iterator vertices_begin() 
340  { return GenEvent::vertex_iterator( 

341  m_vertex_barcodes.begin() ); } 

65  garren  342  /// end vertex iteration 
2  garren  343  vertex_iterator vertices_end() 
344  { return GenEvent::vertex_iterator( 

345  m_vertex_barcodes.end() ); } 

346  
347  public: 

348  /////////////////////////////// 

349  // particle_iterator // 

350  /////////////////////////////// 

351  // Example of iterating over all particles in the event: 

352  // for ( GenEvent::particle_const_iterator p = particles_begin(); 

353  // p != particles_end(); ++p ) { 

354  // (*p)>print(); 

355  // } 

356  // 

65  garren  357  
358  //! const particle iterator 

359  
360  /// \class particle_const_iterator 

361  /// HepMC::GenEvent::particle_const_iterator 

362  /// is used to iterate over all particles in the event. 

2  garren  363  class particle_const_iterator : 
364  public std::iterator<std::forward_iterator_tag,GenParticle*,ptrdiff_t>{ 

365  // Iterates over all vertices in this event 

366  public: 

65  garren  367  /// iterate over particles 
2  garren  368  particle_const_iterator( 
369  const std::map<int,GenParticle*>::const_iterator& i ) 

370  : m_map_iterator(i) {} 

371  particle_const_iterator() {} 

65  garren  372  /// copy constructor 
2  garren  373  particle_const_iterator( const particle_const_iterator& i ) 
374  { *this = i; } 

375  virtual ~particle_const_iterator() {} 

65  garren  376  /// make a copy 
2  garren  377  particle_const_iterator& operator=( 
378  const particle_const_iterator& i ) 

379  { m_map_iterator = i.m_map_iterator; return *this; } 

65  garren  380  /// return a pointer to GenParticle 
2  garren  381  GenParticle* operator*(void) const 
382  { return m_map_iterator>second; } 

65  garren  383  /// Prefix increment 
2  garren  384  particle_const_iterator& operator++(void) //Prefix increment 
385  { ++m_map_iterator; return *this; } 

65  garren  386  /// Postfix increment 
2  garren  387  particle_const_iterator operator++(int) //Postfix increment 
388  { particle_const_iterator out(*this); ++(*this); return out; } 

65  garren  389  /// equality 
2  garren  390  bool operator==( const particle_const_iterator& a ) const 
391  { return m_map_iterator == a.m_map_iterator; } 

65  garren  392  /// inequality 
2  garren  393  bool operator!=( const particle_const_iterator& a ) const 
394  { return !(m_map_iterator == a.m_map_iterator); } 

395  protected: 

65  garren  396  /// const iterator to the GenParticle map 
2  garren  397  std::map<int,GenParticle*>::const_iterator m_map_iterator; 
398  }; 

399  friend class particle_const_iterator; 

65  garren  400  /// begin particle iteration 
2  garren  401  particle_const_iterator particles_begin() const 
402  { return GenEvent::particle_const_iterator( 

403  m_particle_barcodes.begin() ); } 

65  garren  404  /// end particle iteration 
2  garren  405  particle_const_iterator particles_end() const 
406  { return GenEvent::particle_const_iterator( 

407  m_particle_barcodes.end() ); } 

408  
65  garren  409  //! nonconst particle iterator 
410  
411  /// \class particle_iterator 

412  /// HepMC::GenEvent::particle_iterator 

413  /// is used to iterate over all particles in the event. 

414  class particle_iterator : 

2  garren  415  public std::iterator<std::forward_iterator_tag,GenParticle*,ptrdiff_t>{ 
416  // Iterates over all vertices in this event 

417  public: 

65  garren  418  /// iterate over particles 
2  garren  419  particle_iterator( const std::map<int,GenParticle*>::iterator& i ) 
420  : m_map_iterator( i ) {} 

421  particle_iterator() {} 

65  garren  422  /// copy constructor 
2  garren  423  particle_iterator( const particle_iterator& i ) { *this = i; } 
424  virtual ~particle_iterator() {} 

65  garren  425  /// make a copy 
2  garren  426  particle_iterator& operator=( const particle_iterator& i ) { 
427  m_map_iterator = i.m_map_iterator; 

428  return *this; 

429  } 

65  garren  430  /// const particle iterator 
2  garren  431  operator particle_const_iterator() const 
432  { return particle_const_iterator(m_map_iterator); } 

65  garren  433  /// return pointer to GenParticle 
2  garren  434  GenParticle* operator*(void) const 
435  { return m_map_iterator>second; } 

65  garren  436  /// Prefix increment 
437  particle_iterator& operator++(void) 

2  garren  438  { ++m_map_iterator; return *this; } 
65  garren  439  /// Postfix increment 
440  particle_iterator operator++(int) 

2  garren  441  { particle_iterator out(*this); ++(*this); return out; } 
65  garren  442  /// equality 
2  garren  443  bool operator==( const particle_iterator& a ) const 
444  { return m_map_iterator == a.m_map_iterator; } 

65  garren  445  /// inequality 
2  garren  446  bool operator!=( const particle_iterator& a ) const 
447  { return !(m_map_iterator == a.m_map_iterator); } 

448  protected: 

65  garren  449  /// iterator for GenParticle map 
2  garren  450  std::map<int,GenParticle*>::iterator m_map_iterator; 
451  }; 

452  friend class particle_iterator; 

65  garren  453  /// begin particle iteration 
2  garren  454  particle_iterator particles_begin() 
455  { return GenEvent::particle_iterator( 

456  m_particle_barcodes.begin() ); } 

65  garren  457  /// end particle iteration 
2  garren  458  particle_iterator particles_end() 
459  { return GenEvent::particle_iterator( 

460  m_particle_barcodes.end() ); } 

461  
462  //////////////////////////////////////////////// 

463  protected: 

464  // 

465  // Following methods intended for use by GenParticle/Vertex classes: 

466  // In general there is no reason they should be used elsewhere. 

65  garren  467  /// set the barcode  intended for use by GenParticle 
2  garren  468  bool set_barcode( GenParticle* p, int suggested_barcode =0 ); 
65  garren  469  /// set the barcode  intended for use by GenVertex 
2  garren  470  bool set_barcode( GenVertex* v, int suggested_barcode =0 ); 
65  garren  471  /// intended for use by GenParticle 
2  garren  472  void remove_barcode( GenParticle* p ); 
65  garren  473  /// intended for use by GenVertex 
2  garren  474  void remove_barcode( GenVertex* v ); 
475  
65  garren  476  static unsigned int counter(); //!<num GenEvent objects in memory 
477  void delete_all_vertices(); //!<delete all vertices owned by this event 

2  garren  478  
479  private: // data members 

480  int m_signal_process_id; 

481  int m_event_number; 

103  garren  482  int m_mpi; // number of multi paricle interactions 
2  garren  483  double m_event_scale;// energy scale, see hepph/0109068 
484  double m_alphaQCD; // QCD coupling, see hepph/0109068 

485  double m_alphaQED; // QED coupling, see hepph/0109068 

486  GenVertex* m_signal_process_vertex; 

487  WeightContainer m_weights; // weights for this event first weight 

488  // is used by default for hit and miss 

489  std::vector<long int> m_random_states; // container of rndm num 

490  // generator states 

491  
492  std::map< int,GenVertex*,std::greater<int> > m_vertex_barcodes; 

493  std::map< int,GenParticle*,std::less<int> > m_particle_barcodes; 

14  garren  494  HeavyIon* m_heavy_ion; // undefined by default 
36  garren  495  PdfInfo* m_pdf_info; // undefined by default 
2  garren  496  
497  static unsigned int s_counter; 

498  }; 

499  
500  /////////////////////////// 

501  // INLINE Access Methods // 

502  /////////////////////////// 

503  
65  garren  504  /// The integer ID that uniquely specifies this signal 
505  /// process, i.e. MSUB in Pythia. It is necessary to 

506  /// package this with each event rather than with the run 

507  /// because many processes may be generated within one run. 

2  garren  508  inline int GenEvent::signal_process_id() const 
509  { return m_signal_process_id; } 

510  
511  inline int GenEvent::event_number() const { return m_event_number; } 

512  
103  garren  513  /// Returns the number of multi parton interactions in the event. 
514  /// This number is 1 if it is not set. 

515  inline int GenEvent::mpi() const { return m_mpi; } 

516  
2  garren  517  inline double GenEvent::event_scale() const { return m_event_scale; } 
518  
519  inline double GenEvent::alphaQCD() const { return m_alphaQCD; } 

520  
521  inline double GenEvent::alphaQED() const { return m_alphaQED; } 

522  
523  inline GenVertex* GenEvent::signal_process_vertex() const { 

65  garren  524  /// returns a (mutable) pointer to the signal process vertex 
2  garren  525  return m_signal_process_vertex; 
526  } 

527  
528  inline WeightContainer& GenEvent::weights() { return m_weights; } 

529  
530  inline const WeightContainer& GenEvent::weights() const 

531  { return m_weights; } 

532  
92  garren  533  inline HeavyIon* const GenEvent::heavy_ion() const 
14  garren  534  { return m_heavy_ion; } 
535  
92  garren  536  inline HeavyIon* GenEvent::heavy_ion() 
537  { return m_heavy_ion; } 

538  
539  inline PdfInfo* const GenEvent::pdf_info() const 

36  garren  540  { return m_pdf_info; } 
541  
92  garren  542  inline PdfInfo* GenEvent::pdf_info() 
543  { return m_pdf_info; } 

544  
65  garren  545  /// Vector of integers which specify the random number 
546  /// generator's state for this event. It is left to the 

547  /// generator to make use of this. We envision a vector of 

548  /// RndmStatesTags to be included with a run class which 

549  /// would specify the meaning of the random_states. 

2  garren  550  inline std::vector<long int> GenEvent::random_states() const 
551  { return m_random_states; } 

552  
553  inline void GenEvent::set_signal_process_id( int id ) 

554  { m_signal_process_id = id; } 

555  
556  inline void GenEvent::set_event_number( int eventno ) 

557  { m_event_number = eventno; } 

558  
103  garren  559  /// Use this to set the number of multi parton interactions in each event. 
560  inline void GenEvent::set_mpi( int nmpi ) 

561  { m_mpi = nmpi; } 

2  garren  562  
103  garren  563  
2  garren  564  inline void GenEvent::set_event_scale( double sc ) { m_event_scale = sc; } 
565  
566  inline void GenEvent::set_alphaQCD( double a ) { m_alphaQCD = a; } 

567  
568  inline void GenEvent::set_alphaQED( double a ) { m_alphaQED = a; } 

569  
570  inline void GenEvent::set_signal_process_vertex( GenVertex* vtx ) { 

571  m_signal_process_vertex = vtx; 

572  if ( m_signal_process_vertex ) add_vertex( m_signal_process_vertex ); 

573  } 

574  
92  garren  575  inline void GenEvent::set_heavy_ion( const HeavyIon& ion ) 
576  { m_heavy_ion = new HeavyIon(ion); } 

14  garren  577  
92  garren  578  inline void GenEvent::set_pdf_info( const PdfInfo& p ) 
579  { m_pdf_info = new PdfInfo(p); } 

36  garren  580  
2  garren  581  inline void GenEvent::set_random_states( const std::vector<long int>& 
582  randomstates ) 

583  { m_random_states = randomstates; } 

584  
585  inline void GenEvent::remove_barcode( GenParticle* p ) 

586  { m_particle_barcodes.erase( p>barcode() ); } 

587  
588  inline void GenEvent::remove_barcode( GenVertex* v ) 

589  { m_vertex_barcodes.erase( v>barcode() ); } 

590  
65  garren  591  /// Each vertex or particle has a barcode, which is just an integer which 
592  /// uniquely identifies it inside the event (i.e. there is a one to one 

593  /// mapping between particle memory addresses and particle barcodes... and 

594  /// the same applied for vertices). 

595  /// 

596  /// The value of a barcode has NO MEANING and NO ORDER! 

597  /// For the user's convenience, when an event is read in via an IO_method 

598  /// from an indexed list (like the HEPEVT common block), then the index will 

599  /// become the barcode for that particle. 

600  /// 

601  /// Particle barcodes are always positive integers. 

602  /// The barcodes are chosen and set automatically when a vertex or particle 

603  /// comes under the ownership of an event (i.e. it is contained in an event). 

2  garren  604  inline GenParticle* GenEvent::barcode_to_particle( int barCode ) const 
605  { 

606  std::map<int,GenParticle*>::const_iterator i 

607  = m_particle_barcodes.find(barCode); 

608  return ( i != m_particle_barcodes.end() ) ? (*i).second : 0; 

609  } 

610  
65  garren  611  /// Each vertex or particle has a barcode, which is just an integer which 
612  /// uniquely identifies it inside the event (i.e. there is a one to one 

613  /// mapping between particle memory addresses and particle barcodes... and 

614  /// the same applied for vertices). 

615  /// 

616  /// The value of a barcode has NO MEANING and NO ORDER! 

617  /// For the user's convenience, when an event is read in via an IO_method 

618  /// from an indexed list (like the HEPEVT common block), then the index will 

619  /// become the barcode for that particle. 

620  /// 

621  /// Vertex barcodes are always negative integers. 

622  /// The barcodes are chosen and set automatically when a vertex or particle 

623  /// comes under the ownership of an event (i.e. it is contained in an event). 

2  garren  624  inline GenVertex* GenEvent::barcode_to_vertex( int barCode ) const 
625  { 

626  std::map<int,GenVertex*,std::greater<int> >::const_iterator i 

627  = m_vertex_barcodes.find(barCode); 

628  return ( i != m_vertex_barcodes.end() ) ? (*i).second : 0; 

629  } 

630  
631  inline int GenEvent::particles_size() const { 

632  return (int)m_particle_barcodes.size(); 

633  } 

634  inline bool GenEvent::particles_empty() const { 

635  return (bool)m_particle_barcodes.empty(); 

636  } 

637  inline int GenEvent::vertices_size() const { 

638  return (int)m_vertex_barcodes.size(); 

639  } 

640  inline bool GenEvent::vertices_empty() const { 

641  return (bool)m_vertex_barcodes.empty(); 

642  } 

643  
644  } // HepMC 

645  
646  #endif // HEPMC_GEN_EVENT_H 

647  
648  // 

649  
650 