CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtAmpAmpPdf.hh
Go to the documentation of this file.
1/*******************************************************************************
2 * Project: BaBar detector at the SLAC PEP-II B-factory
3 * Package: EvtGenBase
4 * File: $Id: EvtAmpAmpPdf.hh,v 1.1.1.2 2007/10/26 05:03:14 pingrg Exp $
5 * Author: Alexei Dvoretskii, [email protected], 2001-2002
6 *
7 * Copyright (C) 2002 Caltech
8 *******************************************************************************/
9
10#ifndef EVT_AMP_AMP_PDF_HH
11#define EVT_AMP_AMP_PDF_HH
12
13// From the product A1A2* four PDF terms can be constructed, by taking the positive
14// and the negative parts or the real and imaginary part of the product.
15
16#include <assert.h>
19#include "EvtGenBase/EvtPdf.hh"
20
22
23template <class T>
24class EvtAmpAmpPdf : public EvtPdf<T> {
25public:
26
28 EvtAmpAmpPdf(int type, const EvtAmplitude<T>& amp1, const EvtAmplitude<T>& amp2)
29 : EvtPdf<T>(), _type(type), _amp1(amp1.clone()), _amp2(amp2.clone())
30 {}
32 : EvtPdf<T>(other), _type(other._type), COPY_PTR(_amp1), COPY_PTR(_amp2)
33 {}
34 virtual ~EvtAmpAmpPdf()
35 {
36 delete _amp1;
37 delete _amp2;
38 }
39
40 virtual EvtAmpAmpPdf<T>* clone() const { return new EvtAmpAmpPdf(*this); }
41
42 virtual double pdf(const T& p) const
43 {
44 EvtComplex amp1 = _amp1->evaluate(p);
45 EvtComplex amp2 = _amp2->evaluate(p);
46 EvtComplex pr = amp1 * conj(amp2);
47
48 if(_type == POSRE) return real(pr) > 0 ? real(pr) : 0.;
49 if(_type == NEGRE) return real(pr) < 0 ? -real(pr) : 0.;
50 if(_type == POSIM) return imag(pr) > 0 ? imag(pr) : 0.;
51 if(_type == NEGIM) return imag(pr) < 0 ? -imag(pr) : 0.;
52
53 assert(0);
54 }
55
56private:
57
58 int _type;
59 EvtAmplitude<T>* _amp1;
60 EvtAmplitude<T>* _amp2;
61};
62
63#endif
64
Evt3Rank3C conj(const Evt3Rank3C &t2)
Definition: Evt3Rank3C.cc:175
@ NEGRE
Definition: EvtAmpAmpPdf.hh:21
@ POSIM
Definition: EvtAmpAmpPdf.hh:21
@ POSRE
Definition: EvtAmpAmpPdf.hh:21
@ NEGIM
Definition: EvtAmpAmpPdf.hh:21
double imag(const EvtComplex &c)
Definition: EvtComplex.hh:246
double real(const EvtComplex &c)
Definition: EvtComplex.hh:240
#define COPY_PTR(X)
Definition: EvtMacros.hh:15
virtual ~EvtAmpAmpPdf()
Definition: EvtAmpAmpPdf.hh:34
EvtAmpAmpPdf(int type, const EvtAmplitude< T > &amp1, const EvtAmplitude< T > &amp2)
Definition: EvtAmpAmpPdf.hh:28
virtual EvtAmpAmpPdf< T > * clone() const
Definition: EvtAmpAmpPdf.hh:40
virtual double pdf(const T &p) const
Definition: EvtAmpAmpPdf.hh:42
EvtAmpAmpPdf(const EvtAmpAmpPdf< T > &other)
Definition: EvtAmpAmpPdf.hh:31
Definition: EvtPdf.hh:57