CMS 3D CMS Logo

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