CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::PATJetSlimmer Class Reference

Matcher of reconstructed objects to L1 Muons. More...

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

Public Member Functions

virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override final
 
 PATJetSlimmer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~PATJetSlimmer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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 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 Attributes

const StringCutObjectSelector< pat::JetdropDaughters_
 
const StringCutObjectSelector< pat::JetdropJetVars_
 
const StringCutObjectSelector< pat::JetdropSpecific_
 
const StringCutObjectSelector< pat::JetdropTagInfos_
 
const StringCutObjectSelector< pat::JetdropTrackRefs_
 
std::unique_ptr< pat::ObjectModifier< pat::Jet > > jetModifier_
 
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
 
const bool mayNeedDaughterMap_
 
const bool mixedDaughters_
 
const bool modifyJet_
 
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
 
edm::EDGetTokenT< edm::ValueMap< reco::CandidatePtr > > pf2pcAny_
 
const StringCutObjectSelector< pat::JetrekeyDaughters_
 

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

Matcher of reconstructed objects to L1 Muons.

Author
Giovanni Petrucciani

Definition at line 26 of file PATJetSlimmer.cc.

Constructor & Destructor Documentation

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

Definition at line 46 of file PATJetSlimmer.cc.

References edm::EDConsumerBase::consumesCollector(), edm::ParameterSet::getParameter(), jetModifier_, mayNeedDaughterMap_, mixedDaughters_, modifyJet_, pf2pc_, and pf2pcAny_.

46  :
48  dropJetVars_(iConfig.getParameter<std::string>("dropJetVars")),
49  dropDaughters_(iConfig.getParameter<std::string>("dropDaughters")),
50  rekeyDaughters_(iConfig.getParameter<std::string>("rekeyDaughters")),
51  dropTrackRefs_(iConfig.getParameter<std::string>("dropTrackRefs")),
52  dropSpecific_(iConfig.getParameter<std::string>("dropSpecific")),
53  dropTagInfos_(iConfig.getParameter<std::string>("dropTagInfos")),
54  modifyJet_(iConfig.getParameter<bool>("modifyJets")),
55  mayNeedDaughterMap_(iConfig.getParameter<std::string>("dropDaughters") != "1" && iConfig.getParameter<std::string>("rekeyDaughters") != "0"),
56  mixedDaughters_(iConfig.getParameter<bool>("mixedDaughters"))
57 {
58  if (mayNeedDaughterMap_) {
59  if (mixedDaughters_) {
60  pf2pcAny_ = consumes<edm::ValueMap<reco::CandidatePtr> >(iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
61  } else {
62  pf2pc_ = consumes<edm::Association<pat::PackedCandidateCollection> >(iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
63  }
64  }
66  if( modifyJet_ ) {
67  const edm::ParameterSet& mod_config = iConfig.getParameter<edm::ParameterSet>("modifierConfig");
68  jetModifier_.reset(new pat::ObjectModifier<pat::Jet>(mod_config) );
69  jetModifier_->setConsumes(sumes);
70  } else {
71  jetModifier_.reset(nullptr);
72  }
73  produces<std::vector<pat::Jet> >();
74 }
std::unique_ptr< pat::ObjectModifier< pat::Jet > > jetModifier_
T getParameter(std::string const &) const
const StringCutObjectSelector< pat::Jet > dropDaughters_
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
const StringCutObjectSelector< pat::Jet > dropTrackRefs_
edm::EDGetTokenT< edm::ValueMap< reco::CandidatePtr > > pf2pcAny_
const bool mayNeedDaughterMap_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const bool modifyJet_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const StringCutObjectSelector< pat::Jet > dropSpecific_
const StringCutObjectSelector< pat::Jet > dropTagInfos_
const StringCutObjectSelector< pat::Jet > rekeyDaughters_
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
const StringCutObjectSelector< pat::Jet > dropJetVars_
const bool mixedDaughters_
virtual pat::PATJetSlimmer::~PATJetSlimmer ( )
inlinevirtual

Definition at line 29 of file PATJetSlimmer.cc.

References beginLuminosityBlock(), iEvent, and produce().

29 { }

Member Function Documentation

void pat::PATJetSlimmer::beginLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup iSetup 
)
finaloverridevirtual

Definition at line 77 of file PATJetSlimmer.cc.

References jetModifier_, and modifyJet_.

Referenced by ~PATJetSlimmer().

77  {
78  if( modifyJet_ ) jetModifier_->setEventContent(iSetup);
79 }
std::unique_ptr< pat::ObjectModifier< pat::Jet > > jetModifier_
const bool modifyJet_
void pat::PATJetSlimmer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 82 of file PATJetSlimmer.cc.

References reco::CompositePtrCandidate::addDaughter(), pat::Jet::caloTowersFwdPtr_, edm::OwnVector< T, P >::clear(), reco::CompositePtrCandidate::clearDaughters(), pat::Jet::daughterPtrVector(), DEFINE_FWK_MODULE, dropDaughters_, dropJetVars_, dropSpecific_, dropTagInfos_, dropTrackRefs_, edm::Event::getByToken(), mps_fire::i, metsig::jet, jetModifier_, jets_, crabWrapper::key, mayNeedDaughterMap_, mixedDaughters_, modifyJet_, eostools::move(), MillePedeFileConverter_cfg::out, pf2pc_, pf2pcAny_, pat::Jet::pfCandidatesFwdPtr_, edm::Event::put(), edm::refToPtr(), rekeyDaughters_, pat::Jet::setAssociatedTracks(), reco::Jet::setNPasses(), pat::Jet::specificCalo_, pat::Jet::specificPF_, TrackRefitter_38T_cff::src, pat::Jet::tagInfoLabels_, pat::Jet::tagInfos_, and pat::Jet::tagInfosFwdPtr_.

Referenced by ~PATJetSlimmer().

82  {
83  using namespace edm;
84  using namespace std;
85 
87  iEvent.getByToken(jets_, src);
90  if (mayNeedDaughterMap_) {
91  if (mixedDaughters_) {
92  iEvent.getByToken(pf2pcAny_,pf2pcAny);
93  } else {
94  iEvent.getByToken(pf2pc_,pf2pc);
95  }
96  }
97 
98  auto out = std::make_unique<std::vector<pat::Jet>>();
99  out->reserve(src->size());
100 
101  if( modifyJet_ ) { jetModifier_->setEvent(iEvent); }
102 
103  for (edm::View<pat::Jet>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
104  out->push_back(*it);
105  pat::Jet & jet = out->back();
106 
107  if( modifyJet_ ) { jetModifier_->modify(jet); }
108 
109  if(dropTagInfos_(*it)){
110  jet.tagInfoLabels_.clear();
111  jet.tagInfos_.clear();
112  jet.tagInfosFwdPtr_.clear();
113  }
114  if (dropJetVars_(*it)) {
115  // jet.setJetArea(0);
116  jet.setNPasses(0);
117  // jet.setPileup(0);
118  }
119  if(dropTrackRefs_(*it))
120  {
122  }
123  if (dropDaughters_(*it)) {
124  jet.clearDaughters();
125  jet.pfCandidatesFwdPtr_.clear();
126  jet.caloTowersFwdPtr_.clear();
127  } else if (rekeyDaughters_(*it)) { //rekey
128  //copy old
130  jet.clearDaughters();
131  if (mixedDaughters_) {
132  std::vector<reco::CandidatePtr> ptrs;
133  for(const reco::CandidatePtr &oldptr : old) {
134  ptrs.push_back( (*pf2pcAny)[oldptr] );
135  }
136  std::sort(ptrs.begin(), ptrs.end());
137  for(const reco::CandidatePtr &newptr : ptrs) {
138  jet.addDaughter(newptr);
139  }
140  } else {
141  std::map<unsigned int,reco::CandidatePtr> ptrs;
142  for(unsigned int i=0;i<old.size();i++)
143  {
144  // jet.addDaughter(refToPtr((*pf2pc)[old[i]]));
145  ptrs[((*pf2pc)[old[i]]).key()]=refToPtr((*pf2pc)[old[i]]);
146  }
147  for(std::map<unsigned int,reco::CandidatePtr>::iterator itp=ptrs.begin();itp!=ptrs.end();itp++) //iterate on sorted items
148  {
149  jet.addDaughter(itp->second);
150  }
151  }
152  }
153  if (dropSpecific_(*it)) {
154  // FIXME add method in pat::Jet
155  jet.specificCalo_.clear();
156  jet.specificPF_.clear();
157  }
158  // if (dropJetCorrFactors_(*it)) {
159  // // FIXME add method in pat::Jet
160  // jet.jetEnergyCorrections_.clear();
161  // }
162  }
163 
164  iEvent.put(std::move(out));
165 }
std::unique_ptr< pat::ObjectModifier< pat::Jet > > jetModifier_
const StringCutObjectSelector< pat::Jet > dropDaughters_
CaloTowerFwdPtrVector caloTowersFwdPtr_
Definition: Jet.h:545
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
TagInfoFwdPtrCollection tagInfosFwdPtr_
Definition: Jet.h:586
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
const StringCutObjectSelector< pat::Jet > dropTrackRefs_
edm::EDGetTokenT< edm::ValueMap< reco::CandidatePtr > > pf2pcAny_
const bool mayNeedDaughterMap_
std::vector< PFSpecific > specificPF_
Definition: Jet.h:598
const bool modifyJet_
edm::OwnVector< reco::BaseTagInfo > tagInfos_
Definition: Jet.h:585
std::vector< CaloSpecific > specificCalo_
Definition: Jet.h:596
void clear()
Definition: OwnVector.h:445
const StringCutObjectSelector< pat::Jet > dropSpecific_
const StringCutObjectSelector< pat::Jet > dropTagInfos_
std::vector< std::string > tagInfoLabels_
Definition: Jet.h:584
std::vector< CandidatePtr > daughters
collection of references to daughters
const StringCutObjectSelector< pat::Jet > rekeyDaughters_
void setAssociatedTracks(const reco::TrackRefVector &tracks)
method to set the vector of refs to the tracks associated to this jet
Analysis-level calorimeter jet class.
Definition: Jet.h:80
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
void clearDaughters()
clear daughter references
const StringCutObjectSelector< pat::Jet > dropJetVars_
virtual void setNPasses(int fPasses)
Set number of passes taken by algorithm.
Definition: Jet.h:113
HLT enums.
reco::PFCandidateFwdPtrVector pfCandidatesFwdPtr_
Definition: Jet.h:551
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
const bool mixedDaughters_
void addDaughter(const CandidatePtr &)
add a daughter via a reference
const reco::CompositePtrCandidate::daughters & daughterPtrVector() const override
references to daughtes
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropDaughters_
private

Definition at line 38 of file PATJetSlimmer.cc.

Referenced by produce().

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropJetVars_
private

Definition at line 38 of file PATJetSlimmer.cc.

Referenced by produce().

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropSpecific_
private

Definition at line 38 of file PATJetSlimmer.cc.

Referenced by produce().

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropTagInfos_
private

Definition at line 38 of file PATJetSlimmer.cc.

Referenced by produce().

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropTrackRefs_
private

Definition at line 38 of file PATJetSlimmer.cc.

Referenced by produce().

std::unique_ptr<pat::ObjectModifier<pat::Jet> > pat::PATJetSlimmer::jetModifier_
private

Definition at line 40 of file PATJetSlimmer.cc.

Referenced by beginLuminosityBlock(), PATJetSlimmer(), and produce().

const edm::EDGetTokenT<edm::View<pat::Jet> > pat::PATJetSlimmer::jets_
private

Definition at line 37 of file PATJetSlimmer.cc.

Referenced by produce().

const bool pat::PATJetSlimmer::mayNeedDaughterMap_
private

Definition at line 39 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer(), and produce().

const bool pat::PATJetSlimmer::mixedDaughters_
private

Definition at line 39 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer(), and produce().

const bool pat::PATJetSlimmer::modifyJet_
private

Definition at line 39 of file PATJetSlimmer.cc.

Referenced by beginLuminosityBlock(), PATJetSlimmer(), and produce().

edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection> > pat::PATJetSlimmer::pf2pc_
private

Definition at line 35 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer(), and produce().

edm::EDGetTokenT<edm::ValueMap<reco::CandidatePtr> > pat::PATJetSlimmer::pf2pcAny_
private

Definition at line 36 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer(), and produce().

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::rekeyDaughters_
private

Definition at line 38 of file PATJetSlimmer.cc.

Referenced by produce().