CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CompareGeneratorResultsAnalyzer Class Reference
Inheritance diagram for CompareGeneratorResultsAnalyzer:
edm::global::EDAnalyzer< edm::RunCache< cgra::DummyCache >, edm::LuminosityBlockCache< cgra::DummyCache > > edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::StreamID, edm::Event const &, edm::EventSetup const &) const override
 
 CompareGeneratorResultsAnalyzer (edm::ParameterSet const &)
 
std::shared_ptr< cgra::DummyCacheglobalBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) const override
 
std::shared_ptr< cgra::DummyCacheglobalBeginRun (edm::Run const &, edm::EventSetup const &) const override
 
void globalEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) const override
 
void globalEndRun (edm::Run const &, edm::EventSetup const &) const override
 
- Public Member Functions inherited from edm::global::EDAnalyzer< edm::RunCache< cgra::DummyCache >, edm::LuminosityBlockCache< cgra::DummyCache > >
 EDAnalyzer ()=default
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

bool allowXSecDifferences_
 
edm::EDGetTokenT< GenEventInfoProductevToken1_
 
edm::EDGetTokenT< GenEventInfoProductevToken2_
 
edm::EDGetTokenT< edm::HepMCProducthepMCToken1_
 
edm::EDGetTokenT< edm::HepMCProducthepMCToken2_
 
edm::EDGetTokenT< GenLumiInfoHeaderlumiHeaderToken1_
 
edm::EDGetTokenT< GenLumiInfoHeaderlumiHeaderToken2_
 
edm::EDGetTokenT< GenLumiInfoProductlumiProductToken1_
 
edm::EDGetTokenT< GenLumiInfoProductlumiProductToken2_
 
std::string mod1_
 
std::string mod2_
 
edm::EDGetTokenT< GenRunInfoProductrunProductToken1_
 
edm::EDGetTokenT< GenRunInfoProductrunProductToken2_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 24 of file CompareGeneratorResultsAnalyzer.cc.

Constructor & Destructor Documentation

CompareGeneratorResultsAnalyzer::CompareGeneratorResultsAnalyzer ( edm::ParameterSet const &  iPSet)

Definition at line 60 of file CompareGeneratorResultsAnalyzer.cc.

References allowXSecDifferences_, evToken1_, evToken2_, edm::ParameterSet::getUntrackedParameter(), hepMCToken1_, hepMCToken2_, lumiHeaderToken1_, lumiHeaderToken2_, lumiProductToken1_, lumiProductToken2_, mod1_, mod2_, runProductToken1_, runProductToken2_, and AlCaHLTBitMon_QueryRunRegistry::string.

61  : mod1_{iPSet.getUntrackedParameter<std::string>("module1")},
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)} {}
edm::EDGetTokenT< GenLumiInfoHeader > lumiHeaderToken1_
edm::EDGetTokenT< GenLumiInfoHeader > lumiHeaderToken2_
edm::EDGetTokenT< GenLumiInfoProduct > lumiProductToken2_
edm::EDGetTokenT< GenEventInfoProduct > evToken2_
edm::EDGetTokenT< edm::HepMCProduct > hepMCToken2_
edm::EDGetTokenT< GenEventInfoProduct > evToken1_
edm::EDGetTokenT< GenRunInfoProduct > runProductToken1_
edm::EDGetTokenT< GenLumiInfoProduct > lumiProductToken1_
edm::EDGetTokenT< edm::HepMCProduct > hepMCToken1_
edm::EDGetTokenT< GenRunInfoProduct > runProductToken2_

Member Function Documentation

void CompareGeneratorResultsAnalyzer::analyze ( edm::StreamID  ,
edm::Event const &  iEvent,
edm::EventSetup const &   
) const
overridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 349 of file CompareGeneratorResultsAnalyzer.cc.

References compare(), DEFINE_FWK_MODULE, evToken1_, evToken2_, edm::Event::get(), hepMCToken1_, and hepMCToken2_.

349  {
350  auto const& prod1 = iEvent.get(evToken1_);
351  auto const& prod2 = iEvent.get(evToken2_);
352 
353  compare(prod1, prod2);
354 
355  auto const& hepmc1 = iEvent.get(hepMCToken1_);
356  auto const& hepmc2 = iEvent.get(hepMCToken2_);
357 
358  compare(hepmc1.getHepMCData(), hepmc2.getHepMCData());
359 }
bool compare(const P &i, const P &j)
edm::EDGetTokenT< GenEventInfoProduct > evToken2_
edm::EDGetTokenT< edm::HepMCProduct > hepMCToken2_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< GenEventInfoProduct > evToken1_
edm::EDGetTokenT< edm::HepMCProduct > hepMCToken1_
std::shared_ptr< cgra::DummyCache > CompareGeneratorResultsAnalyzer::globalBeginLuminosityBlock ( edm::LuminosityBlock const &  iLumi,
edm::EventSetup const &   
) const
override

Definition at line 89 of file CompareGeneratorResultsAnalyzer.cc.

References GenLumiInfoProduct::ProcessInfo::accepted(), GenLumiInfoProduct::ProcessInfo::acceptedBr(), compare(), GenLumiInfoProduct::XSec::error(), Exception, edm::LuminosityBlock::get(), GenLumiInfoProduct::ProcessInfo::killed(), GenLumiInfoProduct::ProcessInfo::lheXSec(), lumiHeaderToken1_, lumiHeaderToken2_, GenLumiInfoProduct::FinalStat::n(), GenLumiInfoProduct::ProcessInfo::nPassNeg(), GenLumiInfoProduct::ProcessInfo::nPassPos(), GenLumiInfoProduct::ProcessInfo::nTotalNeg(), GenLumiInfoProduct::ProcessInfo::nTotalPos(), p1, p2, GenLumiInfoProduct::ProcessInfo::process(), GenLumiInfoProduct::ProcessInfo::selected(), GenLumiInfoProduct::FinalStat::sum(), GenLumiInfoProduct::FinalStat::sum2(), GenLumiInfoProduct::ProcessInfo::tried(), and GenLumiInfoProduct::XSec::value().

90  {
91  auto const& prod1 = iLumi.get(lumiHeaderToken1_);
92  auto const& prod2 = iLumi.get(lumiHeaderToken2_);
93 
94  if (prod1.randomConfigIndex() != prod2.randomConfigIndex()) {
95  throw cms::Exception("ComparisonFailure") << "The GenLumiInfoHeaders have different randomConfigIndex "
96  << prod1.randomConfigIndex() << " " << prod2.randomConfigIndex();
97  }
98 
99  if (prod1.configDescription() != prod2.configDescription()) {
100  throw cms::Exception("ComparisonFailure") << "The GenLumiInfoHeaders have different configDescription "
101  << prod1.configDescription() << " " << prod2.configDescription();
102  }
103 
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();
107  }
108 
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();
112  }
113 
114  return std::shared_ptr<cgra::DummyCache>();
115 }
edm::EDGetTokenT< GenLumiInfoHeader > lumiHeaderToken1_
edm::EDGetTokenT< GenLumiInfoHeader > lumiHeaderToken2_
std::shared_ptr< cgra::DummyCache > CompareGeneratorResultsAnalyzer::globalBeginRun ( edm::Run const &  ,
edm::EventSetup const &   
) const
override

Definition at line 75 of file CompareGeneratorResultsAnalyzer.cc.

76  {
77  return std::shared_ptr<cgra::DummyCache>();
78 }
void CompareGeneratorResultsAnalyzer::globalEndLuminosityBlock ( edm::LuminosityBlock const &  iLumi,
edm::EventSetup const &   
) const
override

Definition at line 256 of file CompareGeneratorResultsAnalyzer.cc.

References allowXSecDifferences_, GenEventInfoProduct::alphaQCD(), GenEventInfoProduct::alphaQED(), GenEventInfoProduct::binningValues(), compare(), GenEventInfoProduct::DJRValues(), Exception, edm::LuminosityBlock::get(), mps_fire::i, lumiProductToken1_, lumiProductToken2_, GenEventInfoProduct::nMEPartons(), GenEventInfoProduct::nMEPartonsFiltered(), GenEventInfoProduct::qScale(), GenEventInfoProduct::signalProcessID(), and GenEventInfoProduct::weights().

257  {
258  auto const& prod1 = iLumi.get(lumiProductToken1_);
259  auto const& prod2 = iLumi.get(lumiProductToken2_);
260 
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();
265  }
266 
267  if (prod1.getProcessInfos().size() != prod2.getProcessInfos().size()) {
268  throw cms::Exception("ComparisonFailure")
269  << "The GenLumiInfoHeaders have different getProcessInfos " << prod1.getProcessInfos().size() << " "
270  << prod2.getProcessInfos().size();
271  }
272 
273  for (size_t i = 0; i < prod1.getProcessInfos().size(); ++i) {
274  compare(i, prod1.getProcessInfos()[i], prod2.getProcessInfos()[i], allowXSecDifferences_);
275  }
276 
277  if (not allowXSecDifferences_) {
278  throw cms::Exception("ComparisionFailure") << "The GenLumiInfoProducts are different";
279  }
280  }
281 }
bool compare(const P &i, const P &j)
edm::EDGetTokenT< GenLumiInfoProduct > lumiProductToken2_
edm::EDGetTokenT< GenLumiInfoProduct > lumiProductToken1_
void CompareGeneratorResultsAnalyzer::globalEndRun ( edm::Run const &  iRun,
edm::EventSetup const &   
) const
override

Definition at line 80 of file CompareGeneratorResultsAnalyzer.cc.

References Exception, edm::Run::get(), runProductToken1_, and runProductToken2_.

80  {
81  auto const& prod1 = iRun.get(runProductToken1_);
82  auto const& prod2 = iRun.get(runProductToken2_);
83 
84  if (not prod1.isProductEqual(prod2)) {
85  throw cms::Exception("ComparisonFailure") << "The GenRunInfoProducts are different";
86  }
87 }
edm::EDGetTokenT< GenRunInfoProduct > runProductToken1_
edm::EDGetTokenT< GenRunInfoProduct > runProductToken2_

Member Data Documentation

bool CompareGeneratorResultsAnalyzer::allowXSecDifferences_
private
edm::EDGetTokenT<GenEventInfoProduct> CompareGeneratorResultsAnalyzer::evToken1_
private

Definition at line 42 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by analyze(), and CompareGeneratorResultsAnalyzer().

edm::EDGetTokenT<GenEventInfoProduct> CompareGeneratorResultsAnalyzer::evToken2_
private

Definition at line 43 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by analyze(), and CompareGeneratorResultsAnalyzer().

edm::EDGetTokenT<edm::HepMCProduct> CompareGeneratorResultsAnalyzer::hepMCToken1_
private

Definition at line 45 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by analyze(), and CompareGeneratorResultsAnalyzer().

edm::EDGetTokenT<edm::HepMCProduct> CompareGeneratorResultsAnalyzer::hepMCToken2_
private

Definition at line 46 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by analyze(), and CompareGeneratorResultsAnalyzer().

edm::EDGetTokenT<GenLumiInfoHeader> CompareGeneratorResultsAnalyzer::lumiHeaderToken1_
private
edm::EDGetTokenT<GenLumiInfoHeader> CompareGeneratorResultsAnalyzer::lumiHeaderToken2_
private
edm::EDGetTokenT<GenLumiInfoProduct> CompareGeneratorResultsAnalyzer::lumiProductToken1_
private
edm::EDGetTokenT<GenLumiInfoProduct> CompareGeneratorResultsAnalyzer::lumiProductToken2_
private
std::string CompareGeneratorResultsAnalyzer::mod1_
private

Definition at line 39 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by CompareGeneratorResultsAnalyzer().

std::string CompareGeneratorResultsAnalyzer::mod2_
private

Definition at line 40 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by CompareGeneratorResultsAnalyzer().

edm::EDGetTokenT<GenRunInfoProduct> CompareGeneratorResultsAnalyzer::runProductToken1_
private
edm::EDGetTokenT<GenRunInfoProduct> CompareGeneratorResultsAnalyzer::runProductToken2_
private