25 :
public edm::global::EDAnalyzer<edm::RunCache<cgra::DummyCache>, edm::LuminosityBlockCache<cgra::DummyCache>> {
62 mod2_{iPSet.getUntrackedParameter<
std::string>(
"module2")},
63 evToken1_{consumes<GenEventInfoProduct>(mod1_)},
64 evToken2_{consumes<GenEventInfoProduct>(mod2_)},
65 hepMCToken1_{consumes<edm::HepMCProduct>(
edm::InputTag(mod1_,
"unsmeared"))},
66 hepMCToken2_{consumes<edm::HepMCProduct>(
edm::InputTag(mod2_,
"unsmeared"))},
67 lumiHeaderToken1_{consumes<GenLumiInfoHeader, edm::InLumi>(mod1_)},
68 lumiHeaderToken2_{consumes<GenLumiInfoHeader, edm::InLumi>(mod2_)},
69 lumiProductToken1_{consumes<GenLumiInfoProduct, edm::InLumi>(mod1_)},
70 lumiProductToken2_{consumes<GenLumiInfoProduct, edm::InLumi>(mod2_)},
71 runProductToken1_{consumes<GenRunInfoProduct, edm::InRun>(mod1_)},
72 runProductToken2_{consumes<GenRunInfoProduct, edm::InRun>(mod2_)},
73 allowXSecDifferences_{iPSet.getUntrackedParameter<
bool>(
"allowXSecDifferences",
false)} {}
77 return std::shared_ptr<cgra::DummyCache>();
84 if (not
prod1.isProductEqual(prod2)) {
85 throw cms::Exception(
"ComparisonFailure") <<
"The GenRunInfoProducts are different";
94 if (
prod1.randomConfigIndex() != prod2.randomConfigIndex()) {
95 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoHeaders have different randomConfigIndex " 96 <<
prod1.randomConfigIndex() <<
" " << prod2.randomConfigIndex();
99 if (
prod1.configDescription() != prod2.configDescription()) {
100 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoHeaders have different configDescription " 101 <<
prod1.configDescription() <<
" " << prod2.configDescription();
104 if (
prod1.lheHeaders().size() != prod2.lheHeaders().size()) {
105 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoHeaders have different lheHeaders " 106 <<
prod1.lheHeaders().size() <<
" " << prod2.lheHeaders().size();
109 if (
prod1.weightNames().size() != prod2.weightNames().size()) {
110 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoHeaders have different weightNames " 111 <<
prod1.weightNames().size() <<
" " << prod2.weightNames().size();
114 return std::shared_ptr<cgra::DummyCache>();
121 bool allowXSecDifferences) {
122 if (
p1.process() !=
p2.process()) {
123 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
124 <<
"] process " <<
p1.process() <<
" " <<
p2.process();
127 if (
p1.nPassPos() !=
p2.nPassPos()) {
128 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
129 <<
"] nPassPos " <<
p1.nPassPos() <<
" " <<
p2.nPassPos();
132 if (
p1.nPassNeg() !=
p2.nPassNeg()) {
133 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
134 <<
"] nPassNeg " <<
p1.nPassNeg() <<
" " <<
p2.nPassNeg();
137 if (
p1.nTotalPos() !=
p2.nTotalPos()) {
138 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
139 <<
"] nTotalPos " <<
p1.nTotalPos() <<
" " <<
p2.nTotalPos();
142 if (
p1.nTotalNeg() !=
p2.nTotalNeg()) {
143 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
144 <<
"] nTotalNeg " <<
p1.nTotalNeg() <<
" " <<
p2.nTotalNeg();
147 if (
p1.lheXSec().error() !=
p2.lheXSec().error()) {
148 if (allowXSecDifferences) {
150 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] lheXSec.error " 151 <<
p1.lheXSec().error() <<
" " <<
p2.lheXSec().error();
154 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] lheXSec.error " 155 <<
p1.lheXSec().error() <<
" " <<
p2.lheXSec().error();
159 if (
p1.lheXSec().value() !=
p2.lheXSec().value()) {
160 if (allowXSecDifferences) {
163 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] lheXSec.value " 164 <<
p1.lheXSec().value() <<
" " <<
p2.lheXSec().value();
167 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] lheXSec.value " 168 <<
p1.lheXSec().value() <<
" " <<
p2.lheXSec().value();
172 if (
p1.tried().n() !=
p2.tried().n()) {
173 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
174 <<
"] tried.n " <<
p1.tried().n() <<
" " <<
p2.tried().n();
177 if (
p1.tried().sum() !=
p2.tried().sum()) {
178 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
179 <<
"] tried.sum " <<
p1.tried().sum() <<
" " <<
p2.tried().sum();
182 if (
p1.tried().sum2() !=
p2.tried().sum2()) {
183 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
184 <<
"] tried.sum2 " <<
p1.tried().sum2() <<
" " <<
p2.tried().sum2();
187 if (
p1.selected().n() !=
p2.selected().n()) {
188 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
189 <<
"] selected.n " <<
p1.selected().n() <<
" " <<
p2.selected().n();
192 if (
p1.selected().sum() !=
p2.selected().sum()) {
194 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] selected.sum " 195 <<
p1.selected().sum() <<
" " <<
p2.selected().sum();
198 if (
p1.selected().sum2() !=
p2.selected().sum2()) {
200 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] selected.sum2 " 201 <<
p1.selected().sum2() <<
" " <<
p2.selected().sum2();
204 if (
p1.killed().n() !=
p2.killed().n()) {
205 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
206 <<
"] killed.n " <<
p1.killed().n() <<
" " <<
p2.killed().n();
209 if (
p1.killed().sum() !=
p2.killed().sum()) {
210 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
211 <<
"] killed sum " <<
p1.killed().sum() <<
" " <<
p2.killed().sum();
214 if (
p1.killed().sum2() !=
p2.killed().sum2()) {
215 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
216 <<
"] killed.sum2 " <<
p1.killed().sum2() <<
" " <<
p2.killed().sum2();
219 if (
p1.accepted().n() !=
p2.accepted().n()) {
220 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex
221 <<
"] accepted.n " <<
p1.accepted().n() <<
" " <<
p2.accepted().n();
224 if (
p1.accepted().sum() !=
p2.accepted().sum()) {
226 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] accepted.sum " 227 <<
p1.accepted().sum() <<
" " <<
p2.accepted().sum();
230 if (
p1.accepted().sum2() !=
p2.accepted().sum2()) {
232 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] accepted.sum2 " 233 <<
p1.accepted().sum2() <<
" " <<
p2.accepted().sum2();
236 if (
p1.acceptedBr().n() !=
p2.acceptedBr().n()) {
238 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] acceptedBr.n " 239 <<
p1.acceptedBr().n() <<
" " <<
p2.acceptedBr().n();
242 if (
p1.acceptedBr().sum() !=
p2.acceptedBr().sum()) {
244 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] acceptedZBr.sum " 245 <<
p1.acceptedBr().sum() <<
" " <<
p2.acceptedBr().sum();
248 if (
p1.acceptedBr().sum2() !=
p2.acceptedBr().sum2()) {
250 <<
"The GenLumiInfoProducts have different getProcessInfos()[" << iIndex <<
"] acceptedBr.sum2 " 251 <<
p1.acceptedBr().sum2() <<
" " <<
p2.acceptedBr().sum2();
261 if (not
prod1.isProductEqual(prod2)) {
262 if (
prod1.getHEPIDWTUP() !=
prod1.getHEPIDWTUP()) {
263 throw cms::Exception(
"ComparisonFailure") <<
"The GenLumiInfoProducts have different getHEPIDWTUP " 264 <<
prod1.getHEPIDWTUP() <<
" " << prod2.getHEPIDWTUP();
267 if (
prod1.getProcessInfos().size() != prod2.getProcessInfos().size()) {
269 <<
"The GenLumiInfoHeaders have different getProcessInfos " <<
prod1.getProcessInfos().size() <<
" " 270 << prod2.getProcessInfos().size();
273 for (
size_t i = 0;
i <
prod1.getProcessInfos().size(); ++
i) {
278 throw cms::Exception(
"ComparisionFailure") <<
"The GenLumiInfoProducts are different";
286 throw cms::Exception(
"ComparisonFailure") <<
"The GenEventInfoProducts have different weights " 287 <<
prod1.weights().size() <<
" " << prod2.
weights().size();
291 throw cms::Exception(
"ComparisonFailure") <<
"The GenEventInfoProducts have different binningValues " 296 throw cms::Exception(
"ComparisonFailure") <<
"The GenEventInfoProducts have different DJRValues " 301 throw cms::Exception(
"ComparisonFailure") <<
"The GenEventInfoProducts have different signalProcessID " 307 <<
"The GenEventInfoProducts have different qScale " <<
prod1.qScale() <<
" " << prod2.
qScale();
312 <<
"The GenEventInfoProducts have different alphaQCD " <<
prod1.alphaQCD() <<
" " << prod2.
alphaQCD();
317 <<
"The GenEventInfoProducts have different alphaQED " <<
prod1.alphaQED() <<
" " << prod2.
alphaQED();
322 <<
"The GenEventInfoProducts have different nMEPartons " <<
prod1.nMEPartons() <<
" " << prod2.
nMEPartons();
326 throw cms::Exception(
"ComparisonFailure") <<
"The GenEventInfoProducts have different nMEPartonsFiltered " 332 if (
prod1.signal_process_id() != prod2.signal_process_id()) {
333 throw cms::Exception(
"ComparisonFailure") <<
"The HepMCProducts have different signal_process_id " 334 <<
prod1.signal_process_id() <<
" " << prod2.signal_process_id();
337 if (
prod1.vertices_size() != prod2.vertices_size()) {
338 throw cms::Exception(
"ComparisonFailure") <<
"The HepMCProducts have different vertices_size() " 339 <<
prod1.vertices_size() <<
" " << prod2.vertices_size();
342 if (
prod1.particles_size() != prod2.particles_size()) {
343 throw cms::Exception(
"ComparisonFailure") <<
"The HepMCProducts have different particles_size() " 344 <<
prod1.particles_size() <<
" " << prod2.particles_size();
358 compare(hepmc1.getHepMCData(), hepmc2.getHepMCData());
edm::EDGetTokenT< GenLumiInfoHeader > lumiHeaderToken1_
bool compare(const P &i, const P &j)
const std::vector< double > & binningValues() const
void globalEndRun(edm::Run const &, edm::EventSetup const &) const override
edm::EDGetTokenT< GenLumiInfoHeader > lumiHeaderToken2_
edm::EDGetTokenT< GenLumiInfoProduct > lumiProductToken2_
CompareGeneratorResultsAnalyzer(edm::ParameterSet const &)
std::shared_ptr< cgra::DummyCache > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override
edm::EDGetTokenT< GenEventInfoProduct > evToken2_
edm::EDGetTokenT< edm::HepMCProduct > hepMCToken2_
int nMEPartonsFiltered() const
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< float > & DJRValues() const
edm::EDGetTokenT< GenEventInfoProduct > evToken1_
#define DEFINE_FWK_MODULE(type)
PROD const & get(EDGetTokenT< PROD > token) const noexcept(false)
unsigned int signalProcessID() const
edm::EDGetTokenT< GenRunInfoProduct > runProductToken1_
std::shared_ptr< cgra::DummyCache > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
edm::EDGetTokenT< GenLumiInfoProduct > lumiProductToken1_
bool allowXSecDifferences_
std::vector< double > & weights()
edm::EDGetTokenT< edm::HepMCProduct > hepMCToken1_
Log< level::Warning, false > LogWarning
void analyze(edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
edm::EDGetTokenT< GenRunInfoProduct > runProductToken2_
PROD const & get(EDGetTokenT< PROD > token) const noexcept(false)
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override