Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:23

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "AnalysisDataFormats/TopObjects/interface/TtFullHadronicEvent.h"
0003 #include "AnalysisDataFormats/TopObjects/interface/TtFullHadEvtPartons.h"
0004 
0005 #include "printParticle.h"
0006 using ttevent::printParticle;
0007 
0008 // print info via MessageLogger
0009 void TtFullHadronicEvent::print(const int verbosity) const {
0010   if (verbosity % 10 <= 0)
0011     return;
0012 
0013   edm::LogInfo log("TtFullHadronicEvent");
0014 
0015   log << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \n";
0016 
0017   // get some information from the genEvent
0018   if (!genEvt_)
0019     log << " TtGenEvent not available! \n";
0020   else {
0021     log << " TtGenEvent says: ";
0022     if (!this->genEvent()->isTtBar())
0023       log << "Not TtBar";
0024     else if (this->genEvent()->isFullHadronic())
0025       log << "Fully Hadronic TtBar";
0026     else if (this->genEvent()->isSemiLeptonic())
0027       log << "Semi-leptonic TtBar";
0028     else if (this->genEvent()->isFullLeptonic())
0029       log << "Fully Leptonic TtBar";
0030     log << "\n";
0031   }
0032   // get number of available hypothesis classes
0033   log << " Number of available event hypothesis classes: " << this->numberOfAvailableHypoClasses() << " \n";
0034 
0035   // create a legend for the jetLepComb
0036   log << " - JetCombi    : ";
0037   for (unsigned idx = 0; idx < 6; idx++) {
0038     switch (idx) {
0039       case TtFullHadEvtPartons::LightQ:
0040         log << "  LightQ  ";
0041         break;
0042       case TtFullHadEvtPartons::LightQBar:
0043         log << " LightQBar";
0044         break;
0045       case TtFullHadEvtPartons::B:
0046         log << "     B    ";
0047         break;
0048       case TtFullHadEvtPartons::LightP:
0049         log << "   LightP ";
0050         break;
0051       case TtFullHadEvtPartons::LightPBar:
0052         log << " LightPBar";
0053         break;
0054       case TtFullHadEvtPartons::BBar:
0055         log << "    BBar  ";
0056         break;
0057     }
0058   }
0059   log << "\n";
0060 
0061   // get details from the hypotheses
0062   typedef std::map<HypoClassKey, std::vector<HypoCombPair> >::const_iterator EventHypo;
0063   for (EventHypo hyp = evtHyp_.begin(); hyp != evtHyp_.end(); ++hyp) {
0064     HypoClassKey hypKey = (*hyp).first;
0065     // header for each hypothesis
0066     log << "---------------------------------------------------------------------------- \n";
0067     switch (hypKey) {
0068       case kGeom:
0069         log << " Geom not (yet) applicable to TtFullHadronicEvent --> skipping";
0070         continue;
0071       case kWMassMaxSumPt:
0072         log << " WMassMaxSumPt not (yet) applicable to TtFullHadronicEvent --> skipping";
0073         continue;
0074       case kMaxSumPtWMass:
0075         log << " MaxSumPtWMass not (yet) applicable to TtFullHadronicEvent --> skipping";
0076         continue;
0077       case kGenMatch:
0078         log << " GenMatch";
0079         break;
0080       case kMVADisc:
0081         log << " MVADisc not (yet) applicable to TtFullHadronicEvent --> skipping";
0082         continue;
0083       case kKinFit:
0084         log << " KinFit";
0085         break;
0086       case kKinSolution:
0087         log << " KinSolution not (yet) applicable to TtFullHadronicEvent --> skipping";
0088         continue;
0089       case kWMassDeltaTopMass:
0090         log << " WMassDeltaTopMass not (yet) applicable to TtFullHadronicEvent --> skipping";
0091         continue;
0092       case kHitFit:
0093         log << " HitFit not (yet) applicable to TtFullHadronicEvent --> skipping";
0094         continue;
0095       default:
0096         log << " Unknown TtEvent::HypoClassKey provided --> skipping";
0097         continue;
0098     }
0099     log << "-Hypothesis: \n";
0100     unsigned nOfHyp = this->numberOfAvailableHypos(hypKey);
0101     if (nOfHyp > 1) {
0102       log << " * Number of available jet combinations: " << nOfHyp << " \n";
0103       if (verbosity < 10)
0104         log << " The following was found to be the best one: \n";
0105     }
0106     // if verbosity level is smaller than 10, never show more than the best jet combination
0107     if (verbosity < 10)
0108       nOfHyp = 1;
0109     for (unsigned cmb = 0; cmb < nOfHyp; ++cmb) {
0110       // check if hypothesis is valid
0111       if (!this->isHypoValid(hypKey, cmb))
0112         log << " * Not valid! \n";
0113       // get meta information for valid hypothesis
0114       else {
0115         // jetLepComb
0116         log << " * JetCombi    :";
0117         std::vector<int> jets = this->jetLeptonCombination(hypKey, cmb);
0118         for (unsigned int iJet = 0; iJet < jets.size(); iJet++) {
0119           log << "      " << jets[iJet] << "   ";
0120         }
0121         log << "\n";
0122         // specialties for some hypotheses
0123         switch (hypKey) {
0124           case kGenMatch:
0125             log << " * Sum(DeltaR) : " << this->genMatchSumDR(cmb) << " \n"
0126                 << " * Sum(DeltaPt): " << this->genMatchSumPt(cmb) << " \n";
0127             break;
0128           case kKinFit:
0129             log << " * Chi^2       : " << this->fitChi2(cmb) << " \n"
0130                 << " * Prob(Chi^2) : " << this->fitProb(cmb) << " \n";
0131             break;
0132           default:
0133             break;
0134         }
0135         // kinematic quantities of particles (if last digit of verbosity level > 1)
0136         if (verbosity % 10 >= 2) {
0137           log << " * Candidates (pt; eta; phi; mass) :\n";
0138           if (verbosity % 10 >= 3)
0139             printParticle(log, "top pair", this->topPair(hypKey, cmb));
0140           printParticle(log, "top       ", this->top(hypKey, cmb));
0141           printParticle(log, "W plus    ", this->wPlus(hypKey, cmb));
0142           if (verbosity % 10 >= 3) {
0143             printParticle(log, "b         ", this->b(hypKey, cmb));
0144             printParticle(log, "lightQ    ", this->lightQ(hypKey, cmb));
0145             printParticle(log, "lightQBar ", this->lightQBar(hypKey, cmb));
0146           }
0147           printParticle(log, "topBar    ", this->topBar(hypKey, cmb));
0148           printParticle(log, "W minus   ", this->wMinus(hypKey, cmb));
0149           if (verbosity % 10 >= 3) {
0150             printParticle(log, "bBar      ", this->bBar(hypKey, cmb));
0151             printParticle(log, "lightP    ", this->lightP(hypKey, cmb));
0152             printParticle(log, "lightPBar ", this->lightPBar(hypKey, cmb));
0153           }
0154         }
0155       }
0156     }
0157   }
0158   log << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
0159 }