CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CalculateHLT Class Reference

#include <TopHLTDQMHelper.h>

List of all members.

Public Member Functions

 CalculateHLT (int maxNJets, double wMass)
 default constructor
double masslb (reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
 calculate mlb estimate
double massTopQuark (const std::vector< reco::Jet > &jets)
 calculate top quark mass estimate
double massWBoson (const std::vector< reco::Jet > &jets)
 calculate W boson mass estimate
double tmassTopQuark (reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
 calculate top quark transverse mass estimate
double tmassWBoson (reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
 ~CalculateHLT ()
 default destructor

Private Member Functions

void operator() (const std::vector< reco::Jet > &jets)
void operator() (const reco::Jet &bJet, reco::RecoCandidate *lepton, const reco::MET &met)

Private Attributes

bool failed_
 indicate failed associations
double massTopQuark_
 cache of top quark mass estimate
double massWBoson_
 cache of w boson mass estimate
int maxNJets_
 max. number of jets to be considered
double mlb_
 cache of mlb estimate
double tmassTopQuark_
 cache of top quark transverse mass estimate
double tmassWBoson_
 cache of W boson transverse mass estimate
double wMass_
 paramater of the w boson mass

Detailed Description

Definition at line 67 of file TopHLTDQMHelper.h.


Constructor & Destructor Documentation

CalculateHLT::CalculateHLT ( int  maxNJets,
double  wMass 
)

default constructor

Definition at line 7 of file TopHLTDQMHelper.cc.

                                                    : 
  failed_(false), maxNJets_(maxNJets), wMass_(wMass), massWBoson_(-1.), massTopQuark_(-1.),tmassWBoson_(-1),tmassTopQuark_(-1),mlb_(-1)
{
}
CalculateHLT::~CalculateHLT ( ) [inline]

default destructor

Definition at line 72 of file TopHLTDQMHelper.h.

{};

Member Function Documentation

double CalculateHLT::masslb ( reco::RecoCandidate mu,
const reco::MET met,
const reco::Jet b 
)

calculate mlb estimate

Definition at line 66 of file TopHLTDQMHelper.cc.

References failed_, mlb_, and operator()().

Referenced by TopHLTSingleLepton::MonitorEnsemble::fill().

{
  if(!failed_&& mlb_<0) operator()(b,mu,met); return mlb_;
}
double CalculateHLT::massTopQuark ( const std::vector< reco::Jet > &  jets)

calculate top quark mass estimate

Definition at line 21 of file TopHLTDQMHelper.cc.

References failed_, massTopQuark_, and operator()().

Referenced by TopHLTSingleLepton::MonitorEnsemble::fill().

double CalculateHLT::massWBoson ( const std::vector< reco::Jet > &  jets)

calculate W boson mass estimate

Definition at line 14 of file TopHLTDQMHelper.cc.

References failed_, massWBoson_, and operator()().

Referenced by TopHLTSingleLepton::MonitorEnsemble::fill().

void CalculateHLT::operator() ( const reco::Jet bJet,
reco::RecoCandidate lepton,
const reco::MET met 
) [private]

Definition at line 79 of file TopHLTDQMHelper.cc.

References gather_cfg::cout, mlb_, reco::LeafCandidate::p4(), funct::pow(), reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), mathSSE::sqrt(), tmassTopQuark_, and tmassWBoson_.

                                                                                                {
  double metT = sqrt(pow(met.px(),2) + pow(met.py(),2));
  double lepT = sqrt(pow(lepton->px(),2) + pow(lepton->py(),2));
  double bT   = sqrt(pow(bJet.px(),2) + pow(bJet.py(),2));
  reco::Particle::LorentzVector WT = lepton->p4() + met.p4();
  cout<<"in calculate:\n\t"<<bJet.pt()<<"\t"<<lepton->pt()<<"\t"<<met.pt()<<endl;
  tmassWBoson_ = sqrt(pow(metT+lepT,2) - (WT.px()*WT.px()) - (WT.py()*WT.py()));        
  reco::Particle::LorentzVector topT = WT + bJet.p4();
  tmassTopQuark_ = sqrt(pow((metT+lepT+bT),2) - (topT.px()*topT.px()) - (topT.py()*topT.py()));
  reco::Particle::LorentzVector lb = bJet.p4() + lepton->p4();  
  mlb_ = lb.mass();
}
void CalculateHLT::operator() ( const std::vector< reco::Jet > &  jets) [private]

do the calculation; this is called only once per event by the first function call to return a mass estimate. The once calculated values are cached afterwards

Definition at line 94 of file TopHLTDQMHelper.cc.

References failed_, customizeTrackingMonitorSeedNumber::idx, massTopQuark_, massWBoson_, maxNJets_, and wMass_.

Referenced by masslb(), massTopQuark(), massWBoson(), tmassTopQuark(), and tmassWBoson().

{
  
  if(maxNJets_<0) maxNJets_=jets.size();
  failed_= jets.size()<(unsigned int) maxNJets_;
  if( failed_){ return; }

  // associate those jets with maximum pt of the vectorial 
  // sum to the hadronic decay chain
  double maxPt=-1.;
  std::vector<int> maxPtIndices;
  maxPtIndices.push_back(-1);
  maxPtIndices.push_back(-1);
  maxPtIndices.push_back(-1);
  for(int idx=0; idx<maxNJets_; ++idx){
    for(int jdx=0; jdx<maxNJets_; ++jdx){ if(jdx<=idx) continue;
      for(int kdx=0; kdx<maxNJets_; ++kdx){ if(kdx==idx || kdx==jdx) continue;
        reco::Particle::LorentzVector sum = jets[idx].p4()+jets[jdx].p4()+jets[kdx].p4();
        if( maxPt<0. || maxPt<sum.pt() ){
          maxPt=sum.pt();
          maxPtIndices.clear();
          maxPtIndices.push_back(idx);
          maxPtIndices.push_back(jdx);
          maxPtIndices.push_back(kdx);
        }
      }
    }
  }
  massTopQuark_= (jets[maxPtIndices[0]].p4()+
                  jets[maxPtIndices[1]].p4()+
                  jets[maxPtIndices[2]].p4()).mass();

  // associate those jets that get closest to the W mass
  // with their invariant mass to the W boson
  double wDist =-1.;
  std::vector<int> wMassIndices;
  wMassIndices.push_back(-1);
  wMassIndices.push_back(-1);
  for(unsigned idx=0; idx<maxPtIndices.size(); ++idx){  
    for(unsigned jdx=0; jdx<maxPtIndices.size(); ++jdx){  
      if( jdx==idx || maxPtIndices[idx]>maxPtIndices[jdx] ) continue;
        reco::Particle::LorentzVector sum = jets[maxPtIndices[idx]].p4()+jets[maxPtIndices[jdx]].p4();
        if( wDist<0. || wDist>fabs(sum.mass()-wMass_) ){
          wDist=fabs(sum.mass()-wMass_);
          wMassIndices.clear();
          wMassIndices.push_back(maxPtIndices[idx]);
          wMassIndices.push_back(maxPtIndices[jdx]);
        }
    }
  }
  massWBoson_= (jets[wMassIndices[0]].p4()+
                jets[wMassIndices[1]].p4()).mass();
}
double CalculateHLT::tmassTopQuark ( reco::RecoCandidate mu,
const reco::MET met,
const reco::Jet b 
)

calculate top quark transverse mass estimate

Definition at line 73 of file TopHLTDQMHelper.cc.

References failed_, operator()(), and tmassTopQuark_.

Referenced by TopHLTSingleLepton::MonitorEnsemble::fill().

{
  if(!failed_&& tmassTopQuark_<0) operator()(b,lepton,met); return tmassTopQuark_;
}
double CalculateHLT::tmassWBoson ( reco::RecoCandidate mu,
const reco::MET met,
const reco::Jet b 
)

calculate W boson transverse mass estimate

Definition at line 59 of file TopHLTDQMHelper.cc.

References failed_, operator()(), and tmassWBoson_.

Referenced by TopHLTSingleLepton::MonitorEnsemble::fill().

{
  if(!failed_&& tmassWBoson_<0) operator()(b,mu,met); return tmassWBoson_;
}

Member Data Documentation

bool CalculateHLT::failed_ [private]

indicate failed associations

Definition at line 100 of file TopHLTDQMHelper.h.

Referenced by masslb(), massTopQuark(), massWBoson(), operator()(), tmassTopQuark(), and tmassWBoson().

double CalculateHLT::massTopQuark_ [private]

cache of top quark mass estimate

Definition at line 108 of file TopHLTDQMHelper.h.

Referenced by massTopQuark(), and operator()().

double CalculateHLT::massWBoson_ [private]

cache of w boson mass estimate

Definition at line 106 of file TopHLTDQMHelper.h.

Referenced by massWBoson(), and operator()().

int CalculateHLT::maxNJets_ [private]

max. number of jets to be considered

Definition at line 102 of file TopHLTDQMHelper.h.

Referenced by operator()().

double CalculateHLT::mlb_ [private]

cache of mlb estimate

Definition at line 114 of file TopHLTDQMHelper.h.

Referenced by masslb(), and operator()().

double CalculateHLT::tmassTopQuark_ [private]

cache of top quark transverse mass estimate

Definition at line 112 of file TopHLTDQMHelper.h.

Referenced by operator()(), and tmassTopQuark().

double CalculateHLT::tmassWBoson_ [private]

cache of W boson transverse mass estimate

Definition at line 110 of file TopHLTDQMHelper.h.

Referenced by operator()(), and tmassWBoson().

double CalculateHLT::wMass_ [private]

paramater of the w boson mass

Definition at line 104 of file TopHLTDQMHelper.h.

Referenced by operator()().