CMS 3D CMS Logo

HypothesisAnalyzer Class Reference

#include <TopQuarkAnalysis/Examples/plugins/HypothesisAnalyzer.h>

Inheritance diagram for HypothesisAnalyzer:

edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()

Private Attributes

TH1F * hadTopMass_
TH1F * hadTopPt_
TH1F * hadWMass_
TH1F * hadWPt_
edm::InputTag hypoClassKey_
TH1F * lepTopMass_
TH1F * lepTopPt_
TH1F * lepWMass_
TH1F * lepWPt_
edm::InputTag semiLepEvt_


Detailed Description

Definition at line 14 of file HypothesisAnalyzer.h.


Constructor & Destructor Documentation

HypothesisAnalyzer::HypothesisAnalyzer ( const edm::ParameterSet cfg  )  [explicit]

Definition at line 8 of file HypothesisAnalyzer.cc.

00008                                                                 :
00009   semiLepEvt_  (cfg.getParameter<edm::InputTag>("semiLepEvent")),
00010   hypoClassKey_(cfg.getParameter<edm::InputTag>("hypoClassKey"))
00011 {
00012 }

HypothesisAnalyzer::~HypothesisAnalyzer (  )  [inline]

Definition at line 19 of file HypothesisAnalyzer.h.

00019 {};


Member Function Documentation

void HypothesisAnalyzer::analyze ( const edm::Event evt,
const edm::EventSetup setup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 15 of file HypothesisAnalyzer.cc.

References edm::Event::getByLabel(), hadTopMass_, hadTopPt_, hadWMass_, hadWPt_, hypoClassKey_, lepTopMass_, lepTopPt_, lepWMass_, lepWPt_, reco::Particle::mass(), reco::Particle::pt(), and semiLepEvt_.

00016 {
00017   edm::Handle<TtSemiLeptonicEvent> semiLepEvt;
00018   evt.getByLabel(semiLepEvt_, semiLepEvt);
00019 
00020   edm::Handle<int> hypoClassKeyHandle;
00021   evt.getByLabel(hypoClassKey_, hypoClassKeyHandle);
00022   TtSemiLeptonicEvent::HypoClassKey& hypoClassKey = (TtSemiLeptonicEvent::HypoClassKey&) *hypoClassKeyHandle;
00023 
00024   if( !semiLepEvt->isHypoAvailable(hypoClassKey) ){
00025     edm::LogInfo ( "NonValidHyp" ) << "Hypothesis not available for this event";
00026     return;
00027   }
00028   if( !semiLepEvt->isHypoValid(hypoClassKey) ){
00029     edm::LogInfo ( "NonValidHyp" ) << "Hypothesis not valid for this event";
00030     return;
00031   }
00032   
00033   const reco::Candidate* hadTop = semiLepEvt->hadronicTop(hypoClassKey);
00034   const reco::Candidate* hadW   = semiLepEvt->hadronicW  (hypoClassKey);
00035   const reco::Candidate* lepTop = semiLepEvt->leptonicTop(hypoClassKey);
00036   const reco::Candidate* lepW   = semiLepEvt->leptonicW  (hypoClassKey);
00037 
00038   if(hadTop && hadW && lepTop && lepW){
00039     hadWPt_    ->Fill( hadW->pt()    );
00040     hadWMass_  ->Fill( hadW->mass()  );
00041     hadTopPt_  ->Fill( hadTop->pt()  );
00042     hadTopMass_->Fill( hadTop->mass());
00043     
00044     lepWPt_    ->Fill( lepW->pt()    );
00045     lepWMass_  ->Fill( lepW->mass()  );
00046     lepTopPt_  ->Fill( lepTop->pt()  );
00047     lepTopMass_->Fill( lepTop->mass());
00048   }
00049 }

void HypothesisAnalyzer::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file HypothesisAnalyzer.cc.

References edm::errors::Configuration, hadTopMass_, hadTopPt_, hadWMass_, hadWPt_, lepTopMass_, lepTopPt_, lepWMass_, and lepWPt_.

00053 {
00054   edm::Service<TFileService> fs;
00055   if( !fs ) throw edm::Exception( edm::errors::Configuration, "TFile Service is not registered in cfg file" );
00056 
00057   hadWPt_     = fs->make<TH1F>("hadWPt",     "p_{t} (W_{had}) [GeV]", 100,  0.,  500.);
00058   hadWMass_   = fs->make<TH1F>("hadWMass",   "M (W_{had}) [GeV]"    ,  50,  0. , 150.);
00059   hadTopPt_   = fs->make<TH1F>("hadTopPt",   "p_{t} (t_{had}) [GeV]", 100,  0. , 500.);
00060   hadTopMass_ = fs->make<TH1F>("hadTopMass", "M (t_{had}) [GeV]",      50, 50. , 250.);
00061 
00062   lepWPt_     = fs->make<TH1F>("lepWPt",     "p_{t} (W_{lep}) [GeV]", 100,  0.,  500.);
00063   lepWMass_   = fs->make<TH1F>("lepWMass",   "M (W_{lep}) [GeV]"    ,  50,  0. , 150.);
00064   lepTopPt_   = fs->make<TH1F>("lepTopPt",   "p_{t} (t_{lep}) [GeV]", 100,  0. , 500.);
00065   lepTopMass_ = fs->make<TH1F>("lepTopMass", "M (t_{lep}) [GeV]",      50, 50. , 250.);
00066 }

void HypothesisAnalyzer::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file HypothesisAnalyzer.cc.

00070 {
00071 }


Member Data Documentation

TH1F* HypothesisAnalyzer::hadTopMass_ [private]

Definition at line 33 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadTopPt_ [private]

Definition at line 32 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadWMass_ [private]

Definition at line 31 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadWPt_ [private]

Definition at line 30 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

edm::InputTag HypothesisAnalyzer::hypoClassKey_ [private]

Definition at line 28 of file HypothesisAnalyzer.h.

Referenced by analyze().

TH1F* HypothesisAnalyzer::lepTopMass_ [private]

Definition at line 38 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepTopPt_ [private]

Definition at line 37 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepWMass_ [private]

Definition at line 36 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepWPt_ [private]

Definition at line 35 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

edm::InputTag HypothesisAnalyzer::semiLepEvt_ [private]

Definition at line 27 of file HypothesisAnalyzer.h.

Referenced by analyze().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:49 2009 for CMSSW by  doxygen 1.5.4