CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoTauTag/RecoTau/src/PFTauDecayModeTools.cc

Go to the documentation of this file.
00001 #include "RecoTauTag/RecoTau/interface/PFTauDecayModeTools.h"
00002 
00003 namespace reco { namespace tau {
00004 
00005 unsigned int chargedHadronsInDecayMode(PFTau::hadronicDecayMode mode) {
00006    int modeAsInt = static_cast<int>(mode);
00007    return (modeAsInt / PFTau::kOneProngNPiZero) + 1;
00008 }
00009 
00010 unsigned int piZerosInDecayMode(PFTau::hadronicDecayMode mode) {
00011    int modeAsInt = static_cast<int>(mode);
00012    return (modeAsInt % PFTau::kOneProngNPiZero);
00013 }
00014 
00015 PFTau::hadronicDecayMode translateDecayMode(
00016     unsigned int nCharged, unsigned int nPiZeros) {
00017    // If no tracks exist, this is definitely not a tau!
00018    if(!nCharged) return PFTau::kNull;
00019    // Find the maximum number of PiZeros our parameterization can hold
00020    const unsigned int maxPiZeros = PFTau::kOneProngNPiZero;
00021    // Determine our track index
00022    unsigned int trackIndex = (nCharged-1)*(maxPiZeros+1);
00023    // Check if we handle the given number of tracks
00024    if(trackIndex >= PFTau::kRareDecayMode) return PFTau::kRareDecayMode;
00025 
00026    nPiZeros = (nPiZeros <= maxPiZeros) ? nPiZeros : maxPiZeros;
00027    return static_cast<PFTau::hadronicDecayMode>(trackIndex + nPiZeros);
00028 }
00029 
00030 }} // end namespace reco::tau