CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 TTbar_GenJetAnalyzer (const edm::ParameterSet &)
 ~TTbar_GenJetAnalyzer ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

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".
edm::InputTag genEventInfoProductTag_
std::map< std::string,
MonitorElement * > 
hists_
edm::InputTag jets_
double weight

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 57 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, and cppFunctionSkipper::operator.

                                                                        :
  jets_(iConfig.getParameter<edm::InputTag>("jets")),
  genEventInfoProductTag_(iConfig.getParameter<edm::InputTag>("genEventInfoProductTag"))
{
   //now do what ever initialization is needed
  dbe = 0;
  dbe = edm::Service<DQMStore>().operator->();
}
TTbar_GenJetAnalyzer::~TTbar_GenJetAnalyzer ( )

Definition at line 14 of file TTbar_GenJetAnalyzer.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void TTbar_GenJetAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 30 of file TTbar_GenJetAnalyzer.cc.

References genEventInfoProductTag_, edm::Event::getByLabel(), hists_, fwrapper::jets, jets_, and weight.

{
  using namespace edm;
 
  // --- the MC weights ---
  Handle<GenEventInfoProduct> evt_info;
  iEvent.getByLabel(genEventInfoProductTag_, evt_info);
  if(!evt_info.isValid()) return;
  weight = evt_info->weight() ;

  // Gather information in the GenJet collection
  edm::Handle<std::vector<reco::GenJet> > jets;
  iEvent.getByLabel(jets_, jets );

  if(!jets.isValid()) return;
  // loop Jet collection and fill histograms
  int njets = 0;
  for(std::vector<reco::GenJet>::const_iterator jet_it=jets->begin(); jet_it!=jets->end(); ++jet_it){  

    ++njets; 

    hists_["jetPtAll" ]->Fill( jet_it->pt() , weight );
    hists_["jetEtaAll"]->Fill( jet_it->eta(), weight );

    if (njets == 1) { hists_["jetPt1" ]->Fill( jet_it->pt() , weight );
                      hists_["jetEta1"]->Fill( jet_it->eta(), weight );
                    }
    if (njets == 2) { hists_["jetPt2" ]->Fill( jet_it->pt() , weight );
                      hists_["jetEta2"]->Fill( jet_it->eta(), weight );
                    }
    if (njets == 3) { hists_["jetPt3" ]->Fill( jet_it->pt() , weight );
                      hists_["jetEta3"]->Fill( jet_it->eta(), weight );
                    }
    if (njets == 4) { hists_["jetPt4" ]->Fill( jet_it->pt() , weight );
                      hists_["jetEta4"]->Fill( jet_it->eta(), weight );
                    }
  }

}
void TTbar_GenJetAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file TTbar_GenJetAnalyzer.cc.

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

{
  if(!dbe) return;
  dbe->setCurrentFolder("Generator/TTbar");
  hists_["jetPtAll" ] = dbe->book1D("TTbar_jetPtAll" , "pt" , 1000,  0., 1000.); 
  hists_["jetPt1"   ] = dbe->book1D("TTbar_jetPt1"   , "pt" , 1000,  0., 1000.); 
  hists_["jetPt2"   ] = dbe->book1D("TTbar_jetPt2"   , "pt" , 1000,  0., 1000.); 
  hists_["jetPt3"   ] = dbe->book1D("TTbar_jetPt3"   , "pt" , 1000,  0., 1000.); 
  hists_["jetPt4"   ] = dbe->book1D("TTbar_jetPt4"   , "pt" , 1000,  0., 1000.); 
                                                                                    
  hists_["jetEtaAll"] = dbe->book1D("TTbar_jetEtaAll", "eta",  100, -5.,    5.); 
  hists_["jetEta1"  ] = dbe->book1D("TTbar_jetEta1"  , "eta",  100, -5.,    5.); 
  hists_["jetEta2"  ] = dbe->book1D("TTbar_jetEta2"  , "eta",  100, -5.,    5.); 
  hists_["jetEta3"  ] = dbe->book1D("TTbar_jetEta3"  , "eta",  100, -5.,    5.); 
  hists_["jetEta4"  ] = dbe->book1D("TTbar_jetEta4"  , "eta",  100, -5.,    5.); 
}
void TTbar_GenJetAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 110 of file TTbar_GenJetAnalyzer.cc.

{
}
void TTbar_GenJetAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 98 of file TTbar_GenJetAnalyzer.cc.

{
}
void TTbar_GenJetAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 92 of file TTbar_GenJetAnalyzer.cc.

{
}
void TTbar_GenJetAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 116 of file TTbar_GenJetAnalyzer.cc.

{
}
void TTbar_GenJetAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 104 of file TTbar_GenJetAnalyzer.cc.

{
}
void TTbar_GenJetAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file TTbar_GenJetAnalyzer.cc.

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

                                                                                 {
  //The following says we do not know what parameters are allowed so do no validation
  // Please change this to state exactly what you do use, even if it is no parameters
  edm::ParameterSetDescription desc;
  desc.setUnknown();
  descriptions.addDefault(desc);
}

Member Data Documentation

ME's "container".

Definition at line 77 of file TTbar_GenJetAnalyzer.h.

Referenced by beginJob(), and TTbar_GenJetAnalyzer().

Definition at line 80 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze().

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

Definition at line 81 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 79 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze().

double TTbar_GenJetAnalyzer::weight [private]

Definition at line 83 of file TTbar_GenJetAnalyzer.h.

Referenced by analyze().