CMS 3D CMS Logo

Public Member Functions | Private Attributes

JetBProbabilityComputer Class Reference

#include <JetBProbabilityComputer.h>

Inheritance diagram for JetBProbabilityComputer:
JetTagComputer

List of all members.

Public Member Functions

float discriminator (const TagInfoHelper &ti) const
 JetBProbabilityComputer (const edm::ParameterSet &parameters)
double jetProbability (const std::vector< float > &v) const

Private Attributes

double m_cutMaxDecayLen
double m_cutMaxDistToAxis
double m_deltaR
int m_ipType
double m_minTrackProb
unsigned int m_nbTracks
reco::TrackBase::TrackQuality m_trackQuality
int m_trackSign
bool m_useAllQualities
bool useVariableJTA_
reco::TrackIPTagInfo::variableJTAParameters varJTApars

Detailed Description

Definition at line 13 of file JetBProbabilityComputer.h.


Constructor & Destructor Documentation

JetBProbabilityComputer::JetBProbabilityComputer ( const edm::ParameterSet parameters) [inline]

Definition at line 16 of file JetBProbabilityComputer.h.

References edm::ParameterSet::getParameter(), m_cutMaxDecayLen, m_cutMaxDistToAxis, m_deltaR, m_ipType, m_minTrackProb, m_nbTracks, m_trackQuality, m_trackSign, m_useAllQualities, reco::TrackBase::qualityByName(), AlCaHLTBitMon_QueryRunRegistry::string, JetTagComputer::uses(), useVariableJTA_, and varJTApars.

  { 
     m_ipType           = parameters.getParameter<int>("impactParameterType");
     m_minTrackProb     = parameters.getParameter<double>("minimumProbability");
     m_deltaR           = parameters.getParameter<double>("deltaR");
     m_trackSign        = parameters.getParameter<int>("trackIpSign");
     m_nbTracks         = parameters.getParameter<unsigned int>("numberOfBTracks");
     m_cutMaxDecayLen   = parameters.getParameter<double>("maximumDecayLength");
     m_cutMaxDistToAxis = parameters.getParameter<double>("maximumDistanceToJetAxis");
 
     //
     // access track quality class; "any" takes everything
     //
     std::string trackQualityType = parameters.getParameter<std::string>("trackQualityClass"); //used
     m_trackQuality =  reco::TrackBase::qualityByName(trackQualityType);
     m_useAllQualities = false;
     if (trackQualityType == "any" || 
         trackQualityType == "Any" || 
         trackQualityType == "ANY" ) m_useAllQualities = true;

     useVariableJTA_    = parameters.getParameter<bool>("useVariableJTA");
     if(useVariableJTA_) 
       varJTApars = {
         parameters.getParameter<double>("a_dR"),
         parameters.getParameter<double>("b_dR"),
         parameters.getParameter<double>("a_pT"),
         parameters.getParameter<double>("b_pT"),
         parameters.getParameter<double>("min_pT"),  
         parameters.getParameter<double>("max_pT"),
         parameters.getParameter<double>("min_pT_dRcut"),  
         parameters.getParameter<double>("max_pT_dRcut"),
         parameters.getParameter<double>("max_pT_trackPTcut") };
     
     uses("ipTagInfos");
  }

Member Function Documentation

float JetBProbabilityComputer::discriminator ( const TagInfoHelper ti) const [inline, virtual]

log(all);

Reimplemented from JetTagComputer.

Definition at line 52 of file JetBProbabilityComputer.h.

References cond::ecalcond::all, b, JetTagComputer::TagInfoHelper::get(), i, reco::TrackIPTagInfo::impactParameterData(), PyquenDefaultSettings_cff::impactParameters, edm::Ref< C, T, F >::isNull(), reco::JTATagInfo::jet(), jetProbability(), funct::log(), m_ipType, m_nbTracks, m_useAllQualities, AlCaHLTBitMon_ParallelJobs::p, p4, reco::TrackIPTagInfo::primaryVertex(), reco::TrackIPTagInfo::probabilities(), reco::TrackIPTagInfo::selectedTracks(), python::multivaluedict::sort(), testEve_cfg::tracks, useVariableJTA_, reco::TrackIPTagInfo::variableJTA(), and varJTApars.

   {
      const reco::TrackIPTagInfo & tkip = ti.get<reco::TrackIPTagInfo>();
      const edm::RefVector<reco::TrackCollection> & tracks(tkip.selectedTracks());
      const std::vector<float> & allProbabilities((tkip.probabilities(m_ipType)));
      const std::vector<reco::TrackIPTagInfo::TrackIPData> & impactParameters((tkip.impactParameterData()));

      if(tkip.primaryVertex().isNull()) return 0;

      GlobalPoint pv(tkip.primaryVertex()->position().x(),tkip.primaryVertex()->position().y(),tkip.primaryVertex()->position().z());

      std::vector<float> probabilities;
      std::vector<float> probabilitiesB;
      int i=0;
      for(std::vector<float>::const_iterator it = allProbabilities.begin(); it!=allProbabilities.end(); ++it, i++)
       {
        if (fabs(impactParameters[i].distanceToJetAxis.value()) < m_cutMaxDistToAxis  &&        // distance to JetAxis
            (impactParameters[i].closestToJetAxis - pv).mag() < m_cutMaxDecayLen  &&      // max decay len
            (m_useAllQualities  == true || (*tracks[i]).quality(m_trackQuality)) // use selected track qualities
           )
         {
    // Use only positive(or negative) tracks for B
           float p=fabs(*it);
           if (useVariableJTA_) {
             if (tkip.variableJTA( varJTApars  )[i]) {
               if(m_trackSign>0 || *it <0 ) probabilities.push_back(p); //Use all tracks for positive tagger and only negative for negative tagger      
               if(m_trackSign>0 && *it >=0){probabilitiesB.push_back(*it);} //Use only positive tracks for positive tagger
               if(m_trackSign<0 && *it <=0){probabilitiesB.push_back(- *it);} //Use only negative tracks for negative tagger 
             }
           }
           else
             if( m_deltaR < 0 || ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR)
               {
                 //if(m_trackSign>0 || *it >0 ) probabilities.push_back(p); //Use all tracks for positive tagger and only negative for negative tagger
                 if(m_trackSign>0 || *it <0 ) probabilities.push_back(p); //Use all tracks for positive tagger and only negative for negative tagger
                 
                 if(m_trackSign>0 && *it >=0){probabilitiesB.push_back(*it);} //Use only positive tracks for positive tagger
                 if(m_trackSign<0 && *it <=0){probabilitiesB.push_back(- *it);} //Use only negative tracks for negative tagger 
               }
         }
       }

      float all = jetProbability(probabilities); 
      std::sort(probabilitiesB.begin(), probabilitiesB.end());
      if(probabilitiesB.size() > m_nbTracks )  probabilitiesB.resize(m_nbTracks);
      float b = jetProbability(probabilitiesB);
        
      return -log(b)/4-log(all)/4; 
   }
double JetBProbabilityComputer::jetProbability ( const std::vector< float > &  v) const [inline]

Definition at line 102 of file JetBProbabilityComputer.h.

References gather_cfg::cout, funct::exp(), prof2calltree::l, funct::log(), m_minTrackProb, max(), min, and lumiQueryAPI::q.

Referenced by discriminator().

{
   int ngoodtracks=v.size();
   double SumJet=0.;

  for(std::vector<float>::const_iterator q = v.begin(); q != v.end(); q++){
    SumJet+=(*q>m_minTrackProb)?log(*q):log(m_minTrackProb);
  }

  double ProbJet;
  double Loginvlog=0;

  if(SumJet<0.){
    if(ngoodtracks>=2){
      Loginvlog=log(-SumJet);
    }
    double Prob=1.;
    double lfact=1.;
    for(int l=1; l!=ngoodtracks; l++){
       lfact*=l;
      Prob+=exp(l*Loginvlog-log(1.*lfact));
    }
    double LogProb=log(Prob);
    ProbJet=
      std::min(exp(std::max(LogProb+SumJet,-30.)),1.);
  }else{
    ProbJet=1.;
  }
  if(ProbJet>1)
   std::cout << "ProbJet too high: "  << ProbJet << std::endl;

  //double LogProbJet=-log(ProbJet);
  //  //return 1.-ProbJet;
      return ProbJet;
  }

Member Data Documentation

Definition at line 145 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

Definition at line 146 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

Definition at line 142 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

Definition at line 141 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().

Definition at line 140 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer(), and jetProbability().

unsigned int JetBProbabilityComputer::m_nbTracks [private]

Definition at line 144 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().

Definition at line 147 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

Definition at line 143 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

Definition at line 148 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().

Definition at line 138 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().

Definition at line 139 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().