CMS 3D CMS Logo

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

#include <HypothesisAnalyzer.h>

Inheritance diagram for HypothesisAnalyzer:
edm::EDAnalyzer

Public Member Functions

 HypothesisAnalyzer (const edm::ParameterSet &)
 
 ~HypothesisAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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_
 
const std::string hypoClassKey_
 
TH1F * kinFitProb_
 
TH2F * kinFitProbVsHadTopPullMass_
 
TH1F * lepTopEta_
 
TH1F * lepTopMass_
 
TH1F * lepTopPt_
 
TH1F * lepTopPullEta_
 
TH1F * lepTopPullMass_
 
TH1F * lepTopPullPt_
 
TH1F * lepWEta_
 
TH1F * lepWMass_
 
TH1F * lepWPt_
 
TH1F * lepWPullEta_
 
TH1F * lepWPullMass_
 
TH1F * lepWPullPt_
 
TH1F * neutrinoEta_
 
TH1F * neutrinoPullEta_
 
const edm::InputTag semiLepEvt_
 
TH1F * topPairMass_
 
TH1F * topPairPullMass_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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.

11  :
12  semiLepEvt_ (cfg.getParameter<edm::InputTag>("semiLepEvent")),
13  hypoClassKey_(cfg.getParameter<std::string>("hypoClassKey"))
14 {
15 }
T getParameter(std::string const &) const
const edm::InputTag semiLepEvt_
const std::string hypoClassKey_
HypothesisAnalyzer::~HypothesisAnalyzer ( )
inline

Definition at line 14 of file HypothesisAnalyzer.h.

14 {};

Member Function Documentation

void HypothesisAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
privatevirtual

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_, kinFitProb_, kinFitProbVsHadTopPullMass_, lepTopEta_, lepTopMass_, lepTopPt_, lepTopPullEta_, lepTopPullMass_, lepTopPullPt_, lepWEta_, lepWMass_, lepWPt_, lepWPullEta_, lepWPullMass_, lepWPullPt_, reco::Candidate::mass(), neutrinoEta_, neutrinoPullEta_, reco::Candidate::pt(), semiLepEvt_, topPairMass_, and topPairPullMass_.

19 {
21  // get a handle for the TtSemiLeptonicEvent and a key to the hypothesis
23 
25  event.getByLabel(semiLepEvt_, semiLepEvt);
26 
28  // check if hypothesis is available and valid in this event
30 
31  if( !semiLepEvt->isHypoValid(hypoClassKey_) ){
32  edm::LogInfo("HypothesisAnalyzer") << "Hypothesis " << hypoClassKey_ << " not valid for this event";
33  return;
34  }
35 
37  // get reconstructed top quarks, W bosons, the top pair and the neutrino from the hypothesis
39 
40  const reco::Candidate* topPair = semiLepEvt->topPair(hypoClassKey_);
41  const reco::Candidate* lepTop = semiLepEvt->leptonicDecayTop(hypoClassKey_);
42  const reco::Candidate* lepW = semiLepEvt->leptonicDecayW(hypoClassKey_);
43  const reco::Candidate* hadTop = semiLepEvt->hadronicDecayTop(hypoClassKey_);
44  const reco::Candidate* hadW = semiLepEvt->hadronicDecayW(hypoClassKey_);
45  const reco::Candidate* neutrino = semiLepEvt->singleNeutrino(hypoClassKey_);
46 
48  // fill simple histograms with kinematic variables of the reconstructed particles
50 
51  if(topPair)
52  topPairMass_->Fill( topPair->mass() );
53  if(hadW) {
54  hadWPt_ ->Fill( hadW->pt() );
55  hadWEta_ ->Fill( hadW->eta() );
56  hadWMass_->Fill( hadW->mass() );
57  }
58  if(hadTop) {
59  hadTopPt_ ->Fill( hadTop->pt() );
60  hadTopEta_ ->Fill( hadTop->eta() );
61  hadTopMass_->Fill( hadTop->mass() );
62  }
63  if(lepW) {
64  lepWPt_ ->Fill( lepW->pt() );
65  lepWEta_ ->Fill( lepW->eta() );
66  lepWMass_->Fill( lepW->mass() );
67  }
68  if(lepTop) {
69  lepTopPt_ ->Fill( lepTop->pt() );
70  lepTopEta_ ->Fill( lepTop->eta() );
71  lepTopMass_->Fill( lepTop->mass() );
72  }
73  if(neutrino)
74  neutrinoEta_->Fill( neutrino->eta() );
75 
77  // get corresponding genParticles
79 
80  const math::XYZTLorentzVector* genTopPair = semiLepEvt->topPair();
81  const reco::Candidate* genHadTop = semiLepEvt->hadronicDecayTop();
82  const reco::Candidate* genHadW = semiLepEvt->hadronicDecayW();
83  const reco::Candidate* genLepTop = semiLepEvt->leptonicDecayTop();
84  const reco::Candidate* genLepW = semiLepEvt->leptonicDecayW();
85  const reco::Candidate* genNeutrino = semiLepEvt->singleNeutrino();
86 
88  // fill pull histograms of kinematic variables with respect to the generated particles
90 
91  if(topPair && genTopPair)
92  topPairPullMass_->Fill( (topPair->mass()-genTopPair->mass())/ genTopPair->mass() );
93  if(hadW && genHadW) {
94  hadWPullPt_ ->Fill( (hadW->pt() - genHadW->pt()) / genHadW->pt() );
95  hadWPullEta_ ->Fill( (hadW->eta() - genHadW->eta()) / genHadW->eta() );
96  hadWPullMass_->Fill( (hadW->mass() - genHadW->mass()) / genHadW->mass() );
97  }
98 
99  if(hadTop && genHadTop) {
100  hadTopPullPt_ ->Fill( (hadTop->pt() - genHadTop->pt()) / genHadTop->pt() );
101  hadTopPullEta_ ->Fill( (hadTop->eta() - genHadTop->eta()) / genHadTop->eta() );
102  hadTopPullMass_->Fill( (hadTop->mass() - genHadTop->mass()) / genHadTop->mass() );
103  }
104  if(lepW && genLepW) {
105  lepWPullPt_ ->Fill( (lepW->pt() - genLepW->pt()) / genLepW->pt() );
106  lepWPullEta_ ->Fill( (lepW->eta() - genLepW->eta()) / genLepW->eta() );
107  lepWPullMass_->Fill( (lepW->mass() - genLepW->mass()) / genLepW->mass() );
108  }
109 
110  if(lepTop && genLepTop) {
111  lepTopPullPt_ ->Fill( (lepTop->pt() - genLepTop->pt()) / genLepTop->pt() );
112  lepTopPullEta_ ->Fill( (lepTop->eta() - genLepTop->eta()) / genLepTop->eta() );
113  lepTopPullMass_->Fill( (lepTop->mass() - genLepTop->mass()) / genLepTop->mass() );
114  }
115  if(neutrino && genNeutrino)
116  neutrinoPullEta_->Fill( (neutrino->eta()-genNeutrino->eta()) / genNeutrino->eta() );
117 
119  // fill histograms with variables describing the quality of the hypotheses
121 
122  genMatchDr_->Fill(semiLepEvt->genMatchSumDR());
123  kinFitProb_->Fill(semiLepEvt->fitProb());
124 
125  if(hadTop && genHadTop) {
126  genMatchDrVsHadTopPullMass_->Fill((hadTop->mass() - genHadTop->mass()) / genHadTop->mass(), semiLepEvt->genMatchSumDR());
127  kinFitProbVsHadTopPullMass_->Fill((hadTop->mass() - genHadTop->mass()) / genHadTop->mass(), semiLepEvt->fitProb());
128  }
129 
130 }
const edm::InputTag semiLepEvt_
const std::string hypoClassKey_
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
virtual double eta() const =0
momentum pseudorapidity
void HypothesisAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 133 of file HypothesisAnalyzer.cc.

References edm::errors::Configuration, edm::hlt::Exception, genMatchDr_, genMatchDrVsHadTopPullMass_, hadTopEta_, hadTopMass_, hadTopPt_, hadTopPullEta_, hadTopPullMass_, hadTopPullPt_, hadWEta_, hadWMass_, hadWPt_, hadWPullEta_, hadWPullMass_, hadWPullPt_, kinFitProb_, kinFitProbVsHadTopPullMass_, lepTopEta_, lepTopMass_, lepTopPt_, lepTopPullEta_, lepTopPullMass_, lepTopPullPt_, lepWEta_, lepWMass_, lepWPt_, lepWPullEta_, lepWPullMass_, lepWPullPt_, TFileDirectory::make(), neutrinoEta_, neutrinoPullEta_, topPairMass_, and topPairPullMass_.

134 {
136  if( !fs ) throw edm::Exception( edm::errors::Configuration, "TFile Service is not registered in cfg file" );
137 
139  // book histograms
141 
142  neutrinoEta_ = fs->make<TH1F>("neutrinoEta", "#eta (neutrino)", 21, -4., 4.);
143  neutrinoPullEta_ = fs->make<TH1F>("neutrinoPullEta", "(#eta_{rec}-#eta_{gen})/#eta_{gen} (neutrino)", 40, -1., 1.);
144 
145  hadWPt_ = fs->make<TH1F>("hadWPt" , "p_{T} (W_{had}) [GeV]", 25, 0., 500.);
146  hadWEta_ = fs->make<TH1F>("hadWEta" , "#eta (W_{had})" , 21, -4., 4.);
147  hadWMass_ = fs->make<TH1F>("hadWMass", "M (W_{had}) [GeV]" , 25, 0., 200.);
148 
149  hadTopPt_ = fs->make<TH1F>("hadTopPt" , "p_{T} (t_{had}) [GeV]", 25, 0. , 500.);
150  hadTopEta_ = fs->make<TH1F>("hadTopEta" , "#eta (t_{had})" , 21, -4., 4.);
151  hadTopMass_ = fs->make<TH1F>("hadTopMass", "M (t_{had}) [GeV]" , 40, 0. , 400.);
152 
153  lepWPt_ = fs->make<TH1F>("lepWPt" , "p_{t} (W_{lep}) [GeV]", 25, 0., 500.);
154  lepWEta_ = fs->make<TH1F>("lepWEta" , "#eta (W_{lep})" , 21, -4., 4.);
155  lepWMass_ = fs->make<TH1F>("lepWMass", "M (W_{lep}) [GeV]" , 25, 0., 200.);
156 
157  lepTopPt_ = fs->make<TH1F>("lepTopPt" , "p_{T} (t_{lep}) [GeV]", 25, 0. , 500.);
158  lepTopEta_ = fs->make<TH1F>("lepTopEta" , "#eta (t_{lep})" , 21, -4., 4.);
159  lepTopMass_ = fs->make<TH1F>("lepTopMass", "M (t_{lep}) [GeV]" , 40, 0. , 400.);
160 
161  hadWPullPt_ = fs->make<TH1F>("hadWPullPt" , "(p_{T,rec}-p_{T,gen})/p_{T,gen} (W_{had})" , 40, -1., 1.);
162  hadWPullEta_ = fs->make<TH1F>("hadWPullEta" , "(#eta_{rec}-#eta_{gen})/#eta_{gen} (W_{had})", 40, -1., 1.);
163  hadWPullMass_ = fs->make<TH1F>("hadWPullMass", "(M_{rec}-M_{gen})/M_{gen} (W_{had})" , 40, -1., 1.);
164 
165  hadTopPullPt_ = fs->make<TH1F>("hadTopPullPt" , "(p_{T,rec}-p_{T,gen})/p_{T,gen} (t_{had})" , 40, -1., 1.);
166  hadTopPullEta_ = fs->make<TH1F>("hadTopPullEta" , "(#eta_{rec}-#eta_{gen})/#eta_{gen} (t_{had})", 40, -1., 1.);
167  hadTopPullMass_ = fs->make<TH1F>("hadTopPullMass", "(M_{rec}-M_{gen})/M_{gen} (t_{had})" , 40, -1., 1.);
168 
169  lepWPullPt_ = fs->make<TH1F>("lepWPullPt" , "(p_{T,rec}-p_{T,gen})/p_{T,gen} (W_{lep})" , 40, -1., 1.);
170  lepWPullEta_ = fs->make<TH1F>("lepWPullEta" , "(#eta_{rec}-#eta_{gen})/#eta_{gen} (W_{lep})", 40, -1., 1.);
171  lepWPullMass_ = fs->make<TH1F>("lepWPullMass", "(M_{rec}-M_{gen})/M_{gen} (W_{lep})" , 40, -1., 1.);
172 
173  lepTopPullPt_ = fs->make<TH1F>("lepTopPullPt" , "(p_{T,rec}-p_{T,gen})/p_{T,gen} (t_{lep})" , 40, -1., 1.);
174  lepTopPullEta_ = fs->make<TH1F>("lepTopPullEta" , "(#eta_{rec}-#eta_{gen})/#eta_{gen} (t_{lep})", 40, -1., 1.);
175  lepTopPullMass_ = fs->make<TH1F>("lepTopPullMass", "(M_{rec}-M_{gen})/M_{gen} (t_{lep})" , 40, -1., 1.);
176 
177  topPairMass_ = fs->make<TH1F>("topPairMass", "M (t#bar{t})", 36, 340., 940.);
178  topPairPullMass_ = fs->make<TH1F>("topPairPullMass", "(M_{rec}-M_{gen})/M_{gen} (t#bar{t})", 40, -1., 1.);
179 
180  genMatchDr_ = fs->make<TH1F>("genMatchDr", "GenMatch #Sigma#DeltaR", 40, 0., 4.);
181  kinFitProb_ = fs->make<TH1F>("kinFitProb", "KinFit probability" , 50, 0., 1.);
182 
183  genMatchDrVsHadTopPullMass_ = fs->make<TH2F>("genMatchDrVsHadTopPullMass",
184  "GenMatch #Sigma #Delta R vs. (M_{rec}-M_{gen})/M_{gen} (t_{had}))",
185  40, -1., 1., 40, 0., 4.);
186  kinFitProbVsHadTopPullMass_ = fs->make<TH2F>("kinFitProbVsHadTopPullMass",
187  "KinFit probability vs. (M_{rec}-M_{gen})/M_{gen} (t_{had}))",
188  40, -1., 1., 20, 0., 1.);
189 }
T * make() const
make new ROOT object
void HypothesisAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 192 of file HypothesisAnalyzer.cc.

193 {
194 }

Member Data Documentation

TH1F* HypothesisAnalyzer::genMatchDr_
private

Definition at line 63 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH2F* HypothesisAnalyzer::genMatchDrVsHadTopPullMass_
private

Definition at line 66 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadTopEta_
private

Definition at line 37 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadTopMass_
private

Definition at line 38 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadTopPt_
private

Definition at line 36 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadTopPullEta_
private

Definition at line 41 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadTopPullMass_
private

Definition at line 42 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadTopPullPt_
private

Definition at line 40 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadWEta_
private

Definition at line 29 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadWMass_
private

Definition at line 30 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadWPt_
private

Definition at line 28 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadWPullEta_
private

Definition at line 33 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadWPullMass_
private

Definition at line 34 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::hadWPullPt_
private

Definition at line 32 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

const std::string HypothesisAnalyzer::hypoClassKey_
private

Definition at line 23 of file HypothesisAnalyzer.h.

Referenced by analyze().

TH1F* HypothesisAnalyzer::kinFitProb_
private

Definition at line 64 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH2F* HypothesisAnalyzer::kinFitProbVsHadTopPullMass_
private

Definition at line 67 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepTopEta_
private

Definition at line 53 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepTopMass_
private

Definition at line 54 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepTopPt_
private

Definition at line 52 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepTopPullEta_
private

Definition at line 60 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepTopPullMass_
private

Definition at line 61 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepTopPullPt_
private

Definition at line 59 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepWEta_
private

Definition at line 45 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepWMass_
private

Definition at line 46 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepWPt_
private

Definition at line 44 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepWPullEta_
private

Definition at line 49 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepWPullMass_
private

Definition at line 50 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::lepWPullPt_
private

Definition at line 48 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::neutrinoEta_
private

Definition at line 25 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::neutrinoPullEta_
private

Definition at line 26 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

const edm::InputTag HypothesisAnalyzer::semiLepEvt_
private

Definition at line 22 of file HypothesisAnalyzer.h.

Referenced by analyze().

TH1F* HypothesisAnalyzer::topPairMass_
private

Definition at line 56 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1F* HypothesisAnalyzer::topPairPullMass_
private

Definition at line 57 of file HypothesisAnalyzer.h.

Referenced by analyze(), and beginJob().