]>
Commit | Line | Data |
---|---|---|
da0e9ce3 | 1 | /******************************************************************************* |
2 | * Project: BaBar detector at the SLAC PEP-II B-factory | |
3 | * Package: EvtGenBase | |
0ca57c2f | 4 | * File: $Id: EvtAmpPdf.hh,v 1.2 2009-03-16 16:43:40 robbep Exp $ |
da0e9ce3 | 5 | * Author: Alexei Dvoretskii, dvoretsk@slac.stanford.edu, 2001-2002 |
6 | * | |
7 | * Copyright (C) 2002 Caltech | |
8 | *******************************************************************************/ | |
9 | ||
10 | #ifndef EVT_AMP_PDF_HH | |
11 | #define EVT_AMP_PDF_HH | |
12 | ||
13 | #include "EvtGenBase/EvtMacros.hh" | |
14 | #include "EvtGenBase/EvtAmplitude.hh" | |
15 | #include "EvtGenBase/EvtPdf.hh" | |
16 | ||
17 | template <class T> | |
18 | ||
19 | class EvtAmpPdf : public EvtPdf<T> { | |
20 | public: | |
21 | ||
22 | EvtAmpPdf() {} | |
23 | EvtAmpPdf(const EvtAmplitude<T>& amp) : EvtPdf<T>(), _amp(amp.clone()) {} | |
24 | EvtAmpPdf(const EvtAmpPdf<T>& other) : EvtPdf<T>(other), COPY_PTR(_amp) {} | |
25 | virtual ~EvtAmpPdf() { delete _amp; } | |
26 | ||
27 | virtual EvtAmpPdf<T>* clone() const { return new EvtAmpPdf(*this); } | |
28 | ||
29 | virtual double pdf(const T& p) const | |
30 | { | |
31 | EvtComplex amp = _amp->evaluate(p); | |
32 | return real(amp)*real(amp) + imag(amp)*imag(amp); | |
33 | } | |
34 | ||
35 | private: | |
36 | ||
37 | EvtAmplitude<T>* _amp; | |
38 | }; | |
39 | ||
40 | #endif | |
41 |