CMS 3D CMS Logo

HLTScoutingCaloProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTrigger/JetMET
4 // Class: HLTScoutingCaloProducer
5 //
11 //
12 // Original Author: Dustin James Anderson
13 // Created: Fri, 12 Jun 2015 15:49:20 GMT
14 //
15 //
16 
17 // system include files
18 #include <memory>
19 
20 // user include files
26 
33 
36 
38 
40 public:
42  ~HLTScoutingCaloProducer() override;
43 
44  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
45 
46 private:
47  void produce(edm::StreamID sid, edm::Event& iEvent, edm::EventSetup const& setup) const final;
48 
55 
56  const double caloJetPtCut;
57  const double caloJetEtaCut;
58 
59  const bool doMet;
60  const bool doJetBTags;
61  const bool doJetIDTags;
62 };
63 
64 //
65 // constructors and destructor
66 //
68  : caloJetCollection_(consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("caloJetCollection"))),
69  caloJetBTagCollection_(
70  consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("caloJetBTagCollection"))),
71  caloJetIDTagCollection_(
72  consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("caloJetIDTagCollection"))),
73  vertexCollection_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"))),
74  metCollection_(consumes<reco::CaloMETCollection>(iConfig.getParameter<edm::InputTag>("metCollection"))),
75  rho_(consumes<double>(iConfig.getParameter<edm::InputTag>("rho"))),
76  caloJetPtCut(iConfig.getParameter<double>("caloJetPtCut")),
77  caloJetEtaCut(iConfig.getParameter<double>("caloJetEtaCut")),
78  doMet(iConfig.getParameter<bool>("doMet")),
79  doJetBTags(iConfig.getParameter<bool>("doJetBTags")),
80  doJetIDTags(iConfig.getParameter<bool>("doJetIDTags")) {
81  //register products
82  produces<Run3ScoutingCaloJetCollection>();
83  produces<double>("rho");
84  produces<double>("caloMetPt");
85  produces<double>("caloMetPhi");
86 }
87 
89 
90 // ------------ method called to produce the data ------------
92  using namespace edm;
93 
94  //get calo jets
96  std::unique_ptr<Run3ScoutingCaloJetCollection> outCaloJets(new Run3ScoutingCaloJetCollection());
97  if (iEvent.getByToken(caloJetCollection_, caloJetCollection)) {
98  //get jet tags
100  bool haveJetBTags = false;
102  haveJetBTags = true;
103  }
105  bool haveJetIDTags = false;
107  haveJetIDTags = true;
108  }
109 
110  for (auto& jet : *caloJetCollection) {
111  if (jet.pt() > caloJetPtCut && fabs(jet.eta()) < caloJetEtaCut) {
112  //find the jet tag(s) corresponding to the jet
113  float bTagValue = -20;
114  float bTagMinDR2 = 0.01;
115  if (haveJetBTags) {
116  for (auto& tag : *caloJetBTagCollection) {
117  float dR2 = reco::deltaR2(jet, *(tag.first));
118  if (dR2 < bTagMinDR2) {
119  bTagMinDR2 = dR2;
120  bTagValue = tag.second;
121  }
122  }
123  }
124  float idTagValue = -20;
125  float idTagMinDR2 = 0.01;
126  if (haveJetIDTags) {
127  for (auto& tag : *caloJetIDTagCollection) {
128  float dR2 = reco::deltaR2(jet, *(tag.first));
129  if (dR2 < idTagMinDR2) {
130  idTagMinDR2 = dR2;
131  idTagValue = tag.second;
132  }
133  }
134  }
135  outCaloJets->emplace_back(jet.pt(),
136  jet.eta(),
137  jet.phi(),
138  jet.mass(),
139  jet.jetArea(),
140  jet.maxEInEmTowers(),
141  jet.maxEInHadTowers(),
142  jet.hadEnergyInHB(),
143  jet.hadEnergyInHE(),
144  jet.hadEnergyInHF(),
145  jet.emEnergyInEB(),
146  jet.emEnergyInEE(),
147  jet.emEnergyInHF(),
148  jet.towersArea(),
149  idTagValue,
150  bTagValue);
151  }
152  }
153  }
154 
155  //get rho
157  std::unique_ptr<double> outRho(new double(-999));
158  if (iEvent.getByToken(rho_, rho)) {
159  outRho = std::make_unique<double>(*rho);
160  }
161 
162  //get MET
164  std::unique_ptr<double> outMetPt(new double(-999));
165  std::unique_ptr<double> outMetPhi(new double(-999));
166  if (doMet && iEvent.getByToken(metCollection_, metCollection)) {
167  outMetPt = std::make_unique<double>(metCollection->front().pt());
168  outMetPhi = std::make_unique<double>(metCollection->front().phi());
169  }
170 
171  //put output
172  iEvent.put(std::move(outCaloJets));
173  // iEvent.put(std::move(outVertices));
174  iEvent.put(std::move(outRho), "rho");
175  iEvent.put(std::move(outMetPt), "caloMetPt");
176  iEvent.put(std::move(outMetPhi), "caloMetPhi");
177 }
178 
179 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
182  desc.add<edm::InputTag>("caloJetCollection", edm::InputTag("hltAK4CaloJets"));
183  desc.add<edm::InputTag>("caloJetBTagCollection", edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo"));
184  desc.add<edm::InputTag>("caloJetIDTagCollection", edm::InputTag("hltCaloJetFromPV"));
185  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
186  desc.add<edm::InputTag>("metCollection", edm::InputTag("hltMet"));
187  desc.add<edm::InputTag>("rho", edm::InputTag("hltFixedGridRhoFastjetAllCalo"));
188  desc.add<double>("caloJetPtCut", 20.0);
189  desc.add<double>("caloJetEtaCut", 3.0);
190  desc.add<bool>("doMet", true);
191  desc.add<bool>("doJetBTags", false);
192  desc.add<bool>("doJetIDTags", false);
193  descriptions.add("hltScoutingCaloProducer", desc);
194 }
195 
196 // declare this class as a framework plugin
edm::StreamID
Definition: StreamID.h:30
JetTag.h
CaloJet.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
HLT_FULL_cff.caloJetBTagCollection
caloJetBTagCollection
Definition: HLT_FULL_cff.py:122175
susyDQM_cfi.metCollection
metCollection
Definition: susyDQM_cfi.py:11
edm::EDGetTokenT< reco::CaloJetCollection >
Run3ScoutingVertex.h
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTScoutingCaloProducer::vertexCollection_
const edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
Definition: HLTScoutingCaloProducer.cc:52
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
HLT_FULL_cff.doMet
doMet
Definition: HLT_FULL_cff.py:122112
HLTScoutingCaloProducer::HLTScoutingCaloProducer
HLTScoutingCaloProducer(const edm::ParameterSet &)
Definition: HLTScoutingCaloProducer.cc:67
edm::Handle< reco::CaloJetCollection >
HLTScoutingCaloProducer::caloJetCollection_
const edm::EDGetTokenT< reco::CaloJetCollection > caloJetCollection_
Definition: HLTScoutingCaloProducer.cc:49
HLTScoutingCaloProducer::produce
void produce(edm::StreamID sid, edm::Event &iEvent, edm::EventSetup const &setup) const final
Definition: HLTScoutingCaloProducer.cc:91
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
CaloMETCollection.h
HLTScoutingCaloProducer::metCollection_
const edm::EDGetTokenT< reco::CaloMETCollection > metCollection_
Definition: HLTScoutingCaloProducer.cc:53
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CaloMET.h
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
HLT_FULL_cff.caloJetIDTagCollection
caloJetIDTagCollection
Definition: HLT_FULL_cff.py:122174
HLTScoutingCaloProducer::doMet
const bool doMet
Definition: HLTScoutingCaloProducer.cc:59
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
DDAxes::rho
Vertex.h
HLTScoutingCaloProducer::doJetIDTags
const bool doJetIDTags
Definition: HLTScoutingCaloProducer.cc:61
HLT_FULL_cff.doJetIDTags
doJetIDTags
Definition: HLT_FULL_cff.py:122171
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
deltaR.h
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
iEvent
int iEvent
Definition: GenABIO.cc:224
HLTScoutingCaloProducer::~HLTScoutingCaloProducer
~HLTScoutingCaloProducer() override
reco::CaloJetCollection
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Definition: CaloJetCollection.h:15
reco::JetTagCollection
JetFloatAssociation::Container JetTagCollection
Definition: JetTag.h:17
HLTScoutingCaloProducer::rho_
const edm::EDGetTokenT< double > rho_
Definition: HLTScoutingCaloProducer.cc:54
edm::EventSetup
Definition: EventSetup.h:57
HLT_FULL_cff.caloJetEtaCut
caloJetEtaCut
Definition: HLT_FULL_cff.py:122176
VertexFwd.h
HLTScoutingCaloProducer::doJetBTags
const bool doJetBTags
Definition: HLTScoutingCaloProducer.cc:60
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
metsig::jet
Definition: SignAlgoResolutions.h:47
HLTScoutingCaloProducer::caloJetIDTagCollection_
const edm::EDGetTokenT< reco::JetTagCollection > caloJetIDTagCollection_
Definition: HLTScoutingCaloProducer.cc:51
CaloMETCollection
Collection of Calo MET.
ParameterSet.h
HLT_FULL_cff.caloJetPtCut
caloJetPtCut
Definition: HLT_FULL_cff.py:122169
Run3ScoutingCaloJetCollection
std::vector< Run3ScoutingCaloJet > Run3ScoutingCaloJetCollection
Definition: Run3ScoutingCaloJet.h:99
EDProducer.h
HLTScoutingCaloProducer::caloJetEtaCut
const double caloJetEtaCut
Definition: HLTScoutingCaloProducer.cc:57
edm::Event
Definition: Event.h:73
HLTScoutingCaloProducer::caloJetPtCut
const double caloJetPtCut
Definition: HLTScoutingCaloProducer.cc:56
HLTScoutingCaloProducer::caloJetBTagCollection_
const edm::EDGetTokenT< reco::JetTagCollection > caloJetBTagCollection_
Definition: HLTScoutingCaloProducer.cc:50
pdwgLeptonRecoSkim_cfi.caloJetCollection
caloJetCollection
Definition: pdwgLeptonRecoSkim_cfi.py:8
HLTScoutingCaloProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTScoutingCaloProducer.cc:180
edm::InputTag
Definition: InputTag.h:15
Run3ScoutingCaloJet.h
HLT_FULL_cff.doJetBTags
doJetBTags
Definition: HLT_FULL_cff.py:122168
HLTScoutingCaloProducer
Definition: HLTScoutingCaloProducer.cc:39