CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HypothesisAnalyzer Class Reference

#include <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 ()
virtual void endJob ()

Private Attributes

TH1F * genMatchDr_
TH2F * genMatchDrVsHadTopPullMass_
TH1F * hadTopEta_
TH1F * hadTopMass_
TH1F * hadTopPt_
TH1F * hadTopPullEta_
TH1F * hadTopPullMass_
TH1F * hadTopPullPt_
TH1F * hadWEta_
TH1F * hadWMass_
TH1F * hadWPt_
TH1F * hadWPullEta_
TH1F * hadWPullMass_
TH1F * hadWPullPt_
edm::InputTag hypoClassKey_
TH1F * mvaDisc_
TH2F * mvaDiscVsHadTopPullMass_
edm::InputTag semiLepEvt_

Detailed Description

Definition at line 9 of file HypothesisAnalyzer.h.


Constructor & Destructor Documentation

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

Definition at line 11 of file HypothesisAnalyzer.cc.

                                                                :
  semiLepEvt_  (cfg.getParameter<edm::InputTag>("semiLepEvent")),
  hypoClassKey_(cfg.getParameter<edm::InputTag>("hypoClassKey"))
{
}
HypothesisAnalyzer::~HypothesisAnalyzer ( ) [inline]

Definition at line 14 of file HypothesisAnalyzer.h.

{};

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 18 of file HypothesisAnalyzer.cc.

References reco::Candidate::eta(), genMatchDr_, genMatchDrVsHadTopPullMass_, hadTopEta_, hadTopMass_, hadTopPt_, hadTopPullEta_, hadTopPullMass_, hadTopPullPt_, hadWEta_, hadWMass_, hadWPt_, hadWPullEta_, hadWPullMass_, hadWPullPt_, hypoClassKey_, reco::Candidate::mass(), mvaDisc_, mvaDiscVsHadTopPullMass_, reco::Candidate::pt(), and semiLepEvt_.

{
  // get a handle for the TtSemiLeptonicEvent and a key to the hypothesis
  
  edm::Handle<TtSemiLeptonicEvent> semiLepEvt;
  event.getByLabel(semiLepEvt_, semiLepEvt);

  edm::Handle<int> hypoClassKeyHandle;
  event.getByLabel(hypoClassKey_, hypoClassKeyHandle);
  TtSemiLeptonicEvent::HypoClassKey& hypoClassKey = (TtSemiLeptonicEvent::HypoClassKey&) *hypoClassKeyHandle;

  // check if hypothesis is available and valid in this event

  if( !semiLepEvt->isHypoValid(hypoClassKey) ){
    edm::LogInfo("HypothesisAnalyzer") << "Hypothesis not valid for this event";
    return;
  }

  // get reconstructed top quarks and W bosons from the hypothesis

  const reco::Candidate* hadTop = semiLepEvt->hadronicDecayTop(hypoClassKey);
  const reco::Candidate* hadW   = semiLepEvt->hadronicDecayW  (hypoClassKey);

  // fill simple histograms with pt, eta and the masses of the reconstructed particles

  if(hadW) {
    hadWPt_  ->Fill( hadW->pt()   );
    hadWEta_ ->Fill( hadW->eta()  );
    hadWMass_->Fill( hadW->mass() );
  }

  if(hadTop) {
    hadTopPt_  ->Fill( hadTop->pt()   );
    hadTopEta_ ->Fill( hadTop->eta()  );
    hadTopMass_->Fill( hadTop->mass() );
  }

  // get genParticles

  const reco::Candidate* genHadTop = semiLepEvt->hadronicDecayTop();
  const reco::Candidate* genHadW   = semiLepEvt->hadronicDecayW();

  // fill pull histograms for pt, eta and the masses of the reconstructed with respect to the generated particles

  if(hadW && genHadW) {
    hadWPullPt_  ->Fill( (hadW->pt() - genHadW->pt()) / genHadW->pt()   );
    hadWPullEta_ ->Fill( (hadW->eta() - genHadW->eta()) / genHadW->eta()  );
    hadWPullMass_->Fill( (hadW->mass() - genHadW->mass()) / genHadW->mass() );
  }

  if(hadTop && genHadTop) {
    hadTopPullPt_  ->Fill( (hadTop->pt() - genHadTop->pt()) / genHadTop->pt()   );
    hadTopPullEta_ ->Fill( (hadTop->eta() - genHadTop->eta()) / genHadTop->eta()  );
    hadTopPullMass_->Fill( (hadTop->mass() - genHadTop->mass()) / genHadTop->mass() );
  }

  // fill histograms with variables describing the quality of the hypotheses

  genMatchDr_->Fill(semiLepEvt->genMatchSumDR());
  mvaDisc_   ->Fill(semiLepEvt->mvaDisc());

  if(hadTop && genHadTop) {

    genMatchDrVsHadTopPullMass_->Fill((hadTop->mass() - genHadTop->mass()) / genHadTop->mass(), semiLepEvt->genMatchSumDR());
    mvaDiscVsHadTopPullMass_   ->Fill((hadTop->mass() - genHadTop->mass()) / genHadTop->mass(), semiLepEvt->mvaDisc());

  }

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

Reimplemented from edm::EDAnalyzer.

Definition at line 103 of file HypothesisAnalyzer.cc.

References edm::errors::Configuration, Exception, genMatchDr_, genMatchDrVsHadTopPullMass_, hadTopEta_, hadTopMass_, hadTopPt_, hadTopPullEta_, hadTopPullMass_, hadTopPullPt_, hadWEta_, hadWMass_, hadWPt_, hadWPullEta_, hadWPullMass_, hadWPullPt_, mvaDisc_, and mvaDiscVsHadTopPullMass_.

{
  edm::Service<TFileService> fs;
  if( !fs ) throw edm::Exception( edm::errors::Configuration, "TFile Service is not registered in cfg file" );

  // book histograms

  hadWPt_   = fs->make<TH1F>("hadWPt"  , "p_{t} (W_{had}) [GeV]", 25,  0., 500.);
  hadWEta_  = fs->make<TH1F>("hadWEta" , "#eta (W_{had})"       , 20, -4.,   4.);
  hadWMass_ = fs->make<TH1F>("hadWMass", "M (W_{had}) [GeV]"    , 25,  0., 200.);

  hadTopPt_   = fs->make<TH1F>("hadTopPt"  , "p_{t} (t_{had}) [GeV]", 25, 0. , 500.);
  hadTopEta_  = fs->make<TH1F>("hadTopEta" , "#eta (t_{had})"       , 20, -4.,   4.);
  hadTopMass_ = fs->make<TH1F>("hadTopMass", "M (t_{had}) [GeV]"    , 40, 0. , 400.);

  hadWPullPt_   = fs->make<TH1F>("hadWPullPt"  , "(p_{t,rec}-p_{t,gen})/p_{t,gen} (W_{had})"   , 40, -1., 1.);
  hadWPullEta_  = fs->make<TH1F>("hadWPullEta" , "(#eta_{rec}-#eta_{gen})/#eta_{gen} (W_{had})", 40, -1., 1.);
  hadWPullMass_ = fs->make<TH1F>("hadWPullMass", "(M_{rec}-M_{gen})/M_{gen} (W_{had})"         , 40, -1., 1.);

  hadTopPullPt_   = fs->make<TH1F>("hadTopPullPt"  , "(p_{t,rec}-p_{t,gen})/p_{t,gen} (t_{had})"   , 40, -1., 1.);
  hadTopPullEta_  = fs->make<TH1F>("hadTopPullEta" , "(#eta_{rec}-#eta_{gen})/#eta_{gen} (t_{had})", 40, -1., 1.);
  hadTopPullMass_ = fs->make<TH1F>("hadTopPullMass", "(M_{rec}-M_{gen})/M_{gen} (t_{had})"         , 40, -1., 1.);

  genMatchDr_ = fs->make<TH1F>("genMatchDr", "GenMatch #Sigma #Delta R", 40, 0., 4.);
  mvaDisc_    = fs->make<TH1F>("mvaDisc"   , "MVA discriminator"       , 20, 0., 1.);

  genMatchDrVsHadTopPullMass_ = fs->make<TH2F>("genMatchDrVsHadTopPullMass",
                                               "GenMatch #Sigma #Delta R vs. (M_{rec}-M_{gen})/M_{gen} (t_{had}))",
                                               40, -1., 1., 40, 0., 4.);
  mvaDiscVsHadTopPullMass_    = fs->make<TH2F>("mvaDiscVsHadTopPullMass",
                                               "MVA discriminator vs. (M_{rec}-M_{gen})/M_{gen} (t_{had}))",
                                               40, -1., 1., 20, 0., 1.);
}
void HypothesisAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 140 of file HypothesisAnalyzer.cc.

{
}

Member Data Documentation

Definition at line 41 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 44 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 34 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 35 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 33 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 38 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 39 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 37 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 26 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 27 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadWPt_ [private]

Definition at line 25 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 30 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 31 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 29 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 23 of file HypothesisAnalyzer.h.

Referenced by analyze().

Definition at line 42 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 45 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 22 of file HypothesisAnalyzer.h.

Referenced by analyze().