StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SusyLesHouches.h
1 // SusyLesHouches.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2020 Torbjorn Sjostrand.
3 // Main authors of this file: N. Desai, P. Skands
4 // PYTHIA is licenced under the GNU GPL v2 or later, 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 Pythia8_SLHA_H
14 #define Pythia8_SLHA_H
15 
16 #include "Pythia8/PythiaStdlib.h"
17 
18 namespace Pythia8 {
19 
20 //==========================================================================
21 
22 //************************* SLHA AUX CLASSES *****************************//
23 
24  //class LHblock: the generic SLHA block (see below for matrices)
25  //Explicit typing required, e.g. block<double> minpar;
26  template <class T> class LHblock {
27 
28  public:
29 
30  //Constructor.
31  LHblock<T>() : idnow(0), qDRbar(), i(), val() {} ;
32 
33  //Does block exist?
34  bool exists() { return int(entry.size()) == 0 ? false : true ; };
35  //Clear block
36  void clear() { entry.clear(); };
37 
38  //set: set block entry values.
39  //Possible return values from set:
40  // 0: normal return. Entry did not previously exist and has been created.
41  // 1: normal return. Entry did previously exist and has been overwritten.
42  //-1: failure.
43  int set(int iIn,T valIn) {
44  int alreadyexisting=exists(iIn)?1:0;
45  entry[iIn]=valIn;
46  return alreadyexisting;
47  };
48  // Read index and value from SLHA data line
49  int set(istringstream& linestream, bool indexed=true) {
50  i = 0;
51  if (indexed) linestream >> i >> val;
52  else linestream >> val;
53  return linestream ? set(i,val) : -1;
54  };
55  // With i already given, read value from remaining SLHA data line
56  int set(int iIn,istringstream& linestream) {
57  linestream >> val;
58  return linestream ? set(iIn,val) : -1;
59  };
60  // Shorthand for entry[0]. Used e.g. for block ALPHA.
61  void set(T valIn) { entry[0]=valIn; };
62 
63  // Does entry i already exist in this block?
64  bool exists(int iIn) {return entry.find(iIn) != entry.end()
65  ? true : false;};
66 
67  // Indexing with (). Output only.
68  T operator()() {
69  if (exists(0)) {return entry[0];} else {T dummy(0); return dummy;};
70  };
71  T operator()(int iIn) {
72  if (exists(iIn)) {return entry[iIn];} else {T dummy(0); return dummy;};
73  };
74 
75  // Size of map
76  int size() {return int(entry.size());};
77 
78  // First and next key code
79  int first() { idnow = entry.begin()->first; return idnow; };
80  int next() {
81  typename map<int,T>::iterator itnow;
82  itnow = ++entry.find(idnow);
83  if ( itnow == entry.end() ) itnow=entry.begin();
84  return idnow = itnow->first;
85  };
86 
87  // Simple print utility
88  void list() {
89  bool finished=false;
90  int ibegin=first();
91  i=ibegin;
92  while (!finished) {
93  cout << " "<< i << " " << entry[i] <<endl;
94  i=next();
95  if (i == ibegin) finished=true;
96  };
97  };
98 
99  // Special for DRbar running blocks.
100  void setq(double qIn) { qDRbar=qIn; }
101  double q() { return qDRbar; }
102 
103  protected:
104  map<int,T> entry;
105 
106  private:
107  int idnow;
108  double qDRbar;
109  //Auxiliary vars
110  int i;
111  T val;
112  };
113 
114  // Derived class for generic blocks containing vectors of strings.
115  class LHgenericBlock : public LHblock<string> {
116 
117  public:
118 
119  //Constructor.
120  LHgenericBlock() { } ;
121 
122  // Read index and value from SLHA data line
123  int set(string lineIn) {
124  entry[entry.size()] = lineIn;
125  return 0;
126  };
127 
128  };
129 
130  // class LHmatrixBlock: the generic SLHA matrix
131  // Explicit sizing required, e.g.LHmatrixBlock<4> nmix;
132  // Note, indexing from 1 is intentional, zeroth column/row not used.
133  template <int size> class LHmatrixBlock {
134  public:
135  //Constructor. Set uninitialized and explicitly zero.
136  LHmatrixBlock<size>() : entry(), qDRbar(), val() {
137  initialized=false;
138  for (i=1;i<=size;i++) {
139  for (j=1;j<=size;j++) {
140  entry[i][j]=0.0;
141  };
142  };
143  };
144 
145  // Copy constructor.
146  LHmatrixBlock(const LHmatrixBlock& m) : val(m.val) {
147  for (i=1;i<=size;i++) for (j=1;j<=size;j++) entry[i][j] = m(i,j);
148  qDRbar = m.qDRbar;
149  initialized = m.initialized; }
150 
151  // Assignment.
152  LHmatrixBlock& operator=(const LHmatrixBlock& m) {
153  if (this != &m) {
154  for (i=1;i<=size;i++) for (j=1;j<=size;j++) entry[i][j] = m(i,j);
155  qDRbar = m.qDRbar;
156  initialized = m.initialized;
157  }
158  return *this; };
159 
160  // Does this matrix contain any entries?
161  bool exists() { return initialized; };
162  // Clear initialized flag
163  void clear() { initialized=false; };
164 
165  // Set matrix entry
166  int set(int iIn,int jIn, double valIn) {
167  if (iIn>0 && jIn>0 && iIn<=size && jIn<=size) {
168  entry[iIn][jIn]=valIn;
169  initialized=true;
170  return 0;
171  } else {
172  return -1;
173  };
174  };
175 
176  // Set entry from linestream (used during file read)
177  int set(istringstream& linestream) {
178  linestream >> i >> j >> val;
179  return linestream ? set(i,j,val) : -1;
180  };
181 
182  // () Overloading: Get entry
183  double operator()(int iIn, int jIn) const {
184  return (iIn <= size && jIn <= size && iIn > 0 && jIn > 0) ?
185  entry[iIn][jIn] : 0.0;
186  };
187 
188  // Set and get scale for DRbar running LHblocks.
189  void setq(double qIn) { qDRbar=qIn; }
190  double q() { return qDRbar; }
191 
192  // Simple print utility, to be elaborated on.
193  void list() {
194  for (i=1;i<=size;i++) {
195  cout << " "<<i << " " ;
196  for (j=1;j<=size;j++) cout << entry[i][j] << " ";
197  cout << endl;
198  };
199  };
200 
201  private:
202  bool initialized;
203  double entry[size+1][size+1];
204  double qDRbar;
205  //Auxiliary vars
206  int i,j;
207  double val;
208  };
209 
210  // class tensorBlock: the generic SLHA tensor
211  // Explicit sizing required, e.g. tensorBlock<3> rvlam;
212  template <int size> class LHtensor3Block {
213  public:
214  //Constructor. Set uninitialized and explicitly zero.
215  LHtensor3Block<size>() : entry(), qDRbar(), val() {
216  initialized=false;
217  for (i=1;i<=size;i++) {
218  for (j=1;j<=size;j++) {
219  for (k=1;k<=size;k++) {
220  entry[i][j][k]=0.0;
221  };
222  };
223  };
224  };
225 
226  // Copy constructor.
227  LHtensor3Block(const LHtensor3Block& m) : val(m.val) {
228  for (i=0;i<size;i++) for (j=0;j<=size;j++) for (k=0;k<=size;k++)
229  entry[i][j][k] = m(i,j,k);
230  qDRbar = m.qDRbar;
231  initialized = m.initialized; };
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  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  if (iIn>0 && jIn>0 && kIn>0 && iIn<=size && jIn<=size && kIn<=size) {
251  entry[iIn][jIn][kIn]=valIn;
252  initialized=true;
253  return 0;
254  } else {
255  return -1;
256  };
257  };
258 
259  // Set entry from linestream (used during file read)
260  int set(istringstream& linestream) {
261  linestream >> i >> j >> k >> val;
262  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  return (iIn <= size && jIn <= size && kIn <= size && iIn > 0
268  && jIn > 0 && kIn > 0) ? entry[iIn][jIn][kIn] : 0.0;
269  };
270 
271  // Set and get scale for DRbar running LHblocks.
272  void setq(double qIn) { qDRbar=qIn; }
273  double q() { return qDRbar; }
274 
275  // Simple print utility, to be elaborated on.
276  void list() {
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  class LHdecayChannel {
300  public:
301 
302  LHdecayChannel() : brat(0.0) {};
303  LHdecayChannel(double bratIn, int nDaIn, vector<int> idDaIn,
304  string cIn="") : brat() { setChannel(bratIn,nDaIn,idDaIn,cIn);
305  }
306 
307  // Functions to set decay channel information
308  void setChannel(double bratIn, int nDaIn, vector<int> idDaIn,
309  string cIn="") {
310  brat = bratIn;
311  for (int i=0; i<=nDaIn; i++) {
312  if (i < int(idDaIn.size())) idDa.push_back(idDaIn[i]);
313  comment = cIn;
314  }
315  }
316  void setBrat(double bratIn) {brat=bratIn;}
317  void setIdDa(vector<int> idDaIn) {idDa = idDaIn;}
318 
319  // Functions to get decay channel information
320  double getBrat() {return brat;}
321  int getNDa() {return int(idDa.size());}
322  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  class LHdecayTable {
333  public:
334 
335  LHdecayTable() : id(0), width(0.0) {};
336  LHdecayTable(int idIn) : id(idIn), width(0.0) {};
337  LHdecayTable(int idIn, double widthIn) : id(idIn), width(widthIn) {};
338 
339  // Functions to get PDG code (id) and width
340  int getId() {return id;}
341  double getWidth() {return width;}
342 
343  // Functions to set PDG code (id) and width
344  void setId(int idIn) {id = idIn;}
345  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  LHdecayChannel newChannel(bratIn, nDaIn, idDaIn, cIn);
355  table.push_back(newChannel);
356  }
357 
358  // Function to return number of decay channels
359  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  if (iChannel >= 0 && iChannel < int(table.size())) {
381  return table[iChannel];
382  } else {
383  LHdecayChannel dum;
384  return dum;
385  }
386  }
387 
388  private:
389  int id;
390  double width;
391  vector<LHdecayChannel> table;
392 
393  };
394 
395 //==========================================================================
396 
397 class SusyLesHouches {
398 
399 public:
400 
401  //Constructor, with and without filename.
402  SusyLesHouches(int verboseIn=1) : verboseSav(verboseIn),
403  headerPrinted(false), footerPrinted(false), filePrinted(false),
404  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 listHeader(); // print Header
420  void listFooter(); // print Footer
421  void listSpectrum(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<double> > 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  //***************************** SLHA PRIVATE *****************************//
649 private:
650  //SLHA I/O
651  int verboseSav;
652  bool headerPrinted, footerPrinted, filePrinted;
653  bool slhaRead, lhefRead, lhefSlha, useDecay;
654 
655 };
656 
657 //--------------------------------------------------------------------------
658 
659 // utilities to set generic blocks
660 
661 template <class T> int SusyLesHouches::set(string blockName, T val) {
662 
663  // Make sure everything is interpreted as lower case (for safety)
664  toLowerRep(blockName);
665 
666  // Add new generic block if not already existing
667  if (genericBlocks.find(blockName) == genericBlocks.end()) {
668  LHgenericBlock gBlock;
669  genericBlocks[blockName]=gBlock;
670  }
671 
672  // Convert input value to string
673  ostringstream lineStream;
674  lineStream << val;
675  return genericBlocks[blockName].set(lineStream.str());
676 
677 }
678 
679 template <class T> int SusyLesHouches::set(string blockName, int indx, T val) {
680 
681  // Make sure everything is interpreted as lower case (for safety)
682  toLowerRep(blockName);
683 
684  // Add new generic block if not already existing
685  if (genericBlocks.find(blockName) == genericBlocks.end()) {
686  LHgenericBlock gBlock;
687  genericBlocks[blockName]=gBlock;
688  }
689 
690  // Convert input value to string
691  ostringstream lineStream;
692  lineStream << indx<<" "<<val;
693  return genericBlocks[blockName].set(lineStream.str());
694 
695 }
696 
697 template <class T> int SusyLesHouches::set(string blockName, int indx,
698  int jndx, T val) {
699 
700  // Make sure everything is interpreted as lower case (for safety)
701  toLowerRep(blockName);
702 
703  // Add new generic block if not already existing
704  if (genericBlocks.find(blockName) == genericBlocks.end()) {
705  LHgenericBlock gBlock;
706  genericBlocks[blockName]=gBlock;
707  }
708 
709  // Convert input value to string
710  ostringstream lineStream;
711  lineStream << indx<<" "<<jndx<<" "<<val;
712  return genericBlocks[blockName].set(lineStream.str());
713 
714 }
715 
716 template <class T> int SusyLesHouches::set(string blockName, int indx,
717  int jndx, int kndx, T val) {
718 
719  // Make sure everything is interpreted as lower case (for safety)
720  toLowerRep(blockName);
721 
722  // Add new generic block if not already existing
723  if (genericBlocks.find(blockName) == genericBlocks.end()) {
724  LHgenericBlock gBlock;
725  genericBlocks[blockName]=gBlock;
726  }
727 
728  // Convert input value to string
729  ostringstream lineStream;
730  lineStream << indx<<" "<<jndx<<" "<<kndx<<" "<<val;
731  return genericBlocks[blockName].set(lineStream.str());
732 
733 }
734 
735 // utilities to read generic blocks
736 
737 template <class T> bool SusyLesHouches::getEntry(string blockName, T& val) {
738 
739  // Make sure everything is interpret as lower case (for safety)
740  toLowerRep(blockName);
741 
742  // Safety checks
743  if (genericBlocks.find(blockName) == genericBlocks.end()) {
744  message(1,"getEntry","attempting to extract entry from non-existent block "
745  +blockName);
746  return false;
747  }
748  if (genericBlocks[blockName].size() == 0) {
749  message(1,"getEntry","attempting to extract entry from zero-size block "
750  +blockName);
751  return false;
752  }
753  if (genericBlocks[blockName].size() >= 2) {
754  message(1,"getEntry","attempting to extract un-indexed entry "
755  "from multi-entry block "+blockName);
756  return false;
757  }
758  // Attempt to extract value as class T
759  LHgenericBlock block = genericBlocks[blockName];
760  istringstream linestream(block(0));
761  linestream >> val;
762  if ( !linestream ) {
763  message(1,"getEntry","problem extracting un-indexed entry "
764  "from block "+blockName);
765  return false;
766  }
767  // If made it all the way here, value was successfully extracted.
768  // Return true.
769  return true;
770 }
771 
772 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
773  T& val) {
774 
775  // Make sure everything is interpret as lower case (for safety)
776  toLowerRep(blockName);
777 
778  // Safety checks
779  if (genericBlocks.find(blockName) == genericBlocks.end()) {
780  message(1,"getEntry","attempting to extract entry from non-existent block "
781  +blockName);
782  return false;
783  }
784  if (genericBlocks[blockName].size() == 0) {
785  message(1,"getEntry","attempting to extract entry from zero-size block "
786  +blockName);
787  return false;
788  }
789  // Attempt to extract indexed value as class T
790  LHgenericBlock block = genericBlocks[blockName];
791  // Loop over block contents, search for indexed entry with index i
792  for (int jEntry = 0; jEntry < block.size(); jEntry++) {
793  istringstream linestream(block(jEntry));
794  // Buffer line according to format selected by T
795  int indxNow;
796  T valNow;
797  linestream >> indxNow >> valNow;
798  // If index found and value was readable, return true
799  if (linestream && indxNow == indx) {
800  val = valNow;
801  return true;
802  }
803  }
804  // If index not found or unreadable, return false
805  message(1,"getEntry","problem extracting indexed entry from block "
806  +blockName);
807  return false;
808 }
809 
810 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
811  int jndx, T& val) {
812 
813  // Make sure everything is interpret as lower case (for safety)
814  toLowerRep(blockName);
815 
816  // Safety checks
817  if (genericBlocks.find(blockName) == genericBlocks.end()) {
818  message(1,"getEntry","attempting to extract entry from non-existent block "
819  +blockName);
820  return false;
821  }
822  if (genericBlocks[blockName].size() == 0) {
823  message(1,"getEntry","attempting to extract entry from zero-size block "
824  +blockName);
825  return false;
826  }
827  // Attempt to extract matrix-indexed value as class T
828  LHgenericBlock block = genericBlocks[blockName];
829  // Loop over block contents, search for indexed entry with indices i, j
830  for (int jEntry = 0; jEntry < block.size(); jEntry++) {
831  istringstream linestream(block(jEntry));
832  // Buffer line according to format selected by T
833  int indxNow, jndxNow;
834  T valNow;
835  linestream >> indxNow >> jndxNow >> valNow;
836  // If index found and value was readable, return true
837  if (linestream && indxNow == indx && jndxNow == jndx) {
838  val = valNow;
839  return true;
840  }
841  }
842  // If index not found or unreadable, return false
843  message(1,"getEntry","problem extracting matrix-indexed entry from block "
844  +blockName);
845  return false;
846 }
847 
848 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
849  int jndx, int kndx, T& val) {
850 
851  // Make sure everything is interpret as lower case (for safety)
852  toLowerRep(blockName);
853 
854  // Safety checks
855  if (genericBlocks.find(blockName) == genericBlocks.end()) {
856  message(1,"getEntry","attempting to extract entry from non-existent block "
857  +blockName);
858  return false;
859  }
860  if (genericBlocks[blockName].size() == 0) {
861  message(1,"getEntry","attempting to extract entry from zero-size block "
862  +blockName);
863  return false;
864  }
865  // Attempt to extract tensor-indexed value as class T
866  LHgenericBlock block = genericBlocks[blockName];
867  // Loop over block contents, search for indexed entry with indices i, j, k
868  for (int jEntry = 0; jEntry < block.size(); jEntry++) {
869  istringstream linestream(block(jEntry));
870  // Buffer line according to format selected by T
871  int indxNow, jndxNow, kndxNow;
872  T valNow;
873  linestream >> indxNow >> jndxNow >> kndxNow >> valNow;
874  // If index found and value was readable, return true
875  if (linestream && indxNow == indx && jndxNow == jndx && kndxNow == kndx) {
876  val = valNow;
877  return true;
878  }
879  }
880  // If index not found or unreadable, return false
881  message(1,"getEntry","problem extracting tensor-indexed entry from block "
882  +blockName);
883  return false;
884  }
885 
886 //==========================================================================
887 
888 
889 } // end of namespace Pythia8
890 
891 #endif // end Pythia8_SLHA_H