test
CMS 3D CMS Logo

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

Slimmer of PAT METs. More...

Inheritance diagram for pat::PATMETSlimmer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  OneMETShift
 

Public Member Functions

 PATMETSlimmer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
virtual ~PATMETSlimmer ()
 
- 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void maybeReadShifts (const edm::ParameterSet &basePSet, const std::string &name, pat::MET::METUncertaintyLevel level)
 

Private Attributes

std::vector< OneMETShiftshifts_
 
edm::EDGetTokenT
< pat::METCollection
src_
 

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

Slimmer of PAT METs.

Definition at line 19 of file PATMETSlimmer.cc.

Constructor & Destructor Documentation

pat::PATMETSlimmer::PATMETSlimmer ( const edm::ParameterSet iConfig)
explicit

Definition at line 43 of file PATMETSlimmer.cc.

References maybeReadShifts(), pat::MET::Raw, pat::MET::Type1, and pat::MET::Type1p2.

43  :
44  src_(consumes<pat::METCollection>(iConfig.getParameter<edm::InputTag>("src")))
45 {
46  maybeReadShifts( iConfig, "rawUncertainties", pat::MET::Raw );
47  maybeReadShifts( iConfig, "type1Uncertainties", pat::MET::Type1 );
48  maybeReadShifts( iConfig, "type1p2Uncertainties", pat::MET::Type1p2 );
49  produces<std::vector<pat::MET> >();
50 }
T getParameter(std::string const &) const
void maybeReadShifts(const edm::ParameterSet &basePSet, const std::string &name, pat::MET::METUncertaintyLevel level)
edm::EDGetTokenT< pat::METCollection > src_
virtual pat::PATMETSlimmer::~PATMETSlimmer ( )
inlinevirtual

Definition at line 22 of file PATMETSlimmer.cc.

22 { }

Member Function Documentation

void pat::PATMETSlimmer::maybeReadShifts ( const edm::ParameterSet basePSet,
const std::string &  name,
pat::MET::METUncertaintyLevel  level 
)
private

Definition at line 52 of file PATMETSlimmer.cc.

References pat::MET::ElectronEnDown, pat::MET::ElectronEnUp, edm::hlt::Exception, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), pat::MET::JetEnDown, pat::MET::JetEnUp, pat::MET::JetResDown, pat::MET::JetResUp, pat::MET::MuonEnDown, pat::MET::MuonEnUp, mergeVDriftHistosByStation::name, pat::MET::TauEnDown, pat::MET::TauEnUp, pat::MET::UnclusteredEnDown, and pat::MET::UnclusteredEnUp.

Referenced by PATMETSlimmer().

52  {
53  if (basePSet.existsAs<edm::ParameterSet>(name)) {
54  throw cms::Exception("Unsupported", "Reading PSets not supported, for now just use input tag");
55  } else if (basePSet.existsAs<edm::InputTag>(name)) {
56  const edm::InputTag & baseTag = basePSet.getParameter<edm::InputTag>(name);
57  shifts_.push_back(OneMETShift(pat::MET::JetEnUp, level, baseTag, consumesCollector()));
58  shifts_.push_back(OneMETShift(pat::MET::JetEnDown, level, baseTag, consumesCollector()));
59  shifts_.push_back(OneMETShift(pat::MET::JetResUp, level, baseTag, consumesCollector()));
60  shifts_.push_back(OneMETShift(pat::MET::JetResDown, level, baseTag, consumesCollector()));
61  shifts_.push_back(OneMETShift(pat::MET::MuonEnUp, level, baseTag, consumesCollector()));
62  shifts_.push_back(OneMETShift(pat::MET::MuonEnDown, level, baseTag, consumesCollector()));
63  shifts_.push_back(OneMETShift(pat::MET::ElectronEnUp, level, baseTag, consumesCollector()));
64  shifts_.push_back(OneMETShift(pat::MET::ElectronEnDown, level, baseTag, consumesCollector()));
65  shifts_.push_back(OneMETShift(pat::MET::TauEnUp, level, baseTag, consumesCollector()));
66  shifts_.push_back(OneMETShift(pat::MET::TauEnDown, level, baseTag, consumesCollector()));
67  shifts_.push_back(OneMETShift(pat::MET::UnclusteredEnUp, level, baseTag, consumesCollector()));
68  shifts_.push_back(OneMETShift(pat::MET::UnclusteredEnDown, level, baseTag, consumesCollector()));
69  }
70 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< OneMETShift > shifts_
tuple level
Definition: testEve_cfg.py:34
void pat::PATMETSlimmer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 96 of file PATMETSlimmer.cc.

References edm::Event::getByToken(), CaloMET_cfi::met, dbtoconf::out, edm::Event::put(), edm::shift, shifts_, alcazmumu_cfi::src, and src_.

96  {
97  using namespace edm;
98  using namespace std;
99 
101  iEvent.getByToken(src_, src);
102  if (src->size() != 1) throw cms::Exception("CorruptData", "More than one MET in the collection");
103 
104  auto_ptr<vector<pat::MET> > out(new vector<pat::MET>(1, src->front()));
105  pat::MET & met = out->back();
106  for (OneMETShift &shift : shifts_) {
107  shift.readAndSet(iEvent, met);
108  }
109 
110  iEvent.put(out);
111 }
Analysis-level MET class.
Definition: MET.h:42
tuple met
____________________________________________________________________________||
Definition: CaloMET_cfi.py:4
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< pat::METCollection > src_
tuple out
Definition: dbtoconf.py:99
static unsigned int const shift
std::vector< OneMETShift > shifts_

Member Data Documentation

std::vector<OneMETShift> pat::PATMETSlimmer::shifts_
private

Definition at line 38 of file PATMETSlimmer.cc.

Referenced by produce().

edm::EDGetTokenT<pat::METCollection> pat::PATMETSlimmer::src_
private

Definition at line 37 of file PATMETSlimmer.cc.

Referenced by produce().