]>
Commit | Line | Data |
---|---|---|
5ad4eb21 | 1 | // SusyLesHouches.h is a part of the PYTHIA event generator. |
2 | // Copyright (C) 2008 Peter Skands, Torbjorn Sjostrand. | |
3 | // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details. | |
4 | // Please respect the MCnet Guidelines, see GUIDELINES for details. | |
5 | ||
6 | #ifndef SLHA_H | |
7 | #define SLHA_H | |
8 | ||
9 | // Stdlib header files for string and character manipulation. | |
10 | #include <string> | |
11 | #include <cctype> | |
12 | // Stdlib header files for containers. | |
13 | #include <vector> | |
14 | #include <map> | |
15 | // Stdlib header files for input/output. | |
16 | #include <iostream> | |
17 | #include <iomanip> | |
18 | #include <fstream> | |
19 | #include <sstream> | |
20 | // Stdlib header files for mathematics. | |
21 | #include <cmath> | |
22 | ||
23 | // Stdlib namespace | |
24 | using namespace std; | |
25 | ||
26 | class SusyLesHouches { | |
27 | ||
28 | public: | |
29 | ||
30 | //Constructor, with and without filename. | |
31 | SusyLesHouches(int verboseIn=1) : verbose(verboseIn), | |
32 | headerPrinted(false), footerPrinted(false), | |
33 | slhaRead(false), lhefRead(false), lhefSlha(false) {}; | |
34 | SusyLesHouches(string filename, int verboseIn=1) : verbose(verboseIn), | |
35 | headerPrinted(false), footerPrinted(false), | |
36 | slhaRead(true), lhefRead(false), lhefSlha(false) {readFile(filename);}; | |
37 | ||
38 | //***************************** SLHA FILE I/O *****************************// | |
39 | int readFile(string slhaFile="slha.spc"); // read in SLHA file | |
40 | //int writeFile(string filename): write SLHA file on filename | |
41 | int checkSpectrum(); | |
42 | ||
43 | //Output utilities | |
44 | void printHeader(); // print Header | |
45 | void printFooter(); // print Footer | |
46 | void printSpectrum(); // print Spectrum | |
47 | ||
48 | // Class for SLHA data entry | |
49 | class Entry { | |
50 | ||
51 | public: | |
52 | //Constructor. | |
53 | Entry() : isIntP(false), isDoubleP(false), | |
54 | isStringP(false), n(0), d(0.0), s(""), commentP("") {} | |
55 | ||
56 | // Generic functions to inquire whether an int, double, or string | |
57 | bool isInt(){return isIntP;} | |
58 | bool isDouble(){return isDoubleP;} | |
59 | bool isString(){return isStringP;} | |
60 | ||
61 | // = Overloading: Set entry to int, double, or string | |
62 | Entry& operator=(double& val) { | |
63 | d=val;isIntP=false;isDoubleP=true;isStringP=false; | |
64 | return *this; | |
65 | }; | |
66 | Entry& operator=(int& val) { | |
67 | n=val;isIntP=true;isDoubleP=false;isStringP=false; | |
68 | return *this; | |
69 | }; | |
70 | Entry& operator=(string& val) { | |
71 | s=val;isIntP=false;isDoubleP=false;isStringP=true; | |
72 | return *this; | |
73 | }; | |
74 | ||
75 | // Set and Get comment | |
76 | void setComment(string comment) {commentP=comment;} | |
77 | void getComment(string comment) {comment=commentP;} | |
78 | ||
79 | // Generic functions to get value | |
80 | bool get(int& val) {val=n; return isIntP;} | |
81 | bool get(double& val) {val=d; return isDoubleP;} | |
82 | bool get(string& val) {val=s; return isStringP;} | |
83 | ||
84 | private: | |
85 | bool isIntP, isDoubleP, isStringP; | |
86 | int n; | |
87 | double d; | |
88 | string s; | |
89 | string commentP; | |
90 | ||
91 | }; | |
92 | ||
93 | //***************************** SLHA CLASSES *****************************// | |
94 | ||
95 | ||
96 | //class block: the generic SLHA block (see below for matrices) | |
97 | //Explicit typing required, e.g. block<double> minpar; | |
98 | template <class T> class block { | |
99 | ||
100 | public: | |
101 | ||
102 | //Constructor. | |
103 | block<T>() : idnow(0) { } ; | |
104 | ||
105 | //Does block exist? | |
106 | bool exists() { return entry.size() == 0 ? false : true ; }; | |
107 | //Clear block | |
108 | void clear() { entry.clear(); }; | |
109 | ||
110 | //set: set block entry values. | |
111 | //Possible return values from set: | |
112 | // 0: normal return. Entry did not previously exist and has been created. | |
113 | // 1: normal return. Entry did previously exist and has been overwritten. | |
114 | //-1: failure. | |
115 | int set(int iIn,T valIn) { | |
116 | int alreadyexisting=exists(iIn)?1:0; | |
117 | entry[iIn]=valIn; | |
118 | return alreadyexisting; | |
119 | }; | |
120 | // Read index and value from SLHA data line | |
121 | int set(istringstream& linestream) { | |
122 | linestream >> i >> val; | |
123 | return linestream ? set(i,val) : -1; | |
124 | }; | |
125 | // With i already given, read value from remaining SLHA data line | |
126 | int set(int iIn,istringstream& linestream) { | |
127 | linestream >> val; | |
128 | return linestream ? set(iIn,val) : -1; | |
129 | }; | |
130 | // Shorthand for entry[0]. Used e.g. for block ALPHA. | |
131 | void set(T valIn) { entry[0]=valIn; }; | |
132 | ||
133 | // Does entry i already exist in this block? | |
134 | bool exists(int iIn) {return entry.find(iIn) != entry.end() | |
135 | ? true : false;}; | |
136 | ||
137 | // Indexing with (). Output only. | |
138 | T operator()(int iIn=0) { | |
139 | if (exists(iIn)) {return entry[iIn];} else {T dummy(0); return dummy;}; | |
140 | }; | |
141 | ||
142 | // Size of map | |
143 | int size() {return entry.size();}; | |
144 | ||
145 | // First and next key code | |
146 | int first() { idnow = entry.begin()->first; return idnow; }; | |
147 | int next() { | |
148 | typename map<int,T>::iterator itnow; | |
149 | itnow = ++entry.find(idnow); | |
150 | if ( itnow == entry.end() ) itnow=entry.begin(); | |
151 | return idnow = itnow->first; | |
152 | }; | |
153 | ||
154 | // Simple print utility | |
155 | void print() { | |
156 | bool finished=false; | |
157 | int ibegin=first(); | |
158 | i=ibegin; | |
159 | while (!finished) { | |
160 | cout << " "<< i << " " << entry[i] <<endl; | |
161 | i=next(); | |
162 | if (i == ibegin) finished=true; | |
163 | }; | |
164 | }; | |
165 | ||
166 | // Special for DRbar running blocks. | |
167 | void setq(double qIn) { qDRbar=qIn; } | |
168 | double q() { return qDRbar; } | |
169 | ||
170 | private: | |
171 | map<int,T> entry; | |
172 | int idnow; | |
173 | double qDRbar; | |
174 | //Auxiliary vars | |
175 | int i; | |
176 | T val; | |
177 | }; | |
178 | ||
179 | // class matrixblock: the generic SLHA matrix | |
180 | // Explicit sizing required, e.g. matrixblock<4> nmix; | |
181 | template <int size> class matrixblock { | |
182 | public: | |
183 | //Constructor. Set uninitialized and explicitly zero. | |
184 | matrixblock<size>() : i(0), j(0), val(0) { | |
185 | initialized=false; | |
186 | for (i=1;i<=size;i++) { | |
187 | for (j=1;j<=size;j++) { | |
188 | entry[i][j]=0.0; | |
189 | }; | |
190 | }; | |
191 | }; | |
192 | ||
193 | // Assignment | |
194 | matrixblock& operator=(const matrixblock& m) { | |
195 | if (this != &m) { | |
196 | for (i=0;i<size;i++) for (j=0;j<=size;j++) entry[i][j] = m(i,j); | |
197 | qDRbar = m.qDRbar; | |
198 | initialized = m.initialized; | |
199 | } | |
200 | return *this; }; | |
201 | ||
202 | // Does this matrix contain any entries? | |
203 | bool exists() { return initialized; }; | |
204 | // Clear initialized flag | |
205 | void clear() { initialized=false; }; | |
206 | ||
207 | // Set matrix entry | |
208 | int set(int iIn,int jIn, double valIn) { | |
209 | if (iIn>0 && jIn>0 && iIn<=size && jIn<=size) { | |
210 | entry[iIn][jIn]=valIn; | |
211 | initialized=true; | |
212 | return 0; | |
213 | } else { | |
214 | return -1; | |
215 | }; | |
216 | }; | |
217 | ||
218 | // Set entry from linestream (used during file read) | |
219 | int set(istringstream& linestream) { | |
220 | linestream >> i >> j >> val; | |
221 | return linestream ? set(i,j,val) : -1; | |
222 | }; | |
223 | ||
224 | // () Overloading: Get entry | |
225 | double operator()(int iIn, int jIn) const { | |
226 | return (iIn <= size && jIn <= size && iIn > 0 && jIn > 0) ? | |
227 | entry[iIn][jIn] : 0.0; | |
228 | }; | |
229 | ||
230 | // Set and get scale for DRbar running blocks. | |
231 | void setq(double qIn) { qDRbar=qIn; } | |
232 | double q() { return qDRbar; } | |
233 | ||
234 | // Simple print utility, to be elaborated on. | |
235 | void print() { | |
236 | for (i=1;i<=size;i++) { | |
237 | cout << " "<<i << " " ; | |
238 | for (j=1;j<=size;j++) cout << entry[i][j] << " "; | |
239 | cout << endl; | |
240 | }; | |
241 | }; | |
242 | ||
243 | private: | |
244 | bool initialized; | |
245 | double entry[size+1][size+1]; | |
246 | double qDRbar; | |
247 | //Auxiliary vars | |
248 | int i,j; | |
249 | double val; | |
250 | }; | |
251 | ||
252 | // class tensorblock: the generic SLHA tensor | |
253 | // Explicit sizing required, e.g. tensorblock<3> rvlam; | |
254 | template <int size> class tensor3block { | |
255 | public: | |
256 | //Constructor. Set uninitialized and explicitly zero. | |
257 | tensor3block<size>() { | |
258 | initialized=false; | |
259 | for (i=1;i<=size;i++) { | |
260 | for (j=1;j<=size;j++) { | |
261 | for (k=1;k<=size;k++) { | |
262 | entry[i][j][k]=0.0; | |
263 | }; | |
264 | }; | |
265 | }; | |
266 | }; | |
267 | ||
268 | // Assignment | |
269 | tensor3block& operator=(const tensor3block& m) { | |
270 | if (this != &m) { | |
271 | for (i=0;i<size;i++) for (j=0;j<=size;j++) for (k=0;k<=size;k++) | |
272 | entry[i][j][k] = m(i,j,k); | |
273 | qDRbar = m.qDRbar; | |
274 | initialized = m.initialized; | |
275 | } | |
276 | return *this; }; | |
277 | ||
278 | // Does this matrix contain any entries? | |
279 | bool exists() { return initialized; }; | |
280 | // Clear initialized flag | |
281 | void clear() { initialized=false; }; | |
282 | ||
283 | // Set matrix entry | |
284 | int set(int iIn,int jIn, int kIn, double valIn) { | |
285 | if (iIn>0 && jIn>0 && kIn>0 && iIn<=size && jIn<=size && kIn<=size) { | |
286 | entry[iIn][jIn][kIn]=valIn; | |
287 | initialized=true; | |
288 | return 0; | |
289 | } else { | |
290 | return -1; | |
291 | }; | |
292 | }; | |
293 | ||
294 | // Set entry from linestream (used during file read) | |
295 | int set(istringstream& linestream) { | |
296 | linestream >> i >> j >> k >> val; | |
297 | return linestream ? set(i,j,k,val) : -1; | |
298 | }; | |
299 | ||
300 | // () Overloading: Get entry | |
301 | double operator()(int iIn, int jIn, int kIn) const { | |
302 | return (iIn <= size && jIn <= size && kIn <= size && iIn > 0 | |
303 | && jIn > 0 && kIn > 0) ? entry[iIn][jIn][kIn] : 0.0; | |
304 | }; | |
305 | ||
306 | // Set and get scale for DRbar running blocks. | |
307 | void setq(double qIn) { qDRbar=qIn; } | |
308 | double q() { return qDRbar; } | |
309 | ||
310 | // Simple print utility, to be elaborated on. | |
311 | void print() { | |
312 | for (i=1;i<=size;i++) { | |
313 | for (j=1;j<=size;j++) { | |
314 | cout << " "<<i << " "<<j << " " ; | |
315 | for (k=1;k<=size;k++) { | |
316 | cout << entry[i][j][k] << " "; | |
317 | cout << endl; | |
318 | }; | |
319 | }; | |
320 | }; | |
321 | }; | |
322 | ||
323 | private: | |
324 | bool initialized; | |
325 | double entry[size+1][size+1][size+1]; | |
326 | double qDRbar; | |
327 | //Auxiliary vars | |
328 | int i,j,k; | |
329 | double val; | |
330 | }; | |
331 | ||
332 | //*************************** THE SLHA1 BLOCKS ***************************// | |
333 | //blocks for model definition: | |
334 | block<int> modsel; | |
335 | block<int> modsel21; | |
336 | block<double> modsel12; | |
337 | block<double> minpar; | |
338 | block<double> extpar; | |
339 | block<double> sminputs; | |
340 | //blocks for RGE program specific output | |
341 | block<string> spinfo; | |
342 | block<string> spinfo3; | |
343 | block<string> spinfo4; | |
344 | //blocks for DCY program specific output | |
345 | block<string> dcinfo; | |
346 | block<string> dcinfo3; | |
347 | block<string> dcinfo4; | |
348 | //blocks for mass and coupling spectrum | |
349 | block<double> mass; | |
350 | matrixblock<4> nmix; | |
351 | matrixblock<2> umix; | |
352 | matrixblock<2> vmix; | |
353 | matrixblock<2> stopmix; | |
354 | matrixblock<2> sbotmix; | |
355 | matrixblock<2> staumix; | |
356 | block<double> alpha; | |
357 | block<double> hmix; | |
358 | block<double> gauge; | |
359 | block<double> msoft; | |
360 | matrixblock<3> au; | |
361 | matrixblock<3> ad; | |
362 | matrixblock<3> ae; | |
363 | matrixblock<3> yu; | |
364 | matrixblock<3> yd; | |
365 | matrixblock<3> ye; | |
366 | ||
367 | //*************************** THE SLHA2 BLOCKS ***************************// | |
368 | //Additions to SLHA1 | |
369 | block<double> qextpar; | |
370 | ||
371 | //FLV Input | |
372 | block<double> vckmin; // The input CKM Wolfenstein parms. | |
373 | block<double> upmnsin; // The input PMNS PDG parms. | |
374 | matrixblock<3> msq2in; // The input upper off-diagonal msq2 | |
375 | matrixblock<3> msu2in; // The input upper off-diagonal msu2 | |
376 | matrixblock<3> msd2in; // The input upper off-diagonal msd2 | |
377 | matrixblock<3> msl2in; // The input upper off-diagonal msl2 | |
378 | matrixblock<3> mse2in; // The input upper off-diagonal mse2 | |
379 | matrixblock<3> tuin; // The input upper off-diagonal TU | |
380 | matrixblock<3> tdin; // The input upper off-diagonal TD | |
381 | matrixblock<3> tein; // The input upper off-diagonal TE | |
382 | //FLV Output | |
383 | matrixblock<3> vckm; // The output DRbar running Re{VCKM} at Q | |
384 | matrixblock<3> upmns; // The output DRbar running Re{UPMNS} at Q | |
385 | matrixblock<3> msq2; // The output DRbar running msq2 at Q | |
386 | matrixblock<3> msu2; // The output DRbar running msu2 at Q | |
387 | matrixblock<3> msd2; // The output DRbar running msd2 at Q | |
388 | matrixblock<3> msl2; // The output DRbar running msl2 at Q | |
389 | matrixblock<3> mse2; // The output DRbar running mse2 at Q | |
390 | matrixblock<3> tu; // The output DRbar running TU at Q | |
391 | matrixblock<3> td; // The output DRbar running TD at Q | |
392 | matrixblock<3> te; // The output DRbar running TE at Q | |
393 | matrixblock<6> usqmix; // The Re{} up squark mixing matrix | |
394 | matrixblock<6> dsqmix; // The Re{} down squark mixing matrix | |
395 | matrixblock<6> selmix; // The Re{} selectron mixing matrix | |
396 | matrixblock<3> snumix; // The Re{} sneutrino mixing matrix | |
397 | matrixblock<3> snsmix; // The scalar sneutrino mixing matrix | |
398 | matrixblock<3> snamix; // The pseudoscalar neutrino mixing matrix | |
399 | ||
400 | //RPV Input | |
401 | tensor3block<3> rvlamllein; // The input LNV lambda couplings | |
402 | tensor3block<3> rvlamlqdin; // The input LNV lambda' couplings | |
403 | tensor3block<3> rvlamuddin; // The input BNV lambda'' couplings | |
404 | tensor3block<3> rvtllein; // The input LNV T couplings | |
405 | tensor3block<3> rvtlqdin; // The input LNV T' couplings | |
406 | tensor3block<3> rvtuddin; // The input BNV T'' couplings | |
407 | block<double> rvkappain; // The input LNV kappa couplings | |
408 | block<double> rvdin; // The input LNV D terms | |
409 | block<double> rvm2lh1in; // The input LNV m2LH1 couplings | |
410 | block<double> rvsnvevin; // The input LNV sneutrino vevs | |
411 | //RPV Output | |
412 | tensor3block<3> rvlamlle; // The output LNV lambda couplings | |
413 | tensor3block<3> rvlamlqd; // The output LNV lambda' couplings | |
414 | tensor3block<3> rvlamudd; // The output BNV lambda'' couplings | |
415 | tensor3block<3> rvtlle; // The output LNV T couplings | |
416 | tensor3block<3> rvtlqd; // The output LNV T' couplings | |
417 | tensor3block<3> rvtudd; // The output BNV T'' couplings | |
418 | block<double> rvkappa; // The output LNV kappa couplings | |
419 | block<double> rvd; // The output LNV D terms | |
420 | block<double> rvm2lh1; // The output LNV m2LH1 couplings | |
421 | block<double> rvsnvev; // The output LNV sneutrino vevs | |
422 | matrixblock<7> rvnmix; // The RPV neutralino mixing matrix | |
423 | matrixblock<5> rvumix; // The RPV chargino L mixing matrix | |
424 | matrixblock<5> rvvmix; // The RPV chargino R mixing matrix | |
425 | matrixblock<5> rvhmix; // The RPV neutral scalar mixing matrix | |
426 | matrixblock<5> rvamix; // The RPV neutral pseudoscalar mixing matrix | |
427 | matrixblock<7> rvlmix; // The RPV charged fermion mixing matrix | |
428 | ||
429 | //CPV Input | |
430 | block<double> imminpar; | |
431 | block<double> imextpar; | |
432 | //CPV Output | |
433 | matrixblock<4> cvhmix; // The CPV Higgs mixing matrix | |
434 | matrixblock<4> imcvhmix; // Optional: imaginary components | |
435 | matrixblock<3> imau,imad,imae; // Im{} of AU, AD, AE | |
436 | ||
437 | //CPV + FLV Input | |
438 | matrixblock<3> immsq2in; // The Im{} input upper off-diagonal msq2 | |
439 | matrixblock<3> immsu2in; // The Im{} input upper off-diagonal msu2 | |
440 | matrixblock<3> immsd2in; // The Im{} input upper off-diagonal msd2 | |
441 | matrixblock<3> immsl2in; // The Im{} input upper off-diagonal msl2 | |
442 | matrixblock<3> immse2in; // The Im{} input upper off-diagonal mse2 | |
443 | matrixblock<3> imtuin,imtdin,imtein; // The Im{} input upper off-diagonal T | |
444 | //CPV + FLV Output | |
445 | matrixblock<3> imvckm; // The output DRbar running Im{VCKM} at Q | |
446 | matrixblock<3> imupmns; // The output DRbar running Im{UPMNS} at Q | |
447 | matrixblock<3> immsq2; // The output DRbar running msq2 at Q | |
448 | matrixblock<3> immsu2; // The output DRbar running msu2 at Q | |
449 | matrixblock<3> immsd2; // The output DRbar running msd2 at Q | |
450 | matrixblock<3> immsl2; // The output DRbar running msl2 at Q | |
451 | matrixblock<3> immse2; // The output DRbar running mse2 at Q | |
452 | matrixblock<3> imtu,imtd,imte; // Im{} of TU, TD, TE | |
453 | matrixblock<6> imusqmix;// The Im{} up squark mixing matrix | |
454 | matrixblock<6> imdsqmix; // The Im{} down squark mixing matrix | |
455 | matrixblock<6> imselmix; // The Im{} selectron mixing matrix | |
456 | matrixblock<3> imsnumix; // The Im{} sneutrino mixing matrix | |
457 | matrixblock<4> imnmix; // The Im{} neutralino mixing matrix | |
458 | matrixblock<4> imumix; // The Im{} chargino L mixing matrix | |
459 | matrixblock<4> imvmix; // The Im{} chargino R mixing matrix | |
460 | ||
461 | //NMSSM Input | |
462 | // All input is in EXTPAR | |
463 | //NMSSM Output | |
464 | block<double> nmssmrun; // The block of NMSSM running parameters | |
465 | matrixblock<3> nmhmix; // The NMSSM scalar Higgs mixing | |
466 | matrixblock<3> nmamix; // The NMSSM pseudoscalar Higgs mixing | |
467 | matrixblock<5> nmnmix; // The NMSSM neutralino mixing | |
468 | matrixblock<5> imnmnmix; // Im{} (for future use) | |
469 | ||
470 | //*************************** SET BLOCK VALUE ****************************// | |
471 | template <class T> int set(string,T); | |
472 | template <class T> int set(string,int,T); | |
473 | template <class T> int set(string,int,int,T); | |
474 | template <class T> int set(string,int,int,int,T); | |
475 | ||
476 | //***************************** SLHA PRIVATE *****************************// | |
477 | private: | |
478 | //SLHA I/O | |
479 | string spectrumFile; | |
480 | void message(int, string,string ,int line=0); | |
481 | int verbose; | |
482 | bool headerPrinted, footerPrinted; | |
483 | bool slhaRead, lhefRead, lhefSlha; | |
484 | ||
485 | }; | |
486 | ||
487 | #endif | |
488 | ||
489 |