CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
GenWeightsTableProducer Class Reference
Inheritance diagram for GenWeightsTableProducer:
edm::global::EDProducer< edm::StreamCache< LumiCacheInfoHolder >, edm::RunCache< DynamicWeightChoice >, edm::RunSummaryCache< CounterMap >, edm::EndRunProducer > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

std::unique_ptr< LumiCacheInfoHolder > beginStream (edm::StreamID) const override
 
void fillLHEPdfWeightTablesFromGenInfo (Counter *counter, const DynamicWeightChoiceGenInfo *weightChoice, double genWeight, const GenEventInfoProduct &genProd, std::unique_ptr< nanoaod::FlatTable > &outScale, std::unique_ptr< nanoaod::FlatTable > &outPdf, std::unique_ptr< nanoaod::FlatTable > &outNamed, std::unique_ptr< nanoaod::FlatTable > &outPS) const
 
void fillLHEWeightTables (Counter *counter, const DynamicWeightChoice *weightChoice, const DynamicWeightChoiceGenInfo *genWeightChoice, double genWeight, const LHEEventProduct &lheProd, const GenEventInfoProduct &genProd, std::unique_ptr< nanoaod::FlatTable > &outScale, std::unique_ptr< nanoaod::FlatTable > &outPdf, std::unique_ptr< nanoaod::FlatTable > &outRwgt, std::unique_ptr< nanoaod::FlatTable > &outNamed, std::unique_ptr< nanoaod::FlatTable > &outPS) const
 
void fillOnlyPSWeightTable (Counter *counter, const DynamicWeightChoiceGenInfo *genWeightChoice, double genWeight, const GenEventInfoProduct &genProd, std::unique_ptr< nanoaod::FlatTable > &outPS) const
 
 GenWeightsTableProducer (edm::ParameterSet const &params)
 
std::shared_ptr< DynamicWeightChoice > globalBeginRun (edm::Run const &iRun, edm::EventSetup const &) const override
 
std::shared_ptr< CounterMap > globalBeginRunSummary (edm::Run const &, edm::EventSetup const &) const override
 
void globalEndRun (edm::Run const &, edm::EventSetup const &) const override
 
void globalEndRunProduce (edm::Run &iRun, edm::EventSetup const &, CounterMap const *runCounterMap) const override
 
void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, CounterMap *runCounterMap) const override
 
void produce (edm::StreamID id, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
void setPSWeightInfo (const std::vector< double > &genWeights, const DynamicWeightChoiceGenInfo *genWeightChoice, std::vector< double > &wPS, std::string &psWeightDocStr) const
 
void streamBeginLuminosityBlock (edm::StreamID id, edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &eventSetup) const override
 
void streamBeginRun (edm::StreamID id, edm::Run const &, edm::EventSetup const &) const override
 
void streamEndRunSummary (edm::StreamID id, edm::Run const &, edm::EventSetup const &, CounterMap *runCounterMap) const override
 
 ~GenWeightsTableProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer< edm::StreamCache< LumiCacheInfoHolder >, edm::RunCache< DynamicWeightChoice >, edm::RunSummaryCache< CounterMap >, edm::EndRunProducer >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Protected Attributes

std::atomic< bool > debug_
 
std::atomic< bool > debugRun_
 
const edm::EDGetTokenT< GenLumiInfoHeadergenLumiInfoHeadTag_
 
const edm::EDGetTokenT< GenEventInfoProductgenTag_
 
std::atomic< bool > hasIssuedWarning_
 
bool keepAllPSWeights_
 
std::unordered_map< std::string, uint32_t > lhaNameToID_
 
const std::vector< edm::InputTaglheLabel_
 
const std::vector< edm::EDGetTokenT< LHERunInfoProduct > > lheRunTag_
 
const std::vector< edm::EDGetTokenT< LHEEventProduct > > lheTag_
 
int lheWeightPrecision_
 
unsigned int maxPdfWeights_
 
std::vector< std::string > namedWeightIDs_
 
std::vector< std::string > namedWeightLabels_
 
std::vector< uint32_t > preferredPDFLHAIDs_
 
std::atomic< bool > psWeightWarning_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- 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 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<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 247 of file GenWeightsTableProducer.cc.

Constructor & Destructor Documentation

◆ GenWeightsTableProducer()

GenWeightsTableProducer::GenWeightsTableProducer ( edm::ParameterSet const &  params)
inline

Definition at line 252 of file GenWeightsTableProducer.cc.

References makeGlobalPositionRcd_cfg::tag.

253  : genTag_(consumes<GenEventInfoProduct>(params.getParameter<edm::InputTag>("genEvent"))),
254  lheLabel_(params.getParameter<std::vector<edm::InputTag>>("lheInfo")),
256  [this](const edm::InputTag& tag) { return mayConsume<LHEEventProduct>(tag); })),
258  lheLabel_, [this](const edm::InputTag& tag) { return mayConsume<LHERunInfoProduct, edm::InRun>(tag); })),
260  mayConsume<GenLumiInfoHeader, edm::InLumi>(params.getParameter<edm::InputTag>("genLumiInfoHeader"))),
261  namedWeightIDs_(params.getParameter<std::vector<std::string>>("namedWeightIDs")),
262  namedWeightLabels_(params.getParameter<std::vector<std::string>>("namedWeightLabels")),
263  lheWeightPrecision_(params.getParameter<int32_t>("lheWeightPrecision")),
264  maxPdfWeights_(params.getParameter<uint32_t>("maxPdfWeights")),
265  keepAllPSWeights_(params.getParameter<bool>("keepAllPSWeights")),
266  debug_(params.getUntrackedParameter<bool>("debug", false)),
267  debugRun_(debug_.load()),
268  hasIssuedWarning_(false),
269  psWeightWarning_(false) {
270  produces<nanoaod::FlatTable>();
271  produces<std::string>("genModel");
272  produces<nanoaod::FlatTable>("LHEScale");
273  produces<nanoaod::FlatTable>("LHEPdf");
274  produces<nanoaod::FlatTable>("LHEReweighting");
275  produces<nanoaod::FlatTable>("LHENamed");
276  produces<nanoaod::FlatTable>("PS");
277  produces<nanoaod::MergeableCounterTable, edm::Transition::EndRun>();
278  if (namedWeightIDs_.size() != namedWeightLabels_.size()) {
279  throw cms::Exception("Configuration", "Size mismatch between namedWeightIDs & namedWeightLabels");
280  }
281  for (const edm::ParameterSet& pdfps : params.getParameter<std::vector<edm::ParameterSet>>("preferredPDFs")) {
282  const std::string& name = pdfps.getParameter<std::string>("name");
283  uint32_t lhaid = pdfps.getParameter<uint32_t>("lhaid");
284  preferredPDFLHAIDs_.push_back(lhaid);
286  lhaNameToID_[name + ".LHgrid"] = lhaid;
287  }
288  }
const std::vector< edm::EDGetTokenT< LHERunInfoProduct > > lheRunTag_
const edm::EDGetTokenT< GenEventInfoProduct > genTag_
std::atomic< bool > hasIssuedWarning_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
std::unordered_map< std::string, uint32_t > lhaNameToID_
const std::vector< edm::InputTag > lheLabel_
std::atomic< bool > psWeightWarning_
std::vector< std::string > namedWeightLabels_
const std::vector< edm::EDGetTokenT< LHEEventProduct > > lheTag_
std::vector< uint32_t > preferredPDFLHAIDs_
std::vector< std::string > namedWeightIDs_
const edm::EDGetTokenT< GenLumiInfoHeader > genLumiInfoHeadTag_

◆ ~GenWeightsTableProducer()

GenWeightsTableProducer::~GenWeightsTableProducer ( )
inlineoverride

Definition at line 290 of file GenWeightsTableProducer.cc.

290 {}

Member Function Documentation

◆ beginStream()

std::unique_ptr<LumiCacheInfoHolder> GenWeightsTableProducer::beginStream ( edm::StreamID  ) const
inlineoverride

Definition at line 937 of file GenWeightsTableProducer.cc.

937  {
938  return std::make_unique<LumiCacheInfoHolder>();
939  }

◆ fillDescriptions()

static void GenWeightsTableProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 1142 of file GenWeightsTableProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, HLT_2022v14_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

1142  {
1144  desc.add<edm::InputTag>("genEvent", edm::InputTag("generator"))
1145  ->setComment("tag for the GenEventInfoProduct, to get the main weight");
1146  desc.add<edm::InputTag>("genLumiInfoHeader", edm::InputTag("generator"))
1147  ->setComment("tag for the GenLumiInfoProduct, to get the model string");
1148  desc.add<std::vector<edm::InputTag>>("lheInfo", std::vector<edm::InputTag>{{"externalLHEProducer"}, {"source"}})
1149  ->setComment("tag(s) for the LHE information (LHEEventProduct and LHERunInfoProduct)");
1150 
1152  prefpdf.add<std::string>("name");
1153  prefpdf.add<uint32_t>("lhaid");
1154  desc.addVPSet("preferredPDFs", prefpdf, std::vector<edm::ParameterSet>())
1155  ->setComment(
1156  "LHA PDF Ids of the preferred PDF sets, in order of preference (the first matching one will be used)");
1157  desc.add<std::vector<std::string>>("namedWeightIDs")->setComment("set of LHA weight IDs for named LHE weights");
1158  desc.add<std::vector<std::string>>("namedWeightLabels")
1159  ->setComment("output names for the namedWeightIDs (in the same order)");
1160  desc.add<int32_t>("lheWeightPrecision")->setComment("Number of bits in the mantissa for LHE weights");
1161  desc.add<uint32_t>("maxPdfWeights")->setComment("Maximum number of PDF weights to save (to crop NN replicas)");
1162  desc.add<bool>("keepAllPSWeights")->setComment("Store all PS weights found");
1163  desc.addOptionalUntracked<bool>("debug")->setComment("dump out all LHE information for one event");
1164  descriptions.add("genWeightsTable", desc);
1165  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillLHEPdfWeightTablesFromGenInfo()

void GenWeightsTableProducer::fillLHEPdfWeightTablesFromGenInfo ( Counter *  counter,
const DynamicWeightChoiceGenInfo *  weightChoice,
double  genWeight,
const GenEventInfoProduct genProd,
std::unique_ptr< nanoaod::FlatTable > &  outScale,
std::unique_ptr< nanoaod::FlatTable > &  outPdf,
std::unique_ptr< nanoaod::FlatTable > &  outNamed,
std::unique_ptr< nanoaod::FlatTable > &  outPS 
) const
inline

Definition at line 440 of file GenWeightsTableProducer.cc.

References lheWeightPrecision_, setPSWeightInfo(), AlCaHLTBitMon_QueryRunRegistry::string, GenEventInfoProduct::weights(), and hltDeepSecondaryVertexTagInfosPFPuppi_cfi::weights.

Referenced by produce().

447  {
448  const std::vector<unsigned int>& scaleWeightIDs = weightChoice->scaleWeightIDs;
449  const std::vector<unsigned int>& pdfWeightIDs = weightChoice->pdfWeightIDs;
450 
451  auto weights = genProd.weights();
452  double w0 = (weights.size() > 1) ? weights.at(1) : 1.;
453  double originalXWGTUP = (weights.size() > 1) ? weights.at(1) : 1.;
454 
455  std::vector<double> wScale, wPDF, wPS;
456  for (auto id : scaleWeightIDs)
457  wScale.push_back(weights.at(id) / w0);
458  for (auto id : pdfWeightIDs) {
459  wPDF.push_back(weights.at(id) / w0);
460  }
461 
462  std::string psWeightsDocStr;
463  setPSWeightInfo(genProd.weights(), weightChoice, wPS, psWeightsDocStr);
464 
465  outScale = std::make_unique<nanoaod::FlatTable>(wScale.size(), "LHEScaleWeight", false);
466  outScale->addColumn<float>("", wScale, weightChoice->scaleWeightsDoc, lheWeightPrecision_);
467 
468  outPdf = std::make_unique<nanoaod::FlatTable>(wPDF.size(), "LHEPdfWeight", false);
469  outPdf->addColumn<float>("", wPDF, weightChoice->pdfWeightsDoc, lheWeightPrecision_);
470 
471  outPS = std::make_unique<nanoaod::FlatTable>(wPS.size(), "PSWeight", false);
472  outPS->addColumn<float>("", wPS, psWeightsDocStr, lheWeightPrecision_);
473 
474  outNamed = std::make_unique<nanoaod::FlatTable>(1, "LHEWeight", true);
475  outNamed->addColumnValue<float>("originalXWGTUP", originalXWGTUP, "Nominal event weight in the LHE file");
476  /*for (unsigned int i = 0, n = wNamed.size(); i < n; ++i) {
477  outNamed->addColumnValue<float>(namedWeightLabels_[i], wNamed[i], "LHE weight for id "+namedWeightIDs_[i]+", relative to nominal", lheWeightPrecision_);
478  }*/
479 
480  counter->incLHE(genWeight, wScale, wPDF, std::vector<double>(), std::vector<double>(), wPS);
481  }
void setPSWeightInfo(const std::vector< double > &genWeights, const DynamicWeightChoiceGenInfo *genWeightChoice, std::vector< double > &wPS, std::string &psWeightDocStr) const
std::vector< double > & weights()

◆ fillLHEWeightTables()

void GenWeightsTableProducer::fillLHEWeightTables ( Counter *  counter,
const DynamicWeightChoice *  weightChoice,
const DynamicWeightChoiceGenInfo *  genWeightChoice,
double  genWeight,
const LHEEventProduct lheProd,
const GenEventInfoProduct genProd,
std::unique_ptr< nanoaod::FlatTable > &  outScale,
std::unique_ptr< nanoaod::FlatTable > &  outPdf,
std::unique_ptr< nanoaod::FlatTable > &  outRwgt,
std::unique_ptr< nanoaod::FlatTable > &  outNamed,
std::unique_ptr< nanoaod::FlatTable > &  outPS 
) const
inline

Definition at line 369 of file GenWeightsTableProducer.cc.

References debug_, spr::find(), mps_fire::i, lheWeightPrecision_, dqmiodumpmetadata::n, namedWeightIDs_, namedWeightLabels_, LHEEventProduct::originalXWGTUP(), setPSWeightInfo(), AlCaHLTBitMon_QueryRunRegistry::string, GenEventInfoProduct::weights(), and LHEEventProduct::weights().

Referenced by produce().

379  {
380  bool lheDebug = debug_.exchange(
381  false); // make sure only the first thread dumps out this (even if may still be mixed up with other output, but nevermind)
382 
383  const std::vector<std::string>& scaleWeightIDs = weightChoice->scaleWeightIDs;
384  const std::vector<std::string>& pdfWeightIDs = weightChoice->pdfWeightIDs;
385  const std::vector<std::string>& rwgtWeightIDs = weightChoice->rwgtIDs;
386 
387  double w0 = lheProd.originalXWGTUP();
388 
389  std::vector<double> wScale(scaleWeightIDs.size(), 1), wPDF(pdfWeightIDs.size(), 1), wRwgt(rwgtWeightIDs.size(), 1),
390  wNamed(namedWeightIDs_.size(), 1);
391  for (auto& weight : lheProd.weights()) {
392  if (lheDebug)
393  printf("Weight %+9.5f rel %+9.5f for id %s\n", weight.wgt, weight.wgt / w0, weight.id.c_str());
394  // now we do it slowly, can be optimized
395  auto mScale = std::find(scaleWeightIDs.begin(), scaleWeightIDs.end(), weight.id);
396  if (mScale != scaleWeightIDs.end())
397  wScale[mScale - scaleWeightIDs.begin()] = weight.wgt / w0;
398 
399  auto mPDF = std::find(pdfWeightIDs.begin(), pdfWeightIDs.end(), weight.id);
400  if (mPDF != pdfWeightIDs.end())
401  wPDF[mPDF - pdfWeightIDs.begin()] = weight.wgt / w0;
402 
403  auto mRwgt = std::find(rwgtWeightIDs.begin(), rwgtWeightIDs.end(), weight.id);
404  if (mRwgt != rwgtWeightIDs.end())
405  wRwgt[mRwgt - rwgtWeightIDs.begin()] = weight.wgt / w0;
406 
407  auto mNamed = std::find(namedWeightIDs_.begin(), namedWeightIDs_.end(), weight.id);
408  if (mNamed != namedWeightIDs_.end())
409  wNamed[mNamed - namedWeightIDs_.begin()] = weight.wgt / w0;
410  }
411 
412  std::vector<double> wPS;
413  std::string psWeightDocStr;
414  setPSWeightInfo(genProd.weights(), genWeightChoice, wPS, psWeightDocStr);
415 
416  outPS = std::make_unique<nanoaod::FlatTable>(wPS.size(), "PSWeight", false);
417  outPS->addColumn<float>("", wPS, psWeightDocStr, lheWeightPrecision_);
418 
419  outScale = std::make_unique<nanoaod::FlatTable>(wScale.size(), "LHEScaleWeight", false);
420  outScale->addColumn<float>("", wScale, weightChoice->scaleWeightsDoc, lheWeightPrecision_);
421 
422  outPdf = std::make_unique<nanoaod::FlatTable>(wPDF.size(), "LHEPdfWeight", false);
423  outPdf->addColumn<float>("", wPDF, weightChoice->pdfWeightsDoc, lheWeightPrecision_);
424 
425  outRwgt = std::make_unique<nanoaod::FlatTable>(wRwgt.size(), "LHEReweightingWeight", false);
426  outRwgt->addColumn<float>("", wRwgt, weightChoice->rwgtWeightDoc, lheWeightPrecision_);
427 
428  outNamed = std::make_unique<nanoaod::FlatTable>(1, "LHEWeight", true);
429  outNamed->addColumnValue<float>("originalXWGTUP", lheProd.originalXWGTUP(), "Nominal event weight in the LHE file");
430  for (unsigned int i = 0, n = wNamed.size(); i < n; ++i) {
431  outNamed->addColumnValue<float>(namedWeightLabels_[i],
432  wNamed[i],
433  "LHE weight for id " + namedWeightIDs_[i] + ", relative to nominal",
435  }
436 
437  counter->incLHE(genWeight, wScale, wPDF, wRwgt, wNamed, wPS);
438  }
double originalXWGTUP() const
void setPSWeightInfo(const std::vector< double > &genWeights, const DynamicWeightChoiceGenInfo *genWeightChoice, std::vector< double > &wPS, std::string &psWeightDocStr) const
Definition: weight.py:1
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< std::string > namedWeightLabels_
std::vector< double > & weights()
std::vector< std::string > namedWeightIDs_
const std::vector< WGT > & weights() const

◆ fillOnlyPSWeightTable()

void GenWeightsTableProducer::fillOnlyPSWeightTable ( Counter *  counter,
const DynamicWeightChoiceGenInfo *  genWeightChoice,
double  genWeight,
const GenEventInfoProduct genProd,
std::unique_ptr< nanoaod::FlatTable > &  outPS 
) const
inline

Definition at line 483 of file GenWeightsTableProducer.cc.

References lheWeightPrecision_, setPSWeightInfo(), AlCaHLTBitMon_QueryRunRegistry::string, and GenEventInfoProduct::weights().

Referenced by produce().

487  {
488  std::vector<double> wPS;
489  std::string psWeightDocStr;
490  setPSWeightInfo(genProd.weights(), genWeightChoice, wPS, psWeightDocStr);
491  outPS = std::make_unique<nanoaod::FlatTable>(wPS.size(), "PSWeight", false);
492  outPS->addColumn<float>("", wPS, psWeightDocStr, lheWeightPrecision_);
493 
494  counter->incGenOnly(genWeight);
495  counter->incPSOnly(genWeight, wPS);
496  }
void setPSWeightInfo(const std::vector< double > &genWeights, const DynamicWeightChoiceGenInfo *genWeightChoice, std::vector< double > &wPS, std::string &psWeightDocStr) const
std::vector< double > & weights()

◆ globalBeginRun()

std::shared_ptr<DynamicWeightChoice> GenWeightsTableProducer::globalBeginRun ( edm::Run const &  iRun,
edm::EventSetup const &   
) const
inlineoverride

Definition at line 544 of file GenWeightsTableProducer.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, debugRun_, mps_fire::end, spr::find(), first, newFWLiteAna::found, edm::Run::getByLabel(), l1ctLayer2EG_cff::id, genWeightsTable_cfi::lhaid, lhaNameToID_, genWeightsTable_cfi::lheInfo, lheLabel_, groupFilesInBlocks::lines, maxPdfWeights_, submitDQMOfflineCAF::nLines, preferredPDFLHAIDs_, jetUpdater_cfi::sort, and AlCaHLTBitMon_QueryRunRegistry::string.

544  {
546 
547  bool lheDebug = debugRun_.exchange(
548  false); // make sure only the first thread dumps out this (even if may still be mixed up with other output, but nevermind)
549  auto weightChoice = std::make_shared<DynamicWeightChoice>();
550 
551  // getByToken throws since we're not in the endRun (see https://github.com/cms-sw/cmssw/pull/18499)
552  //if (iRun.getByToken(lheRunTag_, lheInfo)) {
553  for (const auto& lheLabel : lheLabel_) {
554  iRun.getByLabel(lheLabel, lheInfo);
555  if (lheInfo.isValid()) {
556  break;
557  }
558  }
559  if (lheInfo.isValid()) {
560  std::vector<ScaleVarWeight> scaleVariationIDs;
561  std::vector<PDFSetWeights> pdfSetWeightIDs;
562  std::vector<std::string> lheReweighingIDs;
563  bool isFirstGroup = true;
564 
565  std::regex weightgroupmg26x("<weightgroup\\s+(?:name|type)=\"(.*)\"\\s+combine=\"(.*)\"\\s*>");
566  std::regex weightgroup("<weightgroup\\s+combine=\"(.*)\"\\s+(?:name|type)=\"(.*)\"\\s*>");
567  std::regex weightgroupRwgt("<weightgroup\\s+(?:name|type)=\"(.*)\"\\s*>");
568  std::regex endweightgroup("</weightgroup>");
569  std::regex scalewmg26x(
570  "<weight\\s+(?:.*\\s+)?id=\"(\\d+)\"\\s*(?:lhapdf=\\d+|dyn=\\s*-?\\d+)?\\s*((?:[mM][uU][rR]|renscfact)=\"("
571  "\\S+)\"\\s+(?:[mM][uU][Ff]|facscfact)=\"(\\S+)\")(\\s+.*)?</weight>");
572  std::regex scalewmg26xNew(
573  "<weight\\s*((?:[mM][uU][fF]|facscfact)=\"(\\S+)\"\\s+(?:[mM][uU][Rr]|renscfact)=\"(\\S+)\").+id=\"(\\d+)\"(."
574  "*)?</weight>");
575 
576  //<weight MUF="1.0" MUR="2.0" PDF="306000" id="1006"> MUR=2.0 </weight>
577  std::regex scalew(
578  "<weight\\s+(?:.*\\s+)?id=\"(\\d+|\\d+-NNLOPS)\">\\s*(?:lhapdf=\\d+|dyn=\\s*-?\\d+)?\\s*((?:mu[rR]|renscfact)"
579  "=(\\S+)\\s+(?:mu[Ff]|facscfact)=(\\S+)(\\s+.*)?)</weight>");
580  std::regex pdfw(
581  "<weight\\s+id=\"(\\d+)\">\\s*(?:PDF set|lhapdf|PDF|pdfset)\\s*=\\s*(\\d+)\\s*(?:\\s.*)?</weight>");
582  std::regex pdfwOld("<weight\\s+(?:.*\\s+)?id=\"(\\d+)\">\\s*Member \\s*(\\d+)\\s*(?:.*)</weight>");
583  std::regex pdfwmg26x(
584  "<weight\\s+id=\"(\\d+)\"\\s*MUR=\"(?:\\S+)\"\\s*MUF=\"(?:\\S+)\"\\s*(?:PDF "
585  "set|lhapdf|PDF|pdfset)\\s*=\\s*\"(\\d+)\"\\s*>\\s*(?:PDF=(\\d+)\\s*MemberID=(\\d+))?\\s*(?:\\s.*)?</"
586  "weight>");
587  //<weightgroup combine="symmhessian+as" name="NNPDF31_nnlo_as_0118_mc_hessian_pdfas">
588 
589  //<weight MUF="1.0" MUR="1.0" PDF="325300" id="1048"> PDF=325300 MemberID=0 </weight>
590  std::regex pdfwmg26xNew(
591  "<weight\\s+MUF=\"(?:\\S+)\"\\s*MUR=\"(?:\\S+)\"\\s*PDF=\"(?:\\S+)\"\\s*id=\"(\\S+)\"\\s*>"
592  "\\s*(?:PDF=(\\d+)\\s*MemberID=(\\d+))?\\s*(?:\\s.*)?</"
593  "weight>");
594 
595  std::regex rwgt("<weight\\s+id=\"(.+)\">(.+)?(</weight>)?");
596  std::smatch groups;
597  for (auto iter = lheInfo->headers_begin(), end = lheInfo->headers_end(); iter != end; ++iter) {
598  if (iter->tag() != "initrwgt") {
599  if (lheDebug)
600  std::cout << "Skipping LHE header with tag" << iter->tag() << std::endl;
601  continue;
602  }
603  if (lheDebug)
604  std::cout << "Found LHE header with tag" << iter->tag() << std::endl;
605  std::vector<std::string> lines = iter->lines();
606  bool missed_weightgroup =
607  false; //Needed because in some of the samples ( produced with MG26X ) a small part of the header info is ordered incorrectly
608  bool ismg26x = false;
609  bool ismg26xNew = false;
610  for (unsigned int iLine = 0, nLines = lines.size(); iLine < nLines;
611  ++iLine) { //First start looping through the lines to see which weightgroup pattern is matched
612  boost::replace_all(lines[iLine], "&lt;", "<");
613  boost::replace_all(lines[iLine], "&gt;", ">");
614  if (std::regex_search(lines[iLine], groups, weightgroupmg26x)) {
615  ismg26x = true;
616  } else if (std::regex_search(lines[iLine], groups, scalewmg26xNew) ||
617  std::regex_search(lines[iLine], groups, pdfwmg26xNew)) {
618  ismg26xNew = true;
619  }
620  }
621  for (unsigned int iLine = 0, nLines = lines.size(); iLine < nLines; ++iLine) {
622  if (lheDebug)
623  std::cout << lines[iLine];
624  if (std::regex_search(lines[iLine], groups, ismg26x ? weightgroupmg26x : weightgroup)) {
625  std::string groupname = groups.str(2);
626  if (ismg26x)
627  groupname = groups.str(1);
628  if (lheDebug)
629  std::cout << ">>> Looks like the beginning of a weight group for '" << groupname << "'" << std::endl;
630  if (groupname.find("scale_variation") == 0 || groupname == "Central scale variation" || isFirstGroup) {
631  if (lheDebug && groupname.find("scale_variation") != 0 && groupname != "Central scale variation")
632  std::cout << ">>> First weight is not scale variation, but assuming is the Central Weight" << std::endl;
633  else if (lheDebug)
634  std::cout << ">>> Looks like scale variation for theory uncertainties" << std::endl;
635  isFirstGroup = false;
636  for (++iLine; iLine < nLines; ++iLine) {
637  if (lheDebug) {
638  std::cout << " " << lines[iLine];
639  }
640  if (std::regex_search(
641  lines[iLine], groups, ismg26x ? scalewmg26x : (ismg26xNew ? scalewmg26xNew : scalew))) {
642  if (lheDebug)
643  std::cout << " >>> Scale weight " << groups[1].str() << " for " << groups[3].str() << " , "
644  << groups[4].str() << " , " << groups[5].str() << std::endl;
645  if (ismg26xNew) {
646  scaleVariationIDs.emplace_back(groups.str(4), groups.str(1), groups.str(3), groups.str(2));
647  } else {
648  scaleVariationIDs.emplace_back(groups.str(1), groups.str(2), groups.str(3), groups.str(4));
649  }
650  } else if (std::regex_search(lines[iLine], endweightgroup)) {
651  if (lheDebug)
652  std::cout << ">>> Looks like the end of a weight group" << std::endl;
653  if (!missed_weightgroup) {
654  break;
655  } else
656  missed_weightgroup = false;
657  } else if (std::regex_search(lines[iLine], ismg26x ? weightgroupmg26x : weightgroup)) {
658  if (lheDebug)
659  std::cout << ">>> Looks like the beginning of a new weight group, I will assume I missed the end "
660  "of the group."
661  << std::endl;
662  if (ismg26x || ismg26xNew)
663  missed_weightgroup = true;
664  --iLine; // rewind by one, and go back to the outer loop
665  break;
666  }
667  }
668  } else if (groupname == "PDF_variation" || groupname.find("PDF_variation ") == 0) {
669  if (lheDebug)
670  std::cout << ">>> Looks like a new-style block of PDF weights for one or more pdfs" << std::endl;
671  for (++iLine; iLine < nLines; ++iLine) {
672  if (lheDebug)
673  std::cout << " " << lines[iLine];
674  if (std::regex_search(lines[iLine], groups, pdfw)) {
675  unsigned int lhaID = std::stoi(groups.str(2));
676  if (lheDebug)
677  std::cout << " >>> PDF weight " << groups.str(1) << " for " << groups.str(2) << " = " << lhaID
678  << std::endl;
679  if (pdfSetWeightIDs.empty() || !pdfSetWeightIDs.back().maybe_add(groups.str(1), lhaID)) {
680  pdfSetWeightIDs.emplace_back(groups.str(1), lhaID);
681  }
682  } else if (std::regex_search(lines[iLine], endweightgroup)) {
683  if (lheDebug)
684  std::cout << ">>> Looks like the end of a weight group" << std::endl;
685  if (!missed_weightgroup) {
686  break;
687  } else
688  missed_weightgroup = false;
689  } else if (std::regex_search(lines[iLine], ismg26x ? weightgroupmg26x : weightgroup)) {
690  if (lheDebug)
691  std::cout << ">>> Looks like the beginning of a new weight group, I will assume I missed the end "
692  "of the group."
693  << std::endl;
694  if (ismg26x || ismg26xNew)
695  missed_weightgroup = true;
696  --iLine; // rewind by one, and go back to the outer loop
697  break;
698  }
699  }
700  } else if (groupname == "PDF_variation1" || groupname == "PDF_variation2") {
701  if (lheDebug)
702  std::cout << ">>> Looks like a new-style block of PDF weights for multiple pdfs" << std::endl;
703  unsigned int lastid = 0;
704  for (++iLine; iLine < nLines; ++iLine) {
705  if (lheDebug)
706  std::cout << " " << lines[iLine];
707  if (std::regex_search(lines[iLine], groups, pdfw)) {
708  unsigned int id = std::stoi(groups.str(1));
709  unsigned int lhaID = std::stoi(groups.str(2));
710  if (lheDebug)
711  std::cout << " >>> PDF weight " << groups.str(1) << " for " << groups.str(2) << " = " << lhaID
712  << std::endl;
713  if (id != (lastid + 1) || pdfSetWeightIDs.empty()) {
714  pdfSetWeightIDs.emplace_back(groups.str(1), lhaID);
715  } else {
716  pdfSetWeightIDs.back().add(groups.str(1), lhaID);
717  }
718  lastid = id;
719  } else if (std::regex_search(lines[iLine], endweightgroup)) {
720  if (lheDebug)
721  std::cout << ">>> Looks like the end of a weight group" << std::endl;
722  if (!missed_weightgroup) {
723  break;
724  } else
725  missed_weightgroup = false;
726  } else if (std::regex_search(lines[iLine], ismg26x ? weightgroupmg26x : weightgroup)) {
727  if (lheDebug)
728  std::cout << ">>> Looks like the beginning of a new weight group, I will assume I missed the end "
729  "of the group."
730  << std::endl;
731  if (ismg26x || ismg26xNew)
732  missed_weightgroup = true;
733  --iLine; // rewind by one, and go back to the outer loop
734  break;
735  }
736  }
737  } else if (lhaNameToID_.find(groupname) != lhaNameToID_.end()) {
738  if (lheDebug)
739  std::cout << ">>> Looks like an old-style PDF weight for an individual pdf" << std::endl;
740  unsigned int firstLhaID = lhaNameToID_.find(groupname)->second;
741  bool first = true;
742  for (++iLine; iLine < nLines; ++iLine) {
743  if (lheDebug)
744  std::cout << " " << lines[iLine];
745  if (std::regex_search(
746  lines[iLine], groups, ismg26x ? pdfwmg26x : (ismg26xNew ? pdfwmg26xNew : pdfwOld))) {
747  unsigned int member = 0;
748  if (!ismg26x && !ismg26xNew) {
749  member = std::stoi(groups.str(2));
750  } else if (ismg26xNew) {
751  if (!groups.str(3).empty()) {
752  member = std::stoi(groups.str(3));
753  }
754  } else {
755  if (!groups.str(4).empty()) {
756  member = std::stoi(groups.str(4));
757  }
758  }
759  unsigned int lhaID = member + firstLhaID;
760  if (lheDebug)
761  std::cout << " >>> PDF weight " << groups.str(1) << " for " << member << " = " << lhaID
762  << std::endl;
763  //if (member == 0) continue; // let's keep also the central value for now
764  if (first) {
765  pdfSetWeightIDs.emplace_back(groups.str(1), lhaID);
766  first = false;
767  } else {
768  pdfSetWeightIDs.back().add(groups.str(1), lhaID);
769  }
770  } else if (std::regex_search(lines[iLine], endweightgroup)) {
771  if (lheDebug)
772  std::cout << ">>> Looks like the end of a weight group" << std::endl;
773  if (!missed_weightgroup) {
774  break;
775  } else
776  missed_weightgroup = false;
777  } else if (std::regex_search(lines[iLine], ismg26x ? weightgroupmg26x : weightgroup)) {
778  if (lheDebug)
779  std::cout << ">>> Looks like the beginning of a new weight group, I will assume I missed the end "
780  "of the group."
781  << std::endl;
782  if (ismg26x || ismg26xNew)
783  missed_weightgroup = true;
784  --iLine; // rewind by one, and go back to the outer loop
785  break;
786  }
787  }
788  } else if (groupname == "mass_variation" || groupname == "sthw2_variation" ||
789  groupname == "width_variation") {
790  if (lheDebug)
791  std::cout << ">>> Looks like an EW parameter weight" << std::endl;
792  for (++iLine; iLine < nLines; ++iLine) {
793  if (lheDebug)
794  std::cout << " " << lines[iLine];
795  if (std::regex_search(lines[iLine], groups, rwgt)) {
796  std::string rwgtID = groups.str(1);
797  if (lheDebug)
798  std::cout << " >>> LHE reweighting weight: " << rwgtID << std::endl;
799  if (std::find(lheReweighingIDs.begin(), lheReweighingIDs.end(), rwgtID) == lheReweighingIDs.end()) {
800  // we're only interested in the beggining of the block
801  lheReweighingIDs.emplace_back(rwgtID);
802  }
803  } else if (std::regex_search(lines[iLine], endweightgroup)) {
804  if (lheDebug)
805  std::cout << ">>> Looks like the end of a weight group" << std::endl;
806  }
807  }
808  } else {
809  for (++iLine; iLine < nLines; ++iLine) {
810  if (lheDebug)
811  std::cout << " " << lines[iLine];
812  if (std::regex_search(lines[iLine], groups, endweightgroup)) {
813  if (lheDebug)
814  std::cout << ">>> Looks like the end of a weight group" << std::endl;
815  if (!missed_weightgroup) {
816  break;
817  } else
818  missed_weightgroup = false;
819  } else if (std::regex_search(lines[iLine], ismg26x ? weightgroupmg26x : weightgroup)) {
820  if (lheDebug)
821  std::cout << ">>> Looks like the beginning of a new weight group, I will assume I missed the end "
822  "of the group."
823  << std::endl;
824  if (ismg26x || ismg26xNew)
825  missed_weightgroup = true;
826  --iLine; // rewind by one, and go back to the outer loop
827  break;
828  }
829  }
830  }
831  } else if (std::regex_search(lines[iLine], groups, weightgroupRwgt)) {
832  std::string groupname = groups.str(1);
833  if (groupname.find("mg_reweighting") != std::string::npos) {
834  if (lheDebug)
835  std::cout << ">>> Looks like a LHE weights for reweighting" << std::endl;
836  for (++iLine; iLine < nLines; ++iLine) {
837  if (lheDebug)
838  std::cout << " " << lines[iLine];
839  if (std::regex_search(lines[iLine], groups, rwgt)) {
840  std::string rwgtID = groups.str(1);
841  if (lheDebug)
842  std::cout << " >>> LHE reweighting weight: " << rwgtID << std::endl;
843  if (std::find(lheReweighingIDs.begin(), lheReweighingIDs.end(), rwgtID) == lheReweighingIDs.end()) {
844  // we're only interested in the beggining of the block
845  lheReweighingIDs.emplace_back(rwgtID);
846  }
847  } else if (std::regex_search(lines[iLine], endweightgroup)) {
848  if (lheDebug)
849  std::cout << ">>> Looks like the end of a weight group" << std::endl;
850  if (!missed_weightgroup) {
851  break;
852  } else
853  missed_weightgroup = false;
854  } else if (std::regex_search(lines[iLine], ismg26x ? weightgroupmg26x : weightgroup)) {
855  if (lheDebug)
856  std::cout << ">>> Looks like the beginning of a new weight group, I will assume I missed the end "
857  "of the group."
858  << std::endl;
859  if (ismg26x)
860  missed_weightgroup = true;
861  --iLine; // rewind by one, and go back to the outer loop
862  break;
863  }
864  }
865  }
866  }
867  }
868  //std::cout << "============= END [ " << iter->tag() << " ] ============ \n\n" << std::endl;
869 
870  // ----- SCALE VARIATIONS -----
871  std::sort(scaleVariationIDs.begin(), scaleVariationIDs.end());
872  if (lheDebug)
873  std::cout << "Found " << scaleVariationIDs.size() << " scale variations: " << std::endl;
874  std::stringstream scaleDoc;
875  scaleDoc << "LHE scale variation weights (w_var / w_nominal); ";
876  for (unsigned int isw = 0, nsw = scaleVariationIDs.size(); isw < nsw; ++isw) {
877  const auto& sw = scaleVariationIDs[isw];
878  if (isw)
879  scaleDoc << "; ";
880  scaleDoc << "[" << isw << "] is " << sw.label;
881  weightChoice->scaleWeightIDs.push_back(sw.wid);
882  if (lheDebug)
883  printf(" id %s: scales ren = % .2f fact = % .2f text = %s\n",
884  sw.wid.c_str(),
885  sw.scales.first,
886  sw.scales.second,
887  sw.label.c_str());
888  }
889  if (!scaleVariationIDs.empty())
890  weightChoice->scaleWeightsDoc = scaleDoc.str();
891 
892  // ------ PDF VARIATIONS (take the preferred one) -----
893  if (lheDebug) {
894  std::cout << "Found " << pdfSetWeightIDs.size() << " PDF set errors: " << std::endl;
895  for (const auto& pw : pdfSetWeightIDs)
896  printf("lhaIDs %6d - %6d (%3lu weights: %s, ... )\n",
897  pw.lhaIDs.first,
898  pw.lhaIDs.second,
899  pw.wids.size(),
900  pw.wids.front().c_str());
901  }
902 
903  // ------ LHE REWEIGHTING -------
904  if (lheDebug) {
905  std::cout << "Found " << lheReweighingIDs.size() << " reweighting weights" << std::endl;
906  }
907  std::copy(lheReweighingIDs.begin(), lheReweighingIDs.end(), std::back_inserter(weightChoice->rwgtIDs));
908 
909  std::stringstream pdfDoc;
910  pdfDoc << "LHE pdf variation weights (w_var / w_nominal) for LHA IDs ";
911  bool found = false;
912  for (const auto& pw : pdfSetWeightIDs) {
913  for (uint32_t lhaid : preferredPDFLHAIDs_) {
914  if (pw.lhaIDs.first != lhaid && pw.lhaIDs.first != (lhaid + 1))
915  continue; // sometimes the first weight is not saved if that PDF is the nominal one for the sample
916  if (pw.wids.size() == 1)
917  continue; // only consider error sets
918  pdfDoc << pw.lhaIDs.first << " - " << pw.lhaIDs.second;
919  weightChoice->pdfWeightIDs = pw.wids;
920  if (maxPdfWeights_ < pw.wids.size()) {
921  weightChoice->pdfWeightIDs.resize(maxPdfWeights_); // drop some replicas
922  pdfDoc << ", truncated to the first " << maxPdfWeights_ << " replicas";
923  }
924  weightChoice->pdfWeightsDoc = pdfDoc.str();
925  found = true;
926  break;
927  }
928  if (found)
929  break;
930  }
931  }
932  }
933  return weightChoice;
934  }
std::unordered_map< std::string, uint32_t > lhaNameToID_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::vector< edm::InputTag > lheLabel_
std::vector< uint32_t > preferredPDFLHAIDs_

◆ globalBeginRunSummary()

std::shared_ptr<CounterMap> GenWeightsTableProducer::globalBeginRunSummary ( edm::Run const &  ,
edm::EventSetup const &   
) const
inlineoverride

Definition at line 1071 of file GenWeightsTableProducer.cc.

1071  {
1072  return std::make_shared<CounterMap>();
1073  }

◆ globalEndRun()

void GenWeightsTableProducer::globalEndRun ( edm::Run const &  ,
edm::EventSetup const &   
) const
inlineoverride

Definition at line 1140 of file GenWeightsTableProducer.cc.

1140 {}

◆ globalEndRunProduce()

void GenWeightsTableProducer::globalEndRunProduce ( edm::Run iRun,
edm::EventSetup const &  ,
CounterMap const *  runCounterMap 
) const
inlineoverride

Definition at line 1084 of file GenWeightsTableProducer.cc.

References mps_fire::i, label, eostools::move(), dqmiodumpmetadata::n, namedWeightLabels_, MillePedeFileConverter_cfg::out, edm::Run::put(), AlCaHLTBitMon_QueryRunRegistry::string, heppy_batch::val, and x.

1084  {
1085  auto out = std::make_unique<nanoaod::MergeableCounterTable>();
1086 
1087  for (const auto& x : runCounterMap->countermap) {
1088  auto runCounter = &(x.second);
1089  std::string label = (!x.first.empty()) ? (std::string("_") + x.first) : "";
1090  std::string doclabel = (!x.first.empty()) ? (std::string(", for model label ") + x.first) : "";
1091 
1092  out->addInt("genEventCount" + label, "event count" + doclabel, runCounter->num);
1093  out->addFloat("genEventSumw" + label, "sum of gen weights" + doclabel, runCounter->sumw);
1094  out->addFloat("genEventSumw2" + label, "sum of gen (weight^2)" + doclabel, runCounter->sumw2);
1095 
1096  double norm = runCounter->sumw ? 1.0 / runCounter->sumw : 1;
1097  auto sumScales = runCounter->sumScale;
1098  for (auto& val : sumScales)
1099  val *= norm;
1100  out->addVFloatWithNorm("LHEScaleSumw" + label,
1101  "Sum of genEventWeight * LHEScaleWeight[i], divided by genEventSumw" + doclabel,
1102  sumScales,
1103  runCounter->sumw);
1104  auto sumPDFs = runCounter->sumPDF;
1105  for (auto& val : sumPDFs)
1106  val *= norm;
1107  out->addVFloatWithNorm("LHEPdfSumw" + label,
1108  "Sum of genEventWeight * LHEPdfWeight[i], divided by genEventSumw" + doclabel,
1109  sumPDFs,
1110  runCounter->sumw);
1111  auto sumPS = runCounter->sumPS;
1112  for (auto& val : sumPS)
1113  val *= norm;
1114  out->addVFloatWithNorm("PSSumw" + label,
1115  "Sum of genEventWeight * PSWeight[i], divided by genEventSumw" + doclabel,
1116  sumPS,
1117  runCounter->sumw);
1118  if (!runCounter->sumRwgt.empty()) {
1119  auto sumRwgts = runCounter->sumRwgt;
1120  for (auto& val : sumRwgts)
1121  val *= norm;
1122  out->addVFloatWithNorm("LHEReweightingSumw" + label,
1123  "Sum of genEventWeight * LHEReweightingWeight[i], divided by genEventSumw" + doclabel,
1124  sumRwgts,
1125  runCounter->sumw);
1126  }
1127  if (!runCounter->sumNamed.empty()) { // it could be empty if there's no LHE info in the sample
1128  for (unsigned int i = 0, n = namedWeightLabels_.size(); i < n; ++i) {
1129  out->addFloatWithNorm(
1130  "LHESumw_" + namedWeightLabels_[i] + label,
1131  "Sum of genEventWeight * LHEWeight_" + namedWeightLabels_[i] + ", divided by genEventSumw" + doclabel,
1132  runCounter->sumNamed[i] * norm,
1133  runCounter->sumw);
1134  }
1135  }
1136  }
1137  iRun.put(std::move(out));
1138  }
char const * label
std::vector< std::string > namedWeightLabels_
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Run.h:109
def move(src, dest)
Definition: eostools.py:511

◆ globalEndRunSummary()

void GenWeightsTableProducer::globalEndRunSummary ( edm::Run const &  ,
edm::EventSetup const &  ,
CounterMap *  runCounterMap 
) const
inlineoverride

Definition at line 1082 of file GenWeightsTableProducer.cc.

1082 {}

◆ produce()

void GenWeightsTableProducer::produce ( edm::StreamID  id,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
inlineoverridevirtual

Implements edm::global::EDProducerBase.

Definition at line 292 of file GenWeightsTableProducer.cc.

References fillLHEPdfWeightTablesFromGenInfo(), fillLHEWeightTables(), fillOnlyPSWeightTable(), genTag_, hasIssuedWarning_, iEvent, genWeightsTable_cfi::lheInfo, lheTag_, eostools::move(), MillePedeFileConverter_cfg::out, AlCaHLTBitMon_QueryRunRegistry::string, GenEventInfoProduct::weight(), and mps_merge::weight.

292  {
293  // get my counter for weights
294  Counter* counter = streamCache(id)->countermap.get();
295 
296  // generator information (always available)
298  iEvent.getByToken(genTag_, genInfo);
299  double weight = genInfo->weight();
300 
301  // table for gen info, always available
302  auto out = std::make_unique<nanoaod::FlatTable>(1, "genWeight", true);
303  out->setDoc("generator weight");
304  out->addColumnValue<float>("", weight, "generator weight");
305  iEvent.put(std::move(out));
306 
307  std::string model_label = streamCache(id)->countermap.getLabel();
308  auto outM = std::make_unique<std::string>((!model_label.empty()) ? std::string("GenModel_") + model_label : "");
309  iEvent.put(std::move(outM), "genModel");
310  bool getLHEweightsFromGenInfo = !model_label.empty();
311 
312  // tables for LHE weights, may not be filled
313  std::unique_ptr<nanoaod::FlatTable> lheScaleTab, lhePdfTab, lheRwgtTab, lheNamedTab;
314  std::unique_ptr<nanoaod::FlatTable> genPSTab;
315 
317  for (const auto& lheTag : lheTag_) {
318  iEvent.getByToken(lheTag, lheInfo);
319  if (lheInfo.isValid()) {
320  break;
321  }
322  }
323 
324  const auto genWeightChoice = &(streamCache(id)->weightChoice);
325  if (lheInfo.isValid()) {
326  if (getLHEweightsFromGenInfo && !hasIssuedWarning_.exchange(true))
327  edm::LogWarning("LHETablesProducer")
328  << "Found both a LHEEventProduct and a GenLumiInfoHeader: will only save weights from LHEEventProduct.\n";
329  // get the dynamic choice of weights
330  const DynamicWeightChoice* weightChoice = runCache(iEvent.getRun().index());
331  // go fill tables
333  weightChoice,
334  genWeightChoice,
335  weight,
336  *lheInfo,
337  *genInfo,
338  lheScaleTab,
339  lhePdfTab,
340  lheRwgtTab,
341  lheNamedTab,
342  genPSTab);
343  } else if (getLHEweightsFromGenInfo) {
345  counter, genWeightChoice, weight, *genInfo, lheScaleTab, lhePdfTab, lheNamedTab, genPSTab);
346  lheRwgtTab = std::make_unique<nanoaod::FlatTable>(1, "LHEReweightingWeights", true);
347  //lheNamedTab.reset(new nanoaod::FlatTable(1, "LHENamedWeights", true));
348  //genPSTab.reset(new nanoaod::FlatTable(1, "PSWeight", true));
349  } else {
350  // Still try to add the PS weights
351  fillOnlyPSWeightTable(counter, genWeightChoice, weight, *genInfo, genPSTab);
352  // make dummy values
353  lheScaleTab = std::make_unique<nanoaod::FlatTable>(1, "LHEScaleWeights", true);
354  lhePdfTab = std::make_unique<nanoaod::FlatTable>(1, "LHEPdfWeights", true);
355  lheRwgtTab = std::make_unique<nanoaod::FlatTable>(1, "LHEReweightingWeights", true);
356  lheNamedTab = std::make_unique<nanoaod::FlatTable>(1, "LHENamedWeights", true);
357  if (!hasIssuedWarning_.exchange(true)) {
358  edm::LogWarning("LHETablesProducer") << "No LHEEventProduct, so there will be no LHE Tables\n";
359  }
360  }
361 
362  iEvent.put(std::move(lheScaleTab), "LHEScale");
363  iEvent.put(std::move(lhePdfTab), "LHEPdf");
364  iEvent.put(std::move(lheRwgtTab), "LHEReweighting");
365  iEvent.put(std::move(lheNamedTab), "LHENamed");
366  iEvent.put(std::move(genPSTab), "PS");
367  }
const edm::EDGetTokenT< GenEventInfoProduct > genTag_
void fillOnlyPSWeightTable(Counter *counter, const DynamicWeightChoiceGenInfo *genWeightChoice, double genWeight, const GenEventInfoProduct &genProd, std::unique_ptr< nanoaod::FlatTable > &outPS) const
Definition: weight.py:1
std::atomic< bool > hasIssuedWarning_
void fillLHEWeightTables(Counter *counter, const DynamicWeightChoice *weightChoice, const DynamicWeightChoiceGenInfo *genWeightChoice, double genWeight, const LHEEventProduct &lheProd, const GenEventInfoProduct &genProd, std::unique_ptr< nanoaod::FlatTable > &outScale, std::unique_ptr< nanoaod::FlatTable > &outPdf, std::unique_ptr< nanoaod::FlatTable > &outRwgt, std::unique_ptr< nanoaod::FlatTable > &outNamed, std::unique_ptr< nanoaod::FlatTable > &outPS) const
std::function< unsigned int(align::ID)> Counter
int iEvent
Definition: GenABIO.cc:224
void fillLHEPdfWeightTablesFromGenInfo(Counter *counter, const DynamicWeightChoiceGenInfo *weightChoice, double genWeight, const GenEventInfoProduct &genProd, std::unique_ptr< nanoaod::FlatTable > &outScale, std::unique_ptr< nanoaod::FlatTable > &outPdf, std::unique_ptr< nanoaod::FlatTable > &outNamed, std::unique_ptr< nanoaod::FlatTable > &outPS) const
const std::vector< edm::EDGetTokenT< LHEEventProduct > > lheTag_
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511

◆ setPSWeightInfo()

void GenWeightsTableProducer::setPSWeightInfo ( const std::vector< double > &  genWeights,
const DynamicWeightChoiceGenInfo *  genWeightChoice,
std::vector< double > &  wPS,
std::string &  psWeightDocStr 
) const
inline

Definition at line 498 of file GenWeightsTableProducer.cc.

References mps_fire::i, keepAllPSWeights_, and psWeightWarning_.

Referenced by fillLHEPdfWeightTablesFromGenInfo(), fillLHEWeightTables(), and fillOnlyPSWeightTable().

501  {
502  wPS.clear();
503  // isRegularPSSet = keeping all weights and the weights are a usual size, ie
504  // all weights are PS weights (don't use header incase missing names)
505  bool isRegularPSSet = keepAllPSWeights_ && (genWeights.size() == 14 || genWeights.size() == 46);
506  if (!genWeightChoice->psWeightIDs.empty() && !isRegularPSSet) {
507  psWeightDocStr = genWeightChoice->psWeightsDoc;
508  double psNom = genWeights.at(genWeightChoice->psBaselineID);
509  for (auto wgtidx : genWeightChoice->psWeightIDs) {
510  wPS.push_back(genWeights.at(wgtidx) / psNom);
511  }
512  } else {
513  int vectorSize =
514  keepAllPSWeights_ ? (genWeights.size() - 2) : ((genWeights.size() == 14 || genWeights.size() == 46) ? 4 : 1);
515 
516  if (vectorSize > 1) {
517  double nominal = genWeights.at(1); // Called 'Baseline' in GenLumiInfoHeader
518  if (keepAllPSWeights_) {
519  for (int i = 0; i < vectorSize; i++) {
520  wPS.push_back(genWeights.at(i + 2) / nominal);
521  }
522  psWeightDocStr = "All PS weights (w_var / w_nominal)";
523  } else {
524  if (!psWeightWarning_.exchange(true))
525  edm::LogWarning("LHETablesProducer")
526  << "GenLumiInfoHeader not found: Central PartonShower weights will fill with the 6-10th entries \n"
527  << " This may incorrect for some mcs (madgraph 2.6.1 with its `isr:murfact=0.5` have a differnt "
528  "order )";
529  for (std::size_t i = 6; i < 10; i++) {
530  wPS.push_back(genWeights.at(i) / nominal);
531  }
532  psWeightDocStr =
533  "PS weights (w_var / w_nominal); [0] is ISR=2 FSR=1; [1] is ISR=1 FSR=2"
534  "[2] is ISR=0.5 FSR=1; [3] is ISR=1 FSR=0.5;";
535  }
536  } else {
537  wPS.push_back(1.0);
538  psWeightDocStr = "dummy PS weight (1.0) ";
539  }
540  }
541  }
std::atomic< bool > psWeightWarning_

◆ streamBeginLuminosityBlock()

void GenWeightsTableProducer::streamBeginLuminosityBlock ( edm::StreamID  id,
edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  eventSetup 
) const
inlineoverride

Definition at line 944 of file GenWeightsTableProducer.cc.

References GenLumiInfoHeader::configDescription(), newFWLiteAna::found, genLumiInfoHeadTag_, edm::LuminosityBlock::getByToken(), watchdog::group, mps_fire::i, edm::HandleBase::isValid(), keepAllPSWeights_, label, genWeightsTable_cfi::lhaid, lhaNameToID_, mps_splice::line, maxPdfWeights_, jetUpdater_cfi::sort, AlCaHLTBitMon_QueryRunRegistry::string, GenLumiInfoHeader::weightNames(), and x.

946  {
947  auto counterMap = &(streamCache(id)->countermap);
948  edm::Handle<GenLumiInfoHeader> genLumiInfoHead;
949  lumiBlock.getByToken(genLumiInfoHeadTag_, genLumiInfoHead);
950  if (!genLumiInfoHead.isValid())
951  edm::LogWarning("LHETablesProducer")
952  << "No GenLumiInfoHeader product found, will not fill generator model string.\n";
953 
955  if (genLumiInfoHead.isValid()) {
956  label = genLumiInfoHead->configDescription();
957  boost::replace_all(label, "-", "_");
958  boost::replace_all(label, "/", "_");
959  }
960  counterMap->setLabel(label);
961 
962  if (genLumiInfoHead.isValid()) {
963  auto weightChoice = &(streamCache(id)->weightChoice);
964 
965  std::vector<ScaleVarWeight> scaleVariationIDs;
966  std::vector<PDFSetWeights> pdfSetWeightIDs;
967  weightChoice->psWeightIDs.clear();
968 
969  std::regex scalew("LHE,\\s+id\\s+=\\s+(\\d+),\\s+(.+)\\,\\s+mur=(\\S+)\\smuf=(\\S+)");
970  std::regex pdfw("LHE,\\s+id\\s+=\\s+(\\d+),\\s+(.+),\\s+Member\\s+(\\d+)\\s+of\\ssets\\s+(\\w+\\b)");
971  std::regex mainPSw("sr(Def|:murfac=)(Hi|Lo|_dn|_up|0.5|2.0)");
972  std::smatch groups;
973  auto weightNames = genLumiInfoHead->weightNames();
974  std::unordered_map<std::string, uint32_t> knownPDFSetsFromGenInfo_;
975  unsigned int weightIter = 0;
976  for (const auto& line : weightNames) {
977  if (std::regex_search(line, groups, scalew)) { // scale variation
978  auto id = groups.str(1);
979  auto group = groups.str(2);
980  auto mur = groups.str(3);
981  auto muf = groups.str(4);
982  if (group.find("Central scale variation") != std::string::npos)
983  scaleVariationIDs.emplace_back(groups.str(1), groups.str(2), groups.str(3), groups.str(4));
984  } else if (std::regex_search(line, groups, pdfw)) { // PDF variation
985  auto id = groups.str(1);
986  auto group = groups.str(2);
987  auto memberid = groups.str(3);
988  auto pdfset = groups.str(4);
989  if (group.find(pdfset) != std::string::npos) {
990  if (knownPDFSetsFromGenInfo_.find(pdfset) == knownPDFSetsFromGenInfo_.end()) {
991  knownPDFSetsFromGenInfo_[pdfset] = std::atoi(id.c_str());
992  pdfSetWeightIDs.emplace_back(id, std::atoi(id.c_str()));
993  } else
994  pdfSetWeightIDs.back().add(id, std::atoi(id.c_str()));
995  }
996  } else if (line == "Baseline") {
997  weightChoice->psBaselineID = weightIter;
998  } else if (line.find("isr") != std::string::npos || line.find("fsr") != std::string::npos) {
999  weightChoice->matchPS_alt = line.find("sr:") != std::string::npos; // (f/i)sr: for new weights
1000  if (keepAllPSWeights_) {
1001  weightChoice->psWeightIDs.push_back(weightIter); // PS variations
1002  } else if (std::regex_search(line, groups, mainPSw)) {
1003  if (weightChoice->psWeightIDs.empty())
1004  weightChoice->psWeightIDs = std::vector<unsigned int>(4, -1);
1005  int psIdx = (line.find("fsr") != std::string::npos) ? 1 : 0;
1006  psIdx += (groups.str(2) == "Hi" || groups.str(2) == "_up" || groups.str(2) == "2.0") ? 0 : 2;
1007  weightChoice->psWeightIDs[psIdx] = weightIter;
1008  }
1009  }
1010  weightIter++;
1011  }
1012  if (keepAllPSWeights_) {
1013  weightChoice->psWeightsDoc = "All PS weights (w_var / w_nominal)";
1014  } else if (weightChoice->psWeightIDs.size() == 4) {
1015  weightChoice->psWeightsDoc =
1016  "PS weights (w_var / w_nominal); [0] is ISR=2 FSR=1; [1] is ISR=1 FSR=2"
1017  "[2] is ISR=0.5 FSR=1; [3] is ISR=1 FSR=0.5;";
1018  for (int i = 0; i < 4; i++) {
1019  if (static_cast<int>(weightChoice->psWeightIDs[i]) == -1)
1020  weightChoice->setMissingWeight(i);
1021  }
1022  } else {
1023  weightChoice->psWeightsDoc = "dummy PS weight (1.0) ";
1024  }
1025 
1026  weightChoice->scaleWeightIDs.clear();
1027  weightChoice->pdfWeightIDs.clear();
1028 
1029  std::sort(scaleVariationIDs.begin(), scaleVariationIDs.end());
1030  std::stringstream scaleDoc;
1031  scaleDoc << "LHE scale variation weights (w_var / w_nominal); ";
1032  for (unsigned int isw = 0, nsw = scaleVariationIDs.size(); isw < nsw; ++isw) {
1033  const auto& sw = scaleVariationIDs[isw];
1034  if (isw)
1035  scaleDoc << "; ";
1036  scaleDoc << "[" << isw << "] is " << sw.label;
1037  weightChoice->scaleWeightIDs.push_back(std::atoi(sw.wid.c_str()));
1038  }
1039  if (!scaleVariationIDs.empty())
1040  weightChoice->scaleWeightsDoc = scaleDoc.str();
1041  std::stringstream pdfDoc;
1042  pdfDoc << "LHE pdf variation weights (w_var / w_nominal) for LHA names ";
1043  bool found = false;
1044  for (const auto& pw : pdfSetWeightIDs) {
1045  if (pw.wids.size() == 1)
1046  continue; // only consider error sets
1047  for (const auto& wantedpdf : lhaNameToID_) {
1048  auto pdfname = wantedpdf.first;
1049  if (knownPDFSetsFromGenInfo_.find(pdfname) == knownPDFSetsFromGenInfo_.end())
1050  continue;
1051  uint32_t lhaid = knownPDFSetsFromGenInfo_.at(pdfname);
1052  if (pw.lhaIDs.first != lhaid)
1053  continue;
1054  pdfDoc << pdfname;
1055  for (const auto& x : pw.wids)
1056  weightChoice->pdfWeightIDs.push_back(std::atoi(x.c_str()));
1057  if (maxPdfWeights_ < pw.wids.size()) {
1058  weightChoice->pdfWeightIDs.resize(maxPdfWeights_); // drop some replicas
1059  pdfDoc << ", truncated to the first " << maxPdfWeights_ << " replicas";
1060  }
1061  weightChoice->pdfWeightsDoc = pdfDoc.str();
1062  found = true;
1063  break;
1064  }
1065  if (found)
1066  break;
1067  }
1068  }
1069  }
std::unordered_map< std::string, uint32_t > lhaNameToID_
const std::string & configDescription() const
const std::vector< std::string > & weightNames() const
char const * label
bool isValid() const
Definition: HandleBase.h:70
const edm::EDGetTokenT< GenLumiInfoHeader > genLumiInfoHeadTag_

◆ streamBeginRun()

void GenWeightsTableProducer::streamBeginRun ( edm::StreamID  id,
edm::Run const &  ,
edm::EventSetup const &   
) const
inlineoverride

Definition at line 941 of file GenWeightsTableProducer.cc.

941  {
942  streamCache(id)->clear();
943  }

◆ streamEndRunSummary()

void GenWeightsTableProducer::streamEndRunSummary ( edm::StreamID  id,
edm::Run const &  ,
edm::EventSetup const &  ,
CounterMap *  runCounterMap 
) const
inlineoverride

Definition at line 1075 of file GenWeightsTableProducer.cc.

1078  {
1079  runCounterMap->merge(streamCache(id)->countermap);
1080  }

Member Data Documentation

◆ debug_

std::atomic<bool> GenWeightsTableProducer::debug_
mutableprotected

Definition at line 1182 of file GenWeightsTableProducer.cc.

Referenced by fillLHEWeightTables().

◆ debugRun_

std::atomic<bool> GenWeightsTableProducer::debugRun_
mutableprotected

Definition at line 1182 of file GenWeightsTableProducer.cc.

Referenced by globalBeginRun().

◆ genLumiInfoHeadTag_

const edm::EDGetTokenT<GenLumiInfoHeader> GenWeightsTableProducer::genLumiInfoHeadTag_
protected

Definition at line 1172 of file GenWeightsTableProducer.cc.

Referenced by streamBeginLuminosityBlock().

◆ genTag_

const edm::EDGetTokenT<GenEventInfoProduct> GenWeightsTableProducer::genTag_
protected

Definition at line 1168 of file GenWeightsTableProducer.cc.

Referenced by produce().

◆ hasIssuedWarning_

std::atomic<bool> GenWeightsTableProducer::hasIssuedWarning_
mutableprotected

Definition at line 1182 of file GenWeightsTableProducer.cc.

Referenced by produce().

◆ keepAllPSWeights_

bool GenWeightsTableProducer::keepAllPSWeights_
protected

Definition at line 1180 of file GenWeightsTableProducer.cc.

Referenced by setPSWeightInfo(), and streamBeginLuminosityBlock().

◆ lhaNameToID_

std::unordered_map<std::string, uint32_t> GenWeightsTableProducer::lhaNameToID_
protected

Definition at line 1175 of file GenWeightsTableProducer.cc.

Referenced by globalBeginRun(), and streamBeginLuminosityBlock().

◆ lheLabel_

const std::vector<edm::InputTag> GenWeightsTableProducer::lheLabel_
protected

Definition at line 1169 of file GenWeightsTableProducer.cc.

Referenced by globalBeginRun().

◆ lheRunTag_

const std::vector<edm::EDGetTokenT<LHERunInfoProduct> > GenWeightsTableProducer::lheRunTag_
protected

Definition at line 1171 of file GenWeightsTableProducer.cc.

◆ lheTag_

const std::vector<edm::EDGetTokenT<LHEEventProduct> > GenWeightsTableProducer::lheTag_
protected

Definition at line 1170 of file GenWeightsTableProducer.cc.

Referenced by produce().

◆ lheWeightPrecision_

int GenWeightsTableProducer::lheWeightPrecision_
protected

◆ maxPdfWeights_

unsigned int GenWeightsTableProducer::maxPdfWeights_
protected

Definition at line 1179 of file GenWeightsTableProducer.cc.

Referenced by globalBeginRun(), and streamBeginLuminosityBlock().

◆ namedWeightIDs_

std::vector<std::string> GenWeightsTableProducer::namedWeightIDs_
protected

Definition at line 1176 of file GenWeightsTableProducer.cc.

Referenced by fillLHEWeightTables().

◆ namedWeightLabels_

std::vector<std::string> GenWeightsTableProducer::namedWeightLabels_
protected

Definition at line 1177 of file GenWeightsTableProducer.cc.

Referenced by fillLHEWeightTables(), and globalEndRunProduce().

◆ preferredPDFLHAIDs_

std::vector<uint32_t> GenWeightsTableProducer::preferredPDFLHAIDs_
protected

Definition at line 1174 of file GenWeightsTableProducer.cc.

Referenced by globalBeginRun().

◆ psWeightWarning_

std::atomic<bool> GenWeightsTableProducer::psWeightWarning_
mutableprotected

Definition at line 1182 of file GenWeightsTableProducer.cc.

Referenced by setPSWeightInfo().