BOSS 8.0.0
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 "EvtAmpPdf.hh"
22#include "EvtAmplitudeSum.hh"
23#include "EvtMacros.hh"
25#include "EvtPdfMax.hh"
26#include "EvtPdfSum.hh"
27#include <stdio.h>
28#include <string>
29#include <vector>
30
31template <class T> class EvtAmpFactory {
32public:
33 EvtAmpFactory() : _amp( 0 ), _ampConj( 0 ), _pc( 0 ), _dm( 0. ), _verbose( false ) {}
34
36 : _amp( other._amp ? (EvtAmplitudeSum<T>*)other._amp : 0 )
37 , _ampConj( other._ampConj ? (EvtAmplitudeSum<T>*)other._ampConj : 0 )
38 , _pc( other._pc ? (EvtPdfSum<T>*)other._pc : 0 )
39 , _dm( other._dm )
40 , _verbose( other._verbose ) {}
41
42 virtual ~EvtAmpFactory() {
43 if ( _amp ) delete _amp;
44 if ( _ampConj ) delete _ampConj;
45 if ( _pc ) delete _pc;
46 }
47
48 virtual EvtAmpFactory<T>* clone() const = 0;
49
50 virtual void build( const EvtMultiChannelParser& parser, int nItg ) {
53 _pc = new EvtPdfSum<T>();
54
55 printf( "Amplitude with %d terms\n", parser.getNAmp() );
56 int i;
57 for ( i = 0; i < parser.getNAmp(); i++ )
58 {
59
60 std::vector<std::string> v = parser.amp( i );
61 EvtComplex c = parser.ampCoef( i );
62 processAmp( c, v );
63 }
64
65 printf( "Conj. amplitude with %d terms\n", parser.getNAmpConj() );
66 for ( i = 0; i < parser.getNAmpConj(); i++ )
67 {
68
69 std::vector<std::string> v = parser.ampConj( i );
70 EvtComplex c = parser.ampConjCoef( i );
71 processAmp( c, v, true );
72 }
73
74 printf( "Calculating pole compensator integrals %d steps\n", nItg );
75 if ( nItg > 0 ) _pc->getItg( nItg );
76
77 printf( "End build\n" );
78 }
79
80 virtual void processAmp( EvtComplex c, std::vector<std::string> v, bool conj = false ) = 0;
81
82 inline bool isCPModel() const { return ( _ampConj->nTerms() > 0 ? true : false ); }
83 inline double dm() const { return _dm; }
84
85 void setVerbose() { _verbose = true; }
86
87 EvtAmplitudeSum<T>* getAmp() const { return _amp; }
89 EvtPdfSum<T>* getPC() const { return _pc; }
90 EvtAmplitude<T>* getAmp( int i ) const { return _amp->getTerm( i ); }
91 EvtPdf<T>* getPC( int i ) const { return _pc->getPdf( i ); }
92 const char* compName( int i ) const { return _names[i].c_str(); }
93
94 EvtComplex getCoeff( int i ) const { return _amp->c( i ); }
95
96 double getTermCoeff( int i ) const { return abs2( _amp->c( i ) ); }
97 double getTermCoeff( int type, int i, int j ) const {
98 switch ( type )
99 {
100
101 case 0: return 2 * real( _amp->c( i ) * conj( _amp->c( j ) ) ); // posre
102 case 1: return -2 * real( _amp->c( i ) * conj( _amp->c( j ) ) ); // negre
103 case 2: return -2 * imag( _amp->c( i ) * conj( _amp->c( j ) ) ); // posim
104 case 3: return 2 * imag( _amp->c( i ) * conj( _amp->c( j ) ) ); // negim
105 default: assert( 0 );
106 }
107 }
108
109protected:
110 EvtAmplitudeSum<T>* _amp; // _owned_ amplitude
111 EvtAmplitudeSum<T>* _ampConj; // _owned_ conjugate amplitude
112 EvtPdfSum<T>* _pc; // _ownded_ pole compensator
113 std::vector<std::string> _names; // names of partial amplitudes
114
115 double _dm; // Mass difference for conjugate amplitude
117};
118
119#endif
Evt3Rank3C conj(const Evt3Rank3C &t2)
double imag(const EvtComplex &c)
double abs2(const EvtComplex &c)
**********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