CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
LheWeightValidation Class Reference

#include <LheWeightValidation.h>

Inheritance diagram for LheWeightValidation:
DQMOneEDAnalyzer<> edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
void dqmEndRun (const edm::Run &, const edm::EventSetup &) override
 
 LheWeightValidation (const edm::ParameterSet &)
 
 ~LheWeightValidation () override=default
 
- Public Member Functions inherited from DQMOneEDAnalyzer<>
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () 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)
 

Private Member Functions

void bookTemplates (DQMHelper &aDqmHelper, std::vector< std::unique_ptr< TH1F >> &scaleVar, std::vector< std::unique_ptr< TH1F >> &pdfVar, std::vector< MonitorElement *> &tmps, const std::string &name, const std::string &title, int nbin, float low, float high, const std::string &xtitle, const std::string &ytitle)
 
void envelop (const std::vector< std::unique_ptr< TH1F >> &var, std::vector< MonitorElement *> &tmps)
 
void fillTemplates (std::vector< std::unique_ptr< TH1F >> &scaleVar, std::vector< std::unique_ptr< TH1F >> &pdfVar, std::vector< MonitorElement *> &tmps, float obs)
 
void pdfRMS (const std::vector< std::unique_ptr< TH1F >> &var, std::vector< MonitorElement *> &tmps)
 

Private Attributes

const bool dumpLHEheader_
 
const edm::EDGetTokenT< reco::GenJetCollectiongenJetToken_
 
const edm::EDGetTokenT< reco::GenParticleCollectiongenParticleToken_
 
const int idxPdfEnd_
 
const int idxPdfStart_
 
const double jetEtaCut_
 
std::vector< std::unique_ptr< TH1F > > jetMultPdfVar_
 
std::vector< std::unique_ptr< TH1F > > jetMultScaleVar_
 
std::vector< MonitorElement * > jetMultTemp_
 
const double jetPtCut_
 
const int jetPtNbin_
 
const double jetPtRange_
 
std::vector< std::unique_ptr< TH1F > > leadJetEtaPdfVar_
 
std::vector< std::unique_ptr< TH1F > > leadJetEtaScaleVar_
 
std::vector< MonitorElement * > leadJetEtaTemp_
 
std::vector< std::unique_ptr< TH1F > > leadJetPtPdfVar_
 
std::vector< std::unique_ptr< TH1F > > leadJetPtScaleVar_
 
std::vector< MonitorElement * > leadJetPtTemp_
 
std::vector< std::unique_ptr< TH1F > > leadLepEtaPdfVar_
 
std::vector< std::unique_ptr< TH1F > > leadLepEtaScaleVar_
 
std::vector< MonitorElement * > leadLepEtaTemp_
 
const double leadLepPtCut_
 
const int leadLepPtNbin_
 
std::vector< std::unique_ptr< TH1F > > leadLepPtPdfVar_
 
const double leadLepPtRange_
 
std::vector< std::unique_ptr< TH1F > > leadLepPtScaleVar_
 
std::vector< MonitorElement * > leadLepPtTemp_
 
const double lepEtaCut_
 
const edm::EDGetTokenT< LHEEventProductlheEvtToken_
 
const edm::InputTag lheLabel_
 
const edm::EDGetTokenT< LHERunInfoProductlheRunToken_
 
MonitorElementnEvt_
 
const int nJetsNbin_
 
MonitorElementnlogWgt_
 
const int nPdfVar_
 
const int nScaleVar_
 
double orgWgt_
 
const int rapidityNbin_
 
const double rapidityRange_
 
double weight_
 
std::vector< LHEEventProduct::WGTweights_
 
MonitorElementwgtVal_
 

Additional Inherited Members

- Public Types inherited from DQMOneEDAnalyzer<>
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::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
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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)
 
- Protected Attributes inherited from DQMOneEDAnalyzer<>
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 30 of file LheWeightValidation.h.

Constructor & Destructor Documentation

◆ LheWeightValidation()

LheWeightValidation::LheWeightValidation ( const edm::ParameterSet iPSet)
explicit

Definition at line 8 of file LheWeightValidation.cc.

9  : lheLabel_(iPSet.getParameter<edm::InputTag>("lheProduct")),
10  genParticleToken_(consumes<reco::GenParticleCollection>(iPSet.getParameter<edm::InputTag>("genParticles"))),
11  lheEvtToken_(consumes<LHEEventProduct>(lheLabel_)),
12  lheRunToken_(consumes<LHERunInfoProduct, edm::InRun>(lheLabel_)),
13  genJetToken_(consumes<reco::GenJetCollection>(iPSet.getParameter<edm::InputTag>("genJets"))),
14  dumpLHEheader_(iPSet.getParameter<bool>("dumpLHEheader")),
15  leadLepPtNbin_(iPSet.getParameter<int>("leadLepPtNbin")),
16  rapidityNbin_(iPSet.getParameter<int>("rapidityNbin")),
17  leadLepPtRange_(iPSet.getParameter<double>("leadLepPtRange")),
18  leadLepPtCut_(iPSet.getParameter<double>("leadLepPtCut")),
19  lepEtaCut_(iPSet.getParameter<double>("lepEtaCut")),
20  rapidityRange_(iPSet.getParameter<double>("rapidityRange")),
21  nJetsNbin_(iPSet.getParameter<int>("nJetsNbin")),
22  jetPtNbin_(iPSet.getParameter<int>("jetPtNbin")),
23  jetPtCut_(iPSet.getParameter<double>("jetPtCut")),
24  jetEtaCut_(iPSet.getParameter<double>("jetEtaCut")),
25  jetPtRange_(iPSet.getParameter<double>("jetPtRange")),
26  nScaleVar_(iPSet.getParameter<int>("nScaleVar")),
27  idxPdfStart_(iPSet.getParameter<int>("idxPdfStart")),
28  idxPdfEnd_(iPSet.getParameter<int>("idxPdfEnd")),
const edm::InputTag lheLabel_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
const edm::EDGetTokenT< LHEEventProduct > lheEvtToken_
const double leadLepPtRange_
const edm::EDGetTokenT< reco::GenJetCollection > genJetToken_
const edm::EDGetTokenT< LHERunInfoProduct > lheRunToken_

◆ ~LheWeightValidation()

LheWeightValidation::~LheWeightValidation ( )
overridedefault

Member Function Documentation

◆ analyze()

void LheWeightValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from DQMOneEDAnalyzer<>.

Definition at line 164 of file LheWeightValidation.cc.

References funct::abs(), dqm::impl::MonitorElement::Fill(), fillTemplates(), genJetToken_, genParticleToken_, heavyIonCSV_trainingSettings::idx, iEvent, edm::EDGetTokenT< T >::isUninitialized(), edm::HandleBase::isValid(), jetEtaCut_, jetMultPdfVar_, jetMultScaleVar_, jetMultTemp_, jetPtCut_, leadJetEtaPdfVar_, leadJetEtaScaleVar_, leadJetEtaTemp_, leadJetPtPdfVar_, leadJetPtScaleVar_, leadJetPtTemp_, leadLepEtaPdfVar_, leadLepEtaScaleVar_, leadLepEtaTemp_, leadLepPtCut_, leadLepPtPdfVar_, leadLepPtScaleVar_, leadLepPtTemp_, lepEtaCut_, HLT_2023v12_cff::leptons, lheEvtToken_, nEvt_, nlogWgt_, orgWgt_, LHEEventProduct::originalXWGTUP(), jetUpdater_cfi::sort, weight_, LHEEventProduct::weights(), weights_, and wgtVal_.

164  {
166 
168  iEvent.getByToken(lheEvtToken_, lheEvt);
169 
170  if (!lheEvt.isValid())
171  return; // do nothing if there is no LHE product
172 
173  orgWgt_ = lheEvt->originalXWGTUP();
175  weights_ = lheEvt->weights();
176 
177  nEvt_->Fill(0.5, weight_);
178  nlogWgt_->Fill(std::log10(lheEvt->weights().size()), weight_);
179 
180  for (unsigned idx = 0; idx < lheEvt->weights().size(); idx++)
181  wgtVal_->Fill(weights_[idx].wgt / orgWgt_);
182 
184  iEvent.getByToken(genParticleToken_, ptcls);
186  iEvent.getByToken(genJetToken_, genjets);
187 
188  std::vector<reco::GenParticleRef> leptons;
189 
190  for (unsigned iptc = 0; iptc < ptcls->size(); iptc++) {
191  reco::GenParticleRef ptc(ptcls, iptc);
192  if (ptc->status() == 1 && (std::abs(ptc->pdgId()) == 11 || std::abs(ptc->pdgId()) == 13)) {
193  if (ptc->pt() > leadLepPtCut_ && std::abs(ptc->eta()) < lepEtaCut_)
194  leptons.push_back(ptc);
195  }
196  }
197 
198  std::sort(leptons.begin(), leptons.end(), HepMCValidationHelper::sortByPtRef<reco::GenParticleRef>);
199 
200  if (!leptons.empty()) {
201  reco::GenParticleRef leadLep = leptons.at(0);
204  }
205 
206  std::vector<reco::GenJetRef> genjetVec;
207 
208  for (unsigned igj = 0; igj < genjets->size(); igj++) {
209  reco::GenJetRef genjet(genjets, igj);
210 
211  if (genjet->pt() > jetPtCut_ && std::abs(genjet->eta()) < jetEtaCut_)
212  genjetVec.push_back(genjet);
213  }
214 
215  fillTemplates(jetMultScaleVar_, jetMultPdfVar_, jetMultTemp_, (float)genjetVec.size());
216 
217  if (!genjetVec.empty()) {
218  std::sort(genjetVec.begin(), genjetVec.end(), HepMCValidationHelper::sortByPtRef<reco::GenJetRef>);
219 
220  auto leadJet = genjetVec.at(0);
223  }
224 } //analyze
std::vector< MonitorElement * > leadLepPtTemp_
MonitorElement * wgtVal_
std::vector< LHEEventProduct::WGT > weights_
std::vector< MonitorElement * > leadJetPtTemp_
std::vector< std::unique_ptr< TH1F > > leadLepEtaScaleVar_
double originalXWGTUP() const
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:104
std::vector< std::unique_ptr< TH1F > > jetMultScaleVar_
void fillTemplates(std::vector< std::unique_ptr< TH1F >> &scaleVar, std::vector< std::unique_ptr< TH1F >> &pdfVar, std::vector< MonitorElement *> &tmps, float obs)
std::vector< std::unique_ptr< TH1F > > leadJetPtScaleVar_
std::vector< std::unique_ptr< TH1F > > leadJetEtaPdfVar_
std::vector< std::unique_ptr< TH1F > > leadLepPtScaleVar_
std::vector< std::unique_ptr< TH1F > > jetMultPdfVar_
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
MonitorElement * nlogWgt_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< MonitorElement * > jetMultTemp_
const edm::EDGetTokenT< LHEEventProduct > lheEvtToken_
MonitorElement * nEvt_
std::vector< MonitorElement * > leadLepEtaTemp_
bool isValid() const
Definition: HandleBase.h:70
std::vector< std::unique_ptr< TH1F > > leadLepEtaPdfVar_
const edm::EDGetTokenT< reco::GenJetCollection > genJetToken_
std::vector< std::unique_ptr< TH1F > > leadJetEtaScaleVar_
std::vector< std::unique_ptr< TH1F > > leadJetPtPdfVar_
const std::vector< WGT > & weights() const
std::vector< MonitorElement * > leadJetEtaTemp_
std::vector< std::unique_ptr< TH1F > > leadLepPtPdfVar_

◆ bookHistograms()

void LheWeightValidation::bookHistograms ( DQMStore::IBooker iBook,
edm::Run const &  iRun,
edm::EventSetup const &   
)
overridevirtual

Setting the DQM top directories

Implements DQMOneEDAnalyzer<>.

Definition at line 31 of file LheWeightValidation.cc.

References DQMHelper::book1dHisto(), bookTemplates(), ctppsRandomDQMSource_cfi::folderName, edm::Run::getByLabel(), jetMultPdfVar_, jetMultScaleVar_, jetMultTemp_, jetPtNbin_, jetPtRange_, leadJetEtaPdfVar_, leadJetEtaScaleVar_, leadJetEtaTemp_, leadJetPtPdfVar_, leadJetPtScaleVar_, leadJetPtTemp_, leadLepEtaPdfVar_, leadLepEtaScaleVar_, leadLepEtaTemp_, leadLepPtNbin_, leadLepPtPdfVar_, leadLepPtRange_, leadLepPtScaleVar_, leadLepPtTemp_, genWeightsTable_cfi::lheInfo, lheLabel_, nEvt_, nJetsNbin_, nlogWgt_, rapidityNbin_, rapidityRange_, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and wgtVal_.

31  {
32  // check LHE product exists
34  // getByToken throws an exception unless we're in the endRun (see https://github.com/cms-sw/cmssw/pull/18499)
35  iRun.getByLabel(lheLabel_, lheInfo);
36 
37  if (!lheInfo.isValid())
38  return;
39 
41  std::string folderName = "Generator/LHEWeight";
42  DQMHelper aDqmHelper(&iBook);
44 
45  // Number of analyzed events
46  nEvt_ = aDqmHelper.book1dHisto("nEvt", "n analyzed Events", 1, 0., 1., "bin", "Number of Events");
47  nlogWgt_ = aDqmHelper.book1dHisto("nlogWgt", "Log10(n weights)", 100, 0., 5., "log_{10}(nWgts)", "Number of Events");
48  wgtVal_ = aDqmHelper.book1dHisto("wgtVal", "weights", 100, -1.5, 3., "weight", "Number of Weights");
49 
50  bookTemplates(aDqmHelper,
54  "leadLepPt",
55  "leading lepton Pt",
57  0.,
59  "Pt_{l} (GeV)",
60  "Number of Events");
61  bookTemplates(aDqmHelper,
65  "leadLepEta",
66  "leading lepton #eta",
70  "#eta_{l}",
71  "Number of Events");
72  bookTemplates(aDqmHelper,
76  "JetMultiplicity",
77  "Gen jet multiplicity",
78  nJetsNbin_,
79  0,
80  nJetsNbin_,
81  "n",
82  "Number of Events");
83  bookTemplates(aDqmHelper,
87  "leadJetPt",
88  "leading Gen jet Pt",
89  jetPtNbin_,
90  0.,
92  "Pt_{j} (GeV)",
93  "Number of Events");
94  bookTemplates(aDqmHelper,
98  "leadJetEta",
99  "leading Gen jet #eta",
103  "#eta_{j}",
104  "Number of Events");
105 
106  return;
107 }
const edm::InputTag lheLabel_
std::vector< MonitorElement * > leadLepPtTemp_
MonitorElement * wgtVal_
std::vector< MonitorElement * > leadJetPtTemp_
std::vector< std::unique_ptr< TH1F > > leadLepEtaScaleVar_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< std::unique_ptr< TH1F > > jetMultScaleVar_
std::vector< std::unique_ptr< TH1F > > leadJetPtScaleVar_
std::vector< std::unique_ptr< TH1F > > leadJetEtaPdfVar_
std::vector< std::unique_ptr< TH1F > > leadLepPtScaleVar_
std::vector< std::unique_ptr< TH1F > > jetMultPdfVar_
MonitorElement * nlogWgt_
void bookTemplates(DQMHelper &aDqmHelper, std::vector< std::unique_ptr< TH1F >> &scaleVar, std::vector< std::unique_ptr< TH1F >> &pdfVar, std::vector< MonitorElement *> &tmps, const std::string &name, const std::string &title, int nbin, float low, float high, const std::string &xtitle, const std::string &ytitle)
std::vector< MonitorElement * > jetMultTemp_
MonitorElement * nEvt_
std::vector< MonitorElement * > leadLepEtaTemp_
const double leadLepPtRange_
std::vector< std::unique_ptr< TH1F > > leadLepEtaPdfVar_
std::vector< std::unique_ptr< TH1F > > leadJetEtaScaleVar_
std::vector< std::unique_ptr< TH1F > > leadJetPtPdfVar_
std::vector< MonitorElement * > leadJetEtaTemp_
std::vector< std::unique_ptr< TH1F > > leadLepPtPdfVar_

◆ bookTemplates()

void LheWeightValidation::bookTemplates ( DQMHelper aDqmHelper,
std::vector< std::unique_ptr< TH1F >> &  scaleVar,
std::vector< std::unique_ptr< TH1F >> &  pdfVar,
std::vector< MonitorElement *> &  tmps,
const std::string &  name,
const std::string &  title,
int  nbin,
float  low,
float  high,
const std::string &  xtitle,
const std::string &  ytitle 
)
private

Definition at line 109 of file LheWeightValidation.cc.

References DQMHelper::book1dHisto(), LaserClient_cfi::high, heavyIonCSV_trainingSettings::idx, LaserClient_cfi::low, Skims_PA_cff::name, nPdfVar_, nScaleVar_, AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, cond::impl::to_string(), compareTotals::xtitle, and compareTotals::ytitle.

Referenced by bookHistograms().

119  {
120  tmps.push_back(aDqmHelper.book1dHisto(name, title, nbin, low, high, xtitle, ytitle));
121  tmps.push_back(aDqmHelper.book1dHisto(name + "ScaleUp", title + " scale up", nbin, low, high, xtitle, ytitle));
122  tmps.at(1)->getTH1()->Sumw2(false);
123  tmps.push_back(aDqmHelper.book1dHisto(name + "ScaleDn", title + " scale down", nbin, low, high, xtitle, ytitle));
124  tmps.at(2)->getTH1()->Sumw2(false);
125  tmps.push_back(aDqmHelper.book1dHisto(
126  name + "ScaleUp_ratio", "Ratio of " + title + " scale upper envelop / Nominal", nbin, low, high, xtitle, ytitle));
127  tmps.at(3)->setEfficiencyFlag();
128  tmps.push_back(aDqmHelper.book1dHisto(
129  name + "ScaleDn_ratio", "Ratio of " + title + " scale lower envelop / Nominal", nbin, low, high, xtitle, ytitle));
130  tmps.at(4)->setEfficiencyFlag();
131  tmps.push_back(aDqmHelper.book1dHisto(name + "PdfUp", title + " PDF upper RMS", nbin, low, high, xtitle, ytitle));
132  tmps.at(5)->getTH1()->Sumw2(false);
133  tmps.push_back(aDqmHelper.book1dHisto(name + "PdfDn", title + " PDF lower RMS", nbin, low, high, xtitle, ytitle));
134  tmps.at(6)->getTH1()->Sumw2(false);
135  tmps.push_back(aDqmHelper.book1dHisto(
136  name + "PdfUp_ratio", "Ratio of " + title + " PDF upper RMS / Nominal", nbin, low, high, xtitle, ytitle));
137  tmps.at(7)->setEfficiencyFlag();
138  tmps.push_back(aDqmHelper.book1dHisto(
139  name + "PdfDn_ratio", "Ratio of " + title + " PDF lower RMS / Nominal", nbin, low, high, xtitle, ytitle));
140  tmps.at(8)->setEfficiencyFlag();
141 
142  for (int idx = 0; idx < nScaleVar_; idx++) {
143  scaleVar.push_back(
144  std::make_unique<TH1F>(std::string(name + "Scale" + std::to_string(idx)).c_str(),
145  std::string(";" + std::string(xtitle) + ";" + std::string(ytitle)).c_str(),
146  nbin,
147  low,
148  high));
149  scaleVar.at(idx)->Sumw2();
150  }
151 
152  for (int idx = 0; idx < nPdfVar_; idx++) {
153  pdfVar.push_back(std::make_unique<TH1F>(std::string(name + "Pdf" + std::to_string(idx)).c_str(),
154  std::string(";" + std::string(xtitle) + ";" + std::string(ytitle)).c_str(),
155  nbin,
156  low,
157  high));
158  pdfVar.at(idx)->Sumw2();
159  }
160 } // to get ratio plots correctly - need to modify PostProcessor_cff.py as well!
std::string to_string(const V &value)
Definition: OMSAccess.h:71
MonitorElement * book1dHisto(const std::string &name, const std::string &title, int n, double xmin, double xmax, const std::string &xaxis, const std::string &yaxis)
Definition: DQMHelper.cc:7

◆ dqmBeginRun()

void LheWeightValidation::dqmBeginRun ( const edm::Run ,
const edm::EventSetup  
)
overridevirtual

Reimplemented from DQMOneEDAnalyzer<>.

Definition at line 162 of file LheWeightValidation.cc.

162 {}

◆ dqmEndRun()

void LheWeightValidation::dqmEndRun ( const edm::Run iRun,
const edm::EventSetup  
)
overridevirtual

Reimplemented from DQMOneEDAnalyzer<>.

Definition at line 243 of file LheWeightValidation.cc.

References gather_cfg::cout, dumpLHEheader_, envelop(), edm::Run::getByToken(), edm::EDGetTokenT< T >::isUninitialized(), jetMultPdfVar_, jetMultScaleVar_, jetMultTemp_, MainPageGenerator::l, leadJetEtaPdfVar_, leadJetEtaScaleVar_, leadJetEtaTemp_, leadJetPtPdfVar_, leadJetPtScaleVar_, leadJetPtTemp_, leadLepEtaPdfVar_, leadLepEtaScaleVar_, leadLepEtaTemp_, leadLepPtPdfVar_, leadLepPtScaleVar_, leadLepPtTemp_, genWeightsTable_cfi::lheInfo, lheRunToken_, and pdfRMS().

243  {
245  return;
246 
249 
250  if (!lheInfo.isValid())
251  return;
252 
263 
264  if (dumpLHEheader_) {
265  for (auto it = lheInfo->headers_begin(); it != lheInfo->headers_end(); it++) {
266  std::cout << "Header start" << std::endl;
267  std::cout << "Tag: " << it->tag() << std::endl;
268  for (const auto& l : it->lines()) {
269  std::cout << l << std::endl;
270  }
271  std::cout << "Header end" << std::endl;
272  }
273  }
274 }
void envelop(const std::vector< std::unique_ptr< TH1F >> &var, std::vector< MonitorElement *> &tmps)
void pdfRMS(const std::vector< std::unique_ptr< TH1F >> &var, std::vector< MonitorElement *> &tmps)
std::vector< MonitorElement * > leadLepPtTemp_
std::vector< MonitorElement * > leadJetPtTemp_
std::vector< std::unique_ptr< TH1F > > leadLepEtaScaleVar_
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:104
std::vector< std::unique_ptr< TH1F > > jetMultScaleVar_
std::vector< std::unique_ptr< TH1F > > leadJetPtScaleVar_
std::vector< std::unique_ptr< TH1F > > leadJetEtaPdfVar_
std::vector< std::unique_ptr< TH1F > > leadLepPtScaleVar_
std::vector< std::unique_ptr< TH1F > > jetMultPdfVar_
std::vector< MonitorElement * > jetMultTemp_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Run.h:318
std::vector< MonitorElement * > leadLepEtaTemp_
std::vector< std::unique_ptr< TH1F > > leadLepEtaPdfVar_
const edm::EDGetTokenT< LHERunInfoProduct > lheRunToken_
std::vector< std::unique_ptr< TH1F > > leadJetEtaScaleVar_
std::vector< std::unique_ptr< TH1F > > leadJetPtPdfVar_
std::vector< MonitorElement * > leadJetEtaTemp_
std::vector< std::unique_ptr< TH1F > > leadLepPtPdfVar_

◆ envelop()

void LheWeightValidation::envelop ( const std::vector< std::unique_ptr< TH1F >> &  var,
std::vector< MonitorElement *> &  tmps 
)
private

Definition at line 276 of file LheWeightValidation.cc.

References b, SiStripPI::max, SiStripPI::min, findQualityFiles::v, and trigObjTnPSource_cfi::var.

Referenced by dqmEndRun().

276  {
277  if (var.empty())
278  return;
279 
280  for (int b = 0; b < var.at(0)->GetNbinsX() + 2; b++) {
281  float valU = var.at(0)->GetBinContent(b);
282  float valD = valU;
283 
284  if (valU == 0.)
285  continue;
286 
287  for (unsigned v = 1; v < var.size(); v++) {
288  if (var.at(v)->GetEntries() == 0.)
289  continue;
290 
291  valU = std::max(valU, (float)var.at(v)->GetBinContent(b));
292  valD = std::min(valD, (float)var.at(v)->GetBinContent(b));
293  }
294  tmps.at(1)->setBinContent(b, valU);
295  tmps.at(2)->setBinContent(b, valD);
296  }
297 
298  tmps.at(1)->setEntries(var.at(0)->GetEntries());
299  tmps.at(2)->setEntries(var.at(0)->GetEntries());
300  tmps.at(1)->getTH1()->Sumw2(true);
301  tmps.at(2)->getTH1()->Sumw2(true);
302 
303  return;
304 }
double b
Definition: hdecay.h:118

◆ fillTemplates()

void LheWeightValidation::fillTemplates ( std::vector< std::unique_ptr< TH1F >> &  scaleVar,
std::vector< std::unique_ptr< TH1F >> &  pdfVar,
std::vector< MonitorElement *> &  tmps,
float  obs 
)
private

Definition at line 226 of file LheWeightValidation.cc.

References idxPdfEnd_, idxPdfStart_, nPdfVar_, nScaleVar_, orgWgt_, weight_, and weights_.

Referenced by analyze().

229  {
230  tmps.at(0)->Fill(obs, weight_);
231 
232  if (static_cast<int>(weights_.size()) >= nScaleVar_) {
233  for (int iWgt = 0; iWgt < nScaleVar_; iWgt++)
234  scaleVar.at(iWgt)->Fill(obs, weights_[iWgt].wgt / orgWgt_);
235  }
236 
237  if (static_cast<int>(weights_.size()) >= idxPdfEnd_) {
238  for (int iWgt = 0; iWgt < nPdfVar_; iWgt++)
239  pdfVar.at(iWgt)->Fill(obs, weights_[idxPdfStart_ + iWgt].wgt / orgWgt_);
240  }
241 }
std::vector< LHEEventProduct::WGT > weights_

◆ pdfRMS()

void LheWeightValidation::pdfRMS ( const std::vector< std::unique_ptr< TH1F >> &  var,
std::vector< MonitorElement *> &  tmps 
)
private

Definition at line 306 of file LheWeightValidation.cc.

References b, makePileupJSON::denom, dqmMemoryStats::float, SiStripPI::rms, mathSSE::sqrt(), findQualityFiles::v, and trigObjTnPSource_cfi::var.

Referenced by dqmEndRun().

306  {
307  if (var.empty())
308  return;
309 
310  float denom = var.size();
311  for (int b = 0; b < tmps.at(0)->getNbinsX() + 2; b++) {
312  float valNom = tmps.at(0)->getBinContent(b);
313  float rmsSq = 0.;
314  if (valNom == 0.)
315  continue;
316 
317  for (unsigned v = 0; v < var.size(); v++) {
318  if (var.at(v)->GetEntries() == 0.)
319  continue;
320 
321  float dev = (float)var.at(v)->GetBinContent(b) - valNom;
322  rmsSq += dev * dev;
323  }
324 
325  float rms = std::sqrt(rmsSq / denom);
326  float rmsup = valNom + rms;
327  float rmsdn = valNom - rms;
328  tmps.at(5)->setBinContent(b, rmsup);
329  tmps.at(6)->setBinContent(b, rmsdn);
330  }
331 
332  tmps.at(5)->setEntries(tmps.at(0)->getTH1F()->GetEntries());
333  tmps.at(6)->setEntries(tmps.at(0)->getTH1F()->GetEntries());
334  tmps.at(5)->getTH1()->Sumw2(true);
335  tmps.at(6)->getTH1()->Sumw2(true);
336 
337  return;
338 }
T sqrt(T t)
Definition: SSEVec.h:19
double b
Definition: hdecay.h:118

Member Data Documentation

◆ dumpLHEheader_

const bool LheWeightValidation::dumpLHEheader_
private

Definition at line 89 of file LheWeightValidation.h.

Referenced by dqmEndRun().

◆ genJetToken_

const edm::EDGetTokenT<reco::GenJetCollection> LheWeightValidation::genJetToken_
private

Definition at line 87 of file LheWeightValidation.h.

Referenced by analyze().

◆ genParticleToken_

const edm::EDGetTokenT<reco::GenParticleCollection> LheWeightValidation::genParticleToken_
private

Definition at line 84 of file LheWeightValidation.h.

Referenced by analyze().

◆ idxPdfEnd_

const int LheWeightValidation::idxPdfEnd_
private

Definition at line 96 of file LheWeightValidation.h.

Referenced by fillTemplates().

◆ idxPdfStart_

const int LheWeightValidation::idxPdfStart_
private

Definition at line 96 of file LheWeightValidation.h.

Referenced by fillTemplates().

◆ jetEtaCut_

const double LheWeightValidation::jetEtaCut_
private

Definition at line 93 of file LheWeightValidation.h.

Referenced by analyze().

◆ jetMultPdfVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::jetMultPdfVar_
private

Definition at line 77 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ jetMultScaleVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::jetMultScaleVar_
private

Definition at line 76 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ jetMultTemp_

std::vector<MonitorElement*> LheWeightValidation::jetMultTemp_
private

Definition at line 68 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ jetPtCut_

const double LheWeightValidation::jetPtCut_
private

Definition at line 93 of file LheWeightValidation.h.

Referenced by analyze().

◆ jetPtNbin_

const int LheWeightValidation::jetPtNbin_
private

Definition at line 92 of file LheWeightValidation.h.

Referenced by bookHistograms().

◆ jetPtRange_

const double LheWeightValidation::jetPtRange_
private

Definition at line 93 of file LheWeightValidation.h.

Referenced by bookHistograms().

◆ leadJetEtaPdfVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::leadJetEtaPdfVar_
private

Definition at line 81 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadJetEtaScaleVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::leadJetEtaScaleVar_
private

Definition at line 80 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadJetEtaTemp_

std::vector<MonitorElement*> LheWeightValidation::leadJetEtaTemp_
private

Definition at line 70 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadJetPtPdfVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::leadJetPtPdfVar_
private

Definition at line 79 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadJetPtScaleVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::leadJetPtScaleVar_
private

Definition at line 78 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadJetPtTemp_

std::vector<MonitorElement*> LheWeightValidation::leadJetPtTemp_
private

Definition at line 69 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadLepEtaPdfVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::leadLepEtaPdfVar_
private

Definition at line 75 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadLepEtaScaleVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::leadLepEtaScaleVar_
private

Definition at line 74 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadLepEtaTemp_

std::vector<MonitorElement*> LheWeightValidation::leadLepEtaTemp_
private

Definition at line 67 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadLepPtCut_

const double LheWeightValidation::leadLepPtCut_
private

Definition at line 91 of file LheWeightValidation.h.

Referenced by analyze().

◆ leadLepPtNbin_

const int LheWeightValidation::leadLepPtNbin_
private

Definition at line 90 of file LheWeightValidation.h.

Referenced by bookHistograms().

◆ leadLepPtPdfVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::leadLepPtPdfVar_
private

Definition at line 73 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadLepPtRange_

const double LheWeightValidation::leadLepPtRange_
private

Definition at line 91 of file LheWeightValidation.h.

Referenced by bookHistograms().

◆ leadLepPtScaleVar_

std::vector<std::unique_ptr<TH1F> > LheWeightValidation::leadLepPtScaleVar_
private

Definition at line 72 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ leadLepPtTemp_

std::vector<MonitorElement*> LheWeightValidation::leadLepPtTemp_
private

Definition at line 66 of file LheWeightValidation.h.

Referenced by analyze(), bookHistograms(), and dqmEndRun().

◆ lepEtaCut_

const double LheWeightValidation::lepEtaCut_
private

Definition at line 91 of file LheWeightValidation.h.

Referenced by analyze().

◆ lheEvtToken_

const edm::EDGetTokenT<LHEEventProduct> LheWeightValidation::lheEvtToken_
private

Definition at line 85 of file LheWeightValidation.h.

Referenced by analyze().

◆ lheLabel_

const edm::InputTag LheWeightValidation::lheLabel_
private

Definition at line 83 of file LheWeightValidation.h.

Referenced by bookHistograms().

◆ lheRunToken_

const edm::EDGetTokenT<LHERunInfoProduct> LheWeightValidation::lheRunToken_
private

Definition at line 86 of file LheWeightValidation.h.

Referenced by dqmEndRun().

◆ nEvt_

MonitorElement* LheWeightValidation::nEvt_
private

Definition at line 63 of file LheWeightValidation.h.

Referenced by analyze(), and bookHistograms().

◆ nJetsNbin_

const int LheWeightValidation::nJetsNbin_
private

Definition at line 92 of file LheWeightValidation.h.

Referenced by bookHistograms().

◆ nlogWgt_

MonitorElement* LheWeightValidation::nlogWgt_
private

Definition at line 64 of file LheWeightValidation.h.

Referenced by analyze(), and bookHistograms().

◆ nPdfVar_

const int LheWeightValidation::nPdfVar_
private

Definition at line 96 of file LheWeightValidation.h.

Referenced by bookTemplates(), and fillTemplates().

◆ nScaleVar_

const int LheWeightValidation::nScaleVar_
private

Definition at line 95 of file LheWeightValidation.h.

Referenced by bookTemplates(), and fillTemplates().

◆ orgWgt_

double LheWeightValidation::orgWgt_
private

Definition at line 60 of file LheWeightValidation.h.

Referenced by analyze(), and fillTemplates().

◆ rapidityNbin_

const int LheWeightValidation::rapidityNbin_
private

Definition at line 90 of file LheWeightValidation.h.

Referenced by bookHistograms().

◆ rapidityRange_

const double LheWeightValidation::rapidityRange_
private

Definition at line 91 of file LheWeightValidation.h.

Referenced by bookHistograms().

◆ weight_

double LheWeightValidation::weight_
private

Definition at line 60 of file LheWeightValidation.h.

Referenced by analyze(), and fillTemplates().

◆ weights_

std::vector<LHEEventProduct::WGT> LheWeightValidation::weights_
private

Definition at line 61 of file LheWeightValidation.h.

Referenced by analyze(), and fillTemplates().

◆ wgtVal_

MonitorElement* LheWeightValidation::wgtVal_
private

Definition at line 65 of file LheWeightValidation.h.

Referenced by analyze(), and bookHistograms().