test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 overridefinal
 

Private Attributes

const edm::EDGetTokenT
< reco::JetTagCollection
caloJetBTagCollection_
 
const edm::EDGetTokenT
< reco::CaloJetCollection
caloJetCollection_
 
const double caloJetEtaCut
 
const edm::EDGetTokenT
< reco::JetTagCollection
caloJetIDTagCollection_
 
const double caloJetPtCut
 
const bool doJetBTags
 
const bool doJetIDTags
 
const bool doMet
 
const edm::EDGetTokenT
< reco::CaloMETCollection
metCollection_
 
const edm::EDGetTokenT< double > rho_
 
const edm::EDGetTokenT
< reco::VertexCollection
vertexCollection_
 

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<ScoutingVertexCollection>();
83  produces<double>("rho");
84  produces<double>("caloMetPt");
85  produces<double>("caloMetPhi");
86 }
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 88 of file HLTScoutingCaloProducer.cc.

89 { }

Member Function Documentation

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

Definition at line 187 of file HLTScoutingCaloProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_25ns10e33_v2_cff::InputTag.

187  {
189  desc.add<edm::InputTag>("caloJetCollection",edm::InputTag("hltAK4CaloJets"));
190  desc.add<edm::InputTag>("caloJetBTagCollection",edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo"));
191  desc.add<edm::InputTag>("caloJetIDTagCollection",edm::InputTag("hltCaloJetFromPV"));
192  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
193  desc.add<edm::InputTag>("metCollection", edm::InputTag("hltMet"));
194  desc.add<edm::InputTag>("rho", edm::InputTag("hltFixedGridRhoFastjetAllCalo"));
195  desc.add<double>("caloJetPtCut", 20.0);
196  desc.add<double>("caloJetEtaCut", 3.0);
197  desc.add<bool>("doMet", true);
198  desc.add<bool>("doJetBTags", false);
199  desc.add<bool>("doJetIDTags", false);
200  descriptions.add("hltScoutingCaloProducer", desc);
201 }
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 93 of file HLTScoutingCaloProducer.cc.

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

94 {
95  using namespace edm;
96 
97  //get calo jets
98  Handle<reco::CaloJetCollection> caloJetCollection;
99  std::auto_ptr<ScoutingCaloJetCollection> outCaloJets(new ScoutingCaloJetCollection());
100  if(iEvent.getByToken(caloJetCollection_, caloJetCollection)){
101  //get jet tags
102  Handle<reco::JetTagCollection> caloJetBTagCollection;
103  bool haveJetBTags = false;
104  if(doJetBTags && iEvent.getByToken(caloJetBTagCollection_, caloJetBTagCollection)){
105  haveJetBTags = true;
106  }
107  Handle<reco::JetTagCollection> caloJetIDTagCollection;
108  bool haveJetIDTags = false;
109  if(doJetIDTags && iEvent.getByToken(caloJetIDTagCollection_, caloJetIDTagCollection)){
110  haveJetIDTags = true;
111  }
112 
113  for(auto &jet : *caloJetCollection){
114  if(jet.pt() > caloJetPtCut && fabs(jet.eta()) < caloJetEtaCut){
115  //find the jet tag(s) corresponding to the jet
116  float bTagValue = -20;
117  float bTagMinDR2 = 0.01;
118  if(haveJetBTags){
119  for(auto &tag : *caloJetBTagCollection){
120  float dR2 = reco::deltaR2(jet, *(tag.first));
121  if(dR2 < bTagMinDR2){
122  bTagMinDR2 = dR2;
123  bTagValue = tag.second;
124  }
125  }
126  }
127  float idTagValue = -20;
128  float idTagMinDR2 = 0.01;
129  if(haveJetIDTags){
130  for(auto &tag : *caloJetIDTagCollection){
131  float dR2 = reco::deltaR2(jet, *(tag.first));
132  if(dR2 < idTagMinDR2){
133  idTagMinDR2 = dR2;
134  idTagValue = tag.second;
135  }
136  }
137  }
138  outCaloJets->emplace_back(
139  jet.pt(), jet.eta(), jet.phi(), jet.mass(),
140  jet.jetArea(), jet.maxEInEmTowers(), jet.maxEInHadTowers(),
141  jet.hadEnergyInHB(), jet.hadEnergyInHE(), jet.hadEnergyInHF(),
142  jet.emEnergyInEB(), jet.emEnergyInEE(), jet.emEnergyInHF(),
143  jet.towersArea(), idTagValue, bTagValue
144  );
145  }
146  }
147  }
148 
149  //get vertices
151  std::auto_ptr<ScoutingVertexCollection> outVertices(new ScoutingVertexCollection());
153  //produce vertices (only if present; otherwise return an empty collection)
154  for(auto &vtx : *vertexCollection){
155  outVertices->emplace_back(
156  vtx.x(), vtx.y(), vtx.z(), vtx.zError()
157  );
158  }
159  }
160 
161  //get rho
163  std::auto_ptr<double> outRho(new double(-999));
164  if(iEvent.getByToken(rho_, rho)){
165  outRho.reset(new double(*rho));
166  }
167 
168  //get MET
170  std::auto_ptr<double> outMetPt(new double(-999));
171  std::auto_ptr<double> outMetPhi(new double(-999));
173  outMetPt.reset(new double(metCollection->front().pt()));
174  outMetPhi.reset(new double(metCollection->front().phi()));
175  }
176 
177  //put output
178  iEvent.put(outCaloJets);
179  iEvent.put(outVertices);
180  iEvent.put(outRho, "rho");
181  iEvent.put(outMetPt, "caloMetPt");
182  iEvent.put(outMetPhi, "caloMetPhi");
183 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
const edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
const edm::EDGetTokenT< reco::CaloMETCollection > metCollection_
tuple vertexCollection
std::vector< ScoutingCaloJet > ScoutingCaloJetCollection
const edm::EDGetTokenT< reco::CaloJetCollection > caloJetCollection_
std::vector< ScoutingVertex > ScoutingVertexCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
const edm::EDGetTokenT< double > rho_
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
string metCollection
Definition: MT2Analyzer.py:466
const edm::EDGetTokenT< reco::JetTagCollection > caloJetIDTagCollection_
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.

Referenced by produce().