CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HypothesisAnalyzer.cc
Go to the documentation of this file.
6 
8 
10 
12  semiLepEvt_ (cfg.getParameter<edm::InputTag>("semiLepEvent")),
13  hypoClassKey_(cfg.getParameter<std::string>("hypoClassKey"))
14 {
15 }
16 
17 void
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 }
131 
132 void
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 }
190 
191 void
193 {
194 }
virtual void analyze(const edm::Event &, const edm::EventSetup &)
virtual float mass() const =0
mass
const edm::InputTag semiLepEvt_
const std::string hypoClassKey_
virtual float eta() const =0
momentum pseudorapidity
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
virtual float pt() const =0
transverse momentum
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
HypothesisAnalyzer(const edm::ParameterSet &)
T * make() const
make new ROOT object
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")