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
 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 (const std::string &iProcessName, std::vector< const char * > &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::CaloJetCollection
caloJetCollection_
 
const double caloJetEtaCut
 
const double caloJetPtCut
 
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
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 36 of file HLTScoutingCaloProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 60 of file HLTScoutingCaloProducer.cc.

60  :
61  caloJetCollection_(consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("caloJetCollection"))),
62  vertexCollection_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"))),
63  metCollection_(consumes<reco::CaloMETCollection>(iConfig.getParameter<edm::InputTag>("metCollection"))),
64  rho_(consumes<double>(iConfig.getParameter<edm::InputTag>("rho"))),
65  caloJetPtCut(iConfig.getParameter<double>("caloJetPtCut")),
66  caloJetEtaCut(iConfig.getParameter<double>("caloJetEtaCut")),
67  doMet(iConfig.getParameter<bool>("doMet"))
68 {
69  //register products
70  produces<ScoutingCaloJetCollection>();
71  produces<ScoutingVertexCollection>();
72  produces<double>("rho");
73  produces<double>("caloMetPt");
74  produces<double>("caloMetPhi");
75 }
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_
HLTScoutingCaloProducer::~HLTScoutingCaloProducer ( )

Definition at line 77 of file HLTScoutingCaloProducer.cc.

78 { }

Member Function Documentation

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

Definition at line 154 of file HLTScoutingCaloProducer.cc.

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

154  {
156  desc.add<edm::InputTag>("caloJetCollection",edm::InputTag("hltAK4CaloJets"));
157  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
158  desc.add<edm::InputTag>("metCollection", edm::InputTag("hltMetCleanUsingJetID"));
159  desc.add<edm::InputTag>("rho", edm::InputTag("hltFixedGridRhoFastjetAllCalo"));
160  desc.add<double>("caloJetPtCut", 20.0);
161  desc.add<double>("caloJetEtaCut", 3.0);
162  desc.add<bool>("doMet", true);
163  descriptions.add("hltScoutingCaloProducer", desc);
164 }
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 82 of file HLTScoutingCaloProducer.cc.

References caloJetCollection_, caloJetEtaCut, caloJetPtCut, doMet, edm::Event::getByToken(), metsig::jet, objects.METAnalyzer::metCollection, metCollection_, edm::Event::put(), rho, rho_, GoodVertex_cfg::vertexCollection, and vertexCollection_.

83 {
84  using namespace edm;
85 
86  //get calo jets
87  Handle<reco::CaloJetCollection> caloJetCollection;
88  if(!iEvent.getByToken(caloJetCollection_, caloJetCollection)){
89  edm::LogError ("HLTScoutingCaloProducer") << "invalid collection: caloJetCollection" << "\n";
90  return;
91  }
92 
93  //get vertices
95  std::auto_ptr<ScoutingVertexCollection> outVertices(new ScoutingVertexCollection());
97  //produce vertices (only if present; otherwise return an empty collection)
98  for(auto &vtx : *vertexCollection){
99  outVertices->emplace_back(
100  vtx.x(), vtx.y(), vtx.z(), vtx.zError()
101  );
102  }
103  }
104 
105  //get rho
107  if(!iEvent.getByToken(rho_, rho)){
108  edm::LogError ("HLTScoutingCaloProducer") << "invalid collection: rho" << "\n";
109  return;
110  }
111  std::auto_ptr<double> outRho(new double(*rho));
112 
113  //get MET
115  if(doMet && !iEvent.getByToken(metCollection_, metCollection)){
116  edm::LogError ("HLTScoutingCaloProducer") << "invalid collection: metCollection" << "\n";
117  return;
118  }
119 
120  //produce calo jets
121  std::auto_ptr<ScoutingCaloJetCollection> outCaloJets(new ScoutingCaloJetCollection());
122  for(auto &jet : *caloJetCollection){
123  if(jet.pt() > caloJetPtCut && fabs(jet.eta()) < caloJetEtaCut){
124  outCaloJets->emplace_back(
125  jet.pt(), jet.eta(), jet.phi(), jet.mass(),
126  jet.jetArea(), jet.maxEInEmTowers(), jet.maxEInHadTowers(),
127  jet.hadEnergyInHB(), jet.hadEnergyInHE(), jet.hadEnergyInHF(),
128  jet.emEnergyInEB(), jet.emEnergyInEE(), jet.emEnergyInHF(),
129  jet.towersArea(), 0.0
130  );
131  }
132  }
133 
134  //produce MET
135  double metPt = -999;
136  double metPhi = -999;
137  if(doMet){
138  metPt = metCollection->front().pt();
139  metPhi = metCollection->front().phi();
140  }
141  std::auto_ptr<double> outMetPt(new double(metPt));
142  std::auto_ptr<double> outMetPhi(new double(metPhi));
143 
144  //put output
145  iEvent.put(outCaloJets);
146  iEvent.put(outVertices);
147  iEvent.put(outRho, "rho");
148  iEvent.put(outMetPt, "caloMetPt");
149  iEvent.put(outMetPhi, "caloMetPhi");
150 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
const edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
const edm::EDGetTokenT< reco::CaloMETCollection > metCollection_
Definition: DDAxes.h:10
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:113
const edm::EDGetTokenT< double > rho_

Member Data Documentation

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

Definition at line 46 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const double HLTScoutingCaloProducer::caloJetEtaCut
private

Definition at line 52 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const double HLTScoutingCaloProducer::caloJetPtCut
private

Definition at line 51 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

const bool HLTScoutingCaloProducer::doMet
private

Definition at line 54 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

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

Definition at line 48 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

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

Definition at line 49 of file HLTScoutingCaloProducer.cc.

Referenced by produce().

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

Definition at line 47 of file HLTScoutingCaloProducer.cc.

Referenced by produce().