CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SysShiftMETcorrInputProducer Class Reference

#include <SysShiftMETcorrInputProducer.h>

Inheritance diagram for SysShiftMETcorrInputProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 SysShiftMETcorrInputProducer (const edm::ParameterSet &)
 
 ~SysShiftMETcorrInputProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

TFormula * corrPx_
 
TFormula * corrPy_
 
std::string moduleLabel_
 
edm::EDGetTokenT< edm::View
< reco::MET > > 
token_
 
bool useNvtx
 
edm::EDGetTokenT
< reco::VertexCollection
verticesToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Compute MET correction to compensate systematic shift of MET in x/y-direction (cf. https://indico.cern.ch/getFile.py/access?contribId=1&resId=0&materialId=slides&confId=174318 )

Authors
Christian Veelken, LLR

Definition at line 28 of file SysShiftMETcorrInputProducer.h.

Constructor & Destructor Documentation

SysShiftMETcorrInputProducer::SysShiftMETcorrInputProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 11 of file SysShiftMETcorrInputProducer.cc.

References corrPx_, corrPy_, data, edm::ParameterSet::getParameter(), moduleLabel_, AlCaHLTBitMon_QueryRunRegistry::string, token_, useNvtx, and verticesToken_.

12  : moduleLabel_(cfg.getParameter<std::string>("@module_label")),
13  useNvtx(false),
14  corrPx_(0),
15  corrPy_(0)
16 {
17  token_ = consumes<edm::View<reco::MET> >(cfg.getParameter<edm::InputTag>("src"));
18 
19  edm::ParameterSet cfgCorrParameter = cfg.getParameter<edm::ParameterSet>("parameter");
20  TString corrPxFormula = cfgCorrParameter.getParameter<std::string>("px");
21  TString corrPyFormula = cfgCorrParameter.getParameter<std::string>("py").data();
22  if ( corrPxFormula.Contains("Nvtx") || corrPyFormula.Contains("Nvtx") )
23  {
24  useNvtx = true,
25  verticesToken_ = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("srcVertices"));
26  }
27 
28  corrPxFormula.ReplaceAll("sumEt", "x");
29  corrPxFormula.ReplaceAll("Nvtx", "y");
30  std::string corrPxName = std::string(moduleLabel_).append("_corrPx");
31  corrPx_ = new TFormula(corrPxName.data(), corrPxFormula.Data());
32 
33  corrPyFormula.ReplaceAll("sumEt", "x");
34  corrPyFormula.ReplaceAll("Nvtx", "y");
35  std::string corrPyName = std::string(moduleLabel_).append("_corrPy");
36  corrPy_ = new TFormula(corrPyName.data(), corrPyFormula.Data());
37 
38  produces<CorrMETData>();
39 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
edm::EDGetTokenT< edm::View< reco::MET > > token_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
SysShiftMETcorrInputProducer::~SysShiftMETcorrInputProducer ( )

Definition at line 41 of file SysShiftMETcorrInputProducer.cc.

42 {
43 // nothing to be done yet...
44 }

Member Function Documentation

void SysShiftMETcorrInputProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 46 of file SysShiftMETcorrInputProducer.cc.

References corrPx_, corrPy_, edm::Event::getByToken(), objects.METAnalyzer::met, edm::Event::put(), token_, useNvtx, HLT_25ns14e33_v1_cff::vertices, and verticesToken_.

47 {
48  //std::cout << "<SysShiftMETcorrInputProducer::produce>:" << std::endl;
49 
52  evt.getByToken(token_, met);
53  if ( met->size() != 1 )
54  throw cms::Exception("SysShiftMETcorrInputProducer::produce")
55  << "Failed to find unique MET object !!\n";
56 
57  double sumEt = met->front().sumEt();
58  //std::cout << " sumEt = " << sumEt << std::endl;
59 
60  size_t Nvtx = 0;
61  if ( useNvtx )
62  {
64  evt.getByToken(verticesToken_, vertices);
65  Nvtx = vertices->size();
66  }
67  //std::cout << " Nvtx = " << Nvtx << std::endl;
68 
69  std::auto_ptr<CorrMETData> metCorr(new CorrMETData());
70  metCorr->mex = -corrPx_->Eval(sumEt, Nvtx);
71  metCorr->mey = -corrPy_->Eval(sumEt, Nvtx);
72  //std::cout << "--> metCorr: Px = " << metCorr->mex << ", Py = " << metCorr->mey << std::endl;
73 
74  evt.put(metCorr);
75 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
edm::EDGetTokenT< edm::View< reco::MET > > token_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
edm::View< reco::MET > METView
a MET correction term
Definition: CorrMETData.h:14

Member Data Documentation

TFormula* SysShiftMETcorrInputProducer::corrPx_
private

Definition at line 46 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().

TFormula* SysShiftMETcorrInputProducer::corrPy_
private

Definition at line 47 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().

std::string SysShiftMETcorrInputProducer::moduleLabel_
private
edm::EDGetTokenT<edm::View<reco::MET> > SysShiftMETcorrInputProducer::token_
private

Definition at line 41 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().

bool SysShiftMETcorrInputProducer::useNvtx
private

Definition at line 44 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().

edm::EDGetTokenT<reco::VertexCollection> SysShiftMETcorrInputProducer::verticesToken_
private

Definition at line 42 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().