CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TTbar_GenJetAnalyzer Class Reference

#include <TTbar_GenJetAnalyzer.h>

Inheritance diagram for TTbar_GenJetAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TTbar_GenJetAnalyzer (const edm::ParameterSet &)
 
 ~TTbar_GenJetAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

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

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 

Private Attributes

DQMStoredbe
 ME's "container". More...
 
edm::InputTag genEventInfoProductTag_
 
edm::EDGetTokenT
< GenEventInfoProduct
genEventInfoProductTagToken_
 
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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 56 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 dbe, genEventInfoProductTag_, genEventInfoProductTagToken_, jets_, jetsToken_, and cppFunctionSkipper::operator.

4  :
5  jets_(iConfig.getParameter<edm::InputTag>("jets")),
6  genEventInfoProductTag_(iConfig.getParameter<edm::InputTag>("genEventInfoProductTag"))
7 {
8  //now do what ever initialization is needed
9  dbe = 0;
11 
12  genEventInfoProductTagToken_=consumes<GenEventInfoProduct>(genEventInfoProductTag_);
13  jetsToken_=consumes<std::vector<reco::GenJet> >(jets_);
14 
15 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< reco::GenJet > > jetsToken_
edm::InputTag genEventInfoProductTag_
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
DQMStore * dbe
ME&#39;s &quot;container&quot;.
TTbar_GenJetAnalyzer::~TTbar_GenJetAnalyzer ( )

Definition at line 18 of file TTbar_GenJetAnalyzer.cc.

19 {
20 
21  // do anything here that needs to be done at desctruction time
22  // (e.g. close files, deallocate resources etc.)
23 
24 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 34 of file TTbar_GenJetAnalyzer.cc.

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

35 {
36  using namespace edm;
37 
38  // --- the MC weights ---
40  iEvent.getByToken(genEventInfoProductTagToken_, evt_info);
41  if(!evt_info.isValid()) return;
42  weight = evt_info->weight() ;
43 
44  // Gather information in the GenJet collection
46  iEvent.getByToken(jetsToken_, jets );
47 
48  if(!jets.isValid()) return;
49  // loop Jet collection and fill histograms
50  int njets = 0;
51  for(std::vector<reco::GenJet>::const_iterator jet_it=jets->begin(); jet_it!=jets->end(); ++jet_it){
52 
53  ++njets;
54 
55  hists_["jetPtAll" ]->Fill( jet_it->pt() , weight );
56  hists_["jetEtaAll"]->Fill( jet_it->eta(), weight );
57 
58  if (njets == 1) { hists_["jetPt1" ]->Fill( jet_it->pt() , weight );
59  hists_["jetEta1"]->Fill( jet_it->eta(), weight );
60  }
61  if (njets == 2) { hists_["jetPt2" ]->Fill( jet_it->pt() , weight );
62  hists_["jetEta2"]->Fill( jet_it->eta(), weight );
63  }
64  if (njets == 3) { hists_["jetPt3" ]->Fill( jet_it->pt() , weight );
65  hists_["jetEta3"]->Fill( jet_it->eta(), weight );
66  }
67  if (njets == 4) { hists_["jetPt4" ]->Fill( jet_it->pt() , weight );
68  hists_["jetEta4"]->Fill( jet_it->eta(), weight );
69  }
70  }
71 
72 }
edm::EDGetTokenT< std::vector< reco::GenJet > > jetsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
vector< PseudoJet > jets
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
std::map< std::string, MonitorElement * > hists_
void TTbar_GenJetAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file TTbar_GenJetAnalyzer.cc.

References DQMStore::book1D(), dbe, hists_, and DQMStore::setCurrentFolder().

78 {
79  if(!dbe) return;
80  dbe->setCurrentFolder("Generator/TTbar");
81  hists_["jetPtAll" ] = dbe->book1D("TTbar_jetPtAll" , "pt" , 1000, 0., 1000.);
82  hists_["jetPt1" ] = dbe->book1D("TTbar_jetPt1" , "pt" , 1000, 0., 1000.);
83  hists_["jetPt2" ] = dbe->book1D("TTbar_jetPt2" , "pt" , 1000, 0., 1000.);
84  hists_["jetPt3" ] = dbe->book1D("TTbar_jetPt3" , "pt" , 1000, 0., 1000.);
85  hists_["jetPt4" ] = dbe->book1D("TTbar_jetPt4" , "pt" , 1000, 0., 1000.);
86 
87  hists_["jetEtaAll"] = dbe->book1D("TTbar_jetEtaAll", "eta", 100, -5., 5.);
88  hists_["jetEta1" ] = dbe->book1D("TTbar_jetEta1" , "eta", 100, -5., 5.);
89  hists_["jetEta2" ] = dbe->book1D("TTbar_jetEta2" , "eta", 100, -5., 5.);
90  hists_["jetEta3" ] = dbe->book1D("TTbar_jetEta3" , "eta", 100, -5., 5.);
91  hists_["jetEta4" ] = dbe->book1D("TTbar_jetEta4" , "eta", 100, -5., 5.);
92 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
std::map< std::string, MonitorElement * > hists_
DQMStore * dbe
ME&#39;s &quot;container&quot;.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void TTbar_GenJetAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 114 of file TTbar_GenJetAnalyzer.cc.

115 {
116 }
void TTbar_GenJetAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 102 of file TTbar_GenJetAnalyzer.cc.

103 {
104 }
void TTbar_GenJetAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 96 of file TTbar_GenJetAnalyzer.cc.

97 {
98 }
void TTbar_GenJetAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 120 of file TTbar_GenJetAnalyzer.cc.

121 {
122 }
void TTbar_GenJetAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 108 of file TTbar_GenJetAnalyzer.cc.

109 {
110 }
void TTbar_GenJetAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 126 of file TTbar_GenJetAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

126  {
127  //The following says we do not know what parameters are allowed so do no validation
128  // Please change this to state exactly what you do use, even if it is no parameters
130  desc.setUnknown();
131  descriptions.addDefault(desc);
132 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

DQMStore* TTbar_GenJetAnalyzer::dbe
private

ME's "container".

Definition at line 76 of file TTbar_GenJetAnalyzer.h.

Referenced by beginJob(), and TTbar_GenJetAnalyzer().

edm::InputTag TTbar_GenJetAnalyzer::genEventInfoProductTag_
private

Definition at line 79 of file TTbar_GenJetAnalyzer.h.

Referenced by TTbar_GenJetAnalyzer().

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

Definition at line 84 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and TTbar_GenJetAnalyzer().

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

Definition at line 80 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and beginJob().

edm::InputTag TTbar_GenJetAnalyzer::jets_
private

Definition at line 78 of file TTbar_GenJetAnalyzer.h.

Referenced by TTbar_GenJetAnalyzer().

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

Definition at line 85 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and TTbar_GenJetAnalyzer().

double TTbar_GenJetAnalyzer::weight
private