00001 // -*- C++ -*- 00002 #include "AGILe/AlpGen/AlpGenFHerwigJimmy.hh" 00003 #include "AGILe/AlpGen/AlpGenWrapper.hh" 00004 #include "AGILe/FHerwig/FHerwigWrapper65.hh" 00005 #include "AGILe/FHerwig/JimmyWrapper.hh" 00006 #include "AGILe/Utils.hh" 00007 #include "HepMC/HEPEVT_Wrapper.h" 00008 00009 00010 //----------------------------------------------------------------------------- 00011 // Implementation file for class : AlpGenFHerwigJimmy 00012 // This is the file-reading interface wrapper only. It contains an instance of 00013 // FHerwigJimmy which does most of the work. This class is only to provide access to 00014 // the parameter 00015 // settings. 00016 // 00017 // Authors: Jon Butterworth 00018 // Andy Buckley 00019 //----------------------------------------------------------------------------- 00020 00021 00022 namespace AGILe { 00023 00024 00025 // Standard constructor 00026 AlpGenFHerwigJimmy::AlpGenFHerwigJimmy() { 00027 // Set flag to read from LHA event file 00028 FC_HWPROC.IPROC = -100; 00029 _iprocset = true; 00030 00031 // Set the ALPGEN filename to "zhjj" by default 00032 FC_AHIO.FILENAME[0] = 'z'; 00033 FC_AHIO.FILENAME[1] = 'h'; 00034 FC_AHIO.FILENAME[2] = 'j'; 00035 FC_AHIO.FILENAME[3] = 'j'; 00036 } 00037 00038 00039 // Set string parameters 00040 bool AlpGenFHerwigJimmy::setParam(const string& name, const string& value) { 00041 // Try AlpGen param handling first 00042 bool ok = _alpgen.setParam(name, value); 00043 if (ok) return SUCCESS; 00044 // Fall back to Herwig+Jimmy param handling 00045 ok = FHerwigJimmy::setParam(name, value); 00046 if (ok) return SUCCESS; 00047 // Fail 00048 MSG_ERROR("AlpGenHerwigJimmy doesn't have a parameter called " << name); 00049 return FAILURE; 00050 } 00051 00052 00053 // Call event generation with veto routine for MLM matching 00054 void AlpGenFHerwigJimmy::makeEvent(HepMC::GenEvent& evt) { 00055 Generator::makeEvent(evt); 00056 while (true) { 00057 int counter(0); 00058 // Repeat the first stages of event generation until multiple 00059 // scattering succeeds (or isn't run at all). 00060 while (true) { 00061 FC_HWUINE(); // Initialize event 00062 FC_HWEPRO(); // Generate hard subprocess 00063 00064 // Call the AlpGen matching routine 00065 int imatch = 0; 00066 FC_UPVETO(&imatch); 00067 if (imatch != 0) { 00068 MSG_DEBUG("Event killed by UPVETO"); 00069 FC_HWEVNT.IERROR = -1; 00070 FC_HWUFNE(); 00071 continue; 00072 } 00073 00074 counter += 1; 00075 00076 FC_HWBGEN(); // Generate parton cascade 00077 00078 // Call the multiple scattering routine with the abort flag. 00079 // If abort is returned with value 1 (true), then abandon the 00080 // event. This implementation makes sure that the event generation 00081 // continues if multiple scattering is disabled (MSFLAG != 1) 00082 int abort(0); 00083 if (FC_JMPARM.MSFLAG == 1) FC_HWMSCT(&abort); 00084 // If MS is okay or disabled, escape the loop and 00085 // continue with the decays and hadronisation. 00086 if (abort == 0) { 00087 MSG_DEBUG("Num attempts to make MPI = " << counter); 00088 break; 00089 } 00090 00091 // Check for too many attempts to make MPI scatters 00092 if (counter > 100) { 00093 throw runtime_error("Too many attempts to make MPI in FHerwigJimmy"); 00094 } 00095 } 00096 FC_HWDHOB(); // Do heavy quark decays 00097 if (_doHadronise) { 00098 FC_HWCFOR(); // Do cluster formation 00099 FC_HWCDEC(); // Do cluster decays 00100 FC_HWDHAD(); // Do unstable particle decays 00101 FC_HWDHVY(); // Do heavy flavor decays 00102 FC_HWMEVT(); // Add soft underlying event 00103 } 00104 FC_HWUFNE(); // Finish event 00105 if (FC_HWEVNT.IERROR == 0) break; 00106 } 00107 clearEvent(evt); 00108 fillEvent(evt); 00109 } 00110 00111 00112 } 00113 00114 00115 // Class factory 00116 extern "C" { 00117 AGILe::Generator* create() { return new AGILe::AlpGenFHerwigJimmy(); } 00118 void destroy(AGILe::Generator* gen) { delete gen; } 00119 }