CMS 3D CMS Logo

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

#include <HLTrigger/JetMET/plugins/HLTScoutingCaloProducer.cc>

Inheritance diagram for HLTScoutingCaloProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTScoutingCaloProducer (const edm::ParameterSet &)
 
 ~HLTScoutingCaloProducer ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, 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 updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void produce (edm::StreamID sid, edm::Event &iEvent, edm::EventSetup const &setup) const override final
 

Private Attributes

const edm::EDGetTokenT< reco::JetTagCollectioncaloJetBTagCollection_
 
const edm::EDGetTokenT< reco::CaloJetCollectioncaloJetCollection_
 
const double caloJetEtaCut
 
const edm::EDGetTokenT< reco::JetTagCollectioncaloJetIDTagCollection_
 
const double caloJetPtCut
 
const bool doJetBTags
 
const bool doJetIDTags
 
const bool doMet
 
const edm::EDGetTokenT< reco::CaloMETCollectionmetCollection_
 
const edm::EDGetTokenT< double > rho_
 
const edm::EDGetTokenT< reco::VertexCollectionvertexCollection_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Description: Producer for ScoutingCaloJets from reco::CaloJet objects

Definition at line 39 of file HLTScoutingCaloProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 67 of file HLTScoutingCaloProducer.cc.

67  :
68  caloJetCollection_(consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("caloJetCollection"))),
69  caloJetBTagCollection_(consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("caloJetBTagCollection"))),
70  caloJetIDTagCollection_(consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("caloJetIDTagCollection"))),
71  vertexCollection_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"))),
72  metCollection_(consumes<reco::CaloMETCollection>(iConfig.getParameter<edm::InputTag>("metCollection"))),
73  rho_(consumes<double>(iConfig.getParameter<edm::InputTag>("rho"))),
74  caloJetPtCut(iConfig.getParameter<double>("caloJetPtCut")),
75  caloJetEtaCut(iConfig.getParameter<double>("caloJetEtaCut")),
76  doMet(iConfig.getParameter<bool>("doMet")),
77  doJetBTags(iConfig.getParameter<bool>("doJetBTags")),
78  doJetIDTags(iConfig.getParameter<bool>("doJetIDTags"))
79 {
80  //register products
81  produces<ScoutingCaloJetCollection>();
82  produces<double>("rho");
83  produces<double>("caloMetPt");
84  produces<double>("caloMetPhi");
85 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
const edm::EDGetTokenT< reco::CaloMETCollection > metCollection_
const edm::EDGetTokenT< reco::CaloJetCollection > caloJetCollection_
const edm::EDGetTokenT< double > rho_
const edm::EDGetTokenT< reco::JetTagCollection > caloJetIDTagCollection_
const edm::EDGetTokenT< reco::JetTagCollection > caloJetBTagCollection_
HLTScoutingCaloProducer::~HLTScoutingCaloProducer ( )

Definition at line 87 of file HLTScoutingCaloProducer.cc.

88 { }

Member Function Documentation

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

Definition at line 174 of file HLTScoutingCaloProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

174  {
176  desc.add<edm::InputTag>("caloJetCollection",edm::InputTag("hltAK4CaloJets"));
177  desc.add<edm::InputTag>("caloJetBTagCollection",edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo"));
178  desc.add<edm::InputTag>("caloJetIDTagCollection",edm::InputTag("hltCaloJetFromPV"));
179  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
180  desc.add<edm::InputTag>("metCollection", edm::InputTag("hltMet"));
181  desc.add<edm::InputTag>("rho", edm::InputTag("hltFixedGridRhoFastjetAllCalo"));
182  desc.add<double>("caloJetPtCut", 20.0);
183  desc.add<double>("caloJetEtaCut", 3.0);
184  desc.add<bool>("doMet", true);
185  desc.add<bool>("doJetBTags", false);
186  desc.add<bool>("doJetIDTags", false);
187  descriptions.add("hltScoutingCaloProducer", desc);
188 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTScoutingCaloProducer::produce ( edm::StreamID  sid,
edm::Event iEvent,
edm::EventSetup const &  setup 
) const
finaloverrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 92 of file HLTScoutingCaloProducer.cc.

References caloJetBTagCollection_, caloJetCollection_, caloJetEtaCut, caloJetIDTagCollection_, caloJetPtCut, reco::deltaR2(), doJetBTags, doJetIDTags, doMet, edm::Event::getByToken(), metsig::jet, MT2Analyzer::metCollection, metCollection_, eostools::move(), edm::Event::put(), rho, rho_, and GlobalPosition_Frontier_DevDB_cff::tag.

93 {
94  using namespace edm;
95 
96  //get calo jets
97  Handle<reco::CaloJetCollection> caloJetCollection;
98  std::unique_ptr<ScoutingCaloJetCollection> outCaloJets(new ScoutingCaloJetCollection());
99  if(iEvent.getByToken(caloJetCollection_, caloJetCollection)){
100  //get jet tags
101  Handle<reco::JetTagCollection> caloJetBTagCollection;
102  bool haveJetBTags = false;
103  if(doJetBTags && iEvent.getByToken(caloJetBTagCollection_, caloJetBTagCollection)){
104  haveJetBTags = true;
105  }
106  Handle<reco::JetTagCollection> caloJetIDTagCollection;
107  bool haveJetIDTags = false;
108  if(doJetIDTags && iEvent.getByToken(caloJetIDTagCollection_, caloJetIDTagCollection)){
109  haveJetIDTags = true;
110  }
111 
112  for(auto &jet : *caloJetCollection){
113  if(jet.pt() > caloJetPtCut && fabs(jet.eta()) < caloJetEtaCut){
114  //find the jet tag(s) corresponding to the jet
115  float bTagValue = -20;
116  float bTagMinDR2 = 0.01;
117  if(haveJetBTags){
118  for(auto &tag : *caloJetBTagCollection){
119  float dR2 = reco::deltaR2(jet, *(tag.first));
120  if(dR2 < bTagMinDR2){
121  bTagMinDR2 = dR2;
122  bTagValue = tag.second;
123  }
124  }
125  }
126  float idTagValue = -20;
127  float idTagMinDR2 = 0.01;
128  if(haveJetIDTags){
129  for(auto &tag : *caloJetIDTagCollection){
130  float dR2 = reco::deltaR2(jet, *(tag.first));
131  if(dR2 < idTagMinDR2){
132  idTagMinDR2 = dR2;
133  idTagValue = tag.second;
134  }
135  }
136  }
137  outCaloJets->emplace_back(
138  jet.pt(), jet.eta(), jet.phi(), jet.mass(),
139  jet.jetArea(), jet.maxEInEmTowers(), jet.maxEInHadTowers(),
140  jet.hadEnergyInHB(), jet.hadEnergyInHE(), jet.hadEnergyInHF(),
141  jet.emEnergyInEB(), jet.emEnergyInEE(), jet.emEnergyInHF(),
142  jet.towersArea(), idTagValue, bTagValue
143  );
144  }
145  }
146  }
147 
148  //get rho
150  std::unique_ptr<double> outRho(new double(-999));
151  if(iEvent.getByToken(rho_, rho)){
152  outRho.reset(new double(*rho));
153  }
154 
155  //get MET
157  std::unique_ptr<double> outMetPt(new double(-999));
158  std::unique_ptr<double> outMetPhi(new double(-999));
159  if(doMet && iEvent.getByToken(metCollection_, metCollection)){
160  outMetPt.reset(new double(metCollection->front().pt()));
161  outMetPhi.reset(new double(metCollection->front().phi()));
162  }
163 
164  //put output
165  iEvent.put(std::move(outCaloJets));
166  // iEvent.put(std::move(outVertices));
167  iEvent.put(std::move(outRho), "rho");
168  iEvent.put(std::move(outMetPt), "caloMetPt");
169  iEvent.put(std::move(outMetPhi), "caloMetPhi");
170 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const edm::EDGetTokenT< reco::CaloMETCollection > metCollection_
std::vector< ScoutingCaloJet > ScoutingCaloJetCollection
const edm::EDGetTokenT< reco::CaloJetCollection > caloJetCollection_
const edm::EDGetTokenT< double > rho_
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
HLT enums.
const edm::EDGetTokenT< reco::JetTagCollection > caloJetIDTagCollection_
def move(src, dest)
Definition: eostools.py:510
const edm::EDGetTokenT< reco::JetTagCollection > caloJetBTagCollection_

Member Data Documentation

const edm::EDGetTokenT<reco::JetTagCollection> HLTScoutingCaloProducer::caloJetBTagCollection_
private

Definition at line 50 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<reco::CaloJetCollection> HLTScoutingCaloProducer::caloJetCollection_
private

Definition at line 49 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const double HLTScoutingCaloProducer::caloJetEtaCut
private

Definition at line 57 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<reco::JetTagCollection> HLTScoutingCaloProducer::caloJetIDTagCollection_
private

Definition at line 51 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const double HLTScoutingCaloProducer::caloJetPtCut
private

Definition at line 56 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const bool HLTScoutingCaloProducer::doJetBTags
private

Definition at line 60 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const bool HLTScoutingCaloProducer::doJetIDTags
private

Definition at line 61 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const bool HLTScoutingCaloProducer::doMet
private

Definition at line 59 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<reco::CaloMETCollection> HLTScoutingCaloProducer::metCollection_
private

Definition at line 53 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<double> HLTScoutingCaloProducer::rho_
private

Definition at line 54 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<reco::VertexCollection> HLTScoutingCaloProducer::vertexCollection_
private

Definition at line 52 of file HLTScoutingCaloProducer.cc.