Line data Source code
1 : // SusyLesHouches.h is a part of the PYTHIA event generator.
2 : // Copyright (C) 2015 Torbjorn Sjostrand.
3 : // Main authors of this file: N. Desai, P. Skands
4 : // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
5 : // Please respect the MCnet Guidelines, see GUIDELINES for details.
6 :
7 : // Header file for SUSY Les Houches Accord functionality
8 : // This part of the SLHA interface basically contains the Pythia-independent
9 : // SLHA read/write and processing utilities, which would be common to any
10 : // SLHA interface.
11 : // (The Pythia-specific components reside in the SLHAinterface class.)
12 :
13 : #ifndef SLHA_H
14 : #define SLHA_H
15 :
16 : // Stdlib header files for string and character manipulation.
17 : #include <string>
18 : #include <cctype>
19 : // Stdlib header files for containers.
20 : #include <vector>
21 : #include <map>
22 : // Stdlib header files for input/output.
23 : #include <iostream>
24 : #include <iomanip>
25 : #include <fstream>
26 : #include <sstream>
27 : // Stdlib header files for mathematics.
28 : #include <cmath>
29 : #include <cstdlib>
30 :
31 : // Stdlib namespace
32 : using namespace std;
33 :
34 : //************************* SLHA AUX CLASSES *****************************//
35 :
36 : namespace Pythia8 {
37 :
38 : //class LHblock: the generic SLHA block (see below for matrices)
39 : //Explicit typing required, e.g. block<double> minpar;
40 0 : template <class T> class LHblock {
41 :
42 : public:
43 :
44 : //Constructor.
45 0 : LHblock<T>() : idnow(0) {} ;
46 :
47 : //Does block exist?
48 0 : bool exists() { return int(entry.size()) == 0 ? false : true ; };
49 : //Clear block
50 : void clear() { entry.clear(); };
51 :
52 : //set: set block entry values.
53 : //Possible return values from set:
54 : // 0: normal return. Entry did not previously exist and has been created.
55 : // 1: normal return. Entry did previously exist and has been overwritten.
56 : //-1: failure.
57 : int set(int iIn,T valIn) {
58 0 : int alreadyexisting=exists(iIn)?1:0;
59 0 : entry[iIn]=valIn;
60 0 : return alreadyexisting;
61 : };
62 : // Read index and value from SLHA data line
63 : int set(istringstream& linestream, bool indexed=true) {
64 0 : i = 0;
65 0 : if (indexed) linestream >> i >> val;
66 0 : else linestream >> val;
67 0 : return linestream ? set(i,val) : -1;
68 : };
69 : // With i already given, read value from remaining SLHA data line
70 : int set(int iIn,istringstream& linestream) {
71 0 : linestream >> val;
72 0 : return linestream ? set(iIn,val) : -1;
73 : };
74 : // Shorthand for entry[0]. Used e.g. for block ALPHA.
75 0 : void set(T valIn) { entry[0]=valIn; };
76 :
77 : // Does entry i already exist in this block?
78 0 : bool exists(int iIn) {return entry.find(iIn) != entry.end()
79 : ? true : false;};
80 :
81 : // Indexing with (). Output only.
82 : T operator()() {
83 0 : if (exists(0)) {return entry[0];} else {T dummy(0); return dummy;};
84 0 : };
85 : T operator()(int iIn) {
86 0 : if (exists(iIn)) {return entry[iIn];} else {T dummy(0); return dummy;};
87 0 : };
88 :
89 : // Size of map
90 0 : int size() {return int(entry.size());};
91 :
92 : // First and next key code
93 0 : int first() { idnow = entry.begin()->first; return idnow; };
94 : int next() {
95 0 : typename map<int,T>::iterator itnow;
96 0 : itnow = ++entry.find(idnow);
97 0 : if ( itnow == entry.end() ) itnow=entry.begin();
98 0 : return idnow = itnow->first;
99 0 : };
100 :
101 : // Simple print utility
102 : void print() {
103 : bool finished=false;
104 : int ibegin=first();
105 : i=ibegin;
106 : while (!finished) {
107 : cout << " "<< i << " " << entry[i] <<endl;
108 : i=next();
109 : if (i == ibegin) finished=true;
110 : };
111 : };
112 :
113 : // Special for DRbar running blocks.
114 0 : void setq(double qIn) { qDRbar=qIn; }
115 0 : double q() { return qDRbar; }
116 :
117 : protected:
118 : map<int,T> entry;
119 :
120 : private:
121 : int idnow;
122 : double qDRbar;
123 : //Auxiliary vars
124 : int i;
125 : T val;
126 : };
127 :
128 : // Derived class for generic blocks containing vectors of strings.
129 0 : class LHgenericBlock : public LHblock<string> {
130 :
131 : public:
132 :
133 : //Constructor.
134 0 : LHgenericBlock() { } ;
135 :
136 : // Read index and value from SLHA data line
137 : int set(string lineIn) {
138 0 : entry[entry.size()] = lineIn;
139 0 : return 0;
140 : };
141 :
142 : };
143 :
144 : // class LHmatrixBlock: the generic SLHA matrix
145 : // Explicit sizing required, e.g.LHmatrixBlock<4> nmix;
146 : template <int size> class LHmatrixBlock {
147 : public:
148 : //Constructor. Set uninitialized and explicitly zero.
149 0 : LHmatrixBlock<size>() {
150 0 : initialized=false;
151 0 : for (i=1;i<=size;i++) {
152 0 : for (j=1;j<=size;j++) {
153 0 : entry[i][j]=0.0;
154 : };
155 : };
156 0 : };
157 :
158 : // Assignment
159 : LHmatrixBlock& operator=(const LHmatrixBlock& m) {
160 : if (this != &m) {
161 : for (i=0;i<size;i++) for (j=0;j<=size;j++) entry[i][j] = m(i,j);
162 : qDRbar = m.qDRbar;
163 : initialized = m.initialized;
164 : }
165 : return *this; };
166 :
167 : // Does this matrix contain any entries?
168 0 : bool exists() { return initialized; };
169 : // Clear initialized flag
170 : void clear() { initialized=false; };
171 :
172 : // Set matrix entry
173 : int set(int iIn,int jIn, double valIn) {
174 0 : if (iIn>0 && jIn>0 && iIn<=size && jIn<=size) {
175 0 : entry[iIn][jIn]=valIn;
176 0 : initialized=true;
177 0 : return 0;
178 : } else {
179 0 : return -1;
180 : };
181 0 : };
182 :
183 : // Set entry from linestream (used during file read)
184 : int set(istringstream& linestream) {
185 0 : linestream >> i >> j >> val;
186 0 : return linestream ? set(i,j,val) : -1;
187 : };
188 :
189 : // () Overloading: Get entry
190 : double operator()(int iIn, int jIn) const {
191 0 : return (iIn <= size && jIn <= size && iIn > 0 && jIn > 0) ?
192 0 : entry[iIn][jIn] : 0.0;
193 : };
194 :
195 : // Set and get scale for DRbar running LHblocks.
196 0 : void setq(double qIn) { qDRbar=qIn; }
197 : double q() { return qDRbar; }
198 :
199 : // Simple print utility, to be elaborated on.
200 : void print() {
201 : for (i=1;i<=size;i++) {
202 : cout << " "<<i << " " ;
203 : for (j=1;j<=size;j++) cout << entry[i][j] << " ";
204 : cout << endl;
205 : };
206 : };
207 :
208 : private:
209 : bool initialized;
210 : double entry[size+1][size+1];
211 : double qDRbar;
212 : //Auxiliary vars
213 : int i,j;
214 : double val;
215 : };
216 :
217 : // class tensorBlock: the generic SLHA tensor
218 : // Explicit sizing required, e.g. tensorBlock<3> rvlam;
219 : template <int size> class LHtensor3Block {
220 : public:
221 : //Constructor. Set uninitialized and explicitly zero.
222 0 : LHtensor3Block<size>() {
223 0 : initialized=false;
224 0 : for (i=1;i<=size;i++) {
225 0 : for (j=1;j<=size;j++) {
226 0 : for (k=1;k<=size;k++) {
227 0 : entry[i][j][k]=0.0;
228 : };
229 : };
230 : };
231 0 : };
232 :
233 : // Assignment
234 : LHtensor3Block& operator=(const LHtensor3Block& m) {
235 : if (this != &m) {
236 : for (i=0;i<size;i++) for (j=0;j<=size;j++) for (k=0;k<=size;k++)
237 : entry[i][j][k] = m(i,j,k);
238 : qDRbar = m.qDRbar;
239 : initialized = m.initialized;
240 : }
241 : return *this; };
242 :
243 : // Does this matrix contain any entries?
244 0 : bool exists() { return initialized; };
245 : // Clear initialized flag
246 : void clear() { initialized=false; };
247 :
248 : // Set matrix entry
249 : int set(int iIn,int jIn, int kIn, double valIn) {
250 0 : if (iIn>0 && jIn>0 && kIn>0 && iIn<=size && jIn<=size && kIn<=size) {
251 0 : entry[iIn][jIn][kIn]=valIn;
252 0 : initialized=true;
253 0 : return 0;
254 : } else {
255 0 : return -1;
256 : };
257 0 : };
258 :
259 : // Set entry from linestream (used during file read)
260 : int set(istringstream& linestream) {
261 0 : linestream >> i >> j >> k >> val;
262 0 : return linestream ? set(i,j,k,val) : -1;
263 : };
264 :
265 : // () Overloading: Get entry
266 : double operator()(int iIn, int jIn, int kIn) const {
267 0 : return (iIn <= size && jIn <= size && kIn <= size && iIn > 0
268 0 : && jIn > 0 && kIn > 0) ? entry[iIn][jIn][kIn] : 0.0;
269 : };
270 :
271 : // Set and get scale for DRbar running LHblocks.
272 0 : void setq(double qIn) { qDRbar=qIn; }
273 : double q() { return qDRbar; }
274 :
275 : // Simple print utility, to be elaborated on.
276 : void print() {
277 : for (i=1;i<=size;i++) {
278 : for (j=1;j<=size;j++) {
279 : cout << " "<<i << " "<<j << " " ;
280 : for (k=1;k<=size;k++) {
281 : cout << entry[i][j][k] << " ";
282 : cout << endl;
283 : };
284 : };
285 : };
286 : };
287 :
288 : private:
289 : bool initialized;
290 : double entry[size+1][size+1][size+1];
291 : double qDRbar;
292 : //Auxiliary vars
293 : int i,j,k;
294 : double val;
295 : };
296 :
297 : //*************************** DECAY TABLES ***************************//
298 :
299 0 : class LHdecayChannel {
300 : public:
301 :
302 0 : LHdecayChannel() : brat(0.0) {};
303 0 : LHdecayChannel(double bratIn, int nDaIn, vector<int> idDaIn,
304 0 : string cIn="") { setChannel(bratIn,nDaIn,idDaIn,cIn);
305 0 : }
306 :
307 : // Functions to set decay channel information
308 : void setChannel(double bratIn, int nDaIn, vector<int> idDaIn,
309 : string cIn="") {
310 0 : brat = bratIn;
311 0 : for (int i=0; i<=nDaIn; i++) {
312 0 : if (i < int(idDaIn.size())) idDa.push_back(idDaIn[i]);
313 0 : comment = cIn;
314 : }
315 0 : }
316 : void setBrat(double bratIn) {brat=bratIn;}
317 : void setIdDa(vector<int> idDaIn) {idDa = idDaIn;}
318 :
319 : // Functions to get decay channel information
320 0 : double getBrat() {return brat;}
321 : int getNDa() {return int(idDa.size());}
322 0 : vector<int> getIdDa() {return idDa;}
323 : string getComment() {return comment;}
324 :
325 : private:
326 : double brat;
327 : vector<int> idDa;
328 : string comment;
329 :
330 : };
331 :
332 0 : class LHdecayTable {
333 : public:
334 :
335 : LHdecayTable() : id(0), width(0.0) {};
336 : LHdecayTable(int idIn) : id(idIn), width(0.0) {};
337 0 : LHdecayTable(int idIn, double widthIn) : id(idIn), width(widthIn) {};
338 :
339 : // Functions to get PDG code (id) and width
340 0 : int getId() {return id;}
341 0 : double getWidth() {return width;}
342 :
343 : // Functions to set PDG code (id) and width
344 : void setId(int idIn) {id = idIn;}
345 0 : void setWidth(double widthIn) {width=widthIn;}
346 :
347 : // Function to reset size and width (width -> 0 by default)
348 : void reset(double widthIn=0.0) {table.resize(0); width=widthIn;}
349 :
350 : // Function to add another decay channel
351 : void addChannel(LHdecayChannel channelIn) {table.push_back(channelIn);}
352 : void addChannel(double bratIn, int nDaIn, vector<int> idDaIn,
353 : string cIn="") {
354 0 : LHdecayChannel newChannel(bratIn, nDaIn, idDaIn, cIn);
355 0 : table.push_back(newChannel);
356 0 : }
357 :
358 : // Function to return number of decay channels
359 0 : int size() {return int(table.size());}
360 :
361 : // Function to return a branching ratio
362 : double getBrat(int iChannel) {
363 : if (iChannel >= 0 && iChannel < int(table.size())) {
364 : return table[iChannel].getBrat();
365 : } else {
366 : return 0.0;
367 : }
368 : }
369 : // Function to return daughter PDG codes
370 : vector<int> getIdDa(int iChannel) {
371 : if (iChannel >= 0 && iChannel < int(table.size())) {
372 : return table[iChannel].getIdDa();
373 : } else {
374 : vector<int> dum;
375 : return dum;
376 : }
377 : }
378 : // Function to return a decay channel
379 : LHdecayChannel getChannel(int iChannel) {
380 0 : if (iChannel >= 0 && iChannel < int(table.size())) {
381 0 : return table[iChannel];
382 : } else {
383 0 : LHdecayChannel dum;
384 : return dum;
385 0 : }
386 0 : }
387 :
388 : private:
389 : int id;
390 : double width;
391 : vector<LHdecayChannel> table;
392 :
393 : };
394 :
395 : //==========================================================================
396 :
397 0 : class SusyLesHouches {
398 :
399 : public:
400 :
401 : //Constructor, with and without filename.
402 0 : SusyLesHouches(int verboseIn=1) : verboseSav(verboseIn),
403 0 : headerPrinted(false), footerPrinted(false), filePrinted(false),
404 0 : slhaRead(false), lhefRead(false), lhefSlha(false), useDecay(true) {};
405 : SusyLesHouches(string filename, int verboseIn=1) : verboseSav(verboseIn),
406 : headerPrinted(false), footerPrinted(false), filePrinted(false),
407 : slhaRead(true), lhefRead(false), lhefSlha(false), useDecay(true)
408 : {readFile(filename);};
409 :
410 : //***************************** SLHA FILE I/O *****************************//
411 : // Read and write SLHA files
412 : int readFile(string slhaFileIn="slha.spc",int verboseIn=1,
413 : bool useDecayIn=true);
414 : int readFile(istream& ,int verboseIn=1,
415 : bool useDecayIn=true);
416 : //int writeFile(string filename): write SLHA file on filename
417 :
418 : //Output utilities
419 : void printHeader(); // print Header
420 : void printFooter(); // print Footer
421 : void printSpectrum(int ifail=0); // print Spectrum
422 :
423 : // Check spectrum and decays
424 : int checkSpectrum();
425 :
426 : // File Name (can be either SLHA or LHEF)
427 : string slhaFile;
428 :
429 : // Class for SLHA data entry
430 : class Entry {
431 :
432 : public:
433 : //Constructor.
434 : Entry() : isIntP(false), isDoubleP(false),
435 : isStringP(false), n(0), d(0.0), s(""), commentP("") {}
436 :
437 : // Generic functions to inquire whether an int, double, or string
438 : bool isInt(){return isIntP;}
439 : bool isDouble(){return isDoubleP;}
440 : bool isString(){return isStringP;}
441 :
442 : // = Overloading: Set entry to int, double, or string
443 : Entry& operator=(double& val) {
444 : d=val;isIntP=false;isDoubleP=true;isStringP=false;
445 : return *this;
446 : };
447 : Entry& operator=(int& val) {
448 : n=val;isIntP=true;isDoubleP=false;isStringP=false;
449 : return *this;
450 : };
451 : Entry& operator=(string& val) {
452 : s=val;isIntP=false;isDoubleP=false;isStringP=true;
453 : return *this;
454 : };
455 :
456 : // Set and Get comment
457 : void setComment(string comment) {commentP=comment;}
458 : void getComment(string comment) {comment=commentP;}
459 :
460 : // Generic functions to get value
461 : bool get(int& val) {val=n; return isIntP;}
462 : bool get(double& val) {val=d; return isDoubleP;}
463 : bool get(string& val) {val=s; return isStringP;}
464 :
465 : private:
466 : bool isIntP, isDoubleP, isStringP;
467 : int n;
468 : double d;
469 : string s;
470 : string commentP;
471 :
472 : };
473 :
474 : //*************************** THE SLHA1 BLOCKS ***************************//
475 : //Blocks for model definition:
476 : LHblock<int> modsel;
477 : LHblock<int> modsel21;
478 : LHblock<double> modsel12;
479 : LHblock<double> minpar;
480 : LHblock<double> extpar;
481 : LHblock<double> sminputs;
482 : //Blocks for RGE program specific output
483 : LHblock<string> spinfo;
484 : LHblock<string> spinfo3;
485 : LHblock<string> spinfo4;
486 : //Blocks for DCY program specific output
487 : LHblock<string> dcinfo;
488 : LHblock<string> dcinfo3;
489 : LHblock<string> dcinfo4;
490 : //Blocks for mass and coupling spectrum
491 : LHblock<double> mass;
492 : LHmatrixBlock<4> nmix;
493 : LHmatrixBlock<2> umix;
494 : LHmatrixBlock<2> vmix;
495 : LHmatrixBlock<2> stopmix;
496 : LHmatrixBlock<2> sbotmix;
497 : LHmatrixBlock<2> staumix;
498 : LHblock<double> alpha;
499 : LHblock<double> hmix;
500 : LHblock<double> gauge;
501 : LHblock<double> msoft;
502 : LHmatrixBlock<3> au;
503 : LHmatrixBlock<3> ad;
504 : LHmatrixBlock<3> ae;
505 : LHmatrixBlock<3> yu;
506 : LHmatrixBlock<3> yd;
507 : LHmatrixBlock<3> ye;
508 :
509 : //************************ THE SLHA1 DECAY TABLES ************************//
510 : vector<LHdecayTable> decays;
511 : map<int,int> decayIndices;
512 :
513 : //********************* THE BSM-SLHA QNUMBERS BLOCKS *********************//
514 : vector< LHblock<int> > qnumbers; // Zero'th entry is PDG code
515 : vector< string > qnumbersName;
516 : vector< string > qnumbersAntiName;
517 :
518 : //*************************** THE SLHA2 BLOCKS ***************************//
519 : //Additions to SLHA1
520 : LHblock<double> qextpar;
521 :
522 : //FLV Input
523 : LHblock<double> vckmin; // The input CKM Wolfenstein parms.
524 : LHblock<double> upmnsin; // The input PMNS PDG parms.
525 : LHmatrixBlock<3> msq2in; // The input upper off-diagonal msq2
526 : LHmatrixBlock<3> msu2in; // The input upper off-diagonal msu2
527 : LHmatrixBlock<3> msd2in; // The input upper off-diagonal msd2
528 : LHmatrixBlock<3> msl2in; // The input upper off-diagonal msl2
529 : LHmatrixBlock<3> mse2in; // The input upper off-diagonal mse2
530 : LHmatrixBlock<3> tuin; // The input upper off-diagonal TU
531 : LHmatrixBlock<3> tdin; // The input upper off-diagonal TD
532 : LHmatrixBlock<3> tein; // The input upper off-diagonal TE
533 : //FLV Output
534 : LHmatrixBlock<3> vckm; // The output DRbar running Re{VCKM} at Q
535 : LHmatrixBlock<3> upmns; // The output DRbar running Re{UPMNS} at Q
536 : LHmatrixBlock<3> msq2; // The output DRbar running msq2 at Q
537 : LHmatrixBlock<3> msu2; // The output DRbar running msu2 at Q
538 : LHmatrixBlock<3> msd2; // The output DRbar running msd2 at Q
539 : LHmatrixBlock<3> msl2; // The output DRbar running msl2 at Q
540 : LHmatrixBlock<3> mse2; // The output DRbar running mse2 at Q
541 : LHmatrixBlock<3> tu; // The output DRbar running TU at Q
542 : LHmatrixBlock<3> td; // The output DRbar running TD at Q
543 : LHmatrixBlock<3> te; // The output DRbar running TE at Q
544 : LHmatrixBlock<6> usqmix; // The Re{} up squark mixing matrix
545 : LHmatrixBlock<6> dsqmix; // The Re{} down squark mixing matrix
546 : LHmatrixBlock<6> selmix; // The Re{} selectron mixing matrix
547 : LHmatrixBlock<3> snumix; // The Re{} sneutrino mixing matrix
548 : LHmatrixBlock<3> snsmix; // The scalar sneutrino mixing matrix
549 : LHmatrixBlock<3> snamix; // The pseudoscalar neutrino mixing matrix
550 :
551 : //RPV Input
552 : LHtensor3Block<3> rvlamllein; // The input LNV lambda couplings
553 : LHtensor3Block<3> rvlamlqdin; // The input LNV lambda' couplings
554 : LHtensor3Block<3> rvlamuddin; // The input BNV lambda'' couplings
555 : LHtensor3Block<3> rvtllein; // The input LNV T couplings
556 : LHtensor3Block<3> rvtlqdin; // The input LNV T' couplings
557 : LHtensor3Block<3> rvtuddin; // The input BNV T'' couplings
558 : LHblock<double> rvkappain; // The input LNV kappa couplings
559 : LHblock<double> rvdin; // The input LNV D terms
560 : LHblock<double> rvm2lh1in; // The input LNV m2LH1 couplings
561 : LHblock<double> rvsnvevin; // The input LNV sneutrino vevs
562 : //RPV Output
563 : LHtensor3Block<3> rvlamlle; // The output LNV lambda couplings
564 : LHtensor3Block<3> rvlamlqd; // The output LNV lambda' couplings
565 : LHtensor3Block<3> rvlamudd; // The output BNV lambda'' couplings
566 : LHtensor3Block<3> rvtlle; // The output LNV T couplings
567 : LHtensor3Block<3> rvtlqd; // The output LNV T' couplings
568 : LHtensor3Block<3> rvtudd; // The output BNV T'' couplings
569 : LHblock<double> rvkappa; // The output LNV kappa couplings
570 : LHblock<double> rvd; // The output LNV D terms
571 : LHblock<double> rvm2lh1; // The output LNV m2LH1 couplings
572 : LHblock<double> rvsnvev; // The output LNV sneutrino vevs
573 : LHmatrixBlock<7> rvnmix; // The RPV neutralino mixing matrix
574 : LHmatrixBlock<5> rvumix; // The RPV chargino L mixing matrix
575 : LHmatrixBlock<5> rvvmix; // The RPV chargino R mixing matrix
576 : LHmatrixBlock<5> rvhmix; // The RPV neutral scalar mixing matrix
577 : LHmatrixBlock<5> rvamix; // The RPV neutral pseudoscalar mixing matrix
578 : LHmatrixBlock<8> rvlmix; // The RPV charged fermion mixing matrix
579 :
580 : //CPV Input
581 : LHblock<double> imminpar;
582 : LHblock<double> imextpar;
583 : //CPV Output
584 : LHmatrixBlock<4> cvhmix; // The CPV Higgs mixing matrix
585 : LHmatrixBlock<4> imcvhmix; // Optional: imaginary components
586 : LHmatrixBlock<3> imau,imad,imae; // Im{} of AU, AD, AE
587 : LHblock<double> imhmix;
588 : LHblock<double> immsoft;
589 :
590 : //CPV + FLV Input
591 : LHmatrixBlock<3> immsq2in; // The Im{} input upper off-diagonal msq2
592 : LHmatrixBlock<3> immsu2in; // The Im{} input upper off-diagonal msu2
593 : LHmatrixBlock<3> immsd2in; // The Im{} input upper off-diagonal msd2
594 : LHmatrixBlock<3> immsl2in; // The Im{} input upper off-diagonal msl2
595 : LHmatrixBlock<3> immse2in; // The Im{} input upper off-diagonal mse2
596 : LHmatrixBlock<3> imtuin,imtdin,imtein; // The Im{} input upper off-diagonal T
597 : //CPV + FLV Output
598 : LHmatrixBlock<3> imvckm; // The output DRbar running Im{VCKM} at Q
599 : LHmatrixBlock<3> imupmns; // The output DRbar running Im{UPMNS} at Q
600 : LHmatrixBlock<3> immsq2; // The output DRbar running msq2 at Q
601 : LHmatrixBlock<3> immsu2; // The output DRbar running msu2 at Q
602 : LHmatrixBlock<3> immsd2; // The output DRbar running msd2 at Q
603 : LHmatrixBlock<3> immsl2; // The output DRbar running msl2 at Q
604 : LHmatrixBlock<3> immse2; // The output DRbar running mse2 at Q
605 : LHmatrixBlock<3> imtu,imtd,imte; // Im{} of TU, TD, TE
606 : LHmatrixBlock<6> imusqmix;// The Im{} up squark mixing matrix
607 : LHmatrixBlock<6> imdsqmix; // The Im{} down squark mixing matrix
608 : LHmatrixBlock<6> imselmix; // The Im{} selectron mixing matrix
609 : LHmatrixBlock<3> imsnumix; // The Im{} sneutrino mixing matrix
610 : LHmatrixBlock<4> imnmix; // The Im{} neutralino mixing matrix
611 : LHmatrixBlock<4> imumix; // The Im{} chargino L mixing matrix
612 : LHmatrixBlock<4> imvmix; // The Im{} chargino R mixing matrix
613 :
614 : //NMSSM Input
615 : // All input is in EXTPAR
616 : //NMSSM Output
617 : LHblock<double> nmssmrun; // The LHblock of NMSSM running parameters
618 : LHmatrixBlock<3> nmhmix; // The NMSSM scalar Higgs mixing
619 : LHmatrixBlock<3> nmamix; // The NMSSM pseudoscalar Higgs mixing
620 : LHmatrixBlock<5> nmnmix; // The NMSSM neutralino mixing
621 : LHmatrixBlock<5> imnmnmix; // Im{} (for future use)
622 :
623 : //*************************** SET BLOCK VALUE ****************************//
624 : template <class T> int set(string,T);
625 : template <class T> int set(string,int,T);
626 : template <class T> int set(string,int,int,T);
627 : template <class T> int set(string,int,int,int,T);
628 :
629 : //********************* GENERIC/USER-DEFINED BLOCKS **********************//
630 : // bool getEntry(name, indices, value)
631 : // = true if LHblock and entry exists (value returned in value,
632 : // typecast by user in call)
633 : // = false otherwise
634 : map<string, LHgenericBlock> genericBlocks;
635 : template <class T> bool getEntry(string, T&);
636 : template <class T> bool getEntry(string, int, T&);
637 : template <class T> bool getEntry(string, int, int, T&);
638 : template <class T> bool getEntry(string, int, int, int, T&);
639 : template <class T> bool getEntry(string, vector<int>, T&);
640 :
641 : // Access/change verbose setting
642 : int verbose() {return verboseSav;}
643 : void verbose(int verboseIn) {verboseSav = verboseIn;}
644 :
645 : // Output of messages from SLHA interface
646 : void message(int, string,string ,int line=0);
647 :
648 : // Convert string to lowercase, removing junk characters
649 : // Copied from PYTHIA 8 Settings class
650 : void toLower(string& name);
651 :
652 : //***************************** SLHA PRIVATE *****************************//
653 : private:
654 : //SLHA I/O
655 : int verboseSav;
656 : bool headerPrinted, footerPrinted, filePrinted;
657 : bool slhaRead, lhefRead, lhefSlha, useDecay;
658 :
659 : };
660 :
661 : //--------------------------------------------------------------------------
662 :
663 : // utilities to set generic blocks
664 :
665 : template <class T> int SusyLesHouches::set(string blockName, T val) {
666 :
667 : // Make sure everything is interpreted as lower case (for safety)
668 : toLower(blockName);
669 :
670 : // Add new generic block if not already existing
671 : if (genericBlocks.find(blockName) == genericBlocks.end()) {
672 : LHgenericBlock gBlock;
673 : genericBlocks[blockName]=gBlock;
674 : }
675 :
676 : // Convert input value to string
677 : ostringstream lineStream;
678 : lineStream << val;
679 : return genericBlocks[blockName].set(lineStream.str());
680 :
681 : }
682 :
683 : template <class T> int SusyLesHouches::set(string blockName, int indx, T val) {
684 :
685 : // Make sure everything is interpreted as lower case (for safety)
686 0 : toLower(blockName);
687 :
688 : // Add new generic block if not already existing
689 0 : if (genericBlocks.find(blockName) == genericBlocks.end()) {
690 0 : LHgenericBlock gBlock;
691 0 : genericBlocks[blockName]=gBlock;
692 0 : }
693 :
694 : // Convert input value to string
695 0 : ostringstream lineStream;
696 0 : lineStream << indx<<" "<<val;
697 0 : return genericBlocks[blockName].set(lineStream.str());
698 :
699 0 : }
700 :
701 : template <class T> int SusyLesHouches::set(string blockName, int indx,
702 : int jndx, T val) {
703 :
704 : // Make sure everything is interpreted as lower case (for safety)
705 : toLower(blockName);
706 :
707 : // Add new generic block if not already existing
708 : if (genericBlocks.find(blockName) == genericBlocks.end()) {
709 : LHgenericBlock gBlock;
710 : genericBlocks[blockName]=gBlock;
711 : }
712 :
713 : // Convert input value to string
714 : ostringstream lineStream;
715 : lineStream << indx<<" "<<jndx<<" "<<val;
716 : return genericBlocks[blockName].set(lineStream.str());
717 :
718 : }
719 :
720 : template <class T> int SusyLesHouches::set(string blockName, int indx,
721 : int jndx, int kndx, T val) {
722 :
723 : // Make sure everything is interpreted as lower case (for safety)
724 : toLower(blockName);
725 :
726 : // Add new generic block if not already existing
727 : if (genericBlocks.find(blockName) == genericBlocks.end()) {
728 : LHgenericBlock gBlock;
729 : genericBlocks[blockName]=gBlock;
730 : }
731 :
732 : // Convert input value to string
733 : ostringstream lineStream;
734 : lineStream << indx<<" "<<jndx<<" "<<kndx<<" "<<val;
735 : return genericBlocks[blockName].set(lineStream.str());
736 :
737 : }
738 :
739 : // utilities to read generic blocks
740 :
741 : template <class T> bool SusyLesHouches::getEntry(string blockName, T& val) {
742 :
743 : // Make sure everything is interpret as lower case (for safety)
744 : toLower(blockName);
745 :
746 : // Safety checks
747 : if (genericBlocks.find(blockName) == genericBlocks.end()) {
748 : message(1,"getEntry","attempting to extract entry from non-existent block "
749 : +blockName);
750 : return false;
751 : }
752 : if (genericBlocks[blockName].size() == 0) {
753 : message(1,"getEntry","attempting to extract entry from zero-size block "
754 : +blockName);
755 : return false;
756 : }
757 : if (genericBlocks[blockName].size() >= 2) {
758 : message(1,"getEntry","attempting to extract un-indexed entry "
759 : "from multi-entry block "+blockName);
760 : return false;
761 : }
762 : // Attempt to extract value as class T
763 : LHgenericBlock block = genericBlocks[blockName];
764 : istringstream linestream(block(0));
765 : linestream >> val;
766 : if ( !linestream ) {
767 : message(1,"getEntry","problem extracting un-indexed entry "
768 : "from block "+blockName);
769 : return false;
770 : }
771 : // If made it all the way here, value was successfully extracted.
772 : // Return true.
773 : return true;
774 : }
775 :
776 : template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
777 : T& val) {
778 :
779 : // Make sure everything is interpret as lower case (for safety)
780 : toLower(blockName);
781 :
782 : // Safety checks
783 : if (genericBlocks.find(blockName) == genericBlocks.end()) {
784 : message(1,"getEntry","attempting to extract entry from non-existent block "
785 : +blockName);
786 : return false;
787 : }
788 : if (genericBlocks[blockName].size() == 0) {
789 : message(1,"getEntry","attempting to extract entry from zero-size block "
790 : +blockName);
791 : return false;
792 : }
793 : // Attempt to extract indexed value as class T
794 : LHgenericBlock block = genericBlocks[blockName];
795 : // Loop over block contents, search for indexed entry with index i
796 : for (int jEntry = 0; jEntry < block.size(); jEntry++) {
797 : istringstream linestream(block(jEntry));
798 : // Buffer line according to format selected by T
799 : int indxNow;
800 : T valNow;
801 : linestream >> indxNow >> valNow;
802 : // If index found and value was readable, return true
803 : if (linestream && indxNow == indx) {
804 : val = valNow;
805 : return true;
806 : }
807 : }
808 : // If index not found or unreadable, return false
809 : message(1,"getEntry","problem extracting indexed entry from block "
810 : +blockName);
811 : return false;
812 : }
813 :
814 : template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
815 : int jndx, T& val) {
816 :
817 : // Make sure everything is interpret as lower case (for safety)
818 : toLower(blockName);
819 :
820 : // Safety checks
821 : if (genericBlocks.find(blockName) == genericBlocks.end()) {
822 : message(1,"getEntry","attempting to extract entry from non-existent block "
823 : +blockName);
824 : return false;
825 : }
826 : if (genericBlocks[blockName].size() == 0) {
827 : message(1,"getEntry","attempting to extract entry from zero-size block "
828 : +blockName);
829 : return false;
830 : }
831 : // Attempt to extract matrix-indexed value as class T
832 : LHgenericBlock block = genericBlocks[blockName];
833 : // Loop over block contents, search for indexed entry with indices i, j
834 : for (int jEntry = 0; jEntry < block.size(); jEntry++) {
835 : istringstream linestream(block(jEntry));
836 : // Buffer line according to format selected by T
837 : int indxNow, jndxNow;
838 : T valNow;
839 : linestream >> indxNow >> jndxNow >> valNow;
840 : // If index found and value was readable, return true
841 : if (linestream && indxNow == indx && jndxNow == jndx) {
842 : val = valNow;
843 : return true;
844 : }
845 : }
846 : // If index not found or unreadable, return false
847 : message(1,"getEntry","problem extracting matrix-indexed entry from block "
848 : +blockName);
849 : return false;
850 : }
851 :
852 : template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
853 : int jndx, int kndx, T& val) {
854 :
855 : // Make sure everything is interpret as lower case (for safety)
856 : toLower(blockName);
857 :
858 : // Safety checks
859 : if (genericBlocks.find(blockName) == genericBlocks.end()) {
860 : message(1,"getEntry","attempting to extract entry from non-existent block "
861 : +blockName);
862 : return false;
863 : }
864 : if (genericBlocks[blockName].size() == 0) {
865 : message(1,"getEntry","attempting to extract entry from zero-size block "
866 : +blockName);
867 : return false;
868 : }
869 : // Attempt to extract tensor-indexed value as class T
870 : LHgenericBlock block = genericBlocks[blockName];
871 : // Loop over block contents, search for indexed entry with indices i, j, k
872 : for (int jEntry = 0; jEntry < block.size(); jEntry++) {
873 : istringstream linestream(block(jEntry));
874 : // Buffer line according to format selected by T
875 : int indxNow, jndxNow, kndxNow;
876 : T valNow;
877 : linestream >> indxNow >> jndxNow >> kndxNow >> valNow;
878 : // If index found and value was readable, return true
879 : if (linestream && indxNow == indx && jndxNow == jndx && kndxNow == kndx) {
880 : val = valNow;
881 : return true;
882 : }
883 : }
884 : // If index not found or unreadable, return false
885 : message(1,"getEntry","problem extracting tensor-indexed entry from block "
886 : +blockName);
887 : return false;
888 : }
889 :
890 : } // end of namespace Pythia8
891 :
892 : #endif
|