CMS 3D CMS Logo

Public Member Functions | Private Attributes

gen::Py8JetGun Class Reference

Inheritance diagram for gen::Py8JetGun:
gen::Py8GunBase gen::Py8InterfaceBase

List of all members.

Public Member Functions

const char * classname () const
bool generatePartonsAndHadronize ()
 Py8JetGun (edm::ParameterSet const &)
 ~Py8JetGun ()

Private Attributes

double fMaxE
double fMaxEta
double fMaxP
double fMinE
double fMinEta
double fMinP

Detailed Description

Definition at line 10 of file Py8JetGun.cc.


Constructor & Destructor Documentation

gen::Py8JetGun::Py8JetGun ( edm::ParameterSet const &  ps)

Definition at line 34 of file Py8JetGun.cc.

References fMaxE, fMaxEta, fMaxP, fMinE, fMinEta, fMinP, and edm::ParameterSet::getParameter().

   : Py8GunBase(ps) 
{

   // ParameterSet defpset ;
   edm::ParameterSet pgun_params = 
      ps.getParameter<edm::ParameterSet>("PGunParameters"); // , defpset ) ;
   fMinEta     = pgun_params.getParameter<double>("MinEta"); // ,-2.2);
   fMaxEta     = pgun_params.getParameter<double>("MaxEta"); // , 2.2);
   fMinP       = pgun_params.getParameter<double>("MinP"); // ,  0.);
   fMaxP       = pgun_params.getParameter<double>("MaxP"); // ,  0.);
   fMinE       = pgun_params.getParameter<double>("MinE"); // ,  0.);
   fMaxE       = pgun_params.getParameter<double>("MaxE"); // ,  0.);

}
gen::Py8JetGun::~Py8JetGun ( ) [inline]

Definition at line 15 of file Py8JetGun.cc.

{}

Member Function Documentation

const char * gen::Py8JetGun::classname ( ) const [virtual]

Implements gen::Py8InterfaceBase.

Definition at line 132 of file Py8JetGun.cc.

{
   return "Py8JetGun"; 
}
bool gen::Py8JetGun::generatePartonsAndHadronize ( ) [virtual]

Implements gen::Py8InterfaceBase.

Definition at line 50 of file Py8JetGun.cc.

References python::multivaluedict::append(), funct::cos(), eta(), gen::Py8GunBase::event(), create_public_lumi_plots::exp, gen::Py8InterfaceBase::fMasterGen, fMaxE, fMaxEta, fMaxP, gen::Py8GunBase::fMaxPhi, fMinE, fMinEta, fMinP, gen::Py8GunBase::fMinPhi, gen::Py8GunBase::fPartIDs, i, M_PI, phi, createTree::pp, randomEngine, funct::sin(), mathSSE::sqrt(), and gen::Py8InterfaceBase::toHepMC.

{

   fMasterGen->event.reset();

   double totPx = 0.;
   double totPy = 0.;
   double totPz = 0.;
   double totE  = 0.;
   double totM  = 0.;
   double phi, eta, the, ee, pp;
   
   for ( size_t i=0; i<fPartIDs.size(); i++ )
   {

      int particleID = fPartIDs[i]; // this is PDG - need to convert to Py8 ???

      // FIXME !!!
      // Ouch, it's using bare randomEngine pointer - that's NOT safe.
      // Need to hold a pointer somewhere properly !!!
      //
      phi = 2. * M_PI * randomEngine->flat() ;
      the = acos( -1. + 2.*randomEngine->flat() );

      // from input
      //
      ee   = (fMaxE-fMinE)*randomEngine->flat() + fMinE;
            
      double mass = (fMasterGen->particleData).mass( particleID );
//      double mass = (pythia->particleData).m0( particleID );

      pp = sqrt( ee*ee - mass*mass );
      
      double px = pp * sin(the) * cos(phi);
      double py = pp * sin(the) * sin(phi);
      double pz = pp * cos(the);

      if ( !((fMasterGen->particleData).isParticle( particleID )) )
      {
         particleID = std::fabs(particleID) ;
      }
      (fMasterGen->event).append( particleID, 1, 0, 0, px, py, pz, ee, mass ); 
      
      // values for computing total mass
      //
      totPx += px;
      totPy += py;
      totPz += pz;
      totE  += ee;

   }

   totM = sqrt( totE*totE - (totPx*totPx+totPy*totPy+totPz*totPz) );

   //now the boost (from input params)
   //
   pp = (fMaxP-fMinP)*randomEngine->flat() + fMinP; 
   ee = sqrt( totM*totM + pp*pp );       

   //the boost direction (from input params)
   //
   phi = (fMaxPhi-fMinPhi)*randomEngine->flat() + fMinPhi;
   eta  = (fMaxEta-fMinEta)*randomEngine->flat() + fMinEta;                                                      
   the  = 2.*atan(exp(-eta));  

   double betaX = pp/ee * std::sin(the) * std::cos(phi);
   double betaY = pp/ee * std::sin(the) * std::sin(phi);
   double betaZ = pp/ee * std::cos(the);  

   // boost all particles
   //   
   (fMasterGen->event).bst( betaX, betaY, betaZ );
   
   if ( !fMasterGen->next() ) return false;
   
   event().reset(new HepMC::GenEvent);
   toHepMC.fill_next_event( fMasterGen->event, event().get() );
      
   return true;   
  
}

Member Data Documentation

double gen::Py8JetGun::fMaxE [private]

Definition at line 28 of file Py8JetGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8JetGun().

double gen::Py8JetGun::fMaxEta [private]

Definition at line 24 of file Py8JetGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8JetGun().

double gen::Py8JetGun::fMaxP [private]

Definition at line 26 of file Py8JetGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8JetGun().

double gen::Py8JetGun::fMinE [private]

Definition at line 27 of file Py8JetGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8JetGun().

double gen::Py8JetGun::fMinEta [private]

Definition at line 23 of file Py8JetGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8JetGun().

double gen::Py8JetGun::fMinP [private]

Definition at line 25 of file Py8JetGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8JetGun().