1 // SusyLesHouches.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2013 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.
7 // Header file for SUSY Les Houches Accord Interface
8 // Is independent of the rest of the PYTHIA implementation and thus could
9 // be re-used stand-alone or merged into other applications, subject to
10 // the MCnet Guidelines mentioned above.
15 // Stdlib header files for string and character manipulation.
18 // Stdlib header files for containers.
21 // Stdlib header files for input/output.
26 // Stdlib header files for mathematics.
33 //************************* SLHA AUX CLASSES *****************************//
37 //class LHblock: the generic SLHA block (see below for matrices)
38 //Explicit typing required, e.g. block<double> minpar;
39 template <class T> class LHblock {
44 LHblock<T>() : idnow(0),qDRbar(0),i(0) {} ;
47 bool exists() { return int(entry.size()) == 0 ? false : true ; };
49 void clear() { entry.clear(); };
51 //set: set block entry values.
52 //Possible return values from set:
53 // 0: normal return. Entry did not previously exist and has been created.
54 // 1: normal return. Entry did previously exist and has been overwritten.
56 int set(int iIn,T valIn) {
57 int alreadyexisting=exists(iIn)?1:0;
59 return alreadyexisting;
61 // Read index and value from SLHA data line
62 int set(istringstream& linestream, bool indexed=true) {
64 if (indexed) linestream >> i >> val;
65 else linestream >> val;
66 return linestream ? set(i,val) : -1;
68 // With i already given, read value from remaining SLHA data line
69 int set(int iIn,istringstream& linestream) {
71 return linestream ? set(iIn,val) : -1;
73 // Shorthand for entry[0]. Used e.g. for block ALPHA.
74 void set(T valIn) { entry[0]=valIn; };
76 // Does entry i already exist in this block?
77 bool exists(int iIn) {return entry.find(iIn) != entry.end()
80 // Indexing with (). Output only.
82 if (exists(0)) {return entry[0];} else {T dummy(0); return dummy;};
84 T operator()(int iIn) {
85 if (exists(iIn)) {return entry[iIn];} else {T dummy(0); return dummy;};
89 int size() {return int(entry.size());};
91 // First and next key code
92 int first() { idnow = entry.begin()->first; return idnow; };
94 typename map<int,T>::iterator itnow;
95 itnow = ++entry.find(idnow);
96 if ( itnow == entry.end() ) itnow=entry.begin();
97 return idnow = itnow->first;
100 // Simple print utility
106 cout << " "<< i << " " << entry[i] <<endl;
108 if (i == ibegin) finished=true;
112 // Special for DRbar running blocks.
113 void setq(double qIn) { qDRbar=qIn; }
114 double q() { return qDRbar; }
127 // Derived class for generic blocks containing vectors of strings.
128 class LHgenericBlock : public LHblock<string> {
133 LHgenericBlock() { } ;
135 // Read index and value from SLHA data line
136 int set(string lineIn) {
137 entry[entry.size()] = lineIn;
143 // class LHmatrixBlock: the generic SLHA matrix
144 // Explicit sizing required, e.g.LHmatrixBlock<4> nmix;
145 template <int size> class LHmatrixBlock {
147 //Constructor. Set uninitialized and explicitly zero.
148 LHmatrixBlock<size>() : initialized(false),qDRbar(0),i(0),j(0),val(0){
149 for (i=1;i<=size;i++) {
150 for (j=1;j<=size;j++) {
157 LHmatrixBlock& operator=(const LHmatrixBlock& m) {
159 for (i=0;i<size;i++) for (j=0;j<=size;j++) entry[i][j] = m(i,j);
161 initialized = m.initialized;
165 // Does this matrix contain any entries?
166 bool exists() { return initialized; };
167 // Clear initialized flag
168 void clear() { initialized=false; };
171 int set(int iIn,int jIn, double valIn) {
172 if (iIn>0 && jIn>0 && iIn<=size && jIn<=size) {
173 entry[iIn][jIn]=valIn;
181 // Set entry from linestream (used during file read)
182 int set(istringstream& linestream) {
183 linestream >> i >> j >> val;
184 return linestream ? set(i,j,val) : -1;
187 // () Overloading: Get entry
188 double operator()(int iIn, int jIn) const {
189 return (iIn <= size && jIn <= size && iIn > 0 && jIn > 0) ?
190 entry[iIn][jIn] : 0.0;
193 // Set and get scale for DRbar running LHblocks.
194 void setq(double qIn) { qDRbar=qIn; }
195 double q() { return qDRbar; }
197 // Simple print utility, to be elaborated on.
199 for (i=1;i<=size;i++) {
200 cout << " "<<i << " " ;
201 for (j=1;j<=size;j++) cout << entry[i][j] << " ";
208 double entry[size+1][size+1];
215 // class tensorBlock: the generic SLHA tensor
216 // Explicit sizing required, e.g. tensorBlock<3> rvlam;
217 template <int size> class LHtensor3Block {
219 //Constructor. Set uninitialized and explicitly zero.
220 LHtensor3Block<size>() : initialized(false),qDRbar(0),i(0),j(0),k(0),val(0){
222 for (i=1;i<=size;i++) {
223 for (j=1;j<=size;j++) {
224 for (k=1;k<=size;k++) {
232 LHtensor3Block& operator=(const LHtensor3Block& m) {
234 for (i=0;i<size;i++) for (j=0;j<=size;j++) for (k=0;k<=size;k++)
235 entry[i][j][k] = m(i,j,k);
237 initialized = m.initialized;
241 // Does this matrix contain any entries?
242 bool exists() { return initialized; };
243 // Clear initialized flag
244 void clear() { initialized=false; };
247 int set(int iIn,int jIn, int kIn, double valIn) {
248 if (iIn>0 && jIn>0 && kIn>0 && iIn<=size && jIn<=size && kIn<=size) {
249 entry[iIn][jIn][kIn]=valIn;
257 // Set entry from linestream (used during file read)
258 int set(istringstream& linestream) {
259 linestream >> i >> j >> k >> val;
260 return linestream ? set(i,j,k,val) : -1;
263 // () Overloading: Get entry
264 double operator()(int iIn, int jIn, int kIn) const {
265 return (iIn <= size && jIn <= size && kIn <= size && iIn > 0
266 && jIn > 0 && kIn > 0) ? entry[iIn][jIn][kIn] : 0.0;
269 // Set and get scale for DRbar running LHblocks.
270 void setq(double qIn) { qDRbar=qIn; }
271 double q() { return qDRbar; }
273 // Simple print utility, to be elaborated on.
275 for (i=1;i<=size;i++) {
276 for (j=1;j<=size;j++) {
277 cout << " "<<i << " "<<j << " " ;
278 for (k=1;k<=size;k++) {
279 cout << entry[i][j][k] << " ";
288 double entry[size+1][size+1][size+1];
295 //*************************** DECAY TABLES ***************************//
297 class LHdecayChannel {
300 LHdecayChannel() : brat(0.0),comment("") {};
301 LHdecayChannel(double bratIn, int nDaIn, vector<int> idDaIn,
302 string cIn="") { setChannel(bratIn,nDaIn,idDaIn,cIn);
305 // Functions to set decay channel information
306 void setChannel(double bratIn, int nDaIn, vector<int> idDaIn,
309 for (int i=0; i<=nDaIn; i++) {
310 if (i < int(idDaIn.size())) idDa.push_back(idDaIn[i]);
314 void setBrat(double bratIn) {brat=bratIn;}
315 void setIdDa(vector<int> idDaIn) {idDa = idDaIn;}
317 // Functions to get decay channel information
318 double getBrat() {return brat;}
319 int getNDa() {return int(idDa.size());}
320 vector<int> getIdDa() {return idDa;}
321 string getComment() {return comment;}
333 LHdecayTable() : id(0), width(0.0) {};
334 LHdecayTable(int idIn) : id(idIn), width(0.0) {};
335 LHdecayTable(int idIn, double widthIn) : id(idIn), width(widthIn) {};
337 // Functions to get PDG code (id) and width
338 int getId() {return id;}
339 double getWidth() {return width;}
341 // Functions to set PDG code (id) and width
342 void setId(int idIn) {id = idIn;}
343 void setWidth(double widthIn) {width=widthIn;}
345 // Function to reset size and width (width -> 0 by default)
346 void reset(double widthIn=0.0) {table.resize(0); width=widthIn;}
348 // Function to add another decay channel
349 void addChannel(LHdecayChannel channelIn) {table.push_back(channelIn);}
350 void addChannel(double bratIn, int nDaIn, vector<int> idDaIn,
352 LHdecayChannel newChannel(bratIn, nDaIn, idDaIn, cIn);
353 table.push_back(newChannel);
356 // Function to return number of decay channels
357 int size() {return int(table.size());}
359 // Function to return a branching ratio
360 double getBrat(int iChannel) {
361 if (iChannel >= 0 && iChannel < int(table.size())) {
362 return table[iChannel].getBrat();
367 // Function to return daughter PDG codes
368 vector<int> getIdDa(int iChannel) {
369 if (iChannel >= 0 && iChannel < int(table.size())) {
370 return table[iChannel].getIdDa();
376 // Function to return a decay channel
377 LHdecayChannel getChannel(int iChannel) {
378 if (iChannel >= 0 && iChannel < int(table.size())) {
379 return table[iChannel];
389 vector<LHdecayChannel> table;
393 //==========================================================================
395 class SusyLesHouches {
399 //Constructor, with and without filename.
400 SusyLesHouches(int verboseIn=1) : verbose(verboseIn),
401 headerPrinted(false), footerPrinted(false), filePrinted(false),
402 slhaRead(false), lhefRead(false), lhefSlha(false), useDecay(true) {};
403 SusyLesHouches(string filename, int verboseIn=1) : verbose(verboseIn),
404 headerPrinted(false), footerPrinted(false), filePrinted(false),
405 slhaRead(true), lhefRead(false), lhefSlha(false), useDecay(true)
406 {readFile(filename);};
408 //***************************** SLHA FILE I/O *****************************//
409 // Read and write SLHA files
410 int readFile(string slhaFileIn="slha.spc",int verboseIn=1,
411 bool useDecayIn=true);
412 //int writeFile(string filename): write SLHA file on filename
415 void printHeader(); // print Header
416 void printFooter(); // print Footer
417 void printSpectrum(int ifail=0); // print Spectrum
419 // Check spectrum and decays
423 // File Name (can be either SLHA or LHEF)
426 // Class for SLHA data entry
431 Entry() : isIntP(false), isDoubleP(false),
432 isStringP(false), n(0), d(0.0), s(""), commentP("") {}
434 // Generic functions to inquire whether an int, double, or string
435 bool isInt(){return isIntP;}
436 bool isDouble(){return isDoubleP;}
437 bool isString(){return isStringP;}
439 // = Overloading: Set entry to int, double, or string
440 Entry& operator=(double& val) {
441 d=val;isIntP=false;isDoubleP=true;isStringP=false;
444 Entry& operator=(int& val) {
445 n=val;isIntP=true;isDoubleP=false;isStringP=false;
448 Entry& operator=(string& val) {
449 s=val;isIntP=false;isDoubleP=false;isStringP=true;
453 // Set and Get comment
454 void setComment(string comment) {commentP=comment;}
455 void getComment(string comment) {comment=commentP;}
457 // Generic functions to get value
458 bool get(int& val) {val=n; return isIntP;}
459 bool get(double& val) {val=d; return isDoubleP;}
460 bool get(string& val) {val=s; return isStringP;}
463 bool isIntP, isDoubleP, isStringP;
471 //*************************** THE SLHA1 BLOCKS ***************************//
472 //Blocks for model definition:
474 LHblock<int> modsel21;
475 LHblock<double> modsel12;
476 LHblock<double> minpar;
477 LHblock<double> extpar;
478 LHblock<double> sminputs;
479 //Blocks for RGE program specific output
480 LHblock<string> spinfo;
481 LHblock<string> spinfo3;
482 LHblock<string> spinfo4;
483 //Blocks for DCY program specific output
484 LHblock<string> dcinfo;
485 LHblock<string> dcinfo3;
486 LHblock<string> dcinfo4;
487 //Blocks for mass and coupling spectrum
488 LHblock<double> mass;
489 LHmatrixBlock<4> nmix;
490 LHmatrixBlock<2> umix;
491 LHmatrixBlock<2> vmix;
492 LHmatrixBlock<2> stopmix;
493 LHmatrixBlock<2> sbotmix;
494 LHmatrixBlock<2> staumix;
495 LHblock<double> alpha;
496 LHblock<double> hmix;
497 LHblock<double> gauge;
498 LHblock<double> msoft;
506 //************************ THE SLHA1 DECAY TABLES ************************//
507 vector<LHdecayTable> decays;
508 map<int,int> decayIndices;
510 //********************* THE BSM-SLHA QNUMBERS BLOCKS *********************//
511 vector< LHblock<int> > qnumbers; // Zero'th entry is PDG code
512 vector< string > qnumbersName;
513 vector< string > qnumbersAntiName;
515 //*************************** THE SLHA2 BLOCKS ***************************//
517 LHblock<double> qextpar;
520 LHblock<double> vckmin; // The input CKM Wolfenstein parms.
521 LHblock<double> upmnsin; // The input PMNS PDG parms.
522 LHmatrixBlock<3> msq2in; // The input upper off-diagonal msq2
523 LHmatrixBlock<3> msu2in; // The input upper off-diagonal msu2
524 LHmatrixBlock<3> msd2in; // The input upper off-diagonal msd2
525 LHmatrixBlock<3> msl2in; // The input upper off-diagonal msl2
526 LHmatrixBlock<3> mse2in; // The input upper off-diagonal mse2
527 LHmatrixBlock<3> tuin; // The input upper off-diagonal TU
528 LHmatrixBlock<3> tdin; // The input upper off-diagonal TD
529 LHmatrixBlock<3> tein; // The input upper off-diagonal TE
531 LHmatrixBlock<3> vckm; // The output DRbar running Re{VCKM} at Q
532 LHmatrixBlock<3> upmns; // The output DRbar running Re{UPMNS} at Q
533 LHmatrixBlock<3> msq2; // The output DRbar running msq2 at Q
534 LHmatrixBlock<3> msu2; // The output DRbar running msu2 at Q
535 LHmatrixBlock<3> msd2; // The output DRbar running msd2 at Q
536 LHmatrixBlock<3> msl2; // The output DRbar running msl2 at Q
537 LHmatrixBlock<3> mse2; // The output DRbar running mse2 at Q
538 LHmatrixBlock<3> tu; // The output DRbar running TU at Q
539 LHmatrixBlock<3> td; // The output DRbar running TD at Q
540 LHmatrixBlock<3> te; // The output DRbar running TE at Q
541 LHmatrixBlock<6> usqmix; // The Re{} up squark mixing matrix
542 LHmatrixBlock<6> dsqmix; // The Re{} down squark mixing matrix
543 LHmatrixBlock<6> selmix; // The Re{} selectron mixing matrix
544 LHmatrixBlock<3> snumix; // The Re{} sneutrino mixing matrix
545 LHmatrixBlock<3> snsmix; // The scalar sneutrino mixing matrix
546 LHmatrixBlock<3> snamix; // The pseudoscalar neutrino mixing matrix
549 LHtensor3Block<3> rvlamllein; // The input LNV lambda couplings
550 LHtensor3Block<3> rvlamlqdin; // The input LNV lambda' couplings
551 LHtensor3Block<3> rvlamuddin; // The input BNV lambda'' couplings
552 LHtensor3Block<3> rvtllein; // The input LNV T couplings
553 LHtensor3Block<3> rvtlqdin; // The input LNV T' couplings
554 LHtensor3Block<3> rvtuddin; // The input BNV T'' couplings
555 LHblock<double> rvkappain; // The input LNV kappa couplings
556 LHblock<double> rvdin; // The input LNV D terms
557 LHblock<double> rvm2lh1in; // The input LNV m2LH1 couplings
558 LHblock<double> rvsnvevin; // The input LNV sneutrino vevs
560 LHtensor3Block<3> rvlamlle; // The output LNV lambda couplings
561 LHtensor3Block<3> rvlamlqd; // The output LNV lambda' couplings
562 LHtensor3Block<3> rvlamudd; // The output BNV lambda'' couplings
563 LHtensor3Block<3> rvtlle; // The output LNV T couplings
564 LHtensor3Block<3> rvtlqd; // The output LNV T' couplings
565 LHtensor3Block<3> rvtudd; // The output BNV T'' couplings
566 LHblock<double> rvkappa; // The output LNV kappa couplings
567 LHblock<double> rvd; // The output LNV D terms
568 LHblock<double> rvm2lh1; // The output LNV m2LH1 couplings
569 LHblock<double> rvsnvev; // The output LNV sneutrino vevs
570 LHmatrixBlock<7> rvnmix; // The RPV neutralino mixing matrix
571 LHmatrixBlock<5> rvumix; // The RPV chargino L mixing matrix
572 LHmatrixBlock<5> rvvmix; // The RPV chargino R mixing matrix
573 LHmatrixBlock<5> rvhmix; // The RPV neutral scalar mixing matrix
574 LHmatrixBlock<5> rvamix; // The RPV neutral pseudoscalar mixing matrix
575 LHmatrixBlock<8> rvlmix; // The RPV charged fermion mixing matrix
578 LHblock<double> imminpar;
579 LHblock<double> imextpar;
581 LHmatrixBlock<4> cvhmix; // The CPV Higgs mixing matrix
582 LHmatrixBlock<4> imcvhmix; // Optional: imaginary components
583 LHmatrixBlock<3> imau,imad,imae; // Im{} of AU, AD, AE
584 LHblock<double> imhmix;
585 LHblock<double> immsoft;
588 LHmatrixBlock<3> immsq2in; // The Im{} input upper off-diagonal msq2
589 LHmatrixBlock<3> immsu2in; // The Im{} input upper off-diagonal msu2
590 LHmatrixBlock<3> immsd2in; // The Im{} input upper off-diagonal msd2
591 LHmatrixBlock<3> immsl2in; // The Im{} input upper off-diagonal msl2
592 LHmatrixBlock<3> immse2in; // The Im{} input upper off-diagonal mse2
593 LHmatrixBlock<3> imtuin,imtdin,imtein; // The Im{} input upper off-diagonal T
595 LHmatrixBlock<3> imvckm; // The output DRbar running Im{VCKM} at Q
596 LHmatrixBlock<3> imupmns; // The output DRbar running Im{UPMNS} at Q
597 LHmatrixBlock<3> immsq2; // The output DRbar running msq2 at Q
598 LHmatrixBlock<3> immsu2; // The output DRbar running msu2 at Q
599 LHmatrixBlock<3> immsd2; // The output DRbar running msd2 at Q
600 LHmatrixBlock<3> immsl2; // The output DRbar running msl2 at Q
601 LHmatrixBlock<3> immse2; // The output DRbar running mse2 at Q
602 LHmatrixBlock<3> imtu,imtd,imte; // Im{} of TU, TD, TE
603 LHmatrixBlock<6> imusqmix;// The Im{} up squark mixing matrix
604 LHmatrixBlock<6> imdsqmix; // The Im{} down squark mixing matrix
605 LHmatrixBlock<6> imselmix; // The Im{} selectron mixing matrix
606 LHmatrixBlock<3> imsnumix; // The Im{} sneutrino mixing matrix
607 LHmatrixBlock<4> imnmix; // The Im{} neutralino mixing matrix
608 LHmatrixBlock<4> imumix; // The Im{} chargino L mixing matrix
609 LHmatrixBlock<4> imvmix; // The Im{} chargino R mixing matrix
612 // All input is in EXTPAR
614 LHblock<double> nmssmrun; // The LHblock of NMSSM running parameters
615 LHmatrixBlock<3> nmhmix; // The NMSSM scalar Higgs mixing
616 LHmatrixBlock<3> nmamix; // The NMSSM pseudoscalar Higgs mixing
617 LHmatrixBlock<5> nmnmix; // The NMSSM neutralino mixing
618 LHmatrixBlock<5> imnmnmix; // Im{} (for future use)
620 //*************************** SET BLOCK VALUE ****************************//
621 template <class T> int set(string,T);
622 template <class T> int set(string,int,T);
623 template <class T> int set(string,int,int,T);
624 template <class T> int set(string,int,int,int,T);
626 //********************* GENERIC/USER-DEFINED BLOCKS **********************//
627 // bool getEntry(name, indices, value)
628 // = true if LHblock and entry exists (value returned in value,
629 // typecast by user in call)
631 map<string, LHgenericBlock> genericBlocks;
632 template <class T> bool getEntry(string, T&);
633 template <class T> bool getEntry(string, int, T&);
634 template <class T> bool getEntry(string, int, int, T&);
635 template <class T> bool getEntry(string, int, int, int, T&);
636 template <class T> bool getEntry(string, vector<int>, T&);
638 // Output of messages from SLHA interface
639 void message(int, string,string ,int line=0);
641 //***************************** SLHA PRIVATE *****************************//
645 bool headerPrinted, footerPrinted, filePrinted;
646 bool slhaRead, lhefRead, lhefSlha, useDecay;
650 //--------------------------------------------------------------------------
652 // utilities to set generic blocks
654 template <class T> int SusyLesHouches::set(string blockName, T val) {
656 // Make sure everything is interpreted as lower case (for safety)
657 for (int iC=0; iC<int(blockName.size()); ++iC)
658 blockName[iC] = tolower(blockName[iC]);
660 // Add new generic block if not already existing
661 if (genericBlocks.find(blockName) == genericBlocks.end()) {
662 LHgenericBlock gBlock;
663 genericBlocks[blockName]=gBlock;
666 // Convert input value to string
667 ostringstream lineStream;
669 return genericBlocks[blockName].set(lineStream.str());
673 template <class T> int SusyLesHouches::set(string blockName, int indx, T val) {
675 // Make sure everything is interpreted as lower case (for safety)
676 for (int iC=0; iC<int(blockName.size()); ++iC)
677 blockName[iC] = tolower(blockName[iC]);
679 // Add new generic block if not already existing
680 if (genericBlocks.find(blockName) == genericBlocks.end()) {
681 LHgenericBlock gBlock;
682 genericBlocks[blockName]=gBlock;
685 // Convert input value to string
686 ostringstream lineStream;
687 lineStream << indx<<" "<<val;
688 return genericBlocks[blockName].set(lineStream.str());
692 template <class T> int SusyLesHouches::set(string blockName, int indx,
695 // Make sure everything is interpreted as lower case (for safety)
696 for (int iC=0; iC<int(blockName.size()); ++iC)
697 blockName[iC] = tolower(blockName[iC]);
699 // Add new generic block if not already existing
700 if (genericBlocks.find(blockName) == genericBlocks.end()) {
701 LHgenericBlock gBlock;
702 genericBlocks[blockName]=gBlock;
705 // Convert input value to string
706 ostringstream lineStream;
707 lineStream << indx<<" "<<jndx<<" "<<val;
708 return genericBlocks[blockName].set(lineStream.str());
712 template <class T> int SusyLesHouches::set(string blockName, int indx,
713 int jndx, int kndx, T val) {
715 // Make sure everything is interpreted as lower case (for safety)
716 for (int iC=0; iC<int(blockName.size()); ++iC)
717 blockName[iC] = tolower(blockName[iC]);
719 // Add new generic block if not already existing
720 if (genericBlocks.find(blockName) == genericBlocks.end()) {
721 LHgenericBlock gBlock;
722 genericBlocks[blockName]=gBlock;
725 // Convert input value to string
726 ostringstream lineStream;
727 lineStream << indx<<" "<<jndx<<" "<<kndx<<" "<<val;
728 return genericBlocks[blockName].set(lineStream.str());
732 // utilities to read generic blocks
734 template <class T> bool SusyLesHouches::getEntry(string blockName, T& val) {
736 // Make sure everything is interpret as lower case (for safety)
737 for (int iC=0; iC<int(blockName.size()); ++iC)
738 blockName[iC] = tolower(blockName[iC]);
741 if (genericBlocks.find(blockName) == genericBlocks.end()) {
742 message(1,"getEntry","attempting to extract entry from non-existent block "
746 if (genericBlocks[blockName].size() == 0) {
747 message(1,"getEntry","attempting to extract entry from zero-size block "
751 if (genericBlocks[blockName].size() >= 2) {
752 message(1,"getEntry","attempting to extract un-indexed entry "
753 "from multi-entry block "+blockName);
756 // Attempt to extract value as class T
757 LHgenericBlock block = genericBlocks[blockName];
758 istringstream linestream(block(0));
761 message(1,"getEntry","problem extracting un-indexed entry "
762 "from block "+blockName);
765 // If made it all the way here, value was successfully extracted.
770 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
773 // Make sure everything is interpret as lower case (for safety)
774 for (int iC=0; iC<int(blockName.size()); ++iC)
775 blockName[iC] = tolower(blockName[iC]);
778 if (genericBlocks.find(blockName) == genericBlocks.end()) {
779 message(1,"getEntry","attempting to extract entry from non-existent block "
783 if (genericBlocks[blockName].size() == 0) {
784 message(1,"getEntry","attempting to extract entry from zero-size block "
788 // Attempt to extract indexed value as class T
789 LHgenericBlock block = genericBlocks[blockName];
790 // Loop over block contents, search for indexed entry with index i
791 for (int jEntry = 0; jEntry < block.size(); jEntry++) {
792 istringstream linestream(block(jEntry));
793 // Buffer line according to format selected by T
796 linestream >> indxNow >> valNow;
797 // If index found and value was readable, return true
798 if (linestream && indxNow == indx) {
803 // If index not found or unreadable, return false
804 message(1,"getEntry","problem extracting indexed entry from block "
809 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
812 // Make sure everything is interpret as lower case (for safety)
813 for (int iC=0; iC<int(blockName.size()); ++iC)
814 blockName[iC] = tolower(blockName[iC]);
817 if (genericBlocks.find(blockName) == genericBlocks.end()) {
818 message(1,"getEntry","attempting to extract entry from non-existent block "
822 if (genericBlocks[blockName].size() == 0) {
823 message(1,"getEntry","attempting to extract entry from zero-size block "
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;
835 linestream >> indxNow >> jndxNow >> valNow;
836 // If index found and value was readable, return true
837 if (linestream && indxNow == indx && jndxNow == jndx) {
842 // If index not found or unreadable, return false
843 message(1,"getEntry","problem extracting matrix-indexed entry from block "
848 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
849 int jndx, int kndx, T& val) {
851 // Make sure everything is interpret as lower case (for safety)
852 for (int iC=0; iC<int(blockName.size()); ++iC)
853 blockName[iC] = tolower(blockName[iC]);
856 if (genericBlocks.find(blockName) == genericBlocks.end()) {
857 message(1,"getEntry","attempting to extract entry from non-existent block "
861 if (genericBlocks[blockName].size() == 0) {
862 message(1,"getEntry","attempting to extract entry from zero-size block "
866 // Attempt to extract tensor-indexed value as class T
867 LHgenericBlock block = genericBlocks[blockName];
868 // Loop over block contents, search for indexed entry with indices i, j, k
869 for (int jEntry = 0; jEntry < block.size(); jEntry++) {
870 istringstream linestream(block(jEntry));
871 // Buffer line according to format selected by T
872 int indxNow, jndxNow, kndxNow;
874 linestream >> indxNow >> jndxNow >> kndxNow >> valNow;
875 // If index found and value was readable, return true
876 if (linestream && indxNow == indx && jndxNow == jndx && kndxNow == kndx) {
881 // If index not found or unreadable, return false
882 message(1,"getEntry","problem extracting tensor-indexed entry from block "