CMS 3D CMS Logo

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

#include <SysShiftMETcorrInputProducer.h>

Inheritance diagram for SysShiftMETcorrInputProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 SysShiftMETcorrInputProducer (const edm::ParameterSet &)
 
 ~SysShiftMETcorrInputProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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 & itemsToGetFrom (BranchType iType) 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)
 

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::VertexCollectionverticesToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 
)
private

Definition at line 46 of file SysShiftMETcorrInputProducer.cc.

References corrPx_, corrPy_, DEFINE_FWK_MODULE, edm::Event::getByToken(), RazorAnalyzer::met, eostools::move(), edm::Event::put(), objects.METAnalyzer::sumEt, token_, useNvtx, ecalDrivenElectronSeedsParameters_cff::vertices, and verticesToken_.

47 {
48  //std::cout << "<SysShiftMETcorrInputProducer::produce>:" << std::endl;
49 
50  typedef edm::View<reco::MET> METView;
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::unique_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(std::move(metCorr));
75 }
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:460
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
edm::EDGetTokenT< edm::View< reco::MET > > token_
met
===> hadronic RAZOR
a MET correction term
Definition: CorrMETData.h:14
def move(src, dest)
Definition: eostools.py:510

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().