evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
EvtAmpAmpPdf.hh
Go to the documentation of this file.
1 
2 /***********************************************************************
3 * Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4 * *
5 * This file is part of EvtGen. *
6 * *
7 * EvtGen is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * EvtGen is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19 ***********************************************************************/
20 
21 #ifndef EVT_AMP_AMP_PDF_HH
22 #define EVT_AMP_AMP_PDF_HH
23 
24 // From the product A1A2* four PDF terms can be constructed, by taking the positive
25 // and the negative parts or the real and imaginary part of the product.
26 
28 #include "EvtGenBase/EvtMacros.hh"
29 #include "EvtGenBase/EvtPdf.hh"
30 
31 #include <assert.h>
32 
33 enum
34 {
35  POSRE = 0,
39 };
40 
41 template <class T>
42 class EvtAmpAmpPdf : public EvtPdf<T> {
43  public:
45  EvtAmpAmpPdf( int type, const EvtAmplitude<T>& amp1,
46  const EvtAmplitude<T>& amp2 ) :
47  EvtPdf<T>(), _type( type ), _amp1( amp1.clone() ), _amp2( amp2.clone() )
48  {
49  }
51  EvtPdf<T>( other ),
52  _type( other._type ),
53  COPY_PTR( _amp1 ),
54  COPY_PTR( _amp2 )
55  {
56  }
57  virtual ~EvtAmpAmpPdf()
58  {
59  delete _amp1;
60  delete _amp2;
61  }
62 
63  virtual EvtAmpAmpPdf<T>* clone() const { return new EvtAmpAmpPdf( *this ); }
64 
65  virtual double pdf( const T& p ) const
66  {
67  EvtComplex amp1 = _amp1->evaluate( p );
68  EvtComplex amp2 = _amp2->evaluate( p );
69  EvtComplex pr = amp1 * conj( amp2 );
70 
71  if ( _type == POSRE )
72  return real( pr ) > 0 ? real( pr ) : 0.;
73  if ( _type == NEGRE )
74  return real( pr ) < 0 ? -real( pr ) : 0.;
75  if ( _type == POSIM )
76  return imag( pr ) > 0 ? imag( pr ) : 0.;
77  if ( _type == NEGIM )
78  return imag( pr ) < 0 ? -imag( pr ) : 0.;
79 
80  assert( 0 );
81  }
82 
83  private:
84  int _type;
87 };
88 
89 #endif
virtual ~EvtAmpAmpPdf()
Definition: EvtAmpAmpPdf.hh:57
Evt3Rank3C conj(const Evt3Rank3C &t2)
Definition: Evt3Rank3C.cpp:172
EvtAmpAmpPdf(int type, const EvtAmplitude< T > &amp1, const EvtAmplitude< T > &amp2)
Definition: EvtAmpAmpPdf.hh:45
EvtAmpAmpPdf(const EvtAmpAmpPdf< T > &other)
Definition: EvtAmpAmpPdf.hh:50
EvtAmplitude< T > * _amp1
Definition: EvtAmpAmpPdf.hh:85
EvtAmplitude< T > * _amp2
Definition: EvtAmpAmpPdf.hh:86
virtual EvtAmpAmpPdf< T > * clone() const
Definition: EvtAmpAmpPdf.hh:63
double imag(const EvtComplex &c)
Definition: EvtComplex.hh:235
#define COPY_PTR(X)
Definition: EvtMacros.hh:26
Definition: EvtPdf.hh:72
virtual double pdf(const T &p) const
Definition: EvtAmpAmpPdf.hh:65
double real(const EvtComplex &c)
Definition: EvtComplex.hh:230
Index other(Index i, Index j)
Definition: EvtCyclic3.cpp:156