test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
JetTracksAssociatorAtVertex Class Reference

#include <JetTracksAssociatorAtVertex.h>

Inheritance diagram for JetTracksAssociatorAtVertex:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetTracksAssociatorAtVertex (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~JetTracksAssociatorAtVertex ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

JetTracksAssociationDRVertex mAssociator
 
JetTracksAssociationDRVertexAssigned mAssociatorAssigned
 
edm::EDGetTokenT< edm::View
< reco::Jet > > 
mJets
 
int mTrackQuality
 
edm::EDGetTokenT
< reco::TrackCollection
mTracks
 
edm::EDGetTokenT
< reco::VertexCollection
pvSrc
 if true, use the track/jet association with vertex assignment to tracks More...
 
bool useAssigned
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 19 of file JetTracksAssociatorAtVertex.h.

Constructor & Destructor Documentation

JetTracksAssociatorAtVertex::JetTracksAssociatorAtVertex ( const edm::ParameterSet fConfig)

Definition at line 18 of file JetTracksAssociatorAtVertex.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), mJets, mTracks, pvSrc, and useAssigned.

19  : mAssociator (fConfig.getParameter<double> ("coneSize")),
20  mAssociatorAssigned (fConfig.getParameter<double> ("coneSize")),
21  useAssigned(false), pvSrc()
22 {
23  mJets = consumes<edm::View <reco::Jet> >(fConfig.getParameter<edm::InputTag> ("jets"));
24  mTracks = consumes<reco::TrackCollection>(fConfig.getParameter<edm::InputTag>("tracks"));
25  if ( fConfig.exists("useAssigned") ) {
26  useAssigned = fConfig.getParameter<bool> ("useAssigned");
27  pvSrc = consumes<reco::VertexCollection>(fConfig.getParameter<edm::InputTag> ("pvSrc"));
28  }
29 
30  produces<reco::JetTracksAssociation::Container> ();
31 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > mTracks
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::View< reco::Jet > > mJets
edm::EDGetTokenT< reco::VertexCollection > pvSrc
if true, use the track/jet association with vertex assignment to tracks
JetTracksAssociationDRVertexAssigned mAssociatorAssigned
JetTracksAssociationDRVertex mAssociator
JetTracksAssociatorAtVertex::~JetTracksAssociatorAtVertex ( )
virtual

Definition at line 33 of file JetTracksAssociatorAtVertex.cc.

33 {}

Member Function Documentation

void JetTracksAssociatorAtVertex::produce ( edm::Event fEvent,
const edm::EventSetup fSetup 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 35 of file JetTracksAssociatorAtVertex.cc.

References reco::JetExtendedAssociation::allJets(), muonTagProbeFilters_cff::allTracks, edm::Event::getByToken(), i, mAssociator, mAssociatorAssigned, mJets, mTracks, JetTracksAssociationDRVertex::produce(), JetTracksAssociationDRVertexAssigned::produce(), edm::Handle< T >::product(), edm::Event::put(), pvSrc, and useAssigned.

35  {
37  fEvent.getByToken (mJets, jets_h);
39  fEvent.getByToken (mTracks, tracks_h);
40 
41  std::auto_ptr<reco::JetTracksAssociation::Container> jetTracks (new reco::JetTracksAssociation::Container (reco::JetRefBaseProd(jets_h)));
42 
43  // format inputs
44  std::vector <edm::RefToBase<reco::Jet> > allJets;
45  allJets.reserve (jets_h->size());
46  for (unsigned i = 0; i < jets_h->size(); ++i) allJets.push_back (jets_h->refAt(i));
47  std::vector <reco::TrackRef> allTracks;
48  allTracks.reserve (tracks_h->size());
49  // run algo
50  for (unsigned i = 0; i < tracks_h->size(); ++i) {
51  allTracks.push_back (reco::TrackRef (tracks_h, i));
52  }
53  if ( !useAssigned ) {
54  mAssociator.produce (&*jetTracks, allJets, allTracks);
55  } else {
57  fEvent.getByToken(pvSrc,pvHandle);
58  const reco::VertexCollection & vertices = *pvHandle.product();
59  mAssociatorAssigned.produce (&*jetTracks, allJets, allTracks,vertices);
60  }
61 
62 
63  // store output
64  fEvent.put (jetTracks);
65 }
std::vector< reco::JetBaseRef > allJets(const Container &)
fill list of all jets associated with values. Return # of jets in the list
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::TrackCollection > mTracks
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< edm::View< reco::Jet > > mJets
void produce(reco::JetTracksAssociation::Container *fAssociation, const std::vector< edm::RefToBase< reco::Jet > > &fJets, const std::vector< reco::TrackRef > &fTracks, const reco::VertexCollection &vertices) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< reco::VertexCollection > pvSrc
if true, use the track/jet association with vertex assignment to tracks
void produce(reco::JetTracksAssociation::Container *fAssociation, const std::vector< edm::RefToBase< reco::Jet > > &fJets, const std::vector< reco::TrackRef > &fTracks) const
JetTracksAssociationDRVertexAssigned mAssociatorAssigned
JetTracksAssociationDRVertex mAssociator
T const * product() const
Definition: Handle.h:81

Member Data Documentation

JetTracksAssociationDRVertex JetTracksAssociatorAtVertex::mAssociator
private

Definition at line 31 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

JetTracksAssociationDRVertexAssigned JetTracksAssociatorAtVertex::mAssociatorAssigned
private

Definition at line 32 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

edm::EDGetTokenT<edm::View <reco::Jet> > JetTracksAssociatorAtVertex::mJets
private

Definition at line 27 of file JetTracksAssociatorAtVertex.h.

Referenced by JetTracksAssociatorAtVertex(), and produce().

int JetTracksAssociatorAtVertex::mTrackQuality
private

Definition at line 30 of file JetTracksAssociatorAtVertex.h.

edm::EDGetTokenT<reco::TrackCollection> JetTracksAssociatorAtVertex::mTracks
private

Definition at line 28 of file JetTracksAssociatorAtVertex.h.

Referenced by JetTracksAssociatorAtVertex(), and produce().

edm::EDGetTokenT<reco::VertexCollection> JetTracksAssociatorAtVertex::pvSrc
private

if true, use the track/jet association with vertex assignment to tracks

Definition at line 34 of file JetTracksAssociatorAtVertex.h.

Referenced by JetTracksAssociatorAtVertex(), and produce().

bool JetTracksAssociatorAtVertex::useAssigned
private

Definition at line 33 of file JetTracksAssociatorAtVertex.h.

Referenced by JetTracksAssociatorAtVertex(), and produce().