CMS 3D CMS Logo

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

#include <L1CaloJetHTTProducer.cc>

Inheritance diagram for L1CaloJetHTTProducer:
edm::stream::EDProducer<>

Public Member Functions

 L1CaloJetHTTProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::Handle< BXVector< l1t::Jet > > bxvCaloJetsHandle
 
edm::EDGetTokenT< BXVector< l1t::Jet > > bxvCaloJetsToken_
 
bool debug
 
double EtaMax
 
edm::Handle< std::vector< reco::GenJet > > genJetsHandle
 
edm::EDGetTokenT< std::vector< reco::GenJet > > genJetsToken_
 
double PtMin
 
bool use_gen_jets
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: Use the L1CaloJetProducer collections to calculate HTT energy sum for CaloJets

Implementation: [Notes on implementation]

Definition at line 39 of file L1CaloJetHTTProducer.cc.

Constructor & Destructor Documentation

◆ L1CaloJetHTTProducer()

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

Definition at line 62 of file L1CaloJetHTTProducer.cc.

63  : EtaMax(iConfig.getParameter<double>("EtaMax")),
64  PtMin(iConfig.getParameter<double>("PtMin")),
65  bxvCaloJetsToken_(consumes<BXVector<l1t::Jet>>(iConfig.getParameter<edm::InputTag>("BXVCaloJetsInputTag"))),
66  genJetsToken_(consumes<std::vector<reco::GenJet>>(iConfig.getParameter<edm::InputTag>("genJets"))),
67  debug(iConfig.getParameter<bool>("debug")),
68  use_gen_jets(iConfig.getParameter<bool>("use_gen_jets"))
69 
70 {
71  produces<float>("CaloJetHTT");
72 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< std::vector< reco::GenJet > > genJetsToken_
edm::EDGetTokenT< BXVector< l1t::Jet > > bxvCaloJetsToken_

Member Function Documentation

◆ produce()

void L1CaloJetHTTProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 74 of file L1CaloJetHTTProducer.cc.

References funct::abs(), bxvCaloJetsHandle, bxvCaloJetsToken_, debug, EtaMax, nano_mu_digi_cff::float, genJetsHandle, genJetsToken_, iEvent, edm::HandleBase::isValid(), LogDebug, eostools::move(), edm::Handle< T >::product(), PtMin, and use_gen_jets.

74  {
75  // Output collections
76  std::unique_ptr<float> CaloJetHTT(new float);
77 
78  *CaloJetHTT = 0.;
79 
80  // CaloJet HTT for L1 collections
81  if (!use_gen_jets) {
83 
84  if (bxvCaloJetsHandle.isValid()) {
85  for (const auto& caloJet : *bxvCaloJetsHandle.product()) {
86  if (caloJet.pt() < PtMin)
87  continue;
88  if (std::abs(caloJet.eta()) > EtaMax)
89  continue;
90  *CaloJetHTT += float(caloJet.pt());
91  }
92  }
93 
94  if (debug) {
95  LogDebug("L1CaloJetHTTProducer") << " BXV L1CaloJetCollection JetHTT = " << *CaloJetHTT << " for PtMin " << PtMin
96  << " and EtaMax " << EtaMax << "\n";
97  }
98  }
99 
100  // CaloJet HTT for gen jets
101  if (use_gen_jets) {
102  iEvent.getByToken(genJetsToken_, genJetsHandle);
103 
104  if (genJetsHandle.isValid()) {
105  for (const auto& genJet : *genJetsHandle.product()) {
106  if (genJet.pt() < PtMin)
107  continue;
108  if (std::abs(genJet.eta()) > EtaMax)
109  continue;
110  *CaloJetHTT += float(genJet.pt());
111  }
112  }
113 
114  if (debug) {
115  LogDebug("L1CaloJetHTTProducer") << " Gen Jets HTT = " << *CaloJetHTT << " for PtMin " << PtMin << " and EtaMax "
116  << EtaMax << "\n";
117  }
118  }
119 
120  iEvent.put(std::move(CaloJetHTT), "CaloJetHTT");
121 }
T const * product() const
Definition: Handle.h:70
edm::Handle< BXVector< l1t::Jet > > bxvCaloJetsHandle
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< std::vector< reco::GenJet > > genJetsToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::Handle< std::vector< reco::GenJet > > genJetsHandle
edm::EDGetTokenT< BXVector< l1t::Jet > > bxvCaloJetsToken_
bool isValid() const
Definition: HandleBase.h:70
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ bxvCaloJetsHandle

edm::Handle<BXVector<l1t::Jet> > L1CaloJetHTTProducer::bxvCaloJetsHandle
private

Definition at line 50 of file L1CaloJetHTTProducer.cc.

Referenced by produce().

◆ bxvCaloJetsToken_

edm::EDGetTokenT<BXVector<l1t::Jet> > L1CaloJetHTTProducer::bxvCaloJetsToken_
private

Definition at line 49 of file L1CaloJetHTTProducer.cc.

Referenced by produce().

◆ debug

bool L1CaloJetHTTProducer::debug
private

◆ EtaMax

double L1CaloJetHTTProducer::EtaMax
private

Definition at line 46 of file L1CaloJetHTTProducer.cc.

Referenced by produce().

◆ genJetsHandle

edm::Handle<std::vector<reco::GenJet> > L1CaloJetHTTProducer::genJetsHandle
private

Definition at line 55 of file L1CaloJetHTTProducer.cc.

Referenced by produce().

◆ genJetsToken_

edm::EDGetTokenT<std::vector<reco::GenJet> > L1CaloJetHTTProducer::genJetsToken_
private

Definition at line 54 of file L1CaloJetHTTProducer.cc.

Referenced by produce().

◆ PtMin

double L1CaloJetHTTProducer::PtMin
private

Definition at line 47 of file L1CaloJetHTTProducer.cc.

Referenced by produce().

◆ use_gen_jets

bool L1CaloJetHTTProducer::use_gen_jets
private

Definition at line 59 of file L1CaloJetHTTProducer.cc.

Referenced by produce().