00001 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00002 #include "SimDataFormats/HepMCProduct/interface/GenInfoProduct.h" 00003 #include <iostream> 00004 #include <algorithm> 00005 00006 00007 using namespace edm; 00008 using namespace std; 00009 00010 GenInfoProduct::GenInfoProduct( double cross_section ) { 00011 cs_ = cross_section; 00012 cs2_ = 0; 00013 fe_ = 0; 00014 cout << "Setting cross section." << endl; 00015 00016 } 00017 00018 00019 // copy constructor 00020 GenInfoProduct::GenInfoProduct(GenInfoProduct const& other) : 00021 cs_(other.cross_section()), cs2_(other.external_cross_section()), fe_(other.filter_efficiency()) { 00022 } 00023 00024 00025 bool GenInfoProduct::mergeProduct(GenInfoProduct const& other) 00026 { 00027 // if external xsec and filter efficiency are identical we allow merging 00028 // unfortunately we cannot merge on-the-fly xsec, as we do not have 00029 // information about the corresponding statistics (i.e. uncertainty) 00030 // so we just ignore it. 00031 // So in the end this merger is a dummy (just a safety check) 00032 00033 if (cs2_ == other.cs2_ && fe_ == other.fe_) 00034 return true; 00035 00036 edm::LogWarning("GenInfoProduct|ProductsNotMergeable") 00037 << "You are merging runs with different cross-sections and/or " 00038 "filter efficiencies (from GenInfoProduct)\n" 00039 "The resulting cross-section will not be consistent." 00040 << std::endl; 00041 00042 return true; 00043 }