BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
eemmg-lib/src/cache.h
Go to the documentation of this file.
1/*
2 * cache.h - cache classes header
3 *
4 * this file is part of PJFry library
5 * Copyright 2011 Valery Yundin
6 */
7
8#ifndef QUL_CACHE_H
9#define QUL_CACHE_H
10
11#include "common.h"
12#include "kinem.h"
13#include "minor.h"
14#ifdef USE_GOLEM_MODE
15 #include "golem.h"
16#endif
17
18template <typename TK, typename TV>
19class MEntry
20{
21 public:
22 MEntry() : key(), val() {}
23 MEntry(const TK& k, TV& v) : key(k), val(v) {}
24
25 MEntry& operator= (const MEntry& entry)
26 {
27 key=entry.key;
28 val=entry.val;
29 return *this;
30 }
31
32 TK key;
33 mutable TV val; // TODO: remove auto_ptr in the future
34
35 MEntry(const MEntry& entry);
36};
37
38class Cache
39{
40 protected:
41 static const int size6=2;
42
43 static const int size5=size6*6;
44 static const int size4=size6*15;
45 static const int size3=size6*20;
46 static const int size2=size6*15;
47 static const int size1=size6*6;
48
49};
50
51class ICache : public Cache
52{
53#ifdef USE_GOLEM_MODE
54 friend class Golem;
55#endif
56 public:
57 typedef struct { ncomplex val[3]; } Ival;
58
80
91
97
98 enum Bcoefs {bb0=1,bb1,
99 bb00,bb11,
100 bb001,
102 };
103
104 // Scalars
105 static ncomplex getI4(int ep, const Kinem4 &k);
106 static ncomplex getI3(int ep, const Kinem3 &k);
107 static ncomplex getI2(int ep, const Kinem2 &k);
108 static ncomplex getI1(int ep, const Kinem1 &k);
109
110 // Tensor PENTAGON
111 static ncomplex getE(int ep, const Kinem5 &kin);
112 static ncomplex getE(int ep, int i, const Kinem5 &kin);
113 static ncomplex getE(int ep, int i, int j, const Kinem5 &kin);
114 static ncomplex getE(int ep, int i, int j, int k, const Kinem5 &kin);
115 static ncomplex getE(int ep, int i, int j, int k, int l, const Kinem5 &kin);
116 static ncomplex getE(int ep, int i, int j, int k, int l, int m, const Kinem5 &kin);
117
118 // Tensor BOX
119 static ncomplex getD(int ep, const Kinem4 &kin) { return getI4(ep, kin); }
120 static ncomplex getD(int ep, int i, const Kinem4 &kin);
121 static ncomplex getD(int ep, int i, int j, const Kinem4 &kin);
122 static ncomplex getD(int ep, int i, int j, int k, const Kinem4 &kin);
123 static ncomplex getD(int ep, int i, int j, int k, int l, const Kinem4 &kin);
124
125 // Tensor TRIANGLE
126 static ncomplex getC(int ep, const Kinem3 &kin) { return getI3(ep, kin); }
127 static ncomplex getC(int ep, int i, const Kinem3 &kin);
128 static ncomplex getC(int ep, int i, int j, const Kinem3 &kin);
129 static ncomplex getC(int ep, int i, int j, int k, const Kinem3 &kin);
130
131 // Tensor BUBBLE
132 static ncomplex getB(int ep, const Kinem2 &kin) { return getI2(ep, kin); }
133 static ncomplex getB(int ep, int i, const Kinem2 &kin);
134 static ncomplex getB(int ep, int i, int j, const Kinem2 &kin);
135
136 // Tadpole
137 static ncomplex getA(int ep, const Kinem1 &kin) { return getI1(ep, kin); }
138
139 static void Clear();
140 static void ClearCC();
141 static void ClearIC();
142
143 static double getMu2();
144 static double setMu2(const double newmu2);
145
146 private:
147 static double mu2;
148 typedef union { int64_t i64; double d64; } ID64;
149 typedef union { double d64; int64_t i64; } DI64;
150 static const ID64 sNAN;
151 friend bool operator==(const double &x, const ICache::ID64 &y);
152
153 // ------------------------------
154 // Tensor integral coefficients
155 // ------------------------------
156 // TODO: rethink and optimize layout later
157 typedef CArray< ncomplex, eeLAST > Save5;
158 typedef MEntry< Kinem5, Save5::Ptr > Entry5;
159 typedef DArray< Entry5, size5 > Array5;
160 static Array5 ic5[3];
161 static Save5* getS5(int ep, const Kinem5 &kin, int coefn);
162
163 typedef CArray< ncomplex, ddLAST > Save4;
164 typedef MEntry< Kinem4, Save4::Ptr > Entry4;
165 typedef DArray< Entry4, size4 > Array4;
166 static Array4 ic4[3];
167 static Save4* getS4(int ep, const Kinem4 &kin, int coefn);
168
169 typedef CArray< ncomplex, ccLAST > Save3;
170 typedef MEntry< Kinem3, Save3::Ptr > Entry3;
171 typedef DArray< Entry3, size3 > Array3;
172 static Array3 ic3[3];
173 static Save3* getS3(int ep, const Kinem3 &kin, int coefn);
174
175 typedef CArray< ncomplex, bbLAST > Save2;
176 typedef MEntry< Kinem2, Save2::Ptr > Entry2;
177 typedef DArray< Entry2, size2 > Array2;
178 static Array2 ic2[3];
179 static Save2* getS2(int ep, const Kinem2 &kin, int coefn);
180
181 // ------------------------------
182 // Scalar integrals
183 // ------------------------------
184 typedef MEntry< Kinem4, Ival > EntryS4;
185 typedef DArray< EntryS4, size4 > ArrayS4;
186 static ArrayS4 ics4;
187
188 typedef MEntry< Kinem3, Ival > EntryS3;
189 typedef DArray< EntryS3, size3 > ArrayS3;
190 static ArrayS3 ics3;
191
192 typedef MEntry< Kinem2, Ival > EntryS2;
193 typedef DArray< EntryS2, size2 > ArrayS2;
194 static ArrayS2 ics2;
195
196 typedef MEntry< Kinem1, Ival > EntryS1;
197 typedef DArray< EntryS1, size1 > ArrayS1;
198 static ArrayS1 ics1;
199};
200
201inline
202bool operator==(const double &x, const ICache::ID64 &y)
203{
204 const ICache::DI64 ix={x};
205 return ix.i64 == y.i64;
206}
207
208
209class MCache : public Cache
210{
211#ifdef USE_GOLEM_MODE
212 friend class Golem;
213#endif
214 public:
215 // TODO: may be return by reference here?
216 static Minor5::Ptr getMinor5(const Kinem5 &k);
217 static Minor4::Ptr getMinor4(const Kinem4 &k);
218 static Minor3::Ptr getMinor3(const Kinem3 &k);
219 static Minor2::Ptr getMinor2(const Kinem2 &k);
220
221 static void insertMinor5(const Kinem5 &k, Minor5::Ptr &m);
222 static void insertMinor4(const Kinem4 &k, Minor4::Ptr &m);
223 static void insertMinor3(const Kinem3 &k, Minor3::Ptr &m);
224 static void insertMinor2(const Kinem2 &k, Minor2::Ptr &m);
225
226#ifdef USE_SMART_INSERT
227# define INSERTMINOR3 smartinsertMinor3
228# define INSERTMINOR2 smartinsertMinor2
229 static void smartinsertMinor3(const Kinem3 &k, Minor3::Ptr &m);
230 static void smartinsertMinor2(const Kinem2 &k, Minor2::Ptr &m);
231#else
232# define INSERTMINOR3 insertMinor3
233# define INSERTMINOR2 insertMinor2
234#endif
235
236 static void Clear();
237
238 private:
239
242 static Array5 cm5;
243
246 static Array4 cm4;
247
250 static Array3 cm3;
251
254 static Array2 cm2;
255
256};
257
258/* =============================================
259 *
260 * inline functions
261 *
262 * =============================================
263 */
264
265#define insertMinorN(n) \
266inline \
267void MCache::insertMinor##n(const Kinem##n &k, Minor##n::Ptr &m) \
268{ \
269 cm##n.insert(Entry##n(k,m)); \
270}
271
276
277#undef insertMinorN
278
279#endif /* _QUL_CACHE_H */
Double_t x[10]
**********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
static const int size5
static const int size2
static const int size1
static const int size6
static const int size4
static const int size3
static ncomplex getE(int ep, int i, int j, int k, int l, int m, const Kinem5 &kin)
static ncomplex getI2(int ep, const Kinem2 &k)
static ncomplex getC(int ep, int i, int j, const Kinem3 &kin)
static ncomplex getI4(int ep, const Kinem4 &k)
static ncomplex getD(int ep, const Kinem4 &kin)
static ncomplex getC(int ep, int i, const Kinem3 &kin)
static double getMu2()
static ncomplex getE(int ep, int i, const Kinem5 &kin)
static ncomplex getI3(int ep, const Kinem3 &k)
static ncomplex getD(int ep, int i, int j, int k, int l, const Kinem4 &kin)
static ncomplex getA(int ep, const Kinem1 &kin)
static ncomplex getB(int ep, int i, int j, const Kinem2 &kin)
static ncomplex getB(int ep, int i, const Kinem2 &kin)
static ncomplex getB(int ep, const Kinem2 &kin)
static void ClearIC()
static double setMu2(const double newmu2)
static ncomplex getC(int ep, int i, int j, int k, const Kinem3 &kin)
static void ClearCC()
friend bool operator==(const double &x, const ICache::ID64 &y)
static ncomplex getE(int ep, const Kinem5 &kin)
static ncomplex getC(int ep, const Kinem3 &kin)
static ncomplex getE(int ep, int i, int j, int k, const Kinem5 &kin)
static ncomplex getE(int ep, int i, int j, const Kinem5 &kin)
static ncomplex getD(int ep, int i, int j, int k, const Kinem4 &kin)
static void Clear()
static ncomplex getD(int ep, int i, const Kinem4 &kin)
static ncomplex getE(int ep, int i, int j, int k, int l, const Kinem5 &kin)
static ncomplex getI1(int ep, const Kinem1 &k)
static ncomplex getD(int ep, int i, int j, const Kinem4 &kin)
static void insertMinor5(const Kinem5 &k, Minor5::Ptr &m)
static void insertMinor4(const Kinem4 &k, Minor4::Ptr &m)
static void smartinsertMinor3(const Kinem3 &k, Minor3::Ptr &m)
static void Clear()
static void smartinsertMinor2(const Kinem2 &k, Minor2::Ptr &m)
static Minor5::Ptr getMinor5(const Kinem5 &k)
static Minor2::Ptr getMinor2(const Kinem2 &k)
static Minor3::Ptr getMinor3(const Kinem3 &k)
static Minor4::Ptr getMinor4(const Kinem4 &k)
static void insertMinor2(const Kinem2 &k, Minor2::Ptr &m)
static void insertMinor3(const Kinem3 &k, Minor3::Ptr &m)
MEntry(const MEntry &entry)
MEntry(const TK &k, TV &v)
MEntry & operator=(const MEntry &entry)
double y[1000]
std::complex< double > ncomplex
#define insertMinorN(n)
bool operator==(const double &x, const ICache::ID64 &y)
double int * ep
Definition qcdloop1.h:74