CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/AnalysisDataFormats/TopObjects/src/TtSemiLeptonicEvent.cc

Go to the documentation of this file.
00001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00002 #include "AnalysisDataFormats/TopObjects/interface/TtSemiLeptonicEvent.h"
00003 #include "AnalysisDataFormats/TopObjects/interface/TtSemiLepEvtPartons.h"
00004 
00005 // print info via MessageLogger
00006 void
00007 TtSemiLeptonicEvent::print(const int verbosity) const
00008 {
00009   if(verbosity%10 <= 0)
00010     return;
00011 
00012   edm::LogInfo log("TtSemiLeptonicEvent");
00013 
00014   log << "++++++++++++++++++++++++++++++++++++++++++++++++++ \n";
00015 
00016   // get some information from the genEvent (if available)
00017   if( !genEvt_ ) log << " TtGenEvent not available! \n";
00018   else {
00019     log << " TtGenEvent says: ";
00020     if( !this->genEvent()->isTtBar() )            log << "Not TtBar";
00021     else if( this->genEvent()->isFullHadronic() ) log << "Fully Hadronic TtBar";
00022     else if( this->genEvent()->isFullLeptonic() ) log << "Fully Leptonic TtBar";
00023     else if( this->genEvent()->isSemiLeptonic() ) {
00024       log << "Semi-leptonic TtBar, ";
00025       switch( this->genEvent()->semiLeptonicChannel() ) {
00026       case WDecay::kElec : log << "Electron"; break;
00027       case WDecay::kMuon : log << "Muon"    ; break;
00028       case WDecay::kTau  : log << "Tau"     ; break;
00029       default            : log << "Unknown" ; break;
00030       }
00031       log << " Channel";
00032     }
00033     log << "\n";
00034   }
00035 
00036   // get number of available hypothesis classes
00037   log << " Number of available event hypothesis classes: " << this->numberOfAvailableHypoClasses() << " \n";
00038 
00039   // create a legend for the jetLepComb
00040   log << " - JetLepComb: ";
00041   for(unsigned idx = 0; idx < 5; idx++) {
00042     switch(idx) {
00043     case TtSemiLepEvtPartons::LightQ    : log << "LightP "; break;
00044     case TtSemiLepEvtPartons::LightQBar : log << "LightQ "; break;
00045     case TtSemiLepEvtPartons::HadB      : log << " HadB  "; break;
00046     case TtSemiLepEvtPartons::LepB      : log << " LepB  "; break;
00047     case TtSemiLepEvtPartons::Lepton    : log << "Lepton "; break;
00048     }
00049   }
00050   log << "\n";
00051 
00052   // get details from the hypotheses
00053   typedef std::map<HypoClassKey, std::vector<HypoCombPair> >::const_iterator EventHypo;
00054   for(EventHypo hyp = evtHyp_.begin(); hyp != evtHyp_.end(); ++hyp) {
00055     HypoClassKey hypKey = (*hyp).first;
00056     // header for each hypothesis
00057     log << "-------------------------------------------------- \n";
00058     switch(hypKey) {
00059     case kGeom              : log << " Geom"             ; break;
00060     case kWMassDeltaTopMass : log << " WMassDeltaTopMass"; break;
00061     case kWMassMaxSumPt     : log << " WMassMaxSumPt"    ; break;
00062     case kMaxSumPtWMass     : log << " MaxSumPtWMass"    ; break;
00063     case kGenMatch          : log << " GenMatch"         ; break;
00064     case kMVADisc           : log << " MVADisc"          ; break;
00065     case kKinFit            : log << " KinFit"           ; break;
00066     default                 : log << " Unknown";
00067     }
00068     log << "-Hypothesis: \n";
00069     log << " * Number of real neutrino solutions: " << this->numberOfRealNeutrinoSolutions(hypKey) << "\n";
00070     unsigned nOfHyp = this->numberOfAvailableHypos(hypKey);
00071     if(nOfHyp > 1) {
00072       log << " * Number of available jet combinations: " << nOfHyp << "\n";
00073       if(verbosity < 10)
00074         log << " The following was found to be the best one:\n";
00075     }
00076     // if verbosity level is smaller than 10, never show more than the best jet combination
00077     if(verbosity < 10)
00078       nOfHyp = 1;
00079     for(unsigned cmb=0; cmb<nOfHyp; cmb++) {
00080       // check if hypothesis is valid
00081       if( !this->isHypoValid(hypKey, cmb) )
00082         log << " * Not valid! \n";
00083       // get meta information for valid hypothesis
00084       else {
00085         // jetLepComb
00086         log << " * JetLepComb:";
00087         std::vector<int> jets = this->jetLeptonCombination(hypKey, cmb);
00088         for(unsigned int iJet = 0; iJet < jets.size(); iJet++) {
00089           log << "   " << jets[iJet] << "   ";
00090         }
00091         log << "\n";
00092         // specialties for some hypotheses
00093         switch(hypKey) {
00094         case kGenMatch : log << " * Sum(DeltaR) : " << this->genMatchSumDR(cmb) << " \n"
00095                              << " * Sum(DeltaPt): " << this->genMatchSumPt(cmb) << " \n"; break;
00096         case kMVADisc  : log << " * Method  : "     << this->mvaMethod()        << " \n"
00097                              << " * Discrim.: "     << this->mvaDisc(cmb)       << " \n"; break;
00098         case kKinFit   : log << " * Chi^2      : "  << this->fitChi2(cmb)       << " \n"
00099                              << " * Prob(Chi^2): "  << this->fitProb(cmb)       << " \n"; break;
00100         default        : break;
00101         }
00102         // kinematic quantities of particles (if last digit of verbosity level > 1)
00103         if(verbosity%10 >= 2) {
00104           log << " * Candidates (pt; eta; phi; mass):\n";
00105           printParticle(log, "hadronic top", this->hadronicDecayTop(hypKey, cmb));
00106           printParticle(log, "hadronic W  ", this->hadronicDecayW  (hypKey, cmb));
00107           if(verbosity%10 >= 3) {
00108             printParticle(log, "hadronic b  ", this->hadronicDecayB       (hypKey, cmb));
00109             printParticle(log, "hadronic p  ", this->hadronicDecayQuark   (hypKey, cmb));
00110             printParticle(log, "hadronic q  ", this->hadronicDecayQuarkBar(hypKey, cmb));
00111           }
00112           printParticle(log, "leptonic top", this->leptonicDecayTop(hypKey, cmb));
00113           printParticle(log, "leptonic W  ", this->leptonicDecayW  (hypKey, cmb));
00114           if(verbosity%10 >= 3) {
00115             printParticle(log, "leptonic b  ", this->leptonicDecayB(hypKey, cmb));
00116             printParticle(log, "lepton      ", this->singleLepton  (hypKey, cmb));
00117             printParticle(log, "neutrino    ", this->singleNeutrino(hypKey, cmb));
00118           }
00119         }
00120       }
00121     }
00122   }
00123 
00124   log << "++++++++++++++++++++++++++++++++++++++++++++++++++";  
00125 }