CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetTracksAssociationXtrpCalo.cc
Go to the documentation of this file.
1 // Associate jets with tracks by simple "dR" criteria
2 // Fedor Ratnikov (UMd), Aug. 28, 2007
3 // $Id: JetTracksAssociationXtrpCalo.cc,v 1.1 2010/03/16 21:49:00 srappocc Exp $
4 
19 
20 // -----------------------------------------------------------------------------
21 //
23 {}
24 
25 // -----------------------------------------------------------------------------
26 //
28 {}
29 
30 
31 // -----------------------------------------------------------------------------
32 //
33 
35  JetRefs const & fJets,
36  std::vector<reco::TrackExtrapolation> const & fExtrapolations,
37  CaloGeometry const & fGeo,
38  double dR )
39 {
40  for ( JetRefs::const_iterator jetsBegin = fJets.begin(),
41  jetsEnd = fJets.end(),
42  ijet = jetsBegin;
43  ijet != jetsEnd; ++ijet ) {
44  reco::TrackRefVector associated;
45  associateInputTracksToJet( associated, **ijet, fExtrapolations, dR );
46  reco::JetTracksAssociation::setValue( fAssociation, *ijet, associated );
47  }
48 
49 
50 }
51 
52 
53 
55  const reco::Jet& fJet,
56  std::vector<reco::TrackExtrapolation> const & fExtrapolations,
57  double dR )
58 {
59  reco::CaloJet const * pCaloJet = dynamic_cast<reco::CaloJet const *>(&fJet);
60  if ( pCaloJet == 0 ) {
61  throw cms::Exception("InvalidInput") << "Expecting calo jets only in JetTracksAssociationXtrpCalo";
62  }
63  // Loop over CaloTowers
64  double jetPhi = pCaloJet->phi();
65  double jetEta = pCaloJet->detectorP4().eta();
66 
67  // now cache the mapping of (det ID --> track)
68 
69 // std::cout<<" New jet "<<jetEta<<" "<<jetPhi<<" Jet ET "<<pCaloJet->et()<<std::endl;
70 
71  for ( std::vector<reco::TrackExtrapolation>::const_iterator xtrpBegin = fExtrapolations.begin(),
72  xtrpEnd = fExtrapolations.end(), ixtrp = xtrpBegin;
73  ixtrp != xtrpEnd; ++ixtrp ) {
74 //
75 // Do nothing with invalid propagation
76 //
77  if( ixtrp->isValid().at(0) == 0 ) continue;
78 
79  reco::TrackBase::Point const & point = ixtrp->positions().at(0);
80 
81 
82  double dr = reco::deltaR<double>( jetEta, jetPhi, point.eta(), point.phi() );
83  if ( dr < dR ) {
84 
85 // std::cout<<" JetTracksAssociationXtrpCalo::associateInputTracksToJet:: initial track "<<ixtrp->track()->pt()<<" "<<ixtrp->track()->eta()<<
86 // " "<<ixtrp->track()->phi()<< " Extrapolated position "<<point.eta()<<" "<<point.phi()<<" Valid? "<<ixtrp->isValid().at(0)<<" Jet eta, phi "<<jetEta<<" "<<jetPhi<<" Jet ET "<<pCaloJet->et()<<
87 // " dr "<<dr<<" dR "<<dR<<std::endl;
88 
89  reco::TrackRef matchedTrack = ixtrp->track();
90  associated.push_back( matchedTrack );
91  }
92  }
93 
94 
95 }
Jets made from CaloTowers.
Definition: CaloJet.h:30
LorentzVector detectorP4() const
detector p4 for full 3d vertex correction.
Definition: CaloJet.cc:65
Base class for all types of Jets.
Definition: Jet.h:21
void associateInputTracksToJet(reco::TrackRefVector &associated, const reco::Jet &fJet, std::vector< reco::TrackExtrapolation > const &fExtrapolations, double dR)
void produce(Association *, JetRefs const &, std::vector< reco::TrackExtrapolation > const &, CaloGeometry const &, double dR)
Associates tracks to jets.
bool setValue(Container &, const reco::JetBaseRef &, reco::TrackRefVector)
associate jet with value. Returns false and associate nothing if jet is already associated ...
math::XYZPoint Point
point in the space
Definition: TrackBase.h:75
std::vector< JetRef > JetRefs
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:61
virtual double phi() const
momentum azimuthal angle
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5