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