1 /*******************************************************************************
2 * Project: BaBar detector at the SLAC PEP-II B-factory
4 * File: $Id: EvtAmpAmpPdf.hh,v 1.2 2003/06/20 17:19:59 dvoretsk Exp $
5 * Author: Alexei Dvoretskii, dvoretsk@slac.stanford.edu, 2001-2002
7 * Copyright (C) 2002 Caltech
8 *******************************************************************************/
10 #ifndef EVT_AMP_AMP_PDF_HH
11 #define EVT_AMP_AMP_PDF_HH
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.
17 #include "EvtGenBase/EvtMacros.hh"
18 #include "EvtGenBase/EvtAmplitude.hh"
19 #include "EvtGenBase/EvtPdf.hh"
21 enum {POSRE=0,NEGRE,POSIM,NEGIM};
24 class EvtAmpAmpPdf : public EvtPdf<T> {
28 EvtAmpAmpPdf(int type, const EvtAmplitude<T>& amp1, const EvtAmplitude<T>& amp2)
29 : EvtPdf<T>(), _type(type), _amp1(amp1.clone()), _amp2(amp2.clone())
31 EvtAmpAmpPdf(const EvtAmpAmpPdf<T>& other)
32 : EvtPdf<T>(other), _type(other._type), COPY_PTR(_amp1), COPY_PTR(_amp2)
34 virtual ~EvtAmpAmpPdf()
40 virtual EvtAmpAmpPdf<T>* clone() const { return new EvtAmpAmpPdf(*this); }
42 virtual double pdf(const T& p) const
44 EvtComplex amp1 = _amp1->evaluate(p);
45 EvtComplex amp2 = _amp2->evaluate(p);
46 EvtComplex pr = amp1 * conj(amp2);
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.;
59 EvtAmplitude<T>* _amp1;
60 EvtAmplitude<T>* _amp2;