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
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file CompareGeneratorResultsAnalyzer.cc.

Constructor & Destructor Documentation

◆ CompareGeneratorResultsAnalyzer()

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

Definition at line 60 of file CompareGeneratorResultsAnalyzer.cc.

References edm::ParameterSet::getUntrackedParameter(), 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

◆ analyze()

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(), evToken1_, evToken2_, hepMCToken1_, hepMCToken2_, iEvent, and prod1Switch_cff::prod1.

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_

◆ globalBeginLuminosityBlock()

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 Exception, Hcal_Conditions_forGlobalTag_cff::iLumi, lumiHeaderToken1_, lumiHeaderToken2_, and prod1Switch_cff::prod1.

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_

◆ globalBeginRun()

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 }

◆ globalEndLuminosityBlock()

void CompareGeneratorResultsAnalyzer::globalEndLuminosityBlock ( edm::LuminosityBlock const &  iLumi,
edm::EventSetup const &   
) const
override

Definition at line 256 of file CompareGeneratorResultsAnalyzer.cc.

References allowXSecDifferences_, compare(), Exception, mps_fire::i, Hcal_Conditions_forGlobalTag_cff::iLumi, lumiProductToken1_, lumiProductToken2_, and prod1Switch_cff::prod1.

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_

◆ globalEndRun()

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(), prod1Switch_cff::prod1, 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

◆ allowXSecDifferences_

bool CompareGeneratorResultsAnalyzer::allowXSecDifferences_
private

Definition at line 57 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by globalEndLuminosityBlock().

◆ evToken1_

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

Definition at line 42 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by analyze().

◆ evToken2_

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

Definition at line 43 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by analyze().

◆ hepMCToken1_

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

Definition at line 45 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by analyze().

◆ hepMCToken2_

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

Definition at line 46 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by analyze().

◆ lumiHeaderToken1_

edm::EDGetTokenT<GenLumiInfoHeader> CompareGeneratorResultsAnalyzer::lumiHeaderToken1_
private

Definition at line 48 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by globalBeginLuminosityBlock().

◆ lumiHeaderToken2_

edm::EDGetTokenT<GenLumiInfoHeader> CompareGeneratorResultsAnalyzer::lumiHeaderToken2_
private

Definition at line 49 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by globalBeginLuminosityBlock().

◆ lumiProductToken1_

edm::EDGetTokenT<GenLumiInfoProduct> CompareGeneratorResultsAnalyzer::lumiProductToken1_
private

Definition at line 51 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by globalEndLuminosityBlock().

◆ lumiProductToken2_

edm::EDGetTokenT<GenLumiInfoProduct> CompareGeneratorResultsAnalyzer::lumiProductToken2_
private

Definition at line 52 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by globalEndLuminosityBlock().

◆ mod1_

std::string CompareGeneratorResultsAnalyzer::mod1_
private

Definition at line 39 of file CompareGeneratorResultsAnalyzer.cc.

◆ mod2_

std::string CompareGeneratorResultsAnalyzer::mod2_
private

Definition at line 40 of file CompareGeneratorResultsAnalyzer.cc.

◆ runProductToken1_

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

Definition at line 54 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by globalEndRun().

◆ runProductToken2_

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

Definition at line 55 of file CompareGeneratorResultsAnalyzer.cc.

Referenced by globalEndRun().