CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DataFormats/JetReco/src/JetTracksAssociation.cc

Go to the documentation of this file.
00001 #include "JetAssociationTemplate.icc"
00002 #include "DataFormats/TrackReco/interface/Track.h"
00003 
00004 #include "DataFormats/JetReco/interface/JetTracksAssociation.h"
00005 
00007 int reco::JetTracksAssociation::tracksNumber (const Container& fContainer, const reco::JetBaseRef fJet) {
00008   return getValue (fContainer, fJet).size();
00009 }
00010 int reco::JetTracksAssociation::tracksNumber (const Container& fContainer, const reco::Jet& fJet) {
00011   return getValue (fContainer, fJet).size();
00012 }
00014 reco::JetTracksAssociation::LorentzVector 
00015 reco::JetTracksAssociation::tracksP4 (const Container& fContainer, const reco::JetBaseRef fJet) {
00016   const reco::TrackRefVector* tracks = &getValue (fContainer, fJet);
00017   math::XYZTLorentzVector result (0,0,0,0);
00018   for (unsigned t = 0; t < tracks->size(); ++t) {
00019     const reco::Track& track = *((*tracks)[t]);
00020     result += math::XYZTLorentzVector (track.px(), track.py(), track.pz(), track.p()); // massless hypothesis 
00021   }
00022   return reco::JetTracksAssociation::LorentzVector (result);
00023 }
00024 reco::JetTracksAssociation::LorentzVector 
00025 reco::JetTracksAssociation::tracksP4 (const Container& fContainer, const reco::Jet& fJet) {
00026   const reco::TrackRefVector* tracks = &getValue (fContainer, fJet);
00027   math::XYZTLorentzVector result (0,0,0,0);
00028   for (unsigned t = 0; t < tracks->size(); ++t) {
00029     const reco::Track& track = *((*tracks)[t]);
00030     result += math::XYZTLorentzVector (track.px(), track.py(), track.pz(), track.p()); // massless hypothesis 
00031   }
00032   return reco::JetTracksAssociation::LorentzVector (result);
00033 }
00034 
00035 
00036 bool reco::JetTracksAssociation::setValue (Container* fContainer, 
00037                                            const reco::JetBaseRef& fJet, 
00038                                            reco::TrackRefVector fValue) {
00039   return JetAssociationTemplate::setValue (fContainer, fJet,fValue);
00040 }
00041 
00042 bool reco::JetTracksAssociation::setValue (Container& fContainer, 
00043                                             const reco::JetBaseRef& fJet, 
00044                                             reco::TrackRefVector fValue) {
00045   return JetAssociationTemplate::setValue (fContainer, fJet,fValue);
00046 }
00047 
00048 const reco::TrackRefVector& reco::JetTracksAssociation::getValue (const Container& fContainer, 
00049                                                             const reco::JetBaseRef& fJet) {
00050   return JetAssociationTemplate::getValue<Container, reco::TrackRefVector> (fContainer, fJet);
00051 }
00052 
00053 const reco::TrackRefVector& reco::JetTracksAssociation::getValue (const Container& fContainer, 
00054                                                             const reco::Jet& fJet) {
00055   return JetAssociationTemplate::getValue<Container, reco::TrackRefVector> (fContainer, fJet);
00056 }
00057 
00058 std::vector<reco::JetBaseRef > reco::JetTracksAssociation::allJets (const Container& fContainer) {
00059   return JetAssociationTemplate::allJets (fContainer);
00060 }
00061   
00062 bool reco::JetTracksAssociation::hasJet (const Container& fContainer, 
00063                                           const reco::JetBaseRef& fJet) {
00064   return JetAssociationTemplate::hasJet (fContainer, fJet);
00065 }
00066 
00067 bool reco::JetTracksAssociation::hasJet (const Container& fContainer, 
00068                                          const reco::Jet& fJet) {
00069   return JetAssociationTemplate::hasJet (fContainer, fJet);
00070 }