CMS 3D CMS Logo

Public Member Functions | Private Member Functions

JetTracksAssociationXtrpCalo Class Reference

#include <JetTracksAssociationXtrpCalo.h>

Inheritance diagram for JetTracksAssociationXtrpCalo:
JetTracksAssociationDR

List of all members.

Public Member Functions

void associateInputTracksToJet (reco::TrackRefVector &associated, const reco::Jet &fJet, std::vector< reco::TrackExtrapolation > const &fExtrapolations, double dR)
 JetTracksAssociationXtrpCalo ()
 Constructor.
void produce (Association *, JetRefs const &, std::vector< reco::TrackExtrapolation > const &, CaloGeometry const &, double dR)
 Associates tracks to jets.
 ~JetTracksAssociationXtrpCalo ()
 Destructor.

Private Member Functions

virtual void associateTracksToJet (reco::TrackRefVector &, const reco::Jet &, const TrackRefs &)
 Unused.

Detailed Description

Definition at line 28 of file JetTracksAssociationXtrpCalo.h.


Constructor & Destructor Documentation

JetTracksAssociationXtrpCalo::JetTracksAssociationXtrpCalo ( )

Constructor.

Definition at line 22 of file JetTracksAssociationXtrpCalo.cc.

{}
JetTracksAssociationXtrpCalo::~JetTracksAssociationXtrpCalo ( )

Destructor.

Definition at line 27 of file JetTracksAssociationXtrpCalo.cc.

{}

Member Function Documentation

void JetTracksAssociationXtrpCalo::associateInputTracksToJet ( reco::TrackRefVector associated,
const reco::Jet fJet,
std::vector< reco::TrackExtrapolation > const &  fExtrapolations,
double  dR 
)

Definition at line 54 of file JetTracksAssociationXtrpCalo.cc.

References reco::CaloJet::detectorP4(), Exception, reco::btau::jetEta, reco::btau::jetPhi, reco::LeafCandidate::phi(), point, and edm::RefVector< C, T, F >::push_back().

Referenced by produce().

{
  reco::CaloJet const * pCaloJet = dynamic_cast<reco::CaloJet const *>(&fJet);
  if ( pCaloJet == 0 ) {
    throw cms::Exception("InvalidInput") << "Expecting calo jets only in JetTracksAssociationXtrpCalo";
  }
  // Loop over CaloTowers
  double jetPhi = pCaloJet->phi();
  double jetEta = pCaloJet->detectorP4().eta();

  // now cache the mapping of (det ID --> track)

//  std::cout<<" New jet "<<jetEta<<" "<<jetPhi<<" Jet ET "<<pCaloJet->et()<<std::endl;

  for ( std::vector<reco::TrackExtrapolation>::const_iterator xtrpBegin = fExtrapolations.begin(),
          xtrpEnd = fExtrapolations.end(), ixtrp = xtrpBegin;
        ixtrp != xtrpEnd; ++ixtrp ) {
//      
// Do nothing with invalid propagation  
//
        if( ixtrp->isValid().at(0) == 0 ) continue;
        
    reco::TrackBase::Point const & point = ixtrp->positions().at(0);


    double dr = reco::deltaR<double>( jetEta, jetPhi, point.eta(), point.phi() );
    if ( dr < dR ) {

//    std::cout<<" JetTracksAssociationXtrpCalo::associateInputTracksToJet:: initial track "<<ixtrp->track()->pt()<<" "<<ixtrp->track()->eta()<<
//    " "<<ixtrp->track()->phi()<< " Extrapolated position "<<point.eta()<<" "<<point.phi()<<" Valid? "<<ixtrp->isValid().at(0)<<" Jet eta, phi "<<jetEta<<" "<<jetPhi<<" Jet ET "<<pCaloJet->et()<<
//    " dr "<<dr<<" dR "<<dR<<std::endl;

      reco::TrackRef matchedTrack = ixtrp->track(); 
      associated.push_back( matchedTrack );      
    }
  }


}
virtual void JetTracksAssociationXtrpCalo::associateTracksToJet ( reco::TrackRefVector ,
const reco::Jet ,
const TrackRefs  
) [inline, private, virtual]

Unused.

Implements JetTracksAssociationDR.

Definition at line 55 of file JetTracksAssociationXtrpCalo.h.

                                                        {}
void JetTracksAssociationXtrpCalo::produce ( Association fAssociation,
JetRefs const &  fJets,
std::vector< reco::TrackExtrapolation > const &  fExtrapolations,
CaloGeometry const &  fGeo,
double  dR 
)

Associates tracks to jets.

Definition at line 34 of file JetTracksAssociationXtrpCalo.cc.

References associateInputTracksToJet(), and reco::JetExtendedAssociation::setValue().

Referenced by JetTracksAssociatorAtCaloFace::produce().

{
  for ( JetRefs::const_iterator jetsBegin = fJets.begin(),
          jetsEnd = fJets.end(), 
          ijet = jetsBegin;
        ijet != jetsEnd; ++ijet ) {
    reco::TrackRefVector associated;
    associateInputTracksToJet( associated, **ijet, fExtrapolations, dR );
    reco::JetTracksAssociation::setValue( fAssociation, *ijet, associated );
  }
  
  
}