Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "AnalysisDataFormats/TopObjects/interface/TtSemiLeptonicEvent.h"
0003 #include "AnalysisDataFormats/TopObjects/interface/TtSemiLepEvtPartons.h"
0004 
0005 #include "printParticle.h"
0006 using ttevent::printParticle;
0007 
0008 // print info via MessageLogger
0009 void TtSemiLeptonicEvent::print(const int verbosity) const {
0010   if (verbosity % 10 <= 0)
0011     return;
0012 
0013   edm::LogInfo log("TtSemiLeptonicEvent");
0014 
0015   log << "++++++++++++++++++++++++++++++++++++++++++++++++++ \n";
0016 
0017   // get some information from the genEvent (if available)
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()->isFullLeptonic())
0027       log << "Fully Leptonic TtBar";
0028     else if (this->genEvent()->isSemiLeptonic()) {
0029       log << "Semi-leptonic TtBar, ";
0030       switch (this->genEvent()->semiLeptonicChannel()) {
0031         case WDecay::kElec:
0032           log << "Electron";
0033           break;
0034         case WDecay::kMuon:
0035           log << "Muon";
0036           break;
0037         case WDecay::kTau:
0038           log << "Tau";
0039           break;
0040         default:
0041           log << "Unknown";
0042           break;
0043       }
0044       log << " Channel";
0045     }
0046     log << "\n";
0047   }
0048 
0049   // get number of available hypothesis classes
0050   log << " Number of available event hypothesis classes: " << this->numberOfAvailableHypoClasses() << " \n";
0051 
0052   // create a legend for the jetLepComb
0053   log << " - JetLepComb: ";
0054   for (unsigned idx = 0; idx < 5; idx++) {
0055     switch (idx) {
0056       case TtSemiLepEvtPartons::LightQ:
0057         log << "LightP ";
0058         break;
0059       case TtSemiLepEvtPartons::LightQBar:
0060         log << "LightQ ";
0061         break;
0062       case TtSemiLepEvtPartons::HadB:
0063         log << " HadB  ";
0064         break;
0065       case TtSemiLepEvtPartons::LepB:
0066         log << " LepB  ";
0067         break;
0068       case TtSemiLepEvtPartons::Lepton:
0069         log << "Lepton ";
0070         break;
0071     }
0072   }
0073   log << "\n";
0074 
0075   // get details from the hypotheses
0076   typedef std::map<HypoClassKey, std::vector<HypoCombPair> >::const_iterator EventHypo;
0077   for (EventHypo hyp = evtHyp_.begin(); hyp != evtHyp_.end(); ++hyp) {
0078     HypoClassKey hypKey = (*hyp).first;
0079     // header for each hypothesis
0080     log << "-------------------------------------------------- \n";
0081     switch (hypKey) {
0082       case kGeom:
0083         log << " Geom";
0084         break;
0085       case kWMassMaxSumPt:
0086         log << " WMassMaxSumPt";
0087         break;
0088       case kMaxSumPtWMass:
0089         log << " MaxSumPtWMass";
0090         break;
0091       case kGenMatch:
0092         log << " GenMatch";
0093         break;
0094       case kMVADisc:
0095         log << " MVADisc";
0096         break;
0097       case kKinFit:
0098         log << " KinFit";
0099         break;
0100       case kKinSolution:
0101         log << " KinSolution not (yet) applicable to TtSemiLeptonicEvent --> skipping";
0102         continue;
0103       case kWMassDeltaTopMass:
0104         log << " WMassDeltaTopMass";
0105         break;
0106       case kHitFit:
0107         log << " HitFit";
0108         break;
0109       default:
0110         log << " Unknown TtEvent::HypoClassKey provided --> skipping";
0111         continue;
0112     }
0113     log << "-Hypothesis: \n";
0114     log << " * Number of real neutrino solutions: " << this->numberOfRealNeutrinoSolutions(hypKey) << "\n";
0115     log << " * Number of considered jets        : " << this->numberOfConsideredJets(hypKey) << "\n";
0116     unsigned nOfHyp = this->numberOfAvailableHypos(hypKey);
0117     if (nOfHyp > 1) {
0118       log << " * Number of stored jet combinations: " << nOfHyp << "\n";
0119       if (verbosity < 10)
0120         log << " The following was found to be the best one:\n";
0121     }
0122     // if verbosity level is smaller than 10, never show more than the best jet combination
0123     if (verbosity < 10)
0124       nOfHyp = 1;
0125     for (unsigned cmb = 0; cmb < nOfHyp; cmb++) {
0126       // check if hypothesis is valid
0127       if (!this->isHypoValid(hypKey, cmb))
0128         log << " * Not valid! \n";
0129       // get meta information for valid hypothesis
0130       else {
0131         // jetLepComb
0132         log << " * JetLepComb:";
0133         std::vector<int> jets = this->jetLeptonCombination(hypKey, cmb);
0134         for (unsigned int iJet = 0; iJet < jets.size(); iJet++) {
0135           log << "   " << jets[iJet] << "   ";
0136         }
0137         log << "\n";
0138         // specialties for some hypotheses
0139         switch (hypKey) {
0140           case kGenMatch:
0141             log << " * Sum(DeltaR) : " << this->genMatchSumDR(cmb) << " \n"
0142                 << " * Sum(DeltaPt): " << this->genMatchSumPt(cmb) << " \n";
0143             break;
0144           case kMVADisc:
0145             log << " * Method  : " << this->mvaMethod() << " \n"
0146                 << " * Discrim.: " << this->mvaDisc(cmb) << " \n";
0147             break;
0148           case kKinFit:
0149             log << " * Chi^2      : " << this->fitChi2(cmb) << " \n"
0150                 << " * Prob(Chi^2): " << this->fitProb(cmb) << " \n";
0151             break;
0152           case kHitFit:
0153             log << " * Chi^2      : " << this->hitFitChi2(cmb) << " \n"
0154                 << " * Prob(Chi^2): " << this->hitFitProb(cmb) << " \n"
0155                 << " * Top mass   : " << this->hitFitMT(cmb) << " +/- " << this->hitFitSigMT(cmb) << " \n";
0156             break;
0157           default:
0158             break;
0159         }
0160         // kinematic quantities of particles (if last digit of verbosity level > 1)
0161         if (verbosity % 10 >= 2) {
0162           log << " * Candidates (pt; eta; phi; mass):\n";
0163           if (verbosity % 10 >= 3)
0164             printParticle(log, "top pair", this->topPair(hypKey, cmb));
0165           printParticle(log, "hadronic top", this->hadronicDecayTop(hypKey, cmb));
0166           printParticle(log, "hadronic W  ", this->hadronicDecayW(hypKey, cmb));
0167           if (verbosity % 10 >= 3) {
0168             printParticle(log, "hadronic b  ", this->hadronicDecayB(hypKey, cmb));
0169             printParticle(log, "hadronic p  ", this->hadronicDecayQuark(hypKey, cmb));
0170             printParticle(log, "hadronic q  ", this->hadronicDecayQuarkBar(hypKey, cmb));
0171           }
0172           printParticle(log, "leptonic top", this->leptonicDecayTop(hypKey, cmb));
0173           printParticle(log, "leptonic W  ", this->leptonicDecayW(hypKey, cmb));
0174           if (verbosity % 10 >= 3) {
0175             printParticle(log, "leptonic b  ", this->leptonicDecayB(hypKey, cmb));
0176             printParticle(log, "lepton      ", this->singleLepton(hypKey, cmb));
0177             printParticle(log, "neutrino    ", this->singleNeutrino(hypKey, cmb));
0178           }
0179         }
0180       }
0181     }
0182   }
0183 
0184   log << "++++++++++++++++++++++++++++++++++++++++++++++++++";
0185 }