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::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 TTbar_GenJetAnalyzer (const edm::ParameterSet &)
 
 ~TTbar_GenJetAnalyzer ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

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

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

Definition at line 15 of file TTbar_GenJetAnalyzer.cc.

15 {}

Member Function Documentation

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

Definition at line 18 of file TTbar_GenJetAnalyzer.cc.

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

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

Implements DQMEDAnalyzer.

Definition at line 59 of file TTbar_GenJetAnalyzer.cc.

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

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

Member Data Documentation

edm::InputTag TTbar_GenJetAnalyzer::genEventInfoProductTag_
private

Definition at line 68 of file TTbar_GenJetAnalyzer.h.

Referenced by TTbar_GenJetAnalyzer().

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

Definition at line 73 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and TTbar_GenJetAnalyzer().

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

Definition at line 69 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and bookHistograms().

edm::InputTag TTbar_GenJetAnalyzer::jets_
private

Definition at line 67 of file TTbar_GenJetAnalyzer.h.

Referenced by TTbar_GenJetAnalyzer().

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

Definition at line 74 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and TTbar_GenJetAnalyzer().

double TTbar_GenJetAnalyzer::weight
private

Definition at line 71 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze().