CMS 3D CMS Logo

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

#include <TTbar_GenJetAnalyzer.h>

Inheritance diagram for TTbar_GenJetAnalyzer:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > 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 &i, edm::Run const &, edm::EventSetup const &) override
 
 TTbar_GenJetAnalyzer (const edm::ParameterSet &)
 
 ~TTbar_GenJetAnalyzer () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
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::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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)
 
 ~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
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::InputTag genEventInfoProductTag_
 
edm::EDGetTokenT< GenEventInfoProductgenEventInfoProductTagToken_
 
std::map< std::string, MonitorElement * > hists_
 
edm::InputTag jets_
 
edm::EDGetTokenT< std::vector< reco::GenJet > > jetsToken_
 
double weight
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
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
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
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 52 of file TTbar_GenJetAnalyzer.h.

Constructor & Destructor Documentation

TTbar_GenJetAnalyzer::TTbar_GenJetAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 4 of file TTbar_GenJetAnalyzer.cc.

References genEventInfoProductTag_, genEventInfoProductTagToken_, jets_, and jetsToken_.

5  : jets_(iConfig.getParameter<edm::InputTag>("jets")),
6  genEventInfoProductTag_(iConfig.getParameter<edm::InputTag>("genEventInfoProductTag")) {
7  genEventInfoProductTagToken_ = consumes<GenEventInfoProduct>(genEventInfoProductTag_);
8  jetsToken_ = consumes<std::vector<reco::GenJet> >(jets_);
9 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< reco::GenJet > > jetsToken_
edm::InputTag genEventInfoProductTag_
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
TTbar_GenJetAnalyzer::~TTbar_GenJetAnalyzer ( )
override

Definition at line 11 of file TTbar_GenJetAnalyzer.cc.

11 {}

Member Function Documentation

void TTbar_GenJetAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 13 of file TTbar_GenJetAnalyzer.cc.

References genEventInfoProductTagToken_, edm::Event::getByToken(), hists_, edm::HandleBase::isValid(), singleTopDQM_cfi::jets, jetsToken_, BTaggingMonitoring_cff::njets, GenEventInfoProduct::weight(), and weight.

13  {
14  using namespace edm;
15 
16  // --- the MC weights ---
18  iEvent.getByToken(genEventInfoProductTagToken_, evt_info);
19  if (!evt_info.isValid())
20  return;
21  weight = evt_info->weight();
22 
23  // Gather information in the GenJet collection
25  iEvent.getByToken(jetsToken_, jets);
26 
27  if (!jets.isValid())
28  return;
29  // loop Jet collection and fill histograms
30  int njets = 0;
31  for (std::vector<reco::GenJet>::const_iterator jet_it = jets->begin(); jet_it != jets->end(); ++jet_it) {
32  ++njets;
33 
34  hists_["jetPtAll"]->Fill(jet_it->pt(), weight);
35  hists_["jetEtaAll"]->Fill(jet_it->eta(), weight);
36 
37  if (njets == 1) {
38  hists_["jetPt1"]->Fill(jet_it->pt(), weight);
39  hists_["jetEta1"]->Fill(jet_it->eta(), weight);
40  }
41  if (njets == 2) {
42  hists_["jetPt2"]->Fill(jet_it->pt(), weight);
43  hists_["jetEta2"]->Fill(jet_it->eta(), weight);
44  }
45  if (njets == 3) {
46  hists_["jetPt3"]->Fill(jet_it->pt(), weight);
47  hists_["jetEta3"]->Fill(jet_it->eta(), weight);
48  }
49  if (njets == 4) {
50  hists_["jetPt4"]->Fill(jet_it->pt(), weight);
51  hists_["jetEta4"]->Fill(jet_it->eta(), weight);
52  }
53  }
54 }
edm::EDGetTokenT< std::vector< reco::GenJet > > jetsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
Definition: weight.py:1
double weight() const
std::map< std::string, MonitorElement * > hists_
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
void TTbar_GenJetAnalyzer::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 56 of file TTbar_GenJetAnalyzer.cc.

References DQMHelper::book1dHisto(), hists_, and dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder().

56  {
57  DQMHelper dqm(&i);
58  i.setCurrentFolder("Generator/TTbar");
59  hists_["jetPtAll"] =
60  dqm.book1dHisto("TTbar_jetPtAll", "pt", 1000, 0., 1000., "P_{t}^{All-Jets} (GeV)", "Number of Events");
61  hists_["jetPt1"] =
62  dqm.book1dHisto("TTbar_jetPt1", "pt", 1000, 0., 1000., "P_{t}^{1st-Jet} (GeV)", "Number of Events");
63  hists_["jetPt2"] =
64  dqm.book1dHisto("TTbar_jetPt2", "pt", 1000, 0., 1000., "P_{t}^{2nd-Jet} (GeV)", "Number of Events");
65  hists_["jetPt3"] =
66  dqm.book1dHisto("TTbar_jetPt3", "pt", 1000, 0., 1000., "P_{t}^{3rd-Jet} (GeV)", "Number of Events");
67  hists_["jetPt4"] =
68  dqm.book1dHisto("TTbar_jetPt4", "pt", 1000, 0., 1000., "P_{t}^{4th-Jet} (GeV)", "Number of Events");
69 
70  hists_["jetEtaAll"] = dqm.book1dHisto("TTbar_jetEtaAll", "eta", 100, -5., 5., "#eta^{All-Jets}", "Number of Events");
71  hists_["jetEta1"] = dqm.book1dHisto("TTbar_jetEta1", "eta", 100, -5., 5., "#eta^{1st-Jet}", "Number of Events");
72  hists_["jetEta2"] = dqm.book1dHisto("TTbar_jetEta2", "eta", 100, -5., 5., "#eta^{2nd-Jet}", "Number of Events");
73  hists_["jetEta3"] = dqm.book1dHisto("TTbar_jetEta3", "eta", 100, -5., 5., "#eta^{3rd-Jet}", "Number of Events");
74  hists_["jetEta4"] = dqm.book1dHisto("TTbar_jetEta4", "eta", 100, -5., 5., "#eta^{4th-Jet}", "Number of Events");
75 }
std::map< std::string, MonitorElement * > hists_

Member Data Documentation

edm::InputTag TTbar_GenJetAnalyzer::genEventInfoProductTag_
private

Definition at line 64 of file TTbar_GenJetAnalyzer.h.

Referenced by TTbar_GenJetAnalyzer().

edm::EDGetTokenT<GenEventInfoProduct> TTbar_GenJetAnalyzer::genEventInfoProductTagToken_
private

Definition at line 69 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and TTbar_GenJetAnalyzer().

std::map<std::string, MonitorElement *> TTbar_GenJetAnalyzer::hists_
private

Definition at line 65 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and bookHistograms().

edm::InputTag TTbar_GenJetAnalyzer::jets_
private

Definition at line 63 of file TTbar_GenJetAnalyzer.h.

Referenced by TTbar_GenJetAnalyzer().

edm::EDGetTokenT<std::vector<reco::GenJet> > TTbar_GenJetAnalyzer::jetsToken_
private

Definition at line 70 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and TTbar_GenJetAnalyzer().

double TTbar_GenJetAnalyzer::weight
private

Definition at line 67 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze().