AmpGen 2.1
Loading...
Searching...
No Matches
Event.h
Go to the documentation of this file.
1#ifndef AMPGEN_EVENT_H
2#define AMPGEN_EVENT_H
3
4#include <vector>
5#include <complex>
6#include <cstring>
7#include <cstddef>
8#include <array>
9#include "AmpGen/Types.h"
10
11namespace AmpGen {
12
17
18 class Event {
19 public:
20 Event () = default;
21 Event( const unsigned& N );
22 Event( const real_t* data, const unsigned& N );
23
24 void set( const unsigned& i, const std::vector<real_t>& p );
25 void set( const unsigned& i, const real_t* p );
26 void set( const real_t* evt );
27 void set( const unsigned& i, const real_t& p ) ;
28 void swap( const unsigned int& i , const unsigned int& j );
29
30 unsigned size() const { return m_event.size(); }
31
32 real_t* pWeight() { return &(m_weight); }
33 real_t* pGenPdf() { return &m_genPdf; }
34 const real_t* address(const unsigned& ref=0) const { return &(m_event[ref]); }
35 real_t* address(const unsigned& ref=0) { return &(m_event[ref]); }
36
37 real_t weight() const { return m_weight; }
38 real_t genPdf() const { return m_genPdf; }
39 real_t operator[](const unsigned& i) const { return m_event[i]; }
40 real_t& operator[](const unsigned& i) { return m_event[i]; }
41 operator const real_t*() const { return &(m_event[0]); }
42 operator real_t*() { return &(m_event[0]); }
43
44 void setWeight( const real_t& weight ){ m_weight = weight ; }
45 void setGenPdf( const real_t& genPdf ){ m_genPdf = genPdf ; }
46 void extendEvent(const real_t& value) { m_event.push_back( value ); }
47
48 void print() const;
49 // void printCache() const;
50 void setIndex(const unsigned& index){ m_index = index; }
51 unsigned index() const { return m_index; }
52 real_t s( const unsigned& index) const ;
53 real_t s( const unsigned& index1, const unsigned& index2 ) const ;
54 real_t s( const unsigned& index1, const unsigned& index2, const unsigned& index3 ) const;
55 real_t s( const std::vector<unsigned>& indices ) const ;
56 void reorder( const std::vector<unsigned>& addresses);
57 const std::vector<real_t>& data() const { return m_event; }
58 private:
59 std::vector<real_t> m_event;
60 real_t m_genPdf = {1};
61 real_t m_weight = {1};
62 unsigned m_index = {0};
63 inline real_t get(const unsigned& index ) const { return m_event[index]; };
64 };
65}
66
67#endif
void set(const unsigned &i, const real_t &p)
Event(const real_t *data, const unsigned &N)
Event(const unsigned &N)
real_t * pGenPdf()
Definition Event.h:33
real_t & operator[](const unsigned &i)
Definition Event.h:40
unsigned index() const
Definition Event.h:51
real_t s(const unsigned &index1, const unsigned &index2, const unsigned &index3) const
real_t s(const unsigned &index) const
Event()=default
real_t weight() const
Definition Event.h:37
void extendEvent(const real_t &value)
Definition Event.h:46
const real_t * address(const unsigned &ref=0) const
Definition Event.h:34
const std::vector< real_t > & data() const
Definition Event.h:57
void setGenPdf(const real_t &genPdf)
Definition Event.h:45
void set(const unsigned &i, const real_t *p)
real_t s(const std::vector< unsigned > &indices) const
real_t genPdf() const
Definition Event.h:38
real_t * pWeight()
Definition Event.h:32
void reorder(const std::vector< unsigned > &addresses)
unsigned size() const
Definition Event.h:30
void set(const real_t *evt)
real_t operator[](const unsigned &i) const
Definition Event.h:39
void setWeight(const real_t &weight)
Definition Event.h:44
void set(const unsigned &i, const std::vector< real_t > &p)
void print() const
void swap(const unsigned int &i, const unsigned int &j)
real_t s(const unsigned &index1, const unsigned &index2) const
void setIndex(const unsigned &index)
Definition Event.h:50
real_t * address(const unsigned &ref=0)
Definition Event.h:35
double real_t
Definition Types.h:6