CMS 3D CMS Logo

TtFullLeptonicEvent.cc
Go to the documentation of this file.
4 
5 #include "printParticle.h"
7 
8 // print info via MessageLogger
9 void TtFullLeptonicEvent::print(const int verbosity) const {
10  if (verbosity % 10 <= 0)
11  return;
12 
13  edm::LogInfo log("TtFullLeptonicEvent");
14 
15  log << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \n";
16 
17  // get some information from the genEvent
18  log << " TtGenEvent says: ";
19  if (!this->genEvent()->isTtBar())
20  log << "Not TtBar";
21  else if (this->genEvent()->isFullHadronic())
22  log << "Fully Hadronic TtBar";
23  else if (this->genEvent()->isSemiLeptonic())
24  log << "Semi-leptonic TtBar";
25  else if (this->genEvent()->isFullLeptonic()) {
26  log << "Fully Leptonic TtBar, ";
27  switch (this->genEvent()->fullLeptonicChannel().first) {
28  case WDecay::kElec:
29  log << "Electron-";
30  break;
31  case WDecay::kMuon:
32  log << "Muon-";
33  break;
34  case WDecay::kTau:
35  log << "Tau-";
36  break;
37  default:
38  log << "Unknown-";
39  break;
40  }
41  switch (this->genEvent()->fullLeptonicChannel().second) {
42  case WDecay::kElec:
43  log << "Electron-";
44  break;
45  case WDecay::kMuon:
46  log << "Muon-";
47  break;
48  case WDecay::kTau:
49  log << "Tau-";
50  break;
51  default:
52  log << "Unknown-";
53  break;
54  }
55  log << "Channel";
56  }
57  log << "\n";
58 
59  // get number of available hypothesis classes
60  log << " Number of available event hypothesis classes: " << this->numberOfAvailableHypoClasses() << " \n";
61 
62  // create a legend for the jetLepComb
63  log << " - JetLepComb: ";
64  log << " b ";
65  log << " bbar ";
66  log << " e1(+) ";
67  log << " e2(-) ";
68  log << " mu1(+)";
69  log << " mu2(-)";
70  log << "\n";
71 
72  // get details from the hypotheses
73  typedef std::map<HypoClassKey, std::vector<HypoCombPair> >::const_iterator EventHypo;
74  for (EventHypo hyp = evtHyp_.begin(); hyp != evtHyp_.end(); ++hyp) {
75  HypoClassKey hypKey = (*hyp).first;
76  // header for each hypothesis
77  log << "------------------------------------------------------------ \n";
78  switch (hypKey) {
79  case kGeom:
80  log << " Geom not (yet) applicable to TtFullLeptonicEvent --> skipping";
81  continue;
82  case kWMassMaxSumPt:
83  log << " WMassMaxSumPt not (yet) applicable to TtFullLeptonicEvent --> skipping";
84  continue;
85  case kMaxSumPtWMass:
86  log << " MaxSumPtWMass not (yet) applicable to TtFullLeptonicEvent --> skipping";
87  continue;
88  case kGenMatch:
89  log << " GenMatch";
90  break;
91  case kMVADisc:
92  log << " MVADisc not (yet) applicable to TtFullLeptonicEvent --> skipping";
93  continue;
94  case kKinFit:
95  log << " KinFit not (yet) applicable to TtFullLeptonicEvent --> skipping";
96  continue;
97  case kKinSolution:
98  log << " KinSolution";
99  break;
100  case kWMassDeltaTopMass:
101  log << " WMassDeltaTopMass not (yet) applicable to TtFullLeptonicEvent --> skipping";
102  continue;
103  case kHitFit:
104  log << " HitFit not (yet) applicable to TtFullLeptonicEvent --> skipping";
105  continue;
106  default:
107  log << " Unknown TtEvent::HypoClassKey provided --> skipping";
108  continue;
109  }
110  log << "-Hypothesis: \n";
111  unsigned nOfHyp = this->numberOfAvailableHypos(hypKey);
112  if (nOfHyp > 1) {
113  log << " * Number of available jet combinations: " << nOfHyp << "\n";
114  if (verbosity < 10)
115  log << " The following was found to be the best one:\n";
116  }
117  // if verbosity level is smaller than 10, never show more than the best jet combination
118  if (verbosity < 10)
119  nOfHyp = 1;
120  for (unsigned cmb = 0; cmb < nOfHyp; cmb++) {
121  // check if hypothesis is valid
122  if (!this->isHypoValid(hypKey, cmb))
123  log << " * Not valid! \n";
124  // get meta information for valid hypothesis
125  else {
126  // jetLepComb
127  log << " * JetLepComb:";
128  std::vector<int> jets = this->jetLeptonCombination(hypKey, cmb);
129  for (unsigned int iJet = 0; iJet < jets.size(); iJet++) {
130  log << " " << jets[iJet] << " ";
131  }
132  log << "\n";
133  // specialties for some hypotheses
134  switch (hypKey) {
135  case kGenMatch:
136  log << " * Sum(DeltaR) : " << this->genMatchSumDR(cmb) << " \n"
137  << " * Sum(DeltaPt): " << this->genMatchSumPt(cmb) << " \n";
138  break;
139  case kKinSolution:
140  log << " * Weight : " << this->solWeight(cmb) << " \n"
141  << " * isWrongCharge: " << this->isWrongCharge() << " \n";
142  break;
143  default:
144  break;
145  }
146  // kinematic quantities of particles (if last digit of verbosity level > 1)
147  if (verbosity % 10 >= 2) {
148  log << " * Candidates (pt; eta; phi; mass):\n";
149  if (verbosity % 10 >= 3)
150  printParticle(log, "top pair", this->topPair(hypKey, cmb));
151  printParticle(log, "top ", this->top(hypKey, cmb));
152  printParticle(log, "W plus ", this->wPlus(hypKey, cmb));
153  if (verbosity % 10 >= 3) {
154  printParticle(log, "b ", this->b(hypKey, cmb));
155  printParticle(log, "leptonBar ", this->leptonBar(hypKey, cmb));
156  printParticle(log, "neutrino ", this->neutrino(hypKey, cmb));
157  }
158  printParticle(log, "topBar ", this->topBar(hypKey, cmb));
159  printParticle(log, "W minus ", this->wMinus(hypKey, cmb));
160  if (verbosity % 10 >= 3) {
161  printParticle(log, "bBar ", this->bBar(hypKey, cmb));
162  printParticle(log, "lepton ", this->lepton(hypKey, cmb));
163  printParticle(log, "neutrinoBar ", this->neutrinoBar(hypKey, cmb));
164  }
165  }
166  }
167  }
168  }
169 
170  log << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
171 }
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
const reco::Candidate * b(const std::string &key, const unsigned &cmb=0) const
get b of the given hypothesis
const reco::Candidate * leptonBar(const std::string &key, const unsigned &cmb=0) const
get anti-lepton of the given hypothesis
const reco::Candidate * neutrinoBar(const std::string &key, const unsigned &cmb=0) const
get anti-neutrino of the given hypothesis
const math::XYZTLorentzVector * topPair() const
get combined 4-vector of top and topBar from the TtGenEvent
Definition: TtEvent.h:151
const reco::Candidate * bBar(const std::string &key, const unsigned &cmb=0) const
get anti-b of the given hypothesis
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
U second(std::pair< T, U > const &p)
bool isWrongCharge() const
return if the kinematic solution of hypothesis &#39;cmb&#39; is right or wrong charge if available; -1 else ...
const reco::Candidate * top(const std::string &key, const unsigned &cmb=0) const
get top of the given hypothesis
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::Candidate * topBar(const std::string &key, const unsigned &cmb=0) const
get anti-top of the given hypothesis
const reco::Candidate * lepton(const std::string &key, const unsigned &cmb=0) const
get lepton of the given hypothesis
double solWeight(const unsigned &cmb=0) const
return the weight of the kinematic solution of hypothesis &#39;cmb&#39; if available; -1 else ...
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::Candidate * wPlus(const std::string &key, const unsigned &cmb=0) const
get Wplus of the given hypothesis
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::Candidate * wMinus(const std::string &key, const unsigned &cmb=0) const
get Wminus of the given hypothesis
const reco::Candidate * neutrino(const std::string &key, const unsigned &cmb=0) const
get neutrino of the given hypothesis
void print(const int verbosity=1) const