Public Member Functions | |
const char * | classname () const |
bool | decay () |
bool | declareSpecialSettings (const std::vector< std::string >) |
bool | declareStableParticles (const std::vector< int > &pdgIds) |
void | finalizeEvent () |
bool | generatePartonsAndHadronize () |
bool | initializeForInternalPartons () |
bool | residualDecay () |
SherpaHadronizer (const edm::ParameterSet ¶ms) | |
void | statistics () |
~SherpaHadronizer () | |
Private Attributes | |
SHERPA::Sherpa | Generator |
unsigned int | maxEventsToPrint |
CLHEP::HepRandomEngine * | randomEngine |
std::string | SherpaLibDir |
edm::ParameterSet | SherpaParameter |
std::string | SherpaResultDir |
Definition at line 26 of file SherpaHadronizer.cc.
SherpaHadronizer::SherpaHadronizer | ( | const edm::ParameterSet & | params | ) |
Definition at line 63 of file SherpaHadronizer.cc.
References gather_cfg::cout, edm::ParameterSet::getParameter(), i, SherpaLibDir, SherpaParameter, and SherpaResultDir.
: BaseHadronizer(params), SherpaLibDir(params.getUntrackedParameter<std::string>("libDir","Sherpa_Process")), SherpaResultDir(params.getUntrackedParameter<std::string>("resultDir","Result")), SherpaParameter(params.getParameter<edm::ParameterSet>("SherpaParameters")), maxEventsToPrint(params.getUntrackedParameter<int>("maxEventsToPrint", 0)) { // The ids (names) of parameter sets to be read (Analysis,Run) to create Analysis.dat, Run.dat //They are given as a vstring. std::vector<std::string> setNames = SherpaParameter.getParameter<std::vector<std::string> >("parameterSets"); //Loop all set names... for ( unsigned i=0; i<setNames.size(); ++i ) { // ...and read the parameters for each set given in vstrings std::vector<std::string> pars = SherpaParameter.getParameter<std::vector<std::string> >(setNames[i]); std::cout << "Write Sherpa parameter set " << setNames[i] <<" to "<<setNames[i]<<".dat "<<std::endl; std::string datfile = SherpaLibDir + "/" + setNames[i] +".dat"; std::ofstream os(datfile.c_str()); // Loop over all strings and write the according *.dat for(std::vector<std::string>::const_iterator itPar = pars.begin(); itPar != pars.end(); ++itPar ) { os<<(*itPar)<<std::endl; } } //To be conform to the default Sherpa usage create a command line: //name of executable (only for demonstration, could also be empty) std::string shRun = "./Sherpa"; //Path where the Sherpa libraries are stored std::string shPath = "PATH=" + SherpaLibDir; //Path where results are stored // std::string shRes = "RESULT_DIRECTORY=" + SherpaLibDir + "/" + SherpaResultDir; // for Sherpa <=1.1.3 std::string shRes = "RESULT_DIRECTORY=" + SherpaResultDir; // from Sherpa 1.2.0 on //Name of the external random number class std::string shRng = "EXTERNAL_RNG=CMS_SHERPA_RNG"; //create the command line char* argv[4]; argv[0]=(char*)shRun.c_str(); argv[1]=(char*)shPath.c_str(); argv[2]=(char*)shRes.c_str(); argv[3]=(char*)shRng.c_str(); //initialize Sherpa with the command line Generator.InitializeTheRun(4,argv); }
SherpaHadronizer::~SherpaHadronizer | ( | ) |
Definition at line 109 of file SherpaHadronizer.cc.
{ }
const char* SherpaHadronizer::classname | ( | ) | const [inline] |
Definition at line 39 of file SherpaHadronizer.cc.
{ return "SherpaHadronizer"; }
bool SherpaHadronizer::decay | ( | ) |
Definition at line 179 of file SherpaHadronizer.cc.
{ return true; }
bool SherpaHadronizer::declareSpecialSettings | ( | const std::vector< std::string > | ) | [inline] |
Definition at line 33 of file SherpaHadronizer.cc.
{ return true; }
bool SherpaHadronizer::declareStableParticles | ( | const std::vector< int > & | pdgIds | ) |
Definition at line 131 of file SherpaHadronizer.cc.
{ #if 0 for(std::vector<int>::const_iterator iter = pdgIds.begin(); iter != pdgIds.end(); ++iter) if (!markStable(*iter)) return false; return true; #else return false; #endif }
void SherpaHadronizer::finalizeEvent | ( | ) |
Definition at line 189 of file SherpaHadronizer.cc.
References gen::BaseHadronizer::event(), lhef::getStatus(), and maxEventsToPrint.
{ #if 0 for(HepMC::GenEvent::particle_iterator iter = event->particles_begin(); iter != event->particles_end(); iter++) (*iter)->set_status(getStatus(*iter)); #endif //******** Verbosity ******* if (maxEventsToPrint > 0) { maxEventsToPrint--; event()->print(); } }
bool SherpaHadronizer::generatePartonsAndHadronize | ( | ) |
Definition at line 162 of file SherpaHadronizer.cc.
References gen::BaseHadronizer::resetEvent().
{ //get the next event and check if it produced if (Generator.GenerateOneEvent()) { //convert it to HepMC2 SHERPA::Input_Output_Handler* ioh = Generator.GetIOHandler(); SHERPA::HepMC2_Interface* hm2i = ioh->GetHepMC2Interface(); HepMC::GenEvent* evt = hm2i->GenEvent(); //ugly!! a hard copy, since sherpa deletes the GenEvent internal resetEvent(new HepMC::GenEvent (*evt)); return true; } else { return false; } }
bool SherpaHadronizer::initializeForInternalPartons | ( | ) |
Definition at line 113 of file SherpaHadronizer.cc.
{ //initialize Sherpa Generator.InitializeTheEventHandler(); return true; }
bool SherpaHadronizer::residualDecay | ( | ) |
Definition at line 184 of file SherpaHadronizer.cc.
{ return true; }
void SherpaHadronizer::statistics | ( | ) |
Definition at line 146 of file SherpaHadronizer.cc.
References gen::BaseHadronizer::runInfo(), and GenRunInfoProduct::setInternalXSec().
{ //calculate statistics Generator.SummarizeRun(); //get the xsec from EventHandler SHERPA::Event_Handler* theEventHandler = Generator.GetEventHandler(); double xsec_val = theEventHandler->TotalXS(); double xsec_err = theEventHandler->TotalErr(); //set the internal cross section in pb in GenRunInfoProduct runInfo().setInternalXSec(GenRunInfoProduct::XSec(xsec_val,xsec_err)); }
SHERPA::Sherpa SherpaHadronizer::Generator [private] |
Definition at line 48 of file SherpaHadronizer.cc.
unsigned int SherpaHadronizer::maxEventsToPrint [private] |
Definition at line 46 of file SherpaHadronizer.cc.
Referenced by finalizeEvent().
CLHEP::HepRandomEngine* SherpaHadronizer::randomEngine [private] |
Definition at line 49 of file SherpaHadronizer.cc.
std::string SherpaHadronizer::SherpaLibDir [private] |
Definition at line 43 of file SherpaHadronizer.cc.
Referenced by SherpaHadronizer().
Definition at line 45 of file SherpaHadronizer.cc.
Referenced by SherpaHadronizer().
std::string SherpaHadronizer::SherpaResultDir [private] |
Definition at line 44 of file SherpaHadronizer.cc.
Referenced by SherpaHadronizer().