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::LuminosityBlockCache< DynamicWeightChoiceGenInfo >, 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< DynamicWeightChoiceGenInfo > globalBeginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &) const override
 
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 globalEndLuminosityBlock (edm::LuminosityBlock 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 &) 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::LuminosityBlockCache< DynamicWeightChoiceGenInfo >, 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 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::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
 
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)
 

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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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 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 245 of file GenWeightsTableProducer.cc.

Constructor & Destructor Documentation

◆ GenWeightsTableProducer()

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

Definition at line 251 of file GenWeightsTableProducer.cc.

References makeGlobalPositionRcd_cfg::tag.

252  : genTag_(consumes<GenEventInfoProduct>(params.getParameter<edm::InputTag>("genEvent"))),
253  lheLabel_(params.getParameter<std::vector<edm::InputTag>>("lheInfo")),
255  [this](const edm::InputTag& tag) { return mayConsume<LHEEventProduct>(tag); })),
257  lheLabel_, [this](const edm::InputTag& tag) { return mayConsume<LHERunInfoProduct, edm::InRun>(tag); })),
259  mayConsume<GenLumiInfoHeader, edm::InLumi>(params.getParameter<edm::InputTag>("genLumiInfoHeader"))),
260  namedWeightIDs_(params.getParameter<std::vector<std::string>>("namedWeightIDs")),
261  namedWeightLabels_(params.getParameter<std::vector<std::string>>("namedWeightLabels")),
262  lheWeightPrecision_(params.getParameter<int32_t>("lheWeightPrecision")),
263  maxPdfWeights_(params.getParameter<uint32_t>("maxPdfWeights")),
264  keepAllPSWeights_(params.getParameter<bool>("keepAllPSWeights")),
265  debug_(params.getUntrackedParameter<bool>("debug", false)),
266  debugRun_(debug_.load()),
267  hasIssuedWarning_(false),
268  psWeightWarning_(false) {
269  produces<nanoaod::FlatTable>();
270  produces<std::string>("genModel");
271  produces<nanoaod::FlatTable>("LHEScale");
272  produces<nanoaod::FlatTable>("LHEPdf");
273  produces<nanoaod::FlatTable>("LHEReweighting");
274  produces<nanoaod::FlatTable>("LHENamed");
275  produces<nanoaod::FlatTable>("PS");
276  produces<nanoaod::MergeableCounterTable, edm::Transition::EndRun>();
277  if (namedWeightIDs_.size() != namedWeightLabels_.size()) {
278  throw cms::Exception("Configuration", "Size mismatch between namedWeightIDs & namedWeightLabels");
279  }
280  for (const edm::ParameterSet& pdfps : params.getParameter<std::vector<edm::ParameterSet>>("preferredPDFs")) {
281  const std::string& name = pdfps.getParameter<std::string>("name");
282  uint32_t lhaid = pdfps.getParameter<uint32_t>("lhaid");
283  preferredPDFLHAIDs_.push_back(lhaid);
285  lhaNameToID_[name + ".LHgrid"] = lhaid;
286  }
287  }
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 289 of file GenWeightsTableProducer.cc.

289 {}

Member Function Documentation

◆ beginStream()

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

Definition at line 936 of file GenWeightsTableProducer.cc.

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

◆ fillDescriptions()

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

Definition at line 1153 of file GenWeightsTableProducer.cc.

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

1153  {
1155  desc.add<edm::InputTag>("genEvent", edm::InputTag("generator"))
1156  ->setComment("tag for the GenEventInfoProduct, to get the main weight");
1157  desc.add<edm::InputTag>("genLumiInfoHeader", edm::InputTag("generator"))
1158  ->setComment("tag for the GenLumiInfoProduct, to get the model string");
1159  desc.add<std::vector<edm::InputTag>>("lheInfo", std::vector<edm::InputTag>{{"externalLHEProducer"}, {"source"}})
1160  ->setComment("tag(s) for the LHE information (LHEEventProduct and LHERunInfoProduct)");
1161 
1163  prefpdf.add<std::string>("name");
1164  prefpdf.add<uint32_t>("lhaid");
1165  desc.addVPSet("preferredPDFs", prefpdf, std::vector<edm::ParameterSet>())
1166  ->setComment(
1167  "LHA PDF Ids of the preferred PDF sets, in order of preference (the first matching one will be used)");
1168  desc.add<std::vector<std::string>>("namedWeightIDs")->setComment("set of LHA weight IDs for named LHE weights");
1169  desc.add<std::vector<std::string>>("namedWeightLabels")
1170  ->setComment("output names for the namedWeightIDs (in the same order)");
1171  desc.add<int32_t>("lheWeightPrecision")->setComment("Number of bits in the mantissa for LHE weights");
1172  desc.add<uint32_t>("maxPdfWeights")->setComment("Maximum number of PDF weights to save (to crop NN replicas)");
1173  desc.add<bool>("keepAllPSWeights")->setComment("Store all PS weights found");
1174  desc.addOptionalUntracked<bool>("debug")->setComment("dump out all LHE information for one event");
1175  descriptions.add("genWeightsTable", desc);
1176  }
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 439 of file GenWeightsTableProducer.cc.

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

Referenced by produce().

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

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

Referenced by produce().

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

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

Referenced by produce().

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

◆ globalBeginLuminosityBlock()

std::shared_ptr<DynamicWeightChoiceGenInfo> GenWeightsTableProducer::globalBeginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &   
) const
inlineoverride

Definition at line 944 of file GenWeightsTableProducer.cc.

References newFWLiteAna::found, genLumiInfoHeadTag_, edm::LuminosityBlock::getByToken(), watchdog::group, mps_fire::i, keepAllPSWeights_, genWeightsTable_cfi::lhaid, lhaNameToID_, mps_splice::line, maxPdfWeights_, jetUpdater_cfi::sort, and x.

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

◆ globalBeginRun()

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

Definition at line 543 of file GenWeightsTableProducer.cc.

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

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

1082  {
1083  return std::make_shared<CounterMap>();
1084  }

◆ globalEndLuminosityBlock()

void GenWeightsTableProducer::globalEndLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) const
inlineoverride

Definition at line 1064 of file GenWeightsTableProducer.cc.

1064 {}

◆ globalEndRun()

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

Definition at line 1151 of file GenWeightsTableProducer.cc.

1151 {}

◆ globalEndRunProduce()

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

Definition at line 1095 of file GenWeightsTableProducer.cc.

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

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

1093 {}

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 291 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.

291  {
292  // get my counter for weights
293  Counter* counter = streamCache(id)->countermap.get();
294 
295  // generator information (always available)
297  iEvent.getByToken(genTag_, genInfo);
298  double weight = genInfo->weight();
299 
300  // table for gen info, always available
301  auto out = std::make_unique<nanoaod::FlatTable>(1, "genWeight", true);
302  out->setDoc("generator weight");
303  out->addColumnValue<float>("", weight, "generator weight");
304  iEvent.put(std::move(out));
305 
306  std::string model_label = streamCache(id)->countermap.getLabel();
307  auto outM = std::make_unique<std::string>((!model_label.empty()) ? std::string("GenModel_") + model_label : "");
308  iEvent.put(std::move(outM), "genModel");
309  bool getLHEweightsFromGenInfo = !model_label.empty();
310 
311  // tables for LHE weights, may not be filled
312  std::unique_ptr<nanoaod::FlatTable> lheScaleTab, lhePdfTab, lheRwgtTab, lheNamedTab;
313  std::unique_ptr<nanoaod::FlatTable> genPSTab;
314 
316  for (const auto& lheTag : lheTag_) {
317  iEvent.getByToken(lheTag, lheInfo);
318  if (lheInfo.isValid()) {
319  break;
320  }
321  }
322 
323  const auto genWeightChoice = luminosityBlockCache(iEvent.getLuminosityBlock().index());
324  if (lheInfo.isValid()) {
325  if (getLHEweightsFromGenInfo && !hasIssuedWarning_.exchange(true))
326  edm::LogWarning("LHETablesProducer")
327  << "Found both a LHEEventProduct and a GenLumiInfoHeader: will only save weights from LHEEventProduct.\n";
328  // get the dynamic choice of weights
329  const DynamicWeightChoice* weightChoice = runCache(iEvent.getRun().index());
330  // go fill tables
332  weightChoice,
333  genWeightChoice,
334  weight,
335  *lheInfo,
336  *genInfo,
337  lheScaleTab,
338  lhePdfTab,
339  lheRwgtTab,
340  lheNamedTab,
341  genPSTab);
342  } else if (getLHEweightsFromGenInfo) {
344  counter, genWeightChoice, weight, *genInfo, lheScaleTab, lhePdfTab, lheNamedTab, genPSTab);
345  lheRwgtTab = std::make_unique<nanoaod::FlatTable>(1, "LHEReweightingWeights", true);
346  //lheNamedTab.reset(new nanoaod::FlatTable(1, "LHENamedWeights", true));
347  //genPSTab.reset(new nanoaod::FlatTable(1, "PSWeight", true));
348  } else {
349  // Still try to add the PS weights
350  fillOnlyPSWeightTable(counter, genWeightChoice, weight, *genInfo, genPSTab);
351  // make dummy values
352  lheScaleTab = std::make_unique<nanoaod::FlatTable>(1, "LHEScaleWeights", true);
353  lhePdfTab = std::make_unique<nanoaod::FlatTable>(1, "LHEPdfWeights", true);
354  lheRwgtTab = std::make_unique<nanoaod::FlatTable>(1, "LHEReweightingWeights", true);
355  lheNamedTab = std::make_unique<nanoaod::FlatTable>(1, "LHENamedWeights", true);
356  if (!hasIssuedWarning_.exchange(true)) {
357  edm::LogWarning("LHETablesProducer") << "No LHEEventProduct, so there will be no LHE Tables\n";
358  }
359  }
360 
361  iEvent.put(std::move(lheScaleTab), "LHEScale");
362  iEvent.put(std::move(lhePdfTab), "LHEPdf");
363  iEvent.put(std::move(lheRwgtTab), "LHEReweighting");
364  iEvent.put(std::move(lheNamedTab), "LHENamed");
365  iEvent.put(std::move(genPSTab), "PS");
366  }
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 497 of file GenWeightsTableProducer.cc.

References mps_fire::i, keepAllPSWeights_, and psWeightWarning_.

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

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

◆ streamBeginLuminosityBlock()

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

Definition at line 1066 of file GenWeightsTableProducer.cc.

References GenLumiInfoHeader::configDescription(), genLumiInfoHeadTag_, edm::LuminosityBlock::getByToken(), edm::HandleBase::isValid(), label, and AlCaHLTBitMon_QueryRunRegistry::string.

1068  {
1069  auto counterMap = &(streamCache(id)->countermap);
1070  edm::Handle<GenLumiInfoHeader> genLumiInfoHead;
1071  lumiBlock.getByToken(genLumiInfoHeadTag_, genLumiInfoHead);
1072 
1074  if (genLumiInfoHead.isValid()) {
1075  label = genLumiInfoHead->configDescription();
1076  boost::replace_all(label, "-", "_");
1077  boost::replace_all(label, "/", "_");
1078  }
1079  counterMap->setLabel(label);
1080  }
const std::string & configDescription() 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 940 of file GenWeightsTableProducer.cc.

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

◆ streamEndRunSummary()

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

Definition at line 1086 of file GenWeightsTableProducer.cc.

1089  {
1090  runCounterMap->merge(streamCache(id)->countermap);
1091  }

Member Data Documentation

◆ debug_

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

Definition at line 1193 of file GenWeightsTableProducer.cc.

Referenced by fillLHEWeightTables().

◆ debugRun_

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

Definition at line 1193 of file GenWeightsTableProducer.cc.

Referenced by globalBeginRun().

◆ genLumiInfoHeadTag_

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

◆ genTag_

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

Definition at line 1179 of file GenWeightsTableProducer.cc.

Referenced by produce().

◆ hasIssuedWarning_

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

Definition at line 1193 of file GenWeightsTableProducer.cc.

Referenced by produce().

◆ keepAllPSWeights_

bool GenWeightsTableProducer::keepAllPSWeights_
protected

Definition at line 1191 of file GenWeightsTableProducer.cc.

Referenced by globalBeginLuminosityBlock(), and setPSWeightInfo().

◆ lhaNameToID_

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

Definition at line 1186 of file GenWeightsTableProducer.cc.

Referenced by globalBeginLuminosityBlock(), and globalBeginRun().

◆ lheLabel_

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

Definition at line 1180 of file GenWeightsTableProducer.cc.

Referenced by globalBeginRun().

◆ lheRunTag_

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

Definition at line 1182 of file GenWeightsTableProducer.cc.

◆ lheTag_

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

Definition at line 1181 of file GenWeightsTableProducer.cc.

Referenced by produce().

◆ lheWeightPrecision_

int GenWeightsTableProducer::lheWeightPrecision_
protected

◆ maxPdfWeights_

unsigned int GenWeightsTableProducer::maxPdfWeights_
protected

Definition at line 1190 of file GenWeightsTableProducer.cc.

Referenced by globalBeginLuminosityBlock(), and globalBeginRun().

◆ namedWeightIDs_

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

Definition at line 1187 of file GenWeightsTableProducer.cc.

Referenced by fillLHEWeightTables().

◆ namedWeightLabels_

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

Definition at line 1188 of file GenWeightsTableProducer.cc.

Referenced by fillLHEWeightTables(), and globalEndRunProduce().

◆ preferredPDFLHAIDs_

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

Definition at line 1185 of file GenWeightsTableProducer.cc.

Referenced by globalBeginRun().

◆ psWeightWarning_

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

Definition at line 1193 of file GenWeightsTableProducer.cc.

Referenced by setPSWeightInfo().