CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
- 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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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

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

Additional Inherited Members

- Public Types inherited from edm::one::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::ProducerBase
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< B > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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 43 of file Phase1L1TJetSumsProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 89 of file Phase1L1TJetSumsProducer.cc.

References edm::ParameterSet::getParameter().

90  : inputJetCollectionTag_{consumes<std::vector<reco::CaloJet> >(
91  iConfig.getParameter<edm::InputTag>("inputJetCollectionTag"))},
92  sinPhi_(iConfig.getParameter<std::vector<double> >("sinPhi")),
93  cosPhi_(iConfig.getParameter<std::vector<double> >("cosPhi")),
94  nBinsPhi_(iConfig.getParameter<unsigned int>("nBinsPhi")),
95  phiLow_(iConfig.getParameter<double>("phiLow")),
96  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")) {
104  produces<std::vector<l1t::EtSum> >(outputCollectionName_).setBranchAlias(outputCollectionName_);
105 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< std::vector< reco::CaloJet > > inputJetCollectionTag_
Phase1L1TJetSumsProducer::~Phase1L1TJetSumsProducer ( )
override

Definition at line 107 of file Phase1L1TJetSumsProducer.cc.

107 {}

Member Function Documentation

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

Definition at line 126 of file Phase1L1TJetSumsProducer.cc.

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

Referenced by produce().

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

Definition at line 146 of file Phase1L1TJetSumsProducer.cc.

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

Referenced by produce().

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

Definition at line 185 of file Phase1L1TJetSumsProducer.cc.

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

185  {
187  desc.add<edm::InputTag>("inputJetCollectionTag",
188  edm::InputTag("Phase1L1TJetCalibrator", "Phase1L1TJetFromPfCandidates"));
189  desc.add<std::vector<double> >("sinPhi");
190  desc.add<std::vector<double> >("cosPhi");
191  desc.add<unsigned int>("nBinsPhi", 72);
192  desc.add<double>("phiLow", -M_PI);
193  desc.add<double>("phiUp", M_PI);
194  desc.add<double>("htPtThreshold", 30);
195  desc.add<double>("mhtPtThreshold", 30);
196  desc.add<double>("htAbsEtaCut", 3);
197  desc.add<double>("mhtAbsEtaCut", 3);
198  desc.add<double>("ptlsb", 0.25), desc.add<string>("outputCollectionName", "Sums");
199  descriptions.add("Phase1L1TJetSumsProducer", desc);
200 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define M_PI
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void Phase1L1TJetSumsProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 109 of file Phase1L1TJetSumsProducer.cc.

References computeHT(), computeMHT(), edm::Event::getByToken(), inputJetCollectionTag_, eostools::move(), outputCollectionName_, and edm::Event::put().

109  {
110  edm::Handle<std::vector<reco::CaloJet> > jetCollectionHandle;
111  iEvent.getByToken(inputJetCollectionTag_, jetCollectionHandle);
112 
113  // computing sums and storing them in sum object
114  l1t::EtSum lHT = computeHT(jetCollectionHandle);
115  l1t::EtSum lMHT = computeMHT(jetCollectionHandle);
116 
117  //packing sums in vector for event saving
118  std::unique_ptr<std::vector<l1t::EtSum> > lSumVectorPtr(new std::vector<l1t::EtSum>(0));
119  lSumVectorPtr->push_back(lHT);
120  lSumVectorPtr->push_back(lMHT);
121  iEvent.put(std::move(lSumVectorPtr), outputCollectionName_);
122 
123  return;
124 }
l1t::EtSum computeMHT(const edm::Handle< std::vector< reco::CaloJet > > inputJets) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
def move
Definition: eostools.py:511
l1t::EtSum computeHT(const edm::Handle< std::vector< reco::CaloJet > > inputJets) const
edm::EDGetTokenT< std::vector< reco::CaloJet > > inputJetCollectionTag_

Member Data Documentation

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

Definition at line 65 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

double Phase1L1TJetSumsProducer::htAbsEtaCut_
private

Definition at line 79 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeHT().

double Phase1L1TJetSumsProducer::htPtThreshold_
private

Definition at line 75 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeHT().

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

Definition at line 61 of file Phase1L1TJetSumsProducer.cc.

Referenced by produce().

double Phase1L1TJetSumsProducer::mhtAbsEtaCut_
private

Definition at line 81 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

double Phase1L1TJetSumsProducer::mhtPtThreshold_
private

Definition at line 77 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

unsigned int Phase1L1TJetSumsProducer::nBinsPhi_
private

Definition at line 66 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

std::string Phase1L1TJetSumsProducer::outputCollectionName_
private

Definition at line 85 of file Phase1L1TJetSumsProducer.cc.

Referenced by produce().

double Phase1L1TJetSumsProducer::phiLow_
private

Definition at line 69 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeHT(), and computeMHT().

double Phase1L1TJetSumsProducer::phiStep_
private

Definition at line 73 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

double Phase1L1TJetSumsProducer::phiUp_
private

Definition at line 71 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeHT(), and computeMHT().

double Phase1L1TJetSumsProducer::ptlsb_
private

Definition at line 83 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().

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

Definition at line 64 of file Phase1L1TJetSumsProducer.cc.

Referenced by computeMHT().