CMS 3D CMS Logo

TtFullHadronicEvent.cc
Go to the documentation of this file.
4 
5 #include "printParticle.h"
7 
8 // print info via MessageLogger
9 void TtFullHadronicEvent::print(const int verbosity) const {
10  if (verbosity % 10 <= 0)
11  return;
12 
13  edm::LogInfo log("TtFullHadronicEvent");
14 
15  log << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \n";
16 
17  // get some information from the genEvent
18  if (!genEvt_)
19  log << " TtGenEvent not available! \n";
20  else {
21  log << " TtGenEvent says: ";
22  if (!this->genEvent()->isTtBar())
23  log << "Not TtBar";
24  else if (this->genEvent()->isFullHadronic())
25  log << "Fully Hadronic TtBar";
26  else if (this->genEvent()->isSemiLeptonic())
27  log << "Semi-leptonic TtBar";
28  else if (this->genEvent()->isFullLeptonic())
29  log << "Fully Leptonic TtBar";
30  log << "\n";
31  }
32  // get number of available hypothesis classes
33  log << " Number of available event hypothesis classes: " << this->numberOfAvailableHypoClasses() << " \n";
34 
35  // create a legend for the jetLepComb
36  log << " - JetCombi : ";
37  for (unsigned idx = 0; idx < 6; idx++) {
38  switch (idx) {
40  log << " LightQ ";
41  break;
43  log << " LightQBar";
44  break;
46  log << " B ";
47  break;
49  log << " LightP ";
50  break;
52  log << " LightPBar";
53  break;
55  log << " BBar ";
56  break;
57  }
58  }
59  log << "\n";
60 
61  // get details from the hypotheses
62  typedef std::map<HypoClassKey, std::vector<HypoCombPair> >::const_iterator EventHypo;
63  for (EventHypo hyp = evtHyp_.begin(); hyp != evtHyp_.end(); ++hyp) {
64  HypoClassKey hypKey = (*hyp).first;
65  // header for each hypothesis
66  log << "---------------------------------------------------------------------------- \n";
67  switch (hypKey) {
68  case kGeom:
69  log << " Geom not (yet) applicable to TtFullHadronicEvent --> skipping";
70  continue;
71  case kWMassMaxSumPt:
72  log << " WMassMaxSumPt not (yet) applicable to TtFullHadronicEvent --> skipping";
73  continue;
74  case kMaxSumPtWMass:
75  log << " MaxSumPtWMass not (yet) applicable to TtFullHadronicEvent --> skipping";
76  continue;
77  case kGenMatch:
78  log << " GenMatch";
79  break;
80  case kMVADisc:
81  log << " MVADisc not (yet) applicable to TtFullHadronicEvent --> skipping";
82  continue;
83  case kKinFit:
84  log << " KinFit";
85  break;
86  case kKinSolution:
87  log << " KinSolution not (yet) applicable to TtFullHadronicEvent --> skipping";
88  continue;
89  case kWMassDeltaTopMass:
90  log << " WMassDeltaTopMass not (yet) applicable to TtFullHadronicEvent --> skipping";
91  continue;
92  case kHitFit:
93  log << " HitFit not (yet) applicable to TtFullHadronicEvent --> skipping";
94  continue;
95  default:
96  log << " Unknown TtEvent::HypoClassKey provided --> skipping";
97  continue;
98  }
99  log << "-Hypothesis: \n";
100  unsigned nOfHyp = this->numberOfAvailableHypos(hypKey);
101  if (nOfHyp > 1) {
102  log << " * Number of available jet combinations: " << nOfHyp << " \n";
103  if (verbosity < 10)
104  log << " The following was found to be the best one: \n";
105  }
106  // if verbosity level is smaller than 10, never show more than the best jet combination
107  if (verbosity < 10)
108  nOfHyp = 1;
109  for (unsigned cmb = 0; cmb < nOfHyp; ++cmb) {
110  // check if hypothesis is valid
111  if (!this->isHypoValid(hypKey, cmb))
112  log << " * Not valid! \n";
113  // get meta information for valid hypothesis
114  else {
115  // jetLepComb
116  log << " * JetCombi :";
117  std::vector<int> jets = this->jetLeptonCombination(hypKey, cmb);
118  for (unsigned int iJet = 0; iJet < jets.size(); iJet++) {
119  log << " " << jets[iJet] << " ";
120  }
121  log << "\n";
122  // specialties for some hypotheses
123  switch (hypKey) {
124  case kGenMatch:
125  log << " * Sum(DeltaR) : " << this->genMatchSumDR(cmb) << " \n"
126  << " * Sum(DeltaPt): " << this->genMatchSumPt(cmb) << " \n";
127  break;
128  case kKinFit:
129  log << " * Chi^2 : " << this->fitChi2(cmb) << " \n"
130  << " * Prob(Chi^2) : " << this->fitProb(cmb) << " \n";
131  break;
132  default:
133  break;
134  }
135  // kinematic quantities of particles (if last digit of verbosity level > 1)
136  if (verbosity % 10 >= 2) {
137  log << " * Candidates (pt; eta; phi; mass) :\n";
138  if (verbosity % 10 >= 3)
139  printParticle(log, "top pair", this->topPair(hypKey, cmb));
140  printParticle(log, "top ", this->top(hypKey, cmb));
141  printParticle(log, "W plus ", this->wPlus(hypKey, cmb));
142  if (verbosity % 10 >= 3) {
143  printParticle(log, "b ", this->b(hypKey, cmb));
144  printParticle(log, "lightQ ", this->lightQ(hypKey, cmb));
145  printParticle(log, "lightQBar ", this->lightQBar(hypKey, cmb));
146  }
147  printParticle(log, "topBar ", this->topBar(hypKey, cmb));
148  printParticle(log, "W minus ", this->wMinus(hypKey, cmb));
149  if (verbosity % 10 >= 3) {
150  printParticle(log, "bBar ", this->bBar(hypKey, cmb));
151  printParticle(log, "lightP ", this->lightP(hypKey, cmb));
152  printParticle(log, "lightPBar ", this->lightPBar(hypKey, cmb));
153  }
154  }
155  }
156  }
157  }
158  log << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
159 }
unsigned int numberOfAvailableHypoClasses() const
return number of available hypothesis classes
Definition: TtEvent.h:86
unsigned int numberOfAvailableHypos(const std::string &key) const
return number of available hypotheses within a given hypothesis class
Definition: TtEvent.h:88
HypoClassKey
supported classes of event hypotheses
Definition: TtEvent.h:26
double fitChi2(const unsigned &cmb=0) const
return the chi2 of the kinematic fit of hypothesis &#39;cmb&#39; if available; -1 else
Definition: TtEvent.h:124
const reco::GenParticle * lightQBar() const
get light Q bar of the TtGenEvent
const math::XYZTLorentzVector * topPair() const
get combined 4-vector of top and topBar from the TtGenEvent
Definition: TtEvent.h:151
const reco::GenParticle * lightQ() const
get light Q of the TtGenEvent
void printParticle(edm::LogInfo &log, const char *name, const reco::Candidate *cand)
print pt, eta, phi, mass of a given candidate into an existing LogInfo
const edm::RefProd< TtGenEvent > & genEvent() const
get TtGenEvent
Definition: TtEvent.h:63
const reco::GenParticle * bBar() const
get anti-b of the TtGenEvent
void print(const int verbosity=1) const
const reco::GenParticle * lightP() const
get light P of the TtGenEvent
double genMatchSumDR(const unsigned &cmb=0) const
return the sum dr of the generator match if available; -1 else
Definition: TtEvent.h:116
const reco::GenParticle * lightPBar() const
get light P bar of the TtGenEvent
const reco::GenParticle * wMinus() const
get Wminus of the TtGenEvent
const reco::GenParticle * b() const
get b of the TtGenEvent
edm::RefProd< TtGenEvent > genEvt_
reference to TtGenEvent (has to be kept in the event!)
Definition: TtEvent.h:188
double fitProb(const unsigned &cmb=0) const
return the fit probability of hypothesis &#39;cmb&#39; if available; -1 else
Definition: TtEvent.h:128
std::vector< int > jetLeptonCombination(const std::string &key, const unsigned &cmb=0) const
return the vector of jet lepton combinatorics for a given hypothesis and class
Definition: TtEvent.h:104
bool isHypoValid(const std::string &key, const unsigned &cmb=0) const
check if hypothesis &#39;cmb&#39; within the hypothesis class was valid; if not it lead to an empty Composite...
Definition: TtEvent.h:78
const reco::GenParticle * top() const
get top of the TtGenEvent
std::map< HypoClassKey, std::vector< HypoCombPair > > evtHyp_
Definition: TtEvent.h:191
double genMatchSumPt(const unsigned &cmb=0) const
return the sum pt of the generator match if available; -1 else
Definition: TtEvent.h:112
const reco::GenParticle * topBar() const
get anti-top of the TtGenEvent
const reco::GenParticle * wPlus() const
get Wplus of the TtGenEvent