47 bool exists() {
return int(entry.size()) == 0 ?
false :
true ; };
49 void clear() { entry.clear(); };
56 int set(
int iIn,T valIn) {
57 int alreadyexisting=exists(iIn)?1:0;
59 return alreadyexisting;
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;
69 int set(
int iIn,istringstream& linestream) {
71 return linestream ? set(iIn,val) : -1;
74 void set(T valIn) { entry[0]=valIn; };
77 bool exists(
int iIn) {
return entry.find(iIn) != entry.end()
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());};
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;
106 cout <<
" "<< i <<
" " << entry[i] <<endl;
108 if (i == ibegin) finished=
true;
113 void setq(
double qIn) { qDRbar=qIn; }
114 double q() {
return qDRbar; }
136 int set(
string lineIn) {
137 entry[entry.size()] = lineIn;
150 for (i=1;i<=size;i++) {
151 for (j=1;j<=size;j++) {
160 for (i=0;i<size;i++)
for (j=0;j<=size;j++) entry[i][j] = m(i,j);
162 initialized = m.initialized;
167 bool exists() {
return initialized; };
169 void clear() { initialized=
false; };
172 int set(
int iIn,
int jIn,
double valIn) {
173 if (iIn>0 && jIn>0 && iIn<=size && jIn<=size) {
174 entry[iIn][jIn]=valIn;
183 int set(istringstream& linestream) {
184 linestream >> i >> j >> val;
185 return linestream ? set(i,j,val) : -1;
189 double operator()(
int iIn,
int jIn)
const {
190 return (iIn <= size && jIn <= size && iIn > 0 && jIn > 0) ?
191 entry[iIn][jIn] : 0.0;
195 void setq(
double qIn) { qDRbar=qIn; }
196 double q() {
return qDRbar; }
200 for (i=1;i<=size;i++) {
201 cout <<
" "<<i <<
" " ;
202 for (j=1;j<=size;j++) cout << entry[i][j] <<
" ";
209 double entry[size+1][size+1];
223 for (i=1;i<=size;i++) {
224 for (j=1;j<=size;j++) {
225 for (k=1;k<=size;k++) {
235 for (i=0;i<size;i++)
for (j=0;j<=size;j++)
for (k=0;k<=size;k++)
236 entry[i][j][k] = m(i,j,k);
238 initialized = m.initialized;
243 bool exists() {
return initialized; };
245 void clear() { initialized=
false; };
248 int set(
int iIn,
int jIn,
int kIn,
double valIn) {
249 if (iIn>0 && jIn>0 && kIn>0 && iIn<=size && jIn<=size && kIn<=size) {
250 entry[iIn][jIn][kIn]=valIn;
259 int set(istringstream& linestream) {
260 linestream >> i >> j >> k >> val;
261 return linestream ? set(i,j,k,val) : -1;
265 double operator()(
int iIn,
int jIn,
int kIn)
const {
266 return (iIn <= size && jIn <= size && kIn <= size && iIn > 0
267 && jIn > 0 && kIn > 0) ? entry[iIn][jIn][kIn] : 0.0;
271 void setq(
double qIn) { qDRbar=qIn; }
272 double q() {
return qDRbar; }
276 for (i=1;i<=size;i++) {
277 for (j=1;j<=size;j++) {
278 cout <<
" "<<i <<
" "<<j <<
" " ;
279 for (k=1;k<=size;k++) {
280 cout << entry[i][j][k] <<
" ";
289 double entry[size+1][size+1][size+1];
302 LHdecayChannel(
double bratIn,
int nDaIn, vector<int> idDaIn,
string cIn=
"") {
303 setChannel(bratIn,nDaIn,idDaIn,cIn);
307 void setChannel(
double bratIn,
int nDaIn, vector<int> idDaIn,
310 for (
int i=0; i<=nDaIn; i++) {
311 if (i <
int(idDaIn.size())) idDa.push_back(idDaIn[i]);
315 void setBrat(
double bratIn) {brat=bratIn;}
316 void setIdDa(vector<int> idDaIn) {idDa = idDaIn;}
319 double getBrat() {
return brat;}
320 int getNDa() {
return int(idDa.size());}
321 vector<int> getIdDa() {
return idDa;}
322 string getComment() {
return comment;}
336 LHdecayTable(
int idIn,
double widthIn) : id(idIn), width(widthIn) {};
339 int getId() {
return id;}
340 double getWidth() {
return width;}
343 void setId(
int idIn) {
id = idIn;}
344 void setWidth(
double widthIn) {width=widthIn;}
347 void reset(
double widthIn=0.0) {table.resize(0); width=widthIn;}
350 void addChannel(
LHdecayChannel channelIn) {table.push_back(channelIn);}
351 void addChannel(
double bratIn,
int nDaIn, vector<int> idDaIn,
354 table.push_back(newChannel);
358 int size() {
return int(table.size());}
361 double getBrat(
int iChannel) {
362 if (iChannel >= 0 && iChannel <
int(table.size())) {
363 return table[iChannel].getBrat();
369 vector<int> getIdDa(
int iChannel) {
370 if (iChannel >= 0 && iChannel <
int(table.size())) {
371 return table[iChannel].getIdDa();
379 if (iChannel >= 0 && iChannel <
int(table.size())) {
380 return table[iChannel];
390 vector<LHdecayChannel> table;
402 headerPrinted(
false), footerPrinted(
false), filePrinted(
false),
403 slhaRead(
false), lhefRead(
false), lhefSlha(
false), useDecay(
true) {};
404 SusyLesHouches(
string filename,
int verboseIn=1) : verbose(verboseIn),
405 headerPrinted(
false), footerPrinted(
false), filePrinted(
false),
406 slhaRead(
true), lhefRead(
false), lhefSlha(
false), useDecay(
true)
407 {readFile(filename);};
411 int readFile(
string slhaFileIn=
"slha.spc",
int verboseIn=1,
412 bool useDecayIn=
true);
418 void printSpectrum(
int ifail=0);
432 Entry() : isIntP(
false), isDoubleP(
false),
433 isStringP(
false), n(0), d(0.0), s(
""), commentP(
"") {}
436 bool isInt(){
return isIntP;}
437 bool isDouble(){
return isDoubleP;}
438 bool isString(){
return isStringP;}
441 Entry& operator=(
double& val) {
442 d=val;isIntP=
false;isDoubleP=
true;isStringP=
false;
445 Entry& operator=(
int& val) {
446 n=val;isIntP=
true;isDoubleP=
false;isStringP=
false;
449 Entry& operator=(
string& val) {
450 s=val;isIntP=
false;isDoubleP=
false;isStringP=
true;
455 void setComment(
string comment) {commentP=comment;}
456 void getComment(
string comment) {comment=commentP;}
459 bool get(
int& val) {val=n;
return isIntP;}
460 bool get(
double& val) {val=d;
return isDoubleP;}
461 bool get(
string& val) {val=s;
return isStringP;}
464 bool isIntP, isDoubleP, isStringP;
508 vector<LHdecayTable> decays;
509 map<int,int> decayIndices;
512 vector< LHblock<int> > qnumbers;
513 vector< string > qnumbersName;
514 vector< string > qnumbersAntiName;
622 template <
class T>
int set(
string,T);
623 template <
class T>
int set(
string,
int,T);
624 template <
class T>
int set(
string,
int,
int,T);
625 template <
class T>
int set(
string,
int,
int,
int,T);
632 map<string, LHgenericBlock> genericBlocks;
633 template <
class T>
bool getEntry(
string, T&);
634 template <
class T>
bool getEntry(
string,
int, T&);
635 template <
class T>
bool getEntry(
string,
int,
int, T&);
636 template <
class T>
bool getEntry(
string,
int,
int,
int, T&);
637 template <
class T>
bool getEntry(
string, vector<int>, T&);
640 void message(
int,
string,
string ,
int line=0);
646 bool headerPrinted, footerPrinted, filePrinted;
647 bool slhaRead, lhefRead, lhefSlha, useDecay;
655 template <
class T>
int SusyLesHouches::set(
string blockName, T val) {
658 for (
int iC=0; iC<int(blockName.size()); ++iC)
659 blockName[iC] = tolower(blockName[iC]);
662 if (genericBlocks.find(blockName) == genericBlocks.end()) {
664 genericBlocks[blockName]=gBlock;
668 ostringstream lineStream;
670 return genericBlocks[blockName].set(lineStream.str());
674 template <
class T>
int SusyLesHouches::set(
string blockName,
int indx, T val) {
677 for (
int iC=0; iC<int(blockName.size()); ++iC)
678 blockName[iC] = tolower(blockName[iC]);
681 if (genericBlocks.find(blockName) == genericBlocks.end()) {
682 LHgenericBlock gBlock;
683 genericBlocks[blockName]=gBlock;
687 ostringstream lineStream;
688 lineStream << indx<<
" "<<val;
689 return genericBlocks[blockName].set(lineStream.str());
693 template <
class T>
int SusyLesHouches::set(
string blockName,
int indx,
697 for (
int iC=0; iC<int(blockName.size()); ++iC)
698 blockName[iC] = tolower(blockName[iC]);
701 if (genericBlocks.find(blockName) == genericBlocks.end()) {
702 LHgenericBlock gBlock;
703 genericBlocks[blockName]=gBlock;
707 ostringstream lineStream;
708 lineStream << indx<<
" "<<jndx<<
" "<<val;
709 return genericBlocks[blockName].set(lineStream.str());
713 template <
class T>
int SusyLesHouches::set(
string blockName,
int indx,
714 int jndx,
int kndx, T val) {
717 for (
int iC=0; iC<int(blockName.size()); ++iC)
718 blockName[iC] = tolower(blockName[iC]);
721 if (genericBlocks.find(blockName) == genericBlocks.end()) {
722 LHgenericBlock gBlock;
723 genericBlocks[blockName]=gBlock;
727 ostringstream lineStream;
728 lineStream << indx<<
" "<<jndx<<
" "<<kndx<<
" "<<val;
729 return genericBlocks[blockName].set(lineStream.str());
735 template <
class T>
bool SusyLesHouches::getEntry(
string blockName, T& val) {
738 for (
int iC=0; iC<int(blockName.size()); ++iC)
739 blockName[iC] = tolower(blockName[iC]);
742 if (genericBlocks.find(blockName) == genericBlocks.end()) {
743 message(1,
"getEntry",
"attempting to extract entry from non-existent block "
747 if (genericBlocks[blockName].size() == 0) {
748 message(1,
"getEntry",
"attempting to extract entry from zero-size block "
752 if (genericBlocks[blockName].size() >= 2) {
753 message(1,
"getEntry",
"attempting to extract un-indexed entry "
754 "from multi-entry block "+blockName);
758 LHgenericBlock block = genericBlocks[blockName];
759 istringstream linestream(block(0));
762 message(1,
"getEntry",
"problem extracting un-indexed entry "
763 "from block "+blockName);
771 template <
class T>
bool SusyLesHouches::getEntry(
string blockName,
int indx,
775 for (
int iC=0; iC<int(blockName.size()); ++iC)
776 blockName[iC] = tolower(blockName[iC]);
779 if (genericBlocks.find(blockName) == genericBlocks.end()) {
780 message(1,
"getEntry",
"attempting to extract entry from non-existent block "
784 if (genericBlocks[blockName].size() == 0) {
785 message(1,
"getEntry",
"attempting to extract entry from zero-size block "
790 LHgenericBlock block = genericBlocks[blockName];
792 for (
int jEntry = 0; jEntry < block.size(); jEntry++) {
793 istringstream linestream(block(jEntry));
797 linestream >> indxNow >> valNow;
799 if (linestream && indxNow == indx) {
805 message(1,
"getEntry",
"problem extracting indexed entry from block "
810 template <
class T>
bool SusyLesHouches::getEntry(
string blockName,
int indx,
814 for (
int iC=0; iC<int(blockName.size()); ++iC)
815 blockName[iC] = tolower(blockName[iC]);
818 if (genericBlocks.find(blockName) == genericBlocks.end()) {
819 message(1,
"getEntry",
"attempting to extract entry from non-existent block "
823 if (genericBlocks[blockName].size() == 0) {
824 message(1,
"getEntry",
"attempting to extract entry from zero-size block "
829 LHgenericBlock block = genericBlocks[blockName];
831 for (
int jEntry = 0; jEntry < block.size(); jEntry++) {
832 istringstream linestream(block(jEntry));
834 int indxNow, jndxNow;
836 linestream >> indxNow >> jndxNow >> valNow;
838 if (linestream && indxNow == indx && jndxNow == jndx) {
844 message(1,
"getEntry",
"problem extracting matrix-indexed entry from block "
849 template <
class T>
bool SusyLesHouches::getEntry(
string blockName,
int indx,
850 int jndx,
int kndx, T& val) {
853 for (
int iC=0; iC<int(blockName.size()); ++iC)
854 blockName[iC] = tolower(blockName[iC]);
857 if (genericBlocks.find(blockName) == genericBlocks.end()) {
858 message(1,
"getEntry",
"attempting to extract entry from non-existent block "
862 if (genericBlocks[blockName].size() == 0) {
863 message(1,
"getEntry",
"attempting to extract entry from zero-size block "
868 LHgenericBlock block = genericBlocks[blockName];
870 for (
int jEntry = 0; jEntry < block.size(); jEntry++) {
871 istringstream linestream(block(jEntry));
873 int indxNow, jndxNow, kndxNow;
875 linestream >> indxNow >> jndxNow >> kndxNow >> valNow;
877 if (linestream && indxNow == indx && jndxNow == jndx && kndxNow == kndx) {
883 message(1,
"getEntry",
"problem extracting tensor-indexed entry from block "
void ae(int tracks=-1, int hits=-1)
This function is to search for the next non-empty event and draw it by looping over StBFChain (readin...