CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Phase1L1TJetSumsProducer Class Reference

#include <L1Trigger/L1CaloTrigger/plugin/Phase1L1TJetSumsProducer.cc>

Inheritance diagram for Phase1L1TJetSumsProducer:
edm::one::EDProducer< edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 Phase1L1TJetSumsProducer (const edm::ParameterSet &)
 
 ~Phase1L1TJetSumsProducer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () 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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

l1t::EtSum computeHT (const edm::Handle< std::vector< reco::CaloJet > > inputJets) const
 
l1t::EtSum computeMHT (const edm::Handle< std::vector< reco::CaloJet > > inputJets) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const std::vector< double > cosPhi_
 
const double htAbsEtaCut_
 
const double htPtThreshold_
 
const edm::EDGetTokenT< std::vector< reco::CaloJet > > inputJetCollectionTag_
 
const double mhtAbsEtaCut_
 
const double mhtPtThreshold_
 
const unsigned int nBinsPhi_
 
const std::string outputCollectionName_
 
const double phiLow_
 
const double phiStep_
 
const double phiUp_
 
const double ptlsb_
 
const std::vector< double > sinPhi_
 

Additional Inherited Members

- Public Types inherited from edm::one::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

Description: Computes HT and MHT from phase-1-like jets

INPUT PARAMETERS ***
sin/cosPhi: Value of sin/cos phi in the middle of each bin of the grid.
etaBinning: vdouble with eta binning (allows non-homogeneous binning in eta)
nBinsPhi: uint32, number of bins in phi
phiLow: double, min phi (typically -pi)
phiUp: double, max phi (typically +pi)
{m}htPtThreshold: Minimum jet pt for HT/MHT calculation
{m}htAbsEtaCut: 
pt/eta/philsb : lsb of quantities used in firmware implementation
outputCollectionName: string, tag for the output collection
 inputCollectionTag: tag for input jet collection

Definition at line 42 of file Phase1L1TJetSumsProducer.cc.

Constructor & Destructor Documentation

◆ Phase1L1TJetSumsProducer()

Phase1L1TJetSumsProducer::Phase1L1TJetSumsProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 88 of file Phase1L1TJetSumsProducer.cc.

References edm::ParameterSet::getParameter().

89  : inputJetCollectionTag_{consumes<std::vector<reco::CaloJet> >(
90  iConfig.getParameter<edm::InputTag>("inputJetCollectionTag"))},
91  sinPhi_(iConfig.getParameter<std::vector<double> >("sinPhi")),
92  cosPhi_(iConfig.getParameter<std::vector<double> >("cosPhi")),
93  nBinsPhi_(iConfig.getParameter<unsigned int>("nBinsPhi")),
94  phiLow_(iConfig.getParameter<double>("phiLow")),
95  phiUp_(iConfig.getParameter<double>("phiUp")),
97  htPtThreshold_(iConfig.getParameter<double>("htPtThreshold")),
98  mhtPtThreshold_(iConfig.getParameter<double>("mhtPtThreshold")),
99  htAbsEtaCut_(iConfig.getParameter<double>("htAbsEtaCut")),
100  mhtAbsEtaCut_(iConfig.getParameter<double>("mhtAbsEtaCut")),
101  ptlsb_(iConfig.getParameter<double>("ptlsb")),
102  outputCollectionName_(iConfig.getParameter<std::string>("outputCollectionName")) {
103  usesResource("TFileService");
104  produces<std::vector<l1t::EtSum> >(outputCollectionName_).setBranchAlias(outputCollectionName_);
105 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::vector< double > sinPhi_
const std::vector< double > cosPhi_
const edm::EDGetTokenT< std::vector< reco::CaloJet > > inputJetCollectionTag_

◆ ~Phase1L1TJetSumsProducer()

Phase1L1TJetSumsProducer::~Phase1L1TJetSumsProducer ( )
overridedefault

Member Function Documentation

◆ computeHT()

l1t::EtSum Phase1L1TJetSumsProducer::computeHT ( const edm::Handle< std::vector< reco::CaloJet > >  inputJets) const
private

Definition at line 123 of file Phase1L1TJetSumsProducer.cc.

References htAbsEtaCut_, htPtThreshold_, HLT_2024v10_cff::inputJets, metsig::jet, L1Analysis::kTotalHt, phiLow_, and phiUp_.

Referenced by produce().

123  {
124  double lHT = 0;
125  for (const auto& jet : *inputJets) {
126  double lJetPt = jet.pt();
127  double lJetPhi = jet.phi();
128  double lJetEta = jet.eta();
129  if ((lJetPhi < phiLow_) || (lJetPhi >= phiUp_))
130  continue;
131 
132  lHT += (lJetPt >= htPtThreshold_ && std::fabs(lJetEta) < htAbsEtaCut_) ? lJetPt : 0;
133  }
134 
136  lHTVector.SetPt(lHT);
137  lHTVector.SetEta(0);
138  lHTVector.SetPhi(0);
139  l1t::EtSum lHTSum(lHTVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0);
140  return lHTSum;
141 }
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38

◆ computeMHT()

l1t::EtSum Phase1L1TJetSumsProducer::computeMHT ( const edm::Handle< std::vector< reco::CaloJet > >  inputJets) const
private

Definition at line 143 of file Phase1L1TJetSumsProducer.cc.

References cosPhi_, HLT_2024v10_cff::inputJets, metsig::jet, L1Analysis::kMissingHt, mhtAbsEtaCut_, mhtPtThreshold_, nBinsPhi_, phiLow_, phiStep_, phiUp_, ptlsb_, sinPhi_, mathSSE::sqrt(), and pileupReCalc_HLTpaths::trunc.

Referenced by produce().

143  {
144  int lTotalJetPx = 0;
145  int lTotalJetPy = 0;
146 
147  std::vector<unsigned int> jetPtInPhiBins(nBinsPhi_, 0);
148 
149  for (const auto& jet : *inputJets) {
150  double lJetPhi = jet.phi();
151 
152  if ((lJetPhi < phiLow_) || (lJetPhi >= phiUp_))
153  continue;
154 
155  unsigned int iPhi = (lJetPhi - phiLow_) / phiStep_;
156 
157  if (jet.pt() >= mhtPtThreshold_ && std::fabs(jet.eta()) < mhtAbsEtaCut_) {
158  unsigned int digiJetPt = floor(jet.pt() / ptlsb_);
159  jetPtInPhiBins[iPhi] += digiJetPt;
160  }
161  }
162 
163  for (unsigned int iPhi = 0; iPhi < jetPtInPhiBins.size(); ++iPhi) {
164  unsigned int digiJetPtSum = jetPtInPhiBins[iPhi];
165 
166  // retrieving sin cos from LUT emulator
167  double lSinPhi = sinPhi_[iPhi];
168  double lCosPhi = cosPhi_[iPhi];
169 
170  // checking if above threshold
171  lTotalJetPx += trunc(digiJetPtSum * lCosPhi);
172  lTotalJetPy += trunc(digiJetPtSum * lSinPhi);
173  }
174 
175  double lMHT = floor(sqrt(lTotalJetPx * lTotalJetPx + lTotalJetPy * lTotalJetPy)) * ptlsb_;
176  math::PtEtaPhiMLorentzVector lMHTVector(lMHT, 0, acos(lTotalJetPx / (lMHT / ptlsb_)), 0);
177  l1t::EtSum lMHTSum(lMHTVector, l1t::EtSum::EtSumType::kMissingHt, 0, 0, 0, 0);
178 
179  return lMHTSum;
180 }
const std::vector< double > sinPhi_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
const std::vector< double > cosPhi_
T sqrt(T t)
Definition: SSEVec.h:19

◆ fillDescriptions()

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

Definition at line 182 of file Phase1L1TJetSumsProducer.cc.

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

182  {
184  desc.add<edm::InputTag>("inputJetCollectionTag",
185  edm::InputTag("l1tPhase1JetCalibrator", "Phase1L1TJetFromPfCandidates"));
186  desc.add<std::vector<double> >("sinPhi");
187  desc.add<std::vector<double> >("cosPhi");
188  desc.add<unsigned int>("nBinsPhi", 72);
189  desc.add<double>("phiLow", -M_PI);
190  desc.add<double>("phiUp", M_PI);
191  desc.add<double>("htPtThreshold", 30);
192  desc.add<double>("mhtPtThreshold", 30);
193  desc.add<double>("htAbsEtaCut", 3);
194  desc.add<double>("mhtAbsEtaCut", 3);
195  desc.add<double>("ptlsb", 0.25), desc.add<string>("outputCollectionName", "Sums");
196  descriptions.add("Phase1L1TJetSumsProducer", desc);
197 }
#define M_PI
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Implements edm::one::EDProducerBase.

Definition at line 107 of file Phase1L1TJetSumsProducer.cc.

References computeHT(), computeMHT(), iEvent, inputJetCollectionTag_, eostools::move(), and outputCollectionName_.

107  {
108  const edm::Handle<std::vector<reco::CaloJet> >& jetCollectionHandle = iEvent.getHandle(inputJetCollectionTag_);
109 
110  // computing sums and storing them in sum object
111  l1t::EtSum lHT = computeHT(jetCollectionHandle);
112  l1t::EtSum lMHT = computeMHT(jetCollectionHandle);
113 
114  //packing sums in vector for event saving
115  std::unique_ptr<std::vector<l1t::EtSum> > lSumVectorPtr(new std::vector<l1t::EtSum>(0));
116  lSumVectorPtr->push_back(lHT);
117  lSumVectorPtr->push_back(lMHT);
118  iEvent.put(std::move(lSumVectorPtr), outputCollectionName_);
119 
120  return;
121 }
l1t::EtSum computeHT(const edm::Handle< std::vector< reco::CaloJet > > inputJets) const
l1t::EtSum computeMHT(const edm::Handle< std::vector< reco::CaloJet > > inputJets) const
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< std::vector< reco::CaloJet > > inputJetCollectionTag_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ cosPhi_

const std::vector<double> Phase1L1TJetSumsProducer::cosPhi_
private

Definition at line 64 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

◆ htAbsEtaCut_

const double Phase1L1TJetSumsProducer::htAbsEtaCut_
private

Definition at line 78 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeHT().

◆ htPtThreshold_

const double Phase1L1TJetSumsProducer::htPtThreshold_
private

Definition at line 74 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeHT().

◆ inputJetCollectionTag_

const edm::EDGetTokenT<std::vector<reco::CaloJet> > Phase1L1TJetSumsProducer::inputJetCollectionTag_
private

Definition at line 60 of file Phase1L1TJetSumsProducer.cc.

Referenced by produce().

◆ mhtAbsEtaCut_

const double Phase1L1TJetSumsProducer::mhtAbsEtaCut_
private

Definition at line 80 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

◆ mhtPtThreshold_

const double Phase1L1TJetSumsProducer::mhtPtThreshold_
private

Definition at line 76 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

◆ nBinsPhi_

const unsigned int Phase1L1TJetSumsProducer::nBinsPhi_
private

Definition at line 65 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

◆ outputCollectionName_

const std::string Phase1L1TJetSumsProducer::outputCollectionName_
private

Definition at line 84 of file Phase1L1TJetSumsProducer.cc.

Referenced by produce().

◆ phiLow_

const double Phase1L1TJetSumsProducer::phiLow_
private

Definition at line 68 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeHT(), and computeMHT().

◆ phiStep_

const double Phase1L1TJetSumsProducer::phiStep_
private

Definition at line 72 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

◆ phiUp_

const double Phase1L1TJetSumsProducer::phiUp_
private

Definition at line 70 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeHT(), and computeMHT().

◆ ptlsb_

const double Phase1L1TJetSumsProducer::ptlsb_
private

Definition at line 82 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

◆ sinPhi_

const std::vector<double> Phase1L1TJetSumsProducer::sinPhi_
private

Definition at line 63 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().