BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtAmpFactory.hh
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information:
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Alexei Dvoretskii 2001-2002
12//------------------------------------------------------------------------
13
14// Abstract amplitude factory parameterized by a vector of
15// strings. Derived classes construct the amplitude, and PDFs for sampling
16// points.
17
18#ifndef EVT_AMP_FACTORY_HH
19#define EVT_AMP_FACTORY_HH
20
21#include <vector>
22#include <string>
23#include <stdio.h>
30
31template <class T>
33public:
34
36 : _amp(0), _ampConj(0), _pc(0), _dm(0.), _verbose(false)
37 {}
38
40 :
41 _amp(other._amp ? (EvtAmplitudeSum<T>*) other._amp : 0),
42 _ampConj(other._ampConj ? (EvtAmplitudeSum<T>*) other._ampConj : 0),
43 _pc(other._pc ? (EvtPdfSum<T>*) other._pc : 0),
44 _dm(other._dm),
45 _verbose(other._verbose)
46 {}
47
49 {
50 if(_amp) delete _amp;
51 if(_ampConj) delete _ampConj;
52 if(_pc) delete _pc;
53 }
54
55 virtual EvtAmpFactory<T>* clone() const = 0;
56
57 virtual void build(const EvtMultiChannelParser& parser, int nItg)
58 {
61 _pc = new EvtPdfSum<T>();
62
63 printf("Amplitude with %d terms\n",parser.getNAmp());
64 int i;
65 for(i=0;i<parser.getNAmp();i++) {
66
67 std::vector<std::string> v = parser.amp(i);
68 EvtComplex c = parser.ampCoef(i);
69 processAmp(c,v);
70 }
71
72 printf("Conj. amplitude with %d terms\n",parser.getNAmpConj());
73 for(i=0;i<parser.getNAmpConj();i++) {
74
75 std::vector<std::string> v = parser.ampConj(i);
76 EvtComplex c = parser.ampConjCoef(i);
77 processAmp(c,v,true);
78 }
79
80 printf("Calculating pole compensator integrals %d steps\n",nItg);
81 if(nItg > 0) _pc->getItg(nItg);
82
83 printf("End build\n");
84 }
85
86 virtual void processAmp(EvtComplex c, std::vector<std::string> v, bool conj = false) = 0;
87
88 inline bool isCPModel() const { return (_ampConj->nTerms() > 0 ? true : false); }
89 inline double dm() const { return _dm; }
90
91 void setVerbose() { _verbose = true; }
92
93
94 EvtAmplitudeSum<T>* getAmp() const { return _amp; }
96 EvtPdfSum<T>* getPC() const { return _pc; }
97 EvtAmplitude<T>* getAmp(int i) const { return _amp->getTerm(i); }
98 EvtPdf<T>* getPC(int i) const { return _pc->getPdf(i); }
99 const char* compName(int i) const { return _names[i].c_str(); }
100
101 EvtComplex getCoeff(int i) const { return _amp->c(i); }
102
103 double getTermCoeff(int i) const { return abs2(_amp->c(i)); }
104 double getTermCoeff(int type, int i, int j) const
105 {
106 switch(type) {
107
108 case 0: return 2*real(_amp->c(i)*conj(_amp->c(j))); //posre
109 case 1: return -2*real(_amp->c(i)*conj(_amp->c(j))); //negre
110 case 2: return -2*imag(_amp->c(i)*conj(_amp->c(j))); //posim
111 case 3: return 2*imag(_amp->c(i)*conj(_amp->c(j))); //negim
112 default: assert(0);
113 }
114 }
115
116protected:
117
118 EvtAmplitudeSum<T> *_amp; // _owned_ amplitude
119 EvtAmplitudeSum<T> *_ampConj; // _owned_ conjugate amplitude
120 EvtPdfSum<T> *_pc; // _ownded_ pole compensator
121 std::vector<std::string> _names; // names of partial amplitudes
122
123 double _dm; // Mass difference for conjugate amplitude
125};
126
127
128#endif
129
130
131
132
133
Evt3Rank3C conj(const Evt3Rank3C &t2)
Definition: Evt3Rank3C.cc:175
double imag(const EvtComplex &c)
Definition: EvtComplex.hh:246
double abs2(const EvtComplex &c)
Definition: EvtComplex.hh:221
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
EvtAmpFactory(const EvtAmpFactory< T > &other)
double dm() const
EvtAmplitude< T > * getAmp(int i) const
virtual void build(const EvtMultiChannelParser &parser, int nItg)
EvtComplex getCoeff(int i) const
EvtPdfSum< T > * _pc
EvtAmplitudeSum< T > * getAmpConj() const
double getTermCoeff(int i) const
EvtPdf< T > * getPC(int i) const
EvtAmplitudeSum< T > * _ampConj
EvtAmplitudeSum< T > * _amp
const char * compName(int i) const
EvtPdfSum< T > * getPC() const
virtual ~EvtAmpFactory()
virtual EvtAmpFactory< T > * clone() const =0
bool isCPModel() const
virtual void processAmp(EvtComplex c, std::vector< std::string > v, bool conj=false)=0
std::vector< std::string > _names
double getTermCoeff(int type, int i, int j) const
EvtAmplitudeSum< T > * getAmp() const
std::vector< std::string > ampConj(int i) const
EvtComplex ampConjCoef(int i) const
std::vector< std::string > amp(int i) const
EvtComplex ampCoef(int i) const
Definition: EvtPdf.hh:57