CMS 3D CMS Logo

edm::HydjetSource Class Reference

#include <GeneratorInterface/HydjetInterface/interface/HydjetSource.h>

Inheritance diagram for edm::HydjetSource:

edm::GeneratedInputSource edm::ConfigurableInputSource edm::InputSource edm::ProductRegistryHelper

List of all members.

Public Member Functions

 HydjetSource (const ParameterSet &, const InputSourceDescription &)
virtual ~HydjetSource ()

Private Member Functions

void add_heavy_ion_rec (HepMC::GenEvent *evt)
HepMC::GenParticle * build_hyjet (int index, int barcode)
HepMC::GenVertex * build_hyjet_vertex (int i, int id)
bool call_hyinit (double energy, double a, int ifb, double bmin, double bmax, double bfix, int nh)
bool call_pygive (const std::string &iParm)
void clear ()
bool get_hard_particles (HepMC::GenEvent *evt, std::vector< SubEvent > &subs)
bool get_soft_particles (HepMC::GenEvent *evt, std::vector< SubEvent > &subs)
bool hydjet_init (const ParameterSet &pset)
bool hyjpythia_init (const ParameterSet &pset)
double nuclear_radius () const
virtual bool produce (Event &e)

Private Attributes

double abeamtarget_
double bfixed_
double bmax_
double bmin_
int cflag_
double comenergy
bool docollisionalenloss_
 DEFAULT = true.
bool doradiativeenloss_
HepMC::GenEvent * evt
double fracsoftmult_
 DEFAULT = true.
double hadfreeztemp_
std::string hymode_
unsigned int maxEventsToPrint_
double maxlongy_
double maxtrany_
int nhard_
int nmultiplicity_
unsigned int nquarkflavor_
int nsoft_
int nsub_
unsigned int pythiaPylistVerbosity_
 number of active quark flavors in qgp DEFAULT=0; allowed values: 0,1,2,3.
double qgpt0_
double qgptau0_
unsigned int shadowingswitch_
double signn_


Detailed Description

Definition at line 32 of file HydjetSource.h.


Constructor & Destructor Documentation

HydjetSource::HydjetSource ( const ParameterSet pset,
const InputSourceDescription desc 
)

Definition at line 39 of file HydjetSource.cc.

References abeamtarget_, bfixed_, bmax_, bmin_, call_hyinit(), cflag_, comenergy, edm::ParameterSet::getUntrackedParameter(), hydjet_init(), hyjpythia_init(), LogDebug, maxEventsToPrint_, nmultiplicity_, nuclear_radius(), and pythiaPylistVerbosity_.

00040   : GeneratedInputSource(pset, desc), evt(0), 
00041     abeamtarget_(pset.getParameter<double>("aBeamTarget")),
00042     bfixed_(pset.getParameter<double>("bFixed")),
00043     bmax_(pset.getParameter<double>("bMax")),
00044     bmin_(pset.getParameter<double>("bMin")),
00045     cflag_(pset.getParameter<int>("cFlag")),
00046     comenergy(pset.getParameter<double>("comEnergy")),
00047     doradiativeenloss_(pset.getParameter<bool>("doRadiativeEnLoss")),
00048     docollisionalenloss_(pset.getParameter<bool>("doCollisionalEnLoss")),
00049     fracsoftmult_(pset.getParameter<double>("fracSoftMultiplicity")),
00050     hadfreeztemp_(pset.getParameter<double>("hadronFreezoutTemperature")),
00051     hymode_(pset.getParameter<string>("hydjetMode")),
00052     maxEventsToPrint_(pset.getUntrackedParameter<int>("maxEventsToPrint", 1)),
00053     maxlongy_(pset.getParameter<double>("maxLongitudinalRapidity")),
00054     maxtrany_(pset.getParameter<double>("maxTransverseRapidity")),
00055     nsub_(0),
00056     nhard_(0),
00057     nmultiplicity_(pset.getParameter<int>("nMultiplicity")),
00058     nsoft_(0),
00059     nquarkflavor_(pset.getParameter<int>("qgpNumQuarkFlavor")),
00060     pythiaPylistVerbosity_(pset.getUntrackedParameter<int>("pythiaPylistVerbosity", 0)),
00061     qgpt0_(pset.getParameter<double>("qgpInitialTemperature")),
00062     qgptau0_(pset.getParameter<double>("qgpProperTimeFormation")),
00063     shadowingswitch_(pset.getParameter<int>("shadowingSwitch")),
00064     signn_(pset.getParameter<double>("sigmaInelNN"))
00065 {
00066   // Default constructor
00067 
00068   // PYLIST Verbosity Level
00069   // Valid PYLIST arguments are: 1, 2, 3, 5, 7, 11, 12, 13
00070   pythiaPylistVerbosity_ = pset.getUntrackedParameter<int>("pythiaPylistVerbosity",0);
00071   LogDebug("PYLISTverbosity") << "Pythia PYLIST verbosity level = " << pythiaPylistVerbosity_;
00072 
00073   //Max number of events printed on verbosity level 
00074   maxEventsToPrint_ = pset.getUntrackedParameter<int>("maxEventsToPrint",0);
00075   LogDebug("Events2Print") << "Number of events to be printed = " << maxEventsToPrint_;
00076 
00077   // the input impact parameter (bxx_) is in [fm]; transform in [fm/RA] for hydjet usage
00078   const float ra = nuclear_radius();
00079   LogInfo("RAScaling")<<"Nuclear radius(RA) =  "<<ra;
00080   bmin_     /= ra;
00081   bmax_     /= ra;
00082   bfixed_   /= ra;
00083 
00084   // initialize pythia
00085   hyjpythia_init(pset);
00086 
00087   // hydjet running options
00088   hydjet_init(pset);
00089 
00090   // initialize hydjet
00091   LogInfo("HYDJETinAction") << "##### Calling HYINIT("<<comenergy<<","<<abeamtarget_<<","<<cflag_<<","<<bmin_<<","<<bmax_<<","<<bfixed_<<","<<nmultiplicity_<<") ####";
00092 
00093   call_hyinit(comenergy,abeamtarget_,cflag_,bmin_,bmax_,bfixed_,nmultiplicity_);
00094     
00095   produces<HepMCProduct>();
00096   produces<GenHIEvent>();
00097 }

HydjetSource::~HydjetSource (  )  [virtual]

Definition at line 101 of file HydjetSource.cc.

References clear().

00102 {
00103   // destructor
00104 
00105   call_pystat(1);
00106 
00107   clear();
00108 }


Member Function Documentation

void HydjetSource::add_heavy_ion_rec ( HepMC::GenEvent *  evt  )  [private]

Definition at line 112 of file HydjetSource.cc.

References hyfpar, hyjpar, nsub_, and nuclear_radius().

Referenced by produce().

00113 {
00114   // heavy ion record in the final CMSSW Event
00115 
00116   HepMC::HeavyIon* hi = new HepMC::HeavyIon(
00117     nsub_,                               // Ncoll_hard/N of SubEvents
00118     static_cast<int>(hyfpar.npart / 2),  // Npart_proj
00119     static_cast<int>(hyfpar.npart / 2),  // Npart_targ
00120     static_cast<int>(hyfpar.nbcol),      // Ncoll
00121     0,                                   // spectator_neutrons
00122     0,                                   // spectator_protons
00123     0,                                   // N_Nwounded_collisions
00124     0,                                   // Nwounded_N_collisions
00125     0,                                   // Nwounded_Nwounded_collisions
00126     hyfpar.bgen * nuclear_radius(),      // impact_parameter in [fm]
00127     0,                                   // event_plane_angle
00128     0,                                   // eccentricity
00129     hyjpar.sigin                         // sigma_inel_NN
00130   );
00131 
00132   evt->set_heavy_ion(*hi);
00133 
00134   delete hi;
00135 }

HepMC::GenParticle * HydjetSource::build_hyjet ( int  index,
int  barcode 
) [private]

Definition at line 139 of file HydjetSource.cc.

References hyjets, and p.

00140 {
00141    // Build particle object corresponding to index in hyjets (soft+hard)
00142 
00143    HepMC::GenParticle* p = new HepMC::GenParticle(
00144                                                   HepMC::FourVector(hyjets.phj[0][index],  // px
00145                                                                     hyjets.phj[1][index],  // py
00146                                                                     hyjets.phj[2][index],  // pz
00147                                                                     hyjets.phj[3][index]), // E
00148                                                   hyjets.khj[1][index],// id
00149                                                   hyjets.khj[0][index] // status
00150                                                   );
00151    p->suggest_barcode(barcode);
00152 
00153    return p;
00154 }

HepMC::GenVertex * HydjetSource::build_hyjet_vertex ( int  i,
int  id 
) [private]

Definition at line 158 of file HydjetSource.cc.

References hyjets, t, x, y, and z.

00159 {
00160   // build verteces for the hyjets stored events 
00161 
00162    double x=hyjets.vhj[0][i];
00163    double y=hyjets.vhj[1][i];
00164    double z=hyjets.vhj[2][i];
00165    double t=hyjets.vhj[4][i];
00166 
00167    HepMC::GenVertex* vertex = new HepMC::GenVertex(HepMC::FourVector(x,y,z,t),id);
00168    return vertex;
00169 }

bool HydjetSource::call_hyinit ( double  energy,
double  a,
int  ifb,
double  bmin,
double  bmax,
double  bfix,
int  nh 
) [private]

Definition at line 292 of file HydjetSource.cc.

References HYINIT, and pydatr.

Referenced by HydjetSource().

00294 {
00295   // initialize hydjet  
00296 
00297    pydatr.mrpy[2]=1;
00298    HYINIT(energy,a,ifb,bmin,bmax,bfix,nh);
00299     return true;
00300 }

bool HydjetSource::call_pygive ( const std::string &  iParm  )  [private]

Definition at line 173 of file HydjetSource.cc.

References pydat1, and PYGIVE.

Referenced by hyjpythia_init().

00174 {
00175   // Set Pythia parameters
00176 
00177   int numWarn = pydat1.mstu[26]; //# warnings
00178   int numErr = pydat1.mstu[22];// # errors
00179   // call the fortran routine pygive with a fortran string
00180   PYGIVE( iParm.c_str(), iParm.length() );  
00181 
00182   // if an error or warning happens it is problem
00183   return pydat1.mstu[26] == numWarn && pydat1.mstu[22] == numErr;   
00184 }

void HydjetSource::clear ( void   )  [private]

Definition at line 188 of file HydjetSource.cc.

Referenced by ~HydjetSource().

00189 {
00190 
00191 }

bool edm::HydjetSource::get_hard_particles ( HepMC::GenEvent *  evt,
std::vector< SubEvent > &  subs 
) [private]

Referenced by produce().

bool edm::HydjetSource::get_soft_particles ( HepMC::GenEvent *  evt,
std::vector< SubEvent > &  subs 
) [private]

Referenced by produce().

bool HydjetSource::hydjet_init ( const ParameterSet pset  )  [private]

Definition at line 304 of file HydjetSource.cc.

References docollisionalenloss_, doradiativeenloss_, fracsoftmult_, hadfreeztemp_, hyflow, hyjpar, hymode_, ludatr, maxlongy_, maxtrany_, nquarkflavor_, pyqpar, qgpt0_, qgptau0_, randomEngine, shadowingswitch_, and signn_.

Referenced by HydjetSource().

00305 {
00306   // set hydjet options
00307 
00308   edm::Service<RandomNumberGenerator> rng;
00309   randomEngine = &(rng->getEngine());
00310   uint32_t seed = rng->mySeed();
00311   ludatr.mrlu[0]=seed;
00312 
00313   // hydjet running mode mode
00314   // kHydroOnly --- nhsel=0 jet production off (pure HYDRO event), nhsel=0
00315   // kHydroJets --- nhsle=1 jet production on, jet quenching off (HYDRO+njet*PYTHIA events)
00316   // kHydroQJet --- nhsel=2 jet production & jet quenching on (HYDRO+njet*PYQUEN events)
00317   // kJetsOnly  --- nhsel=3 jet production on, jet quenching off, HYDRO off (njet*PYTHIA events)
00318   // kQJetsOnly --- nhsel=4 jet production & jet quenching on, HYDRO off (njet*PYQUEN events)
00319 
00320   if(hymode_ == "kHydroOnly") hyjpar.nhsel=0;
00321   else if ( hymode_ == "kHydroJets") hyjpar.nhsel=1;
00322   else if ( hymode_ == "kHydroQJets") hyjpar.nhsel=2;
00323   else if ( hymode_ == "kJetsOnly") hyjpar.nhsel=3;
00324   else if ( hymode_ == "kQJetsOnly") hyjpar.nhsel=4;
00325   else  hyjpar.nhsel=2;
00326 
00327   // fraction of soft hydro induced multiplicity 
00328   hyflow.fpart =  fracsoftmult_; 
00329 
00330   // hadron freez-out temperature
00331   hyflow.Tf   = hadfreeztemp_;
00332 
00333   // maximum longitudinal collective rapidity
00334   hyflow.ylfl = maxlongy_;
00335   
00336   // maximum transverse collective rapidity
00337   hyflow.ytfl = maxtrany_;  
00338 
00339   // shadowing on=1, off=0
00340   hyjpar.ishad  = shadowingswitch_;
00341 
00342   // set inelastic nucleon-nucleon cross section
00343   hyjpar.sigin  = signn_;
00344 
00345   // number of active quark flavors in qgp
00346   pyqpar.nfu    = nquarkflavor_;
00347 
00348   // initial temperature of QGP
00349   pyqpar.T0u    = qgpt0_;
00350 
00351   // proper time of QGP formation
00352   pyqpar.tau0u  = qgptau0_;
00353 
00354   // type of medium induced partonic energy loss
00355   if( doradiativeenloss_ && docollisionalenloss_ ){
00356     edm::LogInfo("HydjetEnLoss") << "##### Radiative AND Collisional partonic energy loss ON ####";
00357     pyqpar.ienglu = 0; 
00358   } else if ( doradiativeenloss_ ) {
00359     edm::LogInfo("HydjetenLoss") << "##### Only RADIATIVE partonic energy loss ON ####";
00360     pyqpar.ienglu = 1; 
00361   } else if ( docollisionalenloss_ ) {
00362     edm::LogInfo("HydjetEnLoss") << "##### Only COLLISIONAL partonic energy loss ON ####";
00363     pyqpar.ienglu = 2; 
00364   } else {
00365     edm::LogInfo("HydjetEnLoss") << "##### Radiative AND Collisional partonic energy loss ON ####";
00366     pyqpar.ienglu = 0; 
00367   }
00368 
00369   return true;
00370 }

bool HydjetSource::hyjpythia_init ( const ParameterSet pset  )  [private]

Definition at line 374 of file HydjetSource.cc.

References call_pygive(), edm::errors::Configuration, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::ParameterSet::getParameter(), i, and pars.

Referenced by HydjetSource().

00375 {
00376   //Set PYTHIA parameters
00377 
00378   //random number seed
00379   edm::Service<RandomNumberGenerator> rng;
00380   uint32_t seed = rng->mySeed();
00381   ostringstream sRandomSet;
00382   sRandomSet << "MRPY(1)=" << seed;
00383   call_pygive(sRandomSet.str());
00384 
00385     // Set PYTHIA parameters in a single ParameterSet
00386   ParameterSet pythia_params = pset.getParameter<ParameterSet>("PythiaParameters") ;
00387   // The parameter sets to be read 
00388   vector<string> setNames = pythia_params.getParameter<vector<string> >("parameterSets");
00389 
00390     // Loop over the sets
00391   for ( unsigned i=0; i<setNames.size(); ++i ) {
00392     string mySet = setNames[i];
00393     
00394     // Read the PYTHIA parameters for each set of parameters
00395     vector<string> pars = pythia_params.getParameter<vector<string> >(mySet);
00396     
00397     cout << "----------------------------------------------" << endl;
00398     cout << "Read PYTHIA parameter set " << mySet << endl;
00399     cout << "----------------------------------------------" << endl;
00400     
00401     // Loop over all parameters and stop in case of mistake
00402     for( vector<string>::const_iterator itPar = pars.begin(); itPar != pars.end(); ++itPar ) {
00403       static string sRandomValueSetting("MRPY(1)");
00404       if( 0 == itPar->compare(0,sRandomValueSetting.size(),sRandomValueSetting) ) {
00405         throw edm::Exception(edm::errors::Configuration,"PythiaError")
00406           <<" Attempted to set random number using 'MRPY(1)'. NOT ALLOWED! \n Use RandomNumberGeneratorService to set the random number seed.";
00407       }
00408       if( !call_pygive(*itPar) ) {
00409         throw edm::Exception(edm::errors::Configuration,"PythiaError") 
00410           <<"PYTHIA did not accept \""<<*itPar<<"\"";
00411       }
00412     }
00413   }
00414 
00415   return true;
00416 }

double HydjetSource::nuclear_radius (  )  const [inline, private]

Definition at line 99 of file HydjetSource.h.

References funct::pow().

Referenced by add_heavy_ion_rec(), and HydjetSource().

00100 {
00101   // Return the nuclear radius derived from the 
00102   // beam/target atomic mass number.
00103 
00104   return 1.15 * pow((double)abeamtarget_, 1./3.);
00105 }

bool HydjetSource::produce ( Event e  )  [private, virtual]

Implements edm::ConfigurableInputSource.

Definition at line 420 of file HydjetSource.cc.

References add_heavy_ion_rec(), call_pylist(), edm::ConfigurableInputSource::event(), get_hard_particles(), get_soft_particles(), HYEVNT, hyflow, hyfpar, hyjpar, maxEventsToPrint_, nhard_, edm::ConfigurableInputSource::numberEventsInRun(), edm::Event::put(), pypars, pyqpar, pythiaPylistVerbosity_, and edm::InputSource::remainingEvents().

00421 {
00422   // generate single event
00423 
00424   nsoft_    = 0;
00425   nhard_    = 0;
00426 
00427   edm::LogInfo("HYDJETmode") << "##### HYDJET  nhsel = " << hyjpar.nhsel;
00428   edm::LogInfo("HYDJETfpart") << "##### HYDJET fpart = " << hyflow.fpart;
00429   edm::LogInfo("HYDJETtf") << "##### HYDJET hadron freez-out temp, Tf = " << hyflow.Tf;
00430   edm::LogInfo("HYDJETinTemp") << "##### HYDJET: QGP init temperature, T0 ="<<pyqpar.T0u;
00431   edm::LogInfo("HYDJETinTau") << "##### HYDJET: QGP formation time,tau0 ="<<pyqpar.tau0u;
00432 
00433   // generate a HYDJET event
00434   int ntry = 0;
00435   while(nsoft_ == 0 && nhard_ == 0){
00436      if(ntry > 100){
00437         edm::LogError("HydjetEmptyEvent") << "##### HYDJET: No Particles generated, Number of tries ="<<ntry;
00438         return false;
00439      }else{
00440         HYEVNT();
00441         nsoft_    = hyfpar.nhyd;
00442         nhard_    = hyfpar.npyt;
00443         ntry++;
00444      }
00445   }
00446   
00447   nsub_     = hyjpar.njet;
00448 
00449   std::vector<SubEvent> subvector;
00450 
00451   // event information
00452   HepMC::GenEvent *evt = new HepMC::GenEvent();
00453 
00454   if(nhard_>0) get_hard_particles(evt,subvector); 
00455   if(nsoft_>0) get_soft_particles(evt,subvector);
00456 
00457   evt->set_signal_process_id(pypars.msti[0]);      // type of the process
00458   evt->set_event_scale(pypars.pari[16]);           // Q^2
00459   evt->set_event_number(numberEventsInRun() - remainingEvents() - 1);
00460 
00461   add_heavy_ion_rec(evt);
00462 
00463   auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
00464   bare_product->addHepMCData(evt );
00465   auto_ptr<GenHIEvent> genhi(new GenHIEvent(subvector,hyjpar.nhsel));
00466   e.put(bare_product);
00467   e.put(genhi);
00468 
00469   // print PYLIST info
00470   if (event() <= maxEventsToPrint_ && pythiaPylistVerbosity_)     
00471      call_pylist(pythiaPylistVerbosity_);      
00472   
00473   return true;
00474 }


Member Data Documentation

double edm::HydjetSource::abeamtarget_ [private]

Definition at line 53 of file HydjetSource.h.

Referenced by HydjetSource().

double edm::HydjetSource::bfixed_ [private]

Definition at line 54 of file HydjetSource.h.

Referenced by HydjetSource().

double edm::HydjetSource::bmax_ [private]

Definition at line 55 of file HydjetSource.h.

Referenced by HydjetSource().

double edm::HydjetSource::bmin_ [private]

Definition at line 57 of file HydjetSource.h.

Referenced by HydjetSource().

int edm::HydjetSource::cflag_ [private]

Definition at line 59 of file HydjetSource.h.

Referenced by HydjetSource().

double edm::HydjetSource::comenergy [private]

Definition at line 62 of file HydjetSource.h.

Referenced by HydjetSource().

bool edm::HydjetSource::docollisionalenloss_ [private]

DEFAULT = true.

Definition at line 64 of file HydjetSource.h.

Referenced by hydjet_init().

bool edm::HydjetSource::doradiativeenloss_ [private]

Definition at line 63 of file HydjetSource.h.

Referenced by hydjet_init().

HepMC::GenEvent* edm::HydjetSource::evt [private]

Definition at line 52 of file HydjetSource.h.

double edm::HydjetSource::fracsoftmult_ [private]

DEFAULT = true.

Definition at line 65 of file HydjetSource.h.

Referenced by hydjet_init().

double edm::HydjetSource::hadfreeztemp_ [private]

Definition at line 71 of file HydjetSource.h.

Referenced by hydjet_init().

std::string edm::HydjetSource::hymode_ [private]

Definition at line 73 of file HydjetSource.h.

Referenced by hydjet_init().

unsigned int edm::HydjetSource::maxEventsToPrint_ [private]

Definition at line 74 of file HydjetSource.h.

Referenced by HydjetSource(), and produce().

double edm::HydjetSource::maxlongy_ [private]

Definition at line 75 of file HydjetSource.h.

Referenced by hydjet_init().

double edm::HydjetSource::maxtrany_ [private]

Definition at line 78 of file HydjetSource.h.

Referenced by hydjet_init().

int edm::HydjetSource::nhard_ [private]

Definition at line 82 of file HydjetSource.h.

Referenced by produce().

int edm::HydjetSource::nmultiplicity_ [private]

Definition at line 83 of file HydjetSource.h.

Referenced by HydjetSource().

unsigned int edm::HydjetSource::nquarkflavor_ [private]

Definition at line 86 of file HydjetSource.h.

Referenced by hydjet_init().

int edm::HydjetSource::nsoft_ [private]

Definition at line 85 of file HydjetSource.h.

int edm::HydjetSource::nsub_ [private]

Definition at line 81 of file HydjetSource.h.

Referenced by add_heavy_ion_rec().

unsigned int edm::HydjetSource::pythiaPylistVerbosity_ [private]

number of active quark flavors in qgp DEFAULT=0; allowed values: 0,1,2,3.

Definition at line 88 of file HydjetSource.h.

Referenced by HydjetSource(), and produce().

double edm::HydjetSource::qgpt0_ [private]

Definition at line 89 of file HydjetSource.h.

Referenced by hydjet_init().

double edm::HydjetSource::qgptau0_ [private]

Definition at line 91 of file HydjetSource.h.

Referenced by hydjet_init().

unsigned int edm::HydjetSource::shadowingswitch_ [private]

Definition at line 93 of file HydjetSource.h.

Referenced by hydjet_init().

double edm::HydjetSource::signn_ [private]

Definition at line 95 of file HydjetSource.h.

Referenced by hydjet_init().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:41:14 2009 for CMSSW by  doxygen 1.5.4