CMS 3D CMS Logo

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

Public Member Functions

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

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 Member Functions

std::vector< l1t::PFTauprocessEvent_HW (std::vector< edm::Ptr< l1t::PFCandidate >> &parts, std::vector< edm::Ptr< reco::CaloJet >> &jets) const
 
void produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 

Static Private Member Functions

static std::vector< l1HPSPFTauEmu::ParticleconvertEDMToHW (std::vector< edm::Ptr< l1t::PFCandidate >> &edmParticles)
 
static std::vector< l1t::PFTauconvertHWToEDM (std::vector< l1HPSPFTauEmu::Tau > hwTaus)
 
static std::vector< l1HPSPFTauEmu::ParticleconvertJetsToHW (std::vector< edm::Ptr< reco::CaloJet >> &edmJets)
 

Private Attributes

bool debug_
 
bool fUseJets_
 
bool HW_
 
int nTaus_
 
edm::EDPutTokenT< l1t::PFTauCollectiontauToken_
 
edm::EDGetTokenT< l1t::PFCandidateCollectiontokenL1PFCands_
 
edm::EDGetTokenT< std::vector< reco::CaloJet > > tokenL1PFJets_
 

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
 
- 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 L1HPSPFTauProducer.cc.

Constructor & Destructor Documentation

◆ L1HPSPFTauProducer()

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

Definition at line 49 of file L1HPSPFTauProducer.cc.

References edm::ProductRegistryHelper::produces().

50  : nTaus_(cfg.getParameter<int>("nTaus")),
51  HW_(cfg.getParameter<bool>("HW")),
52  fUseJets_(cfg.getParameter<bool>("useJets")),
53  debug_(cfg.getParameter<bool>("debug")),
54  tokenL1PFCands_(consumes(cfg.getParameter<edm::InputTag>("srcL1PFCands"))),
55  tokenL1PFJets_(consumes(cfg.getParameter<edm::InputTag>("srcL1PFJets"))),
56  tauToken_{produces()} {}
edm::EDGetTokenT< std::vector< reco::CaloJet > > tokenL1PFJets_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDPutTokenT< l1t::PFTauCollection > tauToken_
edm::EDGetTokenT< l1t::PFCandidateCollection > tokenL1PFCands_

◆ ~L1HPSPFTauProducer()

L1HPSPFTauProducer::~L1HPSPFTauProducer ( )
inlineoverride

Definition at line 23 of file L1HPSPFTauProducer.cc.

23 {};

Member Function Documentation

◆ convertEDMToHW()

std::vector< l1HPSPFTauEmu::Particle > L1HPSPFTauProducer::convertEDMToHW ( std::vector< edm::Ptr< l1t::PFCandidate >> &  edmParticles)
staticprivate

Definition at line 132 of file L1HPSPFTauProducer.cc.

References l1HPSPFTauEmu::dz_base, l1HPSPFTauEmu::etaphi_base, l1ct::PuppiObj::hwEta, l1ct::PuppiObj::hwPhi, l1ct::PuppiObj::hwPt, l1ct::Scales::makePtFromFloat(), l1HPSPFTauEmu::Particle::pID, and l1HPSPFTauEmu::Particle::tempZ0.

Referenced by processEvent_HW().

133  {
134  using namespace l1HPSPFTauEmu;
135  std::vector<Particle> hwParticles;
136 
137  std::for_each(edmParticles.begin(), edmParticles.end(), [&](edm::Ptr<l1t::PFCandidate>& edmParticle) {
138  Particle hwPart;
139  hwPart.hwPt = l1ct::Scales::makePtFromFloat(edmParticle->pt());
140  hwPart.hwEta = edmParticle->eta() * etaphi_base;
141  hwPart.hwPhi = edmParticle->phi() * etaphi_base;
142  hwPart.pID = edmParticle->id();
143  if (edmParticle->z0()) {
144  hwPart.tempZ0 = edmParticle->z0() / dz_base;
145  }
146  hwParticles.push_back(hwPart);
147  });
148  return hwParticles;
149 }
pt_t makePtFromFloat(float pt)
Definition: datatypes.h:181
glbeta_t hwEta
Definition: puppi.h:13
glbphi_t hwPhi
Definition: puppi.h:14
pt_t hwPt
Definition: puppi.h:12
constexpr float dz_base
constexpr float etaphi_base

◆ convertHWToEDM()

std::vector< l1t::PFTau > L1HPSPFTauProducer::convertHWToEDM ( std::vector< l1HPSPFTauEmu::Tau hwTaus)
staticprivate

Definition at line 151 of file L1HPSPFTauProducer.cc.

References l1HPSPFTauEmu::etaphi_base, l1ct::Scales::floatPt(), l1t::gtTau, l1t::PFTau::set_encodedTau(), and metsig::tau.

Referenced by processEvent_HW().

151  {
152  using namespace l1HPSPFTauEmu;
153  std::vector<l1t::PFTau> edmTaus;
154 
155  //empty array for the PFTau format, since it's used for PuppiTaus but not here
156  float tauArray[80] = {0};
157  std::for_each(hwTaus.begin(), hwTaus.end(), [&](Tau tau) {
158  l1gt::Tau gtTau = tau.toGT();
159  l1gt::PackedTau packTau = gtTau.pack();
160 
161  l1t::PFTau pTau(
163  l1ct::Scales::floatPt(tau.hwPt), float(tau.hwEta) / etaphi_base, float(tau.hwPhi) / etaphi_base, 0),
164  tauArray,
165  0,
166  0,
167  0,
168  tau.hwPt,
169  tau.hwEta,
170  tau.hwPhi);
171  pTau.set_encodedTau(packTau);
172  edmTaus.push_back(pTau);
173  });
174  return edmTaus;
175 }
std::array< uint64_t, 2 > PackedTau
Definition: gt_datatypes.h:38
float floatPt(pt_t pt)
Definition: datatypes.h:153
Definition: Tau.py:1
constexpr float etaphi_base
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38

◆ convertJetsToHW()

std::vector< l1HPSPFTauEmu::Particle > L1HPSPFTauProducer::convertJetsToHW ( std::vector< edm::Ptr< reco::CaloJet >> &  edmJets)
staticprivate

Definition at line 117 of file L1HPSPFTauProducer.cc.

References l1HPSPFTauEmu::etaphi_base, l1ct::PuppiObj::hwEta, l1ct::PuppiObj::hwPhi, l1ct::PuppiObj::hwPt, l1ct::Scales::makePtFromFloat(), and l1HPSPFTauEmu::Particle::tempZ0.

Referenced by processEvent_HW().

117  {
118  using namespace l1HPSPFTauEmu;
119  std::vector<Particle> hwJets;
120  std::for_each(edmJets.begin(), edmJets.end(), [&](edm::Ptr<reco::CaloJet>& edmJet) {
122  jPart.hwPt = l1ct::Scales::makePtFromFloat(edmJet->pt());
123  jPart.hwEta = edmJet->eta() * etaphi_base;
124  jPart.hwPhi = edmJet->phi() * etaphi_base;
125  jPart.tempZ0 = 0.;
126  hwJets.push_back(jPart);
127  });
128  return hwJets;
129 }
pt_t makePtFromFloat(float pt)
Definition: datatypes.h:181
glbeta_t hwEta
Definition: puppi.h:13
glbphi_t hwPhi
Definition: puppi.h:14
pt_t hwPt
Definition: puppi.h:12
constexpr float etaphi_base

◆ fillDescriptions()

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

Definition at line 58 of file L1HPSPFTauProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

58  {
60 
61  desc.add<edm::InputTag>("srcL1PFCands", edm::InputTag("l1tLayer1", "Puppi"));
62  desc.add<int>("nTaus", 16);
63  desc.add<bool>("HW", true);
64  desc.add<bool>("useJets", false);
65  desc.add<bool>("debug", false);
66  desc.add<edm::InputTag>("srcL1PFJets",
67  edm::InputTag("l1tPhase1JetCalibrator9x9trimmed", "Phase1L1TJetFromPfCandidates"));
68  descriptions.add("l1tHPSPFTauProducer", desc);
69 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ processEvent_HW()

std::vector< l1t::PFTau > L1HPSPFTauProducer::processEvent_HW ( std::vector< edm::Ptr< l1t::PFCandidate >> &  parts,
std::vector< edm::Ptr< reco::CaloJet >> &  jets 
) const
private

Definition at line 99 of file L1HPSPFTauProducer.cc.

References convertEDMToHW(), convertHWToEDM(), convertJetsToHW(), l1HPSPFTauEmu::emulateEvent(), fUseJets_, PDWG_EXODelayedJetMET_cff::jets, ecalTrigSettings_cff::particles, Tau3MuMonitor_cff::taus, and edmIntegrityCheck::work.

Referenced by produce().

100  {
101  //convert and call emulator
102 
103  using namespace l1HPSPFTauEmu;
104 
105  std::vector<Particle> particles = convertEDMToHW(work);
106 
107  std::vector<Particle> jets = convertJetsToHW(jwork);
108  //also need to pass the jet enabler
109 
110  bool jEnable = fUseJets_;
111 
112  std::vector<Tau> taus = emulateEvent(particles, jets, jEnable);
113 
114  return convertHWToEDM(taus);
115 }
std::vector< Tau > emulateEvent(std::vector< Particle > &parts, std::vector< Particle > &jets, bool jEnable)
static std::vector< l1HPSPFTauEmu::Particle > convertEDMToHW(std::vector< edm::Ptr< l1t::PFCandidate >> &edmParticles)
static std::vector< l1t::PFTau > convertHWToEDM(std::vector< l1HPSPFTauEmu::Tau > hwTaus)
static std::vector< l1HPSPFTauEmu::Particle > convertJetsToHW(std::vector< edm::Ptr< reco::CaloJet >> &edmJets)

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 71 of file L1HPSPFTauProducer.cc.

References mps_fire::i, iEvent, dqmiolumiharvest::j, PDWG_EXODelayedJetMET_cff::jets, eostools::move(), ecalTrigSettings_cff::particles, processEvent_HW(), jetUpdater_cfi::sort, Tau3MuMonitor_cff::taus, tauToken_, tokenL1PFCands_, and tokenL1PFJets_.

71  {
72  auto l1PFCandidates = iEvent.getHandle(tokenL1PFCands_);
73  //add jets even if not used, for simplicity
74  auto l1PFJets = iEvent.getHandle(tokenL1PFJets_);
75  //
76 
77  //adding collection
78  std::vector<edm::Ptr<l1t::PFCandidate>> particles;
79  for (unsigned i = 0; i < (*l1PFCandidates).size(); i++) {
80  particles.push_back(edm::Ptr<l1t::PFCandidate>(l1PFCandidates, i));
81  }
82 
83  //get the jets
84  std::vector<edm::Ptr<reco::CaloJet>> jets;
85  for (unsigned int i = 0; i < (*l1PFJets).size(); i++) {
86  jets.push_back(edm::Ptr<reco::CaloJet>(l1PFJets, i));
87  //
88  }
89 
90  std::vector<l1t::PFTau> taus;
91 
93 
94  std::sort(taus.begin(), taus.end(), [](const l1t::PFTau& i, const l1t::PFTau& j) { return (i.pt() > j.pt()); });
95 
96  iEvent.emplace(tauToken_, std::move(taus));
97 }
edm::EDGetTokenT< std::vector< reco::CaloJet > > tokenL1PFJets_
int iEvent
Definition: GenABIO.cc:224
std::vector< l1t::PFTau > processEvent_HW(std::vector< edm::Ptr< l1t::PFCandidate >> &parts, std::vector< edm::Ptr< reco::CaloJet >> &jets) const
edm::EDPutTokenT< l1t::PFTauCollection > tauToken_
edm::EDGetTokenT< l1t::PFCandidateCollection > tokenL1PFCands_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ debug_

bool L1HPSPFTauProducer::debug_
private

Definition at line 33 of file L1HPSPFTauProducer.cc.

◆ fUseJets_

bool L1HPSPFTauProducer::fUseJets_
private

Definition at line 32 of file L1HPSPFTauProducer.cc.

Referenced by processEvent_HW().

◆ HW_

bool L1HPSPFTauProducer::HW_
private

Definition at line 31 of file L1HPSPFTauProducer.cc.

◆ nTaus_

int L1HPSPFTauProducer::nTaus_
private

Definition at line 30 of file L1HPSPFTauProducer.cc.

◆ tauToken_

edm::EDPutTokenT<l1t::PFTauCollection> L1HPSPFTauProducer::tauToken_
private

Definition at line 46 of file L1HPSPFTauProducer.cc.

Referenced by produce().

◆ tokenL1PFCands_

edm::EDGetTokenT<l1t::PFCandidateCollection> L1HPSPFTauProducer::tokenL1PFCands_
private

Definition at line 35 of file L1HPSPFTauProducer.cc.

Referenced by produce().

◆ tokenL1PFJets_

edm::EDGetTokenT<std::vector<reco::CaloJet> > L1HPSPFTauProducer::tokenL1PFJets_
private

Definition at line 37 of file L1HPSPFTauProducer.cc.

Referenced by produce().