CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  OneMETShift
 

Public Member Functions

 PATMETSlimmer (const edm::ParameterSet &iConfig)
 
void produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
 ~PATMETSlimmer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void maybeReadShifts (const edm::ParameterSet &basePSet, const std::string &name, pat::MET::METCorrectionType level, bool readFromMiniAOD=false)
 

Private Attributes

const bool onMiniAOD_
 
std::vector< OneMETShiftshifts_
 
const edm::EDGetTokenT< pat::METCollectionsrc_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Slimmer of PAT METs.

Definition at line 18 of file PATMETSlimmer.cc.

Constructor & Destructor Documentation

◆ PATMETSlimmer()

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

Definition at line 67 of file PATMETSlimmer.cc.

68  : src_(consumes<pat::METCollection>(iConfig.getParameter<edm::InputTag>("src"))),
69  onMiniAOD_(iConfig.existsAs<bool>("runningOnMiniAOD") ? iConfig.getParameter<bool>("runningOnMiniAOD") : false) {
70  maybeReadShifts(iConfig, "rawVariation", pat::MET::None);
71  maybeReadShifts(iConfig, "t1Uncertainties", pat::MET::T1);
72  maybeReadShifts(iConfig, "t01Variation", pat::MET::T0, onMiniAOD_);
73  maybeReadShifts(iConfig, "t1SmearedVarsAndUncs", pat::MET::Smear);
74 
75  maybeReadShifts(iConfig, "tXYUncForRaw", pat::MET::TXYForRaw);
76  maybeReadShifts(iConfig, "tXYUncForT1", pat::MET::TXY);
77  maybeReadShifts(iConfig, "tXYUncForT01", pat::MET::TXYForT01);
78  maybeReadShifts(iConfig, "tXYUncForT1Smear", pat::MET::TXYForT1Smear);
79  maybeReadShifts(iConfig, "tXYUncForT01Smear", pat::MET::TXYForT01Smear);
80  maybeReadShifts(iConfig, "caloMET", pat::MET::Calo);
81  maybeReadShifts(iConfig, "chsMET", pat::MET::Chs);
82  maybeReadShifts(iConfig, "trkMET", pat::MET::Trk);
83  if (iConfig.getParameter<bool>("addDeepMETs")) {
84  maybeReadShifts(iConfig, "deepMETResolutionTune", pat::MET::DeepResolutionTune);
85  maybeReadShifts(iConfig, "deepMETResponseTune", pat::MET::DeepResponseTune);
86  }
87 
88  produces<std::vector<pat::MET>>();
89 }

References pat::MET::Calo, pat::MET::Chs, pat::MET::DeepResolutionTune, pat::MET::DeepResponseTune, edm::ParameterSet::getParameter(), maybeReadShifts(), pat::MET::None, onMiniAOD_, pat::MET::Smear, pat::MET::T0, pat::MET::T1, pat::MET::Trk, pat::MET::TXY, pat::MET::TXYForRaw, pat::MET::TXYForT01, pat::MET::TXYForT01Smear, and pat::MET::TXYForT1Smear.

◆ ~PATMETSlimmer()

pat::PATMETSlimmer::~PATMETSlimmer ( )
inlineoverride

Definition at line 21 of file PATMETSlimmer.cc.

21 {}

Member Function Documentation

◆ maybeReadShifts()

void pat::PATMETSlimmer::maybeReadShifts ( const edm::ParameterSet basePSet,
const std::string &  name,
pat::MET::METCorrectionType  level,
bool  readFromMiniAOD = false 
)
private

Definition at line 91 of file PATMETSlimmer.cc.

94  {
95  if (basePSet.existsAs<edm::ParameterSet>(name)) {
96  throw cms::Exception("Unsupported", "Reading PSets not supported, for now just use input tag");
97  } else if (basePSet.existsAs<edm::InputTag>(name)) {
98  const edm::InputTag &baseTag = basePSet.getParameter<edm::InputTag>(name);
99 
100  if (level == pat::MET::T1) {
101  shifts_.push_back(
102  OneMETShift(pat::MET::NoShift, level, baseTag, consumesCollector(), readFromMiniAOD, true, false, false));
103  shifts_.push_back(
104  OneMETShift(pat::MET::NoShift, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
105  shifts_.push_back(
106  OneMETShift(pat::MET::JetResUp, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
107  shifts_.push_back(
108  OneMETShift(pat::MET::JetResDown, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
109  shifts_.push_back(
110  OneMETShift(pat::MET::JetEnUp, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
111  shifts_.push_back(
112  OneMETShift(pat::MET::JetEnDown, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
113  shifts_.push_back(
114  OneMETShift(pat::MET::MuonEnUp, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
115  shifts_.push_back(
116  OneMETShift(pat::MET::MuonEnDown, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
117  shifts_.push_back(
118  OneMETShift(pat::MET::ElectronEnUp, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
119  shifts_.push_back(
120  OneMETShift(pat::MET::ElectronEnDown, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
121  shifts_.push_back(
122  OneMETShift(pat::MET::PhotonEnUp, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
123  shifts_.push_back(
124  OneMETShift(pat::MET::PhotonEnDown, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
125  shifts_.push_back(
126  OneMETShift(pat::MET::TauEnUp, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
127  shifts_.push_back(
128  OneMETShift(pat::MET::TauEnDown, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
129  shifts_.push_back(
130  OneMETShift(pat::MET::UnclusteredEnUp, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
131  shifts_.push_back(
132  OneMETShift(pat::MET::UnclusteredEnDown, level, baseTag, consumesCollector(), readFromMiniAOD, false, true));
133  } else if (level == pat::MET::Smear) {
134  shifts_.push_back(
135  OneMETShift(pat::MET::NoShift, level, baseTag, consumesCollector(), readFromMiniAOD, true, false, true));
136  shifts_.push_back(
137  OneMETShift(pat::MET::JetResUp, level, baseTag, consumesCollector(), readFromMiniAOD, false, true, true));
138  shifts_.push_back(
139  OneMETShift(pat::MET::JetResDown, level, baseTag, consumesCollector(), readFromMiniAOD, false, true, true));
140  } else {
141  shifts_.push_back(
142  OneMETShift(pat::MET::NoShift, level, baseTag, consumesCollector(), readFromMiniAOD, true, false));
143  }
144  }
145 }

References pat::MET::ElectronEnDown, pat::MET::ElectronEnUp, Exception, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), pat::MET::JetEnDown, pat::MET::JetEnUp, pat::MET::JetResDown, pat::MET::JetResUp, personalPlayback::level, pat::MET::MuonEnDown, pat::MET::MuonEnUp, Skims_PA_cff::name, pat::MET::NoShift, pat::MET::PhotonEnDown, pat::MET::PhotonEnUp, pat::MET::Smear, pat::MET::T1, pat::MET::TauEnDown, pat::MET::TauEnUp, pat::MET::UnclusteredEnDown, and pat::MET::UnclusteredEnUp.

Referenced by PATMETSlimmer().

◆ produce()

void pat::PATMETSlimmer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 215 of file PATMETSlimmer.cc.

215  {
216  using namespace edm;
217  using namespace std;
218 
220  iEvent.getByToken(src_, src);
221  if (src->size() != 1)
222  throw cms::Exception("CorruptData", "More than one MET in the collection");
223 
224  auto out = std::make_unique<std::vector<pat::MET>>(1, src->front());
225  pat::MET &met = out->back();
226 
227  for (const OneMETShift &shift : shifts_) {
228  shift.readAndSet(iEvent, met);
229  }
230 
231  iEvent.put(std::move(out));
232 }

References iEvent, BTaggingMonitor_cfi::met, eostools::move(), MillePedeFileConverter_cfg::out, edm::shift, shifts_, TrackRefitter_38T_cff::src, and src_.

Member Data Documentation

◆ onMiniAOD_

const bool pat::PATMETSlimmer::onMiniAOD_
private

Definition at line 62 of file PATMETSlimmer.cc.

Referenced by PATMETSlimmer().

◆ shifts_

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

Definition at line 60 of file PATMETSlimmer.cc.

Referenced by produce().

◆ src_

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

Definition at line 59 of file PATMETSlimmer.cc.

Referenced by produce().

personalPlayback.level
level
Definition: personalPlayback.py:22
pat::MET::Smear
Definition: MET.h:200
pat::MET::TXYForT01Smear
Definition: MET.h:199
pat::MET::DeepResolutionTune
Definition: MET.h:205
pat::PATMETSlimmer::shifts_
std::vector< OneMETShift > shifts_
Definition: PATMETSlimmer.cc:60
pat::MET::JetEnDown
Definition: MET.h:156
pat::PATMETSlimmer::maybeReadShifts
void maybeReadShifts(const edm::ParameterSet &basePSet, const std::string &name, pat::MET::METCorrectionType level, bool readFromMiniAOD=false)
Definition: PATMETSlimmer.cc:91
edm
HLT enums.
Definition: AlignableModifier.h:19
pat::MET::PhotonEnDown
Definition: MET.h:166
pat::MET::T1
Definition: MET.h:193
pat::MET::Trk
Definition: MET.h:203
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:46
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
pat::MET::TXYForT1Smear
Definition: MET.h:198
edm::Handle
Definition: AssociativeIterator.h:50
pat::MET::TauEnDown
Definition: MET.h:162
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
pat::MET::JetResUp
Definition: MET.h:153
pat::MET::PhotonEnUp
Definition: MET.h:165
pat::MET::TXYForT01
Definition: MET.h:197
pat::MET::TauEnUp
Definition: MET.h:161
pat::MET::ElectronEnDown
Definition: MET.h:160
pat::MET::Chs
Definition: MET.h:202
pat::MET::JetResDown
Definition: MET.h:154
edm::ParameterSet
Definition: ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::MET
Analysis-level MET class.
Definition: MET.h:40
pat::MET::MuonEnDown
Definition: MET.h:158
pat::MET::ElectronEnUp
Definition: MET.h:159
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
pat::MET::NoShift
Definition: MET.h:167
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
pat::PATMETSlimmer::src_
const edm::EDGetTokenT< pat::METCollection > src_
Definition: PATMETSlimmer.cc:59
pat::MET::TXY
Definition: MET.h:195
pat::MET::T0
Definition: MET.h:194
pat::MET::None
Definition: MET.h:192
Exception
Definition: hltDiff.cc:246
pat::PATMETSlimmer::onMiniAOD_
const bool onMiniAOD_
Definition: PATMETSlimmer.cc:62
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
pat::MET::UnclusteredEnUp
Definition: MET.h:163
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
pat::MET::JetEnUp
Definition: MET.h:155
pat::MET::MuonEnUp
Definition: MET.h:157
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
cms::Exception
Definition: Exception.h:70
pat::MET::UnclusteredEnDown
Definition: MET.h:164
pat::MET::TXYForRaw
Definition: MET.h:196
edm::InputTag
Definition: InputTag.h:15
pat::MET::DeepResponseTune
Definition: MET.h:204
pat::MET::Calo
Definition: MET.h:201