CMS 3D CMS Logo

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 
18 
19 // -----------------------------------------------------------------------------
20 //
22 
23 // -----------------------------------------------------------------------------
24 //
26 
27 // -----------------------------------------------------------------------------
28 //
29 
31  JetRefs const& fJets,
32  std::vector<reco::TrackExtrapolation> const& fExtrapolations,
33  CaloGeometry const& fGeo,
34  double dR) {
35  for (JetRefs::const_iterator jetsBegin = fJets.begin(), jetsEnd = fJets.end(), ijet = jetsBegin; ijet != jetsEnd;
36  ++ijet) {
37  reco::TrackRefVector associated;
38  associateInputTracksToJet(associated, **ijet, fExtrapolations, dR);
39  reco::JetTracksAssociation::setValue(fAssociation, *ijet, associated);
40  }
41 }
42 
44  reco::TrackRefVector& associated,
45  const reco::Jet& fJet,
46  std::vector<reco::TrackExtrapolation> const& fExtrapolations,
47  double dR) {
48  reco::CaloJet const* pCaloJet = dynamic_cast<reco::CaloJet const*>(&fJet);
49  if (pCaloJet == nullptr) {
50  throw cms::Exception("InvalidInput") << "Expecting calo jets only in JetTracksAssociationXtrpCalo";
51  }
52  // Loop over CaloTowers
53  double jetPhi = pCaloJet->phi();
54  double jetEta = pCaloJet->detectorP4().eta();
55 
56  // now cache the mapping of (det ID --> track)
57 
58  // std::cout<<" New jet "<<jetEta<<" "<<jetPhi<<" Jet ET "<<pCaloJet->et()<<std::endl;
59 
60  for (std::vector<reco::TrackExtrapolation>::const_iterator xtrpBegin = fExtrapolations.begin(),
61  xtrpEnd = fExtrapolations.end(),
62  ixtrp = xtrpBegin;
63  ixtrp != xtrpEnd;
64  ++ixtrp) {
65  if (ixtrp->positions().empty())
66  continue;
67  reco::TrackBase::Point const& point = ixtrp->positions().at(0);
68 
69  double dr = reco::deltaR<double>(jetEta, jetPhi, point.eta(), point.phi());
70  if (dr < dR) {
71  // std::cout<<" JetTracksAssociationXtrpCalo::associateInputTracksToJet:: initial track "<<ixtrp->track()->pt()<<" "<<ixtrp->track()->eta()<<
72  // " "<<ixtrp->track()->phi()<< " Extrapolated position "<<point.eta()<<" "<<point.phi()<<" Valid? "<<ixtrp->isValid().at(0)<<" Jet eta, phi "<<jetEta<<" "<<jetPhi<<" Jet ET "<<pCaloJet->et()<<
73  // " dr "<<dr<<" dR "<<dR<<std::endl;
74 
75  reco::TrackRef matchedTrack = ixtrp->track();
76  associated.push_back(matchedTrack);
77  }
78  }
79 }
Propagator.h
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
TrajectoryStateOnSurface.h
CaloJet.h
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
FreeTrajectoryState.h
GlobalTrajectoryParameters.h
Cylinder.h
edm::RefVector< TrackCollection >
edm::Ref< TrackCollection >
Plane.h
CaloGeometry
Definition: CaloGeometry.h:21
reco::JetTracksAssociation::setValue
bool setValue(Container &, const reco::JetBaseRef &, reco::TrackRefVector)
associate jet with value. Returns false and associate nothing if jet is already associated
Definition: JetTracksAssociation.cc:41
JetTracksAssociationXtrpCalo::JetRefs
std::vector< JetRef > JetRefs
Definition: JetTracksAssociationXtrpCalo.h:29
JetTracksAssociationXtrpCalo.h
EcalSubdetector.h
edm::AssociationVector
Definition: AssociationVector.h:67
reco::btau::jetPhi
Definition: TaggingVariable.h:36
reco::btau::jetEta
Definition: TaggingVariable.h:34
CaloSubdetectorGeometry.h
deltaR.h
JetTracksAssociationXtrpCalo::~JetTracksAssociationXtrpCalo
virtual ~JetTracksAssociationXtrpCalo()
Destructor.
Definition: JetTracksAssociationXtrpCalo.cc:25
reco::CaloJet::detectorP4
LorentzVector detectorP4() const
detector p4 for full 3d vertex correction.
Definition: CaloJet.cc:55
MagneticField.h
edm::RefVector::push_back
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
DetId.h
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
Exception
Definition: hltDiff.cc:245
JetTracksAssociationXtrpCalo::JetTracksAssociationXtrpCalo
JetTracksAssociationXtrpCalo()
Constructor.
Definition: JetTracksAssociationXtrpCalo.cc:21
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
point
*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
Vector3D.h
JetTracksAssociationXtrpCalo::produce
void produce(Association *, JetRefs const &, std::vector< reco::TrackExtrapolation > const &, CaloGeometry const &, double dR)
Associates tracks to jets.
Definition: JetTracksAssociationXtrpCalo.cc:30
JetTracksAssociationXtrpCalo::associateInputTracksToJet
void associateInputTracksToJet(reco::TrackRefVector &associated, const reco::Jet &fJet, std::vector< reco::TrackExtrapolation > const &fExtrapolations, double dR)
Definition: JetTracksAssociationXtrpCalo.cc:43