#include <GeneratorInterface/ComphepInterface/interface/ComphepProducer.h>
Public Member Functions | |
ComphepProducer (const ParameterSet &) | |
Constructor. | |
virtual | ~ComphepProducer () |
Destructor. | |
Private Member Functions | |
bool | call_pygive (const std::string &iParm) |
Interface to the PYGIVE/TXGIVE pythia routine, with add'l protections. | |
bool | call_txgive (const std::string &iParm) |
bool | call_txgive_init () |
void | clear () |
virtual void | produce (Event &e, const EventSetup &es) |
Private Attributes | |
std::string | CHFile_ |
MCDB input file. | |
bool | doubleParticle |
double | etamax |
double | etamin |
unsigned int | eventNumber_ |
HepMC::GenEvent * | evt |
CLHEP::HepRandomEngine * | fRandomEngine |
CLHEP::RandFlat * | fRandomGenerator |
bool | getInputFromMCDB_ |
Get input file from LCG MCDB. | |
unsigned int | maxEventsToPrint_ |
Events to print if verbosity. | |
int | MCDBArticleID_ |
Sets the MCDB Article ID (0 if none). | |
int | particleID |
double | phimax |
double | phimin |
double | ptmax |
double | ptmin |
bool | pythiaHepMCVerbosity_ |
HepMC verbosity flag. | |
unsigned int | pythiaPylistVerbosity_ |
Pythia PYLIST Verbosity flag. |
Definition at line 35 of file ComphepProducer.h.
ComphepProducer::ComphepProducer | ( | const ParameterSet & | pset | ) |
Constructor.
Definition at line 66 of file ComphepProducer.cc.
References call_pevmain(), call_pygive(), call_txgive(), call_txgive_init(), CHFile_, edm::errors::Configuration, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), getInputFromMCDB_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, maxEventsToPrint_, MCDBArticleID_, mcdbGetInputFile(), pars, pythiaHepMCVerbosity_, pythiaPylistVerbosity_, and RandomEnginePointer.
00066 : 00067 EDProducer(), evt(0), 00068 pythiaPylistVerbosity_ (pset.getUntrackedParameter<int>("pythiaPylistVerbosity",0)), 00069 pythiaHepMCVerbosity_ (pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity",false)), 00070 maxEventsToPrint_ (pset.getUntrackedParameter<int>("maxEventsToPrint",1)), 00071 getInputFromMCDB_ (pset.getUntrackedParameter<bool>("getInputFromMCDB",false)), 00072 MCDBArticleID_ (pset.getParameter<int>("MCDBArticleID")), 00073 eventNumber_(0) 00074 { 00075 00076 00077 //****** 00078 // Interface with the LCG MCDB 00079 // 00080 if (getInputFromMCDB_) { 00081 CHFile_ = pset.getUntrackedParameter<string>("ComphepInputFile"); 00082 mcdbGetInputFile(CHFile_, MCDBArticleID_); 00083 } 00084 // 00085 //****** 00086 00087 00088 00089 00090 // PYLIST Verbosity Level 00091 // Valid PYLIST arguments are: 1, 2, 3, 5, 7, 11, 12, 13 00092 pythiaPylistVerbosity_ = pset.getUntrackedParameter<int>("pythiaPylistVerbosity",0); 00093 00094 // HepMC event verbosity Level 00095 pythiaHepMCVerbosity_ = pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity",false); 00096 00097 //Max number of events printed on verbosity level 00098 maxEventsToPrint_ = pset.getUntrackedParameter<int>("maxEventsToPrint",0); 00099 00101 // Set PYTHIA parameters in a single ParameterSet 00102 { 00103 ParameterSet pythia_params = 00104 pset.getParameter<ParameterSet>("PythiaParameters") ; 00105 00106 // The parameter sets to be read (default, min bias, user ...) in the 00107 // proper order. 00108 vector<string> setNames = 00109 pythia_params.getParameter<vector<string> >("parameterSets"); 00110 00111 // Loop over the sets 00112 for ( unsigned i=0; i<setNames.size(); ++i ) { 00113 00114 string mySet = setNames[i]; 00115 00116 // Read the PYTHIA parameters for each set of parameters 00117 vector<string> pars = 00118 pythia_params.getParameter<vector<string> >(mySet); 00119 00120 if (mySet != "CSAParameters"){ 00121 00122 // Loop over all parameters and stop in case of mistake 00123 for( vector<string>::const_iterator 00124 itPar = pars.begin(); itPar != pars.end(); ++itPar ) { 00125 static string sRandomValueSetting("MRPY(1)"); 00126 if( 0 == itPar->compare(0,sRandomValueSetting.size(),sRandomValueSetting) ) { 00127 throw edm::Exception(edm::errors::Configuration,"PythiaError") 00128 <<" attempted to set random number using pythia command 'MRPY(1)' this is not allowed.\n Please use the RandomNumberGeneratorService to set the random number seed."; 00129 } 00130 if( ! call_pygive(*itPar) ) { 00131 throw edm::Exception(edm::errors::Configuration,"PythiaError") 00132 <<" pythia did not accept the following \""<<*itPar<<"\""; 00133 } 00134 } 00135 }else if(mySet == "CSAParameters"){ 00136 00137 // Read CSA parameter 00138 00139 pars = pythia_params.getParameter<vector<string> >("CSAParameters"); 00140 00141 00142 call_txgive_init(); 00143 00144 00145 // Loop over all parameters and stop in case of a mistake 00146 for (vector<string>::const_iterator 00147 itPar = pars.begin(); itPar != pars.end(); ++itPar) { 00148 call_txgive(*itPar); 00149 00150 } 00151 00152 } 00153 } 00154 00155 } 00156 00157 00158 // Read the Comphep parameter 00159 #include "GeneratorInterface/CommonInterface/interface/ExternalGenRead.inc" 00160 00161 00162 00163 //In the future, we will get the random number seed on each event and tell 00164 // pythia to use that new seed 00165 edm::Service<RandomNumberGenerator> rng; 00166 RandomEnginePointer = &(rng->getEngine()); 00167 00168 uint32_t seed = rng->mySeed(); 00169 ostringstream sRandomSet; 00170 sRandomSet <<"MRPY(1)="<<seed; 00171 call_pygive(sRandomSet.str()); 00172 00173 call_pevmain(); 00174 00175 // call_pretauola(-1); // TAUOLA initialization 00176 00177 cout << endl; // Statically add for the output 00178 //******** 00179 00180 produces<HepMCProduct>(); 00181 }
ComphepProducer::~ComphepProducer | ( | ) | [virtual] |
Destructor.
Definition at line 184 of file ComphepProducer.cc.
References clear().
00184 { 00185 call_pystat(1); 00186 // call_pretauola(1); // output from TAUOLA 00187 clear(); 00188 }
bool ComphepProducer::call_pygive | ( | const std::string & | iParm | ) | [private] |
Interface to the PYGIVE/TXGIVE pythia routine, with add'l protections.
Definition at line 242 of file ComphepProducer.cc.
References pydat1, and PYGIVE.
Referenced by ComphepProducer().
00243 { 00244 int numWarn = pydat1.mstu[26]; //# warnings 00245 int numErr = pydat1.mstu[22];// # errors 00246 //call the fortran routine pygive with a fortran string 00247 PYGIVE( iParm.c_str(), iParm.length() ); 00248 //if an error or warning happens it is problem 00249 return pydat1.mstu[26] == numWarn && pydat1.mstu[22] == numErr; 00250 }
bool ComphepProducer::call_txgive | ( | const std::string & | iParm | ) | [private] |
Definition at line 253 of file ComphepProducer.cc.
References TXGIVE.
Referenced by ComphepProducer().
00254 { 00255 //call the fortran routine txgive with a fortran string 00256 TXGIVE( iParm.c_str(), iParm.length() ); 00257 return 1; 00258 }
bool ComphepProducer::call_txgive_init | ( | ) | [private] |
Definition at line 261 of file ComphepProducer.cc.
References TXGIVE_INIT.
Referenced by ComphepProducer().
00262 { 00263 TXGIVE_INIT(); 00264 return 1; 00265 }
void ComphepProducer::produce | ( | Event & | e, | |
const EventSetup & | es | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 195 of file ComphepProducer.cc.
References call_pylist(), conv2, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::EventID::event(), eventNumber_, evt, edm::Event::id(), maxEventsToPrint_, edm::Event::put(), pypars, pythiaHepMCVerbosity_, and pythiaPylistVerbosity_.
00195 { 00196 00197 auto_ptr<HepMCProduct> bare_product(new HepMCProduct()); 00198 00199 //******** 00200 // 00201 00202 call_pyevnt(); // generate one event with Pythia 00203 // call_pretauola(0); // tau-lepton decays with TAUOLA 00204 00205 call_pyhepc( 1 ); 00206 00207 // HepMC::GenEvent* evt = conv2.getGenEventfromHEPEVT(); 00208 HepMC::GenEvent* evt = conv2.read_next_event(); 00209 evt->set_signal_process_id(pypars.msti[0]); 00210 ++eventNumber_; 00211 evt->set_event_number(eventNumber_); 00212 00213 00214 //******** Verbosity ******** 00215 00216 if(e.id().event() <= maxEventsToPrint_ && 00217 (pythiaPylistVerbosity_ || pythiaHepMCVerbosity_)) { 00218 00219 // Prints PYLIST info 00220 if(pythiaPylistVerbosity_) { 00221 call_pylist(pythiaPylistVerbosity_); 00222 } 00223 00224 // Prints HepMC event 00225 if(pythiaHepMCVerbosity_) { 00226 cout << "Event process = " << pypars.msti[0] << endl 00227 << "----------------------" << endl; 00228 evt->print(); 00229 } 00230 } 00231 00232 00233 //evt = reader_->fillCurrentEventData(); 00234 //******** 00235 00236 if(evt) bare_product->addHepMCData(evt ); 00237 00238 e.put(bare_product); 00239 }
std::string edm::ComphepProducer::CHFile_ [private] |
bool edm::ComphepProducer::doubleParticle [private] |
Definition at line 75 of file ComphepProducer.h.
double edm::ComphepProducer::etamax [private] |
Definition at line 77 of file ComphepProducer.h.
double edm::ComphepProducer::etamin [private] |
Definition at line 77 of file ComphepProducer.h.
unsigned int edm::ComphepProducer::eventNumber_ [private] |
HepMC::GenEvent* edm::ComphepProducer::evt [private] |
CLHEP::HepRandomEngine* edm::ComphepProducer::fRandomEngine [private] |
Definition at line 80 of file ComphepProducer.h.
CLHEP::RandFlat* edm::ComphepProducer::fRandomGenerator [private] |
Definition at line 81 of file ComphepProducer.h.
bool edm::ComphepProducer::getInputFromMCDB_ [private] |
Get input file from LCG MCDB.
Definition at line 67 of file ComphepProducer.h.
Referenced by ComphepProducer().
unsigned int edm::ComphepProducer::maxEventsToPrint_ [private] |
Events to print if verbosity.
Definition at line 63 of file ComphepProducer.h.
Referenced by ComphepProducer(), and produce().
int edm::ComphepProducer::MCDBArticleID_ [private] |
Sets the MCDB Article ID (0 if none).
Definition at line 69 of file ComphepProducer.h.
Referenced by ComphepProducer().
int edm::ComphepProducer::particleID [private] |
Definition at line 74 of file ComphepProducer.h.
double edm::ComphepProducer::phimax [private] |
Definition at line 78 of file ComphepProducer.h.
double edm::ComphepProducer::phimin [private] |
Definition at line 78 of file ComphepProducer.h.
double edm::ComphepProducer::ptmax [private] |
Definition at line 76 of file ComphepProducer.h.
double edm::ComphepProducer::ptmin [private] |
Definition at line 76 of file ComphepProducer.h.
HepMC verbosity flag.
Definition at line 61 of file ComphepProducer.h.
Referenced by ComphepProducer(), and produce().
unsigned int edm::ComphepProducer::pythiaPylistVerbosity_ [private] |
Pythia PYLIST Verbosity flag.
Definition at line 59 of file ComphepProducer.h.
Referenced by ComphepProducer(), and produce().