sherpa is hosted by Hepforge, IPPP Durham
close Warning: Can't synchronize with repository "(default)" (/hepforge/svn/sherpa does not appear to be a Subversion repository.). Look in the Trac log for more information.

Ticket #36: sherpa-weight.1.1.3.patch

File sherpa-weight.1.1.3.patch, 5.0 KB (added by Frank Siegert, 16 years ago)

Patch for Sherpa version 1.1.3.

  • SHERPA/Tools/Output_HepMC2.C

     
    77
    88void Output_HepMC2::Output(Blob_List* blobs, const double weight)
    99{
    10   m_hepmc2.Sherpa2HepMC(blobs);
     10  m_hepmc2.Sherpa2HepMC(blobs, weight);
    1111  m_hepmc2.GenEvent()->print(m_outstream);
    1212}
  • SHERPA/Tools/HepMC2_Interface.C

     
    2929}
    3030
    3131bool HepMC2_Interface::Sherpa2HepMC(ATOOLS::Blob_List *const blobs,
    32                                     HepMC::GenEvent& event)
     32                                    HepMC::GenEvent& event, double weight)
    3333{
    3434#ifdef USING__HEPMC2__UNITS
    3535  event.use_units(HepMC::Units::GEV,
     
    6060          HepMC::PdfInfo pdfinfo(fl1, fl2, x1, x2, q, p1, p2);
    6161          event.set_pdf_info(pdfinfo);
    6262        }
    63         Blob_Data_Base *info((**blit)["ME_Weight"]);
    64         double weight=1.0;
    65         if (info!=NULL) weight=info->Get<double>();
    6663        std::vector<double> weights; weights.push_back(weight);
    6764        event.weights()=weights;
    6865      }
     
    7976  return true;
    8077}
    8178
    82 bool HepMC2_Interface::Sherpa2HepMC(ATOOLS::Blob_List *const blobs)
     79bool HepMC2_Interface::Sherpa2HepMC(ATOOLS::Blob_List *const blobs,
     80                                    double weight)
    8381{
    8482  if (blobs->empty()) {
    8583    msg_Error()<<"Error in "<<METHOD<<"."<<std::endl
     
    8987  }
    9088  if (p_event!=NULL) delete p_event;
    9189  p_event = new HepMC::GenEvent();
    92   return Sherpa2HepMC(blobs, *p_event);
     90  return Sherpa2HepMC(blobs, *p_event, weight);
    9391}
    9492
    9593bool HepMC2_Interface::Sherpa2HepMC(ATOOLS::Blob * blob, HepMC::GenVertex *& vertex)
  • SHERPA/Tools/HepMC2_Interface.H

     
    3939    ~HepMC2_Interface();
    4040
    4141    // member functions
    42     bool Sherpa2HepMC(ATOOLS::Blob_List *const blobs, HepMC::GenEvent& event);
    43     bool Sherpa2HepMC(ATOOLS::Blob_List *const blobs);
     42    bool Sherpa2HepMC(ATOOLS::Blob_List *const blobs, HepMC::GenEvent& event,
     43                      double weight=1.0);
     44    bool Sherpa2HepMC(ATOOLS::Blob_List *const blobs, double weight=1.0);
    4445    bool Sherpa2HepMC(ATOOLS::Blob *,HepMC::GenVertex *&);
    4546    bool Sherpa2HepMC(ATOOLS::Particle *,HepMC::GenParticle *&);
    4647
  • SHERPA/Tools/Output_HepMC2_Ascii.C

     
    2424
    2525void Output_HepMC2_Ascii::Output(Blob_List* blobs, const double weight)
    2626{
    27   m_hepmc2.Sherpa2HepMC(blobs);
     27  m_hepmc2.Sherpa2HepMC(blobs, weight);
    2828  p_ioascii->write_event(m_hepmc2.GenEvent());
    2929}
    3030
  • SHERPA/Tools/Input_Output_Handler.C

     
    163163  }
    164164}
    165165
    166 bool Input_Output_Handler::OutputToFormat(ATOOLS::Blob_List *const blobs,
    167                                           const double weight)
     166bool Input_Output_Handler::OutputToFormat(ATOOLS::Blob_List *const blobs)
    168167{
    169168  ResetInterfaces();
     169 
     170  double weight=1.0;
     171  for (Blob_List::const_iterator blit=blobs->begin();blit!=blobs->end();++blit){
     172    if ((*blit)->Type()==btp::Signal_Process) {
     173      Blob_Data_Base *info((**blit)["ME_Weight"]);
     174      if (info!=NULL) weight*=info->Get<double>();
     175      info=(**blit)["Process_Weight"];
     176      if (info!=NULL) weight/=info->Get<double>();
     177    }
     178  }
    170179
    171180  for (map<string,Output_Base *>::iterator oit=m_outmap.begin();
    172181       oit!=m_outmap.end();oit++) {
  • SHERPA/Tools/Input_Output_Handler.H

     
    4040    // destructor
    4141    ~Input_Output_Handler();
    4242
    43     bool OutputToFormat(ATOOLS::Blob_List * const,const double=1.);
     43    bool OutputToFormat(ATOOLS::Blob_List * const);
    4444    bool InputFromFormat(ATOOLS::Blob_List * const) { return false; }
    4545
    4646    void PrintEvent(ATOOLS::Blob_List *const);
  • SHERPA/Tools/Output_HepMC2_Genevent.C

     
    3131void Output_HepMC2_Genevent::Output(Blob_List* blobs, const double weight)
    3232{
    3333#ifdef USING__HEPMC2__IOGENEVENT
    34   m_hepmc2.Sherpa2HepMC(blobs);
     34  m_hepmc2.Sherpa2HepMC(blobs, weight);
    3535  p_iogenevent->write_event(m_hepmc2.GenEvent());
    3636#endif
    3737}