ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/JetTools.cc
(Generate patch)

Comparing UserCode/MitPhysics/Utils/src/JetTools.cc (file contents):
Revision 1.16 by pharris, Wed Mar 21 18:56:26 2012 UTC vs.
Revision 1.23 by ceballos, Thu Apr 26 10:16:24 2012 UTC

# Line 340 | Line 340 | Double_t JetTools::Beta(const TrackCol *
340   Double_t JetTools::Beta(const PFJet *jet, const Vertex *vertex, Double_t  delta_z){  
341    double Pt_jets= 0. ;
342    double Pt_jetsTot = 0. ;
343 <
343 >  
344    for(UInt_t i=0;i<jet->NPFCands();i++){
345 <    if(jet->PFCand(i)->BestTrk()){
346 <      Pt_jetsTot += jet->PFCand(i)->BestTrk()->Pt();
347 <      double pDz = TMath::Abs(jet->PFCand(i)->BestTrk()->DzCorrected(*vertex));
345 >    if(jet->PFCand(i)->TrackerTrk()){
346 >      Pt_jetsTot += jet->PFCand(i)->TrackerTrk()->Pt();
347 >      double pDz = TMath::Abs(jet->PFCand(i)->TrackerTrk()->DzCorrected(*vertex));
348        if(pDz < delta_z){
349 <        Pt_jets += jet->PFCand(i)->BestTrk()->Pt();
349 >        Pt_jets += jet->PFCand(i)->TrackerTrk()->Pt();
350        }
351      }
352    }
353  
354 <  Double_t beta = 1.0;
354 >  Double_t beta = 0.;
355    if (Pt_jetsTot > 0)
356      beta = Pt_jets/Pt_jetsTot;
357  
# Line 491 | Line 491 | Double_t JetTools::impactParameter(const
491    double lDZCorr = -1000;
492    for(UInt_t i0 = 0; i0 < iJet->NPFCands(); i0++) {
493      const PFCandidate *pCand = iJet->PFCand(i0);
494 <    if(pCand->BestTrk() == 0) continue;
495 <    if(pCand->Pt() < 1.) continue;
496 <    if(iDZ)  lDZCorr = pCand->BestTrk()->DzCorrected(*iVertex);
497 <    if(!iDZ) lDZCorr = pCand->BestTrk()->D0Corrected(*iVertex);
494 >    if(pCand->TrackerTrk() == 0) continue;
495 >    //if(pCand->Pt() < 1.) continue; => previous iterations
496 >    if(iDZ)  lDZCorr = fabs(pCand->TrackerTrk()->DzCorrected(*iVertex));
497 >    if(!iDZ) lDZCorr = fabs(pCand->TrackerTrk()->D0Corrected(*iVertex));
498      break;
499    }
500    return lDZCorr;
# Line 505 | Line 505 | Double_t JetTools::dRMean(const PFJet *i
505      const PFCandidate *pCand = iJet->PFCand(i0);
506      if(iPFType != -1 && pCand->PFType() != iPFType) continue;
507      double pDR = MathUtils::DeltaR(iJet->Mom(),pCand->Mom());
508 <    lDRMean    += pDR*(pCand->Pt())/iJet->Pt();
508 >    lDRMean    += pDR*(pCand->Pt())/iJet->RawMom().Pt();
509    }
510    return lDRMean;
511   }
512 + Double_t JetTools::frac(const PFJet *iJet,Double_t iDRMax,Double_t iDRMin,Int_t iPFType) {
513 +  double lFrac = 0;
514 +  for(UInt_t i0 = 0; i0 < iJet->NPFCands(); i0++) {
515 +    const PFCandidate *pCand = iJet->PFCand(i0);
516 +    if(iPFType != -1 && pCand->PFType() != iPFType) continue;
517 +    Double_t pDR = MathUtils::DeltaR(iJet->Mom(),pCand->Mom());
518 +    if(pDR > iDRMax) continue;
519 +    if(pDR < iDRMax-0.1) continue;
520 +    lFrac += pCand->Pt()/iJet->Pt();
521 +  }
522 +  return lFrac;
523 + }
524 + Double_t JetTools::betaStar(const PFJet *iJet,const Vertex *iVertex,const VertexCol* iVertices,Double_t iDZCut) {
525 +  Double_t lTotal = 0;  
526 +  Double_t lPileup = 0;
527 +  for(UInt_t i0 = 0; i0 < iJet->NPFCands(); i0++) {
528 +    const PFCandidate* pPF   = iJet->PFCand(i0);
529 +    const Track* pTrack      = pPF->TrackerTrk();
530 +    //if(pPF->GsfTrk()) pTrack = pPF->GsfTrk(); ==> not used in CMSSW
531 +    if(pTrack == 0) continue;
532 +    lTotal += pPF->Pt();
533 +    double pDZPV  = fabs(pTrack->DzCorrected(*iVertex));
534 +    double pDZMin = pDZPV;
535 +    for(unsigned int i1 = 0; i1 < iVertices->GetEntries(); i1++) {
536 +      const Vertex *pV = iVertices->At(i1);
537 +      if(pV->Ndof() < 4 ||
538 +         (pV->Position() - iVertex->Position()).R() < 0.02 ) continue;
539 +      pDZMin = TMath::Min(pDZMin,fabs(pTrack->DzCorrected(*pV)));
540 +    }
541 +    if(pDZPV > 0.2 && pDZMin < 0.2) lPileup += pTrack->Pt();
542 +  }
543 +  if(lTotal == 0) lTotal = 1;
544 +  return lPileup/(lTotal);
545 + }
546   Bool_t  JetTools::passPFLooseId(const PFJet *iJet) {
547    if(iJet->E()                              == 0)       return false;
548    if(iJet->NeutralHadronEnergy()/iJet->E()  >  0.99)    return false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines