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.
EvtAmplitude.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_AMPLITUDE_HH
22 #define EVT_AMPLITUDE_HH
23 
24 #include "EvtGenBase/EvtComplex.hh"
25 
26 // Complex-valued amplitude
27 
28 template <class T>
29 class EvtAmplitude {
30  public:
31  EvtAmplitude() = default;
32  EvtAmplitude( const EvtAmplitude& ) = default;
33  EvtAmplitude( EvtAmplitude&& ) = default;
34  EvtAmplitude& operator=( const EvtAmplitude& ) = default;
35  EvtAmplitude& operator=( EvtAmplitude&& ) = default;
36  virtual ~EvtAmplitude() = default;
37 
38  virtual EvtAmplitude<T>* clone() const = 0;
39 
40  EvtComplex evaluate( const T& p ) const
41  {
42  EvtComplex ret( 0., 0. );
43  if ( p.isValid() )
44  ret = amplitude( p );
45  return ret;
46  }
47 
48  protected:
49  // Derive in subclasses to define amplitude computation
50  // for a fully constructed amplitude object.
51 
52  virtual EvtComplex amplitude( const T& ) const = 0;
53 };
54 
55 #endif
virtual ~EvtAmplitude()=default
EvtComplex evaluate(const T &p) const
Definition: EvtAmplitude.hh:40
virtual EvtComplex amplitude(const T &) const =0
virtual EvtAmplitude< T > * clone() const =0
EvtAmplitude & operator=(const EvtAmplitude &)=default
EvtAmplitude()=default