File indexing completed on 2025-11-03 09:56:25
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
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 
0023 
0024   
0025   
0026   template <class T> class LHblock {
0027 
0028   public:
0029 
0030     
0031     LHblock() : idnow(0), qDRbar(), i(), val() {} ;
0032 
0033     
0034     bool exists() { return int(entry.size()) == 0 ? false : true ; };
0035     
0036     void clear() { entry.clear(); };
0037 
0038     
0039     
0040     
0041     
0042     
0043     int set(int iIn,T valIn) {
0044       int alreadyexisting=exists(iIn)?1:0;
0045       entry[iIn]=valIn;
0046       return alreadyexisting;
0047     };
0048     
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     
0056     int set(int iIn,istringstream& linestream) {
0057       linestream >> val;
0058       return linestream ? set(iIn,val) : -1;
0059     };
0060     
0061     void set(T valIn) { entry[0]=valIn; };
0062 
0063     
0064     bool exists(int iIn) {return entry.find(iIn) != entry.end()
0065       ? true : false;};
0066 
0067     
0068     T operator()() {return exists(0) ? entry[0] : T();}
0069     T operator()(int iIn) {return exists(iIn) ? entry[iIn] : T();}
0070 
0071     
0072     int size() {return int(entry.size());};
0073 
0074     
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     
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     
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     
0106     int i;
0107     T val;
0108   };
0109 
0110   
0111   class LHgenericBlock : public LHblock<string> {
0112 
0113   public:
0114 
0115     
0116     LHgenericBlock() { } ;
0117 
0118     
0119     int set(string lineIn) {
0120       entry[entry.size()] = lineIn;
0121       return 0;
0122     };
0123 
0124   };
0125 
0126   
0127   
0128   
0129   template <int size> class LHmatrixBlock {
0130   public:
0131     
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     
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     
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     
0157     bool exists() { return initialized; };
0158     
0159     void clear() { initialized=false; };
0160 
0161     
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     
0173     int set(istringstream& linestream) {
0174       linestream >> i >> j >> val;
0175       return linestream ? set(i,j,val) : -1;
0176     };
0177 
0178     
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     
0185     void setq(double qIn) { qDRbar=qIn; }
0186     double q() { return qDRbar; }
0187 
0188     
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     
0202     int i,j;
0203     double val;
0204   };
0205 
0206   
0207   
0208   template <int size> class LHtensor3Block {
0209   public:
0210     
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     
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     
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     
0240     bool exists() { return initialized; };
0241     
0242     void clear() { initialized=false; };
0243 
0244     
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     
0256     int set(istringstream& linestream) {
0257       linestream >> i >> j >> k >> val;
0258       return linestream ? set(i,j,k,val) : -1;
0259     };
0260 
0261     
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     
0268     void setq(double qIn) { qDRbar=qIn; }
0269     double q() { return qDRbar; }
0270 
0271     
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     
0289     int i,j,k;
0290     double val;
0291   };
0292 
0293   
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     
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     
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     
0336     int    getId() {return id;}
0337     double getWidth() {return width;}
0338 
0339     
0340     void setId(int idIn) {id = idIn;}
0341     void setWidth(double widthIn) {width=widthIn;}
0342 
0343     
0344     void reset(double widthIn=0.0) {table.resize(0); width=widthIn;}
0345 
0346     
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     
0355     int size() {return int(table.size());}
0356 
0357     
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     
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     
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   
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   
0407   
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   
0414   void listHeader();   
0415   void listFooter();   
0416   void listSpectrum(int ifail=0); 
0417 
0418   
0419   int checkSpectrum();
0420 
0421   
0422   string slhaFile;
0423 
0424   
0425   class Entry {
0426 
0427   public:
0428     
0429     Entry() : isIntP(false), isDoubleP(false),
0430       isStringP(false), n(0), d(0.0), s(""), commentP("") {}
0431 
0432     
0433     bool isInt(){return isIntP;}
0434     bool isDouble(){return isDoubleP;}
0435     bool isString(){return isStringP;}
0436 
0437     
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     
0452     void setComment(string comment) {commentP=comment;}
0453     void getComment(string& comment) {comment=commentP;}
0454 
0455     
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   
0470   
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   
0478   LHblock<string> spinfo;
0479   LHblock<string> spinfo3;
0480   LHblock<string> spinfo4;
0481   
0482   LHblock<string> dcinfo;
0483   LHblock<string> dcinfo3;
0484   LHblock<string> dcinfo4;
0485   
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   
0505   vector<LHdecayTable> decays;
0506   map<int,int> decayIndices;
0507 
0508   
0509   vector< LHblock<double> > qnumbers;     
0510   vector< string > qnumbersName;
0511   vector< string > qnumbersAntiName;
0512 
0513   
0514   
0515   LHblock<double> qextpar;
0516 
0517   
0518   LHblock<double> vckmin;  
0519   LHblock<double> upmnsin; 
0520   LHmatrixBlock<3> msq2in; 
0521   LHmatrixBlock<3> msu2in; 
0522   LHmatrixBlock<3> msd2in; 
0523   LHmatrixBlock<3> msl2in; 
0524   LHmatrixBlock<3> mse2in; 
0525   LHmatrixBlock<3> tuin;   
0526   LHmatrixBlock<3> tdin;   
0527   LHmatrixBlock<3> tein;   
0528   
0529   LHmatrixBlock<3> vckm;    
0530   LHmatrixBlock<3> upmns;   
0531   LHmatrixBlock<3> msq2;    
0532   LHmatrixBlock<3> msu2;    
0533   LHmatrixBlock<3> msd2;    
0534   LHmatrixBlock<3> msl2;    
0535   LHmatrixBlock<3> mse2;    
0536   LHmatrixBlock<3> tu;      
0537   LHmatrixBlock<3> td;      
0538   LHmatrixBlock<3> te;      
0539   LHmatrixBlock<6> usqmix;  
0540   LHmatrixBlock<6> dsqmix;   
0541   LHmatrixBlock<6> selmix;   
0542   LHmatrixBlock<3> snumix;   
0543   LHmatrixBlock<3> snsmix;   
0544   LHmatrixBlock<3> snamix;   
0545 
0546   
0547   LHtensor3Block<3> rvlamllein; 
0548   LHtensor3Block<3> rvlamlqdin; 
0549   LHtensor3Block<3> rvlamuddin; 
0550   LHtensor3Block<3> rvtllein;   
0551   LHtensor3Block<3> rvtlqdin;   
0552   LHtensor3Block<3> rvtuddin;   
0553   LHblock<double> rvkappain;    
0554   LHblock<double> rvdin;        
0555   LHblock<double> rvm2lh1in;    
0556   LHblock<double> rvsnvevin;    
0557   
0558   LHtensor3Block<3> rvlamlle;   
0559   LHtensor3Block<3> rvlamlqd;   
0560   LHtensor3Block<3> rvlamudd;   
0561   LHtensor3Block<3> rvtlle;     
0562   LHtensor3Block<3> rvtlqd;     
0563   LHtensor3Block<3> rvtudd;     
0564   LHblock<double> rvkappa;      
0565   LHblock<double> rvd;          
0566   LHblock<double> rvm2lh1;      
0567   LHblock<double> rvsnvev;      
0568   LHmatrixBlock<7> rvnmix;      
0569   LHmatrixBlock<5> rvumix;      
0570   LHmatrixBlock<5> rvvmix;      
0571   LHmatrixBlock<5> rvhmix;      
0572   LHmatrixBlock<5> rvamix;      
0573   LHmatrixBlock<8> rvlmix;      
0574 
0575   
0576   LHblock<double> imminpar;
0577   LHblock<double> imextpar;
0578   
0579   LHmatrixBlock<4> cvhmix;   
0580   LHmatrixBlock<4> imcvhmix; 
0581   LHmatrixBlock<3> imau,imad,imae; 
0582   LHblock<double> imhmix;
0583   LHblock<double> immsoft;
0584 
0585   
0586   LHmatrixBlock<3> immsq2in;  
0587   LHmatrixBlock<3> immsu2in;  
0588   LHmatrixBlock<3> immsd2in;  
0589   LHmatrixBlock<3> immsl2in;  
0590   LHmatrixBlock<3> immse2in;  
0591   LHmatrixBlock<3> imtuin,imtdin,imtein; 
0592   
0593   LHmatrixBlock<3> imvckm;  
0594   LHmatrixBlock<3> imupmns; 
0595   LHmatrixBlock<3> immsq2;  
0596   LHmatrixBlock<3> immsu2;  
0597   LHmatrixBlock<3> immsd2;  
0598   LHmatrixBlock<3> immsl2;  
0599   LHmatrixBlock<3> immse2;  
0600   LHmatrixBlock<3> imtu,imtd,imte; 
0601   LHmatrixBlock<6> imusqmix;
0602   LHmatrixBlock<6> imdsqmix; 
0603   LHmatrixBlock<6> imselmix; 
0604   LHmatrixBlock<3> imsnumix; 
0605   LHmatrixBlock<4> imnmix;   
0606   LHmatrixBlock<4> imumix;   
0607   LHmatrixBlock<4> imvmix;   
0608 
0609   
0610   
0611   
0612   LHblock<double> nmssmrun;  
0613   LHmatrixBlock<3> nmhmix;   
0614   LHmatrixBlock<3> nmamix;   
0615   LHmatrixBlock<5> nmnmix;   
0616   LHmatrixBlock<5> imnmnmix; 
0617 
0618   
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   
0625   
0626   
0627   
0628   
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   
0637   int verbose() {return verboseSav;}
0638   void verbose(int verboseIn) {verboseSav = verboseIn;}
0639 
0640   
0641   void message(int, string,string ,int line=0);
0642 
0643   
0644 private:
0645   
0646   int verboseSav;
0647   bool headerPrinted, footerPrinted, filePrinted;
0648   bool slhaRead, lhefRead, lhefSlha, useDecay;
0649 
0650 };
0651 
0652 
0653 
0654 
0655 
0656 template <class T> int SusyLesHouches::set(string blockName, T val) {
0657 
0658   
0659   toLowerRep(blockName);
0660 
0661   
0662   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0663     LHgenericBlock gBlock;
0664     genericBlocks[blockName]=gBlock;
0665   }
0666 
0667   
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   
0677   toLowerRep(blockName);
0678 
0679   
0680   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0681     LHgenericBlock gBlock;
0682     genericBlocks[blockName]=gBlock;
0683   }
0684 
0685   
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   
0696   toLowerRep(blockName);
0697 
0698   
0699   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0700     LHgenericBlock gBlock;
0701     genericBlocks[blockName]=gBlock;
0702   }
0703 
0704   
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   
0715   toLowerRep(blockName);
0716 
0717   
0718   if (genericBlocks.find(blockName) == genericBlocks.end()) {
0719     LHgenericBlock gBlock;
0720     genericBlocks[blockName]=gBlock;
0721   }
0722 
0723   
0724   ostringstream lineStream;
0725   lineStream << indx<<" "<<jndx<<" "<<kndx<<" "<<val;
0726   return genericBlocks[blockName].set(lineStream.str());
0727 
0728 }
0729 
0730 
0731 
0732 template <class T> bool SusyLesHouches::getEntry(string blockName, T& val) {
0733 
0734   
0735   toLowerRep(blockName);
0736 
0737   
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   
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   
0763   
0764   return true;
0765 }
0766 
0767 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
0768                                                  T& val) {
0769 
0770   
0771   toLowerRep(blockName);
0772 
0773   
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   
0785   LHgenericBlock block = genericBlocks[blockName];
0786   
0787   for (int jEntry = 0; jEntry < block.size(); jEntry++) {
0788     istringstream linestream(block(jEntry));
0789     
0790     int indxNow;
0791     T valNow;
0792     linestream >> indxNow >> valNow;
0793     
0794     if (linestream && indxNow == indx) {
0795       val = valNow;
0796       return true;
0797     }
0798   }
0799   
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   
0809   toLowerRep(blockName);
0810 
0811   
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   
0823   LHgenericBlock block = genericBlocks[blockName];
0824   
0825   for (int jEntry = 0; jEntry < block.size(); jEntry++) {
0826     istringstream linestream(block(jEntry));
0827     
0828     int indxNow, jndxNow;
0829     T valNow;
0830     linestream >> indxNow >> jndxNow >> valNow;
0831     
0832     if (linestream && indxNow == indx && jndxNow == jndx) {
0833       val = valNow;
0834       return true;
0835     }
0836   }
0837   
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   
0847   toLowerRep(blockName);
0848 
0849   
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   
0861   LHgenericBlock block = genericBlocks[blockName];
0862   
0863   for (int jEntry = 0; jEntry < block.size(); jEntry++) {
0864     istringstream linestream(block(jEntry));
0865     
0866     int indxNow, jndxNow, kndxNow;
0867     T valNow;
0868     linestream >> indxNow >> jndxNow >> kndxNow >> valNow;
0869     
0870     if (linestream && indxNow == indx && jndxNow == jndx && kndxNow == kndx) {
0871       val = valNow;
0872       return true;
0873     }
0874   }
0875   
0876   message(1,"getEntry","problem extracting tensor-indexed entry from block "
0877           +blockName);
0878   return false;
0879  }
0880 
0881 
0882 
0883 } 
0884 
0885 #endif