CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/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 kWMassMaxSumPt     : log << " WMassMaxSumPt"                                                       ; break;
00061     case kMaxSumPtWMass     : log << " MaxSumPtWMass"                                                       ; break;
00062     case kGenMatch          : log << " GenMatch"                                                            ; break;
00063     case kMVADisc           : log << " MVADisc"                                                             ; break;
00064     case kKinFit            : log << " KinFit"                                                              ; break;
00065     case kKinSolution       : log << " KinSolution not (yet) applicable to TtSemiLeptonicEvent --> skipping"; continue;
00066     case kWMassDeltaTopMass : log << " WMassDeltaTopMass"                                                   ; break;
00067     case kHitFit            : log << " HitFit"                                                              ; break;
00068     default                 : log << " Unknown TtEvent::HypoClassKey provided --> skipping"                 ; continue;
00069     }
00070     log << "-Hypothesis: \n";
00071     log << " * Number of real neutrino solutions: " << this->numberOfRealNeutrinoSolutions(hypKey) << "\n";
00072     unsigned nOfHyp = this->numberOfAvailableHypos(hypKey);
00073     if(nOfHyp > 1) {
00074       log << " * Number of available jet combinations: " << nOfHyp << "\n";
00075       if(verbosity < 10)
00076         log << " The following was found to be the best one:\n";
00077     }
00078     // if verbosity level is smaller than 10, never show more than the best jet combination
00079     if(verbosity < 10)
00080       nOfHyp = 1;
00081     for(unsigned cmb=0; cmb<nOfHyp; cmb++) {
00082       // check if hypothesis is valid
00083       if( !this->isHypoValid(hypKey, cmb) )
00084         log << " * Not valid! \n";
00085       // get meta information for valid hypothesis
00086       else {
00087         // jetLepComb
00088         log << " * JetLepComb:";
00089         std::vector<int> jets = this->jetLeptonCombination(hypKey, cmb);
00090         for(unsigned int iJet = 0; iJet < jets.size(); iJet++) {
00091           log << "   " << jets[iJet] << "   ";
00092         }
00093         log << "\n";
00094         // specialties for some hypotheses
00095         switch(hypKey) {
00096         case kGenMatch : log << " * Sum(DeltaR) : " << this->genMatchSumDR(cmb) << " \n"
00097                              << " * Sum(DeltaPt): " << this->genMatchSumPt(cmb) << " \n"; break;
00098         case kMVADisc  : log << " * Method  : "     << this->mvaMethod()        << " \n"
00099                              << " * Discrim.: "     << this->mvaDisc(cmb)       << " \n"; break;
00100         case kKinFit   : log << " * Chi^2      : "  << this->fitChi2(cmb)       << " \n"
00101                              << " * Prob(Chi^2): "  << this->fitProb(cmb)       << " \n"; break;
00102         case kHitFit   : log << " * Chi^2      : "  << this->hitFitChi2(cmb)    << " \n"
00103                              << " * Prob(Chi^2): "  << this->hitFitProb(cmb)    << " \n"
00104                              << " * Top mass   : "  << this->hitFitMT(cmb)      << " +/- " << this->hitFitSigMT(cmb) << " \n"; break;
00105         default        : break;
00106         }
00107         // kinematic quantities of particles (if last digit of verbosity level > 1)
00108         if(verbosity%10 >= 2) {
00109           log << " * Candidates (pt; eta; phi; mass):\n";
00110           printParticle(log, "hadronic top", this->hadronicDecayTop(hypKey, cmb));
00111           printParticle(log, "hadronic W  ", this->hadronicDecayW  (hypKey, cmb));
00112           if(verbosity%10 >= 3) {
00113             printParticle(log, "hadronic b  ", this->hadronicDecayB       (hypKey, cmb));
00114             printParticle(log, "hadronic p  ", this->hadronicDecayQuark   (hypKey, cmb));
00115             printParticle(log, "hadronic q  ", this->hadronicDecayQuarkBar(hypKey, cmb));
00116           }
00117           printParticle(log, "leptonic top", this->leptonicDecayTop(hypKey, cmb));
00118           printParticle(log, "leptonic W  ", this->leptonicDecayW  (hypKey, cmb));
00119           if(verbosity%10 >= 3) {
00120             printParticle(log, "leptonic b  ", this->leptonicDecayB(hypKey, cmb));
00121             printParticle(log, "lepton      ", this->singleLepton  (hypKey, cmb));
00122             printParticle(log, "neutrino    ", this->singleNeutrino(hypKey, cmb));
00123           }
00124         }
00125       }
00126     }
00127   }
00128 
00129   log << "++++++++++++++++++++++++++++++++++++++++++++++++++";
00130 }