Ticket #36: sherpa-weight.patch
File sherpa-weight.patch, 4.9 KB (added by , 16 years ago) |
---|
-
SHERPA/Tools/Output_HepMC2.C
7 7 8 8 void Output_HepMC2::Output(Blob_List* blobs, const double weight) 9 9 { 10 m_hepmc2.Sherpa2HepMC(blobs );10 m_hepmc2.Sherpa2HepMC(blobs, weight); 11 11 m_hepmc2.GenEvent()->print(m_outstream); 12 12 } -
SHERPA/Tools/HepMC2_Interface.C
29 29 } 30 30 31 31 bool HepMC2_Interface::Sherpa2HepMC(ATOOLS::Blob_List *const blobs, 32 HepMC::GenEvent& event )32 HepMC::GenEvent& event, double weight) 33 33 { 34 34 #ifdef USING__HEPMC2__UNITS 35 35 event.use_units(HepMC::Units::GEV, … … 60 60 HepMC::PdfInfo pdfinfo(fl1, fl2, x1, x2, q, p1, p2); 61 61 event.set_pdf_info(pdfinfo); 62 62 } 63 Blob_Data_Base *info((**blit)["ME_Weight"]);64 double weight=1.0;65 if (info!=NULL) weight=info->Get<double>();66 63 std::vector<double> weights; weights.push_back(weight); 67 64 event.weights()=weights; 68 65 } … … 79 76 return true; 80 77 } 81 78 82 bool HepMC2_Interface::Sherpa2HepMC(ATOOLS::Blob_List *const blobs) 79 bool HepMC2_Interface::Sherpa2HepMC(ATOOLS::Blob_List *const blobs, 80 double weight) 83 81 { 84 82 if (blobs->empty()) { 85 83 msg_Error()<<"Error in "<<METHOD<<"."<<std::endl … … 89 87 } 90 88 if (p_event!=NULL) delete p_event; 91 89 p_event = new HepMC::GenEvent(); 92 return Sherpa2HepMC(blobs, *p_event );90 return Sherpa2HepMC(blobs, *p_event, weight); 93 91 } 94 92 95 93 bool HepMC2_Interface::Sherpa2HepMC(ATOOLS::Blob * blob, HepMC::GenVertex *& vertex) -
SHERPA/Tools/HepMC2_Interface.H
42 42 ~HepMC2_Interface(); 43 43 44 44 // member functions 45 bool Sherpa2HepMC(ATOOLS::Blob_List *const blobs, HepMC::GenEvent& event); 46 bool Sherpa2HepMC(ATOOLS::Blob_List *const blobs); 45 bool Sherpa2HepMC(ATOOLS::Blob_List *const blobs, HepMC::GenEvent& event, 46 double weight=1.0); 47 bool Sherpa2HepMC(ATOOLS::Blob_List *const blobs, double weight=1.0); 47 48 48 49 // inline functions 49 50 inline HepMC::GenEvent *const GenEvent() { return p_event; } -
SHERPA/Tools/Output_HepMC2_Ascii.C
24 24 25 25 void Output_HepMC2_Ascii::Output(Blob_List* blobs, const double weight) 26 26 { 27 m_hepmc2.Sherpa2HepMC(blobs );27 m_hepmc2.Sherpa2HepMC(blobs, weight); 28 28 p_ioascii->write_event(m_hepmc2.GenEvent()); 29 29 } 30 30 -
SHERPA/Tools/Input_Output_Handler.C
163 163 } 164 164 } 165 165 166 bool Input_Output_Handler::OutputToFormat(ATOOLS::Blob_List *const blobs, 167 const double weight) 166 bool Input_Output_Handler::OutputToFormat(ATOOLS::Blob_List *const blobs) 168 167 { 169 168 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 } 170 179 171 180 for (map<string,Output_Base *>::iterator oit=m_outmap.begin(); 172 181 oit!=m_outmap.end();oit++) { -
SHERPA/Tools/Input_Output_Handler.H
40 40 // destructor 41 41 ~Input_Output_Handler(); 42 42 43 bool OutputToFormat(ATOOLS::Blob_List * const ,const double=1.);43 bool OutputToFormat(ATOOLS::Blob_List * const); 44 44 bool InputFromFormat(ATOOLS::Blob_List * const) { return false; } 45 45 46 46 void PrintEvent(ATOOLS::Blob_List *const); -
SHERPA/Tools/Output_HepMC2_Genevent.C
31 31 void Output_HepMC2_Genevent::Output(Blob_List* blobs, const double weight) 32 32 { 33 33 #ifdef USING__HEPMC2__IOGENEVENT 34 m_hepmc2.Sherpa2HepMC(blobs );34 m_hepmc2.Sherpa2HepMC(blobs, weight); 35 35 p_iogenevent->write_event(m_hepmc2.GenEvent()); 36 36 #endif 37 37 }