Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:32

0001 // SusyLesHouches.h is a part of the PYTHIA event generator.
0002 // Copyright (C) 2024 Torbjorn Sjostrand.
0003 // Main authors of this file: N. Desai, P. Skands
0004 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
0005 // Please respect the MCnet Guidelines, see GUIDELINES for details.
0006 
0007 // Header file for SUSY Les Houches Accord functionality
0008 // This part of the SLHA interface basically contains the Pythia-independent
0009 // SLHA read/write and processing utilities, which would be common to any
0010 // SLHA interface.
0011 // (The Pythia-specific components reside in the SLHAinterface class.)
0012 
0013 #ifndef Pythia8_SLHA_H
0014 #define Pythia8_SLHA_H
0015 
0016 #include "Pythia8/PythiaStdlib.h"
0017 
0018 namespace Pythia8 {
0019 
0020 //==========================================================================
0021 
0022 //************************* SLHA AUX CLASSES *****************************//
0023 
0024   //class LHblock: the generic SLHA block (see below for matrices)
0025   //Explicit typing required, e.g. block<double> minpar;
0026   template <class T> class LHblock {
0027 
0028   public:
0029 
0030     //Constructor.
0031     LHblock() : idnow(0), qDRbar(), i(), val() {} ;
0032 
0033     //Does block exist?
0034     bool exists() { return int(entry.size()) == 0 ? false : true ; };
0035     //Clear block
0036     void clear() { entry.clear(); };
0037 
0038     //set: set block entry values.
0039     //Possible return values from set:
0040     // 0: normal return. Entry did not previously exist and has been created.
0041     // 1: normal return. Entry did previously exist and has been overwritten.
0042     //-1: failure.
0043     int set(int iIn,T valIn) {
0044       int alreadyexisting=exists(iIn)?1:0;
0045       entry[iIn]=valIn;
0046       return alreadyexisting;
0047     };
0048     // Read index and value from SLHA data line
0049     int set(istringstream& linestream, bool indexed=true) {
0050       i = 0;
0051       if (indexed) linestream >> i >> val;
0052       else linestream >> val;
0053       return linestream ? set(i,val) : -1;
0054     };
0055     // With i already given, read value from remaining SLHA data line
0056     int set(int iIn,istringstream& linestream) {
0057       linestream >> val;
0058       return linestream ? set(iIn,val) : -1;
0059     };
0060     // Shorthand for entry[0]. Used e.g. for block ALPHA.
0061     void set(T valIn) { entry[0]=valIn; };
0062 
0063     // Does entry i already exist in this block?
0064     bool exists(int iIn) {return entry.find(iIn) != entry.end()
0065       ? true : false;};
0066 
0067     // Indexing with (). Output only.
0068     T operator()() {return exists(0) ? entry[0] : T();}
0069     T operator()(int iIn) {return exists(iIn) ? entry[iIn] : T();}
0070 
0071     // Size of map.
0072     int size() {return int(entry.size());};
0073 
0074     // First and next key code.
0075     int first() { idnow = entry.begin()->first; return idnow; };
0076     int next() {
0077       typename map<int,T>::iterator itnow;
0078       itnow = ++entry.find(idnow);
0079       if ( itnow == entry.end() ) itnow=entry.begin();
0080       return idnow = itnow->first;
0081     };
0082 
0083     // Simple print utility.
0084     void list() {
0085       bool finished=false;
0086       int ibegin=first();
0087       i=ibegin;
0088       while (!finished) {
0089         cout << "  "<< i << " " << entry[i] <<endl;
0090         i=next();
0091         if (i == ibegin) finished=true;
0092       };
0093     };
0094 
0095     // Special for DRbar running blocks.
0096     void setq(double qIn) { qDRbar=qIn; }
0097     double q() { return qDRbar; }
0098 
0099   protected:
0100     map<int,T> entry;
0101 
0102   private:
0103     int idnow;
0104     double qDRbar;
0105     //Auxiliary vars
0106     int i;
0107     T val;
0108   };
0109 
0110   // Derived class for generic blocks containing vectors of strings.
0111   class LHgenericBlock : public LHblock<string> {
0112 
0113   public:
0114 
0115     //Constructor.
0116     LHgenericBlock() { } ;
0117 
0118     // Read index and value from SLHA data line
0119     int set(string lineIn) {
0120       entry[entry.size()] = lineIn;
0121       return 0;
0122     };
0123 
0124   };
0125 
0126   // class LHmatrixBlock: the generic SLHA matrix
0127   // Explicit sizing required, e.g.LHmatrixBlock<4> nmix;
0128   // Note, indexing from 1 is intentional, zeroth column/row not used.
0129   template <int size> class LHmatrixBlock {
0130   public:
0131     //Constructor. Set uninitialized and explicitly zero.
0132     LHmatrixBlock() : entry(), qDRbar(), val() {
0133       initialized=false;
0134       for (i=1;i<=size;i++) {
0135         for (j=1;j<=size;j++) {
0136           entry[i][j]=0.0;
0137         };
0138       };
0139     };
0140 
0141     // Copy constructor.
0142     LHmatrixBlock(const LHmatrixBlock& m) : val(m.val) {
0143       for (i=1;i<=size;i++) for (j=1;j<=size;j++) entry[i][j] = m(i,j);
0144       qDRbar = m.qDRbar;
0145       initialized = m.initialized; }
0146 
0147     // Assignment.
0148     LHmatrixBlock& operator=(const LHmatrixBlock& m) {
0149       if (this != &m) {
0150         for (i=1;i<=size;i++) for (j=1;j<=size;j++) entry[i][j] = m(i,j);
0151         qDRbar = m.qDRbar;
0152         initialized = m.initialized;
0153       }
0154       return *this; };
0155 
0156     // Does this matrix contain any entries?
0157     bool exists() { return initialized; };
0158     // Clear initialized flag
0159     void clear() { initialized=false; };
0160 
0161     // Set matrix entry
0162     int set(int iIn,int jIn, double valIn) {
0163       if (iIn>0 && jIn>0 && iIn<=size && jIn<=size) {
0164         entry[iIn][jIn]=valIn;
0165         initialized=true;
0166         return 0;
0167       } else {
0168         return -1;
0169       };
0170     };
0171 
0172     // Set entry from linestream (used during file read)
0173     int set(istringstream& linestream) {
0174       linestream >> i >> j >> val;
0175       return linestream ? set(i,j,val) : -1;
0176     };
0177 
0178     // () Overloading: Get entry
0179     double operator()(int iIn, int jIn) const {
0180       return (iIn <= size && jIn <= size && iIn > 0 && jIn > 0) ?
0181         entry[iIn][jIn] : 0.0;
0182     };
0183 
0184     // Set and get scale for DRbar running LHblocks.
0185     void setq(double qIn) { qDRbar=qIn; }
0186     double q() { return qDRbar; }
0187 
0188     // Simple print utility, to be elaborated on.
0189     void list() {
0190       for (i=1;i<=size;i++) {
0191         cout << "   "<<i << " " ;
0192         for (j=1;j<=size;j++) cout << entry[i][j] << " ";
0193         cout << endl;
0194       };
0195     };
0196 
0197   private:
0198     bool initialized;
0199     double entry[size+1][size+1];
0200     double qDRbar;
0201     //Auxiliary vars
0202     int i,j;
0203     double val;
0204   };
0205 
0206   // class tensorBlock: the generic SLHA tensor
0207   // Explicit sizing required, e.g. tensorBlock<3> rvlam;
0208   template <int size> class LHtensor3Block {
0209   public:
0210     //Constructor. Set uninitialized and explicitly zero.
0211     LHtensor3Block() : entry(), qDRbar(), val() {
0212       initialized=false;
0213       for (i=1;i<=size;i++) {
0214         for (j=1;j<=size;j++) {
0215           for (k=1;k<=size;k++) {
0216             entry[i][j][k]=0.0;
0217           };
0218         };
0219       };
0220     };
0221 
0222     // Copy constructor.
0223     LHtensor3Block(const LHtensor3Block& m) : val(m.val) {
0224       for (i=0;i<=size;i++) for (j=0;j<=size;j++) for (k=0;k<=size;k++)
0225         entry[i][j][k] = m(i,j,k);
0226       qDRbar = m.qDRbar;
0227       initialized = m.initialized; };
0228 
0229     // Assignment.
0230     LHtensor3Block& operator=(const LHtensor3Block& m) {
0231       if (this != &m) {
0232         for (i=0;i<=size;i++) for (j=0;j<=size;j++) for (k=0;k<=size;k++)
0233           entry[i][j][k] = m(i,j,k);
0234         qDRbar = m.qDRbar;
0235         initialized = m.initialized;
0236       }
0237       return *this; };
0238 
0239     // Does this matrix contain any entries?
0240     bool exists() { return initialized; };
0241     // Clear initialized flag
0242     void clear() { initialized=false; };
0243 
0244     // Set matrix entry
0245     int set(int iIn,int jIn, int kIn, double valIn) {
0246       if (iIn>0 && jIn>0 && kIn>0 && iIn<=size && jIn<=size && kIn<=size) {
0247         entry[iIn][jIn][kIn]=valIn;
0248         initialized=true;
0249         return 0;
0250       } else {
0251         return -1;
0252       };
0253     };
0254 
0255     // Set entry from linestream (used during file read)
0256     int set(istringstream& linestream) {
0257       linestream >> i >> j >> k >> val;
0258       return linestream ? set(i,j,k,val) : -1;
0259     };
0260 
0261     // () Overloading: Get entry
0262     double operator()(int iIn, int jIn, int kIn) const {
0263       return (iIn <= size && jIn <= size && kIn <= size && iIn > 0
0264         && jIn > 0 && kIn > 0) ? entry[iIn][jIn][kIn] : 0.0;
0265     };
0266 
0267     // Set and get scale for DRbar running LHblocks.
0268     void setq(double qIn) { qDRbar=qIn; }
0269     double q() { return qDRbar; }
0270 
0271     // Simple print utility, to be elaborated on.
0272     void list() {
0273       for (i=1;i<=size;i++) {
0274         for (j=1;j<=size;j++) {
0275           cout << "   "<<i << " "<<j << " " ;
0276           for (k=1;k<=size;k++) {
0277             cout << entry[i][j][k] << " ";
0278             cout << endl;
0279           };
0280         };
0281       };
0282     };
0283 
0284   private:
0285     bool initialized;
0286     double entry[size+1][size+1][size+1];
0287     double qDRbar;
0288     //Auxiliary vars
0289     int i,j,k;
0290     double val;
0291   };
0292 
0293   //*************************** DECAY TABLES ***************************//
0294 
0295   class LHdecayChannel {
0296   public:
0297 
0298     LHdecayChannel() : brat(0.0) {};
0299     LHdecayChannel(double bratIn, int nDaIn, vector<int> idDaIn,
0300       string cIn="") : brat() { setChannel(bratIn,nDaIn,idDaIn,cIn);
0301     }
0302 
0303     // Functions to set decay channel information
0304     void setChannel(double bratIn, int nDaIn, vector<int> idDaIn,
0305       string cIn="") {
0306       brat    = bratIn;
0307       for (int i=0; i<=nDaIn; i++) {
0308         if (i < int(idDaIn.size())) idDa.push_back(idDaIn[i]);
0309         comment = cIn;
0310       }
0311     }
0312     void setBrat(double bratIn) {brat=bratIn;}
0313     void setIdDa(vector<int> idDaIn) {idDa = idDaIn;}
0314 
0315     // Functions to get decay channel information
0316     double getBrat() {return brat;}
0317     int getNDa() {return int(idDa.size());}
0318     vector<int> getIdDa() {return idDa;}
0319     string getComment() {return comment;}
0320 
0321   private:
0322     double brat;
0323     vector<int> idDa;
0324     string comment;
0325 
0326   };
0327 
0328   class LHdecayTable {
0329   public:
0330 
0331   LHdecayTable() : id(0), width(0.0) {};
0332   LHdecayTable(int idIn) : id(idIn), width(0.0) {};
0333   LHdecayTable(int idIn, double widthIn) : id(idIn), width(widthIn) {};
0334 
0335     // Functions to get PDG code (id) and width
0336     int    getId() {return id;}
0337     double getWidth() {return width;}
0338 
0339     // Functions to set PDG code (id) and width
0340     void setId(int idIn) {id = idIn;}
0341     void setWidth(double widthIn) {width=widthIn;}
0342 
0343     // Function to reset size and width (width -> 0 by default)
0344     void reset(double widthIn=0.0) {table.resize(0); width=widthIn;}
0345 
0346     // Function to add another decay channel
0347     void addChannel(LHdecayChannel channelIn) {table.push_back(channelIn);}
0348     void addChannel(double bratIn, int nDaIn, vector<int> idDaIn,
0349       string cIn="") {
0350       LHdecayChannel newChannel(bratIn, nDaIn, idDaIn, cIn);
0351       table.push_back(newChannel);
0352     }
0353 
0354     // Function to return number of decay channels
0355     int size() {return int(table.size());}
0356 
0357     // Function to return a branching ratio
0358     double getBrat(int iChannel) {
0359       if (iChannel >= 0 && iChannel < int(table.size())) {
0360         return table[iChannel].getBrat();
0361       } else {
0362         return 0.0;
0363       }
0364     }
0365     // Function to return daughter PDG codes
0366     vector<int> getIdDa(int iChannel) {
0367       if (iChannel >= 0 && iChannel < int(table.size())) {
0368         return table[iChannel].getIdDa();
0369       } else {
0370         vector<int> dum;
0371         return dum;
0372       }
0373     }
0374     // Function to return a decay channel
0375     LHdecayChannel getChannel(int iChannel) {
0376       if (iChannel >= 0 && iChannel < int(table.size())) {
0377         return table[iChannel];
0378       } else {
0379         LHdecayChannel dum;
0380         return dum;
0381       }
0382     }
0383 
0384   private:
0385     int id;
0386     double width;
0387     vector<LHdecayChannel> table;
0388 
0389   };
0390 
0391 //==========================================================================
0392 
0393 class SusyLesHouches {
0394 
0395 public:
0396 
0397   // Constructor, with and without filename.
0398   SusyLesHouches(int verboseIn=1) : verboseSav(verboseIn),
0399     headerPrinted(false), footerPrinted(false), filePrinted(false),
0400     slhaRead(false), lhefRead(false), lhefSlha(false), useDecay(true) {};
0401   SusyLesHouches(string filename, int verboseIn=1) : verboseSav(verboseIn),
0402     headerPrinted(false), footerPrinted(false), filePrinted(false),
0403     slhaRead(true), lhefRead(false), lhefSlha(false), useDecay(true) {
0404     readFile(filename);};
0405 
0406   //***************************** SLHA FILE I/O *****************************//
0407   // Read and write SLHA files
0408   int readFile(string slhaFileIn="slha.spc",int verboseIn=1,
0409     bool useDecayIn=true);
0410   int readFile(istream& ,int verboseIn=1,
0411     bool useDecayIn=true);
0412 
0413   //Output utilities
0414   void listHeader();   // print Header
0415   void listFooter();   // print Footer
0416   void listSpectrum(int ifail=0); // print Spectrum
0417 
0418   // Check spectrum and decays
0419   int checkSpectrum();
0420 
0421   // File Name (can be either SLHA or LHEF)
0422   string slhaFile;
0423 
0424   // Class for SLHA data entry
0425   class Entry {
0426 
0427   public:
0428     //Constructor.
0429     Entry() : isIntP(false), isDoubleP(false),
0430       isStringP(false), n(0), d(0.0), s(""), commentP("") {}
0431 
0432     // Generic functions to inquire whether an int, double, or string
0433     bool isInt(){return isIntP;}
0434     bool isDouble(){return isDoubleP;}
0435     bool isString(){return isStringP;}
0436 
0437     // = Overloading: Set entry to int, double, or string
0438     Entry& operator=(double& val)  {
0439       d=val;isIntP=false;isDoubleP=true;isStringP=false;
0440       return *this;
0441     };
0442     Entry& operator=(int& val)  {
0443       n=val;isIntP=true;isDoubleP=false;isStringP=false;
0444       return *this;
0445     };
0446     Entry& operator=(string& val)  {
0447       s=val;isIntP=false;isDoubleP=false;isStringP=true;
0448       return *this;
0449     };
0450 
0451     // Set and Get comment
0452     void setComment(string comment) {commentP=comment;}
0453     void getComment(string& comment) {comment=commentP;}
0454 
0455     // Generic functions to get value
0456     bool get(int& val) {val=n; return isIntP;}
0457     bool get(double& val) {val=d; return isDoubleP;}
0458     bool get(string& val) {val=s; return isStringP;}
0459 
0460   private:
0461     bool isIntP, isDoubleP, isStringP;
0462     int n;
0463     double d;
0464     string s;
0465     string commentP;
0466 
0467   };
0468 
0469   //*************************** THE SLHA1 BLOCKS ***************************//
0470   //Blocks for model definition:
0471   LHblock<int> modsel;
0472   LHblock<int> modsel21;
0473   LHblock<double> modsel12;
0474   LHblock<double> minpar;
0475   LHblock<double> extpar;
0476   LHblock<double> sminputs;
0477   //Blocks for RGE program specific output
0478   LHblock<string> spinfo;
0479   LHblock<string> spinfo3;
0480   LHblock<string> spinfo4;
0481   //Blocks for DCY program specific output
0482   LHblock<string> dcinfo;
0483   LHblock<string> dcinfo3;
0484   LHblock<string> dcinfo4;
0485   //Blocks for mass and coupling spectrum
0486   LHblock<double> mass;
0487   LHmatrixBlock<4> nmix;
0488   LHmatrixBlock<2> umix;
0489   LHmatrixBlock<2> vmix;
0490   LHmatrixBlock<2> stopmix;
0491   LHmatrixBlock<2> sbotmix;
0492   LHmatrixBlock<2> staumix;
0493   LHblock<double> alpha;
0494   LHblock<double> hmix;
0495   LHblock<double> gauge;
0496   LHblock<double> msoft;
0497   LHmatrixBlock<3> au;
0498   LHmatrixBlock<3> ad;
0499   LHmatrixBlock<3> ae;
0500   LHmatrixBlock<3> yu;
0501   LHmatrixBlock<3> yd;
0502   LHmatrixBlock<3> ye;
0503 
0504   //************************ THE SLHA1 DECAY TABLES ************************//
0505   vector<LHdecayTable> decays;
0506   map<int,int> decayIndices;
0507 
0508   //********************* THE BSM-SLHA QNUMBERS BLOCKS *********************//
0509   vector< LHblock<double> > qnumbers;     // Zero'th entry is PDG code
0510   vector< string > qnumbersName;
0511   vector< string > qnumbersAntiName;
0512 
0513   //*************************** THE SLHA2 BLOCKS ***************************//
0514   //Additions to SLHA1
0515   LHblock<double> qextpar;
0516 
0517   //FLV Input
0518   LHblock<double> vckmin;  // The input CKM Wolfenstein parms.
0519   LHblock<double> upmnsin; // The input PMNS PDG parms.
0520   LHmatrixBlock<3> msq2in; // The input upper off-diagonal msq2
0521   LHmatrixBlock<3> msu2in; // The input upper off-diagonal msu2
0522   LHmatrixBlock<3> msd2in; // The input upper off-diagonal msd2
0523   LHmatrixBlock<3> msl2in; // The input upper off-diagonal msl2
0524   LHmatrixBlock<3> mse2in; // The input upper off-diagonal mse2
0525   LHmatrixBlock<3> tuin;   // The input upper off-diagonal TU
0526   LHmatrixBlock<3> tdin;   // The input upper off-diagonal TD
0527   LHmatrixBlock<3> tein;   // The input upper off-diagonal TE
0528   //FLV Output
0529   LHmatrixBlock<3> vckm;    // The output DRbar running Re{VCKM} at Q
0530   LHmatrixBlock<3> upmns;   // The output DRbar running Re{UPMNS} at Q
0531   LHmatrixBlock<3> msq2;    // The output DRbar running msq2 at Q
0532   LHmatrixBlock<3> msu2;    // The output DRbar running msu2 at Q
0533   LHmatrixBlock<3> msd2;    // The output DRbar running msd2 at Q
0534   LHmatrixBlock<3> msl2;    // The output DRbar running msl2 at Q
0535   LHmatrixBlock<3> mse2;    // The output DRbar running mse2 at Q
0536   LHmatrixBlock<3> tu;      // The output DRbar running TU at Q
0537   LHmatrixBlock<3> td;      // The output DRbar running TD at Q
0538   LHmatrixBlock<3> te;      // The output DRbar running TE at Q
0539   LHmatrixBlock<6> usqmix;  // The Re{} up squark mixing matrix
0540   LHmatrixBlock<6> dsqmix;   // The Re{} down squark mixing matrix
0541   LHmatrixBlock<6> selmix;   // The Re{} selectron mixing matrix
0542   LHmatrixBlock<3> snumix;   // The Re{} sneutrino mixing matrix
0543   LHmatrixBlock<3> snsmix;   // The scalar sneutrino mixing matrix
0544   LHmatrixBlock<3> snamix;   // The pseudoscalar neutrino mixing matrix
0545 
0546   //RPV Input
0547   LHtensor3Block<3> rvlamllein; // The input LNV lambda couplings
0548   LHtensor3Block<3> rvlamlqdin; // The input LNV lambda' couplings
0549   LHtensor3Block<3> rvlamuddin; // The input BNV lambda'' couplings
0550   LHtensor3Block<3> rvtllein;   // The input LNV T couplings
0551   LHtensor3Block<3> rvtlqdin;   // The input LNV T' couplings
0552   LHtensor3Block<3> rvtuddin;   // The input BNV T'' couplings
0553   LHblock<double> rvkappain;    // The input LNV kappa couplings
0554   LHblock<double> rvdin;        // The input LNV D terms
0555   LHblock<double> rvm2lh1in;    // The input LNV m2LH1 couplings
0556   LHblock<double> rvsnvevin;    // The input LNV sneutrino vevs
0557   //RPV Output
0558   LHtensor3Block<3> rvlamlle;   // The output LNV lambda couplings
0559   LHtensor3Block<3> rvlamlqd;   // The output LNV lambda' couplings
0560   LHtensor3Block<3> rvlamudd;   // The output BNV lambda'' couplings
0561   LHtensor3Block<3> rvtlle;     // The output LNV T couplings
0562   LHtensor3Block<3> rvtlqd;     // The output LNV T' couplings
0563   LHtensor3Block<3> rvtudd;     // The output BNV T'' couplings
0564   LHblock<double> rvkappa;      // The output LNV kappa couplings
0565   LHblock<double> rvd;          // The output LNV D terms
0566   LHblock<double> rvm2lh1;      // The output LNV m2LH1 couplings
0567   LHblock<double> rvsnvev;      // The output LNV sneutrino vevs
0568   LHmatrixBlock<7> rvnmix;      // The RPV neutralino mixing matrix
0569   LHmatrixBlock<5> rvumix;      // The RPV chargino L mixing matrix
0570   LHmatrixBlock<5> rvvmix;      // The RPV chargino R mixing matrix
0571   LHmatrixBlock<5> rvhmix;      // The RPV neutral scalar mixing matrix
0572   LHmatrixBlock<5> rvamix;      // The RPV neutral pseudoscalar mixing matrix
0573   LHmatrixBlock<8> rvlmix;      // The RPV charged fermion mixing matrix
0574 
0575   //CPV Input
0576   LHblock<double> imminpar;
0577   LHblock<double> imextpar;
0578   //CPV Output
0579   LHmatrixBlock<4> cvhmix;   // The CPV Higgs mixing matrix
0580   LHmatrixBlock<4> imcvhmix; // Optional: imaginary components
0581   LHmatrixBlock<3> imau,imad,imae; // Im{} of AU, AD, AE
0582   LHblock<double> imhmix;
0583   LHblock<double> immsoft;
0584 
0585   //CPV + FLV Input
0586   LHmatrixBlock<3> immsq2in;  // The Im{} input upper off-diagonal msq2
0587   LHmatrixBlock<3> immsu2in;  // The Im{} input upper off-diagonal msu2
0588   LHmatrixBlock<3> immsd2in;  // The Im{} input upper off-diagonal msd2
0589   LHmatrixBlock<3> immsl2in;  // The Im{} input upper off-diagonal msl2
0590   LHmatrixBlock<3> immse2in;  // The Im{} input upper off-diagonal mse2
0591   LHmatrixBlock<3> imtuin,imtdin,imtein; // The Im{} input upper off-diagonal T
0592   //CPV + FLV Output
0593   LHmatrixBlock<3> imvckm;  // The output DRbar running Im{VCKM} at Q
0594   LHmatrixBlock<3> imupmns; // The output DRbar running Im{UPMNS} at Q
0595   LHmatrixBlock<3> immsq2;  // The output DRbar running msq2 at Q
0596   LHmatrixBlock<3> immsu2;  // The output DRbar running msu2 at Q
0597   LHmatrixBlock<3> immsd2;  // The output DRbar running msd2 at Q
0598   LHmatrixBlock<3> immsl2;  // The output DRbar running msl2 at Q
0599   LHmatrixBlock<3> immse2;  // The output DRbar running mse2 at Q
0600   LHmatrixBlock<3> imtu,imtd,imte; // Im{} of TU, TD, TE
0601   LHmatrixBlock<6> imusqmix;// The Im{} up squark mixing matrix
0602   LHmatrixBlock<6> imdsqmix; // The Im{} down squark mixing matrix
0603   LHmatrixBlock<6> imselmix; // The Im{} selectron mixing matrix
0604   LHmatrixBlock<3> imsnumix; // The Im{} sneutrino mixing matrix
0605   LHmatrixBlock<4> imnmix;   // The Im{} neutralino mixing matrix
0606   LHmatrixBlock<4> imumix;   // The Im{} chargino L mixing matrix
0607   LHmatrixBlock<4> imvmix;   // The Im{} chargino R mixing matrix
0608 
0609   //NMSSM Input
0610   //    All input is in EXTPAR
0611   //NMSSM Output
0612   LHblock<double> nmssmrun;  // The LHblock of NMSSM running parameters
0613   LHmatrixBlock<3> nmhmix;   // The NMSSM scalar Higgs mixing
0614   LHmatrixBlock<3> nmamix;   // The NMSSM pseudoscalar Higgs mixing
0615   LHmatrixBlock<5> nmnmix;   // The NMSSM neutralino mixing
0616   LHmatrixBlock<5> imnmnmix; //   Im{} (for future use)
0617 
0618   //*************************** SET BLOCK VALUE ****************************//
0619   template <class T> int set(string,T);
0620   template <class T> int set(string,int,T);
0621   template <class T> int set(string,int,int,T);
0622   template <class T> int set(string,int,int,int,T);
0623 
0624   //********************* GENERIC/USER-DEFINED BLOCKS **********************//
0625   // bool getEntry(name, indices, value)
0626   //      = true if LHblock and entry exists (value returned in value,
0627   //        typecast by user in call)
0628   //      = false otherwise
0629   map<string, LHgenericBlock> genericBlocks;
0630   template <class T> bool getEntry(string, T&);
0631   template <class T> bool getEntry(string, int, T&);
0632   template <class T> bool getEntry(string, int, int, T&);
0633   template <class T> bool getEntry(string, int, int, int, T&);
0634   template <class T> bool getEntry(string, vector<int>, T&);
0635 
0636   // Access/change verbose setting
0637   int verbose() {return verboseSav;}
0638   void verbose(int verboseIn) {verboseSav = verboseIn;}
0639 
0640   // Output of messages from SLHA interface
0641   void message(int, string,string ,int line=0);
0642 
0643   //***************************** SLHA PRIVATE *****************************//
0644 private:
0645   //SLHA I/O
0646   int verboseSav;
0647   bool headerPrinted, footerPrinted, filePrinted;
0648   bool slhaRead, lhefRead, lhefSlha, useDecay;
0649 
0650 };
0651 
0652 //--------------------------------------------------------------------------
0653 
0654 // utilities to set generic blocks
0655 
0656 template <class T> int SusyLesHouches::set(string blockName, T val) {
0657 
0658   // Make sure everything is interpreted as lower case (for safety)
0659   toLowerRep(blockName);
0660 
0661   // Add new generic block if not already existing
0662   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0663     LHgenericBlock gBlock;
0664     genericBlocks[blockName]=gBlock;
0665   }
0666 
0667   // Convert input value to string
0668   ostringstream lineStream;
0669   lineStream << val;
0670   return genericBlocks[blockName].set(lineStream.str());
0671 
0672 }
0673 
0674 template <class T> int SusyLesHouches::set(string blockName, int indx, T val) {
0675 
0676   // Make sure everything is interpreted as lower case (for safety)
0677   toLowerRep(blockName);
0678 
0679   // Add new generic block if not already existing
0680   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0681     LHgenericBlock gBlock;
0682     genericBlocks[blockName]=gBlock;
0683   }
0684 
0685   // Convert input value to string
0686   ostringstream lineStream;
0687   lineStream << indx<<" "<<val;
0688   return genericBlocks[blockName].set(lineStream.str());
0689 
0690 }
0691 
0692 template <class T> int SusyLesHouches::set(string blockName, int indx,
0693                                            int jndx, T val) {
0694 
0695   // Make sure everything is interpreted as lower case (for safety)
0696   toLowerRep(blockName);
0697 
0698   // Add new generic block if not already existing
0699   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0700     LHgenericBlock gBlock;
0701     genericBlocks[blockName]=gBlock;
0702   }
0703 
0704   // Convert input value to string
0705   ostringstream lineStream;
0706   lineStream << indx<<" "<<jndx<<" "<<val;
0707   return genericBlocks[blockName].set(lineStream.str());
0708 
0709 }
0710 
0711 template <class T> int SusyLesHouches::set(string blockName, int indx,
0712                                            int jndx, int kndx, T val) {
0713 
0714   // Make sure everything is interpreted as lower case (for safety)
0715   toLowerRep(blockName);
0716 
0717   // Add new generic block if not already existing
0718   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0719     LHgenericBlock gBlock;
0720     genericBlocks[blockName]=gBlock;
0721   }
0722 
0723   // Convert input value to string
0724   ostringstream lineStream;
0725   lineStream << indx<<" "<<jndx<<" "<<kndx<<" "<<val;
0726   return genericBlocks[blockName].set(lineStream.str());
0727 
0728 }
0729 
0730 // utilities to read generic blocks
0731 
0732 template <class T> bool SusyLesHouches::getEntry(string blockName, T& val) {
0733 
0734   // Make sure everything is interpret as lower case (for safety)
0735   toLowerRep(blockName);
0736 
0737   // Safety checks
0738   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0739     message(1,"getEntry","attempting to extract entry from non-existent block "
0740             +blockName);
0741     return false;
0742   }
0743   if (genericBlocks[blockName].size() == 0) {
0744     message(1,"getEntry","attempting to extract entry from zero-size block "
0745             +blockName);
0746     return false;
0747   }
0748   if (genericBlocks[blockName].size() >= 2) {
0749     message(1,"getEntry","attempting to extract un-indexed entry "
0750       "from multi-entry block "+blockName);
0751     return false;
0752   }
0753   // Attempt to extract value as class T
0754   LHgenericBlock block = genericBlocks[blockName];
0755   istringstream linestream(block(0));
0756   linestream >> val;
0757   if ( !linestream ) {
0758     message(1,"getEntry","problem extracting un-indexed entry "
0759       "from block "+blockName);
0760     return false;
0761   }
0762   // If made it all the way here, value was successfully extracted.
0763   // Return true.
0764   return true;
0765 }
0766 
0767 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
0768                                                  T& val) {
0769 
0770   // Make sure everything is interpret as lower case (for safety)
0771   toLowerRep(blockName);
0772 
0773   // Safety checks
0774   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0775     message(1,"getEntry","attempting to extract entry from non-existent block "
0776             +blockName);
0777     return false;
0778   }
0779   if (genericBlocks[blockName].size() == 0) {
0780     message(1,"getEntry","attempting to extract entry from zero-size block "
0781             +blockName);
0782     return false;
0783   }
0784   // Attempt to extract indexed value as class T
0785   LHgenericBlock block = genericBlocks[blockName];
0786   // Loop over block contents, search for indexed entry with index i
0787   for (int jEntry = 0; jEntry < block.size(); jEntry++) {
0788     istringstream linestream(block(jEntry));
0789     // Buffer line according to format selected by T
0790     int indxNow;
0791     T valNow;
0792     linestream >> indxNow >> valNow;
0793     // If index found and value was readable, return true
0794     if (linestream && indxNow == indx) {
0795       val = valNow;
0796       return true;
0797     }
0798   }
0799   // If index not found or unreadable, return false
0800   message(1,"getEntry","problem extracting indexed entry from block "
0801           +blockName);
0802   return false;
0803 }
0804 
0805 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
0806                                                  int jndx, T& val) {
0807 
0808   // Make sure everything is interpret as lower case (for safety)
0809   toLowerRep(blockName);
0810 
0811   // Safety checks
0812   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0813     message(1,"getEntry","attempting to extract entry from non-existent block "
0814             +blockName);
0815     return false;
0816   }
0817   if (genericBlocks[blockName].size() == 0) {
0818     message(1,"getEntry","attempting to extract entry from zero-size block "
0819             +blockName);
0820     return false;
0821   }
0822   // Attempt to extract matrix-indexed value as class T
0823   LHgenericBlock block = genericBlocks[blockName];
0824   // Loop over block contents, search for indexed entry with indices i, j
0825   for (int jEntry = 0; jEntry < block.size(); jEntry++) {
0826     istringstream linestream(block(jEntry));
0827     // Buffer line according to format selected by T
0828     int indxNow, jndxNow;
0829     T valNow;
0830     linestream >> indxNow >> jndxNow >> valNow;
0831     // If index found and value was readable, return true
0832     if (linestream && indxNow == indx && jndxNow == jndx) {
0833       val = valNow;
0834       return true;
0835     }
0836   }
0837   // If index not found or unreadable, return false
0838   message(1,"getEntry","problem extracting matrix-indexed entry from block "
0839           +blockName);
0840   return false;
0841 }
0842 
0843 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
0844                                                  int jndx, int kndx, T& val) {
0845 
0846   // Make sure everything is interpret as lower case (for safety)
0847   toLowerRep(blockName);
0848 
0849   // Safety checks
0850   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0851     message(1,"getEntry","attempting to extract entry from non-existent block "
0852             +blockName);
0853     return false;
0854   }
0855   if (genericBlocks[blockName].size() == 0) {
0856     message(1,"getEntry","attempting to extract entry from zero-size block "
0857             +blockName);
0858     return false;
0859   }
0860   // Attempt to extract tensor-indexed value as class T
0861   LHgenericBlock block = genericBlocks[blockName];
0862   // Loop over block contents, search for indexed entry with indices i, j, k
0863   for (int jEntry = 0; jEntry < block.size(); jEntry++) {
0864     istringstream linestream(block(jEntry));
0865     // Buffer line according to format selected by T
0866     int indxNow, jndxNow, kndxNow;
0867     T valNow;
0868     linestream >> indxNow >> jndxNow >> kndxNow >> valNow;
0869     // If index found and value was readable, return true
0870     if (linestream && indxNow == indx && jndxNow == jndx && kndxNow == kndx) {
0871       val = valNow;
0872       return true;
0873     }
0874   }
0875   // If index not found or unreadable, return false
0876   message(1,"getEntry","problem extracting tensor-indexed entry from block "
0877           +blockName);
0878   return false;
0879  }
0880 
0881 //==========================================================================
0882 
0883 } // end of namespace Pythia8
0884 
0885 #endif // Pythia8_SLHA_H