CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

gen::HijingHadronizer Class Reference

#include <HijingHadronizer.h>

Inheritance diagram for gen::HijingHadronizer:
gen::BaseHadronizer

List of all members.

Public Member Functions

const char * classname () const
bool decay ()
bool declareSpecialSettings (const std::vector< std::string >)
bool declareStableParticles (const std::vector< int >)
void finalizeEvent ()
bool generatePartonsAndHadronize ()
bool hadronize ()
 HijingHadronizer (const edm::ParameterSet &)
bool initializeForExternalPartons ()
bool initializeForInternalPartons ()
bool readSettings (int)
bool residualDecay ()
void statistics ()
virtual ~HijingHadronizer ()

Private Member Functions

void add_heavy_ion_rec (HepMC::GenEvent *evt)
HepMC::GenParticle * build_hijing (int index, int barcode)
HepMC::GenVertex * build_hijing_vertex (int i, int id)
bool call_hijset (double efrm, std::string frame, std::string proj, std::string targ, int iap, int izp, int iat, int izt)
bool get_particles (HepMC::GenEvent *evt)
void rotateEvtPlane ()

Private Attributes

double bmax_
double bmin_
double cosphi0_
double efrm_
HepMC::GenEvent * evt
std::string frame_
int iap_
int iat_
int izp_
int izt_
double phi0_
std::string proj_
edm::ParameterSet pset_
bool rotate_
double sinphi0_
std::string targ_

Detailed Description

Definition at line 27 of file HijingHadronizer.h.


Constructor & Destructor Documentation

HijingHadronizer::HijingHadronizer ( const edm::ParameterSet pset)

Definition at line 34 of file HijingHadronizer.cc.

References hijRandomEngine.

                                                           :
    BaseHadronizer(pset),
    evt(0), 
    pset_(pset),
    bmax_(pset.getParameter<double>("bMax")),
    bmin_(pset.getParameter<double>("bMin")),
    efrm_(pset.getParameter<double>("comEnergy")),
    frame_(pset.getParameter<string>("frame")),
    proj_(pset.getParameter<string>("proj")),
    targ_(pset.getParameter<string>("targ")),
    iap_(pset.getParameter<int>("iap")),
    izp_(pset.getParameter<int>("izp")),
    iat_(pset.getParameter<int>("iat")),
    izt_(pset.getParameter<int>("izt")),
    phi0_(0.),
    sinphi0_(0.),
    cosphi0_(1.),
    rotate_(pset.getParameter<bool>("rotateEventPlane"))
{
  // Default constructor
  Service<RandomNumberGenerator> rng;
  hijRandomEngine = &(rng->getEngine());

}
HijingHadronizer::~HijingHadronizer ( ) [virtual]

Definition at line 61 of file HijingHadronizer.cc.

{
  // destructor
}

Member Function Documentation

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

Definition at line 67 of file HijingHadronizer.cc.

References himain1, hiparnt, and phi0_.

Referenced by generatePartonsAndHadronize().

{
  // heavy ion record in the final CMSSW Event
  HepMC::HeavyIon* hi = new HepMC::HeavyIon(
    himain1.jatt,                               // Ncoll_hard/N of SubEvents
    himain1.np,                               // Npart_proj
    himain1.nt,                               // Npart_targ
    himain1.n0+himain1.n01+himain1.n10+himain1.n11, // Ncoll
    0,                                   // spectator_neutrons
    0,                                   // spectator_protons
    himain1.n01,                          // N_Nwounded_collisions
    himain1.n10,                          // Nwounded_N_collisions
    himain1.n11,                          // Nwounded_Nwounded_collisions
    //gsfs Changed from 19 to 18 (Fortran counts from 1 , not 0) 
    hiparnt.hint1[18],                   // impact_parameter in [fm]
    phi0_,                               // event_plane_angle
    0,                                   // eccentricity
    //gsfs Changed from 12 to 11 (Fortran counts from 1 , not 0) 
    hiparnt.hint1[11]                    // sigma_inel_NN
  );
  evt->set_heavy_ion(*hi);
  delete hi;
}
HepMC::GenParticle * HijingHadronizer::build_hijing ( int  index,
int  barcode 
) [private]

Definition at line 92 of file HijingHadronizer.cc.

References cosphi0_, configurableAnalysis::GenParticle, himain2, getHLTprescales::index, gen::p, sinphi0_, x, and detailsBasic3DVector::y.

Referenced by get_particles().

{
   // Build particle object corresponding to index in hijing
                                                                                                                                                         
   double x0 = himain2.patt[0][index];
   double y0 = himain2.patt[1][index];

   double x = x0*cosphi0_-y0*sinphi0_;
   double y = y0*cosphi0_+x0*sinphi0_;

   // Hijing gives V0's status=4, they need to have status=1 to be decayed in geant
   // also change status=11 to status=2
   if(himain2.katt[3][index]<=10 && himain2.katt[3][index]>0) himain2.katt[3][index]=1;
   if(himain2.katt[3][index]<=20 && himain2.katt[3][index]>10) himain2.katt[3][index]=2;

   HepMC::GenParticle* p = new HepMC::GenParticle(
                                                  HepMC::FourVector(x,  // px                                                                            
                                                                    y,  // py                                                                            
                                                                    himain2.patt[2][index],  // pz                                                         
                                                                    himain2.patt[3][index]), // E                                                          
                                                  himain2.katt[0][index],// id                                                                             
                                                  himain2.katt[3][index] // status                                                          
                                                  );
   p->suggest_barcode(barcode);
   
   return p;
}
HepMC::GenVertex * HijingHadronizer::build_hijing_vertex ( int  i,
int  id 
) [private]

Definition at line 121 of file HijingHadronizer.cc.

References cosphi0_, himain2, i, sinphi0_, lumiQTWidget::t, x, detailsBasic3DVector::y, and z.

Referenced by get_particles().

{
  // build verteces for the hijing stored events                        
   double x0=himain2.vatt[0][i];
   double y0=himain2.vatt[1][i];
   double x = x0*cosphi0_-y0*sinphi0_;
   double y = y0*cosphi0_+x0*sinphi0_;
   double z=himain2.vatt[2][i];
   double t=himain2.vatt[3][i];

   HepMC::GenVertex* vertex = new HepMC::GenVertex(HepMC::FourVector(x,y,z,t),id);
   return vertex;
}
bool HijingHadronizer::call_hijset ( double  efrm,
std::string  frame,
std::string  proj,
std::string  targ,
int  iap,
int  izp,
int  iat,
int  izt 
) [private]

Definition at line 228 of file HijingHadronizer.cc.

References HIJSET.

Referenced by initializeForInternalPartons().

{

   float ef = efrm;
  // initialize hydjet  
   HIJSET(ef,frame.data(),proj.data(),targ.data(),iap,izp,iat,izt,strlen(frame.data()),strlen(proj.data()),strlen(targ.data()));
   return true;
}
const char * HijingHadronizer::classname ( ) const

Definition at line 292 of file HijingHadronizer.cc.

{  
   return "gen::HijingHadronizer";
}
bool HijingHadronizer::decay ( )

Definition at line 274 of file HijingHadronizer.cc.

{
   return true;
}
bool gen::HijingHadronizer::declareSpecialSettings ( const std::vector< std::string >  ) [inline]

Definition at line 40 of file HijingHadronizer.h.

{ return true; }
bool HijingHadronizer::declareStableParticles ( const std::vector< int >  pdg)

Definition at line 255 of file HijingHadronizer.cc.

{
   return true;
}
void HijingHadronizer::finalizeEvent ( )

Definition at line 284 of file HijingHadronizer.cc.

                                    {
    return;
}
bool HijingHadronizer::generatePartonsAndHadronize ( )

Definition at line 135 of file HijingHadronizer.cc.

References add_heavy_ion_rec(), bmax_, bmin_, gen::BaseHadronizer::event(), evt, frame_, get_particles(), HIJING, rotate_, and rotateEvtPlane().

{
   // generate single event
   if(rotate_) rotateEvtPlane();

   // generate a HIJING event
   
   float f_bmin = bmin_;
   float f_bmax = bmax_;
   HIJING(frame_.data(), f_bmin, f_bmax, strlen(frame_.data()));

   // event information
   HepMC::GenEvent *evt = new HepMC::GenEvent();
   get_particles(evt); 

   //   evt->set_signal_process_id(pypars.msti[0]);      // type of the process
   //   evt->set_event_scale(pypars.pari[16]);           // Q^2
   add_heavy_ion_rec(evt);

   event().reset(evt);

   return true;
}
bool HijingHadronizer::get_particles ( HepMC::GenEvent *  evt) [private]

Definition at line 160 of file HijingHadronizer.cc.

References build_hijing(), build_hijing_vertex(), configurableAnalysis::GenParticle, himain1, himain2, i, LogDebug, and mathSSE::sqrt().

Referenced by generatePartonsAndHadronize().

{
      HepMC::GenVertex*  vertice;

      vector<HepMC::GenParticle*> particles;
      vector<int>                 mother_ids;
      vector<HepMC::GenVertex*>   prods;

      vertice = new HepMC::GenVertex(HepMC::FourVector(0,0,0,0),0);
      evt->add_vertex(vertice);
      if(!evt->signal_process_vertex()) evt->set_signal_process_vertex(vertice);

      const unsigned int knumpart = himain1.natt;

      for (unsigned int ipart = 0; ipart<knumpart; ipart++) {
        
        int mid = himain2.katt[2][ipart] - 1;  // careful of fortan to c++ array index

        particles.push_back(build_hijing(ipart,ipart+1));
        prods.push_back(build_hijing_vertex(ipart,0));
        mother_ids.push_back(mid);
        LogDebug("DecayChain")<<"Mother index : "<<mid;
      } 
      
      LogDebug("Hijing")<<"Number of particles in vector "<<particles.size();

      for (unsigned int ipart = 0; ipart<particles.size(); ipart++) {
         HepMC::GenParticle* part = particles[ipart];

         int mid = mother_ids[ipart];
         LogDebug("DecayChain")<<"Particle "<<ipart;
         LogDebug("DecayChain")<<"Mother's ID "<<mid;
         LogDebug("DecayChain")<<"Particle's PDG ID "<<part->pdg_id();
         
         // remove zero pT particles from list, protection for fastJet against pt=0 jets
         if(part->status()==1&&sqrt(part->momentum().px()*part->momentum().px()+part->momentum().py()*part->momentum().py())==0) 
           continue;
         
         if(mid <= 0){
           vertice->add_particle_out(part);
            continue;
         }

         if(mid > 0){
            HepMC::GenParticle* mother = particles[mid];
            LogDebug("DecayChain")<<"Mother's PDG ID "<<mother->pdg_id();
            HepMC::GenVertex* prod_vertex = mother->end_vertex();
            if(!prod_vertex){
               prod_vertex = prods[ipart];
               prod_vertex->add_particle_in(mother);
               
               evt->add_vertex(prod_vertex);
               prods[ipart]=0; // mark to protect deletion                                                                                                   
               
            }
            prod_vertex->add_particle_out(part);
         }
      }

      // cleanup vertices not assigned to evt                                                                                                            
      for (unsigned int i = 0; i<prods.size(); i++) {
         if(prods[i]) delete prods[i];
      }

   return true;
}
bool HijingHadronizer::hadronize ( )

Definition at line 269 of file HijingHadronizer.cc.

{
   return false;
}
bool gen::HijingHadronizer::initializeForExternalPartons ( )
bool HijingHadronizer::initializeForInternalPartons ( )

Definition at line 238 of file HijingHadronizer.cc.

References call_hijset(), gen::call_pygive(), efrm_, frame_, iap_, iat_, izp_, izt_, proj_, AlCaHLTBitMon_QueryRunRegistry::string, and targ_.

                                                   {

  //initialize pythia5

  if(0){
    std::string dumstr = "";
    call_pygive(dumstr);
  }

   // initialize hijing
   LogInfo("HIJINGinAction") << "##### Calling HIJSET(" << efrm_ << "," <<frame_<<","<<proj_<<","<<targ_<<","<<iap_<<","<<izp_<<","<<iat_<<","<<izt_<<") ####";
   call_hijset(efrm_,frame_,proj_,targ_,iap_,izp_,iat_,izt_);

   return true;

}
bool gen::HijingHadronizer::readSettings ( int  ) [inline]

Definition at line 36 of file HijingHadronizer.h.

{ return true; }
bool HijingHadronizer::residualDecay ( )

Definition at line 279 of file HijingHadronizer.cc.

{  
   return true;
}
void HijingHadronizer::rotateEvtPlane ( ) [private]
void HijingHadronizer::statistics ( )

Definition at line 288 of file HijingHadronizer.cc.

                                 {
    return;
}

Member Data Documentation

double gen::HijingHadronizer::bmax_ [private]

Definition at line 59 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::bmin_ [private]

Definition at line 61 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

Definition at line 77 of file HijingHadronizer.h.

Referenced by build_hijing(), build_hijing_vertex(), and rotateEvtPlane().

double gen::HijingHadronizer::efrm_ [private]

Definition at line 63 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

HepMC::GenEvent* gen::HijingHadronizer::evt [private]

Definition at line 57 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

std::string gen::HijingHadronizer::frame_ [private]

Definition at line 64 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize(), and initializeForInternalPartons().

Definition at line 67 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

Definition at line 69 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

Definition at line 68 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

Definition at line 70 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

double gen::HijingHadronizer::phi0_ [private]

Definition at line 75 of file HijingHadronizer.h.

Referenced by add_heavy_ion_rec(), and rotateEvtPlane().

std::string gen::HijingHadronizer::proj_ [private]

Definition at line 65 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

Definition at line 58 of file HijingHadronizer.h.

Definition at line 78 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

Definition at line 76 of file HijingHadronizer.h.

Referenced by build_hijing(), build_hijing_vertex(), and rotateEvtPlane().

std::string gen::HijingHadronizer::targ_ [private]

Definition at line 66 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().