CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
cms::JetVertexAssociation Class Reference

#include <JetVertexAssociation.h>

Inheritance diagram for cms::JetVertexAssociation:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetVertexAssociation (const edm::ParameterSet &ps)
 
void produce (edm::StreamID, edm::Event &e, const edm::EventSetup &c) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::vector< double > ResultCollection1
 
typedef std::vector< bool > ResultCollection2
 

Private Attributes

edm::EDGetTokenT< reco::CaloJetCollectionjet_token
 
JetVertexMain m_algo
 
edm::EDGetTokenT< reco::TrackCollectiontrack_token
 
edm::EDGetTokenT< reco::VertexCollectionvertex_token
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 26 of file JetVertexAssociation.h.

Member Typedef Documentation

◆ ResultCollection1

typedef std::vector<double> cms::JetVertexAssociation::ResultCollection1
private

Definition at line 33 of file JetVertexAssociation.h.

◆ ResultCollection2

typedef std::vector<bool> cms::JetVertexAssociation::ResultCollection2
private

Definition at line 34 of file JetVertexAssociation.h.

Constructor & Destructor Documentation

◆ JetVertexAssociation()

JetVertexAssociation::JetVertexAssociation ( const edm::ParameterSet ps)

Definition at line 56 of file JetVertexAssociation.cc.

57  : m_algo(iConfig),
58  jet_token(consumes<CaloJetCollection>(edm::InputTag(iConfig.getParameter<std::string>("JET_ALGO")))),
59  track_token(consumes<TrackCollection>(edm::InputTag(iConfig.getParameter<std::string>("TRACK_ALGO")))),
60  vertex_token(consumes<VertexCollection>(edm::InputTag(iConfig.getParameter<std::string>("VERTEX_ALGO")))) {
61  produces<ResultCollection1>("Var");
62  produces<ResultCollection2>("JetType");
63  }
edm::EDGetTokenT< reco::VertexCollection > vertex_token
edm::EDGetTokenT< reco::TrackCollection > track_token
edm::EDGetTokenT< reco::CaloJetCollection > jet_token

Member Function Documentation

◆ produce()

void JetVertexAssociation::produce ( edm::StreamID  ,
edm::Event e,
const edm::EventSetup c 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 65 of file JetVertexAssociation.cc.

References iEvent, metsig::jet, jet_token, PDWG_EXODelayedJetMET_cff::jets, m_algo, JetVertexMain::Main(), eostools::move(), DiDispStaMuonMonitor_cfi::pt, muonTiming_cfi::ptmax, mps_fire::result, track_token, pwdgSkimBPark_cfi::tracks, vertex_token, and jetsAK4_CHS_cff::vertexes.

65  {
67  iEvent.getByToken(jet_token, jets);
68 
70  iEvent.getByToken(track_token, tracks);
71 
73  iEvent.getByToken(vertex_token, vertexes);
74 
75  double SIGNAL_V_Z = 0.;
76  double SIGNAL_V_Z_ERROR = 0.;
77  double ptmax = -100.;
78 
79  VertexCollection::const_iterator vert = vertexes->begin();
80  if (!vertexes->empty()) {
81  for (; vert != vertexes->end(); vert++) {
82  SIGNAL_V_Z = vert->z();
83  double pt = 0.;
84  reco::Vertex::trackRef_iterator tr = vert->tracks_begin();
85  for (; tr != vert->tracks_end(); tr++)
86  pt += (*tr)->pt();
87  if (pt >= ptmax) {
88  ptmax = pt;
89  SIGNAL_V_Z = vert->z();
90  SIGNAL_V_Z_ERROR = vert->zError();
91  }
92  }
93  }
94 
95  pair<double, bool> result;
96  std::unique_ptr<ResultCollection1> result1(new ResultCollection1);
97  std::unique_ptr<ResultCollection2> result2(new ResultCollection2);
98 
99  CaloJetCollection::const_iterator jet = jets->begin();
100 
101  if (!jets->empty()) {
102  for (; jet != jets->end(); jet++) {
103  result = m_algo.Main(*jet, tracks, SIGNAL_V_Z, SIGNAL_V_Z_ERROR);
104  result1->push_back(result.first);
105  result2->push_back(result.second);
106  }
107  }
108 
109  iEvent.put(std::move(result1), "Var");
110  iEvent.put(std::move(result2), "JetType");
111  }
edm::EDGetTokenT< reco::VertexCollection > vertex_token
edm::EDGetTokenT< reco::TrackCollection > track_token
std::vector< double > ResultCollection1
edm::EDGetTokenT< reco::CaloJetCollection > jet_token
int iEvent
Definition: GenABIO.cc:224
std::vector< bool > ResultCollection2
std::pair< double, bool > Main(const reco::CaloJet &jet, edm::Handle< reco::TrackCollection > tracks, double SIGNAL_V_Z, double SIGNAL_V_Z_Error) const
def move(src, dest)
Definition: eostools.py:511
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38

Member Data Documentation

◆ jet_token

edm::EDGetTokenT<reco::CaloJetCollection> cms::JetVertexAssociation::jet_token
private

Definition at line 37 of file JetVertexAssociation.h.

Referenced by produce().

◆ m_algo

JetVertexMain cms::JetVertexAssociation::m_algo
private

Definition at line 36 of file JetVertexAssociation.h.

Referenced by produce().

◆ track_token

edm::EDGetTokenT<reco::TrackCollection> cms::JetVertexAssociation::track_token
private

Definition at line 38 of file JetVertexAssociation.h.

Referenced by produce().

◆ vertex_token

edm::EDGetTokenT<reco::VertexCollection> cms::JetVertexAssociation::vertex_token
private

Definition at line 39 of file JetVertexAssociation.h.

Referenced by produce().