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

Public Member Functions

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

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Matcher of reconstructed objects to L1 Muons.

Author
Giovanni Petrucciani

Definition at line 26 of file PATJetSlimmer.cc.

Constructor & Destructor Documentation

◆ PATJetSlimmer()

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

Definition at line 46 of file PATJetSlimmer.cc.

47  : jets_(consumes<edm::View<pat::Jet>>(iConfig.getParameter<edm::InputTag>("src"))),
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" &&
56  iConfig.getParameter<std::string>("rekeyDaughters") != "0"),
57  mixedDaughters_(iConfig.getParameter<bool>("mixedDaughters")) {
58  if (mayNeedDaughterMap_) {
59  if (mixedDaughters_) {
60  pf2pcAny_ =
61  consumes<edm::ValueMap<reco::CandidatePtr>>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
62  } else {
63  pf2pc_ = consumes<edm::Association<pat::PackedCandidateCollection>>(
64  iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
65  }
66  }
67  if (modifyJet_) {
68  const edm::ParameterSet& mod_config = iConfig.getParameter<edm::ParameterSet>("modifierConfig");
69  jetModifier_ = std::make_unique<pat::ObjectModifier<pat::Jet>>(mod_config, consumesCollector());
70  }
71  produces<std::vector<pat::Jet>>();
72 }

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

◆ ~PATJetSlimmer()

pat::PATJetSlimmer::~PATJetSlimmer ( )
inlineoverride

Definition at line 29 of file PATJetSlimmer.cc.

29 {}

Member Function Documentation

◆ beginLuminosityBlock()

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

Definition at line 74 of file PATJetSlimmer.cc.

74  {
75  if (modifyJet_)
76  jetModifier_->setEventContent(iSetup);
77 }

◆ produce()

void pat::PATJetSlimmer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 79 of file PATJetSlimmer.cc.

79  {
80  using namespace edm;
81  using namespace std;
82 
84  iEvent.getByToken(jets_, src);
87  if (mayNeedDaughterMap_) {
88  if (mixedDaughters_) {
89  iEvent.getByToken(pf2pcAny_, pf2pcAny);
90  } else {
91  iEvent.getByToken(pf2pc_, pf2pc);
92  }
93  }
94 
95  auto out = std::make_unique<std::vector<pat::Jet>>();
96  out->reserve(src->size());
97 
98  if (modifyJet_) {
99  jetModifier_->setEvent(iEvent);
100  }
101 
102  for (edm::View<pat::Jet>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
103  out->push_back(*it);
104  pat::Jet& jet = out->back();
105 
106  if (modifyJet_) {
107  jetModifier_->modify(jet);
108  }
109 
110  if (dropTagInfos_(*it)) {
111  jet.tagInfoLabels_.clear();
112  jet.tagInfos_.clear();
113  jet.tagInfosFwdPtr_.clear();
114  }
115  if (dropJetVars_(*it)) {
116  // jet.setJetArea(0);
117  jet.setNPasses(0);
118  // jet.setPileup(0);
119  }
120  if (dropTrackRefs_(*it)) {
121  jet.setAssociatedTracks(reco::TrackRefVector());
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
129  reco::CompositePtrCandidate::daughters old = jet.daughterPtrVector();
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  // jet.addDaughter(refToPtr((*pf2pc)[old[i]]));
144  ptrs[((*pf2pc)[old[i]]).key()] = refToPtr((*pf2pc)[old[i]]);
145  }
146  for (std::map<unsigned int, reco::CandidatePtr>::iterator itp = ptrs.begin(); itp != ptrs.end();
147  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 }

References mps_fire::i, iEvent, metsig::jet, crabWrapper::key, eostools::move(), MillePedeFileConverter_cfg::out, edm::refToPtr(), jetUpdater_cfi::sort, and TrackRefitter_38T_cff::src.

Member Data Documentation

◆ dropDaughters_

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

Definition at line 38 of file PATJetSlimmer.cc.

◆ dropJetVars_

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

Definition at line 38 of file PATJetSlimmer.cc.

◆ dropSpecific_

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

Definition at line 38 of file PATJetSlimmer.cc.

◆ dropTagInfos_

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

Definition at line 38 of file PATJetSlimmer.cc.

◆ dropTrackRefs_

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

Definition at line 38 of file PATJetSlimmer.cc.

◆ jetModifier_

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

Definition at line 41 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ jets_

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

Definition at line 37 of file PATJetSlimmer.cc.

◆ mayNeedDaughterMap_

const bool pat::PATJetSlimmer::mayNeedDaughterMap_
private

Definition at line 40 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ mixedDaughters_

const bool pat::PATJetSlimmer::mixedDaughters_
private

Definition at line 40 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ modifyJet_

const bool pat::PATJetSlimmer::modifyJet_
private

Definition at line 40 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ pf2pc_

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

Definition at line 35 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ pf2pcAny_

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

Definition at line 36 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ rekeyDaughters_

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

Definition at line 38 of file PATJetSlimmer.cc.

mps_fire.i
i
Definition: mps_fire.py:428
pat::PATJetSlimmer::mayNeedDaughterMap_
const bool mayNeedDaughterMap_
Definition: PATJetSlimmer.cc:40
pat::PATJetSlimmer::jets_
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
Definition: PATJetSlimmer.cc:37
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::RefVector< TrackCollection >
edm::Handle
Definition: AssociativeIterator.h:50
pat::PATJetSlimmer::pf2pcAny_
edm::EDGetTokenT< edm::ValueMap< reco::CandidatePtr > > pf2pcAny_
Definition: PATJetSlimmer.cc:36
edm::refToPtr
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
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
pat::PATJetSlimmer::dropSpecific_
const StringCutObjectSelector< pat::Jet > dropSpecific_
Definition: PATJetSlimmer.cc:38
edm::View
Definition: CaloClusterFwd.h:14
edm::ParameterSet
Definition: ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
pat::PATJetSlimmer::pf2pc_
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
Definition: PATJetSlimmer.cc:35
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::PATJetSlimmer::dropJetVars_
const StringCutObjectSelector< pat::Jet > dropJetVars_
Definition: PATJetSlimmer.cc:38
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::CompositePtrCandidate::daughters
std::vector< CandidatePtr > daughters
collection of references to daughters
Definition: CompositePtrCandidate.h:20
edm::Ptr< Candidate >
pat::PATJetSlimmer::dropTagInfos_
const StringCutObjectSelector< pat::Jet > dropTagInfos_
Definition: PATJetSlimmer.cc:38
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
pat::PATJetSlimmer::mixedDaughters_
const bool mixedDaughters_
Definition: PATJetSlimmer.cc:40
metsig::jet
Definition: SignAlgoResolutions.h:47
pat::PATJetSlimmer::modifyJet_
const bool modifyJet_
Definition: PATJetSlimmer.cc:40
pat::PATJetSlimmer::jetModifier_
std::unique_ptr< pat::ObjectModifier< pat::Jet > > jetModifier_
Definition: PATJetSlimmer.cc:41
pat::PATJetSlimmer::dropDaughters_
const StringCutObjectSelector< pat::Jet > dropDaughters_
Definition: PATJetSlimmer.cc:38
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
crabWrapper.key
key
Definition: crabWrapper.py:19
pat::PATJetSlimmer::dropTrackRefs_
const StringCutObjectSelector< pat::Jet > dropTrackRefs_
Definition: PATJetSlimmer.cc:38
edm::InputTag
Definition: InputTag.h:15
pat::PATJetSlimmer::rekeyDaughters_
const StringCutObjectSelector< pat::Jet > rekeyDaughters_
Definition: PATJetSlimmer.cc:38