Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:24

0001 #ifndef JetReco_JetTracksAssociation_h
0002 #define JetReco_JetTracksAssociation_h
0003 
0004 /** \class JetTracksAssociation
0005  *
0006  * \short Association between jets and float value
0007  *
0008  * \author Fedor Ratnikov, July 27, 2007
0009  *
0010  ************************************************************/
0011 
0012 #include "DataFormats/Common/interface/AssociationVector.h"
0013 #include "DataFormats/JetReco/interface/JetCollection.h"
0014 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0015 #include "DataFormats/Common/interface/Ref.h"
0016 #include "DataFormats/Common/interface/RefVector.h"
0017 #include "DataFormats/Math/interface/LorentzVector.h"
0018 
0019 namespace fwlite {
0020   class Event;
0021 }
0022 
0023 namespace reco {
0024   namespace JetTracksAssociation {
0025     typedef math::PtEtaPhiELorentzVectorF LorentzVector;
0026     typedef reco::TrackRefVector Value;
0027     typedef std::vector<Value> Values;
0028     typedef edm::AssociationVector<reco::JetRefBaseProd, Values> Container;
0029     typedef Container::value_type value_type;
0030     typedef Container::transient_vector_type transient_vector_type;
0031     typedef edm::Ref<Container> Ref;
0032     typedef edm::RefProd<Container> RefProd;
0033     typedef edm::RefVector<Container> RefVector;
0034 
0035     /// Get number of tracks associated with jet
0036     int tracksNumber(const Container&, const reco::JetBaseRef);
0037     /// Get number of tracks associated with jet
0038     int tracksNumber(const Container&, const reco::Jet&);
0039     /// Get LorentzVector as sum of all tracks associated with jet.
0040     LorentzVector tracksP4(const Container&, const reco::JetBaseRef);
0041     /// Get LorentzVector as sum of all tracks associated with jet.
0042     LorentzVector tracksP4(const Container&, const reco::Jet&);
0043 
0044     /// associate jet with value. Returns false and associate nothing if jet is already associated
0045     bool setValue(Container&, const reco::JetBaseRef&, reco::TrackRefVector);
0046     /// associate jet with value. Returns false and associate nothing if jet is already associated
0047     bool setValue(Container*, const reco::JetBaseRef&, reco::TrackRefVector);
0048     /// get value for the association. Throw exception if no association found
0049     const reco::TrackRefVector& getValue(const Container&, const reco::JetBaseRef&);
0050     /// get value for the association. Throw exception if no association found
0051     const reco::TrackRefVector& getValue(const Container&, const reco::Jet&);
0052     /// fill list of all jets associated with values. Return # of jets in the list
0053     std::vector<reco::JetBaseRef> allJets(const Container&);
0054     /// check if jet is associated
0055     bool hasJet(const Container&, const reco::JetBaseRef&);
0056     /// check if jet is associated
0057     bool hasJet(const Container&, const reco::Jet&);
0058   }  // namespace JetTracksAssociation
0059   /// typedefs for backward compatibility
0060   typedef JetTracksAssociation::Container JetTracksAssociationCollection;
0061   typedef JetTracksAssociation::Ref JetTracksAssociationRef;
0062   typedef JetTracksAssociation::RefProd JetTracksAssociationRefProd;
0063   typedef JetTracksAssociation::RefVector JetTracksAssociationRefVector;
0064 }  // namespace reco
0065 
0066 #endif