CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
JetTracksAssociationToTrackRefs Class Reference
Inheritance diagram for JetTracksAssociationToTrackRefs:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetTracksAssociationToTrackRefs (const edm::ParameterSet &iConfig)
 
void produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- 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
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< reco::JetTracksAssociation::ContainerassociationToken_
 
edm::EDGetTokenT< reco::JetCorrectorcorrectorToken_
 
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
 
const double ptMin_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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
 
- 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

The purpose of this producer is to convert AssociationVector<JetRefBaseProd, vector<RefVector<Track> > to a RefVector<Track> of the (unique) values.

Definition at line 23 of file JetTracksAssociationToTrackRefs.cc.

Constructor & Destructor Documentation

JetTracksAssociationToTrackRefs::JetTracksAssociationToTrackRefs ( const edm::ParameterSet iConfig)

Definition at line 39 of file JetTracksAssociationToTrackRefs.cc.

39  :
40  associationToken_(consumes<reco::JetTracksAssociation::Container>(iConfig.getParameter<edm::InputTag>("association"))),
42  correctorToken_(consumes<reco::JetCorrector>(iConfig.getParameter<edm::InputTag>("corrector"))),
43  ptMin_(iConfig.getParameter<double>("correctedPtMin"))
44 {
45  produces<reco::TrackRefVector> ();
46 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
edm::EDGetTokenT< reco::JetCorrector > correctorToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::JetTracksAssociation::Container > associationToken_

Member Function Documentation

void JetTracksAssociationToTrackRefs::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 48 of file JetTracksAssociationToTrackRefs.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

48  {
50  desc.add<edm::InputTag>("association", edm::InputTag("ak4JetTracksAssociatorAtVertexPF"));
51  desc.add<edm::InputTag>("jets", edm::InputTag("ak4PFJetsCHS"));
52  desc.add<edm::InputTag>("corrector", edm::InputTag("ak4PFL1FastL2L3Corrector"));
53  desc.add<double>("correctedPtMin", 0);
54  descriptions.add("jetTracksAssociationToTrackRefs", desc);
55 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void JetTracksAssociationToTrackRefs::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
override

Definition at line 57 of file JetTracksAssociationToTrackRefs.cc.

References TrackValidation_cff::association, associationToken_, reco::JetCorrector::correction(), mitigatedMETSequence_cff::corrector, correctorToken_, DEFINE_FWK_MODULE, edm::Event::getByToken(), mps_fire::i, metsig::jet, fwrapper::jets, jetToken_, eostools::move(), p4, reco::LeafCandidate::p4(), ptMin_, edm::Event::put(), edm::View< T >::refAt(), reco::JetCorrector::refRequired(), Scenarios_cff::scale, edm::View< T >::size(), and reco::JetCorrector::vectorialCorrection().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

57  {
59  iEvent.getByToken(associationToken_, h_assoc);
61 
63  iEvent.getByToken(jetToken_, h_jets);
64  const edm::View<reco::Jet>& jets = *h_jets;
65 
67  iEvent.getByToken(correctorToken_, h_corrector);
68  const reco::JetCorrector& corrector = *h_corrector;
69 
70  auto ret = std::make_unique<reco::TrackRefVector>();
71  std::unordered_set<reco::TrackRefVector::key_type> alreadyAdded;
72 
73  // Exctract tracks only for jets passing certain pT threshold after
74  // correction
75  for(size_t i=0; i<jets.size(); ++i) {
76  edm::RefToBase<reco::Jet> jetRef = jets.refAt(i);
77  const reco::Jet& jet = *jetRef;
78 
79  auto p4 = jet.p4();
80 
81  // Energy correction in the most general way
82  if(!corrector.vectorialCorrection()) {
83  double scale = 1;
84  if(!corrector.refRequired()) {
85  scale = corrector.correction(jet);
86  }
87  else {
88  scale = corrector.correction(jet, jetRef);
89  }
90  p4 = p4*scale;
91  }
92  else {
93  corrector.correction(jet, jetRef, p4);
94  }
95 
96  if(p4.pt() <= ptMin_)
97  continue;
98 
99  for(const auto& trackRef: association[jetRef]) {
100  if(alreadyAdded.find(trackRef.key()) == alreadyAdded.end()) {
101  ret->push_back(trackRef);
102  alreadyAdded.insert(trackRef.key());
103  }
104  }
105  }
106 
107  iEvent.put(std::move(ret));
108 }
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
Base class for all types of Jets.
Definition: Jet.h:20
bool refRequired() const
if correction needs the jet reference
Definition: JetCorrector.h:70
size_type size() const
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:47
edm::EDGetTokenT< reco::JetCorrector > correctorToken_
RefToBase< value_type > refAt(size_type i) const
double p4[4]
Definition: TauolaWrapper.h:92
vector< PseudoJet > jets
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
edm::EDGetTokenT< reco::JetTracksAssociation::Container > associationToken_
bool vectorialCorrection() const
if vectorial correction is provided
Definition: JetCorrector.h:75
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<reco::JetTracksAssociation::Container> JetTracksAssociationToTrackRefs::associationToken_
private

Definition at line 32 of file JetTracksAssociationToTrackRefs.cc.

Referenced by produce().

edm::EDGetTokenT<reco::JetCorrector> JetTracksAssociationToTrackRefs::correctorToken_
private

Definition at line 34 of file JetTracksAssociationToTrackRefs.cc.

Referenced by produce().

edm::EDGetTokenT<edm::View<reco::Jet> > JetTracksAssociationToTrackRefs::jetToken_
private

Definition at line 33 of file JetTracksAssociationToTrackRefs.cc.

Referenced by produce().

const double JetTracksAssociationToTrackRefs::ptMin_
private

Definition at line 35 of file JetTracksAssociationToTrackRefs.cc.

Referenced by produce().