gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
retrieve_overloads.cpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
23 
26 
27 namespace Gambit
28 {
29  namespace Printers
30  {
31 
33 
35  #define RETRIEVE(TYPE) _retrieve(TYPE& out, const std::string& l, const uint r, const ulong p) \
36  { return _retrieve_template(out,l,0,r,p); }
37  bool HDF5Reader::RETRIEVE(int )
39  bool HDF5Reader::RETRIEVE(long )
41  bool HDF5Reader::RETRIEVE(float )
42  bool HDF5Reader::RETRIEVE(double )
43  #undef RETRIEVE
44 
45  #define RETRIEVEFROM(INTYPE,OUTTYPE) _retrieve(INTYPE& out, const std::string& l, const uint r, const ulong p) \
46  { \
47  OUTTYPE outtmp; \
48  bool valid = _retrieve_template(outtmp,l,0,r,p); \
49  out = (INTYPE)outtmp; \
50  return valid; \
51  }
54  #undef RETRIEVEFROM
55 
56  // Bools can't quite use the template function directly, since there
57  // are some issues with bools and MPI/HDF5 types. Easier to just convert
58  // the bool to an int first (this is how they are printed in the first place anyway).
59  bool HDF5Reader::_retrieve(bool& out, const std::string& l, const uint rank, const ulong pID)
60  {
61  uint tmp_out;
62  bool tmp_ret;
63  tmp_ret = _retrieve_template(tmp_out,l,0,rank,pID);
64  out = tmp_out;
65  return tmp_ret;
66  }
67 
68  bool HDF5Reader::_retrieve(ModelParameters& out, const std::string& modelname, const uint rank, const ulong pointID)
69  {
70  bool is_valid = true;
72  bool found_at_least_one(false);
73 
74  //std::cout << "Searching for ModelParameters of model '"<<modelname<<"'"<<std::endl;
75  // Iterate through names in HDF5 group
76  for(std::vector<std::string>::const_iterator
77  it = all_datasets.begin();
78  it!= all_datasets.end(); ++it)
79  {
80  //std::cout << "Candidate: " <<*it<<std::endl;
81  std::string param_name; // *output* of parsing function, parameter name
82  std::string label_root; // *output* of parsing function, label minus parameter name
83  if(parse_label_for_ModelParameters(*it, modelname, param_name, label_root))
84  {
85  // Add the found parameter name to the ModelParameters object
86  out._definePar(param_name);
87  if(found_at_least_one)
88  {
89  if(out.getOutputName()!=label_root)
90  {
91  std::ostringstream err;
92  err << "Error! HDF5Reader could not retrieve ModelParameters matching the model name '"
93  <<modelname<<"' in the HDF5 file:group "<<file<<":"<<group
94  <<"' (while calling 'retrieve'). Candidate parameters WERE found, however their dataset "
95  <<"labels indicate the presence of an inconsistency or ambiguity in the output. For "
96  <<"example, we just tried to retrive a model parameter from the dataset:\n "<<*it
97  <<"\nand successfully found the parameter "<<param_name
98  <<", however the root of the label, that is,\n "<<label_root
99  <<"\ndoes not match the root expected based upon previous parameter retrievals for this "
100  <<"model, which was\n "<<out.getOutputName()<<"\nThis may indicate that multiple sets "
101  <<"of model parameters are present in the output file for the same model! This is not "
102  <<"allowed, please report this bug against whatever master YAML file (or external code?) "
103  <<"produced the output file you are trying to read.";
104  printer_error().raise(LOCAL_INFO,err.str());
105  }
106  }
107  else
108  {
109  out.setOutputName(label_root);
110  }
111  // Get the corresponding value out of the data file
112  double value; // *output* of retrieve function
113  bool tmp_is_valid;
114  tmp_is_valid = _retrieve(value, *it, rank, pointID);
115  found_at_least_one = true;
116  if(tmp_is_valid)
117  {
118  out.setValue(param_name, value);
119  }
120  else
121  {
122  // If one parameter value is 'invalid' then we cannot reconstruct
123  // the ModelParameters object, so we mark the whole thing invalid.
124  out.setValue(param_name, 0);
125  is_valid = false;
126  }
127  }
128  }
129 
130  if(not found_at_least_one)
131  {
132  // Didn't find any matches!
133  std::ostringstream err;
134  err << "Error! HDF5Reader failed to find any ModelParameters matching the model name '"<<modelname<<"' in the HDF5 file:group "<<file<<":"<<group<<"' (while calling 'retrieve'). Please check that model name and input file/group are correct.";
135  printer_error().raise(LOCAL_INFO,err.str());
136  }
138  return is_valid;
139  }
140 
141  struct SLHAcombo
142  {
143  SLHAcombo(const std::string& t, const std::string& b, int i)
144  : tag(t)
145  , block(b)
146  , indices{i}
147  {}
148 
149  SLHAcombo(const std::string& t, const std::string& b, int i, int j)
150  : tag(t)
151  , block(b)
152  , indices{i,j}
153  {}
154 
155  SLHAcombo() : tag(), block(), indices() {}
156 
157  std::string tag;
158  std::string block;
159  std::vector<int> indices;
160  };
161 
162  bool HDF5Reader::retrieve_and_add_to_SLHAea(SLHAstruct& out, bool& found, const std::string& spec_type, const std::string& entry, const SLHAcombo& item, const std::set<std::string>& all_dataset_labels, const uint rank, const ulong pointID)
163  {
164  std::string tag = item.tag;
165  std::string block = item.block;
166  std::vector<int> indices = item.indices;
167 
168  // Create full dataset label
169  std::stringstream dataset_label;
170  dataset_label<<"#"<<spec_type<<" @SpecBit::get_MSSM_spectrum_as_map::"<<entry;
171  if(tag!="") dataset_label<<" "<<tag;
172 
173  //std::cout<<dataset_label.str()<<std::endl;
174  auto jt = all_dataset_labels.find(dataset_label.str());
175  if(jt==all_dataset_labels.end())
176  {
177  found = false; // No entry with this name!
178  return false;
179  }
180  else
181  {
182  found = true;
183  }
184 
185  // Ok, found! Now retrieve the data
186  double value = -999; // *output* of retrieve function
187  bool tmp_is_valid = false;
188  tmp_is_valid = _retrieve(value, dataset_label.str(), rank, pointID);
189  //std::cout<<"Spectrum entry found! entry:"<<entry<<", tag:"<<tag<<", valid:"<<tmp_is_valid<<", value:"<<value<<std::endl;
190  if(tmp_is_valid)
191  {
192  // Stick entry into the SLHAea object
193  SLHAea_check_block(out, block); // Make sure block exists first
194  if(indices.size()==1)
195  {
196  SLHAea_add(out, block, indices.at(0), value, entry+" ("+tag+")");
197  }
198  else if(indices.size()==2)
199  {
200  SLHAea_add(out, block, indices.at(0), indices.at(1), value, entry+" ("+tag+")");
201  }
202  else
203  {
204  std::ostringstream err;
205  err<<"Received invalid number of target SLHA indices for dataset: "<<dataset_label.str()<<std::endl<<"Indices were: "<<indices;
206  printer_error().raise(LOCAL_INFO,err.str());
207  }
208  }
209  return tmp_is_valid;
210  }
211 
213  bool HDF5Reader::_retrieve(SMslha_SLHAstruct& out_main, const std::string& spec_type, const uint rank, const ulong pointID)
214  {
215  SLHAstruct& out(out_main); // Interpret as ordinary SLHAea base class to get operator[] etc
216  bool is_valid = true;
217  std::map<std::string,SLHAcombo> labels_to_SLHA;
218 
219  // Read all dataset labels into a structure that we can search quickly
220  std::set<std::string> all_dataset_labels = get_all_labels();
221 
222  // MASS
223  labels_to_SLHA["Z0" ] = SLHAcombo("Pole_Mass", "SMINPUTS", 4);
224  labels_to_SLHA["W+" ] = SLHAcombo("Pole_Mass", "MASS", 24);
225  labels_to_SLHA["e-" ] = SLHAcombo("Pole_Mass", "SMINPUTS", 11);
226  labels_to_SLHA["mu-" ] = SLHAcombo("Pole_Mass", "SMINPUTS", 13);
227  labels_to_SLHA["tau-" ] = SLHAcombo("Pole_Mass", "SMINPUTS", 7);
228  labels_to_SLHA["t" ] = SLHAcombo("Pole_Mass", "SMINPUTS", 6);
229  labels_to_SLHA["b" ] = SLHAcombo("Pole_Mass", "SMINPUTS", 5);
230  labels_to_SLHA["nu_1" ] = SLHAcombo("Pole_Mass", "SMINPUTS", 12);
231  labels_to_SLHA["nu_2" ] = SLHAcombo("Pole_Mass", "SMINPUTS", 14);
232  labels_to_SLHA["nu_3" ] = SLHAcombo("Pole_Mass", "SMINPUTS", 8);
233 
234  // Light quark running masses (always at 2 GeV, I think it is. Whatever SLHA standard says.)
235  labels_to_SLHA["u_1" ] = SLHAcombo("mass1", "SMINPUTS", 22);
236  labels_to_SLHA["d_1" ] = SLHAcombo("mass1", "SMINPUTS", 21);
237  labels_to_SLHA["d_2" ] = SLHAcombo("mass1", "SMINPUTS", 23);
238 
239  // Automatically extract and add the rest of the entries
240  for(auto it=labels_to_SLHA.begin(); it!=labels_to_SLHA.end(); ++it)
241  {
242  bool found(true);
243  bool tmp_is_valid = retrieve_and_add_to_SLHAea(out, found, spec_type, it->first, it->second, all_dataset_labels, rank, pointID);
244  if(not found)
245  {
246  std::ostringstream err;
247  err << "Error! HDF5Reader encountered an error while attempting to read a spectrum of type '"<<spec_type<<"' from the HDF5 file:group "<<file<<":"<<group<<"' (while calling 'retrieve'). A required dataset could not be found ("<<it->first<<")";
248  printer_error().raise(LOCAL_INFO,err.str());
249  }
250  else if(not tmp_is_valid)
251  {
252  // No need to read any more if some required spectrum entries are invalid. Whole spectrum is invalid.
253  is_valid = false;
254  break;
255  }
256  }
257  return is_valid;
258  }
259 
261  bool HDF5Reader::_retrieve(MSSM_SLHAstruct& out_main, const std::string& spec_type, const uint rank, const ulong pointID)
262  {
263  SLHAstruct& out(out_main); // Interpret as ordinary SLHAea base class to get operator[] etc
264  bool is_valid = true;
265 
266  // Rather than iterate through the datasets, we know what entries we need to find, so we will just
267  // directly look for them.
268  // TODO: We can automate this after the SpecBit redesign, and probably
269  // just use the spectrum "setter" functions to insert this data directly into Spectrum objects.
270  // Unfortunately those don't exist in the current SimpleSpectrum objects, but they will exist after
271  // the redesign.
272  std::map<std::string,SLHAcombo> labels_to_SLHA;
273 
274  // MASS
275  labels_to_SLHA["A0" ] = SLHAcombo("Pole_Mass", "MASS", 36);
276  labels_to_SLHA["H+" ] = SLHAcombo("Pole_Mass", "MASS", 37);
277  labels_to_SLHA["W+" ] = SLHAcombo("Pole_Mass", "MASS", 24);
278  labels_to_SLHA["h0_1" ] = SLHAcombo("Pole_Mass", "MASS", 25);
279  labels_to_SLHA["h0_2" ] = SLHAcombo("Pole_Mass", "MASS", 35);
280  labels_to_SLHA["~g" ] = SLHAcombo("Pole_Mass", "MASS", 1000021);
281  labels_to_SLHA["~chi+_1"] = SLHAcombo("Pole_Mass", "MASS", 1000024);
282  labels_to_SLHA["~chi+_2"] = SLHAcombo("Pole_Mass", "MASS", 1000037);
283  labels_to_SLHA["~chi0_1"] = SLHAcombo("Pole_Mass", "MASS", 1000022);
284  labels_to_SLHA["~chi0_2"] = SLHAcombo("Pole_Mass", "MASS", 1000023);
285  labels_to_SLHA["~chi0_3"] = SLHAcombo("Pole_Mass", "MASS", 1000025);
286  labels_to_SLHA["~chi0_4"] = SLHAcombo("Pole_Mass", "MASS", 1000035);
287  labels_to_SLHA["~d_1" ] = SLHAcombo("Pole_Mass", "MASS", 1000001);
288  labels_to_SLHA["~d_2" ] = SLHAcombo("Pole_Mass", "MASS", 1000003);
289  labels_to_SLHA["~d_3" ] = SLHAcombo("Pole_Mass", "MASS", 1000005);
290  labels_to_SLHA["~d_4" ] = SLHAcombo("Pole_Mass", "MASS", 2000001);
291  labels_to_SLHA["~d_5" ] = SLHAcombo("Pole_Mass", "MASS", 2000003);
292  labels_to_SLHA["~d_6" ] = SLHAcombo("Pole_Mass", "MASS", 2000005);
293  labels_to_SLHA["~u_1" ] = SLHAcombo("Pole_Mass", "MASS", 1000002);
294  labels_to_SLHA["~u_2" ] = SLHAcombo("Pole_Mass", "MASS", 1000004);
295  labels_to_SLHA["~u_3" ] = SLHAcombo("Pole_Mass", "MASS", 1000006);
296  labels_to_SLHA["~u_4" ] = SLHAcombo("Pole_Mass", "MASS", 2000002);
297  labels_to_SLHA["~u_5" ] = SLHAcombo("Pole_Mass", "MASS", 2000004);
298  labels_to_SLHA["~u_6" ] = SLHAcombo("Pole_Mass", "MASS", 2000006);
299  labels_to_SLHA["~e-_1" ] = SLHAcombo("Pole_Mass", "MASS", 1000011);
300  labels_to_SLHA["~e-_2" ] = SLHAcombo("Pole_Mass", "MASS", 1000013);
301  labels_to_SLHA["~e-_3" ] = SLHAcombo("Pole_Mass", "MASS", 1000015);
302  labels_to_SLHA["~e-_4" ] = SLHAcombo("Pole_Mass", "MASS", 2000011);
303  labels_to_SLHA["~e-_5" ] = SLHAcombo("Pole_Mass", "MASS", 2000013);
304  labels_to_SLHA["~e-_6" ] = SLHAcombo("Pole_Mass", "MASS", 2000015);
305  labels_to_SLHA["~nu_1" ] = SLHAcombo("Pole_Mass", "MASS", 1000012);
306  labels_to_SLHA["~nu_2" ] = SLHAcombo("Pole_Mass", "MASS", 1000014);
307  labels_to_SLHA["~nu_3" ] = SLHAcombo("Pole_Mass", "MASS", 1000016);
308  // Standard Model masses. Turns out we do need to retrieve these, since
309  // they might have shifted from SMINPUTS in the spectrum generation process.
310 
311 
312  // MSOFT
313  labels_to_SLHA["M1" ] = SLHAcombo("mass1", "MSOFT", 1);
314  labels_to_SLHA["M2" ] = SLHAcombo("mass1", "MSOFT", 2);
315  labels_to_SLHA["M3" ] = SLHAcombo("mass1", "MSOFT", 3);
316  labels_to_SLHA["mHd2"] = SLHAcombo("mass2", "MSOFT", 21);
317  labels_to_SLHA["mHu2"] = SLHAcombo("mass2", "MSOFT", 22);
318 
319  // HMIX
320  labels_to_SLHA["Mu"] = SLHAcombo("mass1", "HMIX", 1);
321  // Need these two for Higgs vev and tanbeta. Not SLHA, so store in TEMP block temporarily.
322  //labels_to_SLHA["vd"] = SLHAcombo("mass1", "TEMP", 1);
323  //labels_to_SLHA["vu"] = SLHAcombo("mass1", "TEMP", 2);
324  //labels_to_SLHA["mA2"] = SLHAcombo("mass2", "HMIX", 4);
325 
326  // TD, TU, TE
327  #define LABELNXN(N,baseentry,tag,block) \
328  for(int i=1; i<=N; i++){ for(int j=1; j<=N; j++) { \
329  std::stringstream entry; \
330  entry<<baseentry<<"_("<<i<<","<<j<<")"; \
331  labels_to_SLHA[entry.str()] = SLHAcombo(tag, block, i, j); \
332  }}
333  LABELNXN(3,"TYd","mass1","TD")
334  LABELNXN(3,"TYu","mass1","TU")
335  LABELNXN(3,"TYe","mass1","TE")
336 
337  // MSQ2, MSL2, MSD2, MSU2, MSE2
338  LABELNXN(3,"mq2","mass2","MSQ2")
339  LABELNXN(3,"ml2","mass2","MSL2")
340  LABELNXN(3,"md2","mass2","MSD2")
341  LABELNXN(3,"mu2","mass2","MSU2")
342  LABELNXN(3,"me2","mass2","MSE2")
343 
344  // NMIX, UMIX, VMIX
345  LABELNXN(4,"~chi0","Pole_Mixing","NMIX")
346  LABELNXN(2,"~chi-","Pole_Mixing","UMIX")
347  LABELNXN(2,"~chi+","Pole_Mixing","VMIX")
348 
349  // USQMIX, DSQMIX, SELMIX, SNUMIX
350  LABELNXN(6,"~u","Pole_Mixing","USQMIX")
351  LABELNXN(6,"~d","Pole_Mixing","DSQMIX")
352  LABELNXN(6,"~e-","Pole_Mixing","SELMIX")
353  LABELNXN(3,"~nu","Pole_Mixing","SNUMIX")
354 
355  // SCALARMIX, PSEUDOSCALARMIX, CHARGEMIX
356  // TODO: These are not SLHA! Will be
357  // changed after SpecBit redesign
358  LABELNXN(2,"h0","Pole_Mixing","SCALARMIX")
359  LABELNXN(2,"A0","Pole_Mixing","PSEUDOSCALARMIX")
360  LABELNXN(2,"H+","Pole_Mixing","CHARGEMIX")
361  #undef LABELNXN
362 
363  // YD, YU, YE
364  #define LABEL3X3DIAG(baseentry,tag,block) \
365  for(int i=1; i<=3; i++){ \
366  std::stringstream entry; \
367  entry<<baseentry<<"_("<<i<<","<<i<<")"; \
368  labels_to_SLHA[entry.str()] = SLHAcombo(tag, block, i, i); \
369  }
370  LABEL3X3DIAG("Yd","dimensionless","YD")
371  LABEL3X3DIAG("Yu","dimensionless","YU")
372  LABEL3X3DIAG("Ye","dimensionless","YE")
373  #undef LABEL3X3DIAG
374 
375  // GAUGE
376  labels_to_SLHA["g2"] = SLHAcombo("dimensionless", "GAUGE", 2);
377  labels_to_SLHA["g3"] = SLHAcombo("dimensionless", "GAUGE", 3);
378 
379  // Read all dataset labels into a structure that we can search quickly
380  std::set<std::string> all_dataset_labels = get_all_labels();
381 
382  // Macro to help retrive parameters for custom calculations
383  #define GETPAR(OUT,NAME,TAG,TEMP_INDEX) \
384  { \
385  bool found_tmp; \
386  retrieve_and_add_to_SLHAea(out, found_tmp, spec_type, NAME, SLHAcombo(TAG, "TEMP", TEMP_INDEX), all_dataset_labels, rank, pointID); \
387  if(not found_tmp) \
388  { \
389  std::ostringstream err; \
390  err<<"Failed to find "<<NAME<<" ("<<TAG<<") needed to compute SLHA spectrum information!"; \
391  printer_error().raise(LOCAL_INFO,err.str()); \
392  } \
393  OUT = SLHAea_get(out,"TEMP",TEMP_INDEX); \
394  }
395 
396  // Manually compute tanb and mA2
397  double vd,vu,BMu;
398  GETPAR(vd,"vd","mass1",1)
399  GETPAR(vu,"vu","mass1",2)
400  GETPAR(BMu,"BMu","mass2",4)
401 
402  const double tb = vu/vd;
403  const double cb = cos(atan(tb));
404  const double c2b = cos(2*atan(tb));
405  const double sb = sin(atan(tb));
406  const double vev = sqrt(vu*vu + vd*vd);
407  const double mA2 = BMu / (cb*sb);
408 
409  double g1,g2,gprime;
410  GETPAR(g1,"g1","dimensionless",31)
411  GETPAR(g2,"g2","dimensionless",32)
412  gprime = g1*sqrt(3./5.);
413 
414  const double sin2thetaW = (gprime*gprime) / (gprime*gprime + g2*g2);
415 
416  double TYu3,yt; // 3rd gen trilinear and Yukawa
417  GETPAR(TYu3,"TYu_(3,3)","mass1",41)
418  GETPAR(yt,"Yu_(3,3)","dimensionless",42)
419  const double At = TYu3 / yt;
420 
421  // Tree level Z and top masses, needed for MSUSY reconstruction
422  // for old data sets where the scale was not saved in output
423  const double MZ = (1/2.)*sqrt(gprime*gprime + g2*g2)*vev;
424  const double Mt = yt*vu/sqrt(2.);
425 
426  double Mu;
427  GETPAR(Mu,"Mu","mass1",51)
428  // stop mixing parameter
429  const double Xt = At - Mu / tb;
430 
431  double mq2_3, mu2_3;
432  GETPAR(mq2_3,"mq2_(3,3)","mass2",20)
433  GETPAR(mu2_3,"mu2_(3,3)","mass2",21)
434 
435  // reconstruct stop masses
436  const double A = mq2_3 + mu2_3 + 0.5*MZ*MZ*c2b + 2*Mt*Mt;
437  const double B = mq2_3 - mu2_3 + (0.5-(4./3.)*sin2thetaW)*MZ*MZ*c2b;
438  const double m2st1 = 0.5*(A - sqrt(B*B + 4*Mt*Mt*Xt*Xt));
439  const double m2st2 = 0.5*(A + sqrt(B*B + 4*Mt*Mt*Xt*Xt));
440 
441  // assuming no family mixing
442  const double MSUSY = sqrt(sqrt(m2st1)*sqrt(m2st2));
443  #undef GETPAR
444 
445  // Read the "scale" entry, since we need to add this info to the block
446  // top rows.
447  double scale;
448  bool found(true);
449  retrieve_and_add_to_SLHAea(out, found, spec_type, "scale(Q)", SLHAcombo("", "TEMP", 0), all_dataset_labels, rank, pointID);
450  if(not found)
451  {
452  // In some older datasets we forgot to add the scale to the output.
453  // For now we will assume the spectrum was output by FlexibleSUSY, in which case
454  // the running parameters will be defined at the SUSY scale (geometric mean of
455  // DRbar stop masses). TODO: Set this behaviour with an option, maybe? Not sure how though.
456 
457  // Proper calculation of DRbar stop masses, from https://arxiv.org/pdf/0904.2169.pdf Eq. 29 (with non-MSSM bits removed)
458  // We assume that there is no flavour/family mixing, which is true for all our scans so far.
459  // TODO: Make sure that scale is output if we do have this mixing in the future!
460  // Retrieve extra needed values first
461  scale = MSUSY;
462  }
463  else
464  {
465  scale = SLHAea_get(out,"TEMP",0);
466  }
467 
468  // Add blocks that require scale info
469  SLHAea_add_block(out, "GAUGE", scale);
470  SLHAea_add_block(out, "YU", scale);
471  SLHAea_add_block(out, "YD", scale);
472  SLHAea_add_block(out, "YE", scale);
473  SLHAea_add_block(out, "TU", scale);
474  SLHAea_add_block(out, "TD", scale);
475  SLHAea_add_block(out, "TE", scale);
476  SLHAea_add_block(out, "HMIX", scale);
477  SLHAea_add_block(out, "MSQ2", scale);
478  SLHAea_add_block(out, "MSL2", scale);
479  SLHAea_add_block(out, "MSD2", scale);
480  SLHAea_add_block(out, "MSU2", scale);
481  SLHAea_add_block(out, "MSE2", scale);
482  SLHAea_add_block(out, "MSOFT", scale);
483 
484  // Automatically extract and add the rest of the entries
485  for(auto it=labels_to_SLHA.begin(); it!=labels_to_SLHA.end(); ++it)
486  {
487  bool found(true);
488  bool tmp_is_valid = retrieve_and_add_to_SLHAea(out, found, spec_type, it->first, it->second, all_dataset_labels, rank, pointID);
489  if(not found)
490  {
491  std::ostringstream err;
492  err << "Error! HDF5Reader encountered an error while attempting to read a spectrum of type '"<<spec_type<<"' from the HDF5 file:group "<<file<<":"<<group<<"' (while calling 'retrieve'). A required dataset could not be found ("<<it->first<<")";
493  printer_error().raise(LOCAL_INFO,err.str());
494  }
495  else if(not tmp_is_valid)
496  {
497  // No need to read any more if some required spectrum entries are invalid. Whole spectrum is invalid.
498  is_valid = false;
499  break;
500  }
501  }
502 
503  // Need to manually fix up a few entries where we didn't store the spectrum info directly
504  // in SLHA format.
505  if(is_valid)
506  {
507  SLHAea_add(out, "HMIX", 2, tb, "tan beta (Q)");
508  SLHAea_add(out, "HMIX", 3, vev, "Higgs vev (Q)");
509  SLHAea_add(out, "HMIX", 4, mA2, "m_A^2 = BMu/(cb*sb) (Q)");
510  // Normalisation of g1
511  SLHAea_add(out, "GAUGE", 1, gprime, "g' (Q)", true);
512 
513  // Add off-diagonal Yukawa terms (all zero due to SLHA conventions, but
514  // we require them internally due to automated handling of matrices
515  // We do this here rather than read the zeros from the output in case we
516  // don't bother to output them in the future.
517  std::vector<std::string> blocks = {"Yu","Yd","Ye"};
518  for(auto it=blocks.begin(); it!=blocks.end(); ++it)
519  {
520  for(int i=1; i<=3; i++){ for(int j=1; j<=3; j++) {
521  std::stringstream label;
522  label<<(*it)<<"_("<<i<<","<<j<<")";
523  if(i!=j) SLHAea_add(out, (*it), i, j, 0, label.str());
524  }}
525  }
526  }
527 
528  return is_valid;
529  }
530 
531 
532  bool HDF5Reader::_retrieve(std::vector<double>& /*out*/, const std::string& /*label*/, const uint /*rank*/, const ulong /*pointID*/)
533  { printer_error().raise(LOCAL_INFO,"NOT YET IMPLEMENTED"); return false; }
534  bool HDF5Reader::_retrieve(map_str_dbl& /*out*/, const std::string& /*label*/, const uint /*rank*/, const ulong /*pointID*/)
535  { printer_error().raise(LOCAL_INFO,"NOT YET IMPLEMENTED"); return false; }
536  bool HDF5Reader::_retrieve(triplet<double>& /*out*/, const std::string& /*label*/, const uint /*rank*/, const ulong /*pointID*/)
537  { printer_error().raise(LOCAL_INFO,"NOT YET IMPLEMENTED"); return false; }
538  bool HDF5Reader::_retrieve(map_intpair_dbl& /*out*/, const std::string& /*label*/, const uint /*rank*/, const ulong /*pointID*/)
539  { printer_error().raise(LOCAL_INFO,"NOT YET IMPLEMENTED"); return false; }
540 
541  #ifndef SCANNER_STANDALONE // All the types inside HDF5_BACKEND_TYPES need to go inside this def guard.
542 
543  bool HDF5Reader::_retrieve(DM_nucleon_couplings& /*out*/, const std::string& /*label*/, const uint /*rank*/, const ulong /*pointID*/)
544  { printer_error().raise(LOCAL_INFO,"NOT YET IMPLEMENTED"); return false; }
545  bool HDF5Reader::_retrieve(DM_nucleon_couplings_fermionic_HP& /*out*/, const std::string& /*label*/, const uint /*rank*/, const ulong /*pointID*/)
546  { printer_error().raise(LOCAL_INFO,"NOT YET IMPLEMENTED"); return false; }
547  bool HDF5Reader::_retrieve(Flav_KstarMuMu_obs& /*out*/, const std::string& /*label*/, const uint /*rank*/, const ulong /*pointID*/)
548  { printer_error().raise(LOCAL_INFO,"NOT YET IMPLEMENTED"); return false; }
549  bool HDF5Reader::_retrieve(BBN_container& /*out*/, const std::string& /*label*/, const uint /*rank*/, const ulong /*pointID*/)
550  { printer_error().raise(LOCAL_INFO,"NOT YET IMPLEMENTED"); return false; }
551 
552  #endif
553 
555 
556  }
557 }
bool _retrieve(T &, const std::string &label, const uint, const ulong)
Default _retrieve function.
EXPORT_SYMBOLS error & printer_error()
Printer errors.
void SLHAea_add_block(SLHAstruct &, const str &name, const double scale=-1)
Add a new block to an SLHAea object, with or without a scale.
#define LOCAL_INFO
Definition: local_info.hpp:34
START_MODEL mq2_3
Definition: MSSM15atQ.hpp:32
#define RETRIEVEFROM(INTYPE, OUTTYPE)
#define LABELNXN(N, baseentry, tag, block)
unsigned long long int ulonglong
START_MODEL b
Definition: demo.hpp:270
void SLHAea_add(SLHAstruct &slha, const str &block, const int index, const double value, const str &comment="", const bool overwrite=false)
Add an entry to an SLHAea object (if overwrite=false, only if it doesn&#39;t already exist) ...
const std::vector< std::string > all_datasets
Definition: hdf5reader.hpp:146
virtual std::set< std::string > get_all_labels()
Get labels of all datasets in the linked group.
Definition: hdf5reader.cpp:230
SLHAea::Coll SLHAstruct
Less confusing name for SLHAea container class.
bool _retrieve_template(T &out, const std::string &label, int aux_id, const uint rank, const ulong pointID)
"Master" templated retrieve function.
Definition: hdf5reader.hpp:185
HDF5 interface printer class declaration.
dictionary item
std::map< std::pair< int, int >, double > map_intpair_dbl
Shorthand for an int-int pair to double map.
Definition: util_types.hpp:86
#define GETPAR(OUT, NAME, TAG, TEMP_INDEX)
#define LABEL3X3DIAG(baseentry, tag, block)
unsigned long int ulong
START_MODEL mu2_3
Definition: MSSM15atQ.hpp:32
std::map< std::string, double > map_str_dbl
Shorthand for a string-to-double map.
bool retrieve_and_add_to_SLHAea(SLHAstruct &out, bool &found, const std::string &spec_type, const std::string &entry, const SLHAcombo &item, const std::set< std::string > &all_dataset_labels, const uint rank, const ulong pointID)
Extra helper function for spectrum retrieval.
HDF5 printer retriever class declaration This is a class accompanying the HDF5Printer which takes car...
double SLHAea_get(const SLHAstruct &slha, const str &block, const int index)
Get an entry from an SLHAea object as a double, with some error checking.
#define RETRIEVE(TYPE)
Retrieve functions.
TODO: see if we can use this one:
Definition: Analysis.hpp:33
bool SLHAea_check_block(SLHAstruct &slha, const str &block)
Check if a block exists in an SLHAea object, add it if not.
bool parse_label_for_ModelParameters(const std::string &fulllabel, const std::string &modelname, std::string &out, std::string &rest, bool case_sensitive=true)
Helper function for the ModelParameters &#39;_retrieve&#39; functions Parses a printer label and checks if it...
Definition: baseprinter.cpp:81
long long int longlong