CMS 3D CMS Logo

L1CaloJetHTTProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1CaloTrigger
4 // Class: L1CaloJetHTTProducer
5 //
15 //
16 // Original Author: Tyler Ruggles
17 // Created: Fri Mar 22 2019
18 // $Id$
19 //
20 //
21 
29 
30 #include <iostream>
31 
32 // Run2/PhaseI output formats
35 // GenJets if needed
38 
40 public:
41  explicit L1CaloJetHTTProducer(const edm::ParameterSet&);
42 
43 private:
44  void produce(edm::Event&, const edm::EventSetup&) override;
45 
46  double EtaMax;
47  double PtMin;
48 
51 
52  // Gen jet collections are only loaded and used if requested
53  // (use_gen_jets == true)
56 
57  bool debug;
58 
60 };
61 
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 }
73 
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 (fabs(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 (fabs(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 }
122 
L1CaloJetHTTProducer::EtaMax
double EtaMax
Definition: L1CaloJetHTTProducer.cc:46
L1CaloJetHTTProducer::L1CaloJetHTTProducer
L1CaloJetHTTProducer(const edm::ParameterSet &)
Definition: L1CaloJetHTTProducer.cc:62
GenJetCollection.h
electrons_cff.bool
bool
Definition: electrons_cff.py:366
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
edm::Handle::product
T const * product() const
Definition: Handle.h:70
EDProducer.h
ESHandle.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
Jet.h
L1CaloJetHTTProducer::use_gen_jets
bool use_gen_jets
Definition: L1CaloJetHTTProducer.cc:59
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
edm::Handle
Definition: AssociativeIterator.h:50
BXVector
Definition: BXVector.h:15
MakerMacros.h
debug
#define debug
Definition: HDRShower.cc:19
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Jet
Definition: Jet.py:1
HLT_FULL_cff.PtMin
PtMin
Definition: HLT_FULL_cff.py:9921
L1CaloJetHTTProducer::PtMin
double PtMin
Definition: L1CaloJetHTTProducer.cc:47
Service.h
L1CaloJetHTTProducer::debug
bool debug
Definition: L1CaloJetHTTProducer.cc:57
L1JetParticleFwd.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
l1t
delete x;
Definition: CaloConfig.h:22
L1CaloJetHTTProducer::genJetsToken_
edm::EDGetTokenT< std::vector< reco::GenJet > > genJetsToken_
Definition: L1CaloJetHTTProducer.cc:54
iEvent
int iEvent
Definition: GenABIO.cc:224
L1CaloJetHTTProducer::genJetsHandle
edm::Handle< std::vector< reco::GenJet > > genJetsHandle
Definition: L1CaloJetHTTProducer.cc:55
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
L1CaloJetHTTProducer_cfi.use_gen_jets
use_gen_jets
Definition: L1CaloJetHTTProducer_cfi.py:9
edm::EventSetup
Definition: EventSetup.h:58
L1CaloJetHTTProducer::bxvCaloJetsToken_
edm::EDGetTokenT< BXVector< l1t::Jet > > bxvCaloJetsToken_
Definition: L1CaloJetHTTProducer.cc:49
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
MonitorTrackInnerTrackMuons_cff.EtaMax
EtaMax
Definition: MonitorTrackInnerTrackMuons_cff.py:64
Frameworkfwd.h
L1CaloJetHTTProducer::bxvCaloJetsHandle
edm::Handle< BXVector< l1t::Jet > > bxvCaloJetsHandle
Definition: L1CaloJetHTTProducer.cc:50
edm::EDProducer
Definition: EDProducer.h:35
GenJet.h
nanoDQM_cfi.GenJet
GenJet
Definition: nanoDQM_cfi.py:299
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
L1CaloJetHTTProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: L1CaloJetHTTProducer.cc:74
L1CaloJetHTTProducer
Definition: L1CaloJetHTTProducer.cc:39