CMS 3D CMS Logo

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

Public Member Functions

 L1MhtPfProducer (const edm::ParameterSet &)
 
 ~L1MhtPfProducer () 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 Member Functions

std::vector< l1ct::JetconvertEDMToHW (std::vector< l1t::PFJet > edmJets) const
 
std::vector< l1t::EtSumconvertHWToEDM (l1ct::Sum hwSums) const
 
void produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 

Private Attributes

edm::EDGetTokenT< std::vector< l1t::PFJet > > jetsToken
 
float maxJetEta
 
float minJetPt
 

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 20 of file L1MHtPFProducer.cc.

Constructor & Destructor Documentation

◆ L1MhtPfProducer()

L1MhtPfProducer::L1MhtPfProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 35 of file L1MHtPFProducer.cc.

36  : jetsToken(consumes<std::vector<l1t::PFJet>>(cfg.getParameter<edm::InputTag>("jets"))),
37  minJetPt(cfg.getParameter<double>("minJetPt")),
38  maxJetEta(cfg.getParameter<double>("maxJetEta")) {
39  produces<std::vector<l1t::EtSum>>();
40 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< l1t::PFJet > > jetsToken

◆ ~L1MhtPfProducer()

L1MhtPfProducer::~L1MhtPfProducer ( )
override

Definition at line 96 of file L1MHtPFProducer.cc.

96 {}

Member Function Documentation

◆ convertEDMToHW()

std::vector< l1ct::Jet > L1MhtPfProducer::convertEDMToHW ( std::vector< l1t::PFJet edmJets) const
private

Definition at line 65 of file L1MHtPFProducer.cc.

References metsig::jet, and l1ct::Jet::unpack().

Referenced by produce().

65  {
66  std::vector<l1ct::Jet> hwJets;
67  std::for_each(edmJets.begin(), edmJets.end(), [&](l1t::PFJet jet) {
68  l1ct::Jet hwJet = l1ct::Jet::unpack(jet.getHWJetCT());
69  hwJets.push_back(hwJet);
70  });
71  return hwJets;
72 }
Definition: jets.h:12
static Jet unpack(const std::array< uint64_t, 2 > &src)
Definition: jets.h:68

◆ convertHWToEDM()

std::vector< l1t::EtSum > L1MhtPfProducer::convertHWToEDM ( l1ct::Sum  hwSums) const
private

Definition at line 74 of file L1MHtPFProducer.cc.

References l1gt::Scales::floatPhi(), l1gt::Scales::floatPt(), L1Analysis::kMissingHt, L1Analysis::kTotalHt, l1gt::Sum::scalar_pt, l1ct::Sum::toGT(), l1gt::Sum::vector_phi, and l1gt::Sum::vector_pt.

Referenced by produce().

74  {
75  std::vector<l1t::EtSum> edmSums;
76 
78  l1gt::Sum gtSum = hwSums.toGT();
79  htVector.SetPt(l1gt::Scales::floatPt(gtSum.scalar_pt));
80  htVector.SetPhi(0);
81  htVector.SetEta(0);
82 
84  mhtVector.SetPt(l1gt::Scales::floatPt(gtSum.vector_pt));
85  mhtVector.SetPhi(l1gt::Scales::floatPhi(gtSum.vector_phi));
86  mhtVector.SetEta(0);
87 
88  l1t::EtSum ht(htVector, l1t::EtSum::EtSumType::kTotalHt, gtSum.scalar_pt.bits_to_uint64());
89  l1t::EtSum mht(mhtVector, l1t::EtSum::EtSumType::kMissingHt, gtSum.vector_pt.bits_to_uint64(), 0, gtSum.vector_phi);
90 
91  edmSums.push_back(ht);
92  edmSums.push_back(mht);
93  return edmSums;
94 }
float floatPhi(phi_t phi)
Definition: gt_datatypes.h:48
l1gt::Sum toGT() const
Definition: sums.h:50
float floatPt(pt_t pt)
Definition: gt_datatypes.h:46
pt_t vector_pt
Definition: gt_datatypes.h:142
phi_t vector_phi
Definition: gt_datatypes.h:143
pt_t scalar_pt
Definition: gt_datatypes.h:144
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38

◆ produce()

void L1MhtPfProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 42 of file L1MHtPFProducer.cc.

References funct::abs(), convertEDMToHW(), convertHWToEDM(), htmht(), iEvent, metsig::jet, jetsToken, maxJetEta, minJetPt, and eostools::move().

42  {
43  // Get the jets from the event
44  l1t::PFJetCollection edmJets = iEvent.get(jetsToken);
45 
46  // Apply pT and eta selections
47  l1t::PFJetCollection edmJetsFiltered;
48  std::copy_if(edmJets.begin(), edmJets.end(), std::back_inserter(edmJetsFiltered), [&](auto jet) {
49  return jet.pt() > minJetPt && std::abs(jet.eta()) < maxJetEta;
50  });
51 
52  // Run the emulation
53  std::vector<l1ct::Jet> hwJets = convertEDMToHW(edmJetsFiltered); // convert to the emulator format
54  l1ct::Sum hwSums = htmht(hwJets); // call the emulator
55  std::vector<l1t::EtSum> edmSums = convertHWToEDM(hwSums); // convert back to edm format
56 
57  // Put the sums in the event
58  std::unique_ptr<std::vector<l1t::EtSum>> mhtCollection(new std::vector<l1t::EtSum>(0));
59  mhtCollection->push_back(edmSums.at(0)); // HT
60  mhtCollection->push_back(edmSums.at(1)); // MHT
61 
62  iEvent.put(std::move(mhtCollection));
63 }
l1ct::Sum htmht(std::vector< l1ct::Jet > jets)
std::vector< l1t::EtSum > convertHWToEDM(l1ct::Sum hwSums) const
std::vector< l1t::PFJet > PFJetCollection
Definition: PFJet.h:61
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< std::vector< l1t::PFJet > > jetsToken
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: sums.h:10
std::vector< l1ct::Jet > convertEDMToHW(std::vector< l1t::PFJet > edmJets) const
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ jetsToken

edm::EDGetTokenT<std::vector<l1t::PFJet> > L1MhtPfProducer::jetsToken
private

Definition at line 27 of file L1MHtPFProducer.cc.

Referenced by produce().

◆ maxJetEta

float L1MhtPfProducer::maxJetEta
private

Definition at line 29 of file L1MHtPFProducer.cc.

Referenced by produce().

◆ minJetPt

float L1MhtPfProducer::minJetPt
private

Definition at line 28 of file L1MHtPFProducer.cc.

Referenced by produce().