StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SusyLesHouches.h
1 // SusyLesHouches.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2012 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.
6 
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.
11 
12 #ifndef SLHA_H
13 #define SLHA_H
14 
15 // Stdlib header files for string and character manipulation.
16 #include <string>
17 #include <cctype>
18 // Stdlib header files for containers.
19 #include <vector>
20 #include <map>
21 // Stdlib header files for input/output.
22 #include <iostream>
23 #include <iomanip>
24 #include <fstream>
25 #include <sstream>
26 // Stdlib header files for mathematics.
27 #include <cmath>
28 #include <cstdlib>
29 
30 // Stdlib namespace
31 using namespace std;
32 
33 //************************* SLHA AUX CLASSES *****************************//
34 
35 namespace Pythia8 {
36 
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 {
40 
41  public:
42 
43  //Constructor.
44  LHblock<T>() : idnow(0) {} ;
45 
46  //Does block exist?
47  bool exists() { return int(entry.size()) == 0 ? false : true ; };
48  //Clear block
49  void clear() { entry.clear(); };
50 
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.
55  //-1: failure.
56  int set(int iIn,T valIn) {
57  int alreadyexisting=exists(iIn)?1:0;
58  entry[iIn]=valIn;
59  return alreadyexisting;
60  };
61  // Read index and value from SLHA data line
62  int set(istringstream& linestream, bool indexed=true) {
63  i = 0;
64  if (indexed) linestream >> i >> val;
65  else linestream >> val;
66  return linestream ? set(i,val) : -1;
67  };
68  // With i already given, read value from remaining SLHA data line
69  int set(int iIn,istringstream& linestream) {
70  linestream >> val;
71  return linestream ? set(iIn,val) : -1;
72  };
73  // Shorthand for entry[0]. Used e.g. for block ALPHA.
74  void set(T valIn) { entry[0]=valIn; };
75 
76  // Does entry i already exist in this block?
77  bool exists(int iIn) {return entry.find(iIn) != entry.end()
78  ? true : false;};
79 
80  // Indexing with (). Output only.
81  T operator()() {
82  if (exists(0)) {return entry[0];} else {T dummy(0); return dummy;};
83  };
84  T operator()(int iIn) {
85  if (exists(iIn)) {return entry[iIn];} else {T dummy(0); return dummy;};
86  };
87 
88  // Size of map
89  int size() {return int(entry.size());};
90 
91  // First and next key code
92  int first() { idnow = entry.begin()->first; return idnow; };
93  int next() {
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;
98  };
99 
100  // Simple print utility
101  void print() {
102  bool finished=false;
103  int ibegin=first();
104  i=ibegin;
105  while (!finished) {
106  cout << " "<< i << " " << entry[i] <<endl;
107  i=next();
108  if (i == ibegin) finished=true;
109  };
110  };
111 
112  // Special for DRbar running blocks.
113  void setq(double qIn) { qDRbar=qIn; }
114  double q() { return qDRbar; }
115 
116  protected:
117  map<int,T> entry;
118 
119  private:
120  int idnow;
121  double qDRbar;
122  //Auxiliary vars
123  int i;
124  T val;
125  };
126 
127  // Derived class for generic blocks containing vectors of strings.
128  class LHgenericBlock : public LHblock<string> {
129 
130  public:
131 
132  //Constructor.
133  LHgenericBlock() { } ;
134 
135  // Read index and value from SLHA data line
136  int set(string lineIn) {
137  entry[entry.size()] = lineIn;
138  return 0;
139  };
140 
141  };
142 
143  // class LHmatrixBlock: the generic SLHA matrix
144  // Explicit sizing required, e.g.LHmatrixBlock<4> nmix;
145  template <int size> class LHmatrixBlock {
146  public:
147  //Constructor. Set uninitialized and explicitly zero.
149  initialized=false;
150  for (i=1;i<=size;i++) {
151  for (j=1;j<=size;j++) {
152  entry[i][j]=0.0;
153  };
154  };
155  };
156 
157  // Assignment
158  LHmatrixBlock& operator=(const LHmatrixBlock& m) {
159  if (this != &m) {
160  for (i=0;i<size;i++) for (j=0;j<=size;j++) entry[i][j] = m(i,j);
161  qDRbar = m.qDRbar;
162  initialized = m.initialized;
163  }
164  return *this; };
165 
166  // Does this matrix contain any entries?
167  bool exists() { return initialized; };
168  // Clear initialized flag
169  void clear() { initialized=false; };
170 
171  // Set matrix entry
172  int set(int iIn,int jIn, double valIn) {
173  if (iIn>0 && jIn>0 && iIn<=size && jIn<=size) {
174  entry[iIn][jIn]=valIn;
175  initialized=true;
176  return 0;
177  } else {
178  return -1;
179  };
180  };
181 
182  // Set entry from linestream (used during file read)
183  int set(istringstream& linestream) {
184  linestream >> i >> j >> val;
185  return linestream ? set(i,j,val) : -1;
186  };
187 
188  // () Overloading: Get entry
189  double operator()(int iIn, int jIn) const {
190  return (iIn <= size && jIn <= size && iIn > 0 && jIn > 0) ?
191  entry[iIn][jIn] : 0.0;
192  };
193 
194  // Set and get scale for DRbar running LHblocks.
195  void setq(double qIn) { qDRbar=qIn; }
196  double q() { return qDRbar; }
197 
198  // Simple print utility, to be elaborated on.
199  void print() {
200  for (i=1;i<=size;i++) {
201  cout << " "<<i << " " ;
202  for (j=1;j<=size;j++) cout << entry[i][j] << " ";
203  cout << endl;
204  };
205  };
206 
207  private:
208  bool initialized;
209  double entry[size+1][size+1];
210  double qDRbar;
211  //Auxiliary vars
212  int i,j;
213  double val;
214  };
215 
216  // class tensorBlock: the generic SLHA tensor
217  // Explicit sizing required, e.g. tensorBlock<3> rvlam;
218  template <int size> class LHtensor3Block {
219  public:
220  //Constructor. Set uninitialized and explicitly zero.
222  initialized=false;
223  for (i=1;i<=size;i++) {
224  for (j=1;j<=size;j++) {
225  for (k=1;k<=size;k++) {
226  entry[i][j][k]=0.0;
227  };
228  };
229  };
230  };
231 
232  // Assignment
233  LHtensor3Block& operator=(const LHtensor3Block& m) {
234  if (this != &m) {
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);
237  qDRbar = m.qDRbar;
238  initialized = m.initialized;
239  }
240  return *this; };
241 
242  // Does this matrix contain any entries?
243  bool exists() { return initialized; };
244  // Clear initialized flag
245  void clear() { initialized=false; };
246 
247  // Set matrix entry
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;
251  initialized=true;
252  return 0;
253  } else {
254  return -1;
255  };
256  };
257 
258  // Set entry from linestream (used during file read)
259  int set(istringstream& linestream) {
260  linestream >> i >> j >> k >> val;
261  return linestream ? set(i,j,k,val) : -1;
262  };
263 
264  // () Overloading: Get entry
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;
268  };
269 
270  // Set and get scale for DRbar running LHblocks.
271  void setq(double qIn) { qDRbar=qIn; }
272  double q() { return qDRbar; }
273 
274  // Simple print utility, to be elaborated on.
275  void print() {
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] << " ";
281  cout << endl;
282  };
283  };
284  };
285  };
286 
287  private:
288  bool initialized;
289  double entry[size+1][size+1][size+1];
290  double qDRbar;
291  //Auxiliary vars
292  int i,j,k;
293  double val;
294  };
295 
296  //*************************** DECAY TABLES ***************************//
297 
299  public:
300 
301  LHdecayChannel() : brat(0.0) {};
302  LHdecayChannel(double bratIn, int nDaIn, vector<int> idDaIn, string cIn="") {
303  setChannel(bratIn,nDaIn,idDaIn,cIn);
304  }
305 
306  // Functions to set decay channel information
307  void setChannel(double bratIn, int nDaIn, vector<int> idDaIn,
308  string cIn="") {
309  brat = bratIn;
310  for (int i=0; i<=nDaIn; i++) {
311  if (i < int(idDaIn.size())) idDa.push_back(idDaIn[i]);
312  comment = cIn;
313  }
314  }
315  void setBrat(double bratIn) {brat=bratIn;}
316  void setIdDa(vector<int> idDaIn) {idDa = idDaIn;}
317 
318  // Functions to get decay channel information
319  double getBrat() {return brat;}
320  int getNDa() {return int(idDa.size());}
321  vector<int> getIdDa() {return idDa;}
322  string getComment() {return comment;}
323 
324  private:
325  double brat;
326  vector<int> idDa;
327  string comment;
328 
329  };
330 
331  class LHdecayTable {
332  public:
333 
334  LHdecayTable() : id(0), width(0.0) {};
335  LHdecayTable(int idIn) : id(idIn), width(0.0) {};
336  LHdecayTable(int idIn, double widthIn) : id(idIn), width(widthIn) {};
337 
338  // Functions to get PDG code (id) and width
339  int getId() {return id;}
340  double getWidth() {return width;}
341 
342  // Functions to set PDG code (id) and width
343  void setId(int idIn) {id = idIn;}
344  void setWidth(double widthIn) {width=widthIn;}
345 
346  // Function to reset size and width (width -> 0 by default)
347  void reset(double widthIn=0.0) {table.resize(0); width=widthIn;}
348 
349  // Function to add another decay channel
350  void addChannel(LHdecayChannel channelIn) {table.push_back(channelIn);}
351  void addChannel(double bratIn, int nDaIn, vector<int> idDaIn,
352  string cIn="") {
353  LHdecayChannel newChannel(bratIn, nDaIn, idDaIn, cIn);
354  table.push_back(newChannel);
355  }
356 
357  // Function to return number of decay channels
358  int size() {return int(table.size());}
359 
360  // Function to return a branching ratio
361  double getBrat(int iChannel) {
362  if (iChannel >= 0 && iChannel < int(table.size())) {
363  return table[iChannel].getBrat();
364  } else {
365  return 0.0;
366  }
367  }
368  // Function to return daughter PDG codes
369  vector<int> getIdDa(int iChannel) {
370  if (iChannel >= 0 && iChannel < int(table.size())) {
371  return table[iChannel].getIdDa();
372  } else {
373  vector<int> dum;
374  return dum;
375  }
376  }
377  // Function to return a decay channel
378  LHdecayChannel getChannel(int iChannel) {
379  if (iChannel >= 0 && iChannel < int(table.size())) {
380  return table[iChannel];
381  } else {
382  LHdecayChannel dum;
383  return dum;
384  }
385  }
386 
387  private:
388  int id;
389  double width;
390  vector<LHdecayChannel> table;
391 
392  };
393 
394 //==========================================================================
395 
397 
398 public:
399 
400  //Constructor, with and without filename.
401  SusyLesHouches(int verboseIn=1) : verbose(verboseIn),
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);};
408 
409  //***************************** SLHA FILE I/O *****************************//
410  // Read and write SLHA files
411  int readFile(string slhaFileIn="slha.spc",int verboseIn=1,
412  bool useDecayIn=true);
413  //int writeFile(string filename): write SLHA file on filename
414 
415  //Output utilities
416  void printHeader(); // print Header
417  void printFooter(); // print Footer
418  void printSpectrum(int ifail=0); // print Spectrum
419 
420  // Check spectrum and decays
421  int checkSpectrum();
422  int checkDecays();
423 
424  // File Name (can be either SLHA or LHEF)
425  string slhaFile;
426 
427  // Class for SLHA data entry
428  class Entry {
429 
430  public:
431  //Constructor.
432  Entry() : isIntP(false), isDoubleP(false),
433  isStringP(false), n(0), d(0.0), s(""), commentP("") {}
434 
435  // Generic functions to inquire whether an int, double, or string
436  bool isInt(){return isIntP;}
437  bool isDouble(){return isDoubleP;}
438  bool isString(){return isStringP;}
439 
440  // = Overloading: Set entry to int, double, or string
441  Entry& operator=(double& val) {
442  d=val;isIntP=false;isDoubleP=true;isStringP=false;
443  return *this;
444  };
445  Entry& operator=(int& val) {
446  n=val;isIntP=true;isDoubleP=false;isStringP=false;
447  return *this;
448  };
449  Entry& operator=(string& val) {
450  s=val;isIntP=false;isDoubleP=false;isStringP=true;
451  return *this;
452  };
453 
454  // Set and Get comment
455  void setComment(string comment) {commentP=comment;}
456  void getComment(string comment) {comment=commentP;}
457 
458  // Generic functions to get value
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;}
462 
463  private:
464  bool isIntP, isDoubleP, isStringP;
465  int n;
466  double d;
467  string s;
468  string commentP;
469 
470  };
471 
472  //*************************** THE SLHA1 BLOCKS ***************************//
473  //Blocks for model definition:
474  LHblock<int> modsel;
475  LHblock<int> modsel21;
476  LHblock<double> modsel12;
477  LHblock<double> minpar;
478  LHblock<double> extpar;
479  LHblock<double> sminputs;
480  //Blocks for RGE program specific output
481  LHblock<string> spinfo;
482  LHblock<string> spinfo3;
483  LHblock<string> spinfo4;
484  //Blocks for DCY program specific output
485  LHblock<string> dcinfo;
486  LHblock<string> dcinfo3;
487  LHblock<string> dcinfo4;
488  //Blocks for mass and coupling spectrum
489  LHblock<double> mass;
490  LHmatrixBlock<4> nmix;
491  LHmatrixBlock<2> umix;
492  LHmatrixBlock<2> vmix;
493  LHmatrixBlock<2> stopmix;
494  LHmatrixBlock<2> sbotmix;
495  LHmatrixBlock<2> staumix;
496  LHblock<double> alpha;
497  LHblock<double> hmix;
498  LHblock<double> gauge;
499  LHblock<double> msoft;
500  LHmatrixBlock<3> au;
501  LHmatrixBlock<3> ad;
503  LHmatrixBlock<3> yu;
504  LHmatrixBlock<3> yd;
505  LHmatrixBlock<3> ye;
506 
507  //************************ THE SLHA1 DECAY TABLES ************************//
508  vector<LHdecayTable> decays;
509  map<int,int> decayIndices;
510 
511  //********************* THE BSM-SLHA QNUMBERS BLOCKS *********************//
512  vector< LHblock<int> > qnumbers; // Zero'th entry is PDG code
513  vector< string > qnumbersName;
514  vector< string > qnumbersAntiName;
515 
516  //*************************** THE SLHA2 BLOCKS ***************************//
517  //Additions to SLHA1
518  LHblock<double> qextpar;
519 
520  //FLV Input
521  LHblock<double> vckmin; // The input CKM Wolfenstein parms.
522  LHblock<double> upmnsin; // The input PMNS PDG parms.
523  LHmatrixBlock<3> msq2in; // The input upper off-diagonal msq2
524  LHmatrixBlock<3> msu2in; // The input upper off-diagonal msu2
525  LHmatrixBlock<3> msd2in; // The input upper off-diagonal msd2
526  LHmatrixBlock<3> msl2in; // The input upper off-diagonal msl2
527  LHmatrixBlock<3> mse2in; // The input upper off-diagonal mse2
528  LHmatrixBlock<3> tuin; // The input upper off-diagonal TU
529  LHmatrixBlock<3> tdin; // The input upper off-diagonal TD
530  LHmatrixBlock<3> tein; // The input upper off-diagonal TE
531  //FLV Output
532  LHmatrixBlock<3> vckm; // The output DRbar running Re{VCKM} at Q
533  LHmatrixBlock<3> upmns; // The output DRbar running Re{UPMNS} at Q
534  LHmatrixBlock<3> msq2; // The output DRbar running msq2 at Q
535  LHmatrixBlock<3> msu2; // The output DRbar running msu2 at Q
536  LHmatrixBlock<3> msd2; // The output DRbar running msd2 at Q
537  LHmatrixBlock<3> msl2; // The output DRbar running msl2 at Q
538  LHmatrixBlock<3> mse2; // The output DRbar running mse2 at Q
539  LHmatrixBlock<3> tu; // The output DRbar running TU at Q
540  LHmatrixBlock<3> td; // The output DRbar running TD at Q
541  LHmatrixBlock<3> te; // The output DRbar running TE at Q
542  LHmatrixBlock<6> usqmix; // The Re{} up squark mixing matrix
543  LHmatrixBlock<6> dsqmix; // The Re{} down squark mixing matrix
544  LHmatrixBlock<6> selmix; // The Re{} selectron mixing matrix
545  LHmatrixBlock<3> snumix; // The Re{} sneutrino mixing matrix
546  LHmatrixBlock<3> snsmix; // The scalar sneutrino mixing matrix
547  LHmatrixBlock<3> snamix; // The pseudoscalar neutrino mixing matrix
548 
549  //RPV Input
550  LHtensor3Block<3> rvlamllein; // The input LNV lambda couplings
551  LHtensor3Block<3> rvlamlqdin; // The input LNV lambda' couplings
552  LHtensor3Block<3> rvlamuddin; // The input BNV lambda'' couplings
553  LHtensor3Block<3> rvtllein; // The input LNV T couplings
554  LHtensor3Block<3> rvtlqdin; // The input LNV T' couplings
555  LHtensor3Block<3> rvtuddin; // The input BNV T'' couplings
556  LHblock<double> rvkappain; // The input LNV kappa couplings
557  LHblock<double> rvdin; // The input LNV D terms
558  LHblock<double> rvm2lh1in; // The input LNV m2LH1 couplings
559  LHblock<double> rvsnvevin; // The input LNV sneutrino vevs
560  //RPV Output
561  LHtensor3Block<3> rvlamlle; // The output LNV lambda couplings
562  LHtensor3Block<3> rvlamlqd; // The output LNV lambda' couplings
563  LHtensor3Block<3> rvlamudd; // The output BNV lambda'' couplings
564  LHtensor3Block<3> rvtlle; // The output LNV T couplings
565  LHtensor3Block<3> rvtlqd; // The output LNV T' couplings
566  LHtensor3Block<3> rvtudd; // The output BNV T'' couplings
567  LHblock<double> rvkappa; // The output LNV kappa couplings
568  LHblock<double> rvd; // The output LNV D terms
569  LHblock<double> rvm2lh1; // The output LNV m2LH1 couplings
570  LHblock<double> rvsnvev; // The output LNV sneutrino vevs
571  LHmatrixBlock<7> rvnmix; // The RPV neutralino mixing matrix
572  LHmatrixBlock<5> rvumix; // The RPV chargino L mixing matrix
573  LHmatrixBlock<5> rvvmix; // The RPV chargino R mixing matrix
574  LHmatrixBlock<5> rvhmix; // The RPV neutral scalar mixing matrix
575  LHmatrixBlock<5> rvamix; // The RPV neutral pseudoscalar mixing matrix
576  LHmatrixBlock<8> rvlmix; // The RPV charged fermion mixing matrix
577 
578  //CPV Input
579  LHblock<double> imminpar;
580  LHblock<double> imextpar;
581  //CPV Output
582  LHmatrixBlock<4> cvhmix; // The CPV Higgs mixing matrix
583  LHmatrixBlock<4> imcvhmix; // Optional: imaginary components
584  LHmatrixBlock<3> imau,imad,imae; // Im{} of AU, AD, AE
585  LHblock<double> imhmix;
586  LHblock<double> immsoft;
587 
588  //CPV + FLV Input
589  LHmatrixBlock<3> immsq2in; // The Im{} input upper off-diagonal msq2
590  LHmatrixBlock<3> immsu2in; // The Im{} input upper off-diagonal msu2
591  LHmatrixBlock<3> immsd2in; // The Im{} input upper off-diagonal msd2
592  LHmatrixBlock<3> immsl2in; // The Im{} input upper off-diagonal msl2
593  LHmatrixBlock<3> immse2in; // The Im{} input upper off-diagonal mse2
594  LHmatrixBlock<3> imtuin,imtdin,imtein; // The Im{} input upper off-diagonal T
595  //CPV + FLV Output
596  LHmatrixBlock<3> imvckm; // The output DRbar running Im{VCKM} at Q
597  LHmatrixBlock<3> imupmns; // The output DRbar running Im{UPMNS} at Q
598  LHmatrixBlock<3> immsq2; // The output DRbar running msq2 at Q
599  LHmatrixBlock<3> immsu2; // The output DRbar running msu2 at Q
600  LHmatrixBlock<3> immsd2; // The output DRbar running msd2 at Q
601  LHmatrixBlock<3> immsl2; // The output DRbar running msl2 at Q
602  LHmatrixBlock<3> immse2; // The output DRbar running mse2 at Q
603  LHmatrixBlock<3> imtu,imtd,imte; // Im{} of TU, TD, TE
604  LHmatrixBlock<6> imusqmix;// The Im{} up squark mixing matrix
605  LHmatrixBlock<6> imdsqmix; // The Im{} down squark mixing matrix
606  LHmatrixBlock<6> imselmix; // The Im{} selectron mixing matrix
607  LHmatrixBlock<3> imsnumix; // The Im{} sneutrino mixing matrix
608  LHmatrixBlock<4> imnmix; // The Im{} neutralino mixing matrix
609  LHmatrixBlock<4> imumix; // The Im{} chargino L mixing matrix
610  LHmatrixBlock<4> imvmix; // The Im{} chargino R mixing matrix
611 
612  //NMSSM Input
613  // All input is in EXTPAR
614  //NMSSM Output
615  LHblock<double> nmssmrun; // The LHblock of NMSSM running parameters
616  LHmatrixBlock<3> nmhmix; // The NMSSM scalar Higgs mixing
617  LHmatrixBlock<3> nmamix; // The NMSSM pseudoscalar Higgs mixing
618  LHmatrixBlock<5> nmnmix; // The NMSSM neutralino mixing
619  LHmatrixBlock<5> imnmnmix; // Im{} (for future use)
620 
621  //*************************** SET BLOCK VALUE ****************************//
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);
626 
627  //********************* GENERIC/USER-DEFINED BLOCKS **********************//
628  // bool getEntry(name, indices, value)
629  // = true if LHblock and entry exists (value returned in value, typecast
630  // by user in call)
631  // = false otherwise
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&);
638 
639  // Output of messages from SLHA interface
640  void message(int, string,string ,int line=0);
641 
642  //***************************** SLHA PRIVATE *****************************//
643 private:
644  //SLHA I/O
645  int verbose;
646  bool headerPrinted, footerPrinted, filePrinted;
647  bool slhaRead, lhefRead, lhefSlha, useDecay;
648 
649 };
650 
651 //--------------------------------------------------------------------------
652 
653 // utilities to set generic blocks
654 
655 template <class T> int SusyLesHouches::set(string blockName, T val) {
656 
657  // Make sure everything is interpreted as lower case (for safety)
658  for (int iC=0; iC<int(blockName.size()); ++iC)
659  blockName[iC] = tolower(blockName[iC]);
660 
661  // Add new generic block if not already existing
662  if (genericBlocks.find(blockName) == genericBlocks.end()) {
663  LHgenericBlock gBlock;
664  genericBlocks[blockName]=gBlock;
665  }
666 
667  // Convert input value to string
668  ostringstream lineStream;
669  lineStream << val;
670  return genericBlocks[blockName].set(lineStream.str());
671 
672 }
673 
674 template <class T> int SusyLesHouches::set(string blockName, int indx, T val) {
675 
676  // Make sure everything is interpreted as lower case (for safety)
677  for (int iC=0; iC<int(blockName.size()); ++iC)
678  blockName[iC] = tolower(blockName[iC]);
679 
680  // Add new generic block if not already existing
681  if (genericBlocks.find(blockName) == genericBlocks.end()) {
682  LHgenericBlock gBlock;
683  genericBlocks[blockName]=gBlock;
684  }
685 
686  // Convert input value to string
687  ostringstream lineStream;
688  lineStream << indx<<" "<<val;
689  return genericBlocks[blockName].set(lineStream.str());
690 
691 }
692 
693 template <class T> int SusyLesHouches::set(string blockName, int indx,
694  int jndx, T val) {
695 
696  // Make sure everything is interpreted as lower case (for safety)
697  for (int iC=0; iC<int(blockName.size()); ++iC)
698  blockName[iC] = tolower(blockName[iC]);
699 
700  // Add new generic block if not already existing
701  if (genericBlocks.find(blockName) == genericBlocks.end()) {
702  LHgenericBlock gBlock;
703  genericBlocks[blockName]=gBlock;
704  }
705 
706  // Convert input value to string
707  ostringstream lineStream;
708  lineStream << indx<<" "<<jndx<<" "<<val;
709  return genericBlocks[blockName].set(lineStream.str());
710 
711 }
712 
713 template <class T> int SusyLesHouches::set(string blockName, int indx,
714  int jndx, int kndx, T val) {
715 
716  // Make sure everything is interpreted as lower case (for safety)
717  for (int iC=0; iC<int(blockName.size()); ++iC)
718  blockName[iC] = tolower(blockName[iC]);
719 
720  // Add new generic block if not already existing
721  if (genericBlocks.find(blockName) == genericBlocks.end()) {
722  LHgenericBlock gBlock;
723  genericBlocks[blockName]=gBlock;
724  }
725 
726  // Convert input value to string
727  ostringstream lineStream;
728  lineStream << indx<<" "<<jndx<<" "<<kndx<<" "<<val;
729  return genericBlocks[blockName].set(lineStream.str());
730 
731 }
732 
733 // utilities to read generic blocks
734 
735 template <class T> bool SusyLesHouches::getEntry(string blockName, T& val) {
736 
737  // Make sure everything is interpret as lower case (for safety)
738  for (int iC=0; iC<int(blockName.size()); ++iC)
739  blockName[iC] = tolower(blockName[iC]);
740 
741  // Safety checks
742  if (genericBlocks.find(blockName) == genericBlocks.end()) {
743  message(1,"getEntry","attempting to extract entry from non-existent block "
744  +blockName);
745  return false;
746  }
747  if (genericBlocks[blockName].size() == 0) {
748  message(1,"getEntry","attempting to extract entry from zero-size block "
749  +blockName);
750  return false;
751  }
752  if (genericBlocks[blockName].size() >= 2) {
753  message(1,"getEntry","attempting to extract un-indexed entry "
754  "from multi-entry block "+blockName);
755  return false;
756  }
757  // Attempt to extract value as class T
758  LHgenericBlock block = genericBlocks[blockName];
759  istringstream linestream(block(0));
760  linestream >> val;
761  if ( !linestream ) {
762  message(1,"getEntry","problem extracting un-indexed entry "
763  "from block "+blockName);
764  return false;
765  }
766  // If made it all the way here, value was successfully extracted.
767  // Return true.
768  return true;
769 }
770 
771 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
772  T& val) {
773 
774  // Make sure everything is interpret as lower case (for safety)
775  for (int iC=0; iC<int(blockName.size()); ++iC)
776  blockName[iC] = tolower(blockName[iC]);
777 
778  // Safety checks
779  if (genericBlocks.find(blockName) == genericBlocks.end()) {
780  message(1,"getEntry","attempting to extract entry from non-existent block "
781  +blockName);
782  return false;
783  }
784  if (genericBlocks[blockName].size() == 0) {
785  message(1,"getEntry","attempting to extract entry from zero-size block "
786  +blockName);
787  return false;
788  }
789  // Attempt to extract indexed value as class T
790  LHgenericBlock block = genericBlocks[blockName];
791  // Loop over block contents, search for indexed entry with index i
792  for (int jEntry = 0; jEntry < block.size(); jEntry++) {
793  istringstream linestream(block(jEntry));
794  // Buffer line according to format selected by T
795  int indxNow;
796  T valNow;
797  linestream >> indxNow >> valNow;
798  // If index found and value was readable, return true
799  if (linestream && indxNow == indx) {
800  val = valNow;
801  return true;
802  }
803  }
804  // If index not found or unreadable, return false
805  message(1,"getEntry","problem extracting indexed entry from block "
806  +blockName);
807  return false;
808 }
809 
810 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
811  int jndx, T& val) {
812 
813  // Make sure everything is interpret as lower case (for safety)
814  for (int iC=0; iC<int(blockName.size()); ++iC)
815  blockName[iC] = tolower(blockName[iC]);
816 
817  // Safety checks
818  if (genericBlocks.find(blockName) == genericBlocks.end()) {
819  message(1,"getEntry","attempting to extract entry from non-existent block "
820  +blockName);
821  return false;
822  }
823  if (genericBlocks[blockName].size() == 0) {
824  message(1,"getEntry","attempting to extract entry from zero-size block "
825  +blockName);
826  return false;
827  }
828  // Attempt to extract matrix-indexed value as class T
829  LHgenericBlock block = genericBlocks[blockName];
830  // Loop over block contents, search for indexed entry with indices i, j
831  for (int jEntry = 0; jEntry < block.size(); jEntry++) {
832  istringstream linestream(block(jEntry));
833  // Buffer line according to format selected by T
834  int indxNow, jndxNow;
835  T valNow;
836  linestream >> indxNow >> jndxNow >> valNow;
837  // If index found and value was readable, return true
838  if (linestream && indxNow == indx && jndxNow == jndx) {
839  val = valNow;
840  return true;
841  }
842  }
843  // If index not found or unreadable, return false
844  message(1,"getEntry","problem extracting matrix-indexed entry from block "
845  +blockName);
846  return false;
847 }
848 
849 template <class T> bool SusyLesHouches::getEntry(string blockName, int indx,
850  int jndx, int kndx, T& val) {
851 
852  // Make sure everything is interpret as lower case (for safety)
853  for (int iC=0; iC<int(blockName.size()); ++iC)
854  blockName[iC] = tolower(blockName[iC]);
855 
856  // Safety checks
857  if (genericBlocks.find(blockName) == genericBlocks.end()) {
858  message(1,"getEntry","attempting to extract entry from non-existent block "
859  +blockName);
860  return false;
861  }
862  if (genericBlocks[blockName].size() == 0) {
863  message(1,"getEntry","attempting to extract entry from zero-size block "
864  +blockName);
865  return false;
866  }
867  // Attempt to extract tensor-indexed value as class T
868  LHgenericBlock block = genericBlocks[blockName];
869  // Loop over block contents, search for indexed entry with indices i, j, k
870  for (int jEntry = 0; jEntry < block.size(); jEntry++) {
871  istringstream linestream(block(jEntry));
872  // Buffer line according to format selected by T
873  int indxNow, jndxNow, kndxNow;
874  T valNow;
875  linestream >> indxNow >> jndxNow >> kndxNow >> valNow;
876  // If index found and value was readable, return true
877  if (linestream && indxNow == indx && jndxNow == jndx && kndxNow == kndx) {
878  val = valNow;
879  return true;
880  }
881  }
882  // If index not found or unreadable, return false
883  message(1,"getEntry","problem extracting tensor-indexed entry from block "
884  +blockName);
885  return false;
886  }
887 
888 }
889 #endif
890 
891 
892 
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...
Definition: Ed.C:102